blob: 3b19cd539d8418c0a7f3ef394ead4b9e94b68aba [file] [log] [blame]
<html>
<body>
<p>Tests source origin difference for cached resources.</p
<p>This succeeds if not crashing after applying memory pressure (https://bugs.webkit.org/show_bug.cgi?id=163887).</p>
<div id="console"></div>
<div>
<iframe id="iframe1"></iframe>
<iframe id="iframe2"></iframe>
</div>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.addEventListener("message", function(event) {
document.getElementById('console').innerHTML += event.data + "<br/>";
loadNextFrame();
});
var iframeURL8000 = "http://localhost:8000/security/resources/cross-origin-cached-resource-iframe.html";
var iframeURL8080 = "http://localhost:8080/security/resources/cross-origin-cached-resource-iframe.html";
var allowAllImage1 = "data:image/svg+xml;base64, " +
"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRw" +
"Oi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwJSIg" +
"aGVpZ2h0PSIxMDAlIiBmaWxsPSJMaWdodFNlYUdyZWVuIi8+PHJlY3QgeD0iMjAiIHk9IjIwIiB3" +
"aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSJyZWQiLz48aW1hZ2UgeD0iMjAiIHk9IjIw" +
"IiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bGluazpocmVmPSJkYXRhOmltYWdlL3N2Zyt4" +
"bWw7YmFzZTY0LFBITjJaeUI0Yld4dWN6MGlhSFIwY0RvdkwzZDNkeTUzTXk1dmNtY3ZNakF3TUM5" +
"emRtY2lJSGh0Ykc1ek9uaHNhVzVyUFNKb2RIUncNCk9pOHZkM2QzTG5jekxtOXlaeTh4T1RrNUwz" +
"aHNhVzVySWo0OGNtVmpkQ0I0UFNJd0lpQjVQU0l3SWlCM2FXUjBhRDBpTVRBd0pTSWcNCmFHVnBa" +
"MmgwU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VkpYVW05Vk1GSlANCkRRcGxSbXh5VW10S1VsWlZXa05WVjNS" +
"M1ZURmFWVlpyV21waVdGSk1WMnBLYTJKc1FsVk5SMnhSWVc1a01sbFdZM2hoUm05NVZsTjANClVW" +
"RjZiRFphUnpGcVN6QlNVbUl3TlVSYWVqQTVEUXBKYWpRNFRESnNkRmxYWkd4UWFuZDJZek5hYmxC" +
"blBUMGlQand2YVcxaFoyVSsNClBDOXpkbWMrIj48L2ltYWdlPjwvc3ZnPg==";
var counter = 0;
function loadNextFrame()
{
counter++;
// Four first tests try to load an image with a given origin and then the same image (in cache) with a different origin.
if (counter == 1)
document.getElementById('iframe1').src = iframeURL8000 + "#" +
encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage1, shouldPass:true, crossOrigin: "anonymous", id: 1}));
else if (counter == 2)
document.getElementById('iframe2').src = iframeURL8080 + "#" +
encodeURIComponent(JSON.stringify({node: "img", url: allowAllImage1, shouldPass: true, crossOrigin: "anonymous", id: 2}));
else
endTest();
}
function endTest()
{
// Removing iframe2 and applying memory pressure should kick in SVG CachedImage clearing of observer
document.getElementById('iframe2').src = "";
setTimeout(function() {
if (window.internals) {
internals.beginSimulatedMemoryPressure();
internals.endSimulatedMemoryPressure();
}
document.getElementById('console').innerHTML += "PASS applying memory pressure";
if (window.testRunner)
testRunner.notifyDone();
});
}
loadNextFrame();
</script>
</body>
</html>