mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
basic iframe.goBack() test
This commit is contained in:
parent
e7449d541f
commit
abc127ac23
2 changed files with 43 additions and 0 deletions
|
@ -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",
|
||||
|
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue