Commit Graph
41 Commits
Author SHA1 Message Date
Jonatan Klemets 5d9da99e61 Bug 1877792 - Part 8: Add module type to ModuleLoadRequest::NewVisitedSetForTopLevelImport r=spidermonkey-reviewers,dom-worker-reviewers,dom-core,asuth,jonco,mccr8
This patch adds the new parameter to the `NewVisitedSetForTopLevelImport`
method, but we hard-code the module type (which will be addressed in a later
patch)

Differential Revision: https://phabricator.services.mozilla.com/D218555
2024-09-03 08:10:50 +00:00
Jonatan Klemets becd3a556a Bug 1877792 - Part 7: Add ModuleLoadRequest::mModuleType r=dom-core,spidermonkey-reviewers,dom-worker-reviewers,asuth,jonco,mccr8
This patch gets rid of most hard-coded `JS::ModuleType::JavaScript` in
`js/loader/ModuleLoaderBase.cpp`. However, the module type is still hard-coded
when constructing the `ModuleLoadRequest` (will be addressed in a later patch).

Differential Revision: https://phabricator.services.mozilla.com/D218554
2024-09-03 08:10:50 +00:00
Cristina Horotan a842adb0d9 Backed out 20 changesets (bug 1877792) for causing wpt failures at importscripts_mime_local.any.sharedworker.html CLOSED TREE
Backed out changeset 19d78d0b6ee4 (bug 1877792)
Backed out changeset 14f104e5ce51 (bug 1877792)
Backed out changeset 662eb52b2a6f (bug 1877792)
Backed out changeset 48dc4035a14f (bug 1877792)
Backed out changeset d98ecddf2f59 (bug 1877792)
Backed out changeset 1234a31ff88f (bug 1877792)
Backed out changeset a3b5b0cde6ce (bug 1877792)
Backed out changeset a1f494b9592a (bug 1877792)
Backed out changeset a4d7565218f3 (bug 1877792)
Backed out changeset fe179004423b (bug 1877792)
Backed out changeset 39a20aee3942 (bug 1877792)
Backed out changeset 95b20763e650 (bug 1877792)
Backed out changeset d763241fccaf (bug 1877792)
Backed out changeset 0674cf646120 (bug 1877792)
Backed out changeset bd23c96418b6 (bug 1877792)
Backed out changeset 5b1e29e4c597 (bug 1877792)
Backed out changeset 3cead4149e6b (bug 1877792)
Backed out changeset d73a9f57f03c (bug 1877792)
Backed out changeset 82a58a80f58a (bug 1877792)
Backed out changeset 4c7182604e4f (bug 1877792)
2024-08-22 19:23:15 +03:00
Jonatan Klemets 1d65cffc8b Bug 1877792 - Part 8: Add module type to ModuleLoadRequest::NewVisitedSetForTopLevelImport r=spidermonkey-reviewers,dom-worker-reviewers,dom-core,asuth,jonco,mccr8
This patch adds the new parameter to the `NewVisitedSetForTopLevelImport`
method, but we hard-code the module type (which will be addressed in a later
patch)

Differential Revision: https://phabricator.services.mozilla.com/D218555
2024-08-22 14:21:51 +00:00
Jonatan Klemets fa63416707 Bug 1877792 - Part 7: Add ModuleLoadRequest::mModuleType r=dom-core,spidermonkey-reviewers,dom-worker-reviewers,asuth,jonco,mccr8
This patch gets rid of most hard-coded `JS::ModuleType::JavaScript` in
`js/loader/ModuleLoaderBase.cpp`. However, the module type is still hard-coded
when constructing the `ModuleLoadRequest` (will be addressed in a later patch).

Differential Revision: https://phabricator.services.mozilla.com/D218554
2024-08-22 14:21:50 +00:00
Emilio Cobos Álvarez de09ab0dd6 Bug 1887719 - More consistently use UTF8String/nsCString for URLs. r=necko-reviewers,webidl,anti-tracking-reviewers,places-reviewers,jari,kershaw,janv,smaug,hsivonen
Sorry for the massive patch but I found it hard to split without
introducing a bunch of copies around...

This mostly makes necko and DOM agree on which strings to use, which
should result on less copies and conversions.

Differential Revision: https://phabricator.services.mozilla.com/D205601
2024-04-04 11:49:57 +00:00
Gijs Kruitbosch dd4ec5a77c Bug 1881800 - chrome/system-privileged fetch should not use credentials, r=necko-reviewers,barret,valentin,peterv
Differential Revision: https://phabricator.services.mozilla.com/D203258
2024-03-26 16:50:44 +00:00
Iulian Moraru b12ba0dce4 Backed out 2 changesets (bug 1881800) for causing non unified build bustages on nsIPrincipal.h. CLOSED TREE
Backed out changeset 1710585070f0 (bug 1881800)
Backed out changeset 9da17ae527f3 (bug 1881800)
2024-03-26 15:46:50 +02:00
Gijs Kruitbosch 8d6bd6e5b0 Bug 1881800 - chrome/system-privileged fetch should not use credentials, r=necko-reviewers,barret,valentin,peterv
Differential Revision: https://phabricator.services.mozilla.com/D203258
2024-03-26 12:38:54 +00:00
Tooru Fujisawa ad3f8f8a06 Bug 1800641 - Part 8: Add LoadContextBase* parameter to ScriptLoadRequest methods which is going to be moved to LoadedScriptDelegate. r=nbp
Depends on D197845

Differential Revision: https://phabricator.services.mozilla.com/D197846
2024-01-08 14:57:38 +00:00
Tooru Fujisawa 9b4d6d328e Bug 1800641 - Part 7: Add ScriptLoadRequest::State::{CheckingCache,PendingFetchingError}. r=nbp
Depends on D197844

Differential Revision: https://phabricator.services.mozilla.com/D197845
2024-01-08 14:57:38 +00:00
Noemi Erli 46e817bca8 Backed out changeset 4d6294424819 (bug 1800641) for causing Bug 1872347 2023-12-29 16:23:18 +02:00
Nicolas B. Pierron 7ad7f045d4 Bug 1800641 - Move some ScriptLoadRequest fields into LoadedScript. r=yulia
We are looking into caching loaded script in memory. To do so we need something
to cache.

At the moment, the `ScriptLoadRequest` structure hold all the fields which are
loaded, and used before executing JavaScript code. Then, the `ScriptLoadRequest`
is not guaranteed to out-live the first execution.

Therefore, we have to move fields out of the `ScriptLoadRequest` such that they
can later be used by any caching mechanism. The `LoadedScript` is the closest
existing structure which exists which fit the description.

This patch moves fields out of the ScriptLoadRequest into the `LoadedScript`,
which already has a `LoadedScript` field.

The `LoadedScript` field is initialized sooner, when the `ScriptLoadRequest` is
created, to be subsituted later by a real cache implementation. At the moment
the function `ScriptLoadRequest::NoCacheEntryFound` is used as a placeholder to
change the state of the `ScriptLoadRequest` from `CheckingCache` to `Fetching`.
Existing initializations are replaced by assertions to fail in debug build if
the current patch does not reproduce the expected state properly.

The `LoadedScript` get fields such as the source text, the text length, the
bytecode buffer (which also contains SRI), and the offset at which the bytecode
starts within the bytecode buffer. As these fields are no longer reachable by
name, multiple accessors are added to work-around the issue. Using this as an
opportunity to add extra assertions as part of these accessors.

A new class named `LoadedScriptDelegate` is added to re-add, by inheritance, all
the accessors which used to be part of `ScriptLoadRequest` as methods which are
delegating to the field which is holding the `LoadedScript`. This class is using
templates to avoid virtual inheritance which might hinder inlining, especially
since `ScriptLoadRequest` cannot be made final, as `ModuleLoadRequest` extends
it.

The `ScriptFetchOptions` structure is moved to its own file to solve C++ include
issues.

Differential Revision: https://phabricator.services.mozilla.com/D163615
2023-12-25 09:46:54 +00:00
Cosmin Sabou 78d82c8098 Backed out changeset f69f493b2f3c (bug 1800641) for causing non-unified build bustages on LoadedScript.cpp. CLOSED TREE 2023-12-25 08:38:51 +02:00
Nicolas B. Pierron d60b4bd3b1 Bug 1800641 - Move some ScriptLoadRequest fields into LoadedScript. r=yulia
We are looking into caching loaded script in memory. To do so we need something
to cache.

At the moment, the `ScriptLoadRequest` structure hold all the fields which are
loaded, and used before executing JavaScript code. Then, the `ScriptLoadRequest`
is not guaranteed to out-live the first execution.

Therefore, we have to move fields out of the `ScriptLoadRequest` such that they
can later be used by any caching mechanism. The `LoadedScript` is the closest
existing structure which exists which fit the description.

This patch moves fields out of the ScriptLoadRequest into the `LoadedScript`,
which already has a `LoadedScript` field.

The `LoadedScript` field is initialized sooner, when the `ScriptLoadRequest` is
created, to be subsituted later by a real cache implementation. At the moment
the function `ScriptLoadRequest::NoCacheEntryFound` is used as a placeholder to
change the state of the `ScriptLoadRequest` from `CheckingCache` to `Fetching`.
Existing initializations are replaced by assertions to fail in debug build if
the current patch does not reproduce the expected state properly.

The `LoadedScript` get fields such as the source text, the text length, the
bytecode buffer (which also contains SRI), and the offset at which the bytecode
starts within the bytecode buffer. As these fields are no longer reachable by
name, multiple accessors are added to work-around the issue. Using this as an
opportunity to add extra assertions as part of these accessors.

A new class named `LoadedScriptDelegate` is added to re-add, by inheritance, all
the accessors which used to be part of `ScriptLoadRequest` as methods which are
delegating to the field which is holding the `LoadedScript`. This class is using
templates to avoid virtual inheritance which might hinder inlining, especially
since `ScriptLoadRequest` cannot be made final, as `ModuleLoadRequest` extends
it.

The `ScriptFetchOptions` structure is moved to its own file to solve C++ include
issues.

Differential Revision: https://phabricator.services.mozilla.com/D163615
2023-12-25 05:50:53 +00:00
Yoshi Cheng-Hao Huang 2b03ca80a7 Bug 1841859 - Part 1: Move ReferrerPolicy to ScriptLoadRequest and LoadedScript. r=jonco,smaug
Suggested by jonco during review,
https://phabricator.services.mozilla.com/D186944#inline-1036982

Differential Revision: https://phabricator.services.mozilla.com/D187385
2023-09-20 17:32:15 +00:00
Jan de Mooij 64f0528008 Bug 1851854 - Use SetPrefableContextOptions for worklet JS ContextOptions. r=mccr8
`SetPrefableContextOptions` currently has to be called on the main thread, so store
the options in `StartModuleLoadRunnable` and copy them on the worklet thread.

This doesn't update the options when the prefs are changed, but we've been moving
to read-on-startup for prefs so we probably don't need that.

Differential Revision: https://phabricator.services.mozilla.com/D187767
2023-09-11 10:09:45 +00:00
Mirko Brodesser 3de23172d3 Bug 1839316: part 4) Add RequestPriority to ScriptFetchOptions and ScriptLoadRequest. r=smaug
The request priority isn't propagated from `ScriptFetchOptions`, so
setting it has no effect for end-users. That will be implemented in a
following part.

Differential Revision: https://phabricator.services.mozilla.com/D183483
2023-08-28 11:56:34 +00:00
Cosmin Sabou 70b514ed8e Backed out 5 changesets (bug 1839316) for causing bustages on ScriptLoader.cpp. CLOSED TREE
Backed out changeset 85f107e082ee (bug 1839316)
Backed out changeset 8c1e22518c3a (bug 1839316)
Backed out changeset a4c3dec0f34c (bug 1839316)
Backed out changeset 313ff15742dd (bug 1839316)
Backed out changeset fa200e26bbb1 (bug 1839316)
2023-08-09 20:16:06 +03:00
Mirko Brodesser fcb70e3246 Bug 1839316: part 4) Add RequestPriority to ScriptFetchOptions and ScriptLoadRequest. r=smaug
The request priority isn't propagated from `ScriptFetchOptions`, so
setting it has no effect for end-users. That will be implemented in a
following part.

Differential Revision: https://phabricator.services.mozilla.com/D183483
2023-08-09 13:50:28 +00:00
Cosmin Sabou 1ea8eb8868 Backed out 5 changesets (bug 1839316) for causing leaks. CLOSED TREE
Backed out changeset 75edff380fee (bug 1839316)
Backed out changeset 6a622fd5cd91 (bug 1839316)
Backed out changeset 60908cc7c586 (bug 1839316)
Backed out changeset 7b9dd8875a9e (bug 1839316)
Backed out changeset b586915187c2 (bug 1839316)
2023-08-07 16:43:03 +03:00
Mirko Brodesser e0b84f81a4 Bug 1839316: part 4) Add RequestPriority to ScriptFetchOptions and ScriptLoadRequest. r=smaug
The request priority isn't propagated from `ScriptFetchOptions`, so
setting it has no effect for end-users. That will be implemented in a
following part.

Differential Revision: https://phabricator.services.mozilla.com/D183483
2023-08-07 11:46:19 +00:00
Tom Schuster 91477557ae Bug 1843002 - Add parser-metadata to ScriptFetchOptions. r=allstarschh,smaug
Differential Revision: https://phabricator.services.mozilla.com/D183366
2023-07-21 17:28:02 +00:00
Tom Schuster bcfda085d6 Bug 1843002 - Add nonce to ScriptFetchOptions. r=allstarschh,smaug
Differential Revision: https://phabricator.services.mozilla.com/D183365
2023-07-21 17:28:02 +00:00
Stanca Serban b42c5eaa6a Backed out 6 changesets (bug 1313937, bug 1843066, bug 1843002) for causing build bustages in ScriptLoadRequest.h. CLOSED TREE
Backed out changeset 84c2d1c04aa2 (bug 1313937)
Backed out changeset 7cab9a1ea25f (bug 1313937)
Backed out changeset affc7d1f130d (bug 1313937)
Backed out changeset e13aacfe7944 (bug 1843066)
Backed out changeset 21a9bee8f772 (bug 1843002)
Backed out changeset d381b6365111 (bug 1843002)
2023-07-21 17:41:04 +03:00
Tom Schuster 320e8d0d9d Bug 1843002 - Add parser-metadata to ScriptFetchOptions. r=allstarschh,smaug
Differential Revision: https://phabricator.services.mozilla.com/D183366
2023-07-21 12:31:23 +00:00
Tom Schuster 91054529c2 Bug 1843002 - Add nonce to ScriptFetchOptions. r=allstarschh,smaug
Differential Revision: https://phabricator.services.mozilla.com/D183365
2023-07-21 12:31:22 +00:00
Nika Layzell a51fa32bd1 Bug 1826206 - Require nsISerialEventTarget for RetargetDeliveryTo, r=necko-reviewers,valentin
This avoids potential issues where multiple OnDataAvailable callbacks or
similar could theoretically be called concurrently on different
StreamTransportService threads when targeting the STS - these cases will
now target a TaskQueue on the STS instead, structurally ensuring serial
execution.

Differential Revision: https://phabricator.services.mozilla.com/D179984
2023-06-07 14:48:38 +00:00
Yoshi Cheng-Hao Huang f8e32f89c2 Bug 1823568: Hold referrer with nsCOMPtr in StartModuleLoadRunnable. r=yulia,peterv
We use a nsCOMPtr to hold referrer to prevent it from being freed before the
Worklet thread starts.

Differential Revision: https://phabricator.services.mozilla.com/D173816
2023-03-31 09:56:27 +00:00
Yoshi Cheng-Hao Huang 7b4740e90a Bug 1572644 - Part 12-2: Add mErrorToRethrow to hold the JS::Value in WorkletFetchHandler. r=jonco,yulia
Add a JS::Heap<JS::Value> in WorkletFetchHandler to hold the script's
error to rethrow object.

This also requires to change WorkletFetchHandler to a CC class so it can trace the
mErrorToRetrhow



Depends on D166550

Differential Revision: https://phabricator.services.mozilla.com/D170162
2023-03-13 22:59:42 +00:00
Yoshi Cheng-Hao Huang c2f6a4b899 Bug 1572644 - Part 12-1: Using StructuredCloneHolder to pass a JS::Value from a worklet thread to main thread. r=jonco,yulia
Depends on D170161

Differential Revision: https://phabricator.services.mozilla.com/D166550
2023-03-13 22:59:41 +00:00
Yoshi Cheng-Hao Huang 465db5b418 Bug 1572644 - Part 11-2: Preload localized error msg and format it when resolving failed. r=jonco,yulia
Depends on D166549

Differential Revision: https://phabricator.services.mozilla.com/D170161
2023-03-13 22:59:41 +00:00
Yoshi Cheng-Hao Huang f23e82cf4a Bug 1572644 - Part 10: Implement WorkletModuleLoader::OnModuleLoadComplete. r=jonco,yulia
Depends on D166547

Differential Revision: https://phabricator.services.mozilla.com/D166548
2023-03-13 22:59:40 +00:00
Yoshi Cheng-Hao Huang d8ac694178 Bug 1572644 - Part 7-2: Add FetchCompleteRunnable to call OnFetchComplete. r=jonco,yulia
Add a Runnable class called FetchCompleteRunnable to be dispatched from
main thread to worklet thread to call
ModuleLoadRequest::OnFetchComplete.



Depends on D167468

Differential Revision: https://phabricator.services.mozilla.com/D166545
2023-03-13 22:59:39 +00:00
Yoshi Cheng-Hao Huang e59f1a84ce Bug 1572644 - Part 6: Set CORS and referrer on the Request. r=jonco,yulia
Depends on D166543

Differential Revision: https://phabricator.services.mozilla.com/D166544
2023-03-13 22:59:38 +00:00
Yoshi Cheng-Hao Huang b7a6616e3b Bug 1572644 - Part 5-2: Implement WorkletModuleLoader::StartFetch with WorkletFetchHandler::StartFetch method. r=jonco,yulia
Move the fetch code into WorkletFetchHandler::StartFetch, which will be
called by WorkletModuleLoader::StartFetch.



Depends on D167041

Differential Revision: https://phabricator.services.mozilla.com/D166543
2023-03-13 22:59:38 +00:00
Yoshi Cheng-Hao Huang 2b4eb33a16 Bug 1572644 - Part 5-1: Remove mErrorStatus and mURL from WorkletFetchHandler. r=jonco,yulia
WorkletFetchHandler will fetch not only the top level module script
but also its dependent modules, so the mURL should be removed.

For the mErrorStatus, if the existing WorkletFetchHandler has been rejected,
we only handle the case of AbortError here. For the case when "the script's
error to rethrow is not null", we will handle that in the later patch.
See:
https://phabricator.services.mozilla.com/D170162 and
https://phabricator.services.mozilla.com/D166550



Depends on D166542

Differential Revision: https://phabricator.services.mozilla.com/D167041
2023-03-13 22:59:37 +00:00
Yoshi Cheng-Hao Huang a800ffea91 Bug 1572644 - Part 4: Add WorkletLoadContext and nsMainThreadPtrHandle to delegate WorkletFetchHandler on the worklet thread. r=jonco,yulia
Add nsMainThreadPtrHandle to delegate WorkletFetchHandler.
Add WorkletLoadContext to wrap nsMainThreadPtrHandle.



Depends on D166541

Differential Revision: https://phabricator.services.mozilla.com/D166542
2023-03-13 22:59:37 +00:00
Yoshi Cheng-Hao Huang 32b3d9b5ad Bug 1572644 - Part 3: Add StartModuleLoadRunnable. r=jonco,yulia
Add a Runnable class called StartModuleLoadRunnable, which is dispatched
from main thread to worklet thread to call
ModuleLoadRequest::StartModuleLoad.



Depends on D166540

Differential Revision: https://phabricator.services.mozilla.com/D166541
2023-03-13 22:59:37 +00:00
Yoshi Cheng-Hao Huang 93a7c9d895 Bug 1572644 - Part 1-2: Add WorkletScriptHandler. r=jonco,yulia
Add a class called WorkletScriptHandler to handle the loading of each
module script.



Depends on D166539

Differential Revision: https://phabricator.services.mozilla.com/D167042
2023-03-13 22:59:36 +00:00
Yoshi Cheng-Hao Huang a8ac1e5792 Bug 1572644 - Part 1-1: Move WorkletFetchHandler to its own file. r=jonco
This is a refactoring to move WorkletFetchHandler to its own file, so
later other classes can include its header.

Differential Revision: https://phabricator.services.mozilla.com/D166539
2023-03-13 22:59:35 +00:00