Bug 1031988 - Grab the principal from the object rather than the window when resolving the controller shim. r=bz

This commit is contained in:
Bobby Holley 2014-07-02 10:13:14 -07:00
parent dfc928aba7
commit b4d5c952de

View File

@ -2628,9 +2628,12 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
} }
#ifdef USE_CONTROLLERS_SHIM #ifdef USE_CONTROLLERS_SHIM
// Note: We use |obj| rather than |aWin| to get the principal here, because
// this is called during Window setup when the Document isn't necessarily
// hooked up yet.
if (id == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_CONTROLLERS) && if (id == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_CONTROLLERS) &&
!xpc::IsXrayWrapper(obj) && !xpc::IsXrayWrapper(obj) &&
!nsContentUtils::IsSystemPrincipal(aWin->GetPrincipal())) !nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(obj)))
{ {
if (aWin->GetDoc()) { if (aWin->GetDoc()) {
aWin->GetDoc()->WarnOnceAbout(nsIDocument::eWindow_Controllers); aWin->GetDoc()->WarnOnceAbout(nsIDocument::eWindow_Controllers);