summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /devtools/client/webconsole/test/browser
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/webconsole/test/browser')
-rw-r--r--devtools/client/webconsole/test/browser/_browser_console.toml3
-rw-r--r--devtools/client/webconsole/test/browser/browser_console_eager_eval_resolve.js64
-rw-r--r--devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_file.js14
3 files changed, 71 insertions, 10 deletions
diff --git a/devtools/client/webconsole/test/browser/_browser_console.toml b/devtools/client/webconsole/test/browser/_browser_console.toml
index d3d3d42146..e5530874ab 100644
--- a/devtools/client/webconsole/test/browser/_browser_console.toml
+++ b/devtools/client/webconsole/test/browser/_browser_console.toml
@@ -61,6 +61,9 @@ skip-if = [
["browser_console_eager_eval.js"]
+["browser_console_eager_eval_resolve.js"]
+skip-if = ["verify"]
+
["browser_console_enable_network_monitoring.js"]
skip-if = [
"verify",
diff --git a/devtools/client/webconsole/test/browser/browser_console_eager_eval_resolve.js b/devtools/client/webconsole/test/browser/browser_console_eager_eval_resolve.js
new file mode 100644
index 0000000000..cc2daa33ea
--- /dev/null
+++ b/devtools/client/webconsole/test/browser/browser_console_eager_eval_resolve.js
@@ -0,0 +1,64 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+// Check evaluating eager-evaluation values.
+const TEST_URI = "data:text/html;charset=utf8,<!DOCTYPE html>";
+
+add_task(async function () {
+ await addTab(TEST_URI);
+
+ await pushPref("devtools.chrome.enabled", true);
+
+ info("Open the Browser Console");
+ const hud = await BrowserConsoleManager.toggleBrowserConsole();
+
+ await executeResolveHookWithSideEffect(hud);
+});
+
+async function executeResolveHookWithSideEffect(hud) {
+ // Services.droppedLinkHandler is implemented with resolve hook, which imports
+ // ContentAreaDropListener.sys.mjs.
+ //
+ // In order to test the resolve hook behavior, ensure the module is not yet
+ // loaded, which ensures the property is not yet resolved.
+ //
+ // NOTE: This test is not compatible with verify mode, given it depends on the
+ // initial state of the Services object and the module.
+ is(
+ Cu.isESModuleLoaded(
+ "resource://gre/modules/ContentAreaDropListener.sys.mjs"
+ ),
+ false
+ );
+
+ setInputValue(hud, `Services.droppedLinkHandler`);
+
+ await wait(500);
+ // Eager evaluation should fail, due to the side effect in the resolve hook.
+ await waitForEagerEvaluationResult(hud, "");
+
+ setInputValue(hud, "");
+ await wait(500);
+
+ // The property should be resolved when evaluating after the eager evaluation.
+ await executeAndWaitForResultMessage(
+ hud,
+ `Services.droppedLinkHandler;`,
+ "XPCWrappedNative_NoHelper"
+ );
+
+ is(
+ Cu.isESModuleLoaded(
+ "resource://gre/modules/ContentAreaDropListener.sys.mjs"
+ ),
+ true
+ );
+
+ // Eager evaluation should work after the property is resolved.
+ setInputValue(hud, `Services.droppedLinkHandler`);
+ await wait(500);
+ await waitForEagerEvaluationResult(hud, /XPCWrappedNative_NoHelper/);
+}
diff --git a/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_file.js b/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_file.js
index f872745bbd..09e17594ab 100644
--- a/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_file.js
+++ b/devtools/client/webconsole/test/browser/browser_jsterm_screenshot_command_file.js
@@ -97,16 +97,10 @@ add_task(async function () {
const dayString = date.getDate().toString().padStart(2, "0");
const expectedDateString = `${date.getFullYear()}-${monthString}-${dayString}`;
- let screenshotDir;
- try {
- // This will throw if there is not a screenshot directory set for the platform
- screenshotDir = Services.dirsvc.get("Scrnshts", Ci.nsIFile).path;
- } catch (e) {
- const { Downloads } = ChromeUtils.importESModule(
- "resource://gre/modules/Downloads.sys.mjs"
- );
- screenshotDir = await Downloads.getPreferredDownloadsDirectory();
- }
+ const { Downloads } = ChromeUtils.importESModule(
+ "resource://gre/modules/Downloads.sys.mjs"
+ );
+ const screenshotDir = await Downloads.getPreferredDownloadsDirectory();
const { renderedDate, filePath } =
/Saved to (?<filePath>.*Screen Shot (?<renderedDate>\d{4}-\d{2}-\d{2}) at \d{2}.\d{2}.\d{2}\.png)/.exec(