diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/markup/test/browser_markup_events_source_map.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/inspector/markup/test/browser_markup_events_source_map.js')
-rw-r--r-- | devtools/client/inspector/markup/test/browser_markup_events_source_map.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_events_source_map.js b/devtools/client/inspector/markup/test/browser_markup_events_source_map.js new file mode 100644 index 0000000000..39fb3c0575 --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_events_source_map.js @@ -0,0 +1,54 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Check that source maps work in the event popup. + +const INITIAL_URL = URL_ROOT_SSL + "doc_markup_void_elements.html"; +const TEST_URL = URL_ROOT_SSL + "doc_markup_events-source_map.html"; + +/* import-globals-from helper_events_test_runner.js */ +loadHelperScript("helper_events_test_runner.js"); + +const TEST_DATA = [ + { + selector: "#clicky", + isSourceMapped: true, + expected: [ + { + type: "click", + filename: "webpack:///events_original.js:7", + attributes: ["Bubbling"], + handler: `function clickme() { + console.log("clickme"); +}`, + }, + ], + }, +]; + +add_task(async function () { + // Load some other URL before opening the toolbox, then navigate to + // the test URL. This ensures that source map service will see the + // sources as they are loaded, avoiding any races. + const { toolbox, inspector } = await openInspectorForURL(INITIAL_URL); + + // Ensure the source map service is operating. This looks a bit + // funny, but sourceMapURLService is a getter, and we don't need the + // result. + toolbox.sourceMapURLService; + + await navigateTo(TEST_URL); + + await inspector.markup.expandAll(); + + for (const test of TEST_DATA) { + await checkEventsForNode(test, inspector); + } + + // Wait for promises to avoid leaks when running this as a single test. + // We need to do this because we have opened a bunch of popups and don't them + // to affect other test runs when they are GCd. + await promiseNextTick(); +}); |