Backed out changeset dca68a64b04c (bug 1668586) for test_ext_tabs failures CLOSED TREE

This commit is contained in:
Bogdan Tara 2020-10-06 13:48:35 +03:00
Родитель 8391350978
Коммит ca5eff3e26
3 изменённых файлов: 25 добавлений и 40 удалений

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

@ -118,7 +118,6 @@ skip-if = os == "linux" && bits == 64 && os_version = "18.04" # Bug 1614739
[browser_isSynthetic.js]
[browser_keyevents_during_autoscrolling.js]
[browser_label_textlink.js]
[browser_remoteness_change_listeners.js]
[browser_suspend_videos_outside_viewport.js]
support-files =
file_outside_viewport_videos.html

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

@ -1,39 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Check that adding progress listeners to a browser doesn't break things
* when switching the remoteness of that browser.
*/
add_task(async function test_remoteness_switch_listeners() {
await BrowserTestUtils.withNewTab("about:support", async function(browser) {
let wpl;
let navigated = new Promise(resolve => {
wpl = {
onLocationChange() {
is(browser.currentURI.spec, "https://example.com/");
if (browser.currentURI?.spec == "https://example.com/") {
resolve();
}
},
QueryInterface: ChromeUtils.generateQI([
Ci.nsISupportsWeakReference,
Ci.nsIWebProgressListener2,
Ci.nsIWebProgressListener,
]),
};
browser.addProgressListener(wpl);
});
let loaded = BrowserTestUtils.browserLoaded(
browser,
null,
"https://example.com/"
);
BrowserTestUtils.loadURI(browser, "https://example.com/");
await Promise.all([loaded, navigated]);
browser.removeProgressListener(wpl);
});
});

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

@ -920,6 +920,22 @@
);
}
/**
* Move the previously-tracked web progress listeners to this <browser>'s
* current WebProgress.
*/
restoreProgressListeners() {
let listeners = this.progressListeners;
this.progressListeners = [];
for (let { weakListener, mask } of listeners) {
let listener = weakListener.get();
if (listener) {
this.addProgressListener(listener, mask);
}
}
}
onPageHide(aEvent) {
if (!this.docShell || !this.fastFind) {
return;
@ -1034,6 +1050,7 @@
* the <browser> element may not be initialized yet.
*/
let oldNavigation = this._remoteWebNavigation;
this._remoteWebNavigation = new LazyModules.RemoteWebNavigation(this);
// Initialize contentPrincipal to the about:blank principal for this loadcontext
@ -1047,6 +1064,13 @@
// we should re-evaluate the CSP here.
this._csp = null;
if (!oldNavigation) {
// If we weren't remote, then we're transitioning from local to
// remote. Add all listeners from the previous <browser> to the new
// RemoteWebProgress.
this.restoreProgressListeners();
}
this.messageManager.loadFrameScript(
"chrome://global/content/browser-child.js",
true
@ -1095,6 +1119,7 @@
if (!this.isRemoteBrowser) {
this._remoteWebNavigation = null;
this.restoreProgressListeners();
this.addEventListener("pagehide", this.onPageHide, true);
}
}