Backed out changeset 6885e993936a (bug 1056851) for crashtest failures

This commit is contained in:
Carsten "Tomcat" Book 2015-02-19 15:02:05 +01:00
parent 6c5ebe6691
commit 24df8222d0
80 changed files with 636 additions and 412 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -330,14 +330,26 @@ function runTests() {
tests.push(testPointerEventCTORS()); tests.push(testPointerEventCTORS());
tests.push(function() { tests.push(function() {
clearPrefs();
SimpleTest.finish(); SimpleTest.finish();
}); });
nextTest(); nextTest();
} }
window.onload = function() { function initPrefs()
SpecialPowers.pushPrefEnv({"set":[["dom.w3c_pointer_events.enabled", true]]}, runTests); {
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);
} }
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,11 +22,10 @@ bar</textarea>
/** Test for Bug 645914 **/ /** Test for Bug 645914 **/
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() { 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"); 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; textarea.selectionStart = textarea.selectionEnd = 0;
// Simulate a double click on foo // Simulate a double click on foo
@ -55,8 +54,11 @@ function startTest() {
is(textarea.selectionStart, 0, "The start of the selection should be at the beginning of the text"); 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"); 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(); SimpleTest.finish();
} });
</script> </script>
</pre> </pre>
</body> </body>

View File

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

View File

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

View File

@ -29,9 +29,10 @@ 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 // Turn off spatial navigation because it hijacks arrow key events and VK_RETURN
// events. // events.
SimpleTest.waitForFocus(function() { SpecialPowers.setBoolPref("snav.enabled", false);
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, runTests);
}); SimpleTest.waitForFocus(runTests);
var textarea = document.getElementById("textarea"); var textarea = document.getElementById("textarea");
var div = document.getElementById("div"); 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 Ci = Components.interfaces;
var Cc = Components.classes; var Cc = Components.classes;
var gTestRunner;
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
var permManager = Cc["@mozilla.org/permissionmanager;1"] var permManager = Cc["@mozilla.org/permissionmanager;1"]
@ -30,6 +30,18 @@ var permManager = Cc["@mozilla.org/permissionmanager;1"]
const gPermName = 'foobar'; 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 // We use http://test/ as url so all apps use the same url and app isolation is
// more obvious. // more obvious.
var gData = [ var gData = [
@ -128,7 +140,11 @@ function runTest() {
i++; i++;
if (i >= gData.length) { if (i >= gData.length) {
SimpleTest.finish(); if (previousPrefs.mozBrowserFramesEnabled !== undefined) {
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled);
}
SimpleTest.finish();
} else { } else {
gTestRunner.next(); gTestRunner.next();
} }
@ -143,11 +159,9 @@ function runTest() {
} }
} }
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, var gTestRunner = runTest();
function() { gTestRunner.next();
gTestRunner = runTest();
gTestRunner.next();
});
</script> </script>
</pre> </pre>
</body> </body>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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