From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../shared/tests/xpcshell/test_fetch-chrome.js | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 devtools/shared/tests/xpcshell/test_fetch-chrome.js (limited to 'devtools/shared/tests/xpcshell/test_fetch-chrome.js') diff --git a/devtools/shared/tests/xpcshell/test_fetch-chrome.js b/devtools/shared/tests/xpcshell/test_fetch-chrome.js new file mode 100644 index 0000000000..38021d49c9 --- /dev/null +++ b/devtools/shared/tests/xpcshell/test_fetch-chrome.js @@ -0,0 +1,36 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +// Tests for DevToolsUtils.fetch on chrome:// URI's. + +const URL_FOUND = "chrome://devtools-shared/locale/debugger.properties"; +const URL_NOT_FOUND = "chrome://this/is/not/here.js"; + +/** + * Test that non-existent files are handled correctly. + */ +add_task(async function test_missing() { + await DevToolsUtils.fetch(URL_NOT_FOUND).then( + result => { + info(result); + ok(false, "fetch resolved unexpectedly for non-existent chrome:// URI"); + }, + () => { + ok(true, "fetch rejected as the chrome:// URI was non-existent."); + } + ); +}); + +/** + * Tests that existing files are handled correctly. + */ +add_task(async function test_normal() { + await DevToolsUtils.fetch(URL_FOUND).then(result => { + notDeepEqual( + result.content, + "", + "chrome:// URI seems to be read correctly." + ); + }); +}); -- cgit v1.2.3