1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/tests/test_remote_frame.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.8 + <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script> 1.9 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.10 + <style> 1.11 + div, iframe { 1.12 + position:absolute; 1.13 + left:0; top:50px; 1.14 + width:400px; height:400px; 1.15 + transform: translateY(50px); 1.16 + border:5px solid black; 1.17 + } 1.18 + </style> 1.19 +</head> 1.20 + <body> 1.21 + <div id="d" style="background:blue"></div> 1.22 + 1.23 + <script type="application/javascript;version=1.7"> 1.24 + "use strict"; 1.25 + 1.26 + var referenceSnapshot; 1.27 + var iterations = 0; 1.28 + 1.29 + SimpleTest.waitForExplicitFinish(); 1.30 + 1.31 + function pollForTestPass() { 1.32 + var snapshot = snapshotWindow(window); 1.33 + if (compareSnapshots(referenceSnapshot, snapshot, true)[0]) { 1.34 + ok(true, "Test passed after " + iterations + " iterations"); 1.35 + SimpleTest.finish(); 1.36 + return; 1.37 + } 1.38 + 1.39 + ++iterations; 1.40 + if (iterations == 20) { 1.41 + todo(false, "We couldn't draw the frame, but at least we didn't crash"); 1.42 + SimpleTest.finish(); 1.43 + return; 1.44 + } 1.45 + setTimeout(pollForTestPass, 10); 1.46 + } 1.47 + function addRemoteFrame() { 1.48 + let iframe = document.createElement("iframe"); 1.49 + SpecialPowers.wrap(iframe).mozbrowser = true; 1.50 + iframe.src = "data:text/html,<html style='background:blue;'>"; 1.51 + 1.52 + document.body.appendChild(iframe); 1.53 + 1.54 + pollForTestPass(); 1.55 + } 1.56 + addEventListener("load", function() { 1.57 + referenceSnapshot = snapshotWindow(window); 1.58 + document.getElementById("d").style.display = 'none'; 1.59 + SpecialPowers.addPermission("browser", true, document); 1.60 + SpecialPowers.pushPrefEnv({ 1.61 + "set": [ 1.62 + ["dom.ipc.browser_frames.oop_by_default", true], 1.63 + ["dom.mozBrowserFramesEnabled", true] 1.64 + ] 1.65 + }, addRemoteFrame); 1.66 + }); 1.67 + </script> 1.68 +</body>