Attachment #630223: Part 3 - Pull subject principals directly off the compartment. v3 for bug #754202

View | Details | Raw Unified | Return to bug 754202
Collapse All | Expand All

(-)a/caps/src/nsScriptSecurityManager.cpp (-3 / +9 lines)
Line     Link Here 
 Lines 2359-2377   nsScriptSecurityManager::GetPrincipalAndFrame(JSContext *cx, Link Here 
2359
2359
2360
    return nsnull;
2360
    return nsnull;
2361
}
2361
}
2362
2362
2363
nsIPrincipal*
2363
nsIPrincipal*
2364
nsScriptSecurityManager::GetSubjectPrincipal(JSContext *cx,
2364
nsScriptSecurityManager::GetSubjectPrincipal(JSContext *cx,
2365
                                             nsresult* rv)
2365
                                             nsresult* rv)
2366
{
2366
{
2367
    NS_PRECONDITION(rv, "Null out param");
2367
    *rv = NS_OK;
2368
    JSStackFrame *fp;
2368
    JSCompartment *compartment = js::GetContextCompartment(cx);
2369
    return GetPrincipalAndFrame(cx, &fp, rv);
2369
2370
    // The context should always be in a compartment, either one it has entered
2371
    // or the one associated with its global.
2372
    MOZ_ASSERT(!!compartment);
2373
2374
    JSPrincipals *principals = JS_GetCompartmentPrincipals(compartment);
2375
    return nsJSPrincipals::get(principals);
2370
}
2376
}
2371
2377
2372
NS_IMETHODIMP
2378
NS_IMETHODIMP
2373
nsScriptSecurityManager::GetObjectPrincipal(JSContext *aCx, JSObject *aObj,
2379
nsScriptSecurityManager::GetObjectPrincipal(JSContext *aCx, JSObject *aObj,
2374
                                            nsIPrincipal **result)
2380
                                            nsIPrincipal **result)
2375
{
2381
{
2376
    *result = doGetObjectPrincipal(aObj);
2382
    *result = doGetObjectPrincipal(aObj);
2377
    if (!*result)
2383
    if (!*result)

Return to bug 754202