Backed out 2 changesets (bug 1718755) for causing build bustages. CLOSED TREE DONTBUILD

Backed out changeset eae7bcfd58c9 (bug 1718755)
Backed out changeset 6ad9e60bc38e (bug 1718755)
This commit is contained in:
Sandor Molnar 2021-07-08 12:55:09 +03:00
parent 2cdef2f45e
commit 320d01b1d8
15 changed files with 77 additions and 128 deletions

View File

@ -127,7 +127,9 @@ add_task(async function test_about_newtab() {
await SpecialPowers.pushPrefEnv({
set: [
[
"browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar",
[
"browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar",
],
false,
],
],

View File

@ -16,8 +16,7 @@
</div>
<pre id="test">
<script type="application/javascript">
SpecialPowers.pushPrefEnv({"set": [["canvas.hitregions.enabled", true]]}).then(async function() {
await SpecialPowers.promiseTimeout(0);
SpecialPowers.pushPrefEnv({"set": [["canvas.hitregions.enabled", true]]}).then(function() {
var input = document.getElementById("input");
var regionId = "";

View File

@ -35,7 +35,7 @@ SpecialPowers.pushPrefEnv({"set": [
['full-screen-api.allow-trusted-requests-only', false],
['full-screen-api.transition-duration.enter', '0 0'],
['full-screen-api.transition-duration.leave', '0 0']
]}).then(setup);
]}, setup);
function setup() {
newwindow = window.browsingContext.topChromeWindow.openDialog(

View File

@ -34,9 +34,7 @@ window.onload = function() {
myLoadTime = performance.now();
}
SpecialPowers.pushPrefEnv({"set":[["dom.background_loading_iframe", true]]}).then(async function () {
await SpecialPowers.promiseTimeout(0);
SpecialPowers.pushPrefEnv({"set":[["dom.background_loading_iframe", true]]}).then(function () {
var iframe1 = document.createElement("iframe");
var iframe2 = document.createElement("iframe");
var iframe3 = document.createElement("iframe");

View File

@ -17,7 +17,7 @@ SimpleTest.waitForExplicitFinish();
// Force off out-of-process mozbrowser because we need to grab its
// |window| synchronously from here. Out-of-process docshell creation
// for mozbrowser haves entirely differently.
SpecialPowers.pushPrefEnv({"set":[["dom.ipc.tabs.disabled", true]]}).then(startTest);
SpecialPowers.pushPrefEnv({"set":[["dom.ipc.tabs.disabled", true]]}, startTest);
function startTest() {
var otherWindow = window.browsingContext.topChromeWindow.open("window_bug757137.xhtml", "", "chrome");

View File

@ -14,7 +14,6 @@ add_task(async function test_browser_hang() {
await SpecialPowers.pushPrefEnv({
set: [["dom.max_chrome_script_run_time", 2]]
});
await SpecialPowers.promiseTimeout(0);
// Hang for 1.2 seconds.
let now = Date.now();

View File

@ -586,34 +586,18 @@ void nsPresContext::PreferenceChanged(const char* aPrefName) {
}
}
struct WeakRunnableMethod : Runnable {
using Method = void (nsPresContext::*)();
WeakRunnableMethod(const char* aName, nsPresContext* aPc, Method aMethod)
: Runnable(aName), mPresContext(aPc), mMethod(aMethod) {}
nsresult Run() override {
if (nsPresContext* pc = mPresContext.get()) {
(pc->*mMethod)();
}
return NS_OK;
}
private:
WeakPtr<nsPresContext> mPresContext;
Method mMethod;
};
void nsPresContext::DispatchPrefChangedRunnableIfNeeded() {
if (mPostedPrefChangedRunnable) {
return;
}
nsCOMPtr<nsIRunnable> runnable = new WeakRunnableMethod(
"nsPresContext::UpdateAfterPreferencesChanged", this,
&nsPresContext::UpdateAfterPreferencesChanged);
RefreshDriver()->AddEarlyRunner(runnable);
mPostedPrefChangedRunnable = true;
nsCOMPtr<nsIRunnable> runnable =
NewRunnableMethod("nsPresContext::UpdateAfterPreferencesChanged", this,
&nsPresContext::UpdateAfterPreferencesChanged);
nsresult rv = Document()->Dispatch(TaskCategory::Other, runnable.forget());
if (NS_SUCCEEDED(rv)) {
mPostedPrefChangedRunnable = true;
}
}
void nsPresContext::UpdateAfterPreferencesChanged() {
@ -1377,10 +1361,12 @@ void nsPresContext::ThemeChanged(widget::ThemeChangeKind aKind) {
sThemeChanged = true;
nsCOMPtr<nsIRunnable> ev =
new WeakRunnableMethod("nsPresContext::ThemeChangedInternal", this,
&nsPresContext::ThemeChangedInternal);
RefreshDriver()->AddEarlyRunner(ev);
mPendingThemeChanged = true;
NewRunnableMethod("nsPresContext::ThemeChangedInternal", this,
&nsPresContext::ThemeChangedInternal);
nsresult rv = Document()->Dispatch(TaskCategory::Other, ev.forget());
if (NS_SUCCEEDED(rv)) {
mPendingThemeChanged = true;
}
}
}

View File

@ -2889,8 +2889,6 @@ void nsRefreshDriver::Disconnect() {
StopTimer();
mEarlyRunners.Clear();
if (mPresContext) {
mPresContext = nullptr;
if (--sRefreshDriverCount == 0) {

View File

@ -64,7 +64,14 @@ var cs9 = getComputedStyle(document.getElementById("nine"), "");
var cs10 = getComputedStyle(document.getElementById("ten"), "");
function pushPrefEnvAndWait(args, cb) {
SpecialPowers.pushPrefEnv(args).then(cb)
SpecialPowers.pushPrefEnv(args, _ => {
// The nsPresContext delays applying a preference change until after a 0ms
// nsITimer fires. The SpecialPowers.pushPrefEnv() uses setTimeout(f, 0)
// which may execute as a simple runnable dispatch and fire before the
// 0ms nsITimer. Therefore wait an additional 1ms to allow the nsPresContext
// to apply the preferences.
setTimeout(cb, 1);
});
}
pushPrefEnvAndWait({'set': [['browser.display.document_color_use', 1]]}, part1);

View File

@ -893,46 +893,18 @@ class SpecialPowersChild extends JSWindowActorChild {
}
async pushPrefEnv(inPrefs, callback = null) {
let { requiresRefresh } = await this.sendQuery("PushPrefEnv", inPrefs);
if (callback) {
await callback();
}
if (requiresRefresh) {
await this._promiseEarlyRefresh();
}
await this.sendQuery("PushPrefEnv", inPrefs).then(callback);
await this.promiseTimeout(0);
}
async popPrefEnv(callback = null) {
let { popped, requiresRefresh } = await this.sendQuery("PopPrefEnv");
if (callback) {
await callback(popped);
}
if (requiresRefresh) {
await this._promiseEarlyRefresh();
}
await this.sendQuery("PopPrefEnv").then(callback);
await this.promiseTimeout(0);
}
async flushPrefEnv(callback = null) {
let { requiresRefresh } = await this.sendQuery("FlushPrefEnv");
if (callback) {
await callback();
}
if (requiresRefresh) {
await this._promiseEarlyRefresh();
}
}
_promiseEarlyRefresh() {
return new Promise(r => {
// for mochitest-browser
if (typeof this.chromeWindow != "undefined") {
this.chromeWindow.requestAnimationFrame(r);
}
// for mochitest-plain
else {
this.contentWindow.requestAnimationFrame(r);
}
});
await this.sendQuery("FlushPrefEnv").then(callback);
await this.promiseTimeout(0);
}
_addObserverProxy(notification) {

View File

@ -402,26 +402,15 @@ class SpecialPowersParent extends JSWindowActorParent {
/*
Iterate through one atomic set of pref actions and perform sets/clears as appropriate.
All actions performed must modify the relevant pref.
Returns whether we need to wait for a refresh driver tick for the pref to
have effect. This is only needed for ui. and font. prefs, which affect the
look and feel code and have some change-coalescing going on.
*/
_applyPrefs(actions) {
let requiresRefresh = false;
for (let pref of actions) {
requiresRefresh =
requiresRefresh ||
pref.name.startsWith("ui.") ||
pref.name.startsWith("browser.display.") ||
pref.name.startsWith("font.");
if (pref.action == "set") {
this._setPref(pref.name, pref.type, pref.value, pref.iid);
} else if (pref.action == "clear") {
Services.prefs.clearUserPref(pref.name);
}
}
return requiresRefresh;
}
/**
@ -503,8 +492,7 @@ class SpecialPowersParent extends JSWindowActorParent {
}
prefUndoStack.push(cleanupActions);
let requiresRefresh = this._applyPrefs(pendingActions);
return { requiresRefresh };
this._applyPrefs(pendingActions);
});
}
@ -512,19 +500,17 @@ class SpecialPowersParent extends JSWindowActorParent {
return doPrefEnvOp(() => {
let env = prefUndoStack.pop();
if (env) {
let requiresRefresh = this._applyPrefs(env);
return { popped: true, requiresRefresh };
this._applyPrefs(env);
return true;
}
return { popped: false, requiresRefresh: false };
return false;
});
}
flushPrefEnv() {
let requiresRefresh = false;
while (prefUndoStack.length) {
requiresRefresh |= this.popPrefEnv().requiresRefresh;
this.popPrefEnv();
}
return { requiresRefresh };
}
_setPref(name, type, value, iid) {

View File

@ -36,7 +36,7 @@
["memory.report_concurrency", 2] // Cover more child handling cases
];
SpecialPowers.pushPrefEnv({"set": prefs}).then(function() {
SpecialPowers.pushPrefEnv({"set": prefs}, function() {
for (let i = 0; i < numRemotes; i++) {
let w = remotes[i] = window.browsingContext.topChromeWindow.open("remote.xhtml", "", "chrome");
@ -54,7 +54,7 @@
mm.loadFrameScript("data:," + encodeURI("sendAsyncMessage('test:ready');"), true);
});
}
});
}, {once: true});
// Load the given file into the frame, then copy+paste the entire frame and
// check that the cut text matches what we expect.

View File

@ -21,7 +21,8 @@
// Create some remote processes, and set up message-passing so that
// we know when each child is fully initialized.
let remotes = [];
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processCount", numRemotes]]}).then(function() {
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processCount", numRemotes]]},
function() {
for (let i = 0; i < numRemotes; i++) {
let w = remotes[i] = window.browsingContext.topChromeWindow.open("remote.xhtml", "", "chrome");

View File

@ -28,7 +28,7 @@
// Create some remote processes, and set up message-passing so that
// we know when each child is fully initialized.
let remotes = [];
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processCount", 3]]}).then(function() {
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.processCount", 3]]}, function() {
for (let i = 0; i < numToOpen; i++) {
let w = remotes[i] = window.browsingContext.topChromeWindow.open("remote.xhtml", "", "chrome");

View File

@ -10,40 +10,41 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set":[["browser.preferences.instantApply", false]]}).then(function() {
SimpleTest.registerCleanupFunction(() => {
SpecialPowers.clearUserPref("tests.beforeaccept.dialogShown");
SpecialPowers.clearUserPref("tests.beforeaccept.called");
});
SpecialPowers.pushPrefEnv({"set":[["browser.preferences.instantApply", false]]}, function() {
// No instant-apply for this test
var prefWindow = window.browsingContext.topChromeWindow.openDialog("window_preferences_beforeaccept.xhtml", "", "", windowOnload);
function windowOnload() {
var dialogShown = prefWindow.Preferences.get("tests.beforeaccept.dialogShown");
var called = prefWindow.Preferences.get("tests.beforeaccept.called");
is(dialogShown.value, true, "dialog opened, shown pref set");
is(dialogShown.valueFromPreferences, null, "shown pref not committed");
is(called.value, null, "beforeaccept not yet called");
is(called.valueFromPreferences, null, "beforeaccept not yet called, pref not committed");
// try to accept the dialog, should fail the first time
prefWindow.document.getElementById("beforeaccept_dialog").acceptDialog();
is(prefWindow.closed, false, "window not closed");
is(dialogShown.value, true, "shown pref still set");
is(dialogShown.valueFromPreferences, null, "shown pref still not committed");
is(called.value, true, "beforeaccept called");
is(called.valueFromPreferences, null, "called pref not committed");
// try again, this one should succeed
prefWindow.document.getElementById("beforeaccept_dialog").acceptDialog();
is(prefWindow.closed, true, "window now closed");
is(dialogShown.valueFromPreferences, true, "shown pref committed");
is(called.valueFromPreferences, true, "called pref committed");
SimpleTest.finish();
}
SimpleTest.registerCleanupFunction(() => {
SpecialPowers.clearUserPref("tests.beforeaccept.dialogShown");
SpecialPowers.clearUserPref("tests.beforeaccept.called");
});
// No instant-apply for this test
var prefWindow = window.browsingContext.topChromeWindow.openDialog("window_preferences_beforeaccept.xhtml", "", "", windowOnload);
function windowOnload() {
var dialogShown = prefWindow.Preferences.get("tests.beforeaccept.dialogShown");
var called = prefWindow.Preferences.get("tests.beforeaccept.called");
is(dialogShown.value, true, "dialog opened, shown pref set");
is(dialogShown.valueFromPreferences, null, "shown pref not committed");
is(called.value, null, "beforeaccept not yet called");
is(called.valueFromPreferences, null, "beforeaccept not yet called, pref not committed");
// try to accept the dialog, should fail the first time
prefWindow.document.getElementById("beforeaccept_dialog").acceptDialog();
is(prefWindow.closed, false, "window not closed");
is(dialogShown.value, true, "shown pref still set");
is(dialogShown.valueFromPreferences, null, "shown pref still not committed");
is(called.value, true, "beforeaccept called");
is(called.valueFromPreferences, null, "called pref not committed");
// try again, this one should succeed
prefWindow.document.getElementById("beforeaccept_dialog").acceptDialog();
is(prefWindow.closed, true, "window now closed");
is(dialogShown.valueFromPreferences, true, "shown pref committed");
is(called.valueFromPreferences, true, "called pref committed");
SimpleTest.finish();
}
});
]]>
</script>