Bug 1056851 - Change existing callers of SpecialPowers.setBoolPref/setIntPref/setCharPref to SpecialPowers.pushPrefEnv. r=jmaher,mwargers

This commit is contained in:
Anish 2015-02-19 11:53:01 -05:00
parent bbbd784c36
commit d6962a9b5b
80 changed files with 409 additions and 634 deletions

View File

@ -18,8 +18,6 @@
src="../layout.js"></script>
<script type="application/javascript">
SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);
function doTest()
{
var canv = document.getElementById("c");
@ -36,14 +34,15 @@
is(accY, cnvY + 10, "accY should be 10 and not " + accY);
is(accWidth, 150, "accWidth should be 150 and not " + accWidth);
is(accHeight, 100, "accHeight should be 100 and not " + accHeight);
SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
addA11yLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]}, doTest);
});
</script>
</head>
<body>

View File

@ -13,8 +13,6 @@
src="../layout.js"></script>
<script type="application/javascript">
SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);
function redrawCheckbox(context, element, x, y)
{
context.save();
@ -67,13 +65,13 @@
is(hitAcc, hitcanvas, "Hit match at " + tgtX + "," + tgtY +
". Found: " + prettyName(hitAcc));
SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
addA11yLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]}, doTest);
});
</script>
</head>
<body>

View File

@ -37,7 +37,6 @@ var gTallBlueBoxURI = "data:text/html;charset=utf-8;base64,PGh0bWw%2BPGhlYWQ%2BP
// <p>This is a very tall blue box.</p>
// </div></body></html>
window.onload = runTest;
var testWindow;
@ -45,8 +44,9 @@ var testNum = 0;
var smoothScrollPref = "general.smoothScroll";
function runTest() {
SpecialPowers.setBoolPref(smoothScrollPref, false);
testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, function(){
testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
});
}
var nextTest =function() {
@ -124,7 +124,6 @@ var step3 =function() {
"Page2Again: Ensure we can still scroll.");
testWindow.close();
SpecialPowers.clearUserPref(smoothScrollPref);
window.SimpleTest.finish();
}, true);
sendKey('DOWN', testWindow);
@ -137,4 +136,3 @@ SimpleTest.waitForExplicitFinish();
</pre>
</body>
</html>

View File

@ -18,15 +18,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=826058
var gHostedManifestURL = gBaseURL + 'file_app.sjs?apptype=hosted&getmanifest=true';
var gCachedManifestURL = gBaseURL + 'file_app.sjs?apptype=cached&getmanifest=true';
var gTrustedManifestURL = gBaseURL + 'file_app.sjs?apptype=trusted&getmanifest=true';
var gGenerator = runTest();
var gGenerator;
// We need to set the trusted hosted app csp pref since it's only in
// b2g.js for now.
function setCSPPrefs() {
SpecialPowers.pushPrefEnv({'set':
[["security.apps.trusted.CSP.default",
"default-src *; object-src 'none'"]]},
function() { gGenerator.next(); });
SpecialPowers.pushPrefEnv({'set':[["security.apps.trusted.CSP.default",
"default-src *; object-src 'none'"], ["dom.mozBrowserFramesEnabled",true]]},
function() { gGenerator = runTest(); gGenerator.next(); });
}
function go() {
@ -64,10 +62,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=826058
function runTest() {
// Set up.
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
// Test Bug 927699 - navigator.mozApps.install(url) lets NS_ERROR_FAILURE
// onto the web
var request = navigator.mozApps.install("");
@ -324,7 +319,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=826058
}
function finish() {
SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
SimpleTest.finish();
}

View File

@ -22,8 +22,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=716841
function doTest(test_id) {
oldPrefVal = SpecialPowers.getBoolPref("dom.server-events.enabled");
SpecialPowers.setBoolPref("dom.server-events.enabled", true);
ok(true, "here we go");
source = new EventSource("eventsource_redirect.resource");
@ -49,8 +47,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=716841
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [['dom.server-events.enabled', true]]}, doTest);
});
</script>
</pre>

View File

@ -108,44 +108,32 @@ function test6() {
activationListener =
function() {
ok(true, "Untrusted DOMActivate should activate a link");
test7();
SpecialPowers.pushPrefEnv({"set":[["dom.disable_open_during_load", false]]}, test7);
}
dispatchDOMActivate(testlink);
}
var oldPref;
function test7() {
oldPref = SpecialPowers.getBoolPref("dom.disable_open_during_load");
SpecialPowers.setBoolPref("dom.disable_open_during_load", false);
testlink.href = "javascript:opener.activationListener(); window.close();";
testlink.target = "_blank";
activationListener =
function() {
ok(true, "Click() should activate a link");
setTimeout(test8, 0);
SpecialPowers.pushPrefEnv({"set":[["dom.disable_open_during_load", true]]}, test8);
}
testlink.click();
}
function test8() {
SpecialPowers.setBoolPref("dom.disable_open_during_load", true);
testlink.href = "javascript:opener.activationListener(); window.close();";
testlink.target = "_blank";
activationListener =
function() {
ok(false, "Click() should not activate a link");
setTimeout(test9, 0);
}
testlink.click();
hitEventLoop(10, test9);
}
function test9() {
SpecialPowers.setBoolPref("dom.disable_open_during_load", oldPref);
SimpleTest.finish();
testlink.click();
SimpleTest.executeSoon(SimpleTest.finish);
}
addLoadEvent(test1);
</script>

View File

@ -19,8 +19,6 @@ target="_blank">Mozilla Bug 715041</a>
<![CDATA[
/** Mock Idle Service Test for Bug 715041 **/
SpecialPowers.setBoolPref("dom.idle-observers-api.fuzz_time.disabled", true);
//class mock javascript idle service
var idleServiceObj = {
observers: [],
@ -810,8 +808,7 @@ target="_blank">Mozilla Bug 715041</a>
AddShiftLocalEnabled = true;
AddIdleObserverWithInvalidTimeEnabled = false;
caseZero();
SpecialPowers.pushPrefEnv({"set":[['dom.idle-observers-api.fuzz_time.disabled', true]]}, caseZero);
]]>
</script>
</window>

View File

@ -19,8 +19,6 @@ target="_blank">Mozilla Bug 715041</a>
<![CDATA[
/** Mock Idle Service Test for Bug 715041 **/
SpecialPowers.setBoolPref("dom.idle-observers-api.fuzz_time.disabled", true);
try {
var idleServiceCID = Components.ID("6f95d965-4322-4829-8a3c-5dc8a4587f4d");
var idleServiceContractID = "@mozilla.org/widget/idleservice;1";
@ -836,9 +834,7 @@ target="_blank">Mozilla Bug 715041</a>
var RemoveHeadAfterLastLocalFiredEnabled = true;
var RemoveHeadIdleObserverWhileIdleCase1Enabled = true;
var RemoveLastAddLastEnabled = true;
RemoveHeadIdleObserverWhileActive();
SpecialPowers.pushPrefEnv({"set":[['dom.idle-observers-api.fuzz_time.disabled', true]]}, RemoveHeadIdleObserverWhileActive);
]]>
</script>
</window>

View File

@ -117,15 +117,13 @@ function expectFrameProcessShutdown(iframe, frameMM, processMM, callback) {
}
function setUp() {
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
SpecialPowers.addPermission("browser", true, window.document);
SpecialPowers.addPermission("embed-apps", true, window.document);
// TODO: remove in bug 820712
SpecialPowers.setBoolPref("network.disable.ipc.security", true);
runNextTest();
// TODO: remove network.disable.ipc.security in bug 820712
SpecialPowers.pushPrefEnv({
"set": [['dom.mozBrowserFramesEnabled', true],
['dom.ipc.browser_frames.oop_by_default', true],
['network.disable.ipc.security', true]]}, runNextTest);
}
function makeKillTest(isApp) function testKill() {
@ -147,12 +145,6 @@ function makeKillTest(isApp) function testKill() {
}
function tearDown() {
SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
SpecialPowers.clearUserPref("dom.ipc.browser_frames.oop_by_default");
// TODO: remove in bug 820712
SpecialPowers.clearUserPref("network.disable.ipc.security");
SimpleTest.finish();
}

View File

@ -27,8 +27,6 @@ let gAppsService = SpecialPowers.Cc["@mozilla.org/AppsService;1"]
.getService(SpecialPowers.Ci.nsIAppsService);
function setUp() {
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
SpecialPowers.addPermission("browser", true, window.document);
SpecialPowers.addPermission("embed-apps", true, window.document);
@ -36,7 +34,8 @@ function setUp() {
SpecialPowers.addPermission("foobar", true, { url: APP_URL,
appId: appId,
isInBrowserElement: false });
runNextTest();
SpecialPowers.pushPrefEnv({"set":[['dom.mozBrowserFramesEnabled', true],
['dom.ipc.browser_frames.oop_by_default', true]]}, runNextTest);
}
/**
@ -168,8 +167,6 @@ function testChildProcessMessageManager() {
}
function tearDown() {
SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
SpecialPowers.clearUserPref("dom.ipc.browser_frames.oop_by_default");
SimpleTest.finish();
}

View File

@ -5,7 +5,7 @@
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="testDeflate()">
<body onload="loadDeflate()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=792831">Mozilla Bug </a>
<p id="display"></p>
<div id="content" style="display: none">
@ -50,8 +50,6 @@ function sendMessage() {
}
function testDeflate() {
SpecialPowers.setBoolPref("network.websocket.extensions.permessage-deflate", tests[testIdx][0]);
ws = new WebSocket(tests[testIdx][2]);
ws.onopen = function(e) {
@ -89,7 +87,7 @@ function testDeflate() {
sendText = true;
testIdx++;
if (testIdx < tests.length) {
testDeflate();
loadDeflate();
} else {
SimpleTest.finish();
}
@ -97,6 +95,10 @@ function testDeflate() {
}
}
function loadDeflate() {
SpecialPowers.pushPrefEnv({"set":[['network.websocket.extensions.permessage-deflate', tests[testIdx][0]]]}, testDeflate);
}
SimpleTest.waitForExplicitFinish();
</script>

View File

@ -36,13 +36,6 @@ function cleanUp()
}
cleanedUp = true;
if (preallocationEnabledPref === null) {
SpecialPowers.clearUserPref('dom.ipc.processPrelaunch.enabled');
} else {
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled',
preallocationEnabledPref);
}
}
// Even if this test times out, we still want to run cleanUp so as to set the
@ -68,12 +61,11 @@ function runTest()
SimpleTest.finish();
});
});
// Setting this pref to true should cause us to prelaunch a process.
SpecialPowers.setBoolPref('dom.ipc.processPrelaunch.enabled', true);
}
addEventListener('testready', runTest);
// Setting this pref to true should cause us to prelaunch a process.
addEventListener('testready', function() {
SpecialPowers.pushPrefEnv({'set':[["dom.ipc.processPrelaunch.enabled",true]]},runTest);
});
</script>
</body>
</html>

View File

@ -8,7 +8,6 @@
SimpleTest.waitForExplicitFinish();
const Cc = SpecialPowers.Cc;
const Cr = SpecialPowers.Cr;
SpecialPowers.setBoolPref("canvas.path.enabled", true);
function isPixel(ctx, x,y, r,g,b,a, d) {
var pos = x + "," + y;
@ -67,7 +66,9 @@ function runTests() {
SimpleTest.finish();
}
addLoadEvent(runTests);
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set":[["canvas.path.enabled", true]]}, runTests)
});
// Don't leak the world via the Path2D reference to its window.
document.all;

View File

@ -8,7 +8,6 @@
SimpleTest.waitForExplicitFinish();
const Cc = SpecialPowers.Cc;
const Cr = SpecialPowers.Cr;
SpecialPowers.setBoolPref("canvas.path.enabled", true);
function isPixel(ctx, x,y, c, d) {
var pos = x + "," + y;
@ -434,11 +433,12 @@ function runTests() {
ok(false, "unexpected exception thrown in: test_addpath_canvas");
throw e;
}
SpecialPowers.setBoolPref("canvas.path.enabled", false);
SimpleTest.finish();
}
addLoadEvent(runTests);
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set":[["canvas.path.enabled", true]]}, runTests);
});
// Don't leak the world via the Path2D reference to its window.
document.all;

View File

@ -8,8 +8,6 @@
SimpleTest.waitForExplicitFinish();
const Cc = SpecialPowers.Cc;
const Cr = SpecialPowers.Cr;
SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);
</script>
<p>Canvas test: hit regions</p>
@ -78,9 +76,9 @@ function runTests() {
ok(false, "unexpected exception thrown in: test_hitregions");
}
SimpleTest.finish();
SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
}
addLoadEvent(runTests);
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set":[["canvas.hitregions.enabled", true]]}, runTests);
});
</script>

View File

@ -14,7 +14,7 @@
var gBaseURL = 'http://test/tests/dom/datastore/tests/';
var gHostedManifestURL = gBaseURL + 'file_app.sjs?testToken=file_app_install.html';
var gGenerator = runTest();
var gGenerator;
SpecialPowers.pushPermissions(
[{ "type": "browser", "allow": 1, "context": document },
@ -25,11 +25,12 @@
["dom.datastore.sysMsgOnChangeShortTimeoutSec", 1],
["dom.datastore.sysMsgOnChangeLongTimeoutSec", 3],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, function() {
["dom.testing.datastore_enabled_for_hosted_apps", true],
["dom.mozBrowserFramesEnabled", true]]}, function() {
if (SpecialPowers.isMainProcess()) {
SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm");
}
gGenerator = runTest();
gGenerator.next(); });
});
@ -49,8 +50,6 @@
is(typeof navigator.getDataStores, "function", "getDataStores exists and it's a function");
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
SpecialPowers.autoConfirmAppInstall(continueTest);
yield undefined;
@ -102,7 +101,6 @@
}
function finish() {
SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
SimpleTest.finish();
}

View File

@ -89,8 +89,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -89,8 +89,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -89,8 +89,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest)
},
// No confirmation needed when an app is installed

View File

@ -90,8 +90,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -89,8 +89,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -89,8 +89,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -94,8 +94,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -94,8 +94,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -96,8 +96,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -89,8 +89,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -89,8 +89,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -90,8 +90,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -118,8 +118,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -11,13 +11,15 @@
<script type="application/javascript;version=1.7">
var gHostedManifestURL = 'http://test/tests/dom/datastore/tests/file_app.sjs?testToken=file_readonly.html';
var gHostedManifestURL2 = 'http://example.com/tests/dom/datastore/tests/file_app.sjs?testToken=file_readonly.html&template=file_app2.template.webapp';
var gGenerator = runTest();
SpecialPowers.pushPermissions(
[{ "type": "browser", "allow": 1, "context": document },
{ "type": "embed-apps", "allow": 1, "context": document },
{ "type": "webapps-manage", "allow": 1, "context": document }],
function() { gGenerator.next() });
var gGenerator;
SpecialPowers.pushPrefEnv({"set": [["dom.mozBrowserFramesEnabled", true]]}, function() {
gGenerator = runTest();
SpecialPowers.pushPermissions(
[{ "type": "browser", "allow": 1, "context": document },
{ "type": "embed-apps", "allow": 1, "context": document },
{ "type": "webapps-manage", "allow": 1, "context": document }],
function() { gGenerator.next() });
});
function continueTest() {
try { gGenerator.next(); }
@ -35,8 +37,6 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
SpecialPowers.autoConfirmAppInstall(continueTest);
yield undefined;
@ -98,7 +98,6 @@
}
function finish() {
SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
SimpleTest.finish();
}

View File

@ -88,8 +88,7 @@
SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm");
}
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -88,8 +88,7 @@
SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm");
}
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest)
},
// No confirmation needed when an app is installed

View File

@ -89,8 +89,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -89,8 +89,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed

View File

@ -26,7 +26,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=422132
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
SimpleTest.waitForFocus(runTests, window);
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({
"set":[["general.smoothScroll", false],
["mousewheel.min_line_scroll_amount", 1],
["mousewheel.transaction.timeout", 100000]]}, runTests)}, window);
function hitEventLoop(aFunc, aTimes)
{
@ -39,10 +43,6 @@ function hitEventLoop(aFunc, aTimes)
function runTests()
{
SpecialPowers.setBoolPref("general.smoothScroll", false);
SpecialPowers.setIntPref("mousewheel.min_line_scroll_amount", 1);
SpecialPowers.setIntPref("mousewheel.transaction.timeout", 100000);
var target = document.getElementById("target");
var scrollLeft = target.scrollLeft;
@ -81,9 +81,6 @@ function runTests()
"not scrolled to right by 0.5 line delta value with pending 0.5 line delta");
ok(target.scrollTop > scrollTop,
"not scrolled to bottom by 0.5 line delta value with pending 0.5 line delta");
SpecialPowers.clearUserPref("general.smoothScroll");
SpecialPowers.clearUserPref("mousewheel.min_line_scroll_amount");
SpecialPowers.clearUserPref("mousewheel.transaction.timeout");
SimpleTest.finish();
}, 20);
}, 20);

View File

@ -38,9 +38,6 @@ function getTests() {
}
function doTest() {
// Enable context menus
SpecialPowers.setBoolPref("ui.click_hold_context_menus", true);
target = document.getElementById("testTarget");
document.documentElement.addEventListener("contextmenu", function() {
@ -66,29 +63,18 @@ function doCheckDuration() {
var duration = 50;
// Change click hold delay
SpecialPowers.setIntPref("ui.click_hold_context_menus.delay", duration);
synthesizeMouse(target, 0, 0, {type: "mousedown"});
SpecialPowers.pushPrefEnv({"set":[["ui.click_hold_context_menus.delay", duration]]}, function() { synthesizeMouse(target, 0, 0, {type: "mousedown"}); });
}
function finishTest() {
synthesizeKey("VK_ESCAPE", {}, window);
try {
SpecialPowers.clearUserPref("ui.click_hold_context_menus");
}
catch(e) {}
try {
SpecialPowers.clearUserPref("ui.click_hold_context_menus.delay");
}
catch(e) {}
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set":[["ui.click_hold_context_menus", true]]}, doTest);
});
</script>
</pre>
<span id="testTarget" style="border: 1px solid black;">testTarget</span>

View File

@ -60,7 +60,6 @@ function runTest() {
if (!outstandingTests.length) {
winUtils.restoreNormalRefresh();
win.close();
clearPrefs();
SimpleTest.finish();
return;
}
@ -98,27 +97,12 @@ function runTest() {
}, win);
}
function initPrefs()
{
SpecialPowers.setBoolPref("general.smoothScroll", false);
// Disables the app level scroll acceleration
SpecialPowers.setIntPref("mousewheel.acceleration.start", -1);
SpecialPowers.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
// Enable zooming for ctrl-scrolling
SpecialPowers.setIntPref("mousewheel.with_control.action", 3);
}
function clearPrefs()
{
SpecialPowers.clearUserPref("general.smoothScroll");
SpecialPowers.clearUserPref("mousewheel.acceleration.start");
SpecialPowers.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
SpecialPowers.clearUserPref("mousewheel.with_control.action");
}
window.onload = function () {
initPrefs();
SimpleTest.executeSoon(runTest);
window.onload = function() {
SpecialPowers.pushPrefEnv({
"set":[["general.smoothScroll", false],
["mousewheel.acceleration.start", -1],
["mousewheel.system_scroll_override_on_root_content.enabled", false],
["mousewheel.with_control.action", 3]]}, runTest);
}
SimpleTest.waitForExplicitFinish();

View File

@ -63,33 +63,17 @@ function runTest() {
"Pixel scrolling should have finished after one refresh driver iteration. " +
"We shouldn't be scrolling smoothly, even though the pref is set.");
win.close();
clearPrefs();
SimpleTest.finish();
});
});
}, win);
}
function initPrefs()
{
// Disables the app level scroll acceleration
SpecialPowers.setIntPref("mousewheel.acceleration.start", -1);
SpecialPowers.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
// Enables smooth scrolling
SpecialPowers.setBoolPref("general.smoothScroll", true);
}
function clearPrefs()
{
SpecialPowers.clearUserPref("mousewheel.acceleration.start");
SpecialPowers.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
SpecialPowers.clearUserPref("general.smoothScroll");
}
window.onload = function () {
initPrefs();
SimpleTest.executeSoon(runTest);
window.onload = function() {
SpecialPowers.pushPrefEnv({
"set":[["general.smoothScroll", true],
["mousewheel.acceleration.start", -1],
["mousewheel.system_scroll_override_on_root_content.enabled", false]]}, runTest);
}
SimpleTest.waitForExplicitFinish();

View File

@ -330,26 +330,14 @@ function runTests() {
tests.push(testPointerEventCTORS());
tests.push(function() {
clearPrefs();
SimpleTest.finish();
});
nextTest();
}
function initPrefs()
{
SpecialPowers.setBoolPref("dom.w3c_pointer_events.enabled", true); // Enable Pointer Events
}
function clearPrefs()
{
SpecialPowers.clearUserPref("dom.w3c_pointer_events.enabled"); // Disable Pointer Events
}
window.onload = function () {
initPrefs();
SimpleTest.executeSoon(runTests);
window.onload = function() {
SpecialPowers.pushPrefEnv({"set":[["dom.w3c_pointer_events.enabled", true]]}, runTests);
}
SimpleTest.waitForExplicitFinish();

View File

@ -50,10 +50,6 @@ function sendMouseClick(element) {
synthesizeMouseAtCenter(element, {});
}
function setRequireTrustedContext(value) {
opener.SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", value);
}
function fullScreenElement() {
return document.getElementById('full-screen-element');
}
@ -213,10 +209,10 @@ function enter_from_arg_test_2(event) {
function exit4(event) {
ok(!document.mozFullScreen, "38. Should be back in non-full-screen mode (fifth time)");
setRequireTrustedContext(true);
addFullscreenErrorContinuation(error2);
fullScreenElement().mozRequestFullScreen();
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", true]]}, function() {
addFullscreenErrorContinuation(error2);
fullScreenElement().mozRequestFullScreen();
});
}
function error2(event) {
@ -237,22 +233,22 @@ function enter5(event) {
function exit5(event) {
ok(!document.mozFullScreen, "Should have left full-screen mode (last time).");
setRequireTrustedContext(false);
SpecialPowers.setBoolPref("full-screen-api.enabled", false);
is(document.mozFullScreenEnabled, false, "document.mozFullScreenEnabled should be false if full-screen-api.enabled is false");
addFullscreenErrorContinuation(error3);
fullScreenElement().mozRequestFullScreen();
SpecialPowers.pushPrefEnv({
"set":[["full-screen-api.allow-trusted-requests-only", false],
["full-screen-api.enabled", false]]}, function() {
is(document.mozFullScreenEnabled, false, "document.mozFullScreenEnabled should be false if full-screen-api.enabled is false");
addFullscreenErrorContinuation(error3);
fullScreenElement().mozRequestFullScreen();
});
}
function error3(event) {
ok(!document.mozFullScreen, "Should still be in normal mode, because pref is not enabled.");
SpecialPowers.setBoolPref("full-screen-api.enabled", true);
is(document.mozFullScreenEnabled, true, "document.mozFullScreenEnabled should be true if full-screen-api.enabled is true");
opener.nextTest();
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.enabled", true]]}, function() {
is(document.mozFullScreenEnabled, true, "document.mozFullScreenEnabled should be true if full-screen-api.enabled is true");
opener.nextTest();
});
}
function begin() {

View File

@ -42,16 +42,18 @@ function begin() {
// Request full-screen from a non trusted context (this script isn't a user
// generated event!).
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", true);
addFullscreenErrorContinuation(
function() {
ok(!document.mozFullScreen, "Should not grant request in non-trusted context");
// Test requesting full-screen mode in a long-running user-generated event handler.
// The request in the key handler should not be granted.
window.addEventListener("keypress", keyHandler, false);
synthesizeKey("VK_A", {});
});
document.body.mozRequestFullScreen();
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", true]]}, startTest);
function startTest() {
addFullscreenErrorContinuation(
function() {
ok(!document.mozFullScreen, "Should not grant request in non-trusted context");
// Test requesting full-screen mode in a long-running user-generated event handler.
// The request in the key handler should not be granted.
window.addEventListener("keypress", keyHandler, false);
synthesizeKey("VK_A", {});
});
document.body.mozRequestFullScreen();
}
}
function keyHandler(event) {
@ -69,14 +71,14 @@ function keyHandler(event) {
// Disable the requirement for trusted contexts only, so the tests are easier
// to write.
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
// Create an iframe without a allowfullscreen attribute, whose contents requests
// full-screen. The request should be denied, and we should not receive a fullscreenchange
// event in this document.
var iframe = document.createElement("iframe");
iframe.src = "file_fullscreen-denied-inner.html";
document.body.appendChild(iframe);
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.allow-trusted-requests-only", false]]}, function() {
// Create an iframe without a allowfullscreen attribute, whose contents requests
// full-screen. The request should be denied, and we should not receive a fullscreenchange
// event in this document.
var iframe = document.createElement("iframe");
iframe.src = "file_fullscreen-denied-inner.html";
document.body.appendChild(iframe);
});
});
document.body.mozRequestFullScreen();
}

View File

@ -56,12 +56,12 @@ function begin() {
ok(contextMenu, "Got context menu XUL");
addFullscreenChangeContinuation("enter", fullscreenEntered);
SpecialPowers.setBoolPref("full-screen-api.approval-required", false);
document.body.mozRequestFullScreen();
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.approval-required", false]]}, function() {
document.body.mozRequestFullScreen();
});
}
function finish() {
SpecialPowers.clearUserPref("full-screen-api.approval-required");
opener.nextTest();
}

View File

@ -25,15 +25,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=935506
* key events while it is in various states.
**/
SimpleTest.waitForExplicitFinish();
// Turn off Spatial Navigation because it hijacks arrow keydown events:
SpecialPowers.setBoolPref("snav.enabled", false);
SimpleTest.waitForFocus(function() {
test();
SimpleTest.finish();
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, function() {
test();
SimpleTest.finish();
});
});
const defaultMinimum = "NaN";
const defaultMaximum = "NaN";
const defaultStep = 1;

View File

@ -41,28 +41,33 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=343444
</form>
<script class="testbody" type="text/javascript">
/** Test for Bug 343444 **/
document.getElementById("start").focus();
var count=0;
while (count < 2) {
sendKey("DOWN");
is(document.activeElement.type, "radio", "radioGroup should ignore non-radio input fields");
if (document.activeElement.id == "start") {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, startTest);
function startTest() {
document.getElementById("start").focus();
var count=0;
while (count < 2) {
sendKey("DOWN");
is(document.activeElement.type, "radio", "radioGroup should ignore non-radio input fields");
if (document.activeElement.id == "start") {
count++;
}
}
document.getElementById("start2").focus();
count = 0;
while (count < 3) {
is(document.activeElement.name, "testtwo",
"radioGroup should only contain elements with the same @name")
sendKey("DOWN");
count++;
}
}
document.getElementById("start2").focus();
count = 0;
while (count < 3) {
is(document.activeElement.name, "testtwo",
"radioGroup should only contain elements with the same @name")
document.getElementById("start3").focus();
sendKey("DOWN");
count++;
is(document.activeElement.name, "testthree", "we don't have an infinite-loop");
SimpleTest.finish();
}
document.getElementById("start3").focus();
sendKey("DOWN");
is(document.activeElement.name, "testthree", "we don't have an infinite-loop");
</script>
</pre>
</body>

View File

@ -26,11 +26,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=843725
SimpleTest.waitForExplicitFinish();
// Turn off Spatial Navigation because it hijacks arrow keydown events:
SpecialPowers.setBoolPref("snav.enabled", false);
SimpleTest.waitForFocus(function() {
test();
SimpleTest.finish();
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, function() {
test();
SimpleTest.finish();
});
});
const defaultMinimum = 0;

View File

@ -26,13 +26,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=853525
* ugly rounding errors.
**/
SimpleTest.waitForExplicitFinish();
// Turn off spatial navigation because it hijacks arrow keydown events:
SpecialPowers.setBoolPref("snav.enabled", false);
// Turn off Spatial Navigation because it hijacks arrow keydown events:
SimpleTest.waitForFocus(function() {
test();
SimpleTest.finish();
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, function() {
test();
SimpleTest.finish();
});
});
/**

View File

@ -23,28 +23,31 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=229925
<script class="testbody" type="text/javascript">
/** Test for Bug 229925 **/
SimpleTest.waitForExplicitFinish();
var r1 = document.getElementById("r1");
var r2 = document.getElementById("r2");
var s1 = document.getElementById("s1");
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, startTest);
function startTest() {
r1.click();
ok(r1.checked,
"The first radio input element should be checked by clicking the element");
r2.click();
ok(r2.checked,
"The second radio input element should be checked by clicking the element");
s1.click();
ok(r1.checked,
"The first radio input element should be checked by clicking other element");
r1.click();
ok(r1.checked,
"The first radio input element should be checked by clicking the element");
r2.click();
ok(r2.checked,
"The second radio input element should be checked by clicking the element");
s1.click();
ok(r1.checked,
"The first radio input element should be checked by clicking other element");
r1.focus();
synthesizeKey("VK_LEFT", {});
ok(r2.checked,
"The second radio input element should be checked by key");
synthesizeKey("VK_LEFT", {});
ok(r1.checked,
"The first radio input element should be checked by key");
r1.focus();
synthesizeKey("VK_LEFT", {});
ok(r2.checked,
"The second radio input element should be checked by key");
synthesizeKey("VK_LEFT", {});
ok(r1.checked,
"The first radio input element should be checked by key");
SimpleTest.finish();
}
</script>
</pre>
</body>

View File

@ -20,16 +20,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=874640
var state = states.shift();
if (state == 'end') {
SpecialPowers.setBoolPref("dom.experimental_forms", pref);
SimpleTest.finish();
return;
}
SpecialPowers.setBoolPref("dom.experimental_forms", state === 'true');
iframe.src = 'data:text/html,<script>' +
SpecialPowers.pushPrefEnv({"set":[["dom.experimental_forms", state === 'true']]},
function() {
iframe.src = 'data:text/html,<script>' +
'parent.is("valueAsDate" in document.createElement("input"), ' +
state + ', "valueAsDate presence state should be ' + state + '");' +
'<\/script>'
});
}
</script>

View File

@ -89,17 +89,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=369370
is(kidDoc.body.scrollTop, 0, "Checking scrollTop");
kidWin.close();
SpecialPowers.clearUserPref("browser.enable_automatic_image_resizing");
SimpleTest.finish();
}
var kidWin;
var kidDoc;
SimpleTest.waitForExplicitFinish();
SpecialPowers.setBoolPref("browser.enable_automatic_image_resizing", true);
var kidWin = window.open("bug369370-popup.png", "bug369370", "width=400,height=300");
var kidDoc; // will init onload
ok(kidWin, "opened child window");
kidWin.onload = childLoaded;
SpecialPowers.pushPrefEnv({"set":[["browser.enable_automatic_image_resizing", true]]}, function() {
kidWin = window.open("bug369370-popup.png", "bug369370", "width=400,height=300");
// will init onload
ok(kidWin, "opened child window");
kidWin.onload = childLoaded;
});
</script>
</body>
</html>

View File

@ -23,9 +23,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=633058
SimpleTest.waitForExplicitFinish();
// Turn off Spatial Navigation so that the 'keypress' event fires.
SpecialPowers.setBoolPref('snav.enabled', false);
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set":[['snav.enabled', false]]}, startTest);
});
function startTest() {
var nbExpectedKeyPress = 8;
var inputGotKeyPress = 0;
var divGotKeyPress = 0;
@ -60,8 +61,7 @@ SimpleTest.waitForFocus(function() {
synthesizeKey('VK_RETURN', {});
}, false);
input.focus();
});
}
</script>
</pre>
</body>

View File

@ -22,9 +22,10 @@ SimpleTest.waitForExplicitFinish();
// Turn off spatial navigation because it hijacks VK_RIGHT and VK_LEFT keydown
// events.
SpecialPowers.setBoolPref("snav.enabled", false);
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, startTest);
});
function startTest() {
function textAreaCtor() {
return document.createElement("textarea");
}
@ -42,7 +43,7 @@ SimpleTest.waitForFocus(function() {
}
SimpleTest.finish();
});
}
function test(ctor) {
var elem = ctor();

View File

@ -22,14 +22,6 @@
<script type="application/javascript">
/** Tests for Bug 545812 **/
// Ensure the full-screen api is enabled, and will be disabled on test exit.
SpecialPowers.setBoolPref("full-screen-api.enabled", true);
// Disable the requirement for trusted contexts only, so the tests are easier
// to write.
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
SimpleTest.requestFlakyTimeout("untriaged");
// Run the tests which go full-screen in new windows, as mochitests normally
@ -94,8 +86,6 @@ function runNextTest() {
}, false);
gTestIndex++;
} else {
SpecialPowers.clearUserPref("full-screen-api.enabled");
SpecialPowers.clearUserPref("full-screen-api.allow-trusted-requests-only");
SimpleTest.finish();
}
}
@ -108,11 +98,16 @@ if (isOSXLion || isOSXMtnLion || isOSXYosemite) {
} catch (e) {
}
is(window.fullScreen, false, "Shouldn't be able to set window fullscreen from content");
addLoadEvent(nextTest);
// Ensure the full-screen api is enabled, and will be disabled on test exit.
// Disable the requirement for trusted contexts only, so the tests are easier
// to write
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({
"set":[["full-screen-api.enabled", true],
["full-screen-api.allow-trusted-requests-only", false]]}, nextTest);
});
SimpleTest.waitForExplicitFinish();
}
</script>
</pre>
</body>

View File

@ -14,34 +14,36 @@
// Test to ensure NetworkStats is enabled but mozNetworkStats.getAvailableNetworks
// does not work in content because mozNetworkStats is null when no permission.
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [['dom.mozNetworkStats.enabled', true]]}, runTest);
function runTest() {
SpecialPowers.removePermission("networkstats-manage", document);
SpecialPowers.setBoolPref("dom.mozNetworkStats.enabled", true);
SpecialPowers.removePermission("networkstats-manage", document);
ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
"Preference 'dom.mozNetworkStats.enabled' is true.");
ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
"Preference 'dom.mozNetworkStats.enabled' is true.");
ok(!SpecialPowers.hasPermission("networkstats-manage", document),
"Has no permission 'networkstats-manage'.");
ok(!SpecialPowers.hasPermission("networkstats-manage", document),
"Has no permission 'networkstats-manage'.");
ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
is(navigator.mozNetworkStats, null,
"mozNetworkStats should be null when no permission.");
is(navigator.mozNetworkStats, null,
"mozNetworkStats should be null when no permission.");
var error;
try {
navigator.mozNetworkStats.getAvailableNetworks;
var error;
try {
navigator.mozNetworkStats.getAvailableNetworks;
ok(false,
"Accessing navigator.mozNetworkStats.getAvailableNetworks should throw!");
} catch (ex) {
error = ex;
}
ok(false,
"Accessing navigator.mozNetworkStats.getAvailableNetworks should throw!");
} catch (ex) {
error = ex;
ok(error,
"Got an exception accessing navigator.mozNetworkStats.getAvailableNetworks");
SimpleTest.finish();
}
ok(error,
"Got an exception accessing navigator.mozNetworkStats.getAvailableNetworks");
</script>
</pre>
</body>

View File

@ -16,19 +16,19 @@
navigator.mozTCPSocket, but mozTCPSocket.open does not work
in content.
**/
SpecialPowers.setBoolPref("dom.mozTCPSocket.enabled", true);
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
function runTest() {
ok('mozTCPSocket' in navigator, "navigator.mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
ok('mozTCPSocket' in navigator, "navigator.mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
try {
navigator.mozTCPSocket.open('localhost', 80);
throw new Error("Error: navigator.mozTCPSocket.open should raise for content that does not have the tcp-socket permission");
} catch (e) {
ok(true, "navigator.mozTCPSocket.open should raise for content that does not have the tcp-socket permission");
try {
navigator.mozTCPSocket.open('localhost', 80);
throw new Error("Error: navigator.mozTCPSocket.open should raise for content that does not have the tcp-socket permission");
} catch (e) {
ok(true, "navigator.mozTCPSocket.open should raise for content that does not have the tcp-socket permission");
}
SimpleTest.finish();
}
SpecialPowers.setBoolPref("dom.mozTCPSocket.enabled", false);
</script>
</pre>
</body>

View File

@ -16,15 +16,16 @@
navigator.mozTCPSocket, and mozTCPSocket.open works when
the tcp-socket permission has been granted.
**/
SpecialPowers.setBoolPref("dom.mozTCPSocket.enabled", true);
SpecialPowers.addPermission("tcp-socket", true, document);
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [['dom.mozTCPSocket.enabled', true]]}, runTest);
function runTest() {
SpecialPowers.addPermission("tcp-socket", true, document);
ok('mozTCPSocket' in navigator, "navigator.mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
ok(navigator.mozTCPSocket.open('localhost', 80), "navigator.mozTCPSocket.open should work for content that has the tcp-socket permission");
SpecialPowers.setBoolPref("dom.mozTCPSocket.enabled", false);
ok('mozTCPSocket' in navigator, "navigator.mozTCPSocket should be accessible if dom.mozTCPSocket.enabled is true");
ok(navigator.mozTCPSocket.open('localhost', 80), "navigator.mozTCPSocket.open should work for content that has the tcp-socket permission");
SimpleTest.finish();
}
</script>
</pre>
</body>

View File

@ -90,8 +90,7 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTests();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTests);
},
// No confirmation needed when an app is installed

View File

@ -40,11 +40,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=265203
<script type="application/javascript">
/** Test for Bug 265203 **/
// Turn off spatial navigation because it hijacks VK_RIGHT and VK_LEFT keydown
// events
SpecialPowers.setBoolPref("snav.enabled", false);
var gTestStarted = false;
var expectedResult = [ null, 0, null ];
var nextTest;
@ -101,8 +96,9 @@ function startTest() {
if (gTestStarted)
return;
gTestStarted = true;
SpecialPowers.pushPrefEnv({"set": [["accessibility.browsewithcaret", true]]}, test0);
// Turn off spatial navigation because it hijacks VK_RIGHT and VK_LEFT keydown
// events
SpecialPowers.pushPrefEnv({"set": [["accessibility.browsewithcaret", true], ["snav.enabled", false]]}, test0);
}
SimpleTest.waitForExplicitFinish();

View File

@ -13,11 +13,8 @@ SimpleTest.waitForExplicitFinish();
// Ensure the full-screen api is enabled, and will be disabled on test exit.
var gPrevEnabled = SpecialPowers.getBoolPref("full-screen-api.enabled");
SpecialPowers.setBoolPref("full-screen-api.enabled", true);
var gPrevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requests-only");
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
var newwindow;
const Cc = Components.classes;
const Ci = Components.interfaces;
@ -35,13 +32,16 @@ var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
.getNoAppCodebasePrincipal(uri);
pm.removeFromPrincipal(principal, "fullscreen");
newwindow = window.open("MozEnteredDomFullscreen_chrome.xul", "_blank","chrome,resizable=yes,width=400,height=400");
SpecialPowers.pushPrefEnv({"set": [['full-screen-api.enabled', true],
['full-screen-api.allow-trusted-requests-only', false]]}, setup);
function setup() {
newwindow = window.open("MozEnteredDomFullscreen_chrome.xul", "_blank","chrome,resizable=yes,width=400,height=400");
}
function done()
{
newwindow.close();
SpecialPowers.setBoolPref("full-screen-api.enabled", gPrevEnabled);
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", gPrevTrusted);
SimpleTest.finish();
}

View File

@ -12,9 +12,10 @@
SimpleTest.waitForExplicitFinish();
function runTest()
{
SpecialPowers.setBoolPref("dom.event.clipboardevents.enabled", false);
window.open("data:text/html,<body onload='window.opener.doChecks(this)'><input id='i' value='Sample Text'></body>",
"_blank", "chrome,width=200,height=200");
SpecialPowers.pushPrefEnv({"set": [['dom.event.clipboardevents.enabled', false]]}, function() {
window.open("data:text/html,<body onload='window.opener.doChecks(this)'><input id='i' value='Sample Text'></body>",
"_blank", "chrome,width=200,height=200");
});
}
var event_fired = false;
@ -49,7 +50,6 @@ function doChecks(win)
is(textbox.value, "STeText", "paste changed text when preference is disabled");
ok(event_fired, "paste event fired when preference is disabled")
SpecialPowers.clearUserPref("dom.event.clipboardevents.enabled");
win.close();
SimpleTest.finish();
}

View File

@ -679,4 +679,3 @@ function checkCachedDataTransfer(cd, eventtype)
</pre>
</body>
</html>

View File

@ -12,6 +12,7 @@
navigator.vibrate throws an exception where appropriate. -->
<script class="testbody" type="text/javascript;version=1.7">
SimpleTest.waitForExplicitFinish();
var result;
function expectFailure(param) {
result = navigator.vibrate(param);
@ -23,7 +24,7 @@ function expectSuccess(param) {
is(result, true, 'vibrate(' + param + ') must succeed.');
}
function tests() {
function tests(aEnabled) {
// Some edge cases that the bindings should handle for us.
expectSuccess(null);
expectSuccess(undefined);
@ -68,24 +69,18 @@ function tests() {
navigator.vibrate([100, 100]);
}
ok(true, "Didn't crash after issuing a lot of vibrate() calls.");
if(!aEnabled)
SimpleTest.finish();
}
var origVibratorEnabled = SpecialPowers.getBoolPref('dom.vibrator.enabled');
// Test with the vibrator pref enabled.
try {
SpecialPowers.setBoolPref('dom.vibrator.enabled', true);
tests();
// Everything should be the same when the vibrator is disabled -- in
// particular, a disabled vibrator shouldn't eat failures we'd otherwise
// observe.
SpecialPowers.setBoolPref('dom.vibrator.enabled', false);
tests();
}
finally {
SpecialPowers.setBoolPref('dom.vibrator.enabled', origVibratorEnabled);
}
SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', true]]}, function() {
tests(true);
SpecialPowers.pushPrefEnv({"set": [['dom.vibrator.enabled', false]]}, tests(false));
});
// Everything should be the same when the vibrator is disabled -- in
// particular, a disabled vibrator shouldn't eat failures we'd otherwise
// observe.
</script>
</body>

View File

@ -12,18 +12,6 @@ SimpleTest.waitForExplicitFinish();
var fileTestOnCurrentOrigin = (location.protocol + "//" + location.host + location.pathname)
.replace("test_a", "frameA");
var previousPrefs = {
mozBrowserFramesEnabled: undefined,
};
try {
previousPrefs.mozBrowserFramesEnabled = SpecialPowers.getBoolPref('dom.mozBrowserFramesEnabled');
} catch(e)
{
}
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
SpecialPowers.addPermission("browser", true, window.document);
SpecialPowers.addPermission("embed-apps", true, window.document);
@ -110,10 +98,6 @@ function runTest()
SpecialPowers.removePermission("browser", window.document);
SpecialPowers.removePermission("embed-apps", window.document);
if (previousPrefs.mozBrowserFramesEnabled !== undefined) {
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled);
}
SimpleTest.finish();
} else {
gTestRunner.next();
@ -131,6 +115,10 @@ function runTest()
var gTestRunner = runTest();
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [['dom.mozBrowserFramesEnabled', true]]}, startTest);
});
function startTest()
{
is(localStorage.getItem("0"), null, "no data");
@ -139,9 +127,6 @@ function startTest()
gTestRunner.next();
}
addLoadEvent(startTest);
</script>
</head>

View File

@ -14,14 +14,13 @@
var tests = [
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.tv.enabled", true]]}, function() {
SpecialPowers.pushPrefEnv({"set": [["dom.tv.enabled", true],["dom.mozBrowserFramesEnabled", true]]}, function() {
SpecialPowers.pushPermissions(
[{ "type": "browser", "allow": true, "context": document },
{ "type": "embed-apps", "allow": true, "context": document },
{ "type": "webapps-manage", "allow": true, "context": document }],
function() {
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
// No confirmation needed when an app is installed and uninstalled.
SpecialPowers.autoConfirmAppInstall(() => {
SpecialPowers.autoConfirmAppUninstall(runTest);

View File

@ -21,14 +21,6 @@ SimpleTest.waitForExplicitFinish();
// |window| synchronously from here. Out-of-process docshell creation
// for mozbrowser haves entirely differently.
// XXX why doesn't pushPrefEnv() work here?
var ipcTabsWereDisabled;
try {
ipcTabsWereDisabled = SpecialPowers.getBoolPref("dom.ipc.tabs.disabled");
} catch (e) {
ipcTabsWereDisabled = undefined;
}
SpecialPowers.setBoolPref("dom.ipc.tabs.disabled", true);
var otherWindow = window.open("window_bug757137.xul", "", "chrome");
ok(chromeWindowInterface !== null, 'nsIDOMChromeWindow interface is defined');
var otherChromeWindow = null;
@ -39,25 +31,22 @@ try {
}
ok(otherChromeWindow !== null, 'XUL window should QI to ChromeWindow');
otherWindow.onload = function () {
var w = otherWindow.document.getElementById('f').contentWindow;
ok(w !== null, 'got the |window| for a mozbrowser iframe');
var chromeWindow = null;
try {
var chromeWindow = w.QueryInterface(chromeWindowInterface);
} catch(e) { }
ok(chromeWindow === null, 'mozbrowser iframe should not get ChromeWindow');
SpecialPowers.pushPrefEnv({"set":[["dom.ipc.tabs.disabled", true]]}, startTest);
otherWindow.close();
SimpleTest.waitForFocus(function() {
if (ipcTabsWereDisabled !== undefined) {
SpecialPowers.setBoolPref("dom.ipc.tabs.disabled", ipcTabsWereDisabled);
} else {
SpecialPowers.clearUserPref("dom.ipc.tabs.disabled");
}
SimpleTest.finish();
});
};
function startTest() {
otherWindow.onload = function () {
var w = otherWindow.document.getElementById('f').contentWindow;
ok(w !== null, 'got the |window| for a mozbrowser iframe');
var chromeWindow = null;
try {
var chromeWindow = w.QueryInterface(chromeWindowInterface);
} catch(e) { }
ok(chromeWindow === null, 'mozbrowser iframe should not get ChromeWindow');
otherWindow.close();
SimpleTest.waitForFocus(SimpleTest.finish);
};
}
</script>
</window>

View File

@ -20,7 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549262
/** Test for Bug 549262 **/
var smoothScrollPref = "general.smoothScroll";
SpecialPowers.setBoolPref(smoothScrollPref, false);
SimpleTest.waitForExplicitFinish();
var win = window.open("file_bug549262.html", "_blank",
"width=600,height=600,scrollbars=yes");
@ -30,8 +29,10 @@ var cwu = SpecialPowers.getDOMWindowUtils(win);
function step() {
cwu.advanceTimeAndRefresh(100);
}
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, startTest);
}, win);
function startTest() {
// Make sure that pressing Space when a contenteditable element is not focused
// will scroll the page.
var ed = win.document.getElementById("editor");
@ -121,12 +122,10 @@ SimpleTest.waitForFocus(function() {
is(win.getSelection().focusOffset, ed.textContent.length, "Selection should be moved to the end");
win.close();
SpecialPowers.clearUserPref(smoothScrollPref);
cwu.restoreNormalRefresh();
SimpleTest.finish();
}, win);
}
</script>
</pre>
</body>

View File

@ -26,9 +26,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=578771
/** Test for Bug 578771 **/
SimpleTest.waitForExplicitFinish();
// Avoid platform selection differences
SpecialPowers.setBoolPref("layout.word_select.eat_space_to_next_word", false);
function testElem(elem, elemTag) {
var ce = document.getElementById("ce");
ce.focus();
@ -42,17 +39,20 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=578771
ok(elem.selectionStart == 0 && elem.selectionEnd == 14,
"Triple-clicking on another " + elemTag + " works correctly");
}
// Avoid platform selection differences
SimpleTest.waitForFocus(function() {
var input = document.getElementById("ip");
testElem(input, "input");
var textarea = document.getElementById("ta");
testElem(textarea, "textarea");
SpecialPowers.clearUserPref("layout.word_select.eat_space_to_next_word");
SimpleTest.finish();
SpecialPowers.pushPrefEnv({"set":[["layout.word_select.eat_space_to_next_word", false]]}, startTest);
});
function startTest() {
var input = document.getElementById("ip");
testElem(input, "input");
var textarea = document.getElementById("ta");
testElem(textarea, "textarea");
SimpleTest.finish();
}
</script>
</pre>

View File

@ -87,8 +87,6 @@ SimpleTest.waitForFocus(function() {
const needlessGrowth = preserveRatio ? 1 : 0;
const reversedGrowth = preserveRatio ? -1 : 1;
SpecialPowers.setBoolPref("editor.resizing.preserve_ratio", preserveRatio);
// top resizer
testResizer(W/2, 0, -10, -10, 0, 10);
testResizer(W/2, 0, -10, 0, 0, 0);
@ -176,15 +174,15 @@ SimpleTest.waitForFocus(function() {
testResizer( 0, 0, 10, -10, -10 * reversedGrowth, 10);
testResizer( 0, 0, 10, 0, -10 * ignoredGrowth, 0);
testResizer( 0, 0, 10, 10, -10, -10);
SpecialPowers.clearUserPref("editor.resizing.preserve_ratio");
}
runTests(false);
runTests(true);
SimpleTest.finish();
});
}
SpecialPowers.pushPrefEnv({"set": [["editor.resizing.preserve_ratio", false]]}, function() {
runTests(false);
SpecialPowers.pushPrefEnv({"set": [["editor.resizing.preserve_ratio", true]]}, function() {
runTests(true);
SimpleTest.finish();
});
});
});
</script>
</pre>

View File

@ -22,10 +22,11 @@ bar</textarea>
/** Test for Bug 645914 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set":[["layout.word_select.eat_space_to_next_word", true],
["browser.triple_click_selects_paragraph", false]]}, startTest);
});
function startTest() {
var textarea = document.querySelector("textarea");
SpecialPowers.setBoolPref("layout.word_select.eat_space_to_next_word", true);
SpecialPowers.setBoolPref("browser.triple_click_selects_paragraph", false);
textarea.selectionStart = textarea.selectionEnd = 0;
// Simulate a double click on foo
@ -54,11 +55,8 @@ SimpleTest.waitForFocus(function() {
is(textarea.selectionStart, 0, "The start of the selection should be at the beginning of the text");
is(textarea.selectionEnd, textarea.value.length, "The end of the selection should be the end of the paragraph");
SpecialPowers.clearUserPref("layout.word_select.eat_space_to_next_word");
SpecialPowers.clearUserPref("browser.triple_click_selects_paragraph");
SimpleTest.finish();
});
}
</script>
</pre>
</body>

View File

@ -24,7 +24,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=674770
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
SpecialPowers.setBoolPref("middlemouse.paste", true);
SpecialPowers.pushPrefEnv({"set":[["middlemouse.paste", true]]}, startTest);
});
function startTest() {
localStorage.removeItem("clicked");
window.linkWasClicked = false;
@ -48,11 +50,10 @@ SimpleTest.waitForFocus(function() {
ok(!window.linkWasClicked, "The click operation shouldn't work in the contenteditable area");
localStorage.removeItem("clicked");
SpecialPowers.clearUserPref("middlemouse.paste");
SimpleTest.finish();
}, 100);
}, 100);
});
}
function hitEventLoop(func, times) {
if (times > 0) {

View File

@ -47,11 +47,11 @@ function clickEventHnalder(aEvent)
// NOTE: tests need to check the result *after* the content is actually
// modified. Sometimes, the modification is delayed. Therefore, there
// are a lot of functions and SimpleTest.executeSoon()s.
SimpleTest.waitForFocus(function() {
SpecialPowers.setBoolPref("middlemouse.contentLoadURL", false);
SpecialPowers.setBoolPref("middlemouse.paste", true);
SpecialPowers.pushPrefEnv({"set":[["middlemouse.contentLoadURL", false],
["middlemouse.paste", true]]}, startTest);
});
function startTest() {
frameWindow = iframe.contentWindow;
frameDocument = iframe.contentDocument;
@ -62,27 +62,24 @@ SimpleTest.waitForFocus(function() {
var text = frameDocument.getElementById("text");
text.focus();
SimpleTest.executeSoon(function() {
if (navigator.platform.indexOf("Linux") == 0) {
synthesizeKey("a", { altKey: true }, frameWindow);
} else {
synthesizeKey("a", { accelKey: true }, frameWindow);
}
// Windows and Mac don't have primary selection, we should copy the text to
// the global clipboard.
if (!SpecialPowers.supportsSelectionClipboard()) {
SimpleTest.waitForClipboard("pasted",
function() { synthesizeKey("c", { accelKey: true }, frameWindow); },
function() { SimpleTest.executeSoon(runInputTests1) },
cleanup);
} else {
// Otherwise, don't call waitForClipboard since it breaks primary
// selection.
runInputTests1();
}
});
});
if (navigator.platform.indexOf("Linux") == 0) {
synthesizeKey("a", { altKey: true }, frameWindow);
} else {
synthesizeKey("a", { accelKey: true }, frameWindow);
}
// Windows and Mac don't have primary selection, we should copy the text to
// the global clipboard.
if (!SpecialPowers.supportsSelectionClipboard()) {
SimpleTest.waitForClipboard("pasted",
function() { synthesizeKey("c", { accelKey: true }, frameWindow); },
function() { SimpleTest.executeSoon(runInputTests1) },
cleanup);
} else {
// Otherwise, don't call waitForClipboard since it breaks primary
// selection.
runInputTests1();
}
}
function runInputTests1()
{
@ -389,9 +386,6 @@ function runBodyEditableDocumentTests2()
function cleanup()
{
SpecialPowers.clearUserPref("middlemouse.contentLoadURL");
SpecialPowers.clearUserPref("middlemouse.paste");
SimpleTest.finish();
}

View File

@ -29,10 +29,9 @@ SimpleTest.requestFlakyTimeout("This test uses setTimeouts in order to fix an in
// Turn off spatial navigation because it hijacks arrow key events and VK_RETURN
// events.
SpecialPowers.setBoolPref("snav.enabled", false);
SimpleTest.waitForFocus(runTests);
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, runTests);
});
var textarea = document.getElementById("textarea");
var div = document.getElementById("div");

View File

@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=758258
var Ci = Components.interfaces;
var Cc = Components.classes;
var gTestRunner;
SimpleTest.waitForExplicitFinish();
var permManager = Cc["@mozilla.org/permissionmanager;1"]
@ -30,18 +30,6 @@ var permManager = Cc["@mozilla.org/permissionmanager;1"]
const gPermName = 'foobar';
var previousPrefs = {
mozBrowserFramesEnabled: undefined,
};
try {
previousPrefs.mozBrowserFramesEnabled = SpecialPowers.getBoolPref('dom.mozBrowserFramesEnabled');
} catch(e)
{
}
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
// We use http://test/ as url so all apps use the same url and app isolation is
// more obvious.
var gData = [
@ -140,11 +128,7 @@ function runTest() {
i++;
if (i >= gData.length) {
if (previousPrefs.mozBrowserFramesEnabled !== undefined) {
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled);
}
SimpleTest.finish();
SimpleTest.finish();
} else {
gTestRunner.next();
}
@ -159,9 +143,11 @@ function runTest() {
}
}
var gTestRunner = runTest();
gTestRunner.next();
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]},
function() {
gTestRunner = runTest();
gTestRunner.next();
});
</script>
</pre>
</body>

View File

@ -30,23 +30,20 @@
var imgLoadingContent =
SpecialPowers.wrap(img).QueryInterface(Ci.nsIImageLoadingContent);
imgLoadingContent.addObserver(gObserver);
SpecialPowers.setBoolPref('min_discard_timeout_ms', 1);
function initCF() {
setTimeout(function() { document.adoptNode(tCF0); }, 0);
}
document.addEventListener("DOMContentLoaded", initCF, false);
function cleanupAndFinish() {
SpecialPowers.clearUserPref('min_discard_timeout_ms');
imgLoadingContent.removeObserver(gObserver);
setTimeout("document.documentElement.className = '';", 0);
}
function loadhandler() {
setTimeout("cleanupAndFinish();", 30000);
}
window.addEventListener("load", loadhandler, false);
window.addEventListener("load", function() {
SpecialPowers.pushPrefEnv({"set":[["min_discard_timeout_ms", 1]]}, loadhandler)}, false);
</script>
</body>
</html>

View File

@ -190,4 +190,3 @@ function starttest(){
</pre>
</body>
</html>

View File

@ -14,8 +14,6 @@ SimpleTest.waitForExplicitFinish();
var pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
.getService(SpecialPowers.Ci.nsILoginManager);
// Assume that the pref starts out true, so set to false
SpecialPowers.setBoolPref("signon.autofillForms", false);
</script>
<p id="display"></p>
@ -52,14 +50,14 @@ function startTest(){
is($_(1, "uname").value, "testuser", "Checking for filled username");
is($_(1, "pword").value, "testpass", "Checking for filled password");
// Reset pref (since we assumed it was true to start)
SpecialPowers.setBoolPref("signon.autofillForms", true);
SimpleTest.finish();
});
}
window.addEventListener("runTests", startTest);
// Assume that the pref starts out true, so set to false
SpecialPowers.pushPrefEnv({"set":[["signon.autofillForms", false]]}, setup);
function setup() {
window.addEventListener("runTests", startTest);
}
</script>
</pre>
</body>

View File

@ -14,11 +14,10 @@ SimpleTest.waitForExplicitFinish();
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
var TestObserver;
// Assume that the pref starts out true, so set to false
SpecialPowers.setBoolPref("signon.autofillForms", false);
var TestObserver = {
SpecialPowers.pushPrefEnv({"set":[["signon.autofillForms", false]]}, function() {
TestObserver = {
receivedNotificationFoundForm : false,
receivedNotificationFoundLogins : false,
dataFoundForm : "",
@ -50,6 +49,7 @@ var TestObserver = {
// Add the observer
SpecialPowers.addObserver(TestObserver, "passwordmgr-found-form", false);
SpecialPowers.addObserver(TestObserver, "passwordmgr-found-logins", false);
});
</script>
<p id="display"></p>
@ -90,10 +90,6 @@ function startTest() {
ok(TestObserver.dataFoundLogins.get("selectedLogin").QueryInterface(Ci.nsILoginInfo), "Checking selectedLogin is nsILoginInfo");
ok(TestObserver.dataFoundLogins.get("selectedLogin").equals(TestObserver.dataFoundLogins.get("foundLogins")[0]),
"Checking selectedLogin is found login");
// Reset pref (since we assumed it was true to start)
SpecialPowers.setBoolPref("signon.autofillForms", true);
// Remove the observer
SpecialPowers.removeObserver(TestObserver, "passwordmgr-found-form");
SpecialPowers.removeObserver(TestObserver, "passwordmgr-found-logins");

View File

@ -21,8 +21,6 @@ var Ci = SpecialPowers.Ci;
SpecialPowers.addPermission("trackingprotection",
Ci.nsIPermissionManager.ALLOW_ACTION,
{ url: "https://allowlisted.example.com" });
// Enable synthetic allowlist URL in nsChannelClassifier
SpecialPowers.setBoolPref("channelclassifier.allowlist_example", true);
// Add some URLs to the tracking database
var testData = "tracking.example.com/";
@ -40,8 +38,6 @@ function clearPermissions() {
ok(!SpecialPowers.testPermission("trackingprotection",
Ci.nsIPermissionManager.ALLOW_ACTION,
{ url: "https://allowlisted.example.com" }));
SpecialPowers.clearUserPref("privacy.trackingprotection.enabled");
SpecialPowers.clearUserPref("channelclassifier.allowlist_example");
}
function doUpdate(update) {
@ -62,7 +58,6 @@ function doUpdate(update) {
SimpleTest.finish();
},
updateSuccess: function(requestedTimeout) {
SpecialPowers.setBoolPref("privacy.trackingprotection.enabled", true);
document.getElementById("testFrame").src = "allowlistAnnotatedFrame.html";
}
};
@ -75,7 +70,9 @@ function doUpdate(update) {
}
SpecialPowers.pushPrefEnv(
{"set" : [["urlclassifier.trackingTable", "test-track-simple"]]},
{"set" : [["urlclassifier.trackingTable", "test-track-simple"],
["privacy.trackingprotection.enabled", true],
["channelclassifier.allowlist_example", true]]},
function() { doUpdate(testUpdate); });
// Expected finish() call is in "allowlistedAnnotatedFrame.html".

View File

@ -13,18 +13,11 @@
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set":[["browser.preferences.instantApply", false]]}, function() {
// No instant-apply for this test
SpecialPowers.setBoolPref("browser.preferences.instantApply", false);
var prefWindow = openDialog("window_preferences_beforeaccept.xul", "", "", windowOnload);
SimpleTest.registerCleanupFunction(() => {
SpecialPowers.clearUserPref("browser.preferences.instantApply");
SpecialPowers.clearUserPref("tests.beforeaccept.dialogShown");
SpecialPowers.clearUserPref("tests.beforeaccept.called");
});
function windowOnload() {
var dialogShown = prefWindow.document.getElementById("tests.beforeaccept.dialogShown");
var called = prefWindow.document.getElementById("tests.beforeaccept.called");
@ -49,6 +42,7 @@
SimpleTest.finish();
}
});
]]>
</script>

View File

@ -634,39 +634,23 @@ function runNextTest()
function init()
{
SpecialPowers.setBoolPref("middlemouse.contentLoadURL", false);
SpecialPowers.setBoolPref("middlemouse.paste", false);
SpecialPowers.setBoolPref("general.autoScroll", false);
SpecialPowers.setIntPref("mousewheel.default.action", 0);
SpecialPowers.setIntPref("mousewheel.default.action.override_x", -1);
SpecialPowers.setIntPref("mousewheel.with_shift.action", 0);
SpecialPowers.setIntPref("mousewheel.with_shift.action.override_x", -1);
SpecialPowers.setIntPref("mousewheel.with_control.action", 0);
SpecialPowers.setIntPref("mousewheel.with_control.action.override_x", -1);
SpecialPowers.setIntPref("mousewheel.with_alt.action", 0);
SpecialPowers.setIntPref("mousewheel.with_alt.action.override_x", -1);
SpecialPowers.setIntPref("mousewheel.with_meta.action", 0);
SpecialPowers.setIntPref("mousewheel.with_meta.action.override_x", -1);
runNextTest();
SpecialPowers.pushPrefEnv({"set":[["middlemouse.contentLoadURL", false],
["middlemouse.paste", false],
["general.autoScroll", false],
["mousewheel.default.action", 0],
["mousewheel.default.action.override_x", -1],
["mousewheel.with_shift.action", 0],
["mousewheel.with_shift.action.override_x", -1],
["mousewheel.with_control.action", 0],
["mousewheel.with_control.action.override_x", -1],
["mousewheel.with_alt.action", 0],
["mousewheel.with_alt.action.override_x", -1],
["mousewheel.with_meta.action", 0],
["mousewheel.with_meta.action.override_x", -1]]}, runNextTest);
}
function finish()
{
SpecialPowers.clearUserPref("middlemouse.contentLoadURL");
SpecialPowers.clearUserPref("middlemouse.paste");
SpecialPowers.clearUserPref("general.autoScroll");
SpecialPowers.clearUserPref("mousewheel.default.action");
SpecialPowers.clearUserPref("mousewheel.default.action.override_x");
SpecialPowers.clearUserPref("mousewheel.with_shift.action");
SpecialPowers.clearUserPref("mousewheel.with_shift.action.override_x");
SpecialPowers.clearUserPref("mousewheel.with_control.action");
SpecialPowers.clearUserPref("mousewheel.with_control.action.override_x");
SpecialPowers.clearUserPref("mousewheel.with_alt.action");
SpecialPowers.clearUserPref("mousewheel.with_alt.action.override_x");
SpecialPowers.clearUserPref("mousewheel.with_meta.action");
SpecialPowers.clearUserPref("mousewheel.with_meta.action.override_x");
SimpleTest.finish();
}

View File

@ -1428,8 +1428,7 @@ function runTests()
if (!kIMEEnabledSupported && !kIMEOpenSupported)
return;
SpecialPowers.setBoolPref("test.IME", true);
SpecialPowers.pushPrefEnv({"set":[["test.IME", true]]}, function() {
// test for normal contents.
runBasicTest(false, false, "Testing of normal contents");
@ -1479,11 +1478,11 @@ function runTests()
// This will call onFinish(), so, this test must be the last.
runEditableSubframeTests();
});
});
}
function onFinish()
{
SpecialPowers.clearUserPref("test.IME");
SimpleTest.finish();
}