Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groundwork for JS selfhosted code. #31594

Open
sagudev opened this issue Mar 9, 2024 · 2 comments
Open

Groundwork for JS selfhosted code. #31594

sagudev opened this issue Mar 9, 2024 · 2 comments
Labels
A-content/script Related to the script thread L-javascript Javascript is required

Comments

@sagudev
Copy link
Member

sagudev commented Mar 9, 2024

To enable loading self hosted code in SM, we firstly need to create safe wrappers for InitSelfHostedCode. Secondly we need to expose way to allow loading self hosted JS on JSRuntime creation. Relevant code in mozjs: https://github.com/servo/mozjs/blob/81906696dd9d062692dd5d68bd245cc0306de23e/mozjs/src/rust.rs#L361-L364. And lastly implement this in servo (and hide it behind pref).

We could load pollyfills for yet unimplemented functionalities using self hosted code.

EDIT: Self-hosted code is very restrictive: https://searchfox.org/mozilla-central/source/js/src/vm/SelfHosting.h#31. In Firefox only SM uses self hosted code (so it's only used for ES stuff).

Unresolved questions

Can you load multiple self hosted files or do all need to be merged into one?

How can self hosted JS code benefit servo (find candidates for self hosted code)? What's it's performance impact?

@sagudev sagudev added A-content/script Related to the script thread L-javascript Javascript is required labels Mar 9, 2024
@ektuu
Copy link
Contributor

ektuu commented Mar 12, 2024

Hey, I am an outreachy applicant and would wish to work on this issue.
could you assign this to me, or shall I start working and be ready with a draft PR?

Also, if you've any other good first issues, I would be glad, if you could help me identify one.

@sagudev
Copy link
Member Author

sagudev commented Mar 12, 2024

This issue isn't really good first issue, especially because it also requires work on mozjs. I suggest looking at E-Easy label for issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/script Related to the script thread L-javascript Javascript is required
Projects
None yet
Development

No branches or pull requests

2 participants