Bug 1434391 - Fix OOM handling bug in Debugger (and eliminate an unnecessary wrap() call). r=jimb
☠☠ backed out by b04a830d12cd ☠ ☠
authorJason Orendorff <jorendorff@mozilla.com>
Thu, 30 Aug 2018 11:09:46 -0500
changeset 435279 a5b2607fc1885b4f86cc7421fda89a19737788e4
parent 435278 a79ed7cdda373e993746bf7a16320c94fe940b0b
child 435280 f88b838fa1b42b7f8a13817afdf08d080d9ca307
push id34602
push userdvarga@mozilla.com
push dateSat, 08 Sep 2018 03:54:14 +0000
treeherdermozilla-central@da268c77ac76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs1434391
milestone64.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 1434391 - Fix OOM handling bug in Debugger (and eliminate an unnecessary wrap() call). r=jimb
js/src/jit-test/tests/debug/bug1434391.js
js/src/vm/Debugger.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/bug1434391.js
@@ -0,0 +1,6 @@
+var g = newGlobal();
+var dbg = new Debugger();
+var gw = dbg.addDebuggee(g);
+oomTest(function () {
+    assertEq(gw.executeInGlobal("(42).toString(0)").throw.errorMessageName, "JSMSG_BAD_RADIX");
+});
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -10306,19 +10306,18 @@ DebuggerObject::getErrorMessageName(JSCo
 
     const JSErrorFormatString* efs = GetErrorMessage(nullptr, report->errorNumber);
     if (!efs) {
         result.set(nullptr);
         return true;
     }
 
     RootedString str(cx, JS_NewStringCopyZ(cx, efs->name));
-    if (!cx->compartment()->wrap(cx, &str))
-        return false;
-
+    if (!str)
+        return false;
     result.set(str);
     return true;
 }
 
 /* static */ bool
 DebuggerObject::getErrorNotes(JSContext* cx, HandleDebuggerObject object,
                               MutableHandleValue result)
 {