Bug 796938 - Switch to GetEntryGlobal in GetCallerDocShellTreeItem. r=smaug
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -5911,25 +5911,18 @@ nsGlobalWindow::RefreshCompartmentPrinci
JS_SetCompartmentPrincipals(js::GetObjectCompartment(GetWrapperPreserveColor()),
nsJSPrincipals::get(mDoc->NodePrincipal()));
}
static already_AddRefed<nsIDocShellTreeItem>
GetCallerDocShellTreeItem()
{
- JSContext *cx = nsContentUtils::GetCurrentJSContext();
- nsCOMPtr<nsIDocShellTreeItem> callerItem;
-
- if (cx) {
- nsCOMPtr<nsIWebNavigation> callerWebNav =
- do_GetInterface(nsJSUtils::GetDynamicScriptGlobal(cx));
-
- callerItem = do_QueryInterface(callerWebNav);
- }
+ nsCOMPtr<nsIWebNavigation> callerWebNav = do_GetInterface(GetEntryGlobal());
+ nsCOMPtr<nsIDocShellTreeItem> callerItem = do_QueryInterface(callerWebNav);
return callerItem.forget();
}
bool
nsGlobalWindow::WindowExists(const nsAString& aName,
bool aLookForCallerOnJSStack)
{