layout/base/tests/test_remote_frame.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:c8ea4ab609c6
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
5 <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
7 <style>
8 div, iframe {
9 position:absolute;
10 left:0; top:50px;
11 width:400px; height:400px;
12 transform: translateY(50px);
13 border:5px solid black;
14 }
15 </style>
16 </head>
17 <body>
18 <div id="d" style="background:blue"></div>
19
20 <script type="application/javascript;version=1.7">
21 "use strict";
22
23 var referenceSnapshot;
24 var iterations = 0;
25
26 SimpleTest.waitForExplicitFinish();
27
28 function pollForTestPass() {
29 var snapshot = snapshotWindow(window);
30 if (compareSnapshots(referenceSnapshot, snapshot, true)[0]) {
31 ok(true, "Test passed after " + iterations + " iterations");
32 SimpleTest.finish();
33 return;
34 }
35
36 ++iterations;
37 if (iterations == 20) {
38 todo(false, "We couldn't draw the frame, but at least we didn't crash");
39 SimpleTest.finish();
40 return;
41 }
42 setTimeout(pollForTestPass, 10);
43 }
44 function addRemoteFrame() {
45 let iframe = document.createElement("iframe");
46 SpecialPowers.wrap(iframe).mozbrowser = true;
47 iframe.src = "data:text/html,<html style='background:blue;'>";
48
49 document.body.appendChild(iframe);
50
51 pollForTestPass();
52 }
53 addEventListener("load", function() {
54 referenceSnapshot = snapshotWindow(window);
55 document.getElementById("d").style.display = 'none';
56 SpecialPowers.addPermission("browser", true, document);
57 SpecialPowers.pushPrefEnv({
58 "set": [
59 ["dom.ipc.browser_frames.oop_by_default", true],
60 ["dom.mozBrowserFramesEnabled", true]
61 ]
62 }, addRemoteFrame);
63 });
64 </script>
65 </body>

mercurial