tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 305f1022d1e65466b1cd97bcc0c5e69b5e556fc5
parent cd7482e4abb9eee6b1af21b422a8ed4f43edcf90
Author: Valentin Gosu <valentin.gosu@gmail.com>
Date:   Tue,  4 Nov 2025 21:03:49 +0000

Bug 1940027 - Test r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D234674

Diffstat:
Amodules/libjar/test/unit/test_bug1940027_embedded_null.js | 29+++++++++++++++++++++++++++++
Mmodules/libjar/test/unit/xpcshell.toml | 2++
2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/modules/libjar/test/unit/test_bug1940027_embedded_null.js b/modules/libjar/test/unit/test_bug1940027_embedded_null.js @@ -0,0 +1,29 @@ +// Should report file not found on non-existent files + +const { NetUtil } = ChromeUtils.importESModule( + "resource://gre/modules/NetUtil.sys.mjs" +); +const path = "data/uncompressed.zip"; + +function run_test() { + var spec = "jar:" + Services.io.newFileURI(do_get_file(path)).spec + "!/"; + var channel = NetUtil.newChannel({ + uri: spec + "hello", + loadUsingSystemPrincipal: true, + }); + let stream = channel.open(); + ok(stream); + stream.close(); + + Assert.throws( + () => { + channel = NetUtil.newChannel({ + uri: spec + "hello%00.js", + loadUsingSystemPrincipal: true, + }); + channel.open(); + }, + /NS_ERROR_FILE_NOT_FOUND/, + "An embedded null must not truncate the path being loaded" + ); +} diff --git a/modules/libjar/test/unit/xpcshell.toml b/modules/libjar/test/unit/xpcshell.toml @@ -48,6 +48,8 @@ support-files = [ ["test_bug1550815.js"] run-if = ["false"] # recovering from SIGBUS is temporarily disabled by bug 1583735 +["test_bug1940027_embedded_null.js"] + ["test_corrupt_1211262.js"] ["test_corrupt_1801102.js"]