Backed out 11 changesets (bug 1721217) for bc failures on browser_scrollPositions.js . CLOSED TREE

Backed out changeset 750f4a84b30e (bug 1721217)
Backed out changeset c4eb4ad769ad (bug 1721217)
Backed out changeset 81af11d67439 (bug 1721217)
Backed out changeset 548f2441b7c6 (bug 1721217)
Backed out changeset cd584129321a (bug 1721217)
Backed out changeset f5f5291d1da8 (bug 1721217)
Backed out changeset 9ad66ceec1e2 (bug 1721217)
Backed out changeset 10b53a21bb23 (bug 1721217)
Backed out changeset 3755cfbe22fe (bug 1721217)
Backed out changeset 71436dc6c4c4 (bug 1721217)
Backed out changeset ecf33b73ae60 (bug 1721217)
This commit is contained in:
Narcis Beleuzu 2021-11-26 01:51:03 +02:00
parent 45c048320a
commit a322582a00
30 changed files with 150 additions and 655 deletions

View File

@ -6403,24 +6403,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) {

View File

@ -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(

View File

@ -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.");
});
});

View File

@ -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]

View File

@ -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);
});
});

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);
});

View File

@ -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,

View File

@ -3173,11 +3173,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());

View File

@ -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);

View File

@ -69,9 +69,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,
@ -1138,10 +1135,6 @@ void CanonicalBrowsingContext::CanonicalDiscard() {
mTabMediaController = nullptr;
}
if (mCurrentLoad) {
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
}
if (mWebProgress) {
RefPtr<BrowsingContextWebProgress> progress = mWebProgress;
progress->ContextDiscarded();
@ -1297,7 +1290,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())) {
@ -1323,7 +1316,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())) {
@ -1349,7 +1342,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())) {
@ -1373,7 +1366,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())) {
@ -2037,8 +2030,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;
}
@ -2047,10 +2039,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
@ -2066,8 +2054,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;
}
@ -2087,14 +2074,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;

View File

@ -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);

View File

@ -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")

View File

@ -1335,7 +1335,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

View File

@ -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()) {

View File

@ -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());

View File

@ -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);

View File

@ -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;

View File

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

View File

@ -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();
});
});

View File

@ -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,

View File

@ -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.

View File

@ -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,

View File

@ -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);
});
};

View File

@ -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(

View File

@ -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([

View File

@ -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;

View File

@ -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