Skip to content

Commit

Permalink
Bug 937317 - Make TabChildGlobal implement nsIGlobalObject. (embedlit…
Browse files Browse the repository at this point in the history
…e version) r=bz
  • Loading branch information
tmeshkova committed Feb 14, 2014
1 parent c96bb1d commit ccb7a8f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions embedding/embedlite/utils/EmbedTabChildGlobal.cpp
Expand Up @@ -42,6 +42,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(EmbedTabChildGlobal)
NS_INTERFACE_MAP_ENTRY(nsISyncMessageSender)
NS_INTERFACE_MAP_ENTRY(nsIContentFrameMessageManager)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsITabChild)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ContentFrameMessageManager)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
Expand Down Expand Up @@ -118,6 +119,15 @@ EmbedTabChildGlobal::GetPrincipal()
return mTabChild->GetPrincipal();
}

JSObject*
EmbedTabChildGlobal::GetGlobalJSObject()
{
NS_ENSURE_TRUE(mTabChild, nullptr);
nsCOMPtr<nsIXPConnectJSObjectHolder> ref = mTabChild->GetGlobal();
NS_ENSURE_TRUE(ref, nullptr);
return ref->GetJSObject();
}

NS_IMETHODIMP
EmbedTabChildGlobal::GetMessageManager(nsIContentFrameMessageManager** aResult)
{
Expand Down
2 changes: 2 additions & 0 deletions embedding/embedlite/utils/EmbedTabChildGlobal.h
Expand Up @@ -19,6 +19,7 @@ class TabChildHelper;
class EmbedTabChildGlobal : public nsDOMEventTargetHelper,
public nsIContentFrameMessageManager,
public nsIScriptObjectPrincipal,
public nsIGlobalObject,
public nsITabChild
{
public:
Expand Down Expand Up @@ -100,6 +101,7 @@ class EmbedTabChildGlobal : public nsDOMEventTargetHelper,
}
virtual JSContext* GetJSContextForEventHandlers() MOZ_OVERRIDE;
virtual nsIPrincipal* GetPrincipal() MOZ_OVERRIDE;
virtual JSObject* GetGlobalJSObject() MOZ_OVERRIDE;

TabChildHelper* mTabChild;
nsRefPtr<nsFrameMessageManager> mMessageManager;
Expand Down

0 comments on commit ccb7a8f

Please sign in to comment.