Allow embedder to indicate whether scripts are inline#603
Merged
Conversation
Co-authored-by: atbrakhi <[email protected]> Signed-off-by: Delan Azabani <[email protected]>
This was referenced Jul 30, 2025
sagudev
reviewed
Jul 30, 2025
Co-authored-by: atbrakhi <[email protected]> Signed-off-by: Delan Azabani <[email protected]>
Co-authored-by: atbrakhi <[email protected]> Signed-off-by: Delan Azabani <[email protected]>
Co-authored-by: atbrakhi <[email protected]> Signed-off-by: Delan Azabani <[email protected]>
sagudev
reviewed
Aug 5, 2025
sagudev
approved these changes
Aug 5, 2025
Member
sagudev
left a comment
There was a problem hiding this comment.
Otherwise this looks good to go.
Co-authored-by: atbrakhi <[email protected]> Signed-off-by: Delan Azabani <[email protected]>
Signed-off-by: Delan Azabani <[email protected]>
Member
Author
|
thanks for the feedback! i’ll update servo/servo#38363 and wait until we can land them together :) |
github-merge-queue Bot
pushed a commit
to servo/servo
that referenced
this pull request
Aug 5, 2025
to use the [SpiderMonkey Debugger API](https://firefox-source-docs.mozilla.org/js/Debugger/) as the single source of truth about scripts and their sources for devtools purposes (#38334), the debugger script needs to be able to distinguish inline scripts from other scripts, because inline scripts are a special case where the source contents need to come from the Servo parser. the mechanism for this is [Debugger.Script.prototype.**introductionType**](https://firefox-source-docs.mozilla.org/js/Debugger/Debugger.Source.html#introductiontype), which is `inlineScript` for inline scripts or a variety of other values for other kinds of scripts, but only the embedder can provide this information. this patch bumps mozjs to servo/mozjs#603, which expands on CompileOptionsWrapper, making it a safe wrapper around CompileOptions. to construct one from safe code, use Runtime::new_compile_options(). then you can call `set_introduction_type(&'static CStr)` on the new instance. we also make Runtime::evaluate_script() take a CompileOptionsWrapper from the caller, instead of constructing one internally. in this patch, we set the introductionType to `c"inlineScript"` when calling run_a_classic_script() and compile_module_script() for inline scripts, and leave it unset all other cases. Testing: will undergo automated tests in #38334 Fixes: part of #36027, part of #38378 --------- Signed-off-by: Delan Azabani <[email protected]> Co-authored-by: atbrakhi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
to use the SpiderMonkey Debugger API as the single source of truth about scripts and their sources for devtools purposes (servo/servo#38334), the debugger script needs to be able to distinguish inline scripts from other scripts, because inline scripts are a special case where the source contents need to come from the Servo parser.
the mechanism for this is Debugger.Script.prototype.introductionType, which is
inlineScriptfor inline scripts or a variety of other values for other kinds of scripts, but only the embedder can provide this information.this patch expands on CompileOptionsWrapper, making it a safe wrapper around CompileOptions. to construct one from safe code, use Runtime::new_compile_options(). then you can call
set_introduction_type(&'static CStr)on the new instance. we also make Runtime::evaluate_script() take a CompileOptionsWrapper from the caller, instead of constructing one internally.Servo patch: servo/servo#38363
Fixes: part of servo/servo#38378