Bug 957688 - Make ComputeStackString pass a principal and remove checkAccess call. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Fri, 24 Jan 2014 16:08:24 -0800
changeset 181203 f6fb2082c9964d0a5930381cd7bf4ae71e2cb20a
parent 181202 37420d9a2c76d14009c25d84580e03befaa7eae0
child 181204 08b7f4b5b665a4e4c4c83c7b96d22d0e712efbff
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs957688
milestone29.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 957688 - Make ComputeStackString pass a principal and remove checkAccess call. r=mrbkap Now that we have the principal-based filtering for stack walking, we can do this. This isn't technically equivalent to the old behavior, since a stack that goes: A -> B -> A would previous have only seen the second set of |A| frames, whereas now we'd see both sets. But this seems strictly better (also, it doesn't happen on the web). As noted, I've filed a bug for making this context- and saveFrameChain-agnostic.
js/src/jsexn.cpp
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -202,33 +202,28 @@ struct SuppressErrorsGuard
         JS_RestoreExceptionState(cx, prevState);
         JS_SetErrorReporter(cx, prevReporter);
     }
 };
 
 static JSString *
 ComputeStackString(JSContext *cx)
 {
-    JSCheckAccessOp checkAccess = cx->runtime()->securityCallbacks->checkObjectAccess;
-
     StringBuffer sb(cx);
 
     {
         RootedAtom atom(cx);
         SuppressErrorsGuard seg(cx);
-        for (NonBuiltinScriptFrameIter i(cx); !i.done(); ++i) {
-            // Cut off the stack if this callee crosses a trust boundary.
-            if (checkAccess && i.isNonEvalFunctionFrame()) {
-                RootedValue v(cx);
-                RootedId callerid(cx, NameToId(cx->names().caller));
-                RootedObject obj(cx, i.callee());
-                if (!checkAccess(cx, obj, callerid, JSACC_READ, &v))
-                    break;
-            }
-
+        // We should get rid of the CURRENT_CONTEXT and STOP_AT_SAVED here.
+        // See bug 960820.
+        for (NonBuiltinScriptFrameIter i(cx, ScriptFrameIter::CURRENT_CONTEXT,
+                                         ScriptFrameIter::STOP_AT_SAVED,
+                                         cx->compartment()->principals);
+            !i.done(); ++i)
+        {
             /* First append the function name, if any. */
             atom = nullptr;
             if (i.isNonEvalFunctionFrame() && i.callee()->displayAtom())
                 atom = i.callee()->displayAtom();
             if (atom && !sb.append(atom))
                 return nullptr;
 
             /* Next a @ separating function name from source location. */