Bug 1287401 - Enter the callback's compartment before running it in the JS shell's ForwardingPromiseRejectionTrackerCallback. r=jandem
authorTill Schneidereit <till@tillschneidereit.net>
Tue, 19 Jul 2016 03:13:00 +0200
changeset 345823 6b5a1893be9137df17e9c271e0c6a3d0e15c3983
parent 345822 875e441f8b804adaf67ad704171c8b2f04015499
child 345824 6ed62e6074afa9f70dd7921533d2f3b1f7c5e622
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1287401
milestone50.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 1287401 - Enter the callback's compartment before running it in the JS shell's ForwardingPromiseRejectionTrackerCallback. r=jandem
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -687,16 +687,18 @@ static void
 ForwardingPromiseRejectionTrackerCallback(JSContext* cx, JS::HandleObject promise,
                                           PromiseRejectionHandlingState state, void* data)
 {
     RootedValue callback(cx, GetShellContext(cx)->promiseRejectionTrackerCallback);
     if (callback.isNull()) {
         return;
     }
 
+    AutoCompartment ac(cx, &callback.toObject());
+
     FixedInvokeArgs<2> args(cx);
     args[0].setObject(*promise);
     args[1].setInt32(static_cast<int32_t>(state));
 
     RootedValue rval(cx);
     if (!Call(cx, callback, UndefinedHandleValue, args, &rval))
         JS_ClearPendingException(cx);
 }