Backed out 12 changesets (bug 1721217) for bc failures on browser_TopLevelNavigationDelegate.js

Backed out changeset 5fe3c617d521 (bug 1721217)
Backed out changeset c131e4a6d9d5 (bug 1721217)
Backed out changeset a59210a5b400 (bug 1721217)
Backed out changeset 74362b0c39c0 (bug 1721217)
Backed out changeset c8075b91d660 (bug 1721217)
Backed out changeset 46512deaf0e5 (bug 1721217)
Backed out changeset b38bc569d227 (bug 1721217)
Backed out changeset ee9bd012fda8 (bug 1721217)
Backed out changeset 7aa2726a0982 (bug 1721217)
Backed out changeset 885ced5f4bb4 (bug 1721217)
Backed out changeset 7d3f99ca3f44 (bug 1721217)
Backed out changeset 2f5a0164679a (bug 1721217)
This commit is contained in:
Narcis Beleuzu 2021-12-01 03:38:10 +02:00
Родитель 6b76c9ed4c
Коммит 4c87b2e488
31 изменённых файлов: 151 добавлений и 656 удалений

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

@ -6543,24 +6543,9 @@
// before the location changed.
this.mBrowser.userTypedValue = null;
// When browser.tabs.documentchannel.parent-controlled pref and SHIP
// are enabled and a load gets cancelled due to another one
// starting, the error is NS_BINDING_CANCELLED_OLD_LOAD.
// When these prefs are not enabled, the error is different and
// that's why we still want to look at the isNavigating flag.
// We could add a workaround and make sure that in the alternative
// codepaths we would also omit the same error, but considering
// how we will be enabling fission by default soon, we can keep
// using isNavigating for now, and remove it when the
// parent-controlled pref and SHIP are enabled by default.
// Bug 1725716 has been filed to consider removing isNavigating
// field alltogether.
let isNavigating = this.mBrowser.isNavigating;
if (
this.mTab.selected &&
aStatus != Cr.NS_BINDING_CANCELLED_OLD_LOAD &&
!isNavigating
) {
if (this.mTab.selected && !isNavigating) {
gURLBar.setURI();
}
} else if (isSuccessful) {

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

@ -50,10 +50,6 @@ add_task(async function test_unknown_host() {
EventUtils.synthesizeKey("KEY_Enter");
await searchPromise;
// With parent initiated loads, we need to give XULBrowserWindow
// time to process the STATE_START event and set the attribute to true.
await new Promise(resolve => executeSoon(resolve));
ok(kButton.hasAttribute("displaystop"), "Should be showing stop");
await TestUtils.waitForCondition(

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

@ -63,43 +63,35 @@ add_task(async function test_overwrite_does_not_delete_first() {
let dialogPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
// Now try and download a thing to the file:
await BrowserTestUtils.withNewTab(
{
gBrowser,
opening: TEST_ROOT + "foo.txt",
waitForLoad: false,
waitForStateStop: true,
},
async function() {
if (
!Services.prefs.getBoolPref(
"browser.download.improvements_to_download_panel"
)
) {
let dialog = await dialogPromise;
info("Got dialog.");
let saveEl = dialog.document.getElementById("save");
dialog.document.getElementById("mode").selectedItem = saveEl;
// Allow accepting the dialog (to avoid the delay helper):
dialog.document
.getElementById("unknownContentType")
.getButton("accept").disabled = false;
// Then accept it:
dialog.document.querySelector("dialog").acceptDialog();
}
ok(await transferCompletePromise, "download should succeed");
ok(
gTestTargetFile.exists(),
"File should still exist and not have been deleted."
);
// Note: the download transfer is fake so data won't have been written to
// the file, so we can't verify that the download actually overwrites data
// like this.
mockTransferRegisterer.unregister();
unregisteredTransfer = true;
await BrowserTestUtils.withNewTab(TEST_ROOT + "foo.txt", async function() {
if (
!Services.prefs.getBoolPref(
"browser.download.improvements_to_download_panel"
)
) {
let dialog = await dialogPromise;
info("Got dialog.");
let saveEl = dialog.document.getElementById("save");
dialog.document.getElementById("mode").selectedItem = saveEl;
// Allow accepting the dialog (to avoid the delay helper):
dialog.document
.getElementById("unknownContentType")
.getButton("accept").disabled = false;
// Then accept it:
dialog.document.querySelector("dialog").acceptDialog();
}
);
ok(await transferCompletePromise, "download should succeed");
ok(
gTestTargetFile.exists(),
"File should still exist and not have been deleted."
);
// Note: the download transfer is fake so data won't have been written to
// the file, so we can't verify that the download actually overwrites data
// like this.
mockTransferRegisterer.unregister();
unregisteredTransfer = true;
});
});
// If we download a file and the user accepts overwriting an existing one,
@ -122,43 +114,35 @@ add_task(async function test_overwrite_works() {
});
});
// Now try and download a thing to the file:
await BrowserTestUtils.withNewTab(
{
gBrowser,
opening: TEST_ROOT + "foo.txt",
waitForLoad: false,
waitForStateStop: true,
},
async function() {
if (
!Services.prefs.getBoolPref(
"browser.download.improvements_to_download_panel"
)
) {
let dialog = await dialogPromise;
info("Got dialog.");
let saveEl = dialog.document.getElementById("save");
dialog.document.getElementById("mode").selectedItem = saveEl;
// Allow accepting the dialog (to avoid the delay helper):
dialog.document
.getElementById("unknownContentType")
.getButton("accept").disabled = false;
// Then accept it:
dialog.document.querySelector("dialog").acceptDialog();
}
info("wait for download to finish");
let download = await downloadFinishedPromise;
ok(download.succeeded, "Download should succeed");
ok(
gTestTargetFile.exists(),
"File should still exist and not have been deleted."
);
let contents = new TextDecoder().decode(
await IOUtils.read(gTestTargetFile.path)
);
info("Got: " + contents);
ok(contents.startsWith("Dummy"), "The file was overwritten.");
await BrowserTestUtils.withNewTab(TEST_ROOT + "foo.txt", async function() {
if (
!Services.prefs.getBoolPref(
"browser.download.improvements_to_download_panel"
)
) {
let dialog = await dialogPromise;
info("Got dialog.");
let saveEl = dialog.document.getElementById("save");
dialog.document.getElementById("mode").selectedItem = saveEl;
// Allow accepting the dialog (to avoid the delay helper):
dialog.document
.getElementById("unknownContentType")
.getButton("accept").disabled = false;
// Then accept it:
dialog.document.querySelector("dialog").acceptDialog();
}
);
info("wait for download to finish");
let download = await downloadFinishedPromise;
ok(download.succeeded, "Download should succeed");
ok(
gTestTargetFile.exists(),
"File should still exist and not have been deleted."
);
let contents = new TextDecoder().decode(
await IOUtils.read(gTestTargetFile.path)
);
info("Got: " + contents);
ok(contents.startsWith("Dummy"), "The file was overwritten.");
});
});

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

@ -339,7 +339,6 @@ skip-if =
https_first_disabled = true
[browser_ext_user_events.js]
[browser_ext_webRequest.js]
[browser_ext_webRequest_error_after_stopped_or_closed.js]
[browser_ext_webrtc.js]
skip-if = os == 'mac' # Bug 1565738
[browser_ext_webNavigation_containerIsolation.js]

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

@ -1,110 +0,0 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
const SLOW_PAGE =
getRootDirectory(gTestPath).replace(
"chrome://mochitests/content",
"http://www.example.com"
) + "file_slowed_document.sjs";
async function runTest(stopLoadFunc) {
async function background() {
let urls = ["http://www.example.com/*"];
browser.webRequest.onCompleted.addListener(
details => {
browser.test.sendMessage("done", {
msg: "onCompleted",
requestId: details.requestId,
});
},
{ urls }
);
browser.webRequest.onBeforeRequest.addListener(
details => {
browser.test.sendMessage("onBeforeRequest", {
requestId: details.requestId,
});
},
{ urls },
["blocking"]
);
browser.webRequest.onErrorOccurred.addListener(
details => {
browser.test.sendMessage("done", {
msg: "onErrorOccurred",
requestId: details.requestId,
});
},
{ urls }
);
}
let extension = ExtensionTestUtils.loadExtension({
manifest: {
permissions: [
"webRequest",
"webRequestBlocking",
"http://www.example.com/*",
],
},
background,
});
await extension.startup();
// Open a SLOW_PAGE and don't wait for it to load
let slowTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
SLOW_PAGE,
false
);
stopLoadFunc(slowTab);
// Retrieve the requestId from onBeforeRequest
let requestIdOnBeforeRequest = await extension.awaitMessage(
"onBeforeRequest"
);
// Now verify that we got the correct event and request id
let doneMessage = await extension.awaitMessage("done");
// We shouldn't get the onCompleted message here
is(doneMessage.msg, "onErrorOccurred", "received onErrorOccurred message");
is(
requestIdOnBeforeRequest.requestId,
doneMessage.requestId,
"request Ids match"
);
BrowserTestUtils.removeTab(slowTab);
await extension.unload();
}
/**
* Check that after we cancel a slow page load, we get an error associated with
* our request.
*/
add_task(async function test_click_stop_button() {
await runTest(async slowTab => {
// Stop the load
let stopButton = document.getElementById("stop-button");
await TestUtils.waitForCondition(() => {
return !stopButton.disabled;
});
stopButton.click();
});
});
/**
* Check that after we close the tab corresponding to a slow page load,
* that we get an error associated with our request.
*/
add_task(async function test_remove_tab() {
await runTest(slowTab => {
// Remove the tab
BrowserTestUtils.removeTab(slowTab);
});
});

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

@ -112,12 +112,10 @@ add_task(async function alwaysAskPreferenceWorks() {
);
let domWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "empty_pdf_file.pdf",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "empty_pdf_file.pdf"
);
let domWindow = await domWindowPromise;
let dialog = domWindow.document.querySelector("#unknownContentType");
@ -156,12 +154,10 @@ add_task(async function handleInternallyPreferenceWorks() {
"Should have selected 'handle internally' for pdf"
);
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "empty_pdf_file.pdf",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "empty_pdf_file.pdf"
);
await ContentTask.spawn(loadingTab.linkedBrowser, null, async () => {
await ContentTaskUtils.waitForCondition(
@ -207,12 +203,10 @@ add_task(async function saveToDiskPreferenceWorks() {
let downloadFinishedPromise = downloadHadFinished(publicList);
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "empty_pdf_file.pdf",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "empty_pdf_file.pdf"
);
let download = await downloadFinishedPromise;
BrowserTestUtils.removeTab(loadingTab);
@ -269,12 +263,10 @@ add_task(async function useSystemDefaultPreferenceWorks() {
let downloadFinishedPromise = downloadHadFinished(publicList);
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "empty_pdf_file.pdf",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "empty_pdf_file.pdf"
);
info("Downloading had finished");
let download = await downloadFinishedPromise;
@ -338,12 +330,10 @@ add_task(async function useSystemDefaultAndAskForDestinationWorks() {
MockFilePicker.cleanup();
});
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "empty_pdf_file.pdf",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "empty_pdf_file.pdf"
);
await filePickerShown;

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

@ -193,11 +193,12 @@ async function testSearchEngine(engineDetails) {
await test.preTest(tab);
}
let googleUrl =
"https://www.google.com/search?client=" + test.code + "&q=foo";
let promises = [
BrowserTestUtils.waitForDocLoadAndStopIt(googleUrl, tab),
BrowserTestUtils.browserStopped(tab.linkedBrowser, googleUrl, true),
BrowserTestUtils.waitForDocLoadAndStopIt(
"https://www.google.com/search?client=" + test.code + "&q=foo",
tab
),
BrowserTestUtils.browserStopped(tab.linkedBrowser, null, true),
];
await test.run(tab);

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

@ -173,8 +173,8 @@ async function testSearchEngine(engineDetails) {
async preTest(tab) {
let browser = tab.linkedBrowser;
BrowserTestUtils.loadURI(browser, "about:newtab");
await BrowserTestUtils.browserLoaded(browser, false, "about:newtab");
await promiseContentSearchReady(browser);
},
async run(tab) {
@ -199,7 +199,7 @@ async function testSearchEngine(engineDetails) {
let promises = [
BrowserTestUtils.waitForDocLoadAndStopIt(test.searchURL, tab),
BrowserTestUtils.browserStopped(tab.linkedBrowser, test.searchURL, true),
BrowserTestUtils.browserStopped(tab.linkedBrowser, null, true),
];
await test.run(tab);

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

@ -148,7 +148,7 @@ https_first_disabled = true
[browser_restore_cookies_noOriginAttributes.js]
[browser_scrollPositions.js]
https_first_disabled = true
skip-if = true # Bug 1743636
skip-if = !fission
[browser_scrollPositionsReaderMode.js]
[browser_sessionHistory.js]
https_first_disabled = true

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

@ -218,242 +218,3 @@ add_task(async function() {
BrowserTestUtils.removeTab(newTab);
BrowserTestUtils.removeTab(tab);
});
/**
* 1) Try to load page 0 and wait for it to finish loading.
* 2) Try to load page 1 and wait for it to finish loading.
* 3) Try to load SLOW_PAGE, and then before it finishes loading, navigate back.
* - We should be taken to page 0.
*/
add_task(async function testCorrectUrlBarAfterGoingBackDuringAnotherLoad() {
// Load example.org
let page0 = "http://example.org/";
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
page0,
true,
true
);
// Load example.com in the same browser
let page1 = "http://example.com/";
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, page1);
BrowserTestUtils.loadURI(tab.linkedBrowser, page1);
await loaded;
let initialValue = gURLBar.untrimmedValue;
let expectedURLBarChange = SLOW_PAGE;
let sawChange = false;
let goneBack = false;
let handler = () => {
if (!goneBack) {
isnot(
gURLBar.untrimmedValue,
initialValue,
`Should not revert URL bar value to ${initialValue}`
);
}
if (gURLBar.getAttribute("pageproxystate") == "valid") {
sawChange = true;
is(
gURLBar.untrimmedValue,
expectedURLBarChange,
`Should set expected URL bar value - ${expectedURLBarChange}`
);
}
};
let obs = new MutationObserver(handler);
obs.observe(gURLBar.textbox, { attributes: true });
// Set the value of url bar to SLOW_PAGE
gURLBar.value = SLOW_PAGE;
gURLBar.handleCommand();
// Copied from the first test case:
// If this ever starts going intermittent, we've broken this.
await new Promise(resolve => setTimeout(resolve, 200));
expectedURLBarChange = page0;
let pageLoadPromise = BrowserTestUtils.browserStopped(
tab.linkedBrowser,
page0
);
// Wait until we can go back
await TestUtils.waitForCondition(() => tab.linkedBrowser.canGoBack);
ok(tab.linkedBrowser.canGoBack, "can go back");
// Navigate back from SLOW_PAGE. We should be taken to page 0 now.
tab.linkedBrowser.goBack();
goneBack = true;
is(
gURLBar.untrimmedValue,
SLOW_PAGE,
"Should not have changed URL bar value synchronously."
);
// Wait until page 0 have finished loading.
await pageLoadPromise;
is(
gURLBar.untrimmedValue,
page0,
"Should not have changed URL bar value synchronously."
);
ok(
sawChange,
"The URL bar change handler should have been called by the time the page was loaded"
);
obs.disconnect();
obs = null;
BrowserTestUtils.removeTab(tab);
});
/**
* 1) Try to load page 1 and wait for it to finish loading.
* 2) Start loading SLOW_PAGE (it won't finish loading)
* 3) Reload the page. We should have loaded page 1 now.
*/
add_task(async function testCorrectUrlBarAfterReloadingDuringSlowPageLoad() {
// Load page 1 - example.com
let page1 = "http://example.com/";
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
page1,
true,
true
);
let initialValue = gURLBar.untrimmedValue;
let expectedURLBarChange = SLOW_PAGE;
let sawChange = false;
let hasReloaded = false;
let handler = () => {
if (!hasReloaded) {
isnot(
gURLBar.untrimmedValue,
initialValue,
"Should not revert URL bar value!"
);
}
if (gURLBar.getAttribute("pageproxystate") == "valid") {
sawChange = true;
is(
gURLBar.untrimmedValue,
expectedURLBarChange,
"Should set expected URL bar value!"
);
}
};
let obs = new MutationObserver(handler);
obs.observe(gURLBar.textbox, { attributes: true });
// Start loading SLOW_PAGE
gURLBar.value = SLOW_PAGE;
gURLBar.handleCommand();
// Copied from the first test: If this ever starts going intermittent,
// we've broken this.
await new Promise(resolve => setTimeout(resolve, 200));
expectedURLBarChange = page1;
let pageLoadPromise = BrowserTestUtils.browserLoaded(
tab.linkedBrowser,
false,
page1
);
// Reload the page
tab.linkedBrowser.reload();
hasReloaded = true;
is(
gURLBar.untrimmedValue,
SLOW_PAGE,
"Should not have changed URL bar value synchronously."
);
// Wait for page1 to be loaded due to a reload while the slow page was still loading
await pageLoadPromise;
ok(
sawChange,
"The URL bar change handler should have been called by the time the page was loaded"
);
obs.disconnect();
obs = null;
BrowserTestUtils.removeTab(tab);
});
/**
* 1) Try to load example.com and wait for it to finish loading.
* 2) Start loading SLOW_PAGE and then stop the load before the load completes
* 3) Check that example.com has been loaded as a result of stopping SLOW_PAGE
* load.
*/
add_task(async function testCorrectUrlBarAfterStoppingTheLoad() {
// Load page 1
let page1 = "http://example.com/";
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
page1,
true,
true
);
let initialValue = gURLBar.untrimmedValue;
let expectedURLBarChange = SLOW_PAGE;
let sawChange = false;
let hasStopped = false;
let handler = () => {
if (!hasStopped) {
isnot(
gURLBar.untrimmedValue,
initialValue,
"Should not revert URL bar value!"
);
}
if (gURLBar.getAttribute("pageproxystate") == "valid") {
sawChange = true;
is(
gURLBar.untrimmedValue,
expectedURLBarChange,
"Should set expected URL bar value!"
);
}
};
let obs = new MutationObserver(handler);
obs.observe(gURLBar.textbox, { attributes: true });
// Start loading SLOW_PAGE
gURLBar.value = SLOW_PAGE;
gURLBar.handleCommand();
// Copied from the first test case:
// If this ever starts going intermittent, we've broken this.
await new Promise(resolve => setTimeout(resolve, 200));
// We expect page 1 to be loaded after the SLOW_PAGE load is stopped.
expectedURLBarChange = page1;
let pageLoadPromise = BrowserTestUtils.browserStopped(
tab.linkedBrowser,
SLOW_PAGE,
true
);
// Stop the SLOW_PAGE load
tab.linkedBrowser.stop();
hasStopped = true;
is(
gURLBar.untrimmedValue,
SLOW_PAGE,
"Should not have changed URL bar value synchronously."
);
// Wait for SLOW_PAGE load to stop
await pageLoadPromise;
ok(
sawChange,
"The URL bar change handler should have been called by the time the page was loaded"
);
obs.disconnect();
obs = null;
BrowserTestUtils.removeTab(tab);
});

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

@ -407,7 +407,6 @@ const ErrorCodes = {
NS_ERROR_SAVE_LINK_AS_TIMEOUT: 0x805d0020,
NS_ERROR_PARSED_DATA_CACHED: 0x805d0021,
NS_REFRESHURI_HEADER_FOUND: 0x5d0002,
NS_BINDING_CANCELLED_OLD_LOAD: 0x805d0027,
NS_ERROR_CONTENT_BLOCKED: 0x805e0006,
NS_ERROR_CONTENT_BLOCKED_SHOW_ALT: 0x805e0007,
NS_PROPTABLE_PROP_NOT_THERE: 0x805e000a,

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

@ -3182,11 +3182,6 @@ auto BrowsingContext::CanSet(FieldIndex<IDX_CurrentInnerWindowId>,
return CanSetResult::Allow;
}
bool BrowsingContext::CanSet(FieldIndex<IDX_ParentInitiatedNavigationEpoch>,
const uint64_t& aValue, ContentParent* aSource) {
return XRE_IsParentProcess() && !aSource;
}
void BrowsingContext::DidSet(FieldIndex<IDX_CurrentInnerWindowId>) {
RefPtr<WindowContext> prevWindowContext = mCurrentWindowContext.forget();
mCurrentWindowContext = WindowContext::GetById(GetCurrentInnerWindowId());

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

@ -221,11 +221,7 @@ enum class ExplicitActiveStatus : uint8_t {
/* The count of request that are used to prevent the browsing context tree \
* from being suspended, which would ONLY be modified on the top level \
* context in the chrome process because that's a non-atomic counter */ \
FIELD(PageAwakeRequestCount, uint32_t) \
/* This field only gets incrememented when we start navigations in the \
* parent process. This is used for keeping track of the racing navigations \
* between the parent and content processes. */ \
FIELD(ParentInitiatedNavigationEpoch, uint64_t)
FIELD(PageAwakeRequestCount, uint32_t)
// BrowsingContext, in this context, is the cross process replicated
// environment in which information about documents is stored. In
@ -1055,9 +1051,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
void DidSet(FieldIndex<IDX_CurrentInnerWindowId>);
bool CanSet(FieldIndex<IDX_ParentInitiatedNavigationEpoch>,
const uint64_t& aValue, ContentParent* aSource);
bool CanSet(FieldIndex<IDX_IsPopupSpam>, const bool& aValue,
ContentParent* aSource);

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

@ -70,9 +70,6 @@ static mozilla::LazyLogModule sPBContext("PBContext");
// Global count of canonical browsing contexts with the private attribute set
static uint32_t gNumberOfPrivateContexts = 0;
// Current parent process epoch for parent initiated navigations
static uint64_t gParentInitiatedNavigationEpoch = 0;
static void IncreasePrivateCount() {
gNumberOfPrivateContexts++;
MOZ_LOG(sPBContext, mozilla::LogLevel::Debug,
@ -1139,10 +1136,6 @@ void CanonicalBrowsingContext::CanonicalDiscard() {
mTabMediaController = nullptr;
}
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
}
if (mWebProgress) {
RefPtr<BrowsingContextWebProgress> progress = mWebProgress;
progress->ContextDiscarded();
@ -1298,7 +1291,7 @@ void CanonicalBrowsingContext::GoBack(
// Stop any known network loads if necessary.
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
}
if (nsDocShell* docShell = nsDocShell::Cast(GetDocShell())) {
@ -1324,7 +1317,7 @@ void CanonicalBrowsingContext::GoForward(
// Stop any known network loads if necessary.
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
}
if (auto* docShell = nsDocShell::Cast(GetDocShell())) {
@ -1350,7 +1343,7 @@ void CanonicalBrowsingContext::GoToIndex(
// Stop any known network loads if necessary.
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
}
if (auto* docShell = nsDocShell::Cast(GetDocShell())) {
@ -1374,7 +1367,7 @@ void CanonicalBrowsingContext::Reload(uint32_t aReloadFlags) {
// Stop any known network loads if necessary.
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
}
if (auto* docShell = nsDocShell::Cast(GetDocShell())) {
@ -2038,8 +2031,7 @@ bool CanonicalBrowsingContext::LoadInParent(nsDocShellLoadState* aLoadState,
// We currently only support starting loads directly from the
// CanonicalBrowsingContext for top-level BCs.
if (!IsTopContent() || !GetContentParent() ||
!StaticPrefs::browser_tabs_documentchannel_parent_controlled() ||
!mozilla::SessionHistoryInParent()) {
!StaticPrefs::browser_tabs_documentchannel_parent_controlled()) {
return false;
}
@ -2048,10 +2040,6 @@ bool CanonicalBrowsingContext::LoadInParent(nsDocShellLoadState* aLoadState,
return false;
}
MOZ_ASSERT(!net::SchemeIsJavascript(aLoadState->URI()));
MOZ_ALWAYS_SUCCEEDS(
SetParentInitiatedNavigationEpoch(++gParentInitiatedNavigationEpoch));
// Note: If successful, this will recurse into StartDocumentLoad and
// set mCurrentLoad to the DocumentLoadListener instance created.
// Ideally in the future we will only start loads from here, and we can
@ -2067,8 +2055,7 @@ bool CanonicalBrowsingContext::AttemptSpeculativeLoadInParent(
// We currently only support starting loads directly from the
// CanonicalBrowsingContext for top-level BCs.
if (!IsTopContent() || !GetContentParent() ||
(StaticPrefs::browser_tabs_documentchannel_parent_controlled() &&
mozilla::SessionHistoryInParent())) {
StaticPrefs::browser_tabs_documentchannel_parent_controlled()) {
return false;
}
@ -2088,14 +2075,8 @@ bool CanonicalBrowsingContext::StartDocumentLoad(
// If we're controlling loads from the parent, then starting a new load means
// that we need to cancel any existing ones.
if (StaticPrefs::browser_tabs_documentchannel_parent_controlled() &&
mozilla::SessionHistoryInParent() && mCurrentLoad) {
// Make sure we are not loading a javascript URI.
MOZ_ASSERT(!aLoad->IsLoadingJSURI());
// If we want to do a download, don't cancel the current navigation.
if (!aLoad->IsDownload()) {
mCurrentLoad->Cancel(NS_BINDING_CANCELLED_OLD_LOAD);
}
mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
}
mCurrentLoad = aLoad;

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

@ -142,8 +142,6 @@ add_task(async function test_navigation() {
// Navigate from remote to non-remote
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TEST_PAGE);
// Wait for the non-blank page to finish loading
await BrowserTestUtils.browserStopped(gBrowser, TEST_PAGE);
testURI = "about:mozilla";
permanentKey = gBrowser.selectedBrowser.permanentKey;
await waitForLoad(testURI);

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

@ -250,6 +250,3 @@ XPC_MSG_DEF(NS_ERROR_SOCIALTRACKING_URI , "The URI is social track
/* Profile manager error codes */
XPC_MSG_DEF(NS_ERROR_DATABASE_CHANGED , "Flushing the profiles to disk would have overwritten changes made elsewhere.")
/* Codes related to URILoader */
XPC_MSG_DEF(NS_BINDING_CANCELLED_OLD_LOAD , "The async request has been cancelled by another async request")

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

@ -1341,7 +1341,7 @@
# from parent-process BrowsingContexts
- name: browser.tabs.documentchannel.parent-controlled
type: bool
value: true
value: false
mirror: always
# Testing-only pref which makes data: URIs be loaded in a "web" content process

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

@ -113,8 +113,6 @@ DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) {
args.cacheKey() = mCacheKey;
args.channelId() = mChannelId;
args.asyncOpenTime() = TimeStamp::Now();
args.parentInitiatedNavigationEpoch() =
loadingContext->GetParentInitiatedNavigationEpoch();
Maybe<IPCClientInfo> ipcClientInfo;
if (mInitialClientInfo.isSome()) {

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

@ -35,11 +35,6 @@ bool DocumentChannelParent::Init(dom::CanonicalBrowsingContext* aContext,
new nsDocShellLoadState(aArgs.loadState());
LOG(("DocumentChannelParent Init [this=%p, uri=%s]", this,
loadState->URI()->GetSpecOrDefault().get()));
if (aArgs.parentInitiatedNavigationEpoch() <
aContext->GetParentInitiatedNavigationEpoch()) {
nsresult rv = NS_BINDING_ABORTED;
return SendFailedAsyncOpen(rv);
}
ContentParent* contentParent =
static_cast<ContentParent*>(Manager()->Manager());

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

@ -532,9 +532,6 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
loadingContext->GetOriginAttributes(attrs);
mLoadIdentifier = aLoadState->GetLoadIdentifier();
// See description of mFileName in nsDocShellLoadState.h
mIsDownload = !aLoadState->FileName().IsVoid();
mIsLoadingJSURI = net::SchemeIsJavascript(aLoadState->URI());
// Check for infinite recursive object or iframe loads
if (aLoadState->OriginalFrameSrc() || !mIsDocumentLoad) {
@ -762,22 +759,6 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
"mismatched parent window context?");
}
// For content-initiated loads, this flag is set in nsDocShell::LoadURI.
// For parent-initiated loads, we have to set it here.
// Below comment is copied from nsDocShell::LoadURI -
// If we have a system triggering principal, we can assume that this load was
// triggered by some UI in the browser chrome, such as the URL bar or
// bookmark bar. This should count as a user interaction for the current sh
// entry, so that the user may navigate back to the current entry, from the
// entry that is going to be added as part of this load.
if (!mSupportsRedirectToRealChannel && aLoadState->TriggeringPrincipal() &&
aLoadState->TriggeringPrincipal()->IsSystemPrincipal()) {
WindowContext* topWc = loadingContext->GetTopWindowContext();
if (topWc && !topWc->IsDiscarded()) {
MOZ_ALWAYS_SUCCEEDS(topWc->SetSHEntryHasUserInteraction(true));
}
}
*aRv = NS_OK;
mOpenPromise = new OpenPromise::Private(__func__);
// We make the promise use direct task dispatch in order to reduce the number
@ -2253,6 +2234,10 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
DisconnectListeners(NS_BINDING_ABORTED, NS_BINDING_ABORTED, true);
// XXX(anny) This is currently a dead code path because parent-controlled
// DC pref is off. When we enable the pref, we might get extra STATE_START
// progress events
// Notify the docshell that it should load using the newly connected
// channel
browserParent->ResumeLoad(mLoadIdentifier);

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

@ -282,8 +282,6 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
uint64_t GetLoadIdentifier() const { return mLoadIdentifier; }
uint32_t GetLoadType() const { return mLoadStateLoadType; }
bool IsDownload() const { return mIsDownload; }
bool IsLoadingJSURI() const { return mIsLoadingJSURI; }
mozilla::dom::LoadingSessionHistoryInfo* GetLoadingSessionHistoryInfo() {
return mLoadingSessionHistoryInfo.get();
@ -540,12 +538,6 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
uint32_t mLoadStateInternalLoadFlags = 0;
uint32_t mLoadStateLoadType = 0;
// Indicates if this load is a download.
bool mIsDownload = false;
// Indicates if we are loading a javascript URI.
bool mIsLoadingJSURI = false;
// Corresponding redirect channel registrar Id for the final channel that
// we want to use when redirecting the child, or doing a process switch.
// 0 means redirection is not started.
@ -576,7 +568,6 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
Maybe<nsCString> mOriginalUriString;
// Parent-initiated loads do not support redirects to real channels.
bool mSupportsRedirectToRealChannel = true;
Maybe<nsCString> mRemoteTypeOverride;

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

@ -440,7 +440,6 @@ struct DocumentChannelCreationArgs {
nsDOMNavigationTiming? timing;
IPCClientInfo? initialClientInfo;
DocumentChannelElementCreationArgs elementCreationArgs;
uint64_t parentInitiatedNavigationEpoch;
};
struct RedirectToRealChannelArgs {

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

@ -476,9 +476,7 @@ add_task(async function test_contentscripts_register_js() {
let completePromise = new Promise(resolve => {
extension.onMessage("script-run-complete", () => {
completeCount++;
if (completeCount == 2) {
resolve();
}
resolve();
});
});

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

@ -147,12 +147,10 @@ add_task(async function test_check_open_with_internal_handler() {
await publicList.removeFinished();
});
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + file,
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + file
);
// Add an extra tab after the loading tab so we can test that
// pdf.js is opened in the adjacent tab and not at the end of
// the tab strip.
@ -344,12 +342,10 @@ add_task(async function test_check_open_with_external_application() {
await publicList.removeFinished();
});
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + file,
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + file
);
let dialogWindow = await dialogWindowPromise;
is(
dialogWindow.location.href,
@ -448,12 +444,10 @@ add_task(async function test_check_open_with_external_then_internal() {
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
// Open a new tab to the PDF file which will trigger the Unknown Content Type dialog
// and choose to open the PDF with an external application.
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + file,
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + file
);
let dialogWindow = await dialogWindowPromise;
is(
dialogWindow.location.href,
@ -507,12 +501,10 @@ add_task(async function test_check_open_with_external_then_internal() {
// and choose to open the PDF internally. The previously used external application should be shown as
// the external option.
dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
loadingTab = await BrowserTestUtils.openNewForegroundTab({
loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + file,
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + file
);
dialogWindow = await dialogWindowPromise;
is(
dialogWindow.location.href,
@ -592,12 +584,10 @@ add_task(
["file_xml_attachment_test.xml", true],
]) {
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + file,
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + file
);
let dialogWindow = await dialogWindowPromise;
is(
dialogWindow.location.href,
@ -645,12 +635,10 @@ add_task(async function test_internal_handler_hidden_with_other_type() {
});
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "file_txt_attachment_test.txt",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "file_txt_attachment_test.txt"
);
let dialogWindow = await dialogWindowPromise;
is(
dialogWindow.location.href,
@ -701,12 +689,10 @@ add_task(async function test_internal_handler_hidden_with_pdf_pref_disabled() {
"file_pdf_binary_octet_stream.pdf",
]) {
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + file,
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + file
);
let dialogWindow = await dialogWindowPromise;
is(
dialogWindow.location.href,
@ -745,12 +731,10 @@ add_task(
set: [["browser.helperApps.showOpenOptionForViewableInternally", false]],
});
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "file_xml_attachment_test.xml",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "file_xml_attachment_test.xml"
);
let dialogWindow = await dialogWindowPromise;
is(
dialogWindow.location.href,

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

@ -24,12 +24,10 @@ add_task(async function skipDialogAndDownloadFile() {
let initialTabsCount = gBrowser.tabs.length;
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "file_image_svgxml.svg",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "file_image_svgxml.svg"
);
// We just open the file to be downloaded... and wait for it to be downloaded!
// We see no dialogs to be accepted in the process.

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

@ -88,7 +88,7 @@ add_task(async function check_download_spam_permissions() {
});
let download = await downloadFinishedPromise;
await TestUtils.waitForCondition(
TestUtils.waitForCondition(
() => gBrowser.tabs.length == INITIAL_TABS_COUNT + 1
);
is(
@ -109,8 +109,7 @@ add_task(async function check_download_spam_permissions() {
"An other file should be blocked"
);
info("Will wait for blockedDownloadsCount to be >= 99");
await TestUtils.waitForCondition(() => blockedDownloadsCount >= 99);
TestUtils.waitForCondition(() => blockedDownloadsCount >= 99);
is(blockedDownloadsCount, 99, "Browser should block 99 downloads");
is(
blockedDownloadsURI,

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

@ -167,12 +167,10 @@ add_task(async function test_broken_saved_handlerinfo_and_useless_mimetypes() {
handlerSvc.store(bogusType);
let tabToClean = null;
let task = function() {
return BrowserTestUtils.openNewForegroundTab({
return BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "file_as.exe?foo=bar",
waitForLoad: false,
waitForStateStop: true,
}).then(tab => {
TEST_PATH + "file_as.exe?foo=bar"
).then(tab => {
return (tabToClean = tab);
});
};

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

@ -33,12 +33,10 @@ async function aDownloadLaunchedWithAppIsSavedInFolder(downloadDir) {
let downloadFinishedPromise = promiseDownloadFinished(publicList);
let initialTabsCount = gBrowser.tabs.length;
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "file_image_svgxml.svg",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "file_image_svgxml.svg"
);
let download = await downloadFinishedPromise;
await BrowserTestUtils.waitForCondition(

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

@ -172,12 +172,10 @@ add_task(async function test_check_saving_handler_choices() {
ensureMIMEState(testCase.preDialogState);
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + file,
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + file
);
let dialogWindow = await dialogWindowPromise;
is(
dialogWindow.location.href,
@ -389,12 +387,10 @@ add_task(
info("Load window and tabs");
let dialogWindowPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + file,
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + file
);
// See if UCT window appears in loaded tab.
let dialogWindow = await Promise.race([

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

@ -51,12 +51,10 @@ add_task(async function aDownloadLaunchedWithAppPromptsForFolder() {
};
});
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "file_txt_attachment_test.txt",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "file_txt_attachment_test.txt"
);
await filePickerShown;
@ -70,12 +68,10 @@ add_task(async function testFilesHandledInternally() {
ensureMIMEState({ preferredAction: handleInternally });
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "file_image_svgxml.svg",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "file_image_svgxml.svg"
);
await TestUtils.waitForCondition(() => {
return (
@ -110,12 +106,10 @@ add_task(async function testFilesHandledBySystemDefaultApp() {
};
});
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "file_pdf_application_pdf.pdf",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "file_pdf_application_pdf.pdf"
);
await launchFileCalled;
@ -176,12 +170,10 @@ add_task(async function testFilesHandledByHelperApp() {
};
});
let loadingTab = await BrowserTestUtils.openNewForegroundTab({
let loadingTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
opening: TEST_PATH + "file_pdf_application_pdf.pdf",
waitForLoad: false,
waitForStateStop: true,
});
TEST_PATH + "file_pdf_application_pdf.pdf"
);
await downloadFinishedPromise;
await launchFileCalled;

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

@ -939,11 +939,6 @@ with modules["URILOADER"]:
# successfully setup.
errors["NS_REFRESHURI_HEADER_FOUND"] = SUCCESS(2)
# When browser.tabs.documentchannel.parent-controlled pref and SHIP
# are enabled and a load gets cancelled due to another one
# starting, the error is NS_BINDING_CANCELLED_OLD_LOAD.
errors["NS_BINDING_CANCELLED_OLD_LOAD"] = FAILURE(39)
# =======================================================================
# 25: NS_ERROR_MODULE_CONTENT