Bug 1250063 - Part 2: don't call notifyTabContextUpdated(). r=sicking

This commit is contained in:
Yoshi Huang 2016-05-16 11:07:09 +08:00
Родитель 96c3cbd91b
Коммит b0b5fc2bf1
2 изменённых файлов: 22 добавлений и 7 удалений

Просмотреть файл

@ -879,14 +879,22 @@ TabChild::NotifyTabContextUpdated()
return;
}
docShell->SetFrameType(IsMozBrowserElement() ?
nsIDocShell::FRAME_TYPE_BROWSER :
HasOwnApp() ?
nsIDocShell::FRAME_TYPE_APP :
nsIDocShell::FRAME_TYPE_REGULAR);
UpdateFrameType();
nsDocShell::Cast(docShell)->SetOriginAttributes(OriginAttributesRef());
}
void
TabChild::UpdateFrameType()
{
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
MOZ_ASSERT(docShell);
// TODO: Bug 1252794 - remove frameType from nsIDocShell.idl
docShell->SetFrameType(IsMozBrowserElement() ? nsIDocShell::FRAME_TYPE_BROWSER :
HasOwnApp() ? nsIDocShell::FRAME_TYPE_APP :
nsIDocShell::FRAME_TYPE_REGULAR);
}
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChild)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome2)
@ -2365,7 +2373,11 @@ TabChild::RecvSwappedWithOtherRemoteLoader(const IPCTabContext& aContext)
if (!UpdateTabContextAfterSwap(maybeContext.GetTabContext())) {
MOZ_CRASH("Update to TabContext after swap was denied.");
}
NotifyTabContextUpdated();
// Since mIsMozBrowserElement may change in UpdateTabContextAfterSwap, so we
// call UpdateFrameType here to make sure the frameType on the docshell is
// correct.
UpdateFrameType();
// Ignore previous value of mTriedBrowserInit since owner content has changed.
mTriedBrowserInit = true;

Просмотреть файл

@ -679,12 +679,15 @@ protected:
private:
// Notify others that our TabContext has been updated. (At the moment, this
// sets the appropriate app-id and is-browser flags on our docshell.)
// sets the appropriate origin attributes on our docshell.)
//
// You should call this after calling TabContext::SetTabContext(). We also
// call this during Init().
void NotifyTabContextUpdated();
// Update the frameType on our docshell.
void UpdateFrameType();
void ActorDestroy(ActorDestroyReason why) override;
enum FrameScriptLoading { DONT_LOAD_SCRIPTS, DEFAULT_LOAD_SCRIPTS };