Merge remote-tracking branch 'upstream/v0.10'
authorTimothy J Fontaine <tjfontaine@gmail.com>
Mon, 10 Mar 2014 23:50:00 +0000 (16:50 -0700)
committerTimothy J Fontaine <tjfontaine@gmail.com>
Mon, 10 Mar 2014 23:50:00 +0000 (16:50 -0700)
Conflicts:
src/node.cc
src/node.js
test/message/max_tick_depth_trace.out

1  2 
doc/api/process.markdown
lib/child_process.js
lib/crypto.js
lib/timers.js
src/node.h
test/simple/test-crypto.js

Simple merge
Simple merge
diff --cc lib/crypto.js
Simple merge
diff --cc lib/timers.js
@@@ -138,9 -113,15 +138,15 @@@ function listOnTimeout() 
          threw = false;
        } finally {
          if (threw) {
+           // We need to continue processing after domain error handling
+           // is complete, but not by using whatever domain was left over
+           // when the timeout threw its exception.
+           var oldDomain = process.domain;
+           process.domain = null;
            process.nextTick(function() {
 -            list.ontimeout();
 +            list[kOnTimeout]();
            });
+           process.domain = oldDomain;
          }
        }
      }
diff --cc src/node.h
@@@ -325,78 -217,56 +325,78 @@@ extern "C" NODE_EXTERN void node_module
  #ifdef _WIN32
  # define NODE_MODULE_EXPORT __declspec(dllexport)
  #else
- # define NODE_MODULE_EXPORT /* empty */
+ # define NODE_MODULE_EXPORT __attribute__((visibility("default")))
  #endif
  
 -#define NODE_MODULE(modname, regfunc)                                 \
 +#if defined(_MSC_VER)
 +#pragma section(".CRT$XCU", read)
 +#define NODE_C_CTOR(fn)                                               \
 +  static void __cdecl fn(void);                                       \
 +  __declspec(dllexport, allocate(".CRT$XCU"))                         \
 +      void (__cdecl*fn ## _)(void) = fn;                              \
 +  static void __cdecl fn(void)
 +#else
 +#define NODE_C_CTOR(fn)                                               \
 +  static void fn(void) __attribute__((constructor));                  \
 +  static void fn(void)
 +#endif
 +
 +#define NODE_MODULE_X(modname, regfunc, priv, flags)                  \
    extern "C" {                                                        \
 -    NODE_MODULE_EXPORT node::node_module_struct modname ## _module =  \
 +    static node::node_module _module =                                \
      {                                                                 \
 -      NODE_STANDARD_MODULE_STUFF,                                     \
 -      (node::addon_register_func)regfunc,                             \
 -      NODE_STRINGIFY(modname)                                         \
 +      NODE_MODULE_VERSION,                                            \
 +      flags,                                                          \
 +      NULL,                                                           \
 +      __FILE__,                                                       \
 +      (node::addon_register_func) (regfunc),                          \
 +      NULL,                                                           \
 +      NODE_STRINGIFY(modname),                                        \
 +      priv,                                                           \
 +      NULL                                                            \
      };                                                                \
 +    NODE_C_CTOR(_register_ ## modname) {                              \
 +      node_module_register(&_module);                                 \
 +    }                                                                 \
    }
  
 -#define NODE_MODULE_DECL(modname) \
 -  extern "C" node::node_module_struct modname ## _module;
 +#define NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, priv, flags)    \
 +  extern "C" {                                                        \
 +    static node::node_module _module =                                \
 +    {                                                                 \
 +      NODE_MODULE_VERSION,                                            \
 +      flags,                                                          \
 +      NULL,                                                           \
 +      __FILE__,                                                       \
 +      NULL,                                                           \
 +      (node::addon_context_register_func) (regfunc),                  \
 +      NODE_STRINGIFY(modname),                                        \
 +      priv,                                                           \
 +      NULL                                                            \
 +    };                                                                \
 +    NODE_C_CTOR(_register_ ## modname) {                              \
 +      node_module_register(&_module);                                 \
 +    }                                                                 \
 +  }
  
 -/* Called after the event loop exits but before the VM is disposed.
 - * Callbacks are run in reverse order of registration, i.e. newest first.
 - */
 -NODE_EXTERN void AtExit(void (*cb)(void* arg), void* arg = 0);
 +#define NODE_MODULE(modname, regfunc)                                 \
 +  NODE_MODULE_X(modname, regfunc, NULL, 0)
 +
 +#define NODE_MODULE_CONTEXT_AWARE(modname, regfunc)                   \
 +  NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0)
 +
 +#define NODE_MODULE_CONTEXT_AWARE_BUILTIN(modname, regfunc)           \
 +  NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, NM_F_BUILTIN)   \
  
  /*
 - * MakeCallback doesn't have a HandleScope. That means the callers scope
 - * will retain ownership of created handles from MakeCallback and related.
 - * There is by default a wrapping HandleScope before uv_run, if the caller
 - * doesn't have a HandleScope on the stack the global will take ownership
 - * which won't be reaped until the uv loop exits.
 - *
 - * If a uv callback is fired, and there is no enclosing HandleScope in the
 - * cb, you will appear to leak 4-bytes for every invocation. Take heed.
 + * For backward compatibility in add-on modules.
   */
 +#define NODE_MODULE_DECL /* nothing */
  
 -NODE_EXTERN void SetErrno(uv_err_t err);
 -NODE_EXTERN v8::Handle<v8::Value>
 -MakeCallback(const v8::Handle<v8::Object> object,
 -             const char* method,
 -             int argc,
 -             v8::Handle<v8::Value> argv[]);
 -
 -NODE_EXTERN v8::Handle<v8::Value>
 -MakeCallback(const v8::Handle<v8::Object> object,
 -             const v8::Handle<v8::String> symbol,
 -             int argc,
 -             v8::Handle<v8::Value> argv[]);
 -
 -NODE_EXTERN v8::Handle<v8::Value>
 -MakeCallback(const v8::Handle<v8::Object> object,
 -             const v8::Handle<v8::Function> callback,
 -             int argc,
 -             v8::Handle<v8::Value> argv[]);
 +/* Called after the event loop exits but before the VM is disposed.
 + * Callbacks are run in reverse order of registration, i.e. newest first.
 + */
 +NODE_EXTERN void AtExit(void (*cb)(void* arg), void* arg = 0);
  
  }  // namespace node
  
Simple merge