Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / mochitest / test_isRemoteProxy.html
blob864407af9d8bc19ce35088aab7b2eebadd16c1e5
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
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"/>
8 </head>
9 <body>
10 <script>
12 async function addFrame(url) {
13 let frame = document.createElement("iframe");
14 frame.src = url;
15 document.body.appendChild(frame);
17 await new Promise(resolve => {
18 frame.addEventListener("load", resolve, { once: true });
19 });
21 return frame;
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");
39 ok(
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");
51 });
53 </script>
54 </body>
55 </html>