diff --git a/mozilla/dom/src/base/nsGlobalWindow.cpp b/mozilla/dom/src/base/nsGlobalWindow.cpp index 55e292932d3..e17612c3307 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.cpp +++ b/mozilla/dom/src/base/nsGlobalWindow.cpp @@ -5010,8 +5010,8 @@ nsGlobalWindow::GetFrames(nsIDOMWindow** aFrames) return NS_OK; } -static nsGlobalWindow* -CallerInnerWindow() +nsGlobalWindow* +nsGlobalWindow::CallerInnerWindow() { nsAXPCNativeCallContext *ncc; nsresult rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc); @@ -5041,6 +5041,8 @@ CallerInnerWindow() // raw pointer here and let the QI's addref be balanced by the nsCOMPtr // destructor's release. nsCOMPtr win = do_QueryWrappedNative(wrapper); + if (!win) + return GetCurrentInnerWindowInternal(); return static_cast(win.get()); } diff --git a/mozilla/dom/src/base/nsGlobalWindow.h b/mozilla/dom/src/base/nsGlobalWindow.h index f1a3e575938..8517d63b343 100644 --- a/mozilla/dom/src/base/nsGlobalWindow.h +++ b/mozilla/dom/src/base/nsGlobalWindow.h @@ -435,6 +435,7 @@ protected: void ClearControllers(); void FreeInnerObjects(PRBool aClearScope); + nsGlobalWindow *CallerInnerWindow(); nsresult SetNewDocument(nsIDocument *aDocument, nsISupports *aState,