platform/upstream/nodejs.git
11 years agowin/msi: use consistent registry key paths
Bert Belder [Thu, 7 Mar 2013 10:37:07 +0000 (11:37 +0100)]
win/msi: use consistent registry key paths

11 years agowin/msi: don't create empty npm folder in %appdata%
Bert Belder [Wed, 6 Mar 2013 14:41:12 +0000 (15:41 +0100)]
win/msi: don't create empty npm folder in %appdata%

Npm creates this folder when it's needed. Creating it in the installer
violates the per-user / per-machine scope separation.

11 years agowin/msi: don't install pdb file
Bert Belder [Wed, 6 Mar 2013 14:39:07 +0000 (15:39 +0100)]
win/msi: don't install pdb file

It's only available in debug builds, and we're not providing
installer packages for debug builds anyway.

11 years agowin/msi: define features before directories/components
Bert Belder [Thu, 28 Feb 2013 14:29:00 +0000 (15:29 +0100)]
win/msi: define features before directories/components

11 years agowin: make nodejsvars.bat detect whether npm is available
Bert Belder [Fri, 8 Mar 2013 00:28:18 +0000 (01:28 +0100)]
win: make nodejsvars.bat detect whether npm is available

11 years agostream: Emit error on stream object, not global
isaacs [Fri, 8 Mar 2013 15:35:35 +0000 (07:35 -0800)]
stream: Emit error on stream object, not global

Apparently this function got abstracted out at some point, and 'this'
wasn't changed to the correct object.

11 years agouv: Upgrade to b68ee40
isaacs [Fri, 8 Mar 2013 02:17:28 +0000 (18:17 -0800)]
uv: Upgrade to b68ee40

11 years agobench: Do math on numbers in compare.js, not strings
isaacs [Thu, 7 Mar 2013 19:56:53 +0000 (11:56 -0800)]
bench: Do math on numbers in compare.js, not strings

11 years agouv: Upgrade to f89125e
isaacs [Wed, 6 Mar 2013 23:44:08 +0000 (15:44 -0800)]
uv: Upgrade to f89125e

11 years agochild_process: support sending dgram socket
Andreas Madsen [Wed, 27 Feb 2013 18:31:24 +0000 (19:31 +0100)]
child_process: support sending dgram socket

child.send can send net servers and sockets. Now that we have support
for dgram clusters this functionality should be extended to include
dgram sockets.

11 years agodoc: dgram: add v0.10 bind() behavior note
Ben Noordhuis [Thu, 7 Mar 2013 13:13:01 +0000 (14:13 +0100)]
doc: dgram: add v0.10 bind() behavior note

dgram.Socket#bind() is always asynchronous now. Add a note at the top
of the documentation that explains how to upgrade.

Fixes #4944.

11 years agodoc: dgram: document bind() callback argument
Ben Noordhuis [Thu, 7 Mar 2013 13:10:47 +0000 (14:10 +0100)]
doc: dgram: document bind() callback argument

11 years agoMerge remote-tracking branch 'ry/v0.8' into master
isaacs [Wed, 6 Mar 2013 23:43:02 +0000 (15:43 -0800)]
Merge remote-tracking branch 'ry/v0.8' into master

Conflicts:
deps/npm/html/api/bin.html
deps/npm/html/api/bugs.html
deps/npm/html/api/commands.html
deps/npm/html/api/config.html
deps/npm/html/api/deprecate.html
deps/npm/html/api/docs.html
deps/npm/html/api/edit.html
deps/npm/html/api/explore.html
deps/npm/html/api/help-search.html
deps/npm/html/api/init.html
deps/npm/html/api/install.html
deps/npm/html/api/link.html
deps/npm/html/api/load.html
deps/npm/html/api/ls.html
deps/npm/html/api/npm.html
deps/npm/html/api/outdated.html
deps/npm/html/api/owner.html
deps/npm/html/api/pack.html
deps/npm/html/api/prefix.html
deps/npm/html/api/prune.html
deps/npm/html/api/publish.html
deps/npm/html/api/rebuild.html
deps/npm/html/api/restart.html
deps/npm/html/api/root.html
deps/npm/html/api/run-script.html
deps/npm/html/api/search.html
deps/npm/html/api/shrinkwrap.html
deps/npm/html/api/start.html
deps/npm/html/api/stop.html
deps/npm/html/api/submodule.html
deps/npm/html/api/tag.html
deps/npm/html/api/test.html
deps/npm/html/api/uninstall.html
deps/npm/html/api/unpublish.html
deps/npm/html/api/update.html
deps/npm/html/api/version.html
deps/npm/html/api/view.html
deps/npm/html/api/whoami.html
deps/npm/html/doc/README.html
deps/npm/html/doc/adduser.html
deps/npm/html/doc/bin.html
deps/npm/html/doc/bugs.html
deps/npm/html/doc/build.html
deps/npm/html/doc/bundle.html
deps/npm/html/doc/cache.html
deps/npm/html/doc/changelog.html
deps/npm/html/doc/coding-style.html
deps/npm/html/doc/completion.html
deps/npm/html/doc/config.html
deps/npm/html/doc/dedupe.html
deps/npm/html/doc/deprecate.html
deps/npm/html/doc/developers.html
deps/npm/html/doc/disputes.html
deps/npm/html/doc/docs.html
deps/npm/html/doc/edit.html
deps/npm/html/doc/explore.html
deps/npm/html/doc/faq.html
deps/npm/html/doc/folders.html
deps/npm/html/doc/global.html
deps/npm/html/doc/help-search.html
deps/npm/html/doc/help.html
deps/npm/html/doc/index.html
deps/npm/html/doc/init.html
deps/npm/html/doc/install.html
deps/npm/html/doc/json.html
deps/npm/html/doc/link.html
deps/npm/html/doc/ls.html
deps/npm/html/doc/npm.html
deps/npm/html/doc/outdated.html
deps/npm/html/doc/owner.html
deps/npm/html/doc/pack.html
deps/npm/html/doc/prefix.html
deps/npm/html/doc/prune.html
deps/npm/html/doc/publish.html
deps/npm/html/doc/rebuild.html
deps/npm/html/doc/registry.html
deps/npm/html/doc/removing-npm.html
deps/npm/html/doc/restart.html
deps/npm/html/doc/rm.html
deps/npm/html/doc/root.html
deps/npm/html/doc/run-script.html
deps/npm/html/doc/scripts.html
deps/npm/html/doc/search.html
deps/npm/html/doc/semver.html
deps/npm/html/doc/shrinkwrap.html
deps/npm/html/doc/star.html
deps/npm/html/doc/stars.html
deps/npm/html/doc/start.html
deps/npm/html/doc/stop.html
deps/npm/html/doc/submodule.html
deps/npm/html/doc/tag.html
deps/npm/html/doc/test.html
deps/npm/html/doc/uninstall.html
deps/npm/html/doc/unpublish.html
deps/npm/html/doc/update.html
deps/npm/html/doc/version.html
deps/npm/html/doc/view.html
deps/npm/html/doc/whoami.html
deps/npm/man/man1/ls.1
deps/npm/man/man1/npm.1
deps/npm/man/man3/npm.3
deps/npm/node_modules/npm-registry-client/lib/publish.js
deps/npm/node_modules/npm-registry-client/package.json
deps/npm/package.json
doc/blog/feature/streams2.md

11 years agonpm: Update to 1.2.14
isaacs [Wed, 6 Mar 2013 23:41:06 +0000 (15:41 -0800)]
npm: Update to 1.2.14

11 years agoblog: Update streams2 feature post to match actual doc
isaacs [Wed, 6 Mar 2013 22:19:16 +0000 (14:19 -0800)]
blog: Update streams2 feature post to match actual doc

11 years agoNow working on 0.9.13
isaacs [Wed, 6 Mar 2013 21:59:58 +0000 (13:59 -0800)]
Now working on 0.9.13

Probably that will be 0.10.0 instead, though.

11 years agodoc: fix ChangeLog typo
isaacs [Wed, 6 Mar 2013 21:59:25 +0000 (13:59 -0800)]
doc: fix ChangeLog typo

11 years agoMerge branch 'v0.9.12-release'
isaacs [Wed, 6 Mar 2013 21:59:07 +0000 (13:59 -0800)]
Merge branch 'v0.9.12-release'

11 years agoblog: Post for 0.9.12
isaacs [Wed, 6 Mar 2013 21:56:56 +0000 (13:56 -0800)]
blog: Post for 0.9.12

11 years ago2013.03.06, Version 0.9.12 (Unstable) v0.9.12
isaacs [Wed, 6 Mar 2013 20:43:35 +0000 (12:43 -0800)]
2013.03.06, Version 0.9.12 (Unstable)

* stream: Allow strings in Readable.push/unshift (isaacs)

* stream: Remove bufferSize option (isaacs)

* stream: Increase highWaterMark on large reads (isaacs)

* stream: _write: takes an encoding argument (isaacs)

* stream: _transform: remove no output() method, provide encoding (isaacs)

* stream: Don't require read(0) to emit 'readable' event (isaacs)

* node: Add --throw-deprecation (isaacs)

* http: fix multiple timeout events (Eugene Girshov)

* http: More useful setTimeout API on server (isaacs)

* net: use close callback, not process.nextTick (Ben Noordhuis)

* net: Provide better error when writing after FIN (isaacs)

* dns: Support NAPTR queries (Pavel Lang)

* dns: fix ReferenceError in resolve() error path (Xidorn Quan)

* child_process: handle ENOENT correctly on Windows (Scott Blomquist)

* cluster: Rename destroy() to kill(signal=SIGTERM) (isaacs)

* build: define nightly tag external to build system (Timothy J Fontaine)

* build: make msi build work when spaces are present in the path (Bert Belder)

* build: fix msi build issue with WiX 3.7/3.8 (Raymond Feng)

* repl: make compatible with domains (Dave Olszewski)

* events: Code cleanup and performance improvements (Trevor Norris)

11 years agoV8: Reapply floating patches
isaacs [Wed, 6 Mar 2013 20:58:37 +0000 (12:58 -0800)]
V8: Reapply floating patches

11 years agoV8: Upgrade to 3.14.5.8
isaacs [Wed, 6 Mar 2013 20:57:49 +0000 (12:57 -0800)]
V8: Upgrade to 3.14.5.8

11 years agohttp: More useful setTimeout API on server
isaacs [Mon, 4 Mar 2013 07:29:22 +0000 (23:29 -0800)]
http: More useful setTimeout API on server

This adds the following to HTTP:

* server.setTimeout(msecs, callback)
  Sets all new connections to time out after the specified time, at
  which point it emits 'timeout' on the server, passing the socket as an
  argument.
  In this way, timeouts can be handled in one place consistently.
* req.setTimeout(), res.setTimeout()
  Essentially an alias to req/res.socket.setTimeout(), but without
  having to delve into a "buried" object.  Adds a listener on the
  req/res object, but not on the socket.
* server.timeout
  Number of milliseconds before incoming connections time out.
  (Default=1000*60*2, as before.)

Furthermore, if the user sets up their own timeout listener on either
the server, the request, or the response, then the default behavior
(destroying the socket) is suppressed.

Fix #3460

11 years agobench: Use environ to run compares more than once
isaacs [Wed, 6 Mar 2013 20:32:59 +0000 (12:32 -0800)]
bench: Use environ to run compares more than once

This will run the benchmarks the number of times specified by NODE_BENCH_RUNS,
to attempt to reduce variability.

If the number of runs is high enough, it'll also throw out the top and bottom
quartiles, since that's where the outliers will be.

It's not very fancy statistics-fu, but it's better than nothing.

Also, linted this file.  It had tabs in it.  TABS!

11 years agostream: Raise readable high water mark in powers of 2
isaacs [Wed, 6 Mar 2013 17:55:00 +0000 (09:55 -0800)]
stream: Raise readable high water mark in powers of 2

This prevents excessively raising the buffer level in tiny increments in
pathological cases.

11 years agostream: Allow strings in Readable.push/unshift
isaacs [Wed, 6 Mar 2013 07:37:37 +0000 (23:37 -0800)]
stream: Allow strings in Readable.push/unshift

Fix #4909

11 years agostream: Remove bufferSize option
isaacs [Wed, 6 Mar 2013 06:57:15 +0000 (22:57 -0800)]
stream: Remove bufferSize option

Now that highWaterMark increases when there are large reads, this
greatly reduces the number of calls necessary to _read(size), assuming
that _read actually respects the size argument.

11 years agostream: Remove pipeOpts.chunkSize
isaacs [Wed, 6 Mar 2013 06:16:46 +0000 (22:16 -0800)]
stream: Remove pipeOpts.chunkSize

It's not actually necessary for backwards compatibility, isn't
used anywhere, and isn't even tested.  Better to just remove it.

11 years agostream: Increase highWaterMark on large reads
isaacs [Wed, 6 Mar 2013 06:09:27 +0000 (22:09 -0800)]
stream: Increase highWaterMark on large reads

If the consumer of a Readable is asking for N bytes, and N > hwm,
then clearly we have set the hwm to low, and ought to increase it.

Fix #4931

11 years agostream: Remove unnecessary nextTick usage in Writable
isaacs [Wed, 6 Mar 2013 01:53:37 +0000 (17:53 -0800)]
stream: Remove unnecessary nextTick usage in Writable

Fix #4928

11 years agotest: Pass cli flags in pummel/test-regress-GH-892
isaacs [Wed, 6 Mar 2013 01:47:12 +0000 (17:47 -0800)]
test: Pass cli flags in pummel/test-regress-GH-892

11 years agonode: Add --throw-deprecation
isaacs [Wed, 6 Mar 2013 01:46:37 +0000 (17:46 -0800)]
node: Add --throw-deprecation

Extremely handy when tracking down a flood of recursive nextTick warnings.

11 years agohttp: fix multiple timeout events
Eugene Girshov [Mon, 4 Mar 2013 20:44:56 +0000 (22:44 +0200)]
http: fix multiple timeout events

Fixed up slightly by @isaacs so as not to miss 'timeout' events in some
cases.

11 years agonet: use close callback, not process.nextTick
Ben Noordhuis [Wed, 6 Mar 2013 15:15:17 +0000 (16:15 +0100)]
net: use close callback, not process.nextTick

Don't emit the 'close' event with process.nextTick.

Closing a handle is an operation that usually *but not always* completes
on the next tick of the event loop, hence using process.nextTick is not
reliable.

Use a proper handle close callback and emit the 'close' event from
inside the callback.

Update tests that depend on the intricacies of the old model.

Fixes #3459.

11 years agohandle_wrap: add close callback support
Ben Noordhuis [Wed, 6 Mar 2013 14:32:40 +0000 (15:32 +0100)]
handle_wrap: add close callback support

11 years agohandle_wrap: replace unref_ field with flags_ field
Ben Noordhuis [Wed, 6 Mar 2013 14:24:20 +0000 (15:24 +0100)]
handle_wrap: replace unref_ field with flags_ field

Prep work for a follow-up commit that adds support for close callbacks.

11 years agosrc: remove unused symbols in node_file.cc
Ben Noordhuis [Wed, 6 Mar 2013 13:45:47 +0000 (14:45 +0100)]
src: remove unused symbols in node_file.cc

11 years agoDNS: Support NAPTR queries
Pavel Lang [Tue, 18 Sep 2012 09:21:38 +0000 (11:21 +0200)]
DNS: Support NAPTR queries

They were previously removed in a90bc78534d94940a6b726c01cf8427c296b4c63.

11 years agocares: Set process._errno, not global.errno
isaacs [Wed, 6 Mar 2013 09:07:46 +0000 (01:07 -0800)]
cares: Set process._errno, not global.errno

This makes test-internet pass

11 years agochild_process: handle ENOENT correctly on Windows
Scott Blomquist [Sat, 16 Feb 2013 01:25:57 +0000 (17:25 -0800)]
child_process: handle ENOENT correctly on Windows

11 years agoprocess: invoke EventEmitter on `process`
Nathan Rajlich [Tue, 5 Mar 2013 20:17:48 +0000 (12:17 -0800)]
process: invoke EventEmitter on `process`

This properly sets the `_maxListeners` property, which
fixes the max listener warning. Closes #4924.

11 years agobuild: define nightly tag external to build system
Timothy J Fontaine [Tue, 5 Mar 2013 19:05:50 +0000 (11:05 -0800)]
build: define nightly tag external to build system

11 years agostream: Use class for write buffer entries
isaacs [Mon, 4 Mar 2013 03:43:46 +0000 (19:43 -0800)]
stream: Use class for write buffer entries

11 years agostream: _write takes an encoding argument
isaacs [Mon, 4 Mar 2013 03:14:06 +0000 (19:14 -0800)]
stream: _write takes an encoding argument

This vastly reduces the overhead of decodeStrings:false streams,
such as net and http.

11 years agostream: Remove output function from _transform
isaacs [Mon, 4 Mar 2013 03:05:44 +0000 (19:05 -0800)]
stream: Remove output function from _transform

Just use stream.push(outputChunk) instead.

11 years agostream: Split Writable logic into small functions
isaacs [Mon, 4 Mar 2013 00:12:02 +0000 (16:12 -0800)]
stream: Split Writable logic into small functions

1. Get rid of unnecessary 'finishing' flag
2. Dont check both ending and ended. Extraneous.

Also: Remove extraneous 'finishing' flag, and don't check both 'ending'
and 'ended', since checking just 'ending' is sufficient.

11 years agobench: Add flag to be silent in runner
isaacs [Sun, 3 Mar 2013 23:44:36 +0000 (15:44 -0800)]
bench: Add flag to be silent in runner

This is helpful in tracking down bailouts and deopts in Stream classes,
without triggering one from the string write in console.log

11 years agoprocess: invoke EventEmitter on `process`
Nathan Rajlich [Tue, 5 Mar 2013 20:17:48 +0000 (12:17 -0800)]
process: invoke EventEmitter on `process`

This properly sets the `_maxListeners` property, which
fixes the max listener warning. Closes #4924.

11 years agoRevert "build, windows: disable SEH"
Bert Belder [Tue, 5 Mar 2013 18:38:28 +0000 (19:38 +0100)]
Revert "build, windows: disable SEH"

This is no longer necessary - the underlying issue was fixed in 01fa5ee.
This reverts commit d87904286024f5ceb6a2d0d5f17e919c775830a0.

11 years agowin/openssl: mark assembled object files as seh safe
Bert Belder [Tue, 5 Mar 2013 18:36:29 +0000 (19:36 +0100)]
win/openssl: mark assembled object files as seh safe

There are no unsafe structured exception handlers in object files
generated from hand-crafted assembly - because they contain no exception
handlers at all.

11 years agoUpdate domain.markdown
Paolo Fragomeni [Mon, 4 Mar 2013 21:04:55 +0000 (16:04 -0500)]
Update domain.markdown

11 years agodeps: upgrade libuv to 0b26af3
Ben Noordhuis [Tue, 5 Mar 2013 15:10:13 +0000 (16:10 +0100)]
deps: upgrade libuv to 0b26af3

11 years agoMerge remote-tracking branch 'origin/v0.8'
Ben Noordhuis [Tue, 5 Mar 2013 14:43:03 +0000 (15:43 +0100)]
Merge remote-tracking branch 'origin/v0.8'

11 years agocluster: propagate bind errors
Ben Noordhuis [Thu, 9 Feb 2012 05:22:50 +0000 (06:22 +0100)]
cluster: propagate bind errors

This commit fixes a bug where the cluster module fails to propagate
EADDRINUSE errors.

When a worker starts a (net, http) server, it requests the listen socket
from its master who then creates and binds the socket.

Now, OS X and Windows don't always signal EADDRINUSE from bind() but
instead defer the error until a later syscall. libuv mimics this
behaviour to provide consistent behaviour across platforms but that
means the worker could end up with a socket that is not actually bound
to the requested addresss.

That's why the worker now checks if the socket is bound, raising
EADDRINUSE if that's not the case.

Fixes #2721.

11 years agoevents: loop backwards in removeListener
Felix Böhm [Tue, 5 Mar 2013 08:20:23 +0000 (09:20 +0100)]
events: loop backwards in removeListener

`removeAllListeners` is removing events from end to start. Therefore
it spends O(n^2) time, since `removeListener` is searching from start to
end.

11 years agoevents: code consistency
Trevor Norris [Mon, 4 Mar 2013 19:59:55 +0000 (11:59 -0800)]
events: code consistency

v8 likes when smaller functions have a single return point, and cleaned
up the single non-strict check.

11 years agoevents: remove type check for event type
Trevor Norris [Mon, 4 Mar 2013 19:33:03 +0000 (11:33 -0800)]
events: remove type check for event type

Strict checking for typeof types broke backwards compatibility for other
libraries. This reverts those checks.

The subclass test has been changed to ensure all operations can be
performed on the inherited EE before instantiation. Including the
ability to set event names with numbers.

11 years agodoc: add url.resolve() usage examples
Ben Noordhuis [Mon, 4 Mar 2013 19:54:34 +0000 (20:54 +0100)]
doc: add url.resolve() usage examples

Fixes #4913.

11 years agowin/msi: make msi build work when spaces are present in the path
Bert Belder [Mon, 4 Mar 2013 18:47:05 +0000 (19:47 +0100)]
win/msi: make msi build work when spaces are present in the path

11 years agostream: Don't require read(0) to emit 'readable' event
isaacs [Sun, 3 Mar 2013 00:03:22 +0000 (16:03 -0800)]
stream: Don't require read(0) to emit 'readable' event

When a readable listener is added, call read(0) so that data will flow in, up to
the high water mark.

Otherwise, it's somewhat confusing that you have to listen for readable,
and ALSO call read() (when it will certainly return null) just to get some
data out of the stream.

See: #4720

11 years agodns: fix ReferenceError in resolve() error path
Xidorn Quan [Sun, 3 Mar 2013 04:53:51 +0000 (12:53 +0800)]
dns: fix ReferenceError in resolve() error path

A typo in the variable name makes it throw a ReferenceError instead of
the expected "Unknown type" error when dns.resolve() is passed a bad
record type argument.

Fixes the following exception:

  ReferenceError: type is not defined
    at Object.exports.resolve (dns.js:189:40)
    at /Users/bnoordhuis/src/master/test/simple/test-c-ares.js:48:9
    <snip>

11 years agolink to LevelUP modules wiki page, not level-hooks
Rod Vagg [Mon, 4 Mar 2013 02:03:40 +0000 (13:03 +1100)]
link to LevelUP modules wiki page, not level-hooks

11 years agolink to LevelUP modules wiki page, not level-hooks
Rod Vagg [Mon, 4 Mar 2013 02:03:40 +0000 (13:03 +1100)]
link to LevelUP modules wiki page, not level-hooks

11 years agocluster: Rename destroy() to kill(signal=SIGTERM)
isaacs [Sun, 3 Mar 2013 23:22:12 +0000 (15:22 -0800)]
cluster: Rename destroy() to kill(signal=SIGTERM)

Fix #4133, bringing the cluster worker API more in line with the
child process API.

11 years agostream: Writable.end(chunk) after end is an error
isaacs [Sat, 2 Mar 2013 20:25:16 +0000 (12:25 -0800)]
stream: Writable.end(chunk) after end is an error

Calling end(data) calls write(data).  Doing this after end should
raise a 'write after end' error.

However, because end() calls were previously ignored on already
ended streams, this error was confusingly suppressed, even though the
data never is written, and cannot get to the other side.

This is a re-hash of 5222d19a11ed0e29d207da0e8c9c8e0e3b18ad78, but
without assuming that the data passed to end() is valid, and thus
breaking a bunch of tests.

11 years agodoc: Add crypto.pseudoRandomBytes, fix typo
Aaron Cannon [Sun, 3 Mar 2013 21:11:08 +0000 (15:11 -0600)]
doc: Add crypto.pseudoRandomBytes, fix typo

11 years agomake repl compatible with domains
Dave Olszewski [Sat, 19 Jan 2013 00:25:52 +0000 (16:25 -0800)]
make repl compatible with domains

The try/catch in repl.js keeps any active domain from catching the
error.  Since the domain may not even be enterd until the code is run,
it's not possible to avoid the try/catch, so emit on the domain when an
error is thrown.

11 years agoRevert "stream: Writable.end(chunk) after end is an error"
Ben Noordhuis [Sun, 3 Mar 2013 01:21:28 +0000 (02:21 +0100)]
Revert "stream: Writable.end(chunk) after end is an error"

It's breaking ~22 tests, Needs further investigation.

This reverts commit 5222d19a11ed0e29d207da0e8c9c8e0e3b18ad78.

11 years agodoc: Typo in ChangeLog
isaacs [Sun, 3 Mar 2013 00:10:21 +0000 (16:10 -0800)]
doc: Typo in ChangeLog

downgrade TO 3.14

11 years agostream: Writable.end(chunk) after end is an error
isaacs [Sat, 2 Mar 2013 20:25:16 +0000 (12:25 -0800)]
stream: Writable.end(chunk) after end is an error

Calling end(data) calls write(data).  Doing this after end should
raise a 'write after end' error.

However, because end() calls were previously ignored on already
ended streams, this error was confusingly suppressed, even though the
data never is written, and cannot get to the other side.

11 years agoevents: Handle emit('error') before ctor
isaacs [Sat, 2 Mar 2013 23:11:23 +0000 (15:11 -0800)]
events: Handle emit('error') before ctor

The previous commit did not handle the case when the event type
is 'error', since that is checked before reading the handler.

11 years agoevents: Handle emit before constructor call
isaacs [Sat, 2 Mar 2013 19:58:21 +0000 (11:58 -0800)]
events: Handle emit before constructor call

11 years agoMerge remote-tracking branch 'origin/v0.8'
Ben Noordhuis [Sat, 2 Mar 2013 22:13:35 +0000 (23:13 +0100)]
Merge remote-tracking branch 'origin/v0.8'

Conflicts:
doc/api/http.markdown
test/simple/test-crypto.js

11 years agotest: make simple/test-dgram-pingpong respect PORT
Ben Noordhuis [Sat, 2 Mar 2013 22:04:05 +0000 (23:04 +0100)]
test: make simple/test-dgram-pingpong respect PORT

Don't use hard-coded port numbers, use common.PORT instead.

Should fix the occasional Jenkins failure; the builds run in parallel.

11 years agonet: s/closed/ended/ in write-after-fin message
isaacs [Sat, 2 Mar 2013 19:50:33 +0000 (11:50 -0800)]
net: s/closed/ended/ in write-after-fin message

11 years agonet: Provide better error when writing after FIN
isaacs [Sat, 2 Mar 2013 18:20:33 +0000 (10:20 -0800)]
net: Provide better error when writing after FIN

The stock writable stream "write after end" message is overly vague, if
you have clearly not called end() yourself yet.

When we receive a FIN from the other side, and call destroySoon() as a
result, then generate an EPIPE error (which is what would happen if you
did actually write to the socket), with a message explaining what
actually happened.

11 years agowindows/msi: fix msi build issue with WiX 3.7/3.8
Raymond Feng [Sat, 2 Mar 2013 18:08:08 +0000 (10:08 -0800)]
windows/msi: fix msi build issue with WiX 3.7/3.8

The `heat` tool that gathers NPM source files wasn't getting called.
Closes #4896

11 years agotest: optionally set common.PORT via env variable
Timothy J Fontaine [Tue, 26 Feb 2013 06:19:16 +0000 (22:19 -0800)]
test: optionally set common.PORT via env variable

This is a back-port of commit 17a8126 from the master branch.

11 years agotest: unlink temp file at test start
Ben Noordhuis [Sat, 2 Mar 2013 01:43:01 +0000 (02:43 +0100)]
test: unlink temp file at test start

The file has a long name that's apparently impossible to remove with
`git clean` on Windows.

11 years agoevents: add type checks to once
Trevor Norris [Wed, 27 Feb 2013 08:15:28 +0000 (00:15 -0800)]
events: add type checks to once

Also cleanup unnecessary use of "self" since it will always be called
using .apply() from emit.

11 years agoevents: emit cleanup
Trevor Norris [Tue, 26 Feb 2013 19:20:19 +0000 (11:20 -0800)]
events: emit cleanup

Cleanup check logic. Place vars at top. Remove PROCESS.

11 years agoevents: additional type check for addListener
Trevor Norris [Tue, 26 Feb 2013 18:20:44 +0000 (10:20 -0800)]
events: additional type check for addListener

Check both passed args to addListener.

Place var at beginning.

11 years agoevents: _events to object and undefined not null
Trevor Norris [Tue, 26 Feb 2013 17:47:36 +0000 (09:47 -0800)]
events: _events to object and undefined not null

By making sure the _events is always an object there is one less check
that needs to be performed by emit.

Use undefined instead of null. typeof checks are a lot faster than
isArray.

There are a few places where the this._events check cannot be removed
because it is possible for the user to call those methods after using
utils.extend to create their own EventEmitter, but before it has
actually been instantiated.

11 years agoevents: removeListener add checks and cleanup
Trevor Norris [Thu, 21 Feb 2013 07:54:38 +0000 (23:54 -0800)]
events: removeListener add checks and cleanup

Remove unecessary splice for single listener events. Add type check for
"type" argument.

11 years agoevents: type check listeners
Trevor Norris [Wed, 20 Feb 2013 23:33:24 +0000 (15:33 -0800)]
events: type check listeners

Make sure the argument passed is a string. Also use typeof === function
check instead of isArray().

11 years agoevents: simplify removeAllListeners logic
Trevor Norris [Wed, 20 Feb 2013 23:19:05 +0000 (15:19 -0800)]
events: simplify removeAllListeners logic

Unnecessary checks were being performed on if the event existed before
being removed.

_events starts out as null, so reset to null when emptied.

Checking typeof is a lot cheaper than isArray().

11 years agoevents: type check setMaxListeners, cleanup throws
Trevor Norris [Wed, 20 Feb 2013 23:04:58 +0000 (15:04 -0800)]
events: type check setMaxListeners, cleanup throws

setMaxListeners will now make sure a positive number is passed. Also
throwing more definitive Error types.

11 years agoevents: ensure usingDomain is always boolean
Trevor Norris [Wed, 20 Feb 2013 22:52:46 +0000 (14:52 -0800)]
events: ensure usingDomain is always boolean

Small addition to ensure that exports.usingDomains is always a bool.

11 years agoevents: add check for listeners length
Trevor Norris [Thu, 14 Feb 2013 08:48:11 +0000 (00:48 -0800)]
events: add check for listeners length

Ability to return just the length of listeners for a given type, using
EventEmitter.listenerCount(emitter, event). This will be a lot cheaper
than creating a copy of the listeners array just to check its length.

11 years agocrypto: don't assert when calling Cipher#final() twice
Ben Noordhuis [Sat, 2 Mar 2013 01:09:14 +0000 (02:09 +0100)]
crypto: don't assert when calling Cipher#final() twice

Remove the assert() that triggered when Cipher#final() or
Decipher#final() was called twice.

Fixes #4886.

11 years agodeps: upgrade libuv to 7e59f9b
Ben Noordhuis [Sat, 2 Mar 2013 00:49:19 +0000 (01:49 +0100)]
deps: upgrade libuv to 7e59f9b

11 years agodoc change for Readable._read()
Lars-Magnus Skog [Fri, 1 Mar 2013 20:09:36 +0000 (21:09 +0100)]
doc change for Readable._read()

11 years agodoc: Clarify advisory-ness of stream._read() argument
isaacs [Fri, 1 Mar 2013 22:26:35 +0000 (14:26 -0800)]
doc: Clarify advisory-ness of stream._read() argument

11 years agodoc: Update to reflect new _read() interface
Gil Pedersen [Fri, 1 Mar 2013 22:15:28 +0000 (23:15 +0100)]
doc: Update to reflect new _read() interface

11 years agodoc: Fix readable.unshift() example
Evan Oxfeld [Fri, 1 Mar 2013 20:10:36 +0000 (15:10 -0500)]
doc: Fix readable.unshift() example

Slice the portion of the buffer to unshift back into the read queue

11 years agobuild/windows: don't use wrong version number
Scott Blomquist [Fri, 1 Mar 2013 20:03:44 +0000 (12:03 -0800)]
build/windows: don't use wrong version number

We were using a global temp file while setting the NODE_VERSION
environment variable. This resulted in simultaneous builds swapping
version numbers on occasion.

This patch removes the use of a temp file for this.

11 years agoblog: Post about v0.9.11
isaacs [Fri, 1 Mar 2013 19:22:07 +0000 (11:22 -0800)]
blog: Post about v0.9.11

11 years agodoc: Correct version in changelog
isaacs [Fri, 1 Mar 2013 19:23:55 +0000 (11:23 -0800)]
doc: Correct version in changelog

11 years agoNow working on 0.9.12
isaacs [Fri, 1 Mar 2013 19:19:38 +0000 (11:19 -0800)]
Now working on 0.9.12

11 years agoMerge branch 'v0.9.11-release'
isaacs [Fri, 1 Mar 2013 19:19:20 +0000 (11:19 -0800)]
Merge branch 'v0.9.11-release'