diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 2f13962e3fa0..096d4173544c 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -2776,8 +2776,11 @@ ShortestPaths(JSContext* cx, unsigned argc, Value* vp) return false; RootedValue predecessor(cx, values[i][j][k]); - if (!JS_DefineProperty(cx, part, "predecessor", predecessor, JSPROP_ENUMERATE)) + if (!cx->compartment()->wrap(cx, &predecessor) || + !JS_DefineProperty(cx, part, "predecessor", predecessor, JSPROP_ENUMERATE)) + { return false; + } if (names[i][j][k]) { RootedString edge(cx, NewStringCopyZ(cx, names[i][j][k].get())); diff --git a/js/src/jit-test/tests/heap-analysis/bug-1252912.js b/js/src/jit-test/tests/heap-analysis/bug-1252912.js new file mode 100644 index 000000000000..1240b45456c7 --- /dev/null +++ b/js/src/jit-test/tests/heap-analysis/bug-1252912.js @@ -0,0 +1,6 @@ +try { + x = evalcx('') + toSource = (function() { + }) +} catch (foo) {} +shortestPaths(this, ["$4"], 5)