Fire a mozbrowseropenwindow event when an html anchor has a non-self target.

This commit is contained in:
Alan Jeffrey 2016-05-31 14:23:06 -05:00
parent 55b0bb027c
commit 835b6a9017
9 changed files with 115 additions and 8 deletions

View file

@ -6538,6 +6538,12 @@
"url": "/_mozilla/mozilla/mozbrowser/iframe_reload_twice.html"
}
],
"mozilla/mozbrowser/mozbrowser_click_fires_openwindow.html": [
{
"path": "mozilla/mozbrowser/mozbrowser_click_fires_openwindow.html",
"url": "/_mozilla/mozilla/mozbrowser/mozbrowser_click_fires_openwindow.html"
}
],
"mozilla/mozbrowser/mozbrowser_loadevents.html": [
{
"path": "mozilla/mozbrowser/mozbrowser_loadevents.html",

View file

@ -0,0 +1,27 @@
<head>
<title>Browser API; mozbrowseropenwindow event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
async_test(function(t) {
var iframe = document.createElement("iframe");
iframe.mozbrowser = "true";
iframe.src = "mozbrowser_click_fires_openwindow_iframe1.html";
iframe.addEventListener("mozbrowseropenwindow", t.step_func(function(e) {
var expectedURL = new URL("mozbrowser_click_fires_openwindow_iframe3.html", window.location.href);
assert_equals(e.detail.target, "_blank");
assert_equals(e.detail.url.toString(), expectedURL.toString());
t.done();
}));
document.body.appendChild(iframe);
});
</script>
</body>

View file

@ -0,0 +1,8 @@
<html>
<body>
Frame 1: <a id="anchor" href="mozbrowser_click_fires_openwindow_iframe2.html">go</a>.
</body>
<script>
document.getElementById("anchor").click()
</script>
</html>

View file

@ -0,0 +1,8 @@
<html>
<body>
Frame 2: <a id="anchor" href="mozbrowser_click_fires_openwindow_iframe3.html" target="_blank">go</a>.
</body>
<script>
document.getElementById("anchor").click()
</script>
</html>

View file

@ -0,0 +1,5 @@
<html>
<body>
Frame 3.
</body>
</html>