Backed out 4 changesets (bug 1510569) for causing build bustages on nsIDocShell.idl CLOSED TREE

Backed out changeset 57f49df057be (bug 1510569)
Backed out changeset de97a258fcfd (bug 1510569)
Backed out changeset 4b0ed20ab3bc (bug 1510569)
Backed out changeset 1d8ab383d3e9 (bug 1510569)
This commit is contained in:
Cosmin Sabou 2019-05-21 20:30:01 +03:00
parent 7637a9982a
commit e565aa827a
18 changed files with 117 additions and 318 deletions

View File

@ -1229,7 +1229,7 @@ function _loadURI(browser, uri, params = {}) {
// !requiredRemoteType means we're loading in the parent/this process. // !requiredRemoteType means we're loading in the parent/this process.
if (!requiredRemoteType) { if (!requiredRemoteType) {
browser.isNavigating = true; browser.inLoadURI = true;
} }
let loadURIOptions = { let loadURIOptions = {
triggeringPrincipal, triggeringPrincipal,
@ -1299,7 +1299,7 @@ function _loadURI(browser, uri, params = {}) {
} }
} finally { } finally {
if (!requiredRemoteType) { if (!requiredRemoteType) {
browser.isNavigating = false; browser.inLoadURI = false;
} }
} }
} }

View File

@ -5034,8 +5034,8 @@ class TabProgressListener {
this.mBrowser.userTypedValue = null; this.mBrowser.userTypedValue = null;
let isNavigating = this.mBrowser.isNavigating; let inLoadURI = this.mBrowser.inLoadURI;
if (this.mTab.selected && gURLBar && !isNavigating) { if (this.mTab.selected && gURLBar && !inLoadURI) {
URLBarSetURI(); URLBarSetURI();
} }
} else if (isSuccessful) { } else if (isSuccessful) {
@ -5108,7 +5108,7 @@ class TabProgressListener {
// and the user cleared the URL manually. // and the user cleared the URL manually.
if (this.mBrowser.didStartLoadSinceLastUserTyping() || if (this.mBrowser.didStartLoadSinceLastUserTyping() ||
(isErrorPage && aLocation.spec != "about:blank") || (isErrorPage && aLocation.spec != "about:blank") ||
(isSameDocument && this.mBrowser.isNavigating) || (isSameDocument && this.mBrowser.inLoadURI) ||
(isSameDocument && !this.mBrowser.userTypedValue)) { (isSameDocument && !this.mBrowser.userTypedValue)) {
this.mBrowser.userTypedValue = null; this.mBrowser.userTypedValue = null;
} }

View File

@ -434,6 +434,7 @@ MessageManagerTunnel.prototype = {
"Content:LoadURIResult", "Content:LoadURIResult",
"Content:LocationChange", "Content:LocationChange",
"Content:SecurityChange", "Content:SecurityChange",
"Content:StateChange",
// Messages sent to browser.js // Messages sent to browser.js
"DOMTitleChanged", "DOMTitleChanged",
"ImageDocumentLoaded", "ImageDocumentLoaded",

View File

@ -387,8 +387,7 @@ nsDocShell::nsDocShell(BrowsingContext* aBrowsingContext)
mTitleValidForCurrentURI(false), mTitleValidForCurrentURI(false),
mIsFrame(false), mIsFrame(false),
mSkipBrowsingContextDetachOnDestroy(false), mSkipBrowsingContextDetachOnDestroy(false),
mWatchedByDevtools(false), mWatchedByDevtools(false) {
mIsNavigating(false) {
mHistoryID.m0 = 0; mHistoryID.m0 = 0;
mHistoryID.m1 = 0; mHistoryID.m1 = 0;
mHistoryID.m2 = 0; mHistoryID.m2 = 0;
@ -3728,12 +3727,6 @@ nsDocShell::GetContentBlockingLog(Promise** aPromise) {
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsDocShell::GetIsNavigating(bool* aOut) {
*aOut = mIsNavigating;
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::SetDeviceSizeIsPageSize(bool aValue) { nsDocShell::SetDeviceSizeIsPageSize(bool aValue) {
if (mDeviceSizeIsPageSize != aValue) { if (mDeviceSizeIsPageSize != aValue) {
@ -3835,10 +3828,6 @@ nsDocShell::GoBack() {
if (!IsNavigationAllowed()) { if (!IsNavigationAllowed()) {
return NS_OK; // JS may not handle returning of an error code return NS_OK; // JS may not handle returning of an error code
} }
auto cleanupIsNavigating = MakeScopeExit([&]() { mIsNavigating = false; });
mIsNavigating = true;
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory(); RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
NS_ENSURE_TRUE(rootSH, NS_ERROR_FAILURE); NS_ENSURE_TRUE(rootSH, NS_ERROR_FAILURE);
ErrorResult rv; ErrorResult rv;
@ -3851,10 +3840,6 @@ nsDocShell::GoForward() {
if (!IsNavigationAllowed()) { if (!IsNavigationAllowed()) {
return NS_OK; // JS may not handle returning of an error code return NS_OK; // JS may not handle returning of an error code
} }
auto cleanupIsNavigating = MakeScopeExit([&]() { mIsNavigating = false; });
mIsNavigating = true;
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory(); RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
NS_ENSURE_TRUE(rootSH, NS_ERROR_FAILURE); NS_ENSURE_TRUE(rootSH, NS_ERROR_FAILURE);
ErrorResult rv; ErrorResult rv;
@ -3869,10 +3854,6 @@ nsDocShell::GotoIndex(int32_t aIndex) {
if (!IsNavigationAllowed()) { if (!IsNavigationAllowed()) {
return NS_OK; // JS may not handle returning of an error code return NS_OK; // JS may not handle returning of an error code
} }
auto cleanupIsNavigating = MakeScopeExit([&]() { mIsNavigating = false; });
mIsNavigating = true;
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory(); RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
NS_ENSURE_TRUE(rootSH, NS_ERROR_FAILURE); NS_ENSURE_TRUE(rootSH, NS_ERROR_FAILURE);
return rootSH->LegacySHistory()->GotoIndex(aIndex); return rootSH->LegacySHistory()->GotoIndex(aIndex);
@ -3888,10 +3869,6 @@ nsresult nsDocShell::LoadURI(const nsAString& aURI,
if (!IsNavigationAllowed()) { if (!IsNavigationAllowed()) {
return NS_OK; // JS may not handle returning of an error code return NS_OK; // JS may not handle returning of an error code
} }
auto cleanupIsNavigating = MakeScopeExit([&]() { mIsNavigating = false; });
mIsNavigating = true;
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIInputStream> postData(aLoadURIOptions.mPostData); nsCOMPtr<nsIInputStream> postData(aLoadURIOptions.mPostData);
nsresult rv = NS_OK; nsresult rv = NS_OK;

View File

@ -1248,10 +1248,6 @@ class nsDocShell final : public nsDocLoader,
// Set when activity in this docshell is being watched by the developer tools. // Set when activity in this docshell is being watched by the developer tools.
bool mWatchedByDevtools : 1; bool mWatchedByDevtools : 1;
// This flag indicates whether or not the DocShell is currently executing an
// nsIWebNavigation navigation method.
bool mIsNavigating : 1;
}; };
#endif /* nsDocShell_h__ */ #endif /* nsDocShell_h__ */

View File

@ -1186,20 +1186,7 @@ interface nsIDocShell : nsIDocShellTreeItem
[notxpcom, nostdcall] readonly attribute boolean isAttemptingToNavigate; [notxpcom, nostdcall] readonly attribute boolean isAttemptingToNavigate;
/** /**
<<<<<<< dest
* Whether developer tools are watching activity in this docshell. * Whether developer tools are watching activity in this docshell.
*/ */
[infallible] attribute boolean watchedByDevtools; [infallible] attribute boolean watchedByDevtools;
* Whether or not this docshell is executing a nsIWebNavigation navigation
* method.
*
* This will be true when the following methods are executing:
* nsIWebNavigation.binaryLoadURI
* nsIWebNavigation.goBack
* nsIWebNavigation.goForward
* nsIWebNavigation.gotoIndex
* nsIWebNavigation.loadURI
*/
[infallible] readonly attribute boolean isNavigating;
}; };

View File

@ -5,7 +5,6 @@
interface nsIContentSecurityPolicy; interface nsIContentSecurityPolicy;
interface nsIPrincipal; interface nsIPrincipal;
interface nsIURI;
interface nsIWebProgress; interface nsIWebProgress;
webidl FrameLoader; webidl FrameLoader;
@ -81,26 +80,4 @@ interface nsIBrowser : nsISupports
readonly attribute nsIPrincipal contentPrincipal; readonly attribute nsIPrincipal contentPrincipal;
readonly attribute nsIContentSecurityPolicy csp; readonly attribute nsIContentSecurityPolicy csp;
/**
* Whether or not the browser is in the process of an nsIWebNavigation
* navigation method.
*/
attribute boolean isNavigating;
/**
* Whether or not the character encoding menu may be enabled.
*/
attribute boolean mayEnableCharacterEncodingMenu;
/**
* Called by Gecko to update the browser when its state changes.
*
* @param aCharset the new character set of the document
* @param aDocumentURI the URI of the current document
* @param aContentType the content type of the document
*/
void updateForStateChange(in AString aCharset,
in nsIURI aDocumentURI,
in AString aContentType);
}; };

View File

@ -40,13 +40,5 @@ interface nsIBrowserChild : nsISupports
[noscript, notxpcom] void beforeUnloadAdded(); [noscript, notxpcom] void beforeUnloadAdded();
[noscript, notxpcom] void beforeUnloadRemoved(); [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();
}; };

View File

@ -132,7 +132,6 @@
#include "nsWebBrowser.h" #include "nsWebBrowser.h"
#include "mozilla/dom/WindowGlobalChild.h" #include "mozilla/dom/WindowGlobalChild.h"
#include "MMPrinter.h" #include "MMPrinter.h"
#include "mozilla/ResultExtensions.h"
#ifdef XP_WIN #ifdef XP_WIN
# include "mozilla/plugins/PluginWidgetChild.h" # include "mozilla/plugins/PluginWidgetChild.h"
@ -395,22 +394,22 @@ BrowserChild::BrowserChild(ContentChild* aManager, const TabId& aTabId,
mDidLoadURLInit(false), mDidLoadURLInit(false),
mAwaitingLA(false), mAwaitingLA(false),
mSkipKeyPress(false), mSkipKeyPress(false),
mLayersObserverEpoch{1}, mLayersObserverEpoch {
1
}
#if defined(XP_WIN) && defined(ACCESSIBILITY) #if defined(XP_WIN) && defined(ACCESSIBILITY)
mNativeWindowHandle(0), , mNativeWindowHandle(0)
#endif #endif
#if defined(ACCESSIBILITY) #if defined(ACCESSIBILITY)
mTopLevelDocAccessibleChild(nullptr), ,
mTopLevelDocAccessibleChild(nullptr)
#endif #endif
mShouldSendWebProgressEventsToParent(false), ,
mPendingDocShellIsActive(false), mPendingDocShellIsActive(false), mPendingDocShellReceivedMessage(false),
mPendingDocShellReceivedMessage(false), mPendingRenderLayers(false),
mPendingRenderLayers(false), mPendingRenderLayersReceivedMessage(false), mPendingLayersObserverEpoch{0},
mPendingRenderLayersReceivedMessage(false), mPendingDocShellBlockers(0), mCancelContentJSEpoch(0),
mPendingLayersObserverEpoch{0}, mWidgetNativeData(0) {
mPendingDocShellBlockers(0),
mCancelContentJSEpoch(0),
mWidgetNativeData(0) {
mozilla::HoldJSObjects(this); mozilla::HoldJSObjects(this);
nsWeakPtr weakPtrThis(do_GetWeakReference( nsWeakPtr weakPtrThis(do_GetWeakReference(
@ -544,9 +543,8 @@ nsresult BrowserChild::Init(mozIDOMWindowProxy* aParent) {
MOZ_ASSERT(docShell); MOZ_ASSERT(docShell);
const uint32_t notifyMask = const uint32_t notifyMask =
nsIWebProgress::NOTIFY_STATE_ALL | nsIWebProgress::NOTIFY_PROGRESS | nsIWebProgress::NOTIFY_PROGRESS | nsIWebProgress::NOTIFY_STATUS |
nsIWebProgress::NOTIFY_STATUS | nsIWebProgress::NOTIFY_REFRESH | nsIWebProgress::NOTIFY_REFRESH | nsIWebProgress::NOTIFY_CONTENT_BLOCKING;
nsIWebProgress::NOTIFY_CONTENT_BLOCKING;
mStatusFilter = new nsBrowserStatusFilter(); mStatusFilter = new nsBrowserStatusFilter();
@ -3455,11 +3453,6 @@ void BrowserChild::BeforeUnloadRemoved() {
} }
} }
NS_IMETHODIMP BrowserChild::BeginSendingWebProgressEventsToParent() {
mShouldSendWebProgressEventsToParent = true;
return NS_OK;
}
mozilla::dom::TabGroup* BrowserChild::TabGroup() { return mTabGroup; } mozilla::dom::TabGroup* BrowserChild::TabGroup() { return mTabGroup; }
nsresult BrowserChild::GetHasSiblings(bool* aHasSiblings) { nsresult BrowserChild::GetHasSiblings(bool* aHasSiblings) {
@ -3476,52 +3469,7 @@ NS_IMETHODIMP BrowserChild::OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsIRequest* aRequest,
uint32_t aStateFlags, uint32_t aStateFlags,
nsresult aStatus) { nsresult aStatus) {
if (!IPCOpen() || !mShouldSendWebProgressEventsToParent) { return NS_ERROR_NOT_IMPLEMENTED;
return NS_OK;
}
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
if (!docShell) {
return NS_OK;
}
RefPtr<Document> document;
if (nsCOMPtr<nsPIDOMWindowOuter> outerWindow = do_GetInterface(docShell)) {
document = outerWindow->GetExtantDoc();
} else {
return NS_OK;
}
Maybe<WebProgressData> webProgressData;
Maybe<WebProgressStateChangeData> stateChangeData;
RequestData requestData;
MOZ_TRY(PrepareProgressListenerData(aWebProgress, aRequest, webProgressData,
requestData));
if (webProgressData->isTopLevel()) {
stateChangeData.emplace();
stateChangeData->isNavigating() = docShell->GetIsNavigating();
stateChangeData->mayEnableCharacterEncodingMenu() =
docShell->GetMayEnableCharacterEncodingMenu();
if (aStateFlags & nsIWebProgressListener::STATE_STOP) {
MOZ_ASSERT(document);
document->GetContentType(stateChangeData->contentType());
document->GetCharacterSet(stateChangeData->charset());
stateChangeData->documentURI() = document->GetDocumentURIObject();
} else {
stateChangeData->contentType().SetIsVoid(true);
stateChangeData->charset().SetIsVoid(true);
}
}
Unused << SendOnStateChange(webProgressData, requestData, aStateFlags,
aStatus, stateChangeData);
return NS_OK;
} }
NS_IMETHODIMP BrowserChild::OnProgressChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP BrowserChild::OnProgressChange(nsIWebProgress* aWebProgress,
@ -3530,7 +3478,7 @@ NS_IMETHODIMP BrowserChild::OnProgressChange(nsIWebProgress* aWebProgress,
int32_t aMaxSelfProgress, int32_t aMaxSelfProgress,
int32_t aCurTotalProgress, int32_t aCurTotalProgress,
int32_t aMaxTotalProgress) { int32_t aMaxTotalProgress) {
if (!IPCOpen() || !mShouldSendWebProgressEventsToParent) { if (!IPCOpen()) {
return NS_OK; return NS_OK;
} }
@ -3559,7 +3507,7 @@ NS_IMETHODIMP BrowserChild::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsIRequest* aRequest,
nsresult aStatus, nsresult aStatus,
const char16_t* aMessage) { const char16_t* aMessage) {
if (!IPCOpen() || !mShouldSendWebProgressEventsToParent) { if (!IPCOpen()) {
return NS_OK; return NS_OK;
} }
@ -3586,7 +3534,7 @@ NS_IMETHODIMP BrowserChild::OnSecurityChange(nsIWebProgress* aWebProgress,
NS_IMETHODIMP BrowserChild::OnContentBlockingEvent(nsIWebProgress* aWebProgress, NS_IMETHODIMP BrowserChild::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsIRequest* aRequest,
uint32_t aEvent) { uint32_t aEvent) {
if (!IPCOpen() || !mShouldSendWebProgressEventsToParent) { if (!IPCOpen()) {
return NS_OK; return NS_OK;
} }

View File

@ -915,8 +915,6 @@ class BrowserChild final : public BrowserChildBase,
#endif #endif
bool mCoalesceMouseMoveEvents; bool mCoalesceMouseMoveEvents;
bool mShouldSendWebProgressEventsToParent;
// In some circumstances, a DocShell might be in a state where it is // 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 // "blocked", and we should not attempt to change its active state or
// the underlying PresShell state until the DocShell becomes unblocked. // the underlying PresShell state until the DocShell becomes unblocked.

View File

@ -2401,53 +2401,27 @@ mozilla::ipc::IPCResult BrowserParent::RecvRegisterProtocolHandler(
return IPC_OK(); return IPC_OK();
} }
mozilla::ipc::IPCResult BrowserParent::RecvOnStateChange(
const Maybe<WebProgressData>& aWebProgressData,
const RequestData& aRequestData, const uint32_t aStateFlags,
const nsresult aStatus,
const Maybe<WebProgressStateChangeData>& aStateChangeData) {
nsCOMPtr<nsIBrowser> browser;
nsCOMPtr<nsIWebProgress> manager;
nsCOMPtr<nsIWebProgressListener> managerAsListener;
if (!GetWebProgressListener(getter_AddRefs(browser), getter_AddRefs(manager),
getter_AddRefs(managerAsListener))) {
return IPC_OK();
}
nsCOMPtr<nsIWebProgress> webProgress;
nsCOMPtr<nsIRequest> request;
ReconstructWebProgressAndRequest(manager, aWebProgressData, aRequestData,
webProgress, request);
if (aWebProgressData && aWebProgressData->isTopLevel()) {
Unused << browser->SetIsNavigating(aStateChangeData->isNavigating());
Unused << browser->SetMayEnableCharacterEncodingMenu(
aStateChangeData->mayEnableCharacterEncodingMenu());
Unused << browser->UpdateForStateChange(aStateChangeData->charset(),
aStateChangeData->documentURI(),
aStateChangeData->contentType());
} else if (aStateChangeData.isSome()) {
return IPC_FAIL(
this,
"Unexpected WebProgressStateChangeData for non-top-level WebProgress");
}
Unused << managerAsListener->OnStateChange(webProgress, request, aStateFlags,
aStatus);
return IPC_OK();
}
mozilla::ipc::IPCResult BrowserParent::RecvOnProgressChange( mozilla::ipc::IPCResult BrowserParent::RecvOnProgressChange(
const Maybe<WebProgressData>& aWebProgressData, const Maybe<WebProgressData>& aWebProgressData,
const RequestData& aRequestData, const int32_t aCurSelfProgress, const RequestData& aRequestData, const int32_t aCurSelfProgress,
const int32_t aMaxSelfProgress, const int32_t aCurTotalProgress, const int32_t aMaxSelfProgress, const int32_t aCurTotalProgress,
const int32_t aMaxTotalProgress) { const int32_t aMaxTotalProgress) {
nsCOMPtr<nsIBrowser> browser; nsCOMPtr<nsIBrowser> browser =
mFrameElement ? mFrameElement->AsBrowser() : nullptr;
if (!browser) {
return IPC_OK();
}
nsCOMPtr<nsIWebProgress> manager; nsCOMPtr<nsIWebProgress> manager;
nsCOMPtr<nsIWebProgressListener> managerAsListener; nsresult rv = browser->GetRemoteWebProgressManager(getter_AddRefs(manager));
if (!GetWebProgressListener(getter_AddRefs(browser), getter_AddRefs(manager), NS_ENSURE_SUCCESS(rv, IPC_OK());
getter_AddRefs(managerAsListener))) {
nsCOMPtr<nsIWebProgressListener> managerAsListener =
do_QueryInterface(manager);
if (!managerAsListener) {
// We are no longer remote, so we cannot propagate this message.
return IPC_OK(); return IPC_OK();
} }
@ -2467,11 +2441,22 @@ mozilla::ipc::IPCResult BrowserParent::RecvOnStatusChange(
const Maybe<WebProgressData>& aWebProgressData, const Maybe<WebProgressData>& aWebProgressData,
const RequestData& aRequestData, const nsresult aStatus, const RequestData& aRequestData, const nsresult aStatus,
const nsString& aMessage) { const nsString& aMessage) {
nsCOMPtr<nsIBrowser> browser; nsCOMPtr<nsIBrowser> browser =
mFrameElement ? mFrameElement->AsBrowser() : nullptr;
if (!browser) {
return IPC_OK();
}
nsCOMPtr<nsIWebProgress> manager; nsCOMPtr<nsIWebProgress> manager;
nsCOMPtr<nsIWebProgressListener> managerAsListener; nsresult rv = browser->GetRemoteWebProgressManager(getter_AddRefs(manager));
if (!GetWebProgressListener(getter_AddRefs(browser), getter_AddRefs(manager), NS_ENSURE_SUCCESS(rv, IPC_OK());
getter_AddRefs(managerAsListener))) {
nsCOMPtr<nsIWebProgressListener> managerAsListener =
do_QueryInterface(manager);
if (!managerAsListener) {
// We are no longer remote, so we cannot propagate this message.
return IPC_OK(); return IPC_OK();
} }
@ -2489,55 +2474,30 @@ mozilla::ipc::IPCResult BrowserParent::RecvOnStatusChange(
mozilla::ipc::IPCResult BrowserParent::RecvOnContentBlockingEvent( mozilla::ipc::IPCResult BrowserParent::RecvOnContentBlockingEvent(
const Maybe<WebProgressData>& aWebProgressData, const Maybe<WebProgressData>& aWebProgressData,
const RequestData& aRequestData, const uint32_t& aEvent) { const RequestData& aRequestData, const uint32_t& aEvent) {
nsCOMPtr<nsIBrowser> browser;
nsCOMPtr<nsIWebProgress> manager;
nsCOMPtr<nsIWebProgressListener> managerAsListener;
if (!GetWebProgressListener(getter_AddRefs(browser), getter_AddRefs(manager),
getter_AddRefs(managerAsListener))) {
return IPC_OK();
}
nsCOMPtr<nsIWebProgress> webProgress;
nsCOMPtr<nsIRequest> request;
ReconstructWebProgressAndRequest(manager, aWebProgressData, aRequestData,
webProgress, request);
Unused << managerAsListener->OnContentBlockingEvent(webProgress, request,
aEvent);
return IPC_OK();
}
bool BrowserParent::GetWebProgressListener(
nsIBrowser** aOutBrowser, nsIWebProgress** aOutManager,
nsIWebProgressListener** aOutListener) {
MOZ_ASSERT(aOutBrowser);
MOZ_ASSERT(aOutManager);
MOZ_ASSERT(aOutListener);
nsCOMPtr<nsIBrowser> browser = nsCOMPtr<nsIBrowser> browser =
mFrameElement ? mFrameElement->AsBrowser() : nullptr; mFrameElement ? mFrameElement->AsBrowser() : nullptr;
if (!browser) { if (browser) {
return false; nsCOMPtr<nsIWebProgress> manager;
nsresult rv = browser->GetRemoteWebProgressManager(getter_AddRefs(manager));
NS_ENSURE_SUCCESS(rv, IPC_OK());
nsCOMPtr<nsIWebProgressListener> managerAsListener =
do_QueryInterface(manager);
if (!managerAsListener) {
// We are no longer remote, so we cannot propagate this message.
return IPC_OK();
}
nsCOMPtr<nsIWebProgress> webProgress;
nsCOMPtr<nsIRequest> request;
ReconstructWebProgressAndRequest(manager, aWebProgressData, aRequestData,
webProgress, request);
Unused << managerAsListener->OnContentBlockingEvent(webProgress, request,
aEvent);
} }
nsCOMPtr<nsIWebProgress> manager; return IPC_OK();
nsresult rv = browser->GetRemoteWebProgressManager(getter_AddRefs(manager));
if (NS_FAILED(rv)) {
return false;
}
nsCOMPtr<nsIWebProgressListener> listener = do_QueryInterface(manager);
if (!listener) {
// We are no longer remote so we cannot forward this event.
return false;
}
browser.forget(aOutBrowser);
manager.forget(aOutManager);
listener.forget(aOutListener);
return true;
} }
void BrowserParent::ReconstructWebProgressAndRequest( void BrowserParent::ReconstructWebProgressAndRequest(

View File

@ -272,12 +272,6 @@ class BrowserParent final : public PBrowserParent,
const nsString& aTitle, const nsString& aTitle,
nsIURI* aDocURI); nsIURI* aDocURI);
mozilla::ipc::IPCResult RecvOnStateChange(
const Maybe<WebProgressData>& awebProgressData,
const RequestData& aRequestData, const uint32_t aStateFlags,
const nsresult aStatus,
const Maybe<WebProgressStateChangeData>& aStateChangeData);
mozilla::ipc::IPCResult RecvOnProgressChange( mozilla::ipc::IPCResult RecvOnProgressChange(
const Maybe<WebProgressData>& aWebProgressData, const Maybe<WebProgressData>& aWebProgressData,
const RequestData& aRequestData, const int32_t aCurSelfProgress, const RequestData& aRequestData, const int32_t aCurSelfProgress,
@ -293,10 +287,6 @@ class BrowserParent final : public PBrowserParent,
const Maybe<WebProgressData>& aWebProgressData, const Maybe<WebProgressData>& aWebProgressData,
const RequestData& aRequestData, const uint32_t& aEvent); const RequestData& aRequestData, const uint32_t& aEvent);
bool GetWebProgressListener(nsIBrowser** aOutBrowser,
nsIWebProgress** aOutManager,
nsIWebProgressListener** aOutManagerAsListener);
void ReconstructWebProgressAndRequest( void ReconstructWebProgressAndRequest(
nsIWebProgress* aManager, const Maybe<WebProgressData>& aWebProgressData, nsIWebProgress* aManager, const Maybe<WebProgressData>& aWebProgressData,
const RequestData& aRequestData, const RequestData& aRequestData,

View File

@ -118,19 +118,6 @@ struct RequestData
nsCString matchedList; nsCString matchedList;
}; };
struct WebProgressStateChangeData
{
bool isNavigating;
bool mayEnableCharacterEncodingMenu;
// The following fields are only set when the aStateFlags param passed with
// this struct is |nsIWebProgress.STATE_STOP|.
nsString contentType;
nsString charset;
nsIURI documentURI;
};
/** /**
* A PBrowser manages a maximal locally connected subtree of BrowsingContexts * A PBrowser manages a maximal locally connected subtree of BrowsingContexts
* in a content process. * in a content process.
@ -557,11 +544,6 @@ parent:
async RegisterProtocolHandler(nsString scheme, nsIURI handlerURI, nsString title, async RegisterProtocolHandler(nsString scheme, nsIURI handlerURI, nsString title,
nsIURI documentURI); nsIURI documentURI);
async OnStateChange(WebProgressData? aWebProgressData,
RequestData aRequestData, uint32_t aStateFlags,
nsresult aStatus,
WebProgressStateChangeData? aStateChangeData);
async OnProgressChange(WebProgressData? aWebProgressData, async OnProgressChange(WebProgressData? aWebProgressData,
RequestData aRequestData, int32_t aCurSelfProgress, RequestData aRequestData, int32_t aCurSelfProgress,
int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress,

View File

@ -51,9 +51,11 @@ class WebNavigationChild extends ActorChild {
} }
_wrapURIChangeCall(fn) { _wrapURIChangeCall(fn) {
this.mm.WebProgress.inLoadURI = true;
try { try {
fn(); fn();
} finally { } finally {
this.mm.WebProgress.inLoadURI = false;
this.mm.WebProgress.sendLoadCallResult(); this.mm.WebProgress.sendLoadCallResult();
} }
} }

View File

@ -8,9 +8,6 @@ const {WebProgressChild} = ChromeUtils.import("resource://gre/modules/WebProgres
this.WebProgress = new WebProgressChild(this); this.WebProgress = new WebProgressChild(this);
// This is a method of nsIBrowserChild.
this.beginSendingWebProgressEventsToParent();
addEventListener("DOMTitleChanged", function(aEvent) { addEventListener("DOMTitleChanged", function(aEvent) {
if (!aEvent.isTrusted || aEvent.target.defaultView != content) if (!aEvent.isTrusted || aEvent.target.defaultView != content)
return; return;

View File

@ -42,12 +42,6 @@ class MozBrowser extends MozElements.MozElementMixin(XULFrameElement) {
this.onPageHide = this.onPageHide.bind(this); this.onPageHide = this.onPageHide.bind(this);
this.isNavigating = false;
this._documentURI = null;
this._characterSet = null;
this._documentContentType = null;
/** /**
* These are managed by the tabbrowser: * These are managed by the tabbrowser:
*/ */
@ -358,16 +352,6 @@ class MozBrowser extends MozElements.MozElementMixin(XULFrameElement) {
return this.contentDocument ? this.contentDocument.contentType : null; return this.contentDocument ? this.contentDocument.contentType : null;
} }
set documentContentType(aContentType) {
if (aContentType != null) {
if (this.isRemoteBrowser) {
this._documentContentType = aContentType;
} else {
this.contentDocument.documentContentType = aContentType;
}
}
}
set sameProcessAsFrameLoader(val) { set sameProcessAsFrameLoader(val) {
this._sameProcessAsFrameLoader = Cu.getWeakReference(val); this._sameProcessAsFrameLoader = Cu.getWeakReference(val);
} }
@ -610,12 +594,6 @@ class MozBrowser extends MozElements.MozElementMixin(XULFrameElement) {
return this.isRemoteBrowser ? this._mayEnableCharacterEncodingMenu : this.docShell.mayEnableCharacterEncodingMenu; return this.isRemoteBrowser ? this._mayEnableCharacterEncodingMenu : this.docShell.mayEnableCharacterEncodingMenu;
} }
set mayEnableCharacterEncodingMenu(aMayEnable) {
if (this.isRemoteBrowser) {
this._mayEnableCharacterEncodingMenu = aMayEnable;
}
}
get contentPrincipal() { get contentPrincipal() {
return this.isRemoteBrowser ? this._contentPrincipal : this.contentDocument.nodePrincipal; return this.isRemoteBrowser ? this._contentPrincipal : this.contentDocument.nodePrincipal;
} }
@ -781,11 +759,11 @@ class MozBrowser extends MozElements.MozElementMixin(XULFrameElement) {
_wrapURIChangeCall(fn) { _wrapURIChangeCall(fn) {
if (!this.isRemoteBrowser) { if (!this.isRemoteBrowser) {
this.isNavigating = true; this.inLoadURI = true;
try { try {
fn(); fn();
} finally { } finally {
this.isNavigating = false; this.inLoadURI = false;
} }
} else { } else {
fn(); fn();
@ -1044,7 +1022,7 @@ class MozBrowser extends MozElements.MozElementMixin(XULFrameElement) {
} }
didStartLoadSinceLastUserTyping() { didStartLoadSinceLastUserTyping() {
return !this.isNavigating && return !this.inLoadURI &&
this.urlbarChangeTracker._startedLoadSinceLastUserTyping; this.urlbarChangeTracker._startedLoadSinceLastUserTyping;
} }
@ -1391,22 +1369,6 @@ class MozBrowser extends MozElements.MozElementMixin(XULFrameElement) {
return this._remoteWebProgressManager; return this._remoteWebProgressManager;
} }
updateForStateChange(aCharset, aDocumentURI, aContentType) {
if (this.isRemoteBrowser && this.messageManager) {
if (aCharset != null) {
this._characterSet = aCharset;
}
if (aDocumentURI != null) {
this._documentURI = aDocumentURI;
}
if (aContentType != null) {
this._documentContentType = aContentType;
}
}
}
purgeSessionHistory() { purgeSessionHistory() {
if (this.isRemoteBrowser) { if (this.isRemoteBrowser) {
try { try {

View File

@ -28,6 +28,7 @@ class RemoteWebProgressManager {
swapBrowser(aBrowser) { swapBrowser(aBrowser) {
if (this._messageManager) { if (this._messageManager) {
this._messageManager.removeMessageListener("Content:StateChange", this);
this._messageManager.removeMessageListener("Content:LocationChange", this); this._messageManager.removeMessageListener("Content:LocationChange", this);
this._messageManager.removeMessageListener("Content:SecurityChange", this); this._messageManager.removeMessageListener("Content:SecurityChange", this);
this._messageManager.removeMessageListener("Content:LoadURIResult", this); this._messageManager.removeMessageListener("Content:LoadURIResult", this);
@ -35,6 +36,7 @@ class RemoteWebProgressManager {
this._browser = aBrowser; this._browser = aBrowser;
this._messageManager = aBrowser.messageManager; this._messageManager = aBrowser.messageManager;
this._messageManager.addMessageListener("Content:StateChange", this);
this._messageManager.addMessageListener("Content:LocationChange", this); this._messageManager.addMessageListener("Content:LocationChange", this);
this._messageManager.addMessageListener("Content:SecurityChange", this); this._messageManager.addMessageListener("Content:SecurityChange", this);
this._messageManager.addMessageListener("Content:LoadURIResult", this); this._messageManager.addMessageListener("Content:LoadURIResult", this);
@ -156,7 +158,7 @@ class RemoteWebProgressManager {
// It shouldn't go through the same processing as all the forwarded // It shouldn't go through the same processing as all the forwarded
// webprogresslistener messages. // webprogresslistener messages.
if (aMessage.name == "Content:LoadURIResult") { if (aMessage.name == "Content:LoadURIResult") {
this._browser.isNavigating = false; this._browser.inLoadURI = false;
return; return;
} }
@ -191,8 +193,8 @@ class RemoteWebProgressManager {
if (json.documentContentType !== null) { if (json.documentContentType !== null) {
this._browser._documentContentType = json.documentContentType; this._browser._documentContentType = json.documentContentType;
} }
if (typeof json.isNavigating != "undefined") { if (typeof json.inLoadURI != "undefined") {
this._browser.isNavigating = json.isNavigating; this._browser.inLoadURI = json.inLoadURI;
} }
if (json.charset) { if (json.charset) {
this._browser._characterSet = json.charset; this._browser._characterSet = json.charset;
@ -201,6 +203,13 @@ class RemoteWebProgressManager {
} }
switch (aMessage.name) { switch (aMessage.name) {
case "Content:StateChange":
if (isTopLevel) {
this._browser._documentURI = Services.io.newURI(json.documentURI);
}
this.onStateChange(webProgress, request, json.stateFlags, json.status);
break;
case "Content:LocationChange": case "Content:LocationChange":
let location = Services.io.newURI(json.location); let location = Services.io.newURI(json.location);
let flags = json.flags; let flags = json.flags;

View File

@ -25,10 +25,11 @@ class WebProgressChild {
constructor(mm) { constructor(mm) {
this.mm = mm; this.mm = mm;
// NOTIFY_PROGRESS, NOTIFY_STATE_ALL, NOTIFY_STATUS, NOTIFY_REFRESH, and this.inLoadURI = false;
// NOTIFY_PROGRESS, NOTIFY_STATUS, NOTIFY_REFRESH, and
// NOTIFY_CONTENT_BLOCKING are handled by PBrowser. // NOTIFY_CONTENT_BLOCKING are handled by PBrowser.
let notifyCode = Ci.nsIWebProgress.NOTIFY_ALL & let notifyCode = Ci.nsIWebProgress.NOTIFY_ALL &
~Ci.nsIWebProgress.NOTIFY_STATE_ALL &
~Ci.nsIWebProgress.NOTIFY_PROGRESS & ~Ci.nsIWebProgress.NOTIFY_PROGRESS &
~Ci.nsIWebProgress.NOTIFY_STATUS & ~Ci.nsIWebProgress.NOTIFY_STATUS &
~Ci.nsIWebProgress.NOTIFY_REFRESH & ~Ci.nsIWebProgress.NOTIFY_REFRESH &
@ -100,6 +101,26 @@ class WebProgressChild {
this.mm.sendAsyncMessage(name, data); this.mm.sendAsyncMessage(name, data);
} }
onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
let json = this._setupJSON(aWebProgress, aRequest, aStateFlags);
json.stateFlags = aStateFlags;
json.status = aStatus;
// It's possible that this state change was triggered by
// loading an internal error page, for which the parent
// will want to know some details, so we'll update it with
// the documentURI.
if (aWebProgress && aWebProgress.isTopLevel) {
json.documentURI = this.mm.content.document.documentURIObject.spec;
json.charset = this.mm.content.document.characterSet;
json.mayEnableCharacterEncodingMenu = this.mm.docShell.mayEnableCharacterEncodingMenu;
json.inLoadURI = this.inLoadURI;
}
this._send("Content:StateChange", json);
}
onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) { onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) {
let json = this._setupJSON(aWebProgress, aRequest); let json = this._setupJSON(aWebProgress, aRequest);
@ -122,7 +143,7 @@ class WebProgressChild {
let csp = this.mm.content.document.nodePrincipal.csp; let csp = this.mm.content.document.nodePrincipal.csp;
json.csp = E10SUtils.serializeCSP(csp); json.csp = E10SUtils.serializeCSP(csp);
json.synthetic = this.mm.content.document.mozSyntheticDocument; json.synthetic = this.mm.content.document.mozSyntheticDocument;
json.isNavigating = this.mm.docShell.isNavigating; json.inLoadURI = this.inLoadURI;
json.requestContextID = this.mm.content.document.documentLoadGroup json.requestContextID = this.mm.content.document.documentLoadGroup
? this.mm.content.document.documentLoadGroup.requestContextID ? this.mm.content.document.documentLoadGroup.requestContextID
: null; : null;