mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #9740 - paulrouget:mozbrowserconnected, r=jdm
Support Browser API event mozbrowserconnected Fixes https://github.com/servo/servo/issues/9382 This new event is not yet documented. If this lands, I will add documentation to MDN. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9740) <!-- Reviewable:end -->
This commit is contained in:
commit
42f1712846
5 changed files with 67 additions and 6 deletions
|
@ -5934,6 +5934,12 @@
|
|||
"url": "/_mozilla/mozilla/mozbrowser/iframe_reload_twice.html"
|
||||
}
|
||||
],
|
||||
"mozilla/mozbrowser/mozbrowser_loadevents.html": [
|
||||
{
|
||||
"path": "mozilla/mozbrowser/mozbrowser_loadevents.html",
|
||||
"url": "/_mozilla/mozilla/mozbrowser/mozbrowser_loadevents.html"
|
||||
}
|
||||
],
|
||||
"mozilla/mozbrowser/mozbrowsericonchange_event.html": [
|
||||
{
|
||||
"path": "mozilla/mozbrowser/mozbrowsericonchange_event.html",
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<head>
|
||||
<title>mozbrowserloadstart, mozbrowserconnected and mozbrowserloadend are dispatched</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
async_test(function(t) {
|
||||
|
||||
var has_reloaded = false;
|
||||
var expectedEvents = [
|
||||
"mozbrowserloadstart",
|
||||
"mozbrowserconnected",
|
||||
"mozbrowserloadend",
|
||||
"mozbrowserloadstart",
|
||||
"mozbrowserconnected",
|
||||
"mozbrowserloadend",
|
||||
];
|
||||
|
||||
var receivedEvents = [];
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.mozbrowser = "true";
|
||||
iframe.src = "http://web-platform.test:8000";
|
||||
|
||||
for (var event_name of ["mozbrowserloadstart",
|
||||
"mozbrowserconnected",
|
||||
"mozbrowserloadend"]) {
|
||||
iframe.addEventListener(event_name, t.step_func(e => {
|
||||
receivedEvents.push(e.type);
|
||||
if (receivedEvents.length == expectedEvents.length) {
|
||||
assert_array_equals(receivedEvents, expectedEvents);
|
||||
t.done();
|
||||
} else {
|
||||
if (e.type == "mozbrowserloadend") {
|
||||
iframe.reload();
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue