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

View File

@ -13,6 +13,8 @@
src="../layout.js"></script>
<script type="application/javascript">
SpecialPowers.setBoolPref("canvas.hitregions.enabled", true);
function redrawCheckbox(context, element, x, y)
{
context.save();
@ -65,13 +67,13 @@
is(hitAcc, hitcanvas, "Hit match at " + tgtX + "," + tgtY +
". Found: " + prettyName(hitAcc));
SpecialPowers.setBoolPref("canvas.hitregions.enabled", false);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [['canvas.hitregions.enabled', true]]}, doTest);
});
</script>
addA11yLoadEvent(doTest);
</script>
</head>
<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>
// </div></body></html>
window.onload = runTest;
var testWindow;
@ -44,9 +45,8 @@ var testNum = 0;
var smoothScrollPref = "general.smoothScroll";
function runTest() {
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, function(){
testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
});
SpecialPowers.setBoolPref(smoothScrollPref, false);
testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
}
var nextTest =function() {
@ -124,6 +124,7 @@ var step3 =function() {
"Page2Again: Ensure we can still scroll.");
testWindow.close();
SpecialPowers.clearUserPref(smoothScrollPref);
window.SimpleTest.finish();
}, true);
sendKey('DOWN', testWindow);
@ -136,3 +137,4 @@ SimpleTest.waitForExplicitFinish();
</pre>
</body>
</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 gCachedManifestURL = gBaseURL + 'file_app.sjs?apptype=cached&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
// b2g.js for now.
function setCSPPrefs() {
SpecialPowers.pushPrefEnv({'set':[["security.apps.trusted.CSP.default",
"default-src *; object-src 'none'"], ["dom.mozBrowserFramesEnabled",true]]},
function() { gGenerator = runTest(); gGenerator.next(); });
SpecialPowers.pushPrefEnv({'set':
[["security.apps.trusted.CSP.default",
"default-src *; object-src 'none'"]]},
function() { gGenerator.next(); });
}
function go() {
@ -62,7 +64,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=826058
function runTest() {
// Set up.
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
// Test Bug 927699 - navigator.mozApps.install(url) lets NS_ERROR_FAILURE
// onto the web
var request = navigator.mozApps.install("");
@ -319,6 +324,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=826058
}
function finish() {
SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
SimpleTest.finish();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -88,7 +88,8 @@
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

View File

@ -88,7 +88,8 @@
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

View File

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

View File

@ -89,7 +89,8 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTest();
},
// 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.requestFlakyTimeout("untriaged");
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({
"set":[["general.smoothScroll", false],
["mousewheel.min_line_scroll_amount", 1],
["mousewheel.transaction.timeout", 100000]]}, runTests)}, window);
SimpleTest.waitForFocus(runTests, window);
function hitEventLoop(aFunc, aTimes)
{
@ -43,6 +39,10 @@ function hitEventLoop(aFunc, aTimes)
function runTests()
{
SpecialPowers.setBoolPref("general.smoothScroll", false);
SpecialPowers.setIntPref("mousewheel.min_line_scroll_amount", 1);
SpecialPowers.setIntPref("mousewheel.transaction.timeout", 100000);
var target = document.getElementById("target");
var scrollLeft = target.scrollLeft;
@ -81,6 +81,9 @@ function runTests()
"not scrolled to right by 0.5 line delta value with pending 0.5 line delta");
ok(target.scrollTop > scrollTop,
"not scrolled to bottom by 0.5 line delta value with pending 0.5 line delta");
SpecialPowers.clearUserPref("general.smoothScroll");
SpecialPowers.clearUserPref("mousewheel.min_line_scroll_amount");
SpecialPowers.clearUserPref("mousewheel.transaction.timeout");
SimpleTest.finish();
}, 20);
}, 20);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,12 +56,12 @@ function begin() {
ok(contextMenu, "Got context menu XUL");
addFullscreenChangeContinuation("enter", fullscreenEntered);
SpecialPowers.pushPrefEnv({"set":[["full-screen-api.approval-required", false]]}, function() {
document.body.mozRequestFullScreen();
});
SpecialPowers.setBoolPref("full-screen-api.approval-required", false);
document.body.mozRequestFullScreen();
}
function finish() {
SpecialPowers.clearUserPref("full-screen-api.approval-required");
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.
**/
SimpleTest.waitForExplicitFinish();
// Turn off Spatial Navigation because it hijacks arrow keydown events:
SpecialPowers.setBoolPref("snav.enabled", false);
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, function() {
test();
SimpleTest.finish();
});
test();
SimpleTest.finish();
});
const defaultMinimum = "NaN";
const defaultMaximum = "NaN";
const defaultStep = 1;

View File

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

View File

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

View File

@ -26,12 +26,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=853525
* ugly rounding errors.
**/
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() {
SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, function() {
test();
SimpleTest.finish();
});
test();
SimpleTest.finish();
});
/**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -90,7 +90,8 @@
}
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTests);
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
runTests();
},
// 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">
/** Test for Bug 265203 **/
// Turn off spatial navigation because it hijacks VK_RIGHT and VK_LEFT keydown
// events
SpecialPowers.setBoolPref("snav.enabled", false);
var gTestStarted = false;
var expectedResult = [ null, 0, null ];
var nextTest;
@ -96,9 +101,8 @@ function startTest() {
if (gTestStarted)
return;
gTestStarted = true;
// Turn off spatial navigation because it hijacks VK_RIGHT and VK_LEFT keydown
// events
SpecialPowers.pushPrefEnv({"set": [["accessibility.browsewithcaret", true], ["snav.enabled", false]]}, test0);
SpecialPowers.pushPrefEnv({"set": [["accessibility.browsewithcaret", true]]}, test0);
}
SimpleTest.waitForExplicitFinish();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1428,7 +1428,8 @@ function runTests()
if (!kIMEEnabledSupported && !kIMEOpenSupported)
return;
SpecialPowers.pushPrefEnv({"set":[["test.IME", true]]}, function() {
SpecialPowers.setBoolPref("test.IME", true);
// test for 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.
runEditableSubframeTests();
});
});
}
function onFinish()
{
SpecialPowers.clearUserPref("test.IME");
SimpleTest.finish();
}