blob: e44c95fda096a3438323c3da17730ef8ba863217 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
function frameScript() {
sendSyncMessage("Test:Message");
sendAsyncMessage("Test:Message");
sendAsyncMessage("Test:Done");
}
function test() {
waitForExplicitFinish();
var newTab = BrowserTestUtils.addTab(gBrowser, "about:blank");
gBrowser.selectedTab = newTab;
let browser = newTab.linkedBrowser;
let frameLoader = browser.frameLoader;
Assert.notStrictEqual(frameLoader, null, "frameLoader looks okay");
browser.messageManager.loadFrameScript(
"data:,(" + frameScript.toString() + ")()",
false
);
browser.messageManager.addMessageListener("Test:Message", msg => {
Assert.strictEqual(msg.target, browser, "<browser> is correct");
Assert.strictEqual(
msg.targetFrameLoader,
frameLoader,
"frameLoader is correct"
);
Assert.strictEqual(
browser.frameLoader,
msg.targetFrameLoader,
"browser frameloader is correct"
);
});
browser.messageManager.addMessageListener("Test:Done", () => {
info("Finished");
gBrowser.removeCurrentTab();
finish();
});
}
|