blob: 86fb3032a476a113db959c266493fe2d376c4b89 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test.js"></script>
<iframe id="testFrame" src="about:blank"></iframe>
<script>
description("Tests that Navigator properties do not get GC'd before their Navigator object.");
jsTestIsAsync = true;
var navigatorProperties = [ "geolocation", "mimeTypes", "plugins" ];
if (navigator.serviceWorker)
navigatorProperties.push("serviceWorker");
onload = function() {
frameNavigator = document.getElementById("testFrame").contentWindow.navigator;
for (let navigatorProperty of navigatorProperties)
eval("frameNavigator." + navigatorProperty + ".foo = 1;");
document.getElementById("testFrame").remove();
for (let navigatorProperty of navigatorProperties)
shouldBe("frameNavigator." + navigatorProperty + ".foo", "1");
debug("");
gc();
for (let navigatorProperty of navigatorProperties)
shouldBe("frameNavigator." + navigatorProperty + ".foo", "1");
debug("");
setTimeout(() => {
gc();
for (let navigatorProperty of navigatorProperties)
shouldBe("frameNavigator." + navigatorProperty + ".foo", "1");
finishJSTest();
}, 10);
}
</script>
</body>