Commit Graph

10 Commits

Author SHA1 Message Date
Gae24
49adfed9a8 script: implement resolve_a_module_integrity_metadata (#42604)
`ImportMap` _integrity_ entry was practically unused, since it is only
needed for [resolving a module integrity
metadata](https://html.spec.whatwg.org/multipage/#resolving-a-module-integrity-metadata).
Now, we correctly initialize `ScriptFetchOptions` when loading a
module's descendants.
I slightly modified `nonimport-integrity.html` test to run
`modulepreload` test cases at the end. Since we haven't an
implementation for it, the test timeout, making the test cases that
comes after them not run.

Testing: More tests start passing
Part of #37553

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-02-14 10:26:49 +00:00
Sam
d5d400c7d6 script: Use CString for Error::Type and Error::Range (#42576)
Continuation of https://github.com/servo/servo/pull/42135, switch
Error::Type and Error::Range to also use CStrings internally, as they
are converted to CString for throwing JS exceptions (other get thrown as
DomException object, which uses rust string internally).

Changes in script crate are mechanical.

Testing: Should be covered by WPT tests.
Part of #42126

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2026-02-12 15:17:30 +00:00
Gae24
fe932a4d1f script: Start using &mut JSContext and wrappers2 functions inside module script code (#42294)
Start using `&mut JSContext` and wrappers2 functions for module script
code.


Testing: A successful build should be enough

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-02-04 06:01:23 +00:00
Gae24
9c4d17e9e1 script: support JSON modules (#42138)
With import attributes enabled we can now support non javascript
modules, for now we are limited to json ones.
Switch `GlobalScope` `modulemap` to be keyed by the tuple url and
module's type.

Testing: Enabled a new directory, new tests should pass

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2026-01-31 01:18:51 +00:00
Gae24
dfed00367a script: Enable module scripts import attributes (#42185)
While working on #42138 I found out that import attributes are an opt-in
feature, which can be enabled by `ContextOptionsRef`'s
`compileOptions_`.
This is likely the reason why `GetRequestedModuleSpecifier` wouldn't
fail.
Now we catch any `GetRequestedModuleSpecifier` exception and pass it to
`load_state`.

Testing: Covered by existing tests

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-01-29 07:46:02 +00:00
Gae24
047cb39fa9 script: Drop ModuleTree network_error and simplify pending fetches logic (#42127)
Since we use `NetworkError` just for logging reasons, we don't really
need to pass it around; instead lets follow spec more closely and pass a
`None` on network failures.
Make more explicit if a `modulemap` entry is currently fetching or
ready.

Testing: No functional change, covered by existing tests

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-01-26 05:43:12 +00:00
Krzysztof Biedroń
17e3061ecd script: Modify ModuleObject::handle() to return a handle with a lifetime (#42071)
Changed the return type of `ModuleObject::handle()` to the original type
of its contained handle by removing `.into()` call, as requested in the
linked issue.

Additional changes are due to temporary borrows now sharing lifetime
with returned handle reference.

Testing: No new tests needed, as the code is functionally the same after
the changes. Verified with running `./mach test-build` and `./mach
test-unit` successfully.
Fixes: https://github.com/servo/servo/issues/42051

Signed-off-by: Krzysztof Biedroń <arkendil@gmail.com>
2026-01-25 00:13:32 +00:00
Josh Matthews
7925a26a99 script: Use OnceCell instead of RefCell for some module fields. (#42119)
This better reflects the intention of the code, which is that these
fields are set at most one time.

Testing: No behaviour change expected, so existing tests suffice.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2026-01-24 06:53:33 +00:00
Gae24
b7ccf86cb8 script: remove more unused code (#42081)
This commit remove more unused code from `script_module`,
`inline_module_map` and `dynamic_modules` fields from `GlobalScope` and
the now unused custom interface `DynamicModuleOwner`.

Testing: No functional change, a successful build is enough.

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-01-22 15:12:09 +00:00
Gae24
a953ba954a script: revamp module script loading to follow current spec (#41779)
Rewrite module script fetching logic to follow current spec.

Testing: Covered by existing wpt tests
Fixes: #31397

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
2026-01-22 11:40:53 +00:00