Source code

Revision control

Other Tools

1
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
"use strict";
6
7
var EXPORTED_SYMBOLS = ["BrowserTestUtilsParent"];
8
9
class BrowserTestUtilsParent extends JSWindowActorParent {
10
receiveMessage(aMessage) {
11
switch (aMessage.name) {
12
case "DOMContentLoaded":
13
case "load": {
14
let event = new CustomEvent(
15
`BrowserTestUtils:ContentEvent:${aMessage.name}`,
16
{
17
detail: {
18
browsingContext: this.browsingContext,
19
...aMessage.data,
20
},
21
}
22
);
23
24
let browser = this.browsingContext.top.embedderElement;
25
if (browser) {
26
browser.dispatchEvent(event);
27
}
28
29
break;
30
}
31
}
32
}
33
}