From d9fab1fdb76ae3a69b5812a7f2190cf3e58f6d75 Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Mon, 28 Oct 2019 11:12:22 +0100 Subject: deps: V8: cherry-pick 777fa98 Original commit message: Make SetSyntheticModuleExport throw instead of crash for nonexistent export name Per spec, Module::SetSyntheticModuleExport should throw a ReferenceError when called with an export name that was not supplied when constructing that SyntheticModule. Instead, the current implementation crashes with a failed CHECK(). Add a new Module::SyntheticModuleSetExport that throws (without an ensuing crash) for this case, and deprecate the old Module::SetSyntheticModuleExport. Bug: v8:9828 Change-Id: I3b3d353064c3851882781818099bd8f6ee74c809 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1860996 Reviewed-by: Adam Klein Reviewed-by: Georg Neis Commit-Queue: Dan Clark Cr-Commit-Position: refs/heads/master@{#64438} Refs: https://github.com/v8/v8/commit/777fa98cc47ac32f0fde3d9aafd830949deb5d23 PR-URL: https://github.com/nodejs/node/pull/30020 Reviewed-By: Colin Ihrig Reviewed-By: Jiawen Geng Reviewed-By: Anna Henningsen Reviewed-By: Matteo Collina --- deps/v8/src/objects/synthetic-module.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'deps/v8/src/objects/synthetic-module.h') diff --git a/deps/v8/src/objects/synthetic-module.h b/deps/v8/src/objects/synthetic-module.h index 6f3bb0438e..77a6eed276 100644 --- a/deps/v8/src/objects/synthetic-module.h +++ b/deps/v8/src/objects/synthetic-module.h @@ -24,9 +24,21 @@ class SyntheticModule DECL_VERIFIER(SyntheticModule) DECL_PRINTER(SyntheticModule) - static void SetExport(Isolate* isolate, Handle module, - Handle export_name, - Handle export_value); + // Set module's exported value for the specified export_name to the specified + // export_value. An error will be thrown if export_name is not one + // of the export_names that were supplied during module construction. + // Returns Just(true) on success, Nothing() if an error was thrown. + static Maybe SetExport(Isolate* isolate, Handle module, + Handle export_name, + Handle export_value); + // The following redundant method should be deleted when the deprecated + // version of v8::SetSyntheticModuleExport is removed. It differs from + // SetExport in that it crashes rather than throwing an error if the caller + // attempts to set an export_name that was not present during construction of + // the module. + static void SetExportStrict(Isolate* isolate, Handle module, + Handle export_name, + Handle export_value); using BodyDescriptor = SubclassBodyDescriptor< Module::BodyDescriptor, -- cgit v1.2.3