зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1510569 - Only forward nsIWebProgress events to the BrowserParent after the WebProgressChild has loaded r=kmag,mconley
Before the WebProgress event handlers started migrating to C++, the parent process would only receive WebProgress events after the child process had finished loading the WebProgressChild script. Now that listeners are registered much earlier (before the BrowserChild has finished setting up its frame scripts), the BrowserParent would receive WebProgress events that were heretofore not received unless the BrowserChild was *very* careful about when it sent the IPC messages. However, even while being very careful, the OnStateChange event handler would always fire events for initial about:blank loads that break a lot of unit tests. Before porting that event, we are now ensuring that the WebProgressChild has finished loading before the BrowserChild will send IPC messages for these events to the BrowserParent. Differential Revision: https://phabricator.services.mozilla.com/D30252 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6994cf11f2
Коммит
7e22278a50
|
@ -40,5 +40,13 @@ interface nsIBrowserChild : nsISupports
|
|||
|
||||
[noscript, notxpcom] void beforeUnloadAdded();
|
||||
[noscript, notxpcom] void beforeUnloadRemoved();
|
||||
};
|
||||
|
||||
/**
|
||||
* Tell the nsIBrowserChild that it should begin sending its nsIWebProgress
|
||||
* events to its nsIBrowserParent.
|
||||
*
|
||||
* This should be called once the frame script for the nsIBrowserChild has
|
||||
* loaded.
|
||||
*/
|
||||
void beginSendingWebProgressEventsToParent();
|
||||
};
|
||||
|
|
|
@ -394,22 +394,22 @@ BrowserChild::BrowserChild(ContentChild* aManager, const TabId& aTabId,
|
|||
mDidLoadURLInit(false),
|
||||
mAwaitingLA(false),
|
||||
mSkipKeyPress(false),
|
||||
mLayersObserverEpoch {
|
||||
1
|
||||
}
|
||||
mLayersObserverEpoch{1},
|
||||
#if defined(XP_WIN) && defined(ACCESSIBILITY)
|
||||
, mNativeWindowHandle(0)
|
||||
mNativeWindowHandle(0),
|
||||
#endif
|
||||
#if defined(ACCESSIBILITY)
|
||||
,
|
||||
mTopLevelDocAccessibleChild(nullptr)
|
||||
mTopLevelDocAccessibleChild(nullptr),
|
||||
#endif
|
||||
,
|
||||
mPendingDocShellIsActive(false), mPendingDocShellReceivedMessage(false),
|
||||
mPendingRenderLayers(false),
|
||||
mPendingRenderLayersReceivedMessage(false), mPendingLayersObserverEpoch{0},
|
||||
mPendingDocShellBlockers(0), mCancelContentJSEpoch(0),
|
||||
mWidgetNativeData(0) {
|
||||
mShouldSendWebProgressEventsToParent(false),
|
||||
mPendingDocShellIsActive(false),
|
||||
mPendingDocShellReceivedMessage(false),
|
||||
mPendingRenderLayers(false),
|
||||
mPendingRenderLayersReceivedMessage(false),
|
||||
mPendingLayersObserverEpoch{0},
|
||||
mPendingDocShellBlockers(0),
|
||||
mCancelContentJSEpoch(0),
|
||||
mWidgetNativeData(0) {
|
||||
mozilla::HoldJSObjects(this);
|
||||
|
||||
nsWeakPtr weakPtrThis(do_GetWeakReference(
|
||||
|
@ -3453,6 +3453,11 @@ void BrowserChild::BeforeUnloadRemoved() {
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP BrowserChild::BeginSendingWebProgressEventsToParent() {
|
||||
mShouldSendWebProgressEventsToParent = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mozilla::dom::TabGroup* BrowserChild::TabGroup() { return mTabGroup; }
|
||||
|
||||
nsresult BrowserChild::GetHasSiblings(bool* aHasSiblings) {
|
||||
|
@ -3478,7 +3483,7 @@ NS_IMETHODIMP BrowserChild::OnProgressChange(nsIWebProgress* aWebProgress,
|
|||
int32_t aMaxSelfProgress,
|
||||
int32_t aCurTotalProgress,
|
||||
int32_t aMaxTotalProgress) {
|
||||
if (!IPCOpen()) {
|
||||
if (!IPCOpen() || !mShouldSendWebProgressEventsToParent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3507,7 +3512,7 @@ NS_IMETHODIMP BrowserChild::OnStatusChange(nsIWebProgress* aWebProgress,
|
|||
nsIRequest* aRequest,
|
||||
nsresult aStatus,
|
||||
const char16_t* aMessage) {
|
||||
if (!IPCOpen()) {
|
||||
if (!IPCOpen() || !mShouldSendWebProgressEventsToParent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3534,7 +3539,7 @@ NS_IMETHODIMP BrowserChild::OnSecurityChange(nsIWebProgress* aWebProgress,
|
|||
NS_IMETHODIMP BrowserChild::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
uint32_t aEvent) {
|
||||
if (!IPCOpen()) {
|
||||
if (!IPCOpen() || !mShouldSendWebProgressEventsToParent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -916,6 +916,8 @@ class BrowserChild final : public BrowserChildBase,
|
|||
#endif
|
||||
bool mCoalesceMouseMoveEvents;
|
||||
|
||||
bool mShouldSendWebProgressEventsToParent;
|
||||
|
||||
// In some circumstances, a DocShell might be in a state where it is
|
||||
// "blocked", and we should not attempt to change its active state or
|
||||
// the underlying PresShell state until the DocShell becomes unblocked.
|
||||
|
|
|
@ -8,6 +8,10 @@ const {WebProgressChild} = ChromeUtils.import("resource://gre/modules/WebProgres
|
|||
|
||||
this.WebProgress = new WebProgressChild(this);
|
||||
|
||||
docShell.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIBrowserChild)
|
||||
.beginSendingWebProgressEventsToParent();
|
||||
|
||||
addEventListener("DOMTitleChanged", function(aEvent) {
|
||||
if (!aEvent.isTrusted || aEvent.target.defaultView != content)
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче