5 <title>Tests for Cu.isRemoteProxy
</title>
6 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
12 async
function addFrame(url
) {
13 let frame
= document
.createElement("iframe");
15 document
.body
.appendChild(frame
);
17 await
new Promise(resolve
=> {
18 frame
.addEventListener("load", resolve
, { once
: true });
24 add_task(async
function() {
25 const { Cu
} = SpecialPowers
;
27 let localFrame
= await
addFrame("file_empty.html");
28 let remoteFrame
= await
addFrame(
29 SimpleTest
.getTestFileURL("file_empty.html")
30 .replace("mochi.test:8888", "example.com"));
32 ok(frames
[0] === localFrame
.contentWindow
, "frames[0] is localFrame");
33 ok(frames
[1] === remoteFrame
.contentWindow
, "frames[1] is remoteFrame");
35 ok(!Cu
.isRemoteProxy(window
), "window is not a remote proxy");
36 ok(!Cu
.isRemoteProxy(location
), "location is not a remote proxy");
38 ok(!Cu
.isRemoteProxy(frames
[0]), "frames[0] is not a remote proxy");
40 !Cu
.isRemoteProxy(frames
[0].location
),
41 "frames[0].location is not a remote proxy"
44 // The processes will be remote only with isolateEverything strategy
45 const expected
= SpecialPowers
.effectiveIsolationStrategy() == SpecialPowers
.ISOLATION_STRATEGY
.IsolateEverything
;
47 is(Cu
.isRemoteProxy(frames
[1]), expected
,
48 "frames[1] is a remote proxy if Fission is enabled and strategy is isolateEverything");
49 is(Cu
.isRemoteProxy(frames
[1].location
), expected
,
50 "frames[1].location is a remote proxy if Fission is enabled and strategy is isolateEverything");