Bug 796938 - Use GetEntryGlobal in nsWindowWatcher::URIFromURL. r=smaug

This commit is contained in:
Bobby Holley 2014-08-19 12:02:08 -07:00
parent 7af3b3dc36
commit 14a072e068

View File

@ -1346,18 +1346,8 @@ nsWindowWatcher::URIfromURL(const char *aURL,
nsIDOMWindow *aParent,
nsIURI **aURI)
{
nsCOMPtr<nsIDOMWindow> baseWindow;
/* build the URI relative to the calling JS Context, if any.
(note this is the same context used to make the security check
in nsGlobalWindow.cpp.) */
JSContext *cx = nsContentUtils::GetCurrentJSContext();
if (cx) {
nsIScriptContext *scriptcx = nsJSUtils::GetDynamicScriptContext(cx);
if (scriptcx) {
baseWindow = do_QueryInterface(scriptcx->GetGlobalObject());
}
}
// Build the URI relative to the entry global.
nsCOMPtr<nsIDOMWindow> baseWindow = do_QueryInterface(GetEntryGlobal());
// failing that, build it relative to the parent window, if possible
if (!baseWindow)