5 <title>XSLT error results shouldn't replace documents loaded during the transform
</title>
6 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css"/>
9 SimpleTest
.waitForExplicitFinish();
11 async
function runTest() {
12 const crossOriginLocation
= "https://example.org/tests/dom/xslt/tests/mochitest/file_bug1769155.html";
13 const sjs
= new URL("bug1769155.sjs", location
.href
);
14 // During the XSLT processing we redirect by setting location and then
15 // spin the event loop using synchronous XHR, so that the location change
16 // happens while we're still processing the XSLT.
18 <?xml-stylesheet type="application/xml" href="#sheet"?>
19 <stylesheet id="sheet" version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
21 <script xmlns="http://www.w3.org/1999/xhtml">
22 location = "${crossOriginLocation}";
23 let xhr = new XMLHttpRequest();
24 xhr.open("GET", "${sjs.href}", false);
30 let win
= window
.open();
32 let redirected
= new Promise((resolve
) => {
33 addEventListener("message", resolve
, { once
: true });
36 SpecialPowers
.spawn(win
, [xml
], value
=> {
37 content
.location
= URL
.createObjectURL(new Blob([ value
], { type
: "application/xml" }));
41 // At this point the setting of window.location should have redirected us to
42 // a cross-origin site.
49 ok(threw
, "Accessing a property on a cross-origin window should fail.");
57 <body onload=
"runTest();">
59 <div id=
"content" style=
"display: none"></div>