From 8f5bd4afafe9c32d846d633f4455f904350f5fcb Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 00:57:20 -0600 Subject: [PATCH 01/10] Update to Node 6.3.0 --- vendor/node | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/node b/vendor/node index d4528c219df8..69c579f33a9b 160000 --- a/vendor/node +++ b/vendor/node @@ -1 +1 @@ -Subproject commit d4528c219df8f442d769bae054883e1af79f105e +Subproject commit 69c579f33a9b0835c5ec0bb56c0ba4d3f5397d35 From 7d42797c1fde358493cce1cb603c8e489218bfb8 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 00:51:57 -0600 Subject: [PATCH 02/10] Update node headers including --- atom/app/node_main.cc | 3 ++- atom/common/native_mate_converters/v8_value_converter.cc | 3 ++- atom/common/node_includes.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/atom/app/node_main.cc b/atom/app/node_main.cc index 6f71d39f5740..d06e89c74828 100644 --- a/atom/app/node_main.cc +++ b/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[]) { diff --git a/atom/common/native_mate_converters/v8_value_converter.cc b/atom/common/native_mate_converters/v8_value_converter.cc index 37e09aec5750..d53fe6f62713 100644 --- a/atom/common/native_mate_converters/v8_value_converter.cc +++ b/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 { diff --git a/atom/common/node_includes.h b/atom/common/node_includes.h index 46b6fa058ebb..01efa6b15470 100644 --- a/atom/common/node_includes.h +++ b/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 From 39e39ae91340fd5db7a14d5d14c2574ee214b268 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 00:52:15 -0600 Subject: [PATCH 03/10] Make use of some new Node config flags --- common.gypi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common.gypi b/common.gypi index 3389e18690a2..0eaf3a31e991 100644 --- a/common.gypi +++ b/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': ' Date: Thu, 21 Jul 2016 00:52:44 -0600 Subject: [PATCH 04/10] Add a few new node defines --- electron.gyp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/electron.gyp b/electron.gyp index 2d18f09e137e..6562b48006dd 100644 --- a/electron.gyp +++ b/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. From 8488b84b53ae1b59ea762f1a7de8cb7d1b65f167 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 01:17:07 -0600 Subject: [PATCH 05/10] Update .node-version --- .node-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.node-version b/.node-version index ed15bef9ae26..dffc266d6a8b 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -v6.1.0 +v6.3.0 From 5fc0201ca1faf93de742c8c415b9df647f9bfd93 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 16:36:31 +0900 Subject: [PATCH 06/10] There is no node_extern.h anymore --- atom/node/osfhandle.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/atom/node/osfhandle.h b/atom/node/osfhandle.h index 6ebb2ab11e9d..3933236e5091 100644 --- a/atom/node/osfhandle.h +++ b/atom/node/osfhandle.h @@ -7,8 +7,6 @@ #include -#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 From 334f03fc42b79ab2ea26326e38c7ee8aefaf6e6c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 16:36:50 +0900 Subject: [PATCH 07/10] Fix compilation errors on Windows --- common.gypi | 2 +- vendor/native_mate | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common.gypi b/common.gypi index 0eaf3a31e991..b2ee5e50811f 100644 --- a/common.gypi +++ b/common.gypi @@ -46,7 +46,7 @@ # 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 diff --git a/vendor/native_mate b/vendor/native_mate index a1efa285204c..b611cbb75f35 160000 --- a/vendor/native_mate +++ b/vendor/native_mate @@ -1 +1 @@ -Subproject commit a1efa285204cb2fbbed450c317fb535a38ea8480 +Subproject commit b611cbb75f35b89d4b7e86735432abe5ed059de3 From cef86f5257ebff012f51cf9dc50f5a80f9598f34 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 16:43:21 +0900 Subject: [PATCH 08/10] Use node::FreeEnvironment --- atom/app/node_main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/app/node_main.cc b/atom/app/node_main.cc index d06e89c74828..e711f48e32f5 100644 --- a/atom/app/node_main.cc +++ b/atom/app/node_main.cc @@ -70,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(); From 39bd2bee8eabbff6c45bd8d4c6d791ff388c309c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 16:44:30 +0900 Subject: [PATCH 09/10] Avoid using CHECK in files using node headesr Node has its own CHECK macro which requires linking with node::Assert. --- .../native_mate_converters/v8_value_converter.cc | 15 +++++---------- atom/common/node_bindings.cc | 4 ++-- vendor/native_mate | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/atom/common/native_mate_converters/v8_value_converter.cc b/atom/common/native_mate_converters/v8_value_converter.cc index d53fe6f62713..ddff43924400 100644 --- a/atom/common/native_mate_converters/v8_value_converter.cc +++ b/atom/common/native_mate_converters/v8_value_converter.cc @@ -111,32 +111,31 @@ base::Value* V8ValueConverter::FromV8Value( v8::Local 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()); } @@ -164,10 +163,9 @@ v8::Local 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 child_v8 = ToV8ValueImpl(isolate, child); - CHECK(!child_v8.IsEmpty()); v8::TryCatch try_catch; result->Set(static_cast(i), child_v8); @@ -187,7 +185,6 @@ v8::Local V8ValueConverter::ToV8Object( !iter.IsAtEnd(); iter.Advance()) { const std::string& key = iter.key(); v8::Local child_v8 = ToV8ValueImpl(isolate, &iter.value()); - CHECK(!child_v8.IsEmpty()); v8::TryCatch try_catch; result.Set(key, child_v8); @@ -211,8 +208,6 @@ base::Value* V8ValueConverter::FromV8ValueImpl( FromV8ValueState* state, v8::Local val, v8::Isolate* isolate) const { - CHECK(!val.IsEmpty()); - FromV8ValueState::Level state_level(state); if (state->HasReachedMaxRecursionDepth()) return nullptr; diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index 40fa6bdb6e28..2a999ea79bc9 100644 --- a/atom/common/node_bindings.cc +++ b/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()); diff --git a/vendor/native_mate b/vendor/native_mate index b611cbb75f35..d9bfe6a49d85 160000 --- a/vendor/native_mate +++ b/vendor/native_mate @@ -1 +1 @@ -Subproject commit b611cbb75f35b89d4b7e86735432abe5ed059de3 +Subproject commit d9bfe6a49d8585916bd8dc77165154afeee4e5b6 From fbfae70803934c75e432876db014014a32c61507 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 21 Jul 2016 17:08:43 +0900 Subject: [PATCH 10/10] spec: Fix exception when refreshing test window --- spec/api-web-contents-spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/api-web-contents-spec.js b/spec/api-web-contents-spec.js index a9519de131aa..b9195702a324 100644 --- a/spec/api-web-contents-spec.js +++ b/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() })