summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-14 08:57:05 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-14 08:57:05 +0200
commit3bd16c90800e8ec6ef8d7f135d8435bbbc0b94e6 (patch)
tree576255c3e2539df2f289cbb48564e82c6d5a307b /js
parent05505d2e83d0c11beb6bc8b5c5a0daf68934c342 (diff)
downloadUXP-3bd16c90800e8ec6ef8d7f135d8435bbbc0b94e6.tar
UXP-3bd16c90800e8ec6ef8d7f135d8435bbbc0b94e6.tar.gz
UXP-3bd16c90800e8ec6ef8d7f135d8435bbbc0b94e6.tar.lz
UXP-3bd16c90800e8ec6ef8d7f135d8435bbbc0b94e6.tar.xz
UXP-3bd16c90800e8ec6ef8d7f135d8435bbbc0b94e6.zip
Bug 1341256 - Fix module namespace object get handler
Diffstat (limited to 'js')
-rw-r--r--js/src/builtin/ModuleObject.cpp6
-rw-r--r--js/src/jit-test/tests/modules/import-namespace.js3
2 files changed, 7 insertions, 2 deletions
diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp
index f13a2b78a..444d8962d 100644
--- a/js/src/builtin/ModuleObject.cpp
+++ b/js/src/builtin/ModuleObject.cpp
@@ -464,8 +464,10 @@ ModuleNamespaceObject::ProxyHandler::get(JSContext* cx, HandleObject proxy, Hand
ModuleEnvironmentObject* env;
Shape* shape;
- if (!ns->bindings().lookup(id, &env, &shape))
- return false;
+ if (!ns->bindings().lookup(id, &env, &shape)) {
+ vp.setUndefined();
+ return true;
+ }
RootedValue value(cx, env->getSlot(shape->slot()));
if (value.isMagic(JS_UNINITIALIZED_LEXICAL)) {
diff --git a/js/src/jit-test/tests/modules/import-namespace.js b/js/src/jit-test/tests/modules/import-namespace.js
index 2094c27fe..0287f7a60 100644
--- a/js/src/jit-test/tests/modules/import-namespace.js
+++ b/js/src/jit-test/tests/modules/import-namespace.js
@@ -45,6 +45,9 @@ b.evaluation();
testHasNames(getModuleEnvironmentNames(b), ["ns", "x"]);
let ns = getModuleEnvironmentValue(b, "ns");
testHasNames(Object.keys(ns), ["a", "b"]);
+assertEq(ns.a, 1);
+assertEq(ns.b, 2);
+assertEq(ns.c, undefined);
assertEq(getModuleEnvironmentValue(b, "x"), 3);
// Test module namespace internal methods as defined in 9.4.6