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

Commit e32462b

Browse files
committed
meta: merge node/master into node-chakracore/master
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>
2 parents 0bdb2b1 + 858b48b commit e32462b

33 files changed

+358
-1941
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

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

3434
# Enable disassembler for `--print-code` v8 options
3535
'v8_enable_disassembler': 1,

deps/v8/src/api.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,9 +2230,8 @@ Location Module::GetModuleRequestLocation(int i) const {
22302230

22312231
Local<Value> Module::GetModuleNamespace() {
22322232
Utils::ApiCheck(
2233-
GetStatus() == kEvaluated, "v8::Module::GetModuleNamespace",
2234-
"v8::Module::GetModuleNamespace can only be used on a module with "
2235-
"status kEvaluated");
2233+
GetStatus() >= kInstantiated, "v8::Module::GetModuleNamespace",
2234+
"v8::Module::GetModuleNamespace must be used on an instantiated module");
22362235
i::Handle<i::Module> self = Utils::OpenHandle(this);
22372236
i::Handle<i::JSModuleNamespace> module_namespace =
22382237
i::Module::GetModuleNamespace(self);

deps/v8/test/cctest/test-modules.cc

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,115 @@ TEST(ModuleEvaluationCompletion2) {
281281
CHECK(!try_catch.HasCaught());
282282
}
283283

284+
TEST(ModuleNamespace) {
285+
Isolate* isolate = CcTest::isolate();
286+
HandleScope scope(isolate);
287+
LocalContext env;
288+
v8::TryCatch try_catch(isolate);
289+
290+
Local<v8::Object> ReferenceError =
291+
CompileRun("ReferenceError")->ToObject(env.local()).ToLocalChecked();
292+
293+
Local<String> source_text = v8_str(
294+
"import {a, b} from 'export var a = 1; export let b = 2';"
295+
"export function geta() {return a};"
296+
"export function getb() {return b};"
297+
"export let radio = 3;"
298+
"export var gaga = 4;");
299+
ScriptOrigin origin = ModuleOrigin(v8_str("file.js"), CcTest::isolate());
300+
ScriptCompiler::Source source(source_text, origin);
301+
Local<Module> module =
302+
ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked();
303+
CHECK_EQ(Module::kUninstantiated, module->GetStatus());
304+
CHECK(module
305+
->InstantiateModule(env.local(),
306+
CompileSpecifierAsModuleResolveCallback)
307+
.FromJust());
308+
CHECK_EQ(Module::kInstantiated, module->GetStatus());
309+
Local<Value> ns = module->GetModuleNamespace();
310+
CHECK_EQ(Module::kInstantiated, module->GetStatus());
311+
Local<v8::Object> nsobj = ns->ToObject(env.local()).ToLocalChecked();
312+
313+
// a, b
314+
CHECK(nsobj->Get(env.local(), v8_str("a")).ToLocalChecked()->IsUndefined());
315+
CHECK(nsobj->Get(env.local(), v8_str("b")).ToLocalChecked()->IsUndefined());
316+
317+
// geta
318+
{
319+
auto geta = nsobj->Get(env.local(), v8_str("geta")).ToLocalChecked();
320+
auto a = geta.As<v8::Function>()
321+
->Call(env.local(), geta, 0, nullptr)
322+
.ToLocalChecked();
323+
CHECK(a->IsUndefined());
324+
}
325+
326+
// getb
327+
{
328+
v8::TryCatch inner_try_catch(isolate);
329+
auto getb = nsobj->Get(env.local(), v8_str("getb")).ToLocalChecked();
330+
CHECK(
331+
getb.As<v8::Function>()->Call(env.local(), getb, 0, nullptr).IsEmpty());
332+
CHECK(inner_try_catch.HasCaught());
333+
CHECK(inner_try_catch.Exception()
334+
->InstanceOf(env.local(), ReferenceError)
335+
.FromJust());
336+
}
337+
338+
// radio
339+
{
340+
v8::TryCatch inner_try_catch(isolate);
341+
// https://bugs.chromium.org/p/v8/issues/detail?id=7235
342+
// CHECK(nsobj->Get(env.local(), v8_str("radio")).IsEmpty());
343+
CHECK(nsobj->Get(env.local(), v8_str("radio"))
344+
.ToLocalChecked()
345+
->IsUndefined());
346+
CHECK(inner_try_catch.HasCaught());
347+
CHECK(inner_try_catch.Exception()
348+
->InstanceOf(env.local(), ReferenceError)
349+
.FromJust());
350+
}
351+
352+
// gaga
353+
{
354+
auto gaga = nsobj->Get(env.local(), v8_str("gaga")).ToLocalChecked();
355+
CHECK(gaga->IsUndefined());
356+
}
357+
358+
CHECK(!try_catch.HasCaught());
359+
CHECK_EQ(Module::kInstantiated, module->GetStatus());
360+
module->Evaluate(env.local()).ToLocalChecked();
361+
CHECK_EQ(Module::kEvaluated, module->GetStatus());
362+
363+
// geta
364+
{
365+
auto geta = nsobj->Get(env.local(), v8_str("geta")).ToLocalChecked();
366+
auto a = geta.As<v8::Function>()
367+
->Call(env.local(), geta, 0, nullptr)
368+
.ToLocalChecked();
369+
CHECK_EQ(1, a->Int32Value(env.local()).FromJust());
370+
}
371+
372+
// getb
373+
{
374+
auto getb = nsobj->Get(env.local(), v8_str("getb")).ToLocalChecked();
375+
auto b = getb.As<v8::Function>()
376+
->Call(env.local(), getb, 0, nullptr)
377+
.ToLocalChecked();
378+
CHECK_EQ(2, b->Int32Value(env.local()).FromJust());
379+
}
380+
381+
// radio
382+
{
383+
auto radio = nsobj->Get(env.local(), v8_str("radio")).ToLocalChecked();
384+
CHECK_EQ(3, radio->Int32Value(env.local()).FromJust());
385+
}
386+
387+
// gaga
388+
{
389+
auto gaga = nsobj->Get(env.local(), v8_str("gaga")).ToLocalChecked();
390+
CHECK_EQ(4, gaga->Int32Value(env.local()).FromJust());
391+
}
392+
393+
CHECK(!try_catch.HasCaught());
394+
}
284395
} // anonymous namespace

doc/api/deprecations.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,18 @@ Importing assert directly is not recommended as the exposed functions will use
807807
loose equality checks. Use `require('assert').strict` instead. The API is the
808808
same as the legacy assert but it will always use strict equality checks.
809809
810+
<a id="DEP0090"></a>
811+
### DEP0090: Invalid GCM authentication tag lengths
812+
813+
Type: Runtime
814+
815+
Node.js supports all GCM authentication tag lengths which are accepted by
816+
OpenSSL when calling [`decipher.setAuthTag()`][]. This behavior will change in
817+
a future version at which point only authentication tag lengths of 128, 120,
818+
112, 104, 96, 64, and 32 bits will be allowed. Authentication tags whose length
819+
is not included in this list will be considered invalid in compliance with
820+
[NIST SP 800-38D][].
821+
810822
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
811823
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array
812824
[`Buffer.from(buffer)`]: buffer.html#buffer_class_method_buffer_from_buffer
@@ -821,6 +833,7 @@ same as the legacy assert but it will always use strict equality checks.
821833
[`console.log()`]: console.html#console_console_log_data_args
822834
[`crypto.createCredentials()`]: crypto.html#crypto_crypto_createcredentials_details
823835
[`crypto.pbkdf2()`]: crypto.html#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback
836+
[`decipher.setAuthTag()`]: crypto.html#crypto_decipher_setauthtag_buffer
824837
[`domain`]: domain.html
825838
[`ecdh.setPublicKey()`]: crypto.html#crypto_ecdh_setpublickey_publickey_encoding
826839
[`emitter.listenerCount(eventName)`]: events.html#events_emitter_listenercount_eventname
@@ -871,4 +884,5 @@ same as the legacy assert but it will always use strict equality checks.
871884
[alloc_unsafe_size]: buffer.html#buffer_class_method_buffer_allocunsafe_size
872885
[from_arraybuffer]: buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length
873886
[from_string_encoding]: buffer.html#buffer_class_method_buffer_from_string_encoding
887+
[NIST SP 800-38D]: http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
874888
[`REPLServer.clearBufferedCommand()`]: repl.html#repl_replserver_clearbufferedcommand

0 commit comments

Comments
 (0)