Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
meta: merge node/master into node-chakracore/master
Browse files Browse the repository at this point in the history
Merge 858b48b as of 2018-01-14
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: Jack Horton <jahorto@microsoft.com>
  • Loading branch information
chakrabot committed Jan 30, 2018
2 parents 0bdb2b1 + 858b48b commit e32462b
Show file tree
Hide file tree
Showing 33 changed files with 358 additions and 1,941 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.5',
'v8_embedder_string': '-node.6',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
5 changes: 2 additions & 3 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2230,9 +2230,8 @@ Location Module::GetModuleRequestLocation(int i) const {

Local<Value> Module::GetModuleNamespace() {
Utils::ApiCheck(
GetStatus() == kEvaluated, "v8::Module::GetModuleNamespace",
"v8::Module::GetModuleNamespace can only be used on a module with "
"status kEvaluated");
GetStatus() >= kInstantiated, "v8::Module::GetModuleNamespace",
"v8::Module::GetModuleNamespace must be used on an instantiated module");
i::Handle<i::Module> self = Utils::OpenHandle(this);
i::Handle<i::JSModuleNamespace> module_namespace =
i::Module::GetModuleNamespace(self);
Expand Down
111 changes: 111 additions & 0 deletions deps/v8/test/cctest/test-modules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,115 @@ TEST(ModuleEvaluationCompletion2) {
CHECK(!try_catch.HasCaught());
}

TEST(ModuleNamespace) {
Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
LocalContext env;
v8::TryCatch try_catch(isolate);

Local<v8::Object> ReferenceError =
CompileRun("ReferenceError")->ToObject(env.local()).ToLocalChecked();

Local<String> source_text = v8_str(
"import {a, b} from 'export var a = 1; export let b = 2';"
"export function geta() {return a};"
"export function getb() {return b};"
"export let radio = 3;"
"export var gaga = 4;");
ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate());
ScriptCompiler::Source source(source_text, origin);
Local<Module> module =
ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked();
CHECK_EQ(Module::kUninstantiated, module->GetStatus());
CHECK(module
->InstantiateModule(env.local(),
CompileSpecifierAsModuleResolveCallback)
.FromJust());
CHECK_EQ(Module::kInstantiated, module->GetStatus());
Local<Value> ns = module->GetModuleNamespace();
CHECK_EQ(Module::kInstantiated, module->GetStatus());
Local<v8::Object> nsobj = ns->ToObject(env.local()).ToLocalChecked();

// a, b
CHECK(nsobj->Get(env.local(), v8_str("a")).ToLocalChecked()->IsUndefined());
CHECK(nsobj->Get(env.local(), v8_str("b")).ToLocalChecked()->IsUndefined());

// geta
{
auto geta = nsobj->Get(env.local(), v8_str("geta")).ToLocalChecked();
auto a = geta.As<v8::Function>()
->Call(env.local(), geta, 0, nullptr)
.ToLocalChecked();
CHECK(a->IsUndefined());
}

// getb
{
v8::TryCatch inner_try_catch(isolate);
auto getb = nsobj->Get(env.local(), v8_str("getb")).ToLocalChecked();
CHECK(
getb.As<v8::Function>()->Call(env.local(), getb, 0, nullptr).IsEmpty());
CHECK(inner_try_catch.HasCaught());
CHECK(inner_try_catch.Exception()
->InstanceOf(env.local(), ReferenceError)
.FromJust());
}

// radio
{
v8::TryCatch inner_try_catch(isolate);
// https://bugs.chromium.org/p/v8/issues/detail?id=7235
// CHECK(nsobj->Get(env.local(), v8_str("radio")).IsEmpty());
CHECK(nsobj->Get(env.local(), v8_str("radio"))
.ToLocalChecked()
->IsUndefined());
CHECK(inner_try_catch.HasCaught());
CHECK(inner_try_catch.Exception()
->InstanceOf(env.local(), ReferenceError)
.FromJust());
}

// gaga
{
auto gaga = nsobj->Get(env.local(), v8_str("gaga")).ToLocalChecked();
CHECK(gaga->IsUndefined());
}

CHECK(!try_catch.HasCaught());
CHECK_EQ(Module::kInstantiated, module->GetStatus());
module->Evaluate(env.local()).ToLocalChecked();
CHECK_EQ(Module::kEvaluated, module->GetStatus());

// geta
{
auto geta = nsobj->Get(env.local(), v8_str("geta")).ToLocalChecked();
auto a = geta.As<v8::Function>()
->Call(env.local(), geta, 0, nullptr)
.ToLocalChecked();
CHECK_EQ(1, a->Int32Value(env.local()).FromJust());
}

// getb
{
auto getb = nsobj->Get(env.local(), v8_str("getb")).ToLocalChecked();
auto b = getb.As<v8::Function>()
->Call(env.local(), getb, 0, nullptr)
.ToLocalChecked();
CHECK_EQ(2, b->Int32Value(env.local()).FromJust());
}

// radio
{
auto radio = nsobj->Get(env.local(), v8_str("radio")).ToLocalChecked();
CHECK_EQ(3, radio->Int32Value(env.local()).FromJust());
}

// gaga
{
auto gaga = nsobj->Get(env.local(), v8_str("gaga")).ToLocalChecked();
CHECK_EQ(4, gaga->Int32Value(env.local()).FromJust());
}

CHECK(!try_catch.HasCaught());
}
} // anonymous namespace
14 changes: 14 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,18 @@ Importing assert directly is not recommended as the exposed functions will use
loose equality checks. Use `require('assert').strict` instead. The API is the
same as the legacy assert but it will always use strict equality checks.
<a id="DEP0090"></a>
### DEP0090: Invalid GCM authentication tag lengths
Type: Runtime
Node.js supports all GCM authentication tag lengths which are accepted by
OpenSSL when calling [`decipher.setAuthTag()`][]. This behavior will change in
a future version at which point only authentication tag lengths of 128, 120,
112, 104, 96, 64, and 32 bits will be allowed. Authentication tags whose length
is not included in this list will be considered invalid in compliance with
[NIST SP 800-38D][].
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
[`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer
Expand All @@ -821,6 +833,7 @@ same as the legacy assert but it will always use strict equality checks.
[`console.log()`]: console.html#console_console_log_data_args
[`crypto.createCredentials()`]: crypto.html#crypto_crypto_createcredentials_details
[`crypto.pbkdf2()`]: crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback
[`decipher.setAuthTag()`]: crypto.html#crypto_decipher_setauthtag_buffer
[`domain`]: domain.html
[`ecdh.setPublicKey()`]: crypto.html#crypto_ecdh_setpublickey_publickey_encoding
[`emitter.listenerCount(eventName)`]: events.html#events_emitter_listenercount_eventname
Expand Down Expand Up @@ -871,4 +884,5 @@ same as the legacy assert but it will always use strict equality checks.
[alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size
[from_arraybuffer]: buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length
[from_string_encoding]: buffer.html#buffer_class_method_buffer_from_string_encoding
[NIST SP 800-38D]: http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
[`REPLServer.clearBufferedCommand()`]: repl.html#repl_replserver_clearbufferedcommand
Loading

0 comments on commit e32462b

Please sign in to comment.