Bug 1257588 - Don't ignore self-hosted frames when getting a saved frame's async cause. r=fitzgen
authorTill Schneidereit <till@tillschneidereit.net>
Tue, 22 Mar 2016 15:54:15 +0100
changeset 289979 9c64ec689d29022d8a5e9b876d91e5d901122430
parent 289978 f19eaabb39588e782f4ed8a785e1f999f7cd3d9f
child 289980 672da685c6fc330d9b8d68e3f1db6cb951f34f8d
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfitzgen
bugs1257588
milestone48.0a1
Bug 1257588 - Don't ignore self-hosted frames when getting a saved frame's async cause. r=fitzgen
js/src/vm/SavedStacks.cpp
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -752,21 +752,27 @@ GetSavedFrameFunctionDisplayName(JSConte
         return SavedFrameResult::AccessDenied;
     }
     namep.set(frame->getFunctionDisplayName());
     return SavedFrameResult::Ok;
 }
 
 JS_PUBLIC_API(SavedFrameResult)
 GetSavedFrameAsyncCause(JSContext* cx, HandleObject savedFrame, MutableHandleString asyncCausep,
-                        SavedFrameSelfHosted selfHosted /* = SavedFrameSelfHosted::Include */)
+                        SavedFrameSelfHosted unused_ /* = SavedFrameSelfHosted::Include */)
 {
     AutoMaybeEnterFrameCompartment ac(cx, savedFrame);
     bool skippedAsync;
-    js::RootedSavedFrame frame(cx, UnwrapSavedFrame(cx, savedFrame, selfHosted, skippedAsync));
+    // This function is always called with self-hosted frames excluded by
+    // GetValueIfNotCached in dom/bindings/Exceptions.cpp. However, we want
+    // to include them because our Promise implementation causes us to have
+    // the async cause on a self-hosted frame. So we just ignore the
+    // parameter and always include self-hosted frames.
+    js::RootedSavedFrame frame(cx, UnwrapSavedFrame(cx, savedFrame, SavedFrameSelfHosted::Include,
+                                                    skippedAsync));
     if (!frame) {
         asyncCausep.set(nullptr);
         return SavedFrameResult::AccessDenied;
     }
     asyncCausep.set(frame->getAsyncCause());
     if (!asyncCausep && skippedAsync)
         asyncCausep.set(cx->names().Async);
     return SavedFrameResult::Ok;