basic iframe.goBack() test

This commit is contained in:
Paul Rouget 2015-12-08 19:15:59 +01:00
parent e7449d541f
commit abc127ac23
2 changed files with 43 additions and 0 deletions

View file

@ -5679,6 +5679,12 @@
"url": "/_mozilla/mozilla/load_event.html"
}
],
"mozilla/mozbrowser/iframe_goback.html": [
{
"path": "mozilla/mozbrowser/iframe_goback.html",
"url": "/_mozilla/mozilla/mozbrowser/iframe_goback.html"
}
],
"mozilla/mozbrowser/mozbrowsericonchange_event.html": [
{
"path": "mozilla/mozbrowser/mozbrowsericonchange_event.html",

View file

@ -0,0 +1,37 @@
<head>
<title>iframe.goBack()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
async_test(function(t) {
var url2 = "data:,a";
var url1 = `data:text/html,<script>setTimeout(() => location.assign("${url2}"), 0)</${"script"}>`;
var locations = []
var expected_locations = [url1, url2, url1];
var iframe = document.createElement("iframe");
iframe.mozbrowser = "true";
iframe.src = url1;
iframe.addEventListener("mozbrowserlocationchange", e => {
locations.push(e.detail);
if (e.detail == url2) {
iframe.goBack();
}
if (locations.length == expected_locations.length) {
assert_array_equals(locations, expected_locations);
t.done();
}
});
document.body.appendChild(iframe);
});
</script>
</body>