common.js (763B)
1 // This file expects runTestInIframe to be in the global scope. 2 /* global runTestInIframe */ 3 4 window.onload = async function () { 5 // We are the parent. Let's load the test. 6 if (parent == this || !location.search.includes("worklet_iframe")) { 7 SimpleTest.waitForExplicitFinish(); 8 9 // configureTest is optional 10 if (window.configureTest) { 11 await window.configureTest(); 12 } 13 14 var iframe = document.createElement("iframe"); 15 iframe.src = location.href + "?worklet_iframe"; 16 document.body.appendChild(iframe); 17 18 return; 19 } 20 21 // Here we are in the iframe. 22 window.SimpleTest = parent.SimpleTest; 23 window.is = parent.is; 24 window.isnot = parent.isnot; 25 window.ok = parent.ok; 26 window.info = parent.info; 27 28 runTestInIframe(); 29 };