зеркало из https://github.com/mozilla/gecko-dev.git
Bug 552605 - Write tests to make sure we reload images that are redirected with a Cache-Control: no-cache header. r=bz
This commit is contained in:
Родитель
9084147b6f
Коммит
c32bb8010a
|
@ -0,0 +1,7 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Bug 89419</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<img src="http://mochi.test:8888/tests/docshell/test/chrome/bug89419.sjs">
|
||||||
|
</body>
|
|
@ -44,6 +44,9 @@ include $(DEPTH)/config/autoconf.mk
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
_HTTP_FILES = \
|
_HTTP_FILES = \
|
||||||
|
bug89419.sjs \
|
||||||
|
blue.png \
|
||||||
|
red.png \
|
||||||
92598_nostore.html \
|
92598_nostore.html \
|
||||||
92598_nostore.html^headers^ \
|
92598_nostore.html^headers^ \
|
||||||
112564_nocache.html \
|
112564_nocache.html \
|
||||||
|
@ -58,6 +61,9 @@ _HTTP_FILES = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
_TEST_FILES = \
|
_TEST_FILES = \
|
||||||
|
test_bug89419.xul \
|
||||||
|
bug89419_window.xul \
|
||||||
|
89419.html \
|
||||||
test_bug92598.xul \
|
test_bug92598.xul \
|
||||||
bug92598_window.xul \
|
bug92598_window.xul \
|
||||||
92598_nostore.html \
|
92598_nostore.html \
|
||||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 2.7 KiB |
|
@ -0,0 +1,13 @@
|
||||||
|
function handleRequest(request, response)
|
||||||
|
{
|
||||||
|
var redirectstate = "/docshell/test/chrome/bug89419.sjs";
|
||||||
|
response.setStatusLine("1.1", 302, "Found");
|
||||||
|
if (getState(redirectstate) == "") {
|
||||||
|
response.setHeader("Location", "red.png", false);
|
||||||
|
setState(redirectstate, "red");
|
||||||
|
} else {
|
||||||
|
response.setHeader("Location", "blue.png", false);
|
||||||
|
setState(redirectstate, "");
|
||||||
|
}
|
||||||
|
response.setHeader("Cache-Control", "no-cache", false);
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||||
|
|
||||||
|
<window id="89419Test"
|
||||||
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
width="600"
|
||||||
|
height="600"
|
||||||
|
onload="setTimeout(nextTest,0);"
|
||||||
|
title="bug 89419 test">
|
||||||
|
|
||||||
|
<script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
|
||||||
|
<script type="application/javascript" src="docshell_helpers.js" />
|
||||||
|
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||||
|
|
||||||
|
<script type="application/javascript"><![CDATA[
|
||||||
|
// Define the generator-iterator for the tests.
|
||||||
|
var tests = testIterator();
|
||||||
|
|
||||||
|
////
|
||||||
|
// Execute the next test in the generator function.
|
||||||
|
//
|
||||||
|
function nextTest() {
|
||||||
|
tests.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
////
|
||||||
|
// Generator function for test steps for bug 89419:
|
||||||
|
// A visited link should have the :visited style applied
|
||||||
|
// to it when displayed on a page which was fetched from
|
||||||
|
// the bfcache.
|
||||||
|
//
|
||||||
|
function testIterator()
|
||||||
|
{
|
||||||
|
// Load a test page containing an image referring to the sjs that returns
|
||||||
|
// a different redirect every time it's loaded.
|
||||||
|
doPageNavigation({
|
||||||
|
uri: getHttpUrl("89419.html"),
|
||||||
|
onNavComplete: nextTest,
|
||||||
|
preventBFCache: true
|
||||||
|
});
|
||||||
|
yield;
|
||||||
|
|
||||||
|
var first = snapshotWindow(TestWindow.getWindow());
|
||||||
|
|
||||||
|
doPageNavigation({
|
||||||
|
uri: "about:blank",
|
||||||
|
onNavComplete: nextTest
|
||||||
|
});
|
||||||
|
yield;
|
||||||
|
|
||||||
|
var second = snapshotWindow(TestWindow.getWindow());
|
||||||
|
function snapshotsEqual(snap1, snap2) {
|
||||||
|
return compareSnapshots(snap1, snap2, true)[0];
|
||||||
|
}
|
||||||
|
ok(!snapshotsEqual(first, second), "about:blank should not be the same as the image web page");
|
||||||
|
|
||||||
|
doPageNavigation({
|
||||||
|
back: true,
|
||||||
|
onNavComplete: nextTest
|
||||||
|
});
|
||||||
|
yield;
|
||||||
|
|
||||||
|
var third = snapshotWindow(TestWindow.getWindow());
|
||||||
|
ok(!snapshotsEqual(third, second), "going back should not be the same as about:blank");
|
||||||
|
ok(snapshotsEqual(first, third), "going back should be the same as the initial load");
|
||||||
|
|
||||||
|
// Tell the framework the test is finished. Include the final 'yield'
|
||||||
|
// statement to prevent a StopIteration exception from being thrown.
|
||||||
|
finish();
|
||||||
|
yield;
|
||||||
|
}
|
||||||
|
|
||||||
|
]]></script>
|
||||||
|
|
||||||
|
<browser type="content-primary" flex="1" id="content" src="about:blank"/>
|
||||||
|
</window>
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 82 B |
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||||
|
<?xml-stylesheet
|
||||||
|
href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||||
|
type="text/css"?>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=89419.xul
|
||||||
|
-->
|
||||||
|
<window title="Mozilla Bug 89419"
|
||||||
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
|
|
||||||
|
<title>Test for Bug 89419</title>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
|
||||||
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<a target="_blank"
|
||||||
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=89419">
|
||||||
|
Mozilla Bug 89419</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="content" style="display: none">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<pre id="test">
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script class="testbody" type="application/javascript">
|
||||||
|
<![CDATA[
|
||||||
|
|
||||||
|
/** Test for Bug 89419 **/
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
window.open("bug89419_window.xul", "bug89419",
|
||||||
|
"chrome,width=600,height=600");
|
||||||
|
|
||||||
|
]]>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</window>
|
|
@ -76,6 +76,10 @@ _TEST_FILES = imgutils.js \
|
||||||
test_bug614392.html \
|
test_bug614392.html \
|
||||||
test_bug657191.html \
|
test_bug657191.html \
|
||||||
bug657191.sjs \
|
bug657191.sjs \
|
||||||
|
bug89419-iframe.html \
|
||||||
|
bug89419.sjs \
|
||||||
|
test_bug89419-1.html \
|
||||||
|
test_bug89419-2.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# Tests disabled due to intermittent orange
|
# Tests disabled due to intermittent orange
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Bug 89419 iframe</title>
|
||||||
|
<body>
|
||||||
|
<img src="bug89419.sjs" width="100" height="100" />
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,13 @@
|
||||||
|
function handleRequest(request, response)
|
||||||
|
{
|
||||||
|
var redirectstate = "/modules/libpr0n/test/mochitest/bug89419.sjs";
|
||||||
|
response.setStatusLine("1.1", 302, "Found");
|
||||||
|
if (getState(redirectstate) == "") {
|
||||||
|
response.setHeader("Location", "red.png", false);
|
||||||
|
setState(redirectstate, "red");
|
||||||
|
} else {
|
||||||
|
response.setHeader("Location", "blue.png", false);
|
||||||
|
setState(redirectstate, "");
|
||||||
|
}
|
||||||
|
response.setHeader("Cache-Control", "no-cache", false);
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=89419
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<title>Test for Bug 89419</title>
|
||||||
|
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.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=89419">Mozilla Bug 89419</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<pre id="test">
|
||||||
|
<script type="application/javascript">
|
||||||
|
|
||||||
|
var first, second, third;
|
||||||
|
var correct, val1, val2;
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
function checkFirst()
|
||||||
|
{
|
||||||
|
var iframeelem = document.getElementById('test-iframe');
|
||||||
|
first = snapshotWindow(iframeelem.contentWindow, false);
|
||||||
|
|
||||||
|
iframeelem.onload = checkSecond;
|
||||||
|
iframeelem.contentWindow.location.reload(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkSecond()
|
||||||
|
{
|
||||||
|
var iframeelem = document.getElementById('test-iframe');
|
||||||
|
second = snapshotWindow(iframeelem.contentWindow, false);
|
||||||
|
|
||||||
|
// Check that we actually reloaded.
|
||||||
|
[correct, val1, val2] = compareSnapshots(first, second, false);
|
||||||
|
ok(correct, "Image should have changed after the first reload.");
|
||||||
|
|
||||||
|
iframeelem.onload = checkThird;
|
||||||
|
iframeelem.contentWindow.location.reload(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkThird()
|
||||||
|
{
|
||||||
|
var iframeelem = document.getElementById('test-iframe');
|
||||||
|
third = snapshotWindow(iframeelem.contentWindow, false);
|
||||||
|
|
||||||
|
// Check that we actually reloaded.
|
||||||
|
[correct, val1, val2] = compareSnapshots(second, third, false);
|
||||||
|
ok(correct, "Image should have changed after the second reload.");
|
||||||
|
|
||||||
|
// Make sure we looped back to the first image.
|
||||||
|
[correct, val1, val2] = compareSnapshots(first, third, true);
|
||||||
|
ok(correct, "Third image should match first image.");
|
||||||
|
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
<div id="content"> <!-- style="display: none" -->
|
||||||
|
<iframe id="test-iframe" src="bug89419-iframe.html" onload="checkFirst()"></iframe>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,68 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=89419
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<title>Test for Bug 89419</title>
|
||||||
|
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.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=89419">Mozilla Bug 89419</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
<pre id="test">
|
||||||
|
<script type="application/javascript">
|
||||||
|
|
||||||
|
var first, second, third;
|
||||||
|
var correct, val1, val2;
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
function checkFirst()
|
||||||
|
{
|
||||||
|
var iframeelem = document.getElementById('test-iframe');
|
||||||
|
first = snapshotWindow(iframeelem.contentWindow, false);
|
||||||
|
|
||||||
|
iframeelem.onload = checkSecond;
|
||||||
|
iframeelem.contentWindow.location.href = iframeelem.contentWindow.location.href;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkSecond()
|
||||||
|
{
|
||||||
|
var iframeelem = document.getElementById('test-iframe');
|
||||||
|
second = snapshotWindow(iframeelem.contentWindow, false);
|
||||||
|
|
||||||
|
// Check that we actually reloaded.
|
||||||
|
[correct, val1, val2] = compareSnapshots(first, second, false);
|
||||||
|
ok(correct, "Image should have changed after the first reload.");
|
||||||
|
|
||||||
|
iframeelem.onload = checkThird;
|
||||||
|
iframeelem.contentWindow.location.href = iframeelem.contentWindow.location.href;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkThird()
|
||||||
|
{
|
||||||
|
var iframeelem = document.getElementById('test-iframe');
|
||||||
|
third = snapshotWindow(iframeelem.contentWindow, false);
|
||||||
|
|
||||||
|
// Check that we actually reloaded.
|
||||||
|
[correct, val1, val2] = compareSnapshots(second, third, false);
|
||||||
|
ok(correct, "Image should have changed after the second reload.");
|
||||||
|
|
||||||
|
// Make sure we looped back to the first image.
|
||||||
|
[correct, val1, val2] = compareSnapshots(first, third, true);
|
||||||
|
ok(correct, "Third image should match first image.");
|
||||||
|
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
<div id="content"> <!-- style="display: none" -->
|
||||||
|
<iframe id="test-iframe" src="bug89419-iframe.html" onload="checkFirst()"></iframe>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -3,7 +3,7 @@ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||||
var gWindowUtils;
|
var gWindowUtils;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gWindowUtils = window.QueryInterface(CI.nsIInterfaceRequestor).getInterface(CI.nsIDOMWindowUtils);
|
gWindowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||||
if (gWindowUtils && !gWindowUtils.compareCanvases)
|
if (gWindowUtils && !gWindowUtils.compareCanvases)
|
||||||
gWindowUtils = null;
|
gWindowUtils = null;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче