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