blob: 1afac5982234be95512418417c96418b75dbc128 [file] [log] [blame]
<script src="../../js-test-resources/js-test-pre.js"></script>
<body>
<script>
jsTestIsAsync = true;
function waitForStylesheet(iframe, completionHandler)
{
var link = iframe.contentDocument.getElementsByTagName('link')[0];
if (internals.isStyleSheetLoadingSubresources(link)) {
setTimeout(function () { waitForStylesheet(iframe, completionHandler) }, 10);
return;
}
completionHandler(link);
}
function load(src, completionHandler)
{
var iframe = document.createElement("iframe");
iframe.src = "resources/stylesheet-html.py?sheet=" + src;
iframe.onload = function () {
iframe.contentDocument.body.offsetWidth;
waitForStylesheet(iframe, completionHandler);
};
document.body.appendChild(iframe);
}
function testSharing(src, expected, completionHandler)
{
load(src, function (linkA) {
load(src, function (linkB) {
styleSheetContentsShared = internals.isSharingStyleSheetContents(linkA, linkB);
debug(src);
if (expected)
shouldBeTrue("styleSheetContentsShared");
else
shouldBeFalse("styleSheetContentsShared");
completionHandler();
});
});
}
testSharing("shareable.css", true, function () {
testSharing("non-shareable.css", false, function () {
finishJSTest();
});
});
</script>
<script src="../../js-test-resources/js-test-post.js"></script>