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

@ -27,6 +27,8 @@ pub(crate) struct SourceForm {
/// URL of the script, or URL of the page for inline scripts.
pub url: String,
pub is_black_boxed: bool,
/// `introductionType` in SpiderMonkey `CompileOptionsWrapper`.
pub introduction_type: String,
}
#[derive(Serialize)]
@ -53,6 +55,9 @@ pub struct SourceActor {
pub content: Option<String>,
pub content_type: Option<String>,
/// `introductionType` in SpiderMonkey `CompileOptionsWrapper`.
pub introduction_type: String,
}
#[derive(Serialize)]
@ -91,6 +96,7 @@ impl SourceActor {
url: ServoUrl,
content: Option<String>,
content_type: Option<String>,
introduction_type: String,
) -> SourceActor {
SourceActor {
name,
@ -98,6 +104,7 @@ impl SourceActor {
content,
content_type,
is_black_boxed: false,
introduction_type,
}
}
@ -107,10 +114,17 @@ impl SourceActor {
url: ServoUrl,
content: Option<String>,
content_type: Option<String>,
introduction_type: String,
) -> &SourceActor {
let source_actor_name = actors.new_name("source");
let source_actor = SourceActor::new(source_actor_name.clone(), url, content, content_type);
let source_actor = SourceActor::new(
source_actor_name.clone(),
url,
content,
content_type,
introduction_type,
);
actors.register(Box::new(source_actor));
actors.register_source_actor(pipeline_id, &source_actor_name);
@ -122,6 +136,7 @@ impl SourceActor {
actor: self.name.clone(),
url: self.url.to_string(),
is_black_boxed: self.is_black_boxed,
introduction_type: self.introduction_type.clone(),
}
}
}