From c0bd1834c8a759a38bd7a5bba5599c4b5a343382 Mon Sep 17 00:00:00 2001 From: Noemi Erli Date: Tue, 21 Apr 2020 03:46:41 +0300 Subject: [PATCH] Backed out 19 changesets (bug 1602318) for causing multiple failures Backed out changeset 4b3345b2e33b (bug 1602318) Backed out changeset 7240b27afe28 (bug 1602318) Backed out changeset a7091729d8c9 (bug 1602318) Backed out changeset e496ab6c0857 (bug 1602318) Backed out changeset 184da6309f0c (bug 1602318) Backed out changeset 79b540f8619d (bug 1602318) Backed out changeset b298015ee960 (bug 1602318) Backed out changeset 6d0783cd5e01 (bug 1602318) Backed out changeset cbc308486b17 (bug 1602318) Backed out changeset 94142944fb54 (bug 1602318) Backed out changeset 7c1eeb299b78 (bug 1602318) Backed out changeset 0fc27502503a (bug 1602318) Backed out changeset 0fc27c2e09d9 (bug 1602318) Backed out changeset b5e2aa4741b2 (bug 1602318) Backed out changeset 57d568114c5a (bug 1602318) Backed out changeset 8f7360d827dc (bug 1602318) Backed out changeset 78930a97c2df (bug 1602318) Backed out changeset 8015780587cd (bug 1602318) Backed out changeset bc9da03cb3a3 (bug 1602318) --- .../general/browser_tab_detach_restore.js | 2 +- .../performance/browser_preferences_usage.js | 2 +- .../test/tabs/browser_e10s_switchbrowser.js | 4 +- .../browser/browser_ext_tabs_onUpdated.js | 14 +- .../test/browser/browser_google_behavior.js | 14 +- .../browser/browser_searchEngine_behaviors.js | 9 +- .../components/search/test/browser/head.js | 67 +++++ .../components/sessionstore/test/browser.ini | 1 + .../sessionstore/test/browser_broadcast.js | 13 +- .../tests/browser/browser_canonizeURL.js | 7 +- .../responsive/browser/web-navigation.js | 3 +- docshell/base/BrowsingContext.cpp | 61 +---- docshell/base/BrowsingContext.h | 21 +- docshell/base/CanonicalBrowsingContext.cpp | 104 -------- docshell/base/CanonicalBrowsingContext.h | 20 -- docshell/base/LoadContext.cpp | 8 + docshell/base/LoadContext.h | 18 ++ docshell/base/nsDocShell.cpp | 51 ++-- docshell/base/nsDocShell.h | 1 + docshell/base/nsILoadContext.idl | 8 + .../BrowserElementPromptService.jsm | 3 +- dom/chrome-webidl/BrowsingContext.webidl | 27 -- dom/ipc/BrowserParent.cpp | 1 + dom/ipc/ContentChild.cpp | 15 -- dom/ipc/ContentChild.h | 4 - dom/ipc/PContent.ipdl | 2 - ...rowser_test_referrer_loadInOtherProcess.js | 2 +- ...rowser_ConsoleStoragePBTest_perwindowpb.js | 62 +++-- modules/libpref/init/StaticPrefList.yaml | 7 - netwerk/ipc/ADocumentChannelBridge.h | 8 +- .../ipc/BrowsingContextDocumentChannel.cpp | 177 ------------- netwerk/ipc/BrowsingContextDocumentChannel.h | 67 ----- netwerk/ipc/DocumentChannelChild.cpp | 12 +- netwerk/ipc/DocumentChannelParent.cpp | 8 +- netwerk/ipc/DocumentChannelParent.h | 7 +- netwerk/ipc/DocumentLoadListener.cpp | 250 +++--------------- netwerk/ipc/DocumentLoadListener.h | 22 +- netwerk/ipc/NeckoParent.cpp | 28 +- netwerk/ipc/NeckoParent.h | 5 +- netwerk/ipc/PNecko.ipdl | 4 +- netwerk/ipc/SocketProcessHost.cpp | 4 - netwerk/ipc/SocketProcessImpl.cpp | 3 +- netwerk/ipc/moz.build | 2 - .../protocol/http/ParentChannelListener.cpp | 22 +- netwerk/protocol/http/ParentChannelListener.h | 2 +- toolkit/actors/WebNavigationChild.jsm | 7 + .../RemoteWebNavigation.jsm | 4 +- ...rowser_unknownContentType_delayedbutton.js | 2 - ...rowser_unknownContentType_dialog_layout.js | 2 - .../test/xpinstall/browser_datauri.js | 6 +- .../test/xpinstall/browser_enabled.js | 19 +- .../test/xpinstall/browser_enabled2.js | 6 +- .../test/xpinstall/browser_enabled3.js | 6 +- .../prefetch/OfflineCacheUpdateParent.cpp | 5 + 54 files changed, 341 insertions(+), 888 deletions(-) delete mode 100644 netwerk/ipc/BrowsingContextDocumentChannel.cpp delete mode 100644 netwerk/ipc/BrowsingContextDocumentChannel.h diff --git a/browser/base/content/test/general/browser_tab_detach_restore.js b/browser/base/content/test/general/browser_tab_detach_restore.js index 5ea47f445300..76adae490457 100644 --- a/browser/base/content/test/general/browser_tab_detach_restore.js +++ b/browser/base/content/test/general/browser_tab_detach_restore.js @@ -15,7 +15,7 @@ add_task(async function() { let tab = BrowserTestUtils.addTab(gBrowser); BrowserTestUtils.loadURI(tab.linkedBrowser, uri); - await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, uri); + await BrowserTestUtils.browserLoaded(tab.linkedBrowser); await TabStateFlusher.flush(tab.linkedBrowser); let key = tab.linkedBrowser.permanentKey; diff --git a/browser/base/content/test/performance/browser_preferences_usage.js b/browser/base/content/test/performance/browser_preferences_usage.js index b0e28f106598..58a152b62726 100644 --- a/browser/base/content/test/performance/browser_preferences_usage.js +++ b/browser/base/content/test/performance/browser_preferences_usage.js @@ -198,7 +198,7 @@ add_task(async function navigate_around() { // This is accessed in debug only. }, "toolkit.cosmeticAnimations.enabled": { - min: 39, + min: 45, max: 55, }, }; diff --git a/browser/base/content/test/tabs/browser_e10s_switchbrowser.js b/browser/base/content/test/tabs/browser_e10s_switchbrowser.js index 331a7cb56bd2..9f1caa55a92f 100644 --- a/browser/base/content/test/tabs/browser_e10s_switchbrowser.js +++ b/browser/base/content/test/tabs/browser_e10s_switchbrowser.js @@ -71,7 +71,7 @@ var waitForLoad = async function(uri) { }; gBrowser.selectedBrowser.webNavigation.loadURI(uri, loadURIOptions); - await BrowserTestUtils.browserStopped(gBrowser, uri); + await BrowserTestUtils.browserStopped(gBrowser); // Some of the documents we're using in this test use Fluent, // and they may finish localization later. @@ -101,7 +101,7 @@ var waitForLoadWithFlags = async function( triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(), }); - await BrowserTestUtils.browserStopped(gBrowser, uri); + await BrowserTestUtils.browserStopped(gBrowser); if (!(flags & Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY)) { if (flags & Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY) { gExpectedHistory.entries.pop(); diff --git a/browser/components/extensions/test/browser/browser_ext_tabs_onUpdated.js b/browser/components/extensions/test/browser/browser_ext_tabs_onUpdated.js index 5954e3e70fd0..f898ec2d9086 100644 --- a/browser/components/extensions/test/browser/browser_ext_tabs_onUpdated.js +++ b/browser/components/extensions/test/browser/browser_ext_tabs_onUpdated.js @@ -215,15 +215,11 @@ add_task(async function test_without_tabs_permission() { await do_test_update(async function background() { const url = "http://mochi.test:8888/browser/browser/components/extensions/test/browser/context_tabs_onUpdated_page.html"; - let tab = null; + const tab = await browser.tabs.create({ url }); let count = 0; browser.tabs.onUpdated.addListener(function onUpdated(tabId, changeInfo) { - // An attention change can happen during tabs.create, so - // we can't compare against tab yet. - if (!("attention" in changeInfo)) { - browser.test.assertEq(tabId, tab.id, "Check tab id"); - } + browser.test.assertEq(tabId, tab.id, "Check tab id"); browser.test.log(`onUpdated: ${JSON.stringify(changeInfo)}`); browser.test.assertFalse( @@ -241,9 +237,7 @@ add_task(async function test_without_tabs_permission() { if (changeInfo.status == "complete") { count++; - if (count === 1) { - browser.tabs.reload(tabId); - } else { + if (count === 2) { browser.test.log("Reload complete"); browser.tabs.onUpdated.removeListener(onUpdated); browser.tabs.remove(tabId); @@ -252,7 +246,7 @@ add_task(async function test_without_tabs_permission() { } }); - tab = await browser.tabs.create({ url }); + browser.tabs.reload(tab.id); }, false /* withPermissions */); }); diff --git a/browser/components/search/test/browser/browser_google_behavior.js b/browser/components/search/test/browser/browser_google_behavior.js index 485e65157c31..896383ad062b 100644 --- a/browser/components/search/test/browser/browser_google_behavior.js +++ b/browser/components/search/test/browser/browser_google_behavior.js @@ -185,17 +185,15 @@ async function testSearchEngine(engineDetails) { await test.preTest(tab); } - let promises = [ - BrowserTestUtils.waitForDocLoadAndStopIt( - "https://www.google.com/search?client=" + test.code + "&q=foo", - tab - ), - BrowserTestUtils.browserStopped(tab.linkedBrowser, null, true), - ]; + let stateChangePromise = promiseStateChangeURI(); await test.run(tab); - await Promise.all(promises); + let receivedURI = await stateChangePromise; + + let receivedURLParams = new URLSearchParams(receivedURI.split("?")[1]); + + Assert.equal(receivedURLParams.get("client"), test.code); if (test.postTest) { await test.postTest(tab); diff --git a/browser/components/search/test/browser/browser_searchEngine_behaviors.js b/browser/components/search/test/browser/browser_searchEngine_behaviors.js index e18130d6984e..7677051617c9 100644 --- a/browser/components/search/test/browser/browser_searchEngine_behaviors.js +++ b/browser/components/search/test/browser/browser_searchEngine_behaviors.js @@ -189,14 +189,13 @@ async function testSearchEngine(engineDetails) { await test.preTest(tab); } - let promises = [ - BrowserTestUtils.waitForDocLoadAndStopIt(test.searchURL, tab), - BrowserTestUtils.browserStopped(tab.linkedBrowser, null, true), - ]; + let stateChangePromise = promiseStateChangeURI(); await test.run(tab); - await Promise.all(promises); + let receivedURI = await stateChangePromise; + + Assert.equal(receivedURI, test.searchURL); } engine.alias = undefined; diff --git a/browser/components/search/test/browser/head.js b/browser/components/search/test/browser/head.js index f5e022fa371c..a9c235d6557d 100644 --- a/browser/components/search/test/browser/head.js +++ b/browser/components/search/test/browser/head.js @@ -109,6 +109,73 @@ async function promiseNewEngine(basename, options = {}) { return engine; } +let promiseStateChangeFrameScript = + "data:," + + encodeURIComponent( + `(${() => { + /* globals docShell, sendAsyncMessage */ + + const global = this; + const LISTENER = Symbol("listener"); + let listener = { + QueryInterface: ChromeUtils.generateQI([ + "nsISupportsWeakReference", + "nsIWebProgressListener", + ]), + + onStateChange: function onStateChange(webProgress, req, flags, status) { + // Only care about top-level document starts + if ( + !webProgress.isTopLevel || + !(flags & Ci.nsIWebProgressListener.STATE_START) + ) { + return; + } + + req.QueryInterface(Ci.nsIChannel); + let spec = req.originalURI.spec; + if (spec == "about:blank") { + return; + } + + delete global[LISTENER]; + docShell.removeProgressListener(listener); + + req.cancel(Cr.NS_ERROR_FAILURE); + + sendAsyncMessage("PromiseStateChange::StateChanged", spec); + }, + }; + + // Make sure the weak reference stays alive. + global[LISTENER] = listener; + + docShell.QueryInterface(Ci.nsIWebProgress); + docShell.addProgressListener( + listener, + Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT + ); + }})()` + ); + +function promiseStateChangeURI() { + const MSG = "PromiseStateChange::StateChanged"; + + return new Promise(resolve => { + let mm = window.getGroupMessageManager("browsers"); + mm.loadFrameScript(promiseStateChangeFrameScript, true); + + let listener = msg => { + mm.removeMessageListener(MSG, listener); + mm.removeDelayedFrameScript(promiseStateChangeFrameScript); + + resolve(msg.data); + }; + + mm.addMessageListener(MSG, listener); + }); +} + // Get an array of the one-off buttons. function getOneOffs() { let oneOffs = []; diff --git a/browser/components/sessionstore/test/browser.ini b/browser/components/sessionstore/test/browser.ini index 743a72ce717b..8af1e095a9ce 100644 --- a/browser/components/sessionstore/test/browser.ini +++ b/browser/components/sessionstore/test/browser.ini @@ -84,6 +84,7 @@ skip-if = fission || debug # bug 1211084 [browser_backup_recovery.js] skip-if = (verify && debug && (os == 'linux')) [browser_broadcast.js] +skip-if = fission || (os == 'mac') || (os == 'linux' && !debug && bits == 64) # Bug 1533895; Fission: SecurityError: The operation is insecure. [browser_capabilities.js] [browser_cleaner.js] [browser_crashedTabs.js] diff --git a/browser/components/sessionstore/test/browser_broadcast.js b/browser/components/sessionstore/test/browser_broadcast.js index 114e034e7af1..cdb5b2202b65 100644 --- a/browser/components/sessionstore/test/browser_broadcast.js +++ b/browser/components/sessionstore/test/browser_broadcast.js @@ -10,7 +10,7 @@ const INITIAL_VALUE = "browser_broadcast.js-initial-value-" + Date.now(); * closing a tab. */ add_task(async function flush_on_tabclose() { - let tab = await createTabWithStorageData(["http://example.com/"]); + let tab = await createTabWithStorageData(["http://example.com"]); let browser = tab.linkedBrowser; await modifySessionStorage(browser, { test: "on-tab-close" }); @@ -33,7 +33,7 @@ add_task(async function flush_on_tabclose() { * duplicating a tab. */ add_task(async function flush_on_duplicate() { - let tab = await createTabWithStorageData(["http://example.com/"]); + let tab = await createTabWithStorageData(["http://example.com"]); let browser = tab.linkedBrowser; await modifySessionStorage(browser, { test: "on-duplicate" }); @@ -61,7 +61,7 @@ add_task(async function flush_on_duplicate() { */ add_task(async function flush_on_windowclose() { let win = await promiseNewWindow(); - let tab = await createTabWithStorageData(["http://example.com/"], win); + let tab = await createTabWithStorageData(["http://example.com"], win); let browser = tab.linkedBrowser; await modifySessionStorage(browser, { test: "on-window-close" }); @@ -84,7 +84,7 @@ add_task(async function flush_on_windowclose() { * (via e.g. setTabState) and does not overwrite the new data. */ add_task(async function flush_on_settabstate() { - let tab = await createTabWithStorageData(["http://example.com/"]); + let tab = await createTabWithStorageData(["http://example.com"]); let browser = tab.linkedBrowser; // Flush to make sure our tab state is up-to-date. @@ -115,7 +115,7 @@ add_task(async function flush_on_settabstate() { * that hasn't been received by chrome, yet. */ add_task(async function flush_on_tabclose_racy() { - let tab = await createTabWithStorageData(["http://example.com/"]); + let tab = await createTabWithStorageData(["http://example.com"]); let browser = tab.linkedBrowser; // Flush to make sure we start with an empty queue. @@ -152,8 +152,7 @@ async function createTabWithStorageData(urls, win = window) { for (let url of urls) { BrowserTestUtils.loadURI(browser, url); - await promiseBrowserLoaded(browser, true, url); - dump("Loaded url: " + url + "\n"); + await promiseBrowserLoaded(browser); await modifySessionStorage(browser, { test: INITIAL_VALUE }); } diff --git a/browser/components/urlbar/tests/browser/browser_canonizeURL.js b/browser/components/urlbar/tests/browser/browser_canonizeURL.js index d454bb060bab..1e8e642be8c8 100644 --- a/browser/components/urlbar/tests/browser/browser_canonizeURL.js +++ b/browser/components/urlbar/tests/browser/browser_canonizeURL.js @@ -55,16 +55,11 @@ add_task(async function checkCtrlWorks() { expectedURL, gBrowser.selectedBrowser ); - let promiseStopped = BrowserTestUtils.browserStopped( - gBrowser.selectedBrowser, - undefined, - true - ); gURLBar.focus(); gURLBar.inputField.value = inputValue.slice(0, -1); EventUtils.sendString(inputValue.slice(-1)); EventUtils.synthesizeKey("KEY_Enter", options); - await Promise.all([promiseLoad, promiseStopped]); + await promiseLoad; } }); diff --git a/devtools/client/responsive/browser/web-navigation.js b/devtools/client/responsive/browser/web-navigation.js index b5644e92b160..473487bddcbd 100644 --- a/devtools/client/responsive/browser/web-navigation.js +++ b/devtools/client/responsive/browser/web-navigation.js @@ -96,7 +96,8 @@ BrowserElementWebNavigation.prototype = { }, stop(flags) { - this._browser.browsingContext.stop(flags); + // No equivalent in the current BrowserElement API + this._sendMessage("WebNavigation:Stop", { flags }); }, get document() { diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index 13d94f45bd65..7012bbf163eb 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -200,7 +200,6 @@ already_AddRefed BrowsingContext::CreateDetached( nsILoadInfo::EMBEDDER_POLICY_NULL); context->mFields.SetWithoutSyncing( nsILoadInfo::OPENER_POLICY_UNSAFE_NONE); - context->mFields.SetWithoutSyncing(false); if (aOpener && aOpener->SameOriginWithTop()) { // We inherit the opener policy if there is a creator and if the creator's @@ -1103,47 +1102,6 @@ bool BrowsingContext::CanSetOriginAttributes() { return true; } -Nullable BrowsingContext::GetAssociatedWindow() { - // nsILoadContext usually only returns same-process windows, - // so we intentionally return nullptr if this BC is out of - // process. - if (IsInProcess()) { - return WindowProxyHolder(this); - } - return nullptr; -} - -Nullable BrowsingContext::GetTopWindow() { - return Top()->GetAssociatedWindow(); -} - -Element* BrowsingContext::GetTopFrameElement() { - return Top()->GetEmbedderElement(); -} - -void BrowsingContext::SetUsePrivateBrowsing(bool aUsePrivateBrowsing, - ErrorResult& aError) { - nsresult rv = SetUsePrivateBrowsing(aUsePrivateBrowsing); - if (NS_FAILED(rv)) { - aError.Throw(rv); - } -} - -void BrowsingContext::SetUseTrackingProtectionWebIDL( - bool aUseTrackingProtection) { - SetForceEnableTrackingProtection(aUseTrackingProtection); -} - -void BrowsingContext::GetOriginAttributes(JSContext* aCx, - JS::MutableHandle aVal, - ErrorResult& aError) { - AssertOriginAttributesMatchPrivateBrowsing(); - - if (!ToJSValue(aCx, mOriginAttributes, aVal)) { - aError.NoteJSContextException(aCx); - } -} - NS_IMETHODIMP BrowsingContext::GetAssociatedWindow( mozIDOMWindowProxy** aAssociatedWindow) { nsCOMPtr win = GetDOMWindow(); @@ -1156,11 +1114,17 @@ NS_IMETHODIMP BrowsingContext::GetTopWindow(mozIDOMWindowProxy** aTopWindow) { } NS_IMETHODIMP BrowsingContext::GetTopFrameElement(Element** aTopFrameElement) { - RefPtr topFrameElement = GetTopFrameElement(); + RefPtr topFrameElement = Top()->GetEmbedderElement(); topFrameElement.forget(aTopFrameElement); return NS_OK; } +NS_IMETHODIMP BrowsingContext::GetNestedFrameId(uint64_t* aNestedFrameId) { + // FIXME: nestedFrameId should be removed, as it was only used by B2G. + *aNestedFrameId = 0; + return NS_OK; +} + NS_IMETHODIMP BrowsingContext::GetIsContent(bool* aIsContent) { *aIsContent = IsContent(); return NS_OK; @@ -1336,7 +1300,6 @@ void BrowsingContext::AssertOriginAttributesMatchPrivateBrowsing() { NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowsingContext) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsILoadContext) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END @@ -1459,10 +1422,6 @@ nsresult BrowsingContext::LoadURI(nsDocShellLoadState* aLoadState, return NS_ERROR_UNEXPECTED; } - if (Canonical()->AttemptLoadURIInParent(aLoadState, aSetNavigating)) { - return NS_OK; - } - if (ContentParent* cp = Canonical()->GetContentParent()) { Unused << cp->SendLoadURI(this, aLoadState, aSetNavigating); } @@ -1871,12 +1830,6 @@ bool BrowsingContext::CanSet(FieldIndex, return CheckOnlyOwningProcessCanSet(aSource); } -bool BrowsingContext::CanSet(FieldIndex, - const bool& aWatchedByDevtools, - ContentParent* aSource) { - return CheckOnlyOwningProcessCanSet(aSource); -} - bool BrowsingContext::CanSet(FieldIndex, const nsString& aUserAgent, ContentParent* aSource) { diff --git a/docshell/base/BrowsingContext.h b/docshell/base/BrowsingContext.h index 1ea866ec6d3e..11a75a5980ba 100644 --- a/docshell/base/BrowsingContext.h +++ b/docshell/base/BrowsingContext.h @@ -121,8 +121,7 @@ class WindowProxyHolder; FIELD(UserAgentOverride, nsString) \ FIELD(EmbedderElementType, Maybe) \ FIELD(MessageManagerGroup, nsString) \ - FIELD(MaxTouchPointsOverride, uint8_t) \ - FIELD(WatchedByDevtools, bool) + FIELD(MaxTouchPointsOverride, uint8_t) // BrowsingContext, in this context, is the cross process replicated // environment in which information about documents is stored. In @@ -259,8 +258,7 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { void RestoreChildren(Children&& aChildren, bool aFromIPC = false); // Triggers a load in the process which currently owns this BrowsingContext. - nsresult LoadURI(nsDocShellLoadState* aLoadState, - bool aSetNavigating = false); + nsresult LoadURI(nsDocShellLoadState* aLoadState, bool aSetNavigating = false); nsresult InternalLoad(nsDocShellLoadState* aLoadState, nsIDocShell** aDocShell, nsIRequest** aRequest); @@ -353,19 +351,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { BrowsingContextGroup* Group() { return mGroup; } - // WebIDL bindings for nsILoadContext - Nullable GetAssociatedWindow(); - Nullable GetTopWindow(); - Element* GetTopFrameElement(); - bool GetIsContent() { return IsContent(); } - void SetUsePrivateBrowsing(bool aUsePrivateBrowsing, ErrorResult& aError); - // Needs a different name to disambiguate from the xpidl method with - // the same signature but different return value. - void SetUseTrackingProtectionWebIDL(bool aUseTrackingProtection); - bool UseTrackingProtectionWebIDL() { return UseTrackingProtection(); } - void GetOriginAttributes(JSContext* aCx, JS::MutableHandle aVal, - ErrorResult& aError); - bool InRDMPane() const { return GetInRDMPane(); } bool IsLoading(); @@ -697,8 +682,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { ContentParent* aSource); bool CanSet(FieldIndex, const bool& aAllowPlugins, ContentParent* aSource); - bool CanSet(FieldIndex, const bool& aWatchedByDevtools, - ContentParent* aSource); template bool CanSet(FieldIndex, const T&, ContentParent*) { diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp index ddf4384d30a1..63ba94d89b54 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp @@ -13,12 +13,8 @@ #include "mozilla/dom/MediaController.h" #include "mozilla/dom/MediaControlService.h" #include "mozilla/dom/PlaybackController.h" -#include "mozilla/net/DocumentLoadListener.h" -#include "mozilla/net/BrowsingContextDocumentChannel.h" #include "mozilla/ipc/ProtocolUtils.h" #include "mozilla/NullPrincipal.h" -#include "mozilla/net/DocumentLoadListener.h" -#include "nsIWebNavigation.h" #include "nsGlobalWindowOuter.h" @@ -285,25 +281,6 @@ void CanonicalBrowsingContext::LoadURI(const nsAString& aURI, LoadURI(loadState, true); } -void CanonicalBrowsingContext::Stop(uint32_t aStopFlags) { - if (IsDiscarded()) { - return; - } - - // Stop any known network loads if necessary. - if (mCurrentLoad && (aStopFlags & nsIWebNavigation::STOP_NETWORK)) { - mCurrentLoad->Cancel(NS_BINDING_ABORTED); - } - - // Ask the docshell to stop to handle loads that haven't - // yet reached here, as well as non-network activity. - if (GetDocShell()) { - nsDocShell::Cast(GetDocShell())->Stop(aStopFlags); - } else if (ContentParent* cp = GetContentParent()) { - Unused << cp->SendStopLoad(this, aStopFlags); - } -} - void CanonicalBrowsingContext::PendingRemotenessChange::Complete( ContentParent* aContentParent) { if (!mPromise) { @@ -566,87 +543,6 @@ MediaController* CanonicalBrowsingContext::GetMediaController() { return mTabMediaController; } -bool CanonicalBrowsingContext::AttemptLoadURIInParent( - nsDocShellLoadState* aLoadState, bool aSetNavigating) { - // We currently only support starting loads directly from the - // CanonicalBrowsingContext for top-level BCs. - if (!IsTopContent() || !StaticPrefs::browser_tabs_documentchannel() || - !StaticPrefs::browser_tabs_documentchannel_parent_initiated()) { - return false; - } - - // We currently don't support initiating loads in the parent when they are - // watched by devtools. This is because devtools tracks loads using content - // process notifications, which happens after the load is initiated in this - // case. Devtools clears all prior requests when it detects a new navigation, - // so it drops the main document load that happened here. - if (GetWatchedByDevtools()) { - return false; - } - - // DocumentChannel currently only supports connecting channels into the - // content process, so we can only support schemes that will always be loaded - // there for now. Restrict to just http(s) for simplicity. - if (!aLoadState->URI()->SchemeIs("http") && - !aLoadState->URI()->SchemeIs("https")) { - return false; - } - - uint64_t outerWindowId = 0; - if (WindowGlobalParent* global = GetCurrentWindowGlobal()) { - nsCOMPtr currentURI = global->GetDocumentURI(); - if (currentURI) { - bool newURIHasRef = false; - aLoadState->URI()->GetHasRef(&newURIHasRef); - bool equalsExceptRef = false; - aLoadState->URI()->EqualsExceptRef(currentURI, &equalsExceptRef); - - if (equalsExceptRef && newURIHasRef) { - // This navigation is same-doc WRT the current one, we should pass it - // down to the docshell to be handled. - return false; - } - } - // If the current document has a beforeunload listener, then we need to - // start the load in that process after we fire the event. - if (global->HasBeforeUnload()) { - return false; - } - - outerWindowId = global->OuterWindowId(); - } - - RefPtr docChannel = - new net::BrowsingContextDocumentChannel(this); - - // If we successfully open the DocumentChannel, then it'll register - // itself in mCurrentLoad and be kept alive until it completes - // loading. - return docChannel->Open(aLoadState, outerWindowId, aSetNavigating); -} - -bool CanonicalBrowsingContext::StartDocumentLoad( - net::DocumentLoadListener* aLoad) { - if (mCurrentLoad) { - // If the new load is originates from a content process, - // and the current load is from the parent, then we consider - // the existing load higher precendence, and reject the new - // one. - if (aLoad->OtherPid() && !mCurrentLoad->OtherPid()) { - return false; - } - mCurrentLoad->Cancel(NS_BINDING_ABORTED); - } - mCurrentLoad = aLoad; - return true; -} -void CanonicalBrowsingContext::EndDocumentLoad( - net::DocumentLoadListener* aLoad) { - if (mCurrentLoad == aLoad) { - mCurrentLoad = nullptr; - } -} - NS_IMPL_CYCLE_COLLECTION_INHERITED(CanonicalBrowsingContext, BrowsingContext, mSessionHistory) diff --git a/docshell/base/CanonicalBrowsingContext.h b/docshell/base/CanonicalBrowsingContext.h index d16b0fc736b8..cb315d16249e 100644 --- a/docshell/base/CanonicalBrowsingContext.h +++ b/docshell/base/CanonicalBrowsingContext.h @@ -19,10 +19,6 @@ #include "nsISHEntry.h" namespace mozilla { -namespace net { -class DocumentLoadListener; -} - namespace dom { class WindowGlobalParent; @@ -104,7 +100,6 @@ class CanonicalBrowsingContext final : public BrowsingContext { using BrowsingContext::LoadURI; void LoadURI(const nsAString& aURI, const LoadURIOptions& aOptions, ErrorResult& aError); - void Stop(uint32_t aStopFlags); using RemotenessPromise = MozPromise, nsresult, false>; RefPtr ChangeFrameRemoteness(const nsAString& aRemoteType, @@ -121,9 +116,6 @@ class CanonicalBrowsingContext final : public BrowsingContext { // if the top-level browsing context has been discarded. MediaController* GetMediaController(); - bool AttemptLoadURIInParent(nsDocShellLoadState* aLoadState, - bool aSetNavigating); - bool HasHistoryEntry(nsISHEntry* aEntry) const { return aEntry && (aEntry == mOSHE || aEntry == mLSHE); } @@ -184,16 +176,6 @@ class CanonicalBrowsingContext final : public BrowsingContext { uint64_t mPendingSwitchId; }; - friend class net::DocumentLoadListener; - // Called when a DocumentLoadListener is created to start a load for - // this browsing context. Returns false if a higher priority load is - // already in-progress and the new one has been rejected. - bool StartDocumentLoad(net::DocumentLoadListener* aLoad); - // Called once DocumentLoadListener completes handling a load, and it - // is either complete, or handed off to the final channel to deliver - // data to the destination docshell. - void EndDocumentLoad(net::DocumentLoadListener* aLoad); - // XXX(farre): Store a ContentParent pointer here rather than mProcessId? // Indicates which process owns the docshell. uint64_t mProcessId; @@ -215,8 +197,6 @@ class CanonicalBrowsingContext final : public BrowsingContext { // context. RefPtr mTabMediaController; - RefPtr mCurrentLoad; - // These are being mirrored from docshell nsCOMPtr mOSHE; nsCOMPtr mLSHE; diff --git a/docshell/base/LoadContext.cpp b/docshell/base/LoadContext.cpp index 82de68472427..0336c52e2bf3 100644 --- a/docshell/base/LoadContext.cpp +++ b/docshell/base/LoadContext.cpp @@ -20,6 +20,7 @@ NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor) LoadContext::LoadContext(nsIPrincipal* aPrincipal, nsILoadContext* aOptionalBase) : mTopFrameElement(nullptr), + mNestedFrameId(0), mIsContent(true), mUseRemoteTabs(false), mUseRemoteSubframes(false), @@ -67,6 +68,13 @@ LoadContext::GetTopFrameElement(dom::Element** aElement) { return NS_OK; } +NS_IMETHODIMP +LoadContext::GetNestedFrameId(uint64_t* aId) { + NS_ENSURE_ARG(aId); + *aId = mNestedFrameId; + return NS_OK; +} + NS_IMETHODIMP LoadContext::GetIsContent(bool* aIsContent) { MOZ_ASSERT(mIsNotNull); diff --git a/docshell/base/LoadContext.h b/docshell/base/LoadContext.h index 470dd52bedc0..52b67d9d87de 100644 --- a/docshell/base/LoadContext.h +++ b/docshell/base/LoadContext.h @@ -36,6 +36,21 @@ class LoadContext final : public nsILoadContext, public nsIInterfaceRequestor { LoadContext(const IPC::SerializedLoadContext& aToCopy, dom::Element* aTopFrameElement, OriginAttributes& aAttrs) : mTopFrameElement(do_GetWeakReference(aTopFrameElement)), + mNestedFrameId(0), + mIsContent(aToCopy.mIsContent), + mUseRemoteTabs(aToCopy.mUseRemoteTabs), + mUseRemoteSubframes(aToCopy.mUseRemoteSubframes), + mUseTrackingProtection(aToCopy.mUseTrackingProtection), +#ifdef DEBUG + mIsNotNull(aToCopy.mIsNotNull), +#endif + mOriginAttributes(aAttrs) { + } + + LoadContext(const IPC::SerializedLoadContext& aToCopy, + uint64_t aNestedFrameId, OriginAttributes& aAttrs) + : mTopFrameElement(nullptr), + mNestedFrameId(aNestedFrameId), mIsContent(aToCopy.mIsContent), mUseRemoteTabs(aToCopy.mUseRemoteTabs), mUseRemoteSubframes(aToCopy.mUseRemoteSubframes), @@ -51,6 +66,7 @@ class LoadContext final : public nsILoadContext, public nsIInterfaceRequestor { bool aUseRemoteSubframes, bool aUseTrackingProtection, const OriginAttributes& aAttrs) : mTopFrameElement(do_GetWeakReference(aTopFrameElement)), + mNestedFrameId(0), mIsContent(aIsContent), mUseRemoteTabs(aUseRemoteTabs), mUseRemoteSubframes(aUseRemoteSubframes), @@ -66,6 +82,7 @@ class LoadContext final : public nsILoadContext, public nsIInterfaceRequestor { // Constructor taking reserved origin attributes. explicit LoadContext(OriginAttributes& aAttrs) : mTopFrameElement(nullptr), + mNestedFrameId(0), mIsContent(false), mUseRemoteTabs(false), mUseRemoteSubframes(false), @@ -84,6 +101,7 @@ class LoadContext final : public nsILoadContext, public nsIInterfaceRequestor { ~LoadContext() {} nsWeakPtr mTopFrameElement; + uint64_t mNestedFrameId; bool mIsContent; bool mUseRemoteTabs; bool mUseRemoteSubframes; diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 54b4a2eb6a97..ebd58b60a126 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9792,6 +9792,26 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState, mContentTypeHint.Truncate(); } + if (mLoadType == LOAD_NORMAL_ALLOW_MIXED_CONTENT || + mLoadType == LOAD_RELOAD_ALLOW_MIXED_CONTENT) { + rv = SetMixedContentChannel(channel); + NS_ENSURE_SUCCESS(rv, rv); + } else if (mMixedContentChannel) { + /* + * If the user "Disables Protection on This Page", we call + * SetMixedContentChannel for the first time, otherwise + * mMixedContentChannel is still null. + * Later, if the new channel passes a same orign check, we remember the + * users decision by calling SetMixedContentChannel using the new channel. + * This way, the user does not have to click the disable protection button + * over and over for browsing the same site. + */ + rv = nsContentUtils::CheckSameOrigin(mMixedContentChannel, channel); + if (NS_FAILED(rv) || NS_FAILED(SetMixedContentChannel(channel))) { + SetMixedContentChannel(nullptr); + } + } + rv = DoChannelLoad( channel, uriLoader, aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER)); @@ -9999,26 +10019,6 @@ nsresult nsDocShell::OpenInitializedChannel(nsIChannel* aChannel, uint32_t aOpenFlags) { nsresult rv = NS_OK; - if (mLoadType == LOAD_NORMAL_ALLOW_MIXED_CONTENT || - mLoadType == LOAD_RELOAD_ALLOW_MIXED_CONTENT) { - rv = SetMixedContentChannel(aChannel); - NS_ENSURE_SUCCESS(rv, rv); - } else if (mMixedContentChannel) { - /* - * If the user "Disables Protection on This Page", we call - * SetMixedContentChannel for the first time, otherwise - * mMixedContentChannel is still null. - * Later, if the new channel passes a same orign check, we remember the - * users decision by calling SetMixedContentChannel using the new channel. - * This way, the user does not have to click the disable protection button - * over and over for browsing the same site. - */ - rv = nsContentUtils::CheckSameOrigin(mMixedContentChannel, aChannel); - if (NS_FAILED(rv) || NS_FAILED(SetMixedContentChannel(aChannel))) { - SetMixedContentChannel(nullptr); - } - } - // If anything fails here, make sure to clear our initial ClientSource. auto cleanupInitialClient = MakeScopeExit([&] { mInitialClientSource.reset(); }); @@ -10070,7 +10070,6 @@ nsresult nsDocShell::OpenInitializedChannel(nsIChannel* aChannel, // ClientInfo, so we just need to allocate a corresponding ClientSource. CreateReservedSourceIfNeeded(aChannel, win->EventTargetFor(TaskCategory::Other)); - rv = NS_OK; } else { rv = AddClientChannelHelper(aChannel, std::move(noReservedClient), GetInitialClientInfo(), @@ -11765,6 +11764,11 @@ nsDocShell::GetTopFrameElement(Element** aElement) { return mBrowsingContext->GetTopFrameElement(aElement); } +NS_IMETHODIMP +nsDocShell::GetNestedFrameId(uint64_t* aId) { + return mBrowsingContext->GetNestedFrameId(aId); +} + NS_IMETHODIMP nsDocShell::GetUseTrackingProtection(bool* aUseTrackingProtection) { return mBrowsingContext->GetUseTrackingProtection(aUseTrackingProtection); @@ -12436,6 +12440,10 @@ nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier, int32_t aHistoryIndex) { aLoadState->GetPendingRedirectedChannel(), previousURI, previousFlags, aRedirects); + MOZ_ASSERT( + (self->mCurrentURI && NS_IsAboutBlank(self->mCurrentURI)) || + !self->mTiming, + "timing object can't already exists in non-about:blank loads"); self->mTiming = new nsDOMNavigationTiming(self, aTiming); // If we're performing a history load, locate the correct history entry, @@ -12845,6 +12853,5 @@ nsDocShell::GetWatchedByDevtools(bool* aWatched) { NS_IMETHODIMP nsDocShell::SetWatchedByDevtools(bool aWatched) { mWatchedByDevtools = aWatched; - mBrowsingContext->SetWatchedByDevtools(aWatched); return NS_OK; } diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 9155982c8b62..f7f8916af6b1 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -305,6 +305,7 @@ class nsDocShell final : public nsDocLoader, NS_IMETHOD GetAssociatedWindow(mozIDOMWindowProxy**) override; NS_IMETHOD GetTopWindow(mozIDOMWindowProxy**) override; NS_IMETHOD GetTopFrameElement(mozilla::dom::Element**) override; + NS_IMETHOD GetNestedFrameId(uint64_t*) override; NS_IMETHOD GetIsContent(bool*) override; NS_IMETHOD GetUsePrivateBrowsing(bool*) override; NS_IMETHOD SetUsePrivateBrowsing(bool) override; diff --git a/docshell/base/nsILoadContext.idl b/docshell/base/nsILoadContext.idl index 234ba531c2b4..67b8ff1cd7b4 100644 --- a/docshell/base/nsILoadContext.idl +++ b/docshell/base/nsILoadContext.idl @@ -55,6 +55,14 @@ interface nsILoadContext : nsISupports */ readonly attribute Element topFrameElement; + /** + * If this LoadContext corresponds to a nested remote iframe, we don't have + * access to the topFrameElement. Instead, we must use this id to send + * messages. A return value of 0 signifies that this load context is not for + * a nested frame. + */ + readonly attribute unsigned long long nestedFrameId; + /** * True if the load context is content (as opposed to chrome). This is * determined based on the type of window the load is performed in, NOT based diff --git a/dom/browser-element/BrowserElementPromptService.jsm b/dom/browser-element/BrowserElementPromptService.jsm index 0218b0a09ca9..9ff49c2051d7 100644 --- a/dom/browser-element/BrowserElementPromptService.jsm +++ b/dom/browser-element/BrowserElementPromptService.jsm @@ -523,7 +523,8 @@ AuthPromptWrapper.prototype = { ); let frame = context.topFrameElement; if (!frame) { - return false; + // This function returns a boolean value + return !!context.nestedFrameId; } if (!BrowserElementPromptService.getBrowserElementParentForFrame(frame)) { diff --git a/dom/chrome-webidl/BrowsingContext.webidl b/dom/chrome-webidl/BrowsingContext.webidl index 860741ac97b7..95aed1c6bab8 100644 --- a/dom/chrome-webidl/BrowsingContext.webidl +++ b/dom/chrome-webidl/BrowsingContext.webidl @@ -5,29 +5,6 @@ interface nsIDocShell; -interface mixin LoadContextMixin { - readonly attribute WindowProxy? associatedWindow; - - readonly attribute WindowProxy? topWindow; - - readonly attribute Element? topFrameElement; - - readonly attribute boolean isContent; - - [SetterThrows] - attribute boolean usePrivateBrowsing; - - readonly attribute boolean useRemoteTabs; - - readonly attribute boolean useRemoteSubframes; - - [BinaryName="useTrackingProtectionWebIDL"] - attribute boolean useTrackingProtection; - - [NewObject, Throws] - readonly attribute any originAttributes; -}; - [Exposed=Window, ChromeOnly] interface BrowsingContext { static BrowsingContext? get(unsigned long long aId); @@ -89,8 +66,6 @@ interface BrowsingContext { void setRDMPaneMaxTouchPoints(octet maxTouchPoints); }; -BrowsingContext includes LoadContextMixin; - [Exposed=Window, ChromeOnly] interface CanonicalBrowsingContext : BrowsingContext { sequence getWindowGlobals(); @@ -127,8 +102,6 @@ interface CanonicalBrowsingContext : BrowsingContext { [Throws] void loadURI(DOMString aURI, optional LoadURIOptions aOptions = {}); - void stop(unsigned long aStopFlags); - [Throws] Promise changeFrameRemoteness( DOMString remoteType, unsigned long long pendingSwitchId); diff --git a/dom/ipc/BrowserParent.cpp b/dom/ipc/BrowserParent.cpp index fbf5f200362f..851448eba0ea 100644 --- a/dom/ipc/BrowserParent.cpp +++ b/dom/ipc/BrowserParent.cpp @@ -3796,6 +3796,7 @@ class FakeChannel final : public nsIChannel, elem.forget(aElement); return NS_OK; } + NS_IMETHOD GetNestedFrameId(uint64_t*) NO_IMPL; NS_IMETHOD GetIsContent(bool*) NO_IMPL; NS_IMETHOD GetUsePrivateBrowsing(bool*) NO_IMPL; NS_IMETHOD SetUsePrivateBrowsing(bool) NO_IMPL; diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 9a8fa198b099..6ff9498be523 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -4167,21 +4167,6 @@ mozilla::ipc::IPCResult ContentChild::RecvDisplayLoadError( return IPC_OK(); } -mozilla::ipc::IPCResult ContentChild::RecvStopLoad( - const MaybeDiscarded& aContext, - const uint32_t aStopFlags) { - if (aContext.IsNullOrDiscarded()) { - return IPC_OK(); - } - BrowsingContext* context = aContext.get(); - - if (nsIDocShell* docShell = context->GetDocShell()) { - nsDocShell::Cast(docShell)->Stop(aStopFlags); - } - - return IPC_OK(); -} - #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS) mozilla::ipc::IPCResult ContentChild::RecvInitSandboxTesting( Endpoint&& aEndpoint) { diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 290f0afa61da..ccaa03e34196 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -797,10 +797,6 @@ class ContentChild final mozilla::ipc::IPCResult RecvDisplayLoadError( const MaybeDiscarded& aContext, const nsAString& aURI); - mozilla::ipc::IPCResult RecvStopLoad( - const MaybeDiscarded& aContext, - const uint32_t aStopFlags); - #ifdef NIGHTLY_BUILD virtual PContentChild::Result OnMessageReceived(const Message& aMsg) override; #else diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index cd7ad10791b4..5987c7717b9d 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -844,8 +844,6 @@ child: async DisplayLoadError(MaybeDiscardedBrowsingContext aContext, nsString aURI); - async StopLoad(MaybeDiscardedBrowsingContext aContext, uint32_t aStopFlags); - // Tell aContext's docshell to update its mOSHE and mLSHE entries async UpdateSHEntriesInDocShell(CrossProcessSHEntry aOldEntry, CrossProcessSHEntry aNewEntry, diff --git a/dom/security/test/general/browser_test_referrer_loadInOtherProcess.js b/dom/security/test/general/browser_test_referrer_loadInOtherProcess.js index 25ed6fbcc729..9b81af138df9 100644 --- a/dom/security/test/general/browser_test_referrer_loadInOtherProcess.js +++ b/dom/security/test/general/browser_test_referrer_loadInOtherProcess.js @@ -87,7 +87,7 @@ var waitForLoad = async function(uri) { }; gBrowser.selectedBrowser.webNavigation.loadURI(uri, loadURIOptions); - await BrowserTestUtils.browserStopped(gBrowser, uri); + await BrowserTestUtils.browserStopped(gBrowser); }; // Tests referrerInfo when navigating from a page in the remote process to main diff --git a/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js b/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js index 7eda392d63df..0ce1d4ad7587 100644 --- a/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js +++ b/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js @@ -32,40 +32,38 @@ function test() { } function doTest(aIsPrivateMode, aWindow, aCallback) { - BrowserTestUtils.browserLoaded( - aWindow.gBrowser.selectedBrowser, - false, - testURI - ).then(() => { - consoleObserver = { - observe(aSubject, aTopic, aData) { - if (aTopic == "console-api-log-event") { - afterEvents = ConsoleAPIStorage.getEvents(innerID); - is( - beforeEvents.length == afterEvents.length - 1, - storageShouldOccur, - "storage should" + (storageShouldOccur ? "" : " not") + " occur" - ); - - executeSoon(function() { - Services.obs.removeObserver( - consoleObserver, - "console-api-log-event" + BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser).then( + () => { + consoleObserver = { + observe(aSubject, aTopic, aData) { + if (aTopic == "console-api-log-event") { + afterEvents = ConsoleAPIStorage.getEvents(innerID); + is( + beforeEvents.length == afterEvents.length - 1, + storageShouldOccur, + "storage should" + (storageShouldOccur ? "" : " not") + " occur" ); - aCallback(); - }); - } - }, - }; - aWindow.Services.obs.addObserver( - consoleObserver, - "console-api-log-event" - ); - aWindow.nativeConsole.log( - "foo bar baz (private: " + aIsPrivateMode + ")" - ); - }); + executeSoon(function() { + Services.obs.removeObserver( + consoleObserver, + "console-api-log-event" + ); + aCallback(); + }); + } + }, + }; + + aWindow.Services.obs.addObserver( + consoleObserver, + "console-api-log-event" + ); + aWindow.nativeConsole.log( + "foo bar baz (private: " + aIsPrivateMode + ")" + ); + } + ); // We expect that console API messages are always stored. storageShouldOccur = true; diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 4aff2bb48c60..bab0565621aa 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -962,13 +962,6 @@ value: true mirror: always -# If set, use DocumentChannel to directly initiate loads from -# parent-process BrowsingContexts -- name: browser.tabs.documentchannel.parent-initiated - type: bool - value: true - mirror: always - - name: browser.tabs.remote.desktopbehavior type: bool value: false diff --git a/netwerk/ipc/ADocumentChannelBridge.h b/netwerk/ipc/ADocumentChannelBridge.h index 592e2b92d047..758fff04dd43 100644 --- a/netwerk/ipc/ADocumentChannelBridge.h +++ b/netwerk/ipc/ADocumentChannelBridge.h @@ -32,18 +32,12 @@ class ADocumentChannelBridge { // RemoveRequest). // We do this so we can remove using NS_BINDING_RETARGETED, but still have // the channel not be in an error state. - // - // aSwitchingToNewProcess is true if the load is successful, but we're - // disconnecting the bridge to switch the load to a new process. virtual void DisconnectChildListeners(nsresult aStatus, - nsresult aLoadGroupStatus, - bool aSwitchingToNewProcess) = 0; + nsresult aLoadGroupStatus) = 0; // Delete the bridge, and drop any refs to the DocumentLoadListener virtual void Delete() = 0; - virtual bool SupportsRedirectToRealChannel() { return true; } - // Initate a switch from the DocumentChannel to the protocol-specific // real channel. virtual RefPtr diff --git a/netwerk/ipc/BrowsingContextDocumentChannel.cpp b/netwerk/ipc/BrowsingContextDocumentChannel.cpp deleted file mode 100644 index ff5b805477f1..000000000000 --- a/netwerk/ipc/BrowsingContextDocumentChannel.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set sw=2 ts=8 et tw=80 : */ - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "BrowsingContextDocumentChannel.h" -#include "DocumentLoadListener.h" -#include "nsIBrowser.h" -#include "mozilla/dom/BrowserParent.h" -#include "mozilla/dom/ContentParent.h" -#include "mozilla/dom/Element.h" -#include "mozilla/dom/RemoteWebProgress.h" -#include "mozilla/dom/RemoteWebProgressRequest.h" -#include "mozilla/dom/WindowGlobalParent.h" - -using namespace mozilla::dom; - -extern mozilla::LazyLogModule gDocumentChannelLog; -#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt) - -namespace mozilla { -namespace net { - -already_AddRefed BrowsingContextDocumentChannel::GetBrowser() { - CanonicalBrowsingContext* bc = mParent->GetBrowsingContext(); - if (!bc || !bc->IsTopContent()) { - NS_ASSERTION(false, "No BC, or subframe?"); - return nullptr; - } - - nsCOMPtr browser; - RefPtr currentElement = bc->GetEmbedderElement(); - - // In Responsive Design Mode, mFrameElement will be the