browser_xhr_substituted_protocol_responseURL.js (839B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 */ 5 6 // Bug 1411725 - An XHR using a SubstitutingProtocolHandler channel 7 // (web-extension:, resource:, etc) should return the original URL, 8 // not the jar/file it was actually substituted for. 9 10 const TEST_URL = "resource://gre/modules/XPCOMUtils.sys.mjs"; 11 12 add_task(async function test() { 13 await new Promise(resolve => { 14 const xhr = new XMLHttpRequest(); 15 xhr.responseType = "text"; 16 xhr.open("get", TEST_URL); 17 xhr.addEventListener("loadend", () => { 18 is( 19 xhr.responseURL, 20 TEST_URL, 21 "original URL is given instead of substitution" 22 ); 23 resolve(); 24 }); 25 xhr.send(); 26 }); 27 });