Bug 1326453 - Part 2: Change @@toStringTag for module namespace objects to non-configurable. r=jonco
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 30 Dec 2016 14:26:04 -0800
changeset 328028 3768e0fa8f4928f5735305e2f7c28afab637f898
parent 328027 aed67a3bb87758948f42693d94558e480912c759
child 328029 5459a408763b5c569c87da171a68bd6813965fe0
push id85352
push usercbook@mozilla.com
push dateThu, 05 Jan 2017 07:30:34 +0000
treeherdermozilla-inbound@07de2edd9c25 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1326453
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1326453 - Part 2: Change @@toStringTag for module namespace objects to non-configurable. r=jonco
js/src/builtin/ModuleObject.cpp
js/src/jit-test/tests/modules/import-namespace.js
--- a/js/src/builtin/ModuleObject.cpp
+++ b/js/src/builtin/ModuleObject.cpp
@@ -389,17 +389,17 @@ ModuleNamespaceObject::ProxyHandler::get
     Rooted<ModuleNamespaceObject*> ns(cx, &proxy->as<ModuleNamespaceObject>());
     if (JSID_IS_SYMBOL(id)) {
         Rooted<JS::Symbol*> symbol(cx, JSID_TO_SYMBOL(id));
         if (symbol == cx->wellKnownSymbols().toStringTag) {
             RootedValue value(cx, StringValue(cx->names().Module));
             desc.object().set(proxy);
             desc.setWritable(false);
             desc.setEnumerable(false);
-            desc.setConfigurable(true);
+            desc.setConfigurable(false);
             desc.setValue(value);
             return true;
         }
 
         return true;
     }
 
     const IndirectBindingMap& bindings = ns->bindings();
--- a/js/src/jit-test/tests/modules/import-namespace.js
+++ b/js/src/jit-test/tests/modules/import-namespace.js
@@ -54,17 +54,17 @@ assertThrowsInstanceOf(function() { ns.a
 delete ns.foo;
 assertThrowsInstanceOf(function() { delete ns.a; }, TypeError);
 
 // Test @@toStringTag property
 desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag);
 assertEq(desc.value, "Module");
 assertEq(desc.writable, false);
 assertEq(desc.enumerable, false);
-assertEq(desc.configurable, true);
+assertEq(desc.configurable, false);
 assertEq(typeof desc.get, "undefined");
 assertEq(typeof desc.set, "undefined");
 assertEq(Object.prototype.toString.call(ns), "[object Module]");
 
 // Test cyclic namespace import and access in module evaluation.
 let c = moduleRepo['c'] =
     parseModule("export let c = 1; import * as ns from 'd'; let d = ns.d;");
 let d = moduleRepo['d'] =