2015-02-26 23:07:08 +03:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1107378
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Test for Bug 1107378</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
2015-03-13 23:15:09 +03:00
|
|
|
<script type="application/javascript;version=1.7" src="unprefixing_service_utils.js"></script>
|
2015-02-26 23:07:08 +03:00
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1107378">Mozilla Bug 1107378</a>
|
|
|
|
<div id="display">
|
2015-03-13 23:15:09 +03:00
|
|
|
<iframe id="testIframe"></iframe>
|
2015-02-26 23:07:08 +03:00
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript;version=1.7">
|
|
|
|
"use strict";
|
2015-03-13 23:15:09 +03:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
2015-02-26 23:07:08 +03:00
|
|
|
|
2015-03-13 23:15:09 +03:00
|
|
|
/**
|
|
|
|
* This test checks that unprefixing is enabled for whitelisted domains, and
|
|
|
|
* that it's disabled for non-whitelisted domains.
|
|
|
|
*
|
|
|
|
* We do this using an iframe, in which we load a test file at a test domain,
|
|
|
|
* and we have the iframe report back to us (using postMessage) about
|
|
|
|
* whether unprefixing is working.
|
|
|
|
*
|
|
|
|
* High-level overview of the process here:
|
|
|
|
* - First, we tweak prefs to enable unprefixing & enable the test-only
|
|
|
|
* entries in our unprefixing whitelist.
|
|
|
|
* - The rest of this test is driven by the "startNextTest()" method.
|
|
|
|
* This method pops a hostname to test and loads a URL from that host
|
|
|
|
* in the iframe.
|
|
|
|
* - We then listen for test-results from the iframe, using the postMessage
|
|
|
|
* handler in unprefixing_service_utils.js.
|
|
|
|
* - When the iframe indicates that it's done, we call "startNextTest()"
|
|
|
|
* again to pop the next host & load *that* in the iframe.
|
|
|
|
* - When nothing remains to be popped, we're done.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const IFRAME_TESTFILE = "unprefixing_service_iframe.html";
|
|
|
|
|
|
|
|
// This function gets invoked when our iframe finishes a given round of testing.
|
|
|
|
function startNextTest()
|
2015-02-26 23:07:08 +03:00
|
|
|
{
|
2015-03-13 23:15:09 +03:00
|
|
|
// Test the next whitelisted host, if any remain.
|
|
|
|
if (gWhitelistedHosts.length > 0) {
|
|
|
|
let host = gWhitelistedHosts.pop();
|
|
|
|
info("Verifying that CSS Unprefixing Service is active, " +
|
|
|
|
"at whitelisted test-host '" + host + "'");
|
|
|
|
testHost(host, true);
|
|
|
|
return;
|
2015-02-26 23:07:08 +03:00
|
|
|
}
|
|
|
|
|
2015-03-13 23:15:09 +03:00
|
|
|
// Test the next not-whitelisted host, if any remain.
|
|
|
|
if (gNotWhitelistedHosts.length > 0) {
|
|
|
|
let host = gNotWhitelistedHosts.pop();
|
|
|
|
info("Verifying that CSS Unprefixing Service is inactive, " +
|
|
|
|
"at non-whitelisted test-host '" + host + "'");
|
|
|
|
testHost(host, false);
|
|
|
|
return;
|
2015-02-26 23:07:08 +03:00
|
|
|
}
|
|
|
|
|
2015-03-13 23:15:09 +03:00
|
|
|
// Both arrays empty --> we're done.
|
|
|
|
SimpleTest.finish();
|
2015-03-14 01:16:33 +03:00
|
|
|
}
|
|
|
|
|
2015-03-13 23:15:09 +03:00
|
|
|
function begin()
|
2015-03-14 01:16:33 +03:00
|
|
|
{
|
2015-03-13 23:15:09 +03:00
|
|
|
// Before we start loading things in iframes, set up postMessage handler.
|
|
|
|
registerPostMessageListener(startNextTest);
|
|
|
|
|
|
|
|
// Turn on prefs & start the first test!
|
|
|
|
SpecialPowers.pushPrefEnv(
|
|
|
|
{ set: [[PREF_UNPREFIXING_SERVICE, true],
|
2015-10-07 06:56:45 +03:00
|
|
|
[PREF_INCLUDE_TEST_DOMAINS, true],
|
|
|
|
// Make sure *native* -webkit prefix support is turned off. It's
|
|
|
|
// not whitelist-restricted, so if we left it enabled, it'd prevent
|
|
|
|
// us from being able to detect CSSUnprefixingService's domain
|
|
|
|
// whitelisting in this test.
|
|
|
|
["layout.css.prefixes.webkit", false]]},
|
2015-03-13 23:15:09 +03:00
|
|
|
startNextTest);
|
2015-02-26 23:07:08 +03:00
|
|
|
}
|
|
|
|
|
2015-03-13 23:15:09 +03:00
|
|
|
begin();
|
2015-02-26 23:07:08 +03:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|