"); document.documentElement.appendChild(gFrame); }, function testInheritFromCurrent_system(cb) { loadListener(gFrame, function () { is(window.inheritedSystem, undefined, "load in type=content iframe shouldn't inherit system principal from current document"); cb(); }, true); gFrame.setAttribute("src", "data:text/html,
"); }, function testInheritFromCreated(cb) { // Open a new chrome window with a type="content" iframe, so that it has no // same-type parent. // Load a javascript: URI in it to ensure that GetInheritedPrincipal will // force creation of a content viewer. let xulWinURL = 'data:application/xhtml+xml,' + ''; let newWin = window.browsingContext.topChromeWindow.openDialog(xulWinURL, "chrome_window", "chrome"); loadListener(newWin, function () { let frame = newWin.document.createXULElement("iframe"); frame.setAttribute("type", "content"); frame.setAttribute("src", "javascript:'1';"); loadListener(frame, function () { is(frame.contentWindow.document.body.textContent, "1", "content viewer was created"); SimpleTest.executeSoon(function () { newWin.close(); cb(); }) }); newWin.document.documentElement.appendChild(frame); }); } ]; addLoadEvent(function onLoad() { ok(Components.stack, "this test must be run with the system principal"); SpecialPowers.pushPrefEnv({"set": [ ["security.data_uri.unique_opaque_origin", false]]}, nextTest); }); function loadListener(target, func) { target.addEventListener("load", function lis() { target.removeEventListener("load", lis, true); func(); }, true); } function nextTest() { if (tests.length) { let test = tests.shift(); SimpleTest.executeSoon(function () { info("running " + test.name); test(nextTest); }); } else SimpleTest.executeSoon(SimpleTest.finish); } ]]>