Bug 749128 - Make sure to have JSContext before creating TabChildGlobal, r=jst

This commit is contained in:
Olli Pettay 2012-04-26 23:56:46 +03:00
parent c5d596b74e
commit 3c497e9072
2 changed files with 10 additions and 1 deletions

View File

@ -907,6 +907,8 @@ TabChild::InitTabChildGlobal()
NS_ENSURE_TRUE(InitTabChildGlobalInternal(scopeSupports), false);
scope->Init();
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(chromeHandler);
NS_ENSURE_TRUE(root, false);
root->SetParentTarget(scope);
@ -990,13 +992,19 @@ SendAsyncMessageToParent(void* aCallbackData,
TabChildGlobal::TabChildGlobal(TabChild* aTabChild)
: mTabChild(aTabChild)
{
}
void
TabChildGlobal::Init()
{
NS_ASSERTION(!mMessageManager, "Re-initializing?!?");
mMessageManager = new nsFrameMessageManager(false,
SendSyncMessageToParent,
SendAsyncMessageToParent,
nsnull,
mTabChild,
nsnull,
aTabChild->GetJSContext());
mTabChild->GetJSContext());
}
NS_IMPL_CYCLE_COLLECTION_CLASS(TabChildGlobal)

View File

@ -94,6 +94,7 @@ class TabChildGlobal : public nsDOMEventTargetHelper,
{
public:
TabChildGlobal(TabChild* aTabChild);
void Init();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)