Bug 833817 part 2 - Remove unused frame argument from GetFunctionObjectPrincipal. r=bholley

--HG--
extra : rebase_source : 1a7e2428c64d806960fa749095b7d0b9ec439c01
This commit is contained in:
Jan de Mooij 2013-01-24 20:39:27 +01:00
Родитель a3bc96776e
Коммит d584c95452
2 изменённых файлов: 5 добавлений и 23 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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