Bug 1503071: Handle JS_UNINITIALIZED_LEXICAL in FormatValue r=tcampbell
authorIain Ireland <iireland@mozilla.com>
Fri, 09 Nov 2018 18:13:34 +0000
changeset 445459 2d2b47f661d7f23c8bacb331dfc618e1dbce829b
parent 445458 90b08b7a2987447743f1a801b198386927fc733a
child 445460 91ad57be0886fa5bc5a05be9ada2e6d0695903cd
push id35017
push usercsabou@mozilla.com
push dateSat, 10 Nov 2018 09:57:29 +0000
treeherdermozilla-central@e9ff3fec51d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1503071
milestone65.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 1503071: Handle JS_UNINITIALIZED_LEXICAL in FormatValue r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D11500
js/src/jit-test/tests/arguments/bug1503071.js
js/src/jsfriendapi.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/arguments/bug1503071.js
@@ -0,0 +1,16 @@
+// |jit-test| exitstatus: 6
+var g = true
+
+setInterruptCallback(function() {
+    print(getBacktrace({args: true}));
+});
+
+function foo(bt, x=3, y = eval("g")) {
+    if (g) {
+	g = false
+	interruptIf(true);
+	foo(false);
+    }
+    (function()  { n = bt;});
+}
+foo(false);
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -835,17 +835,19 @@ js::DumpScript(JSContext* cx, JSScript* 
     return DumpScript(cx, scriptArg, stdout);
 }
 
 #endif
 
 static const char*
 FormatValue(JSContext* cx, HandleValue v, UniqueChars& bytes)
 {
-    if (v.isMagic(JS_OPTIMIZED_OUT)) {
+    if (v.isMagic()) {
+        MOZ_ASSERT(v.whyMagic() == JS_OPTIMIZED_OUT ||
+                   v.whyMagic() == JS_UNINITIALIZED_LEXICAL);
         return "[unavailable]";
     }
 
     if (IsCallable(v)) {
         return "[function]";
     }
 
     if (v.isObject() && IsCrossCompartmentWrapper(&v.toObject())) {