diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/style/test/test_unprefixing_service.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/style/test/test_unprefixing_service.html')
-rw-r--r-- | layout/style/test/test_unprefixing_service.html | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/layout/style/test/test_unprefixing_service.html b/layout/style/test/test_unprefixing_service.html new file mode 100644 index 000000000..c489e2ac0 --- /dev/null +++ b/layout/style/test/test_unprefixing_service.html @@ -0,0 +1,93 @@ +<!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> + <script type="application/javascript;version=1.7" src="unprefixing_service_utils.js"></script> + <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"> + <iframe id="testIframe"></iframe> +</div> +<pre id="test"> +<script type="application/javascript;version=1.7"> +"use strict"; +SimpleTest.waitForExplicitFinish(); + +/** + * 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() +{ + // 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; + } + + // 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; + } + + // Both arrays empty --> we're done. + SimpleTest.finish(); +} + +function begin() +{ + // 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], + [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]]}, + startNextTest); +} + +begin(); + +</script> +</pre> +</body> +</html> |