From 2e76633b8f3c445af75008d051149c879fd63309 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 12 Jun 2014 10:02:33 -0700 Subject: [PATCH] Bug 990090 - Add a version of AutoJSAPIWithErrorsReportedToWindow that takes an nsIGlobalObject. r=bz --- dom/base/ScriptSettings.cpp | 5 +++++ dom/base/ScriptSettings.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/dom/base/ScriptSettings.cpp b/dom/base/ScriptSettings.cpp index e3156ebef90e..b47886195abb 100644 --- a/dom/base/ScriptSettings.cpp +++ b/dom/base/ScriptSettings.cpp @@ -237,6 +237,11 @@ AutoJSAPIWithErrorsReportedToWindow::AutoJSAPIWithErrorsReportedToWindow(nsIScri { } +AutoJSAPIWithErrorsReportedToWindow::AutoJSAPIWithErrorsReportedToWindow(nsIGlobalObject* aGlobalObject) + : AutoJSAPI(FindJSContext(aGlobalObject), /* aIsMainThread = */ true) +{ +} + AutoEntryScript::AutoEntryScript(nsIGlobalObject* aGlobalObject, bool aIsMainThread, JSContext* aCx) diff --git a/dom/base/ScriptSettings.h b/dom/base/ScriptSettings.h index 0bbbe40ac5ff..7097bf010689 100644 --- a/dom/base/ScriptSettings.h +++ b/dom/base/ScriptSettings.h @@ -158,6 +158,8 @@ private: class AutoJSAPIWithErrorsReportedToWindow : public AutoJSAPI { public: AutoJSAPIWithErrorsReportedToWindow(nsIScriptContext* aScx); + // Equivalent to AutoJSAPI if aGlobal is not a Window. + AutoJSAPIWithErrorsReportedToWindow(nsIGlobalObject* aGlobalObject); }; /*