Skip to content

Commit 041c983

Browse files
committed
Merge branch 'v0.4'
Conflicts: deps/libev/wscript doc/api/modules.markdown
2 parents ab0d881 + 8caf7fd commit 041c983

42 files changed

Lines changed: 496 additions & 71 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

deps/v8/src/v8natives.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ function GlobalEval(x) {
157157
}
158158

159159

160+
// execScript for IE compatibility.
161+
function GlobalExecScript(expr, lang) {
162+
// NOTE: We don't care about the character casing.
163+
if (!lang || /javascript/i.test(lang)) {
164+
var f = %CompileString(ToString(expr));
165+
f.call(%GlobalReceiver(global));
166+
}
167+
return null;
168+
}
169+
170+
160171
// ----------------------------------------------------------------------------
161172

162173

@@ -176,7 +187,8 @@ function SetupGlobal() {
176187
"isFinite", GlobalIsFinite,
177188
"parseInt", GlobalParseInt,
178189
"parseFloat", GlobalParseFloat,
179-
"eval", GlobalEval
190+
"eval", GlobalEval,
191+
"execScript", GlobalExecScript
180192
));
181193
}
182194

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2008 the V8 project authors. All rights reserved.
2+
// Redistribution and use in source and binary forms, with or without
3+
// modification, are permitted provided that the following conditions are
4+
// met:
5+
//
6+
// * Redistributions of source code must retain the above copyright
7+
// notice, this list of conditions and the following disclaimer.
8+
// * Redistributions in binary form must reproduce the above
9+
// copyright notice, this list of conditions and the following
10+
// disclaimer in the documentation and/or other materials provided
11+
// with the distribution.
12+
// * Neither the name of Google Inc. nor the names of its
13+
// contributors may be used to endorse or promote products derived
14+
// from this software without specific prior written permission.
15+
//
16+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
28+
var x = 0;
29+
execScript('x = 1', 'javascript');
30+
assertEquals(1, x);
31+
32+
execScript('x = 2', 'JavaScript');
33+
assertEquals(2, x);
34+

deps/v8/test/mjsunit/function-names.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ var globalFunctions = [
128128
"encodeURI", "encodeURIComponent", "Error", "TypeError",
129129
"RangeError", "SyntaxError", "ReferenceError", "EvalError",
130130
"URIError", "isNaN", "isFinite", "parseInt", "parseFloat",
131-
"eval"];
131+
"eval", "execScript"];
132132

133133
TestFunctionNames(this, globalFunctions);
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2008 the V8 project authors. All rights reserved.
2+
// Redistribution and use in source and binary forms, with or without
3+
// modification, are permitted provided that the following conditions are
4+
// met:
5+
//
6+
// * Redistributions of source code must retain the above copyright
7+
// notice, this list of conditions and the following disclaimer.
8+
// * Redistributions in binary form must reproduce the above
9+
// copyright notice, this list of conditions and the following
10+
// disclaimer in the documentation and/or other materials provided
11+
// with the distribution.
12+
// * Neither the name of Google Inc. nor the names of its
13+
// contributors may be used to endorse or promote products derived
14+
// from this software without specific prior written permission.
15+
//
16+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
28+
// Make sure that 'this' is bound to the global object when using
29+
// execScript.
30+
31+
var result;
32+
execScript("result = this");
33+
assertTrue(result === this);

doc/api/buffers.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ method. Here are the different string encodings;
1616

1717
* `'ascii'` - for 7 bit ASCII data only. This encoding method is very fast, and will
1818
strip the high bit if set.
19+
Note that this encoding converts a null character (`'\0'` or `'\u0000'`) into
20+
`0x20` (character code of a space). If you want to convert a null character
21+
into `0x00`, you should use `'utf8'`.
1922

2023
* `'utf8'` - Multi byte encoded Unicode characters. Many web pages and other document formats use UTF-8.
2124

doc/api/fs.markdown

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,27 @@ Synchronous close(2).
255255

256256
### fs.open(path, flags, [mode], [callback])
257257

258-
Asynchronous file open. See open(2). Flags can be 'r', 'r+', 'w', 'w+', 'a',
259-
or 'a+'. `mode` defaults to 0666. The callback gets two arguments `(err, fd)`.
258+
Asynchronous file open. See open(2). `flags` can be:
259+
260+
* `'r'` - Open file for reading.
261+
An exception occurs if the file does not exist.
262+
263+
* `'r+'` - Open file for reading and writing.
264+
An exception occurs if the file does not exist.
265+
266+
* `'w'` - Open file for writing.
267+
The file is created (if it does not exist) or truncated (if it exists).
268+
269+
* `'w+'` - Open file for reading and writing.
270+
The file is created (if it does not exist) or truncated (if it exists).
271+
272+
* `'a'` - Open file for appending.
273+
The file is created if it does not exist.
274+
275+
* `'a+'` - Open file for reading and appending.
276+
The file is created if it does not exist.
277+
278+
`mode` defaults to `0666`. The callback gets two arguments `(err, fd)`.
260279

261280
### fs.openSync(path, flags, [mode])
262281

@@ -419,6 +438,12 @@ Objects returned from `fs.stat()` and `fs.lstat()` are of this type.
419438

420439
`ReadStream` is a `Readable Stream`.
421440

441+
### Event: 'open'
442+
443+
`function (fd) { }`
444+
445+
`fd` is the file descriptor used by the ReadStream.
446+
422447
### fs.createReadStream(path, [options])
423448

424449
Returns a new ReadStream object (See `Readable Stream`).

doc/api/globals.markdown

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ A reference to the current module. In particular
7979
for more information.
8080
`module` isn't actually a global but rather local to each module.
8181

82+
83+
### exports
84+
85+
An object which is shared between all instances of the current module and
86+
made accessible through `require()`.
87+
`exports` is the same as the `module.exports` object. See `src/node.js`
88+
for more information.
89+
`exports` isn't actually a global but rather local to each module.
90+
8291
### setTimeout(cb, ms)
8392
### clearTimeout(t)
8493
### setInterval(cb, ms)

doc/api/http.markdown

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ per connection (in the case of keep-alive connections).
5252

5353
### Event: 'checkContinue'
5454

55-
`function (request, response) {}`
55+
`function (request, response) { }`
5656

5757
Emitted each time a request with an http Expect: 100-continue is received.
5858
If this event isn't listened for, the server will automatically respond
@@ -68,7 +68,7 @@ not be emitted.
6868

6969
### Event: 'upgrade'
7070

71-
`function (request, socket, head)`
71+
`function (request, socket, head) { }`
7272

7373
Emitted each time a client requests a http upgrade. If this event isn't
7474
listened for, then clients requesting an upgrade will have their connections
@@ -84,7 +84,7 @@ sent to the server on that socket.
8484

8585
### Event: 'clientError'
8686

87-
`function (exception) {}`
87+
`function (exception) { }`
8888

8989
If a client connection emits an 'error' event - it will forwarded here.
9090

@@ -394,6 +394,10 @@ Options:
394394
- `path`: Request path. Should include query string and fragments if any.
395395
E.G. `'/index.html?page=12'`
396396
- `headers`: An object containing request headers.
397+
- `agent`: Controls `Agent` behavior. Possible values:
398+
- `undefined` (default): use default `Agent` for this host and port.
399+
- `Agent` object: explicitly use the passed in `Agent`.
400+
- `false`: explicitly generate a new `Agent` for this host and port. `Agent` will not be re-used.
397401

398402
`http.request()` returns an instance of the `http.ClientRequest`
399403
class. The `ClientRequest` instance is a writable stream. If one needs to
@@ -483,7 +487,7 @@ Options:
483487

484488
### Event: 'upgrade'
485489

486-
`function (response, socket, head)`
490+
`function (response, socket, head) { }`
487491

488492
Emitted each time a server responds to a request with an upgrade. If this
489493
event isn't being listened for, clients receiving an upgrade header will have
@@ -537,14 +541,6 @@ A client server pair that show you how to listen for the `upgrade` event using `
537541
});
538542

539543

540-
### Event: 'continue'
541-
542-
`function ()`
543-
544-
Emitted when the server sends a '100 Continue' HTTP response, usually because
545-
the request contained 'Expect: 100-continue'. This is an instruction that
546-
the client should send the request body.
547-
548544
### agent.maxSockets
549545

550546
By default set to 5. Determines how many concurrent sockets the agent can have open.
@@ -600,6 +596,14 @@ This is a `Writable Stream`.
600596

601597
This is an `EventEmitter` with the following events:
602598

599+
### Event: 'continue'
600+
601+
`function () { }`
602+
603+
Emitted when the server sends a '100 Continue' HTTP response, usually because
604+
the request contained 'Expect: 100-continue'. This is an instruction that
605+
the client should send the request body.
606+
603607
### Event 'response'
604608

605609
`function (response) { }`
@@ -646,18 +650,27 @@ The response implements the `Readable Stream` interface.
646650

647651
### Event: 'data'
648652

649-
`function (chunk) {}`
653+
`function (chunk) { }`
650654

651655
Emitted when a piece of the message body is received.
652656

653657

654658
### Event: 'end'
655659

656-
`function () {}`
660+
`function () { }`
657661

658662
Emitted exactly once for each message. No arguments. After
659663
emitted no other events will be emitted on the response.
660664

665+
### Event: 'close'
666+
667+
`function (err) { }`
668+
669+
Indicates that the underlaying connection was terminated before
670+
`end` event was emitted.
671+
See [http.ServerRequest](#http.ServerRequest)'s `'close'` event for more
672+
information.
673+
661674
### response.statusCode
662675

663676
The 3-digit HTTP response status code. E.G. `404`.

doc/api/modules.markdown

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ Because `module` provides a `filename` property (normally equivalent to
318318
`__filename`), the entry point of the current application can be obtained
319319
by checking `require.main.filename`.
320320

321-
322321
## AMD Compatibility
323322

324323
Node's modules have access to a function named `define`, which may be

doc/api/stdio.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Mark a time.
3535
Finish timer, record output. Example
3636

3737
console.time('100-elements');
38-
while (var i = 0; i < 100; i++) {
38+
for (var i = 0; i < 100; i++) {
3939
;
4040
}
4141
console.timeEnd('100-elements');

0 commit comments

Comments
 (0)