From e1824e58752ca78ea671f1c498dd576845dedbb3 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 19 Aug 2014 12:02:05 -0700 Subject: [PATCH] Bug 796938 - Switch nsGlobalWindow::Focus to GetEntryGlobal and eliminate nsContentUtils::GetWindowFromCaller. r=smaug --- content/base/public/nsContentUtils.h | 6 ------ content/base/src/nsContentUtils.cpp | 13 ------------- dom/base/nsGlobalWindow.cpp | 2 +- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index be418e725b8..2e6122401a4 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -404,12 +404,6 @@ public: // aWindow can be either outer or inner window. static bool CanCallerAccess(nsPIDOMWindow* aWindow); - /** - * Get the window through the JS context that's currently on the stack. - * If there's no JS context currently on the stack, returns null. - */ - static nsPIDOMWindow *GetWindowFromCaller(); - /** * The two GetDocumentFrom* functions below allow a caller to get at a * document that is relevant to the currently executing script. diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 1029a092582..82219d737e6 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -1953,19 +1953,6 @@ nsContentUtils::TraceSafeJSContext(JSTracer* aTrc) } } -nsPIDOMWindow * -nsContentUtils::GetWindowFromCaller() -{ - JSContext *cx = GetCurrentJSContext(); - if (cx) { - nsCOMPtr win = - do_QueryInterface(nsJSUtils::GetDynamicScriptGlobal(cx)); - return win; - } - - return nullptr; -} - nsIDocument* nsContentUtils::GetDocumentFromCaller() { diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index c4a19838d23..443e12049cd 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -6558,7 +6558,7 @@ nsGlobalWindow::Focus(ErrorResult& aError) return; } - nsIDOMWindow *caller = nsContentUtils::GetWindowFromCaller(); + nsCOMPtr caller = do_QueryInterface(GetEntryGlobal()); nsCOMPtr opener; GetOpener(getter_AddRefs(opener));