From d584c954527c2a5ef53078676eb673a133917304 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 24 Jan 2013 20:39:27 +0100 Subject: [PATCH] Bug 833817 part 2 - Remove unused frame argument from GetFunctionObjectPrincipal. r=bholley --HG-- extra : rebase_source : 1a7e2428c64d806960fa749095b7d0b9ec439c01 --- caps/include/nsScriptSecurityManager.h | 8 +++----- caps/src/nsScriptSecurityManager.cpp | 20 ++------------------ 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/caps/include/nsScriptSecurityManager.h b/caps/include/nsScriptSecurityManager.h index c666e86523f9..13d6f68bdd62 100644 --- a/caps/include/nsScriptSecurityManager.h +++ b/caps/include/nsScriptSecurityManager.h @@ -440,12 +440,10 @@ private: // Returns null if a principal cannot be found. Note that rv can be NS_OK // when this happens -- this means that there was no script associated // with the function object, and no global object associated with the scope - // of obj (the last object on its parent chain). If the caller is walking - // the JS stack, fp must point to the current frame in the stack iteration. - // Callers MUST pass in a non-null rv here. + // of obj (the last object on its parent chain). Callers MUST pass in a + // non-null rv here. static nsIPrincipal* - GetFunctionObjectPrincipal(JSContext* cx, JSObject* obj, JSStackFrame *fp, - nsresult* rv); + GetFunctionObjectPrincipal(JSContext* cx, JSObject* obj, nsresult* rv); /** * Check capability levels for an |aObj| that implements diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index fc06e2d81d56..b8604ca7c62e 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -1611,7 +1611,7 @@ nsScriptSecurityManager::CheckFunctionAccess(JSContext *aCx, void *aFunObj, // This check is called for event handlers nsresult rv; nsIPrincipal* subject = - GetFunctionObjectPrincipal(aCx, (JSObject *)aFunObj, nullptr, &rv); + GetFunctionObjectPrincipal(aCx, (JSObject *)aFunObj, &rv); // If subject is null, get a principal from the function object's scope. if (NS_SUCCEEDED(rv) && !subject) @@ -1971,7 +1971,6 @@ nsScriptSecurityManager::GetScriptPrincipal(JSScript *script, nsIPrincipal* nsScriptSecurityManager::GetFunctionObjectPrincipal(JSContext *cx, JSObject *obj, - JSStackFrame *fp, nsresult *rv) { NS_PRECONDITION(rv, "Null out param"); @@ -1996,22 +1995,7 @@ nsScriptSecurityManager::GetFunctionObjectPrincipal(JSContext *cx, return nullptr; } - JSScript *frameScript = fp ? JS_GetFrameScript(cx, fp) : nullptr; - - if (frameScript && frameScript != script) - { - // There is a frame script, and it's different from the - // function script. In this case we're dealing with either - // an eval or a Script object, and in these cases the - // principal we want is in the frame's script, not in the - // function's script. The function's script is where the - // eval-calling code came from, not where the eval or new - // Script object came from, and we want the principal of - // the eval function object or new Script object. - - script = frameScript; - } - else if (!js::IsOriginalScriptFunction(fun)) + if (!js::IsOriginalScriptFunction(fun)) { // Here, obj is a cloned function object. In this case, the // clone's prototype may have been precompiled from brutally