diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index f4ee2f12a9f..c0d31bd7026 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -2492,6 +2492,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChildGlobal) NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender) NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager) NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal) + NS_INTERFACE_MAP_ENTRY(nsIGlobalObject) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ContentFrameMessageManager) NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper) @@ -2556,10 +2557,20 @@ TabChildGlobal::GetJSContextForEventHandlers() return nsContentUtils::GetSafeJSContext(); } -nsIPrincipal* +nsIPrincipal* TabChildGlobal::GetPrincipal() { if (!mTabChild) return nullptr; return mTabChild->GetPrincipal(); } + +JSObject* +TabChildGlobal::GetGlobalJSObject() +{ + NS_ENSURE_TRUE(mTabChild, nullptr); + nsCOMPtr ref = mTabChild->GetGlobal(); + NS_ENSURE_TRUE(ref, nullptr); + return ref->GetJSObject(); +} + diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index cf42622b898..ab77432bcde 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -51,7 +51,8 @@ class ClonedMessageData; class TabChildGlobal : public nsDOMEventTargetHelper, public nsIContentFrameMessageManager, - public nsIScriptObjectPrincipal + public nsIScriptObjectPrincipal, + public nsIGlobalObject { public: TabChildGlobal(TabChild* aTabChild); @@ -127,6 +128,7 @@ public: virtual JSContext* GetJSContextForEventHandlers() MOZ_OVERRIDE; virtual nsIPrincipal* GetPrincipal() MOZ_OVERRIDE; + virtual JSObject* GetGlobalJSObject() MOZ_OVERRIDE; nsCOMPtr mMessageManager; TabChild* mTabChild;