mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1318273 - Improve the use of SpecialPowers.pushPrefEnv() - part 1, r=qdot
This commit is contained in:
parent
af66848eae
commit
cf2ad8072f
@ -480,11 +480,9 @@ function* test_delayed_tabattr_removal() {
|
||||
}
|
||||
|
||||
add_task(function*() {
|
||||
yield new Promise((resolve) => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.tabs.showAudioPlayingIcon", true],
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.tabs.showAudioPlayingIcon", true],
|
||||
]});
|
||||
});
|
||||
|
||||
requestLongerTimeout(2);
|
||||
|
@ -99,9 +99,9 @@ function waitForSomeTabToLoad() {
|
||||
* Ensure the Mixed Content Blocker is enabled.
|
||||
*/
|
||||
add_task(function* test_initialize() {
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv({
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.mixed_content.block_active_content", true]],
|
||||
}, resolve));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -17,9 +17,9 @@ function waitForInsecureLoginFormsStateChange(browser, count) {
|
||||
* Checks the insecure login forms logic for the identity block.
|
||||
*/
|
||||
add_task(function* test_simple() {
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv({
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.insecure_password.ui.enabled", true]],
|
||||
}, resolve));
|
||||
});
|
||||
|
||||
for (let [origin, expectWarning] of [
|
||||
["http://example.com", true],
|
||||
@ -82,9 +82,9 @@ add_task(function* test_simple() {
|
||||
* blocking messages when mixed active content is loaded.
|
||||
*/
|
||||
add_task(function* test_mixedcontent() {
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv({
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.mixed_content.block_active_content", false]],
|
||||
}, resolve));
|
||||
});
|
||||
|
||||
// Load the page with the subframe in a new tab.
|
||||
let testUrlPath = "://example.com" + TEST_URL_PATH;
|
||||
|
@ -15,14 +15,12 @@ const gHttpTestUrl = "http://example.com/browser/browser/base/content/test/gener
|
||||
var gTestBrowser = null;
|
||||
|
||||
add_task(function *() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["security.mixed_content.block_active_content", true],
|
||||
["security.mixed_content.block_display_content", false]
|
||||
]
|
||||
}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["security.mixed_content.block_active_content", true],
|
||||
["security.mixed_content.block_display_content", false]
|
||||
]});
|
||||
|
||||
let url = gHttpTestUrl
|
||||
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
|
||||
gTestBrowser = gBrowser.selectedBrowser;
|
||||
|
@ -17,13 +17,11 @@ var gTestBrowser = null;
|
||||
add_task(function *() {
|
||||
let url = gHttpTestRoot1 + "file_mixedContentFromOnunload.html";
|
||||
yield BrowserTestUtils.withNewTab({gBrowser, url}, function*() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["security.mixed_content.block_active_content", true],
|
||||
["security.mixed_content.block_display_content", false]
|
||||
]
|
||||
}, resolve);
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["security.mixed_content.block_active_content", true],
|
||||
["security.mixed_content.block_display_content", false]
|
||||
]
|
||||
});
|
||||
gTestBrowser = gBrowser.selectedBrowser;
|
||||
// Navigation from an http page to a https page with no mixed content
|
||||
|
@ -18,10 +18,7 @@ function waitForSecurityChange(numChanges = 1) {
|
||||
}
|
||||
|
||||
add_task(function* test_fetch() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({ set: [['privacy.trackingprotection.enabled', true]] },
|
||||
resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({ set: [['privacy.trackingprotection.enabled', true]] });
|
||||
|
||||
yield BrowserTestUtils.withNewTab({ gBrowser, url: URL }, function* (newTabBrowser) {
|
||||
let securityChange = waitForSecurityChange();
|
||||
|
@ -23,11 +23,9 @@ var with_new_tab_opened = Task.async(function* (options, taskFn) {
|
||||
});
|
||||
|
||||
add_task(function*() {
|
||||
yield new Promise((resolve) => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["view_source.tab", true],
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["view_source.tab", true],
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* test_regular_page() {
|
||||
|
@ -91,8 +91,7 @@ registerCleanupFunction(function() {
|
||||
});
|
||||
|
||||
function pushPrefs(...aPrefs) {
|
||||
return new Promise(resolve =>
|
||||
SpecialPowers.pushPrefEnv({"set": aPrefs}, resolve));
|
||||
return SpecialPowers.pushPrefEnv({"set": aPrefs});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ add_task(function* () {
|
||||
*/
|
||||
add_task(function* () {
|
||||
let input = "To be or not to be-that is the question";
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv({set: [["keyword.enabled", false]]}, resolve));
|
||||
yield SpecialPowers.pushPrefEnv({set: [["keyword.enabled", false]]});
|
||||
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:newtab", false);
|
||||
// NB: CPOW usage because new tab pages can be preloaded, in which case no
|
||||
// load events fire.
|
||||
|
@ -5,7 +5,7 @@
|
||||
* "example" and hit enter, the browser loads and the URL bar is updated accordingly.
|
||||
*/
|
||||
add_task(function* () {
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv({set: [["keyword.enabled", false]]}, resolve));
|
||||
yield SpecialPowers.pushPrefEnv({set: [["keyword.enabled", false]]});
|
||||
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, function* (browser) {
|
||||
gURLBar.value = "example";
|
||||
gURLBar.select();
|
||||
|
@ -6,14 +6,11 @@ const BASE_URI = "http://mochi.test:8888/browser/browser/components/"
|
||||
+ "contextualidentity/test/browser/empty_file.html";
|
||||
|
||||
add_task(function* setup() {
|
||||
yield new Promise((resolve) => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true]
|
||||
]});
|
||||
});
|
||||
|
||||
|
||||
add_task(function* test() {
|
||||
info("Creating a tab with UCI = 1...");
|
||||
let tab1 = gBrowser.addTab(BASE_URI, {userContextId: 1});
|
||||
|
@ -21,11 +21,9 @@ function* openTabInUserContext(uri, userContextId) {
|
||||
|
||||
add_task(function* setup() {
|
||||
// make sure userContext is enabled.
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true]
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* test() {
|
||||
|
@ -85,15 +85,13 @@ function generateKeyInfo(aData) {
|
||||
|
||||
add_task(function* setup() {
|
||||
// Make sure userContext is enabled.
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
[ "privacy.userContext.enabled", true ],
|
||||
[ "media.mediasource.enabled", true ],
|
||||
[ "media.eme.apiVisible", true ],
|
||||
[ "media.mediasource.webm.enabled", true ],
|
||||
[ "media.clearkey.persistent-license.enabled", true ],
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
[ "privacy.userContext.enabled", true ],
|
||||
[ "media.mediasource.enabled", true ],
|
||||
[ "media.eme.apiVisible", true ],
|
||||
[ "media.mediasource.webm.enabled", true ],
|
||||
[ "media.clearkey.persistent-license.enabled", true ],
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* test() {
|
||||
|
@ -77,11 +77,9 @@ function loadFaviconHandler(metadata, response) {
|
||||
|
||||
add_task(function* setup() {
|
||||
// Make sure userContext is enabled.
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true]
|
||||
]});
|
||||
|
||||
// Create a http server for the image cache test.
|
||||
if (!gHttpServer) {
|
||||
|
@ -318,11 +318,9 @@ function* test_storage_cleared() {
|
||||
|
||||
add_task(function* setup() {
|
||||
// Make sure userContext is enabled.
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true]
|
||||
]});
|
||||
|
||||
// Create a http server for the image cache test.
|
||||
if (!gHttpServer) {
|
||||
|
@ -23,12 +23,10 @@ function openTabInUserContext(uri, userContextId) {
|
||||
|
||||
add_task(function* setup() {
|
||||
// make sure userContext is enabled.
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true],
|
||||
["dom.ipc.processCount", 1]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true],
|
||||
["dom.ipc.processCount", 1]
|
||||
]});
|
||||
});
|
||||
|
||||
let infos = [];
|
||||
|
@ -27,12 +27,10 @@ function openTabInUserContext(uri, userContextId) {
|
||||
|
||||
add_task(function* setup() {
|
||||
// make sure userContext is enabled.
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true],
|
||||
["dom.ipc.processCount", 1]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true],
|
||||
["dom.ipc.processCount", 1]
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* test() {
|
||||
|
@ -13,12 +13,10 @@ const BASE_URI = "http://mochi.test:8888/browser/browser/components/"
|
||||
|
||||
add_task(function* setup() {
|
||||
// make sure userContext is enabled.
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true],
|
||||
["browser.link.open_newwindow", 3],
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true],
|
||||
["browser.link.open_newwindow", 3],
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* test() {
|
||||
|
@ -7,12 +7,10 @@ const BASE_URI = "http://mochi.test:8888/browser/browser/components/"
|
||||
+ "contextualidentity/test/browser/empty_file.html";
|
||||
|
||||
add_task(function* setup() {
|
||||
yield new Promise((resolve) => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true],
|
||||
["browser.link.open_newwindow", 2],
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["privacy.userContext.enabled", true],
|
||||
["browser.link.open_newwindow", 2],
|
||||
]});
|
||||
});
|
||||
|
||||
|
||||
|
@ -208,12 +208,10 @@ function* setDownloadDir() {
|
||||
});
|
||||
}
|
||||
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.download.folderList", 2],
|
||||
["browser.download.dir", tmpDir, Ci.nsIFile],
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.download.folderList", 2],
|
||||
["browser.download.dir", tmpDir, Ci.nsIFile],
|
||||
]});
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,11 +15,10 @@ function makeBookmarkFor(url, keyword) {
|
||||
|
||||
add_task(function* openKeywordBookmarkWithWindowOpen() {
|
||||
// This is the current default, but let's not assume that...
|
||||
yield new Promise((resolve, reject) => {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [[ 'browser.link.open_newwindow', 3 ],
|
||||
[ 'dom.disable_open_during_load', true ]] },
|
||||
resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
[ 'browser.link.open_newwindow', 3 ],
|
||||
[ 'dom.disable_open_during_load', true ]
|
||||
]});
|
||||
|
||||
let moztab;
|
||||
let tabOpened = BrowserTestUtils.openNewForegroundTab(gBrowser, "about:mozilla")
|
||||
|
@ -10,7 +10,7 @@ add_task(function* () {
|
||||
var contextMenu;
|
||||
|
||||
// We want select events to be fired.
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv({"set": [["dom.select_events.enabled", true]]}, resolve));
|
||||
yield SpecialPowers.pushPrefEnv({set: [["dom.select_events.enabled", true]]});
|
||||
|
||||
let envService = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
let originalValue = envService.get("XPCSHELL_TEST_PROFILE_DIR");
|
||||
|
@ -544,9 +544,7 @@ function modifySessionStorage(browser, data, options = {}) {
|
||||
}
|
||||
|
||||
function pushPrefs(...aPrefs) {
|
||||
return new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": aPrefs}, resolve);
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": aPrefs});
|
||||
}
|
||||
|
||||
function popPrefs() {
|
||||
|
@ -28,10 +28,7 @@ function promiseReportCallMade(aValue) {
|
||||
}
|
||||
|
||||
function pushPrefs(...aPrefs) {
|
||||
return new Promise((resolve) => {
|
||||
SpecialPowers.pushPrefEnv({"set": aPrefs}, resolve);
|
||||
resolve();
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": aPrefs});
|
||||
}
|
||||
|
||||
function popPrefs() {
|
||||
|
@ -63,7 +63,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=995943
|
||||
}
|
||||
|
||||
function pushPrefs(prefs) {
|
||||
return new Promise(function(resolve) { SpecialPowers.pushPrefEnv({ set: prefs }, resolve); });
|
||||
return SpecialPowers.pushPrefEnv({ set: prefs });
|
||||
}
|
||||
|
||||
function popPrefs() {
|
||||
|
@ -236,11 +236,9 @@ promise_test(function(t) {
|
||||
// This is to test that we don't temporarily clear the flag when forcing
|
||||
// an unthrottled sample.
|
||||
promise_test(function(t) {
|
||||
return new Promise(function(resolve) {
|
||||
// Needs scrollbars to cause overflow.
|
||||
SpecialPowers.pushPrefEnv({ set: [["ui.showHideScrollbars", 1]] },
|
||||
resolve);
|
||||
}).then(function() {
|
||||
// Needs scrollbars to cause overflow.
|
||||
return SpecialPowers.pushPrefEnv({ set: [["ui.showHideScrollbars", 1]] })
|
||||
.then(function() {
|
||||
var div = addDiv(t, { style: 'animation: rotate 100s' });
|
||||
var animation = div.getAnimations()[0];
|
||||
|
||||
|
@ -6,9 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
function waitForSetPref(pref, value) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
SpecialPowers.pushPrefEnv({ 'set': [[pref, value]] }, resolve);
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({ 'set': [[pref, value]] });
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -26,8 +26,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1276553
|
||||
|
||||
/** Test for Bug 1276553 **/
|
||||
function run() {
|
||||
new Promise(resolve => SpecialPowers.pushPrefEnv(
|
||||
{'set' : [[ 'browser.groupedhistory.enabled', true ]]}, resolve))
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{'set' : [[ 'browser.groupedhistory.enabled', true ]]})
|
||||
.then(() => test(false))
|
||||
.then(() => test(true))
|
||||
.then(() => {
|
||||
|
@ -93,12 +93,9 @@ Test swapFrameLoaders with different frame types and remoteness
|
||||
}
|
||||
|
||||
add_task(function*() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.mozBrowserFramesEnabled", true],
|
||||
["network.disable.ipc.security", true]] },
|
||||
resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.mozBrowserFramesEnabled", true],
|
||||
["network.disable.ipc.security", true]] });
|
||||
});
|
||||
|
||||
add_task(function*() {
|
||||
|
@ -1,21 +1,16 @@
|
||||
function specialPowersLock(orientation) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
'set': [ ["dom.screenorientation.testing.non_fullscreen_lock_allow", true] ]
|
||||
}, function() {
|
||||
var p = screen.orientation.lock(orientation);
|
||||
resolve(p);
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({
|
||||
'set': [ ["dom.screenorientation.testing.non_fullscreen_lock_allow", true] ]
|
||||
}).then(function() => {
|
||||
var p = screen.orientation.lock(orientation);
|
||||
});
|
||||
}
|
||||
|
||||
function specialPowersUnlock() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
'set': [ ["dom.screenorientation.testing.non_fullscreen_lock_allow", true] ]
|
||||
}, function() {
|
||||
screen.orientation.unlock();
|
||||
resolve();
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({
|
||||
'set': [ ["dom.screenorientation.testing.non_fullscreen_lock_allow", true] ]
|
||||
}).then(function() {
|
||||
screen.orientation.unlock();
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
@ -61,8 +61,7 @@ const CROSS_ORIGIN = "http://example.com" + SJS_PATH;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
new Promise(resolve =>
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.prefetch-next.aggressive", true]]}, resolve))
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.prefetch-next.aggressive", true]]})
|
||||
|
||||
// test same origin
|
||||
.then(() => testPrefetchEvent(SAME_ORIGIN + "?statusCode=200&cacheControl=no-cache", false, false))
|
||||
|
@ -20,9 +20,7 @@ https://bugzilla.mozilla.org/1281963
|
||||
// Set a pref value asynchronously, returning a promise that resolves
|
||||
// when it succeeds.
|
||||
let setPref = function* (key, value) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
SpecialPowers.pushPrefEnv({"set": [[key, value]]}, resolve);
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": [[key, value]]});
|
||||
};
|
||||
|
||||
// Run a test to see that we don't expose the supported mimeTypes
|
||||
|
@ -11,12 +11,9 @@
|
||||
<body>
|
||||
<script type="application/javascript;version=1.8">
|
||||
add_task(function*() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.mozBrowserFramesEnabled", true],
|
||||
["network.disable.ipc.security", true]] },
|
||||
resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.mozBrowserFramesEnabled", true],
|
||||
["network.disable.ipc.security", true]] });
|
||||
});
|
||||
|
||||
add_task(function*() {
|
||||
|
@ -11,12 +11,9 @@
|
||||
<body>
|
||||
<script type="application/javascript;version=1.8">
|
||||
add_task(function*() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.mozBrowserFramesEnabled", true],
|
||||
["network.disable.ipc.security", true]] },
|
||||
resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.mozBrowserFramesEnabled", true],
|
||||
["network.disable.ipc.security", true]] });
|
||||
});
|
||||
|
||||
add_task(function*() {
|
||||
|
16
dom/cache/test/mochitest/driver.js
vendored
16
dom/cache/test/mochitest/driver.js
vendored
@ -18,16 +18,12 @@
|
||||
|
||||
function runTests(testFile, order) {
|
||||
function setupPrefs() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.caches.enabled", true],
|
||||
["dom.caches.testing.enabled", true],
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
["dom.serviceWorkers.testing.enabled", true],
|
||||
["dom.serviceWorkers.exemptFromPerDomainMax", true]]
|
||||
}, function() {
|
||||
resolve();
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.caches.enabled", true],
|
||||
["dom.caches.testing.enabled", true],
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
["dom.serviceWorkers.testing.enabled", true],
|
||||
["dom.serviceWorkers.exemptFromPerDomainMax", true]]
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
function pushPrefs(...aPrefs) {
|
||||
return new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": aPrefs}, resolve);
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": aPrefs});
|
||||
}
|
||||
|
||||
function promiseWaitForEvent(object, eventName, capturing = false, chrome = false) {
|
||||
|
@ -237,4 +237,4 @@ add_task(test_domainPolicy);
|
||||
|
||||
registerCleanupFunction(()=>{
|
||||
deactivateDomainPolicy();
|
||||
})
|
||||
})
|
||||
|
@ -41,23 +41,17 @@ function check_ogg(v, enabled, finish) {
|
||||
}
|
||||
|
||||
function opus_enable() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
SpecialPowers.pushPrefEnv({"set": [['media.opus.enabled', true]]},
|
||||
function() {
|
||||
check("audio/ogg; codecs=opus", "probably");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": [['media.opus.enabled', true]]})
|
||||
.then(function() {
|
||||
check("audio/ogg; codecs=opus", "probably");
|
||||
});
|
||||
}
|
||||
|
||||
function opus_disable() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
SpecialPowers.pushPrefEnv({"set": [['media.opus.enabled', false]]},
|
||||
function() {
|
||||
check("audio/ogg; codecs=opus", "");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": [['media.opus.enabled', false]]})
|
||||
.then(function() {
|
||||
check("audio/ogg; codecs=opus", "");
|
||||
});
|
||||
}
|
||||
|
||||
function unspported_ogg() {
|
||||
|
@ -13,9 +13,7 @@
|
||||
var manager = new MediaTestManager;
|
||||
|
||||
function SetPrefs(prefs) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
SpecialPowers.pushPrefEnv({"set": prefs}, function() { resolve(); });
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": prefs});
|
||||
}
|
||||
|
||||
function observe() {
|
||||
|
@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=489415
|
||||
<script type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
|
||||
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
|
||||
var throwOutside = e => setTimeout(() => { throw e; });
|
||||
|
||||
// Generate a random key. The first load with that key will return
|
||||
|
@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=489415
|
||||
<script type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
|
||||
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
|
||||
|
||||
var v1 = document.getElementById("v1");
|
||||
var v2 = document.getElementById("v2");
|
||||
|
@ -230,7 +230,7 @@ function createHTML(options) {
|
||||
return scriptsReady.then(() => realCreateHTML(options));
|
||||
}
|
||||
|
||||
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
|
||||
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
|
||||
|
||||
// noGum - Helper to detect whether active guM tracks still exist.
|
||||
//
|
||||
|
@ -1823,11 +1823,9 @@ var setupIceServerConfig = useIceServer => {
|
||||
// We disable ICE support for HTTP proxy when using a TURN server, because
|
||||
// mochitest uses a fake HTTP proxy to serve content, which will eat our STUN
|
||||
// packets for TURN TCP.
|
||||
var enableHttpProxy = enable => new Promise(resolve => {
|
||||
var enableHttpProxy = enable =>
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{'set': [['media.peerconnection.disable_http_proxy', !enable]]},
|
||||
resolve);
|
||||
});
|
||||
{'set': [['media.peerconnection.disable_http_proxy', !enable]]});
|
||||
|
||||
var spawnIceServer = () => new Promise( (resolve, reject) => {
|
||||
iceServerWebsocket = new WebSocket("ws://localhost:8191/");
|
||||
|
@ -25,7 +25,7 @@ function mustFailWith(msg, reason, constraint, f) {
|
||||
});
|
||||
}
|
||||
|
||||
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
|
||||
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
|
||||
|
||||
runTest(() =>
|
||||
pushPrefs(["media.navigator.streams.fake", true])
|
||||
|
@ -11,7 +11,7 @@
|
||||
bug: "1211656"
|
||||
});
|
||||
|
||||
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
|
||||
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
|
||||
|
||||
/**
|
||||
* Run a test to verify that we can complete a start and stop media playback
|
||||
|
@ -37,7 +37,7 @@ function OnDeviceChangeEventNotReceived() {
|
||||
]);
|
||||
}
|
||||
|
||||
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
|
||||
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
|
||||
|
||||
var videoTracks;
|
||||
|
||||
|
@ -105,8 +105,7 @@ runNetworkTest(() => {
|
||||
JSON.stringify(toComparable(config)), "getConfiguration");
|
||||
pc.close();
|
||||
|
||||
var push = prefs => new Promise(resolve =>
|
||||
SpecialPowers.pushPrefEnv(prefs, resolve));
|
||||
var push = prefs => SpecialPowers.pushPrefEnv(prefs);
|
||||
|
||||
Promise.resolve()
|
||||
// This set of tests are setting the about:config User preferences for default
|
||||
|
@ -66,7 +66,7 @@ runNetworkTest(() => {
|
||||
}
|
||||
]);
|
||||
|
||||
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
|
||||
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
|
||||
|
||||
return pushPrefs(['media.peerconnection.dtmf.enabled', true])
|
||||
.then(() => { test.run() })
|
||||
|
@ -28,7 +28,7 @@ function PC_BOTH_WAIT_FOR_ICE_FAILED(test) {
|
||||
.then(() => ok(true, "ICE on both sides must fail."));
|
||||
}
|
||||
|
||||
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
|
||||
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
|
||||
var test;
|
||||
|
||||
runNetworkTest(options =>
|
||||
|
@ -14,7 +14,7 @@
|
||||
});
|
||||
|
||||
var test;
|
||||
var pushPrefs = (...p) => new Promise(r => SpecialPowers.pushPrefEnv({set: p}, r));
|
||||
var pushPrefs = (...p) => SpecialPowers.pushPrefEnv({set: p});
|
||||
|
||||
function selectRecvSsrc(pc, index) {
|
||||
var receivers = pc._pc.getReceivers();
|
||||
|
@ -1,8 +1,8 @@
|
||||
add_task(function*() {
|
||||
// Make the min_background_timeout_value very high to avoid problems on slow machines
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv({
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
'set': [['dom.min_background_timeout_value', 3000]]
|
||||
}, resolve));
|
||||
});
|
||||
|
||||
// Make a new tab, and put it in the background
|
||||
yield BrowserTestUtils.withNewTab("about:blank", function*(browser) {
|
||||
|
@ -25,18 +25,16 @@ add_task(function* () {
|
||||
});
|
||||
|
||||
add_task(function*() {
|
||||
yield new Promise((resolve) => {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["general.smoothScroll", true],
|
||||
["general.smoothScroll.other", true],
|
||||
["general.smoothScroll.mouseWheel", true],
|
||||
["general.smoothScroll.other.durationMaxMS", 2000],
|
||||
["general.smoothScroll.other.durationMinMS", 1999],
|
||||
["general.smoothScroll.mouseWheel.durationMaxMS", 2000],
|
||||
["general.smoothScroll.mouseWheel.durationMinMS", 1999],
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["general.smoothScroll", true],
|
||||
["general.smoothScroll.other", true],
|
||||
["general.smoothScroll.mouseWheel", true],
|
||||
["general.smoothScroll.other.durationMaxMS", 2000],
|
||||
["general.smoothScroll.other.durationMinMS", 1999],
|
||||
["general.smoothScroll.mouseWheel.durationMaxMS", 2000],
|
||||
["general.smoothScroll.mouseWheel.durationMinMS", 1999],
|
||||
]});
|
||||
});
|
||||
|
||||
/*
|
||||
|
@ -66,9 +66,7 @@ var aboutNewTabService = Cc["@mozilla.org/browser/aboutnewtab-service;1"]
|
||||
.getService(Ci.nsIAboutNewTabService);
|
||||
|
||||
function pushPrefs(...aPrefs) {
|
||||
return new Promise((resolve) => {
|
||||
SpecialPowers.pushPrefEnv({"set": aPrefs}, resolve);
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": aPrefs});
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,7 +1,5 @@
|
||||
add_task(function* () {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [["browser.autofocus", false]]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [["browser.autofocus", false]]});
|
||||
|
||||
const url = "data:text/html,<!DOCTYPE html><html><body><input autofocus><button autofocus></button><textarea autofocus></textarea><select autofocus></select></body></html>";
|
||||
|
||||
|
@ -12,13 +12,11 @@ function testScript(script) {
|
||||
}
|
||||
|
||||
function setupPrefs() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.requestcontext.enabled", true],
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
["dom.serviceWorkers.testing.enabled", true],
|
||||
["dom.serviceWorkers.exemptFromPerDomainMax", true]]
|
||||
}, resolve);
|
||||
return SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.requestcontext.enabled", true],
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
["dom.serviceWorkers.testing.enabled", true],
|
||||
["dom.serviceWorkers.exemptFromPerDomainMax", true]]
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,7 @@ if (inFrame) {
|
||||
}
|
||||
|
||||
function setCookieBehavior(behavior) {
|
||||
return new Promise((resolve, reject) => {
|
||||
SpecialPowers.pushPrefEnv({"set": [[kPrefName, behavior]]}, resolve);
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": [[kPrefName, behavior]]});
|
||||
}
|
||||
|
||||
function runIFrame(url) {
|
||||
|
@ -13,9 +13,7 @@
|
||||
<script>
|
||||
add_task(function* () {
|
||||
// Push the correct preferences for the test
|
||||
yield new Promise((done) => {
|
||||
SpecialPowers.pushPrefEnv({'set': [['dom.select_events.enabled', true]]}, done);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({'set': [['dom.select_events.enabled', true]]});
|
||||
|
||||
// Start the actual test
|
||||
yield new Promise((done) => {
|
||||
|
@ -8,11 +8,8 @@
|
||||
const ACCEPT_SESSION = 2;
|
||||
|
||||
add_task(function*() {
|
||||
yield new Promise((resolve, reject) => {
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.cookie.lifetimePolicy",
|
||||
ACCEPT_SESSION]]},
|
||||
resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [["network.cookie.lifetimePolicy",
|
||||
ACCEPT_SESSION]]});
|
||||
|
||||
// Before setting permission
|
||||
yield new Promise((resolve) => {
|
||||
|
@ -40,11 +40,8 @@
|
||||
}
|
||||
|
||||
function httpsOnly() {
|
||||
var promise = new Promise(function(resolve) {
|
||||
SpecialPowers.pushPrefEnv({'set': [["dom.serviceWorkers.testing.enabled", false]] }, resolve);
|
||||
});
|
||||
|
||||
return promise.then(function() {
|
||||
return SpecialPowers.pushPrefEnv({'set': [["dom.serviceWorkers.testing.enabled", false]] })
|
||||
.then(function() {
|
||||
return navigator.serviceWorker.register("/worker.js");
|
||||
}).then(function(w) {
|
||||
ok(false, "non-HTTPS pages cannot register ServiceWorkers");
|
||||
|
@ -50,10 +50,7 @@ function removeAddon(addon)
|
||||
}
|
||||
|
||||
add_task(function* test_addon_shims() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({set: [["dom.ipc.shims.enabledWarnings", true]]},
|
||||
resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({set: [["dom.ipc.shims.enabledWarnings", true]]});
|
||||
|
||||
let addon = yield addAddon(ADDON_URL);
|
||||
yield window.runAddonShimTests({ok: ok, is: is, info: info});
|
||||
|
@ -48,9 +48,9 @@ add_task(function* test_simple() {
|
||||
* Moving back in history should set hasInsecureLoginForms to true again.
|
||||
*/
|
||||
add_task(function* test_subframe_navigation() {
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv({
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
"set": [["security.mixed_content.block_active_content", false]],
|
||||
}, resolve));
|
||||
});
|
||||
|
||||
// Load the page with the subframe in a new tab.
|
||||
let tab = gBrowser.addTab("https" + testUrlPath + "insecure_test.html");
|
||||
|
@ -21,7 +21,7 @@ function promiseObserve(name)
|
||||
|
||||
add_task(function* ()
|
||||
{
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv({"set": [["places.history.enabled", false]]}, resolve));
|
||||
yield SpecialPowers.pushPrefEnv({"set": [["places.history.enabled", false]]});
|
||||
|
||||
let visitUriPromise = promiseObserve("uri-visit-saved");
|
||||
|
||||
|
@ -106,8 +106,7 @@ add_task(function* test() {
|
||||
let multiprocess = Services.appinfo.browserTabsRemoteAutostart;
|
||||
|
||||
// Set these prefs to ensure that we get measurements.
|
||||
const prefs = {"set": [["javascript.options.mem.notify", true]]};
|
||||
yield new Promise(resolve => SpecialPowers.pushPrefEnv(prefs, resolve));
|
||||
yield SpecialPowers.pushPrefEnv({"set": [["javascript.options.mem.notify", true]]});
|
||||
|
||||
function runRemote(f) {
|
||||
gBrowser.selectedBrowser.messageManager.loadFrameScript(`data:,(${f})()`, false);
|
||||
|
@ -1,9 +1,7 @@
|
||||
|
||||
let tempFile;
|
||||
add_task(function* setup() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [["ui.tooltipDelay", 0]]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [["ui.tooltipDelay", 0]]});
|
||||
tempFile = createTempFile();
|
||||
registerCleanupFunction(function() {
|
||||
tempFile.remove(true);
|
||||
|
@ -184,9 +184,7 @@ function* openDocumentSelect(aURI, aCSSSelector) {
|
||||
}
|
||||
|
||||
function pushPrefs(...aPrefs) {
|
||||
return new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": aPrefs}, resolve);
|
||||
});
|
||||
return SpecialPowers.pushPrefEnv({"set": aPrefs});
|
||||
}
|
||||
|
||||
function waitForPrefChange(pref) {
|
||||
|
@ -61,12 +61,11 @@ function play_non_autoplay_audio() {
|
||||
}
|
||||
|
||||
add_task(function* setup_test_preference() {
|
||||
yield new Promise(resolve => {
|
||||
yield
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["dom.audiochannel.audioCompeting", true],
|
||||
["dom.ipc.processCount", 1]
|
||||
]}, resolve);
|
||||
});
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* cross_tabs_audio_competing() {
|
||||
|
@ -32,12 +32,10 @@ function check_audio_suspended(suspendedType) {
|
||||
}
|
||||
|
||||
add_task(function* setup_test_preference() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["media.useAudioChannelService.testing", true],
|
||||
["media.block-autoplay-until-in-foreground", true]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["media.useAudioChannelService.testing", true],
|
||||
["media.block-autoplay-until-in-foreground", true]
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* block_autoplay_media() {
|
||||
|
@ -2,7 +2,7 @@ requestLongerTimeout(2);
|
||||
add_task(function* ()
|
||||
{
|
||||
function pushPref(name, value) {
|
||||
return new Promise(resolve => SpecialPowers.pushPrefEnv({"set": [[name, value]]}, resolve));
|
||||
return SpecialPowers.pushPrefEnv({"set": [[name, value]]});
|
||||
}
|
||||
|
||||
yield pushPref("general.autoScroll", true);
|
||||
|
@ -75,11 +75,9 @@ function* test_visibility(url, browser) {
|
||||
}
|
||||
|
||||
add_task(function*() {
|
||||
yield new Promise((resolve) => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["media.useAudioChannelService.testing", true]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["media.useAudioChannelService.testing", true]
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* test_page() {
|
||||
|
@ -155,11 +155,9 @@ function* suspended_block(url, browser) {
|
||||
}
|
||||
|
||||
add_task(function* setup_test_preference() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["media.useAudioChannelService.testing", true]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["media.useAudioChannelService.testing", true]
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* test_suspended_pause() {
|
||||
|
@ -275,11 +275,9 @@ function* suspended_block(url, browser) {
|
||||
}
|
||||
|
||||
add_task(function* setup_test_preference() {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
["media.useAudioChannelService.testing", true]
|
||||
]}, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv({"set": [
|
||||
["media.useAudioChannelService.testing", true]
|
||||
]});
|
||||
});
|
||||
|
||||
add_task(function* test_suspended_pause() {
|
||||
|
@ -105,10 +105,8 @@
|
||||
|
||||
function onLoad() {
|
||||
Task.spawn(function* () {
|
||||
yield new Promise(resolve => {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ set: [["findbar.entireword", true]] }, resolve);
|
||||
});
|
||||
yield SpecialPowers.pushPrefEnv(
|
||||
{ set: [["findbar.entireword", true]] });
|
||||
|
||||
gFindBar = document.getElementById("FindToolbar");
|
||||
for (let browserId of ["content", "content-remote"]) {
|
||||
|
Loading…
Reference in New Issue
Block a user