devtools: Expose introductionType to devtools clients (#38541)

in the devtools protocol, [source
forms](https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html#loading-script-sources)
announced in `resources-available-array` messages can include the
`introductionType`, which more or less mirrors the field of the same
name in SpiderMonkey’s CompileOptions.

this patch exposes `introductionType` accordingly, allowing us to check
for the correct values in automated tests.

Testing: new coverage in devtools tests
Fixes: part of #36027

---------

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
shuppy 2025-08-08 20:20:30 +08:00 committed by GitHub
parent 23c0947072
commit c9541f2906
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 232 additions and 42 deletions

View file

@ -1249,7 +1249,21 @@ impl Runnable {
pub(crate) use script_bindings::script_runtime::CanGc;
/// `introductionType` values in SpiderMonkey TransitiveCompileOptions.
///
/// Value definitions are based on the SpiderMonkey Debugger API docs:
/// <https://firefox-source-docs.mozilla.org/js/Debugger/Debugger.Source.html#introductiontype>
// TODO: squish `scriptElement` <https://searchfox.org/mozilla-central/rev/202069c4c5113a1a9052d84fa4679d4c1b22113e/devtools/server/actors/source.js#199-201>
pub(crate) struct IntroductionType;
impl IntroductionType {
pub const INLINE_SCRIPT: &'static CStr = c"inlineScript";
/// `introductionType` for code belonging to `<script src="file.js">` elements.
/// This includes `<script type="module" src="...">`.
pub const SRC_SCRIPT: &CStr = c"srcScript";
/// `introductionType` for code belonging to `<script>code;</script>` elements.
/// This includes `<script type="module" src="...">`.
pub const INLINE_SCRIPT: &CStr = c"inlineScript";
/// `introductionType` for web workers.
/// <https://searchfox.org/mozilla-central/rev/202069c4c5113a1a9052d84fa4679d4c1b22113e/devtools/docs/user/debugger-api/debugger.source/index.rst#96>
pub const WORKER: &CStr = c"Worker";
}