blob: c1757014b53eed5254f4fd57f5e5bbd2f68332f3 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Test counting of third-party script imports in workers</title>
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/util.js"></script>
</head>
<body onload="runTest()">
<script>
function finishTest() {
testRunner.dumpResourceLoadStatistics();
setEnableFeature(false, function() {
testRunner.notifyDone();
});
}
function receiveMessage(event) {
if (event.data.indexOf("PASS") === -1)
testFailed(event.data.replace("FAIL ", ""));
testRunner.statisticsNotifyObserver();
}
function runTest() {
switch (document.location.hash) {
case "":
if (window.testRunner && window.internals) {
setEnableFeature(true, function() {
testRunner.setUseITPDatabase(true);
testRunner.waitUntilDone();
testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(true);
testRunner.installStatisticsDidScanDataRecordsCallback(finishTest);
document.location.hash = "LoadWorker";
runTest();
});
}
break;
case "#LoadWorker":
let w1 = new Worker("resources/worker-importing-localhost-script.js");
w1.onmessage = receiveMessage;
w1.postMessage("shouldNotReceiveCookies");
break;
}
}
</script>
</body>
</html>