gecko-dev/dom/serviceworkers/test/test_imagecache_max_age.html
Brian Grinstead 0d460e3432 Bug 1544322 - Part 2.2 - Remove the [type] attribute for one-liner <script> tags loading files in /tests/SimpleTest/ in dom/ r=bzbarsky
This is split from the previous changeset since if we include dom/ the file size is too
large for phabricator to handle.

This is an autogenerated commit to handle scripts loading mochitest harness files, in
the simple case where the script src is on the same line as the tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 2` argument.

Differential Revision: https://phabricator.services.mozilla.com/D27457

--HG--
extra : moz-landing-system : lando
2019-04-16 03:53:28 +00:00

72 lines
2.5 KiB
HTML

<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<title>Test that the image cache respects a synthesized image's Cache headers</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content">
<iframe></iframe>
</div>
<pre id="test"></pre>
<script class="testbody" type="text/javascript">
var iframe;
var framesLoaded = 0;
function runTest() {
iframe = document.querySelector("iframe");
iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache-maxage/register.html";
window.onmessage = function(e) {
if (e.data.status == "ok") {
ok(e.data.result, e.data.message);
} else if (e.data.status == "registrationdone") {
iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache-maxage/index.html";
} else if (e.data.status == "result") {
switch (++framesLoaded) {
case 1:
is(e.data.url, "image-20px.png", "Correct url expected");
is(e.data.url2, "image-20px.png", "Correct url expected");
is(e.data.width, 20, "Correct width expected");
is(e.data.width2, 20, "Correct width expected");
// Wait for 100ms so that the image gets expired.
setTimeout(function() {
iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache-maxage/index.html?new"
}, 100);
break;
case 2:
is(e.data.url, "image-40px.png", "Correct url expected");
is(e.data.url2, "image-40px.png", "Correct url expected");
is(e.data.width, 40, "Correct width expected");
is(e.data.width2, 40, "Correct width expected");
iframe.src = "/tests/dom/serviceworkers/test/fetch/imagecache-maxage/unregister.html";
break;
default:
ok(false, "This should never happen");
}
} else if (e.data.status == "unregistrationdone") {
window.onmessage = null;
SimpleTest.finish();
}
};
}
SimpleTest.requestFlakyTimeout("This test needs to simulate the passing of time");
SimpleTest.waitForExplicitFinish();
onload = function() {
SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
]}, runTest);
};
</script>
</pre>
</body>
</html>