Browse Source

Merge pull request #6559 from electron/node-6-3

Update to Node.js 6.3.0
Cheng Zhao 8 years ago
parent
commit
9cdc74e431

+ 1 - 1
.node-version

@@ -1 +1 @@
-v6.1.0
+v6.3.0

+ 3 - 2
atom/app/node_main.cc

@@ -7,7 +7,6 @@
 #include "atom/app/uv_task_runner.h"
 #include "atom/browser/javascript_environment.h"
 #include "atom/browser/node_debugger.h"
-#include "atom/common/node_includes.h"
 #include "base/command_line.h"
 #include "base/feature_list.h"
 #include "base/thread_task_runner_handle.h"
@@ -15,6 +14,8 @@
 #include "gin/public/isolate_holder.h"
 #include "gin/v8_initializer.h"
 
+#include "atom/common/node_includes.h"
+
 namespace atom {
 
 int NodeMain(int argc, char *argv[]) {
@@ -69,7 +70,7 @@ int NodeMain(int argc, char *argv[]) {
     exit_code = node::EmitExit(env);
     node::RunAtExit(env);
 
-    env->Dispose();
+    node::FreeEnvironment(env);
   }
 
   v8::V8::Dispose();

+ 7 - 11
atom/common/native_mate_converters/v8_value_converter.cc

@@ -12,7 +12,8 @@
 #include "base/memory/scoped_ptr.h"
 #include "base/values.h"
 #include "native_mate/dictionary.h"
-#include "vendor/node/src/node_buffer.h"
+
+#include "atom/common/node_includes.h"
 
 namespace atom {
 
@@ -110,32 +111,31 @@ base::Value* V8ValueConverter::FromV8Value(
 
 v8::Local<v8::Value> V8ValueConverter::ToV8ValueImpl(
      v8::Isolate* isolate, const base::Value* value) const {
-  CHECK(value);
   switch (value->GetType()) {
     case base::Value::TYPE_NULL:
       return v8::Null(isolate);
 
     case base::Value::TYPE_BOOLEAN: {
       bool val = false;
-      CHECK(value->GetAsBoolean(&val));
+      value->GetAsBoolean(&val);
       return v8::Boolean::New(isolate, val);
     }
 
     case base::Value::TYPE_INTEGER: {
       int val = 0;
-      CHECK(value->GetAsInteger(&val));
+      value->GetAsInteger(&val);
       return v8::Integer::New(isolate, val);
     }
 
     case base::Value::TYPE_DOUBLE: {
       double val = 0.0;
-      CHECK(value->GetAsDouble(&val));
+      value->GetAsDouble(&val);
       return v8::Number::New(isolate, val);
     }
 
     case base::Value::TYPE_STRING: {
       std::string val;
-      CHECK(value->GetAsString(&val));
+      value->GetAsString(&val);
       return v8::String::NewFromUtf8(
           isolate, val.c_str(), v8::String::kNormalString, val.length());
     }
@@ -163,10 +163,9 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Array(
 
   for (size_t i = 0; i < val->GetSize(); ++i) {
     const base::Value* child = nullptr;
-    CHECK(val->Get(i, &child));
+    val->Get(i, &child);
 
     v8::Local<v8::Value> child_v8 = ToV8ValueImpl(isolate, child);
-    CHECK(!child_v8.IsEmpty());
 
     v8::TryCatch try_catch;
     result->Set(static_cast<uint32_t>(i), child_v8);
@@ -186,7 +185,6 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Object(
        !iter.IsAtEnd(); iter.Advance()) {
     const std::string& key = iter.key();
     v8::Local<v8::Value> child_v8 = ToV8ValueImpl(isolate, &iter.value());
-    CHECK(!child_v8.IsEmpty());
 
     v8::TryCatch try_catch;
     result.Set(key, child_v8);
@@ -210,8 +208,6 @@ base::Value* V8ValueConverter::FromV8ValueImpl(
     FromV8ValueState* state,
     v8::Local<v8::Value> val,
     v8::Isolate* isolate) const {
-  CHECK(!val.IsEmpty());
-
   FromV8ValueState::Level state_level(state);
   if (state->HasReachedMaxRecursionDepth())
     return nullptr;

+ 2 - 2
atom/common/node_bindings.cc

@@ -11,7 +11,6 @@
 #include "atom/common/api/locker.h"
 #include "atom/common/atom_command_line.h"
 #include "atom/common/native_mate_converters/file_path_converter.h"
-#include "atom/common/node_includes.h"
 #include "base/command_line.h"
 #include "base/base_paths.h"
 #include "base/environment.h"
@@ -22,6 +21,8 @@
 #include "content/public/common/content_paths.h"
 #include "native_mate/dictionary.h"
 
+#include "atom/common/node_includes.h"
+
 using content::BrowserThread;
 
 // Force all builtin modules to be referenced so they can actually run their
@@ -216,7 +217,6 @@ void NodeBindings::UvRunOnce() {
   DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI));
 
   node::Environment* env = uv_env();
-  CHECK(env);
 
   // Use Locker in browser process.
   mate::Locker locker(env->isolate());

+ 1 - 0
atom/common/node_includes.h

@@ -19,6 +19,7 @@
 #undef CHECK_GT
 #undef CHECK_LE
 #undef CHECK_LT
+#undef UNLIKELY
 #undef DISALLOW_COPY_AND_ASSIGN
 #undef NO_RETURN
 #undef arraysize

+ 2 - 4
atom/node/osfhandle.h

@@ -7,8 +7,6 @@
 
 #include <windows.h>
 
-#include "node_extern.h"
-
 namespace node {
 
 // The _open_osfhandle and _close functions on Windows are provided by the
@@ -20,8 +18,8 @@ namespace node {
 // we always create fd in one instance of VC++ library.
 // Followings wrappers are compiled in node.dll, and all code in electron.exe
 // should call these wrappers instead of calling _open_osfhandle directly.
-NODE_EXTERN int open_osfhandle(intptr_t osfhandle, int flags);
-NODE_EXTERN int close(int fd);
+__declspec(dllexport) int open_osfhandle(intptr_t osfhandle, int flags);
+__declspec(dllexport) int close(int fd);
 
 }  // namespace node
 

+ 6 - 1
common.gypi

@@ -14,11 +14,13 @@
     'python': 'python',
     'openssl_fips': '',
     'openssl_no_asm': 1,
+    'OPENSSL_PRODUCT': 'libopenssl.a',
     'node_release_urlbase': 'https://atom.io/download/atom-shell',
     'node_byteorder': '<!(node <(DEPTH)/tools/get-endianness.js)',
     'node_target_type': 'shared_library',
     'node_install_npm': 'false',
     'node_prefix': '',
+    'node_shared': 'true',
     'node_shared_cares': 'false',
     'node_shared_http_parser': 'false',
     'node_shared_libuv': 'false',
@@ -31,17 +33,20 @@
     'node_use_mdb': 'false',
     'node_use_openssl': 'true',
     'node_use_perfctr': 'false',
+    'node_use_v8_platform': 'false',
+    'node_use_bundled_v8': 'false',
     'uv_library': 'static_library',
     'uv_parent_path': 'vendor/node/deps/uv',
     'uv_use_dtrace': 'false',
     'V8_BASE': '',
     'v8_postmortem_support': 'false',
     'v8_enable_i18n_support': 'false',
+    'v8_inspector': 'false',
   },
   # Settings to compile node under Windows.
   'target_defaults': {
     'target_conditions': [
-      ['_target_name in ["libuv", "http_parser", "openssl", "cares", "node", "zlib"]', {
+      ['_target_name in ["libuv", "http_parser", "openssl", "openssl-cli", "cares", "node", "zlib"]', {
         'msvs_disabled_warnings': [
           4003,  # not enough actual parameters for macro 'V'
           4013,  # 'free' undefined; assuming extern returning int

+ 3 - 0
electron.gyp

@@ -207,6 +207,9 @@
         'vendor/node/node.gyp:node',
       ],
       'defines': [
+        # We need to access internal implementations of Node.
+        'NODE_WANT_INTERNALS=1',
+        'NODE_SHARED_MODE',
         # This is defined in skia/skia_common.gypi.
         'SK_SUPPORT_LEGACY_GETTOPDEVICE',
         # Disable warnings for g_settings_list_schemas.

+ 2 - 2
spec/api-web-contents-spec.js

@@ -63,12 +63,12 @@ describe('webContents module', function () {
       const specWebContents = remote.getCurrentWebContents()
       assert.equal(specWebContents.getId(), webContents.getFocusedWebContents().getId())
 
-      specWebContents.on('devtools-opened', function () {
+      specWebContents.once('devtools-opened', function () {
         assert.equal(specWebContents.devToolsWebContents.getId(), webContents.getFocusedWebContents().getId())
         specWebContents.closeDevTools()
       })
 
-      specWebContents.on('devtools-closed', function () {
+      specWebContents.once('devtools-closed', function () {
         assert.equal(specWebContents.getId(), webContents.getFocusedWebContents().getId())
         done()
       })

+ 1 - 1
vendor/native_mate

@@ -1 +1 @@
-Subproject commit a1efa285204cb2fbbed450c317fb535a38ea8480
+Subproject commit d9bfe6a49d8585916bd8dc77165154afeee4e5b6

+ 1 - 1
vendor/node

@@ -1 +1 @@
-Subproject commit d4528c219df8f442d769bae054883e1af79f105e
+Subproject commit 69c579f33a9b0835c5ec0bb56c0ba4d3f5397d35