test_bug1328865.js (1679B)
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 "use strict"; 6 7 const { NetUtil } = ChromeUtils.importESModule( 8 "resource://gre/modules/NetUtil.sys.mjs" 9 ); 10 11 // Check that reading non existant inner jars results in the right error 12 13 add_task(async function () { 14 var file = do_get_file("data/test_bug597702.zip"); 15 var outerJarBase = "jar:" + Services.io.newFileURI(file).spec + "!/"; 16 var goodSpec = 17 "jar:" + outerJarBase + "inner.jar!/hello#!/ignore%20this%20part"; 18 var goodChannel = NetUtil.newChannel({ 19 uri: goodSpec, 20 loadUsingSystemPrincipal: true, 21 }); 22 var instr = goodChannel.open(); 23 24 ok(!!instr, "Should be able to open channel"); 25 }); 26 27 add_task(async function () { 28 var file = do_get_file("data/test_bug597702.zip"); 29 var outerJarBase = "jar:" + Services.io.newFileURI(file).spec + "!/"; 30 var goodSpec = 31 "jar:" + outerJarBase + "inner.jar!/hello?ignore%20this%20part!/"; 32 var goodChannel = NetUtil.newChannel({ 33 uri: goodSpec, 34 loadUsingSystemPrincipal: true, 35 }); 36 var instr = goodChannel.open(); 37 38 ok(!!instr, "Should be able to open channel"); 39 }); 40 41 add_task(async function () { 42 var file = do_get_file("data/test_bug597702.zip"); 43 var outerJarBase = "jar:" + Services.io.newFileURI(file).spec + "!/"; 44 var goodSpec = "jar:" + outerJarBase + "inner.jar!/hello?ignore#this!/part"; 45 var goodChannel = NetUtil.newChannel({ 46 uri: goodSpec, 47 loadUsingSystemPrincipal: true, 48 }); 49 var instr = goodChannel.open(); 50 51 ok(!!instr, "Should be able to open channel"); 52 });