| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="/js-test-resources/js-test.js"></script> |
| <script src="/resourceLoadStatistics/resources/util.js"></script> |
| <script> |
| description("Tests that document.hasStorageAccess() returns false for a 3rd-party iframe by default."); |
| jsTestIsAsync = true; |
| |
| window.addEventListener("message", receiveMessage, false); |
| |
| function receiveMessage(event) { |
| if (event.origin === "http://localhost:8000") { |
| if (event.data.indexOf("PASS") !== -1) |
| testPassed(event.data.replace("PASS ", "")); |
| else |
| testFailed(event.data.replace("FAIL ", "")); |
| } else |
| testFailed("Received a message from an unexpected origin: " + event.origin); |
| setEnableFeature(false, finishJSTest); |
| } |
| |
| const hostUnderTest = "localhost:8000"; |
| const statisticsUrl = "http://" + hostUnderTest + "/temp"; |
| function runTest() { |
| setEnableFeature(true, function() { |
| let iframeElement = document.createElement("iframe"); |
| iframeElement.id = "TheIframeThatRequestsStorageAccess"; |
| iframeElement.src = "http://localhost:8000/storageAccess/resources/has-storage-access-iframe.html#policyShouldDenyAccess"; |
| document.body.appendChild(iframeElement); |
| }); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| </body> |
| </html> |