зеркало из https://github.com/mozilla/gecko-dev.git
Bug 984467 - Replace GetNativeOfWrapper + QI bit with xpc::WindowOrNull(scope). r=bz
This commit is contained in:
Родитель
febff8480f
Коммит
4c3234f270
|
@ -7607,23 +7607,11 @@ nsGlobalWindow::CallerInnerWindow()
|
|||
}
|
||||
}
|
||||
JSAutoCompartment ac(cx, scope);
|
||||
nsGlobalWindow* win = xpc::WindowOrNull(scope);
|
||||
|
||||
// We don't use xpc::WindowOrNull here because we want to be able to tell
|
||||
// apart the cases of "scope is not an nsISupports at all" and "scope is an
|
||||
// nsISupports that's not a window". It's not clear whether that's desirable,
|
||||
// see bug 984467.
|
||||
nsISupports* native =
|
||||
nsContentUtils::XPConnect()->GetNativeOfWrapper(cx, scope);
|
||||
if (!native)
|
||||
return nullptr;
|
||||
|
||||
// The calling window must be holding a reference, so we can just return a
|
||||
// raw pointer here and let the QI's addref be balanced by the nsCOMPtr
|
||||
// destructor's release.
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(native);
|
||||
if (!win)
|
||||
return GetCurrentInnerWindowInternal();
|
||||
return static_cast<nsGlobalWindow*>(win.get());
|
||||
return win;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче