2 var EXPORTED_SYMBOLS = ["AllowJavascriptChild"];
4 class AllowJavascriptChild extends JSWindowActorChild {
5 async receiveMessage(msg) {
7 case "CheckScriptsAllowed":
8 return this.checkScriptsAllowed();
9 case "CheckFiredLoadEvent":
10 return this.contentWindow.wrappedJSObject.gFiredOnload;
12 return this.createIframe(msg.data.url);
18 if (event.type === "load") {
19 this.sendAsyncMessage("LoadFired");
23 checkScriptsAllowed() {
24 let win = this.contentWindow;
26 win.wrappedJSObject.gFiredOnclick = false;
27 win.document.body.click();
28 return win.wrappedJSObject.gFiredOnclick;
31 async createIframe(url) {
32 let doc = this.contentWindow.document;
34 let iframe = doc.createElement("iframe");
36 doc.body.appendChild(iframe);
38 await new Promise(resolve => {
39 iframe.addEventListener("load", resolve, { once: true });
42 return iframe.browsingContext;