Auto merge of #11542 - asajeffrey:mozbrowser-send-opentab-event, r=paulrouget

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

<!-- Please describe your changes on the following line: -->
When an html anchor has a non-self target, fire a `mozbrowseropenwindow` event.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #11539.
- [X] These changes do not require tests because we don't have the infrastructure for mozbrowser testing yet.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11542)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-06-02 09:45:26 -05:00
commit bdecfa13d2
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>