| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="/js-test-resources/js-test.js"></script> |
| <script> |
| description("Make sure that StorageAreaMap objects do no leak."); |
| jsTestIsAsync = true; |
| localStorage.setItem("foo", "bar"); |
| |
| onload = function() { |
| initialStorageAreaMapCount = internals.storageAreaMapCount; |
| |
| // We use 4 frames, one per origin that we support in layout tests so that we get 4 StorageAreaMap objects |
| // and 4 Storage JS wrappers. Because our GC is conservative, we consider that this test is passing if |
| // any of the Storage JS wrappers gets collected and thus any of the underlying StorageAreaMap objects |
| // get destroyed. |
| document.getElementById("testFrame1").remove(); |
| document.getElementById("testFrame2").remove(); |
| document.getElementById("testFrame3").remove(); |
| document.getElementById("testFrame4").remove(); |
| |
| handle = setInterval(() => { |
| gc() |
| if (internals.storageAreaMapCount < initialStorageAreaMapCount) { |
| testPassed("StorageAreaMap objects are not leaking"); |
| clearInterval(handle); |
| finishJSTest(); |
| } |
| }, 10); |
| } |
| </script> |
| <iframe id="testFrame1" src="http://localhost:8000/storage/resources/storage-map-leaking-iframe.html"></iframe> |
| <iframe id="testFrame2" src="https://localhost:8443/storage/resources/storage-map-leaking-iframe.html"></iframe> |
| <iframe id="testFrame3" src="http://127.0.0.1:8443/storage/resources/storage-map-leaking-iframe.html"></iframe> |
| <iframe id="testFrame4" src="https://127.0.0.1:8443/storage/resources/storage-map-leaking-iframe.html"></iframe> |
| </body> |
| </html> |