Commit Graph
151 Commits
Author SHA1 Message Date
Yoshi Cheng-Hao Huang 5fed3d146f Bug 1968895 - Part 2: Pass BaseURL for static/dynamic import. r=jonco
If the script is redirected, the redirected URL will be stored in
BaseURL(), therefore we should change to use BaseURL instead.

Differential Revision: https://phabricator.services.mozilla.com/D263371
2025-09-07 09:03:39 +00:00
Cristina Horotan 1fe1c12f6e Revert "Bug 1968895: apply code formatting via Lando" for causing SM failures on Value.h
This reverts commit 40010a7da7.

Revert "Bug 1968895 - Part 7: Remove StartFetchingModuleAndDependencies. r=jonco"

This reverts commit 816a0a6015.

Revert "Bug 1968895 - Part 6: Replace CreateStaticImport/CreateDynamicImport with CreateRequest. r=jonco"

This reverts commit e29a957535.

Revert "Bug 1968895 - Part 5: Add CreateDefaultScriptFetchOptions and GetClientReferrerURI. r=jonco"

This reverts commit 4b21d41ec1.

Revert "Bug 1968895 - Part 4: Pass null for referrer in shadow realm import value. r=jonco"

This reverts commit a3417dbe89.

Revert "Bug 1968895 - Part 3: Update ModuleLoadRequest's referrer policy for workers. r=jonco"

This reverts commit 6a28639be8.

Revert "Bug 1968895 - Part 2: Pass BaseURL for static/dynamic import. r=jonco"

This reverts commit dab430a7b4.

Revert "Bug 1968895 - Part 1: Check if dynamic import is supported earlier. r=jonco"

This reverts commit 34f67fd697.
2025-09-03 18:44:42 +00:00
Yoshi Cheng-Hao Huang e29a957535 Bug 1968895 - Part 6: Replace CreateStaticImport/CreateDynamicImport with CreateRequest. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D263375
2025-09-03 17:58:52 +00:00
Yoshi Cheng-Hao Huang 4b21d41ec1 Bug 1968895 - Part 5: Add CreateDefaultScriptFetchOptions and GetClientReferrerURI. r=jonco
Provide virtual interfaces to be overriden by the environment.

Differential Revision: https://phabricator.services.mozilla.com/D263374
2025-09-03 17:58:49 +00:00
Yoshi Cheng-Hao Huang dab430a7b4 Bug 1968895 - Part 2: Pass BaseURL for static/dynamic import. r=jonco
If the script is redirected, the redirected URL will be stored in
BaseURL(), therefore we should change to use BaseURL instead.

Differential Revision: https://phabricator.services.mozilla.com/D263371
2025-09-03 17:58:40 +00:00
Tooru Fujisawa ea00d6421a Bug 1977148 - Part 4: Rename bytecode-encoding-related identifiers to cache. r=nbp
There are shared path between "save bytecode" vs "cache stencil".
This patch just renames everything, and the subsequent bugs and patches will
split the flag and methods.

Differential Revision: https://phabricator.services.mozilla.com/D260911
2025-08-25 05:47:45 +00:00
Tooru Fujisawa 7cce2db4cd Bug 1977148 - Part 3: Always call CalculateCacheFlag. r=nbp
As a preparation to calculate the "bytecode encoding" separately than "do cache"
for the navigation cache, we should always calculate the flag.

Differential Revision: https://phabricator.services.mozilla.com/D260910
2025-08-25 05:47:42 +00:00
Emilio Cobos Álvarez 791917d8af Bug 1976665 - Sort headers in dom/. r=dom-core,media-playback-reviewers,webrtc-reviewers,dom-storage-reviewers,padenot,janv,smaug,jesup,jib
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.

Differential Revision: https://phabricator.services.mozilla.com/D256800
2025-08-05 11:47:34 +00:00
Yoshi Cheng-Hao Huang 745139e2c8 Bug 1820594 - Part 19: Refactor CreateStaticImport. r=jonco
Pass LoadContextBase to CreateStaticImport

Differential Revision: https://phabricator.services.mozilla.com/D255126
2025-07-22 18:29:10 +00:00
Yoshi Cheng-Hao Huang 2f395ffaf7 Bug 1820594 - Part 18: Add mReferrerObj, mModuleRequestObj, mReferencingPrivate, mStatePrivate in ModuleLoadRequest r=jonco
Add data structures to pass those information to
FinishLoadingImportedModule.

Differential Revision: https://phabricator.services.mozilla.com/D228852
2025-07-22 18:29:07 +00:00
Yoshi Cheng-Hao Huang 00a8ab1fce Bug 1820594 - Part 14: Remove VisitedURLSet. r=jonco
Visited set has been removed from the spec.
See https://whatpr.org/html/8253/085d4d1...75e7bf0/webappapis.html

Differential Revision: https://phabricator.services.mozilla.com/D228850
2025-07-22 18:28:52 +00:00
Atila Butkovits f46ece6f70 Revert "Bug 1820594 - Part 36: Add CancelFetchingModules. r=jonco" for causing failures at mochitest.toml.
This reverts commit bb9106dfec.

Revert "Bug 1820594 - Part 35: Disable testSyncImportWhileAsyncImportTLA. r=arai"

This reverts commit bd7ac6c6da.

Revert "Bug 1820594 - Part 34: Update wpt ini for dynamic import. r=jonco"

This reverts commit 6dc30859a2.

Revert "Bug 1820594 - Part 33: Update choice-of-error-1.html.ini and error-type-1.html.ini failed as expected. r=jonco"

This reverts commit 696d4051b2.

Revert "Bug 1820594 - Part 32: Remove js/src/jit-test/tests/modules/bug-1287410.js. r=jonco"

This reverts commit 6a47bd9a7c.

Revert "Bug 1820594 - Part 31: Test the child requests accross multiple module graphs. r=jonco"

This reverts commit fc403c5ea9.

Revert "Bug 1820594 - Part 30: Update JS Shell implementation for HostLoadImportedModule. r=jonco"

This reverts commit 5a2f281ba7.

Revert "Bug 1820594 - Part 29: Remove ModuleLoader::ResolveImportedModule and ModuleLoader::ImportModuleDynamically in JS Shell r=jonco"

This reverts commit aa686310fc.

Revert "Bug 1820594 - Part 28: DOM, Worker, Worklet ScriptLoader, mozJSModuleLoader update r=jonco"

This reverts commit 86aea74da6.

Revert "Bug 1820594 - Part 27: Remove redundant module graph data structures from host layer. r=jonco"

This reverts commit 81673cfb4e.

Revert "Bug 1820594 - Part 26: Remove FindFirstParseError and check for parse error. r=jonco"

This reverts commit 665970f847.

Revert "Bug 1820594 - Part 25: Call FinishLoadingImportedModule for dynamic import. r=jonco"

This reverts commit 9037595d27.

Revert "Bug 1820594 - Part 24: Add ModuleErroredRunnable to dispatch ModuleErrored. r=jonco"

This reverts commit aa0e96e6c1.

Revert "Bug 1820594 - Part 23: Error handling when module fetching failed. r=jonco"

This reverts commit 8054f6d6b3.

Revert "Bug 1820594 - Part 22: Throw TypeError if the module type is unsupported. r=jonco"

This reverts commit f793f2b086.

Revert "Bug 1820594 - Part 21: Implement HostLoadImportedModule and FinishLoadingImportedModule in ModuleLoaderBase. r=jonco"

This reverts commit 2c2abeb8a3.

Revert "Bug 1820594 - Part 20: Update module script's referrer policy. r=jonco"

This reverts commit e92cdaa129.

Revert "Bug 1820594 - Part 19: Refactor CreateStaticImport. r=jonco"

This reverts commit e7cc5dcf27.

Revert "Bug 1820594 - Part 18: Add mReferrerObj, mModuleRequestObj, mReferencingPrivate, mStatePrivate in ModuleLoadRequest r=jonco"

This reverts commit 96b553c522.

Revert "Bug 1820594 - Part 17: Add OnFetchSucceeded r=jonco"

This reverts commit 4b60b4037a.

Revert "Bug 1820594 - Part 16-1 : Use sync version of LoadRequestedModules for chrome pages. r=jonco"

This reverts commit a75c3d1989.

Revert "Bug 1820594 - Part 16: Call LoadRequestedModules in StartFetchingModuleDependencies. r=jonco"

This reverts commit cf9a4a886d.

Revert "Bug 1820594 - Part 15: Remove HostResolveImportedModule and HostImportModuleDynamically r=jonco"

This reverts commit 8c45c3380e.

Revert "Bug 1820594 - Part 14: Remove VisitedURLSet. r=jonco"

This reverts commit 09f1ea1a1a.

Revert "Bug 1820594 - Part 13: Resume waiting requests after fetching dependencies. r=jonco"

This reverts commit a5edee9705.

Revert "Bug 1820594 - Part 12: Implement ContinueDynamicImport. r=jonco"

This reverts commit b487d8ffec.

Revert "Bug 1820594 - Part 11: Implement LoadRequestedModules. r=jonco"

This reverts commit 0049bf82d1.

Revert "Bug 1820594 - Part 10: Implement ImportAttributes in InnerModuleLoading. r=jonco"

This reverts commit 3115d8a191.

Revert "Bug 1820594 - Part 9: Implement FinishLoadingImportedModule, ContinueModuleLoading. r=jonco"

This reverts commit 85bcdccef3.

Revert "Bug 1820594 - Part 8: Update js::FinishDynamicModuleImport. r=jonco"

This reverts commit f5546f06d2.

Revert "Bug 1820594 - Part 7: Remove JS::FinishDynamicModuleImport. r=jonco"

This reverts commit 1e6d8581b9.

Revert "Bug 1820594 - Part 6: Implement InnerModuleLoading. r=jonco"

This reverts commit ef4d03deaf.

Revert "Bug 1820594 - Part 5: Update Module Hook. r=jonco"

This reverts commit 4f00fb82af.

Revert "Bug 1820594 - Part 4: Implement GetImportedModule. r=jonco"

This reverts commit 19507524a2.

Revert "Bug 1820594 - Part 3: Implement LoadedModules in ModuleObject. r=jonco"

This reverts commit f639c7eb96.

Revert "Bug 1820594 - Part 2: Implement GraphLoadingStateRecord. r=jonco"

This reverts commit 05a2b76d9c.

Revert "Bug 1820594 - Part 1: Add ModuleStatus::New. r=jonco"

This reverts commit bfd2615ef1.
2025-07-22 01:03:15 +00:00
Yoshi Cheng-Hao Huang e7cc5dcf27 Bug 1820594 - Part 19: Refactor CreateStaticImport. r=jonco
Pass LoadContextBase to CreateStaticImport

Differential Revision: https://phabricator.services.mozilla.com/D255126
2025-07-21 23:09:17 +00:00
Yoshi Cheng-Hao Huang 96b553c522 Bug 1820594 - Part 18: Add mReferrerObj, mModuleRequestObj, mReferencingPrivate, mStatePrivate in ModuleLoadRequest r=jonco
Add data structures to pass those information to
FinishLoadingImportedModule.

Differential Revision: https://phabricator.services.mozilla.com/D228852
2025-07-21 23:09:14 +00:00
Yoshi Cheng-Hao Huang 09f1ea1a1a Bug 1820594 - Part 14: Remove VisitedURLSet. r=jonco
Visited set has been removed from the spec.
See https://whatpr.org/html/8253/085d4d1...75e7bf0/webappapis.html

Differential Revision: https://phabricator.services.mozilla.com/D228850
2025-07-21 23:09:00 +00:00
Tooru Fujisawa 09193c773c Bug 1973206 - Part 3: Move CalculateBytecodeCacheFlag to instance method as a preparation for the subsequent patches. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254649
2025-06-25 13:15:50 +00:00
Cosmin Sabou a78b9076b4 Revert "Bug 1973206 - Part 6: Store non-top-level module requests which passed the bytecode encoding condition into a separate list. r=nbp,allstarschh" for causing shippable builds bustages.
This reverts commit 99ce61fb4e.

Revert "Bug 1973206 - Part 5: Remove unused variable in ScriptLoader::MaybePrepareModuleForBytecodeEncodingBeforeExecute. r=nbp"

This reverts commit 73dd64fbdc.

Revert "Bug 1973206 - Part 4: Filter out JSON modules earlier in ScriptLoader::CalculateBytecodeCacheFlag. r=nbp"

This reverts commit 5c8d191154.

Revert "Bug 1973206 - Part 3: Move CalculateBytecodeCacheFlag to instance method as a preparation for the subsequent patches. r=nbp"

This reverts commit 2e9c7ce88a.

Revert "Bug 1973206 - Part 2: Verify the list in IsAlreadyHandledForBytecodeEncodingPreparation. r=nbp"

This reverts commit 64d3a74e4d.
2025-06-25 03:36:42 +00:00
Tooru Fujisawa 2e9c7ce88a Bug 1973206 - Part 3: Move CalculateBytecodeCacheFlag to instance method as a preparation for the subsequent patches. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254649
2025-06-25 01:58:35 +00:00
Yoshi Cheng-Hao Huang 8b8c0c1b0e Bug 1890929 - Part 1: Execute non-parser generated inline module scripts asynchronously. r=jonco
Refactors execution behavior to run asynchronously for inline scripts that are
not generated by the parser.

spec:
https://html.spec.whatwg.org/#prepare-the-script-element

Step 32. If el does not have a src content attribute:
  2. type: "module"
    ...
    3. Fetch an inline module script graph, given source text, base URL, settings object, options, and with the following steps given result:
      1. Queue an element task on the networking task source given el to perform the following steps:
        1. Mark as ready el given result.

Step 33. If ... el's type is "module":
  3. Otherwise, if el is not parser-inserted:
    3.2.1 Execute the script element scripts[0].

Differential Revision: https://phabricator.services.mozilla.com/D254202
2025-06-18 16:47:44 +00:00
Tooru Fujisawa c882062351 Bug 1949932 - Part 1: Use SharedScriptCache from ModuleLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242728
2025-04-01 13:09:04 +00:00
Stanca Serban 3d34fe1048 Backed out 8 changesets (bug 1949932) for causing reftests failures in LoadedScript.h. CLOSED TREE
Backed out changeset de39fd08733d (bug 1949932)
Backed out changeset b75281f1b27c (bug 1949932)
Backed out changeset 8920e6d4cf8c (bug 1949932)
Backed out changeset c05f9bf802ae (bug 1949932)
Backed out changeset 2c9718bfd7be (bug 1949932)
Backed out changeset 03f4514cfba8 (bug 1949932)
Backed out changeset 9fe4fd6ee6e8 (bug 1949932)
Backed out changeset 1cebf102e64e (bug 1949932)
2025-04-01 08:59:51 +03:00
Tooru Fujisawa 872eb028b0 Bug 1949932 - Part 1: Use SharedScriptCache from ModuleLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242728
2025-04-01 03:11:18 +00:00
Goloman Adrian 62c97b0b6c Backed out 8 changesets (bug 1949932) for causing build bustages @RootingAPI.h. CLOSED TREE
Backed out changeset 181cde5d267e (bug 1949932)
Backed out changeset 44fd656c40de (bug 1949932)
Backed out changeset b4d93df0edb1 (bug 1949932)
Backed out changeset 7c20db67f688 (bug 1949932)
Backed out changeset ac742d9dc3aa (bug 1949932)
Backed out changeset 102e0dc46dff (bug 1949932)
Backed out changeset 80d1b3331844 (bug 1949932)
Backed out changeset cc1834c3ea2a (bug 1949932)
2025-04-01 07:09:29 +03:00
Tooru Fujisawa 85a3b6e05a Bug 1949932 - Part 1: Use SharedScriptCache from ModuleLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242728
2025-04-01 03:11:18 +00:00
Tooru Fujisawa 35309dc989 Bug 1954644 - Part 4: Remove obsolete comment for static-ness. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242309
2025-03-22 04:03:55 +00:00
Tooru Fujisawa 2383b98374 Bug 1954644 - Part 3: Cleanup ModuleLoadRequest parameters to avoid confusing parameter syntax. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242308
2025-03-22 04:03:54 +00:00
Fatih Kilic 37486aeb74 Bug 1945540: Part 3 - Get integrity from import map. r=tschuster,jonco,dom-core,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D236559
2025-03-06 14:16:30 +00:00
Tooru Fujisawa d0e537de50 Bug 1899090 - Part 9: Rename *IncrementalEncoding public API to *CollectDelazifications. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D230385
2024-12-04 00:54:46 +00:00
Tooru Fujisawa c1b8d7b50e Bug 1899090 - Part 2: Rebuild the incremental encoding with InitialStencilAndDelazifications. r=nbp
Create InitialStencilAndDelazifications and associate it to ScriptSourceObject,
and store on-demand delazifications into the InitialStencilAndDelazifications.

InitialStencilAndDelazifications is merged into single CompilationStencil when
finishing, but the JS::Stencil-based API is going to be rewritten later not
to merge.

Differential Revision: https://phabricator.services.mozilla.com/D230378
2024-12-04 00:54:44 +00:00
Jonatan Klemets 1ccec98a57 Bug 1918449 - Part 1: Handle unknown module type earlier r=jonco,dom-worker-reviewers,dom-core,asuth,mccr8
We never reach `CompileFetchedModule` if we have an unknown module type since
we take the module type into account when we do mime type checking, so the file
always fails to load because of MIME mismatch, and we don't get the expected
`TypeError.` Checking if we have an unknown type should happen much earlier in
the process.

Differential Revision: https://phabricator.services.mozilla.com/D222222
2024-09-24 08:50:36 +00:00
Jonatan Klemets ab903efe6b Bug 1877792 - Part 17: Extend CompileFetchedModule to handle JSON modules r=spidermonkey-reviewers,dom-core,jonco,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D204175
2024-09-03 08:10:54 +00:00
Jonatan Klemets 24c00f1528 Bug 1877792 - Part 9: Add module type to ModuleLoaderBase::{CreateStaticImport,CreateDynamicImport} r=spidermonkey-reviewers,dom-worker-reviewers,dom-core,asuth,jonco,mccr8
This patch adds a module type parameter to
`ModuleLoaderBase::{CreateStaticImport,CreateDynamicImport},` and gets rid of a
bunch of hard-coded `JS::ModuleType::JavaScript.` However, the module type is
still hard-coded when we call `CreateDynamicImport` and `CreateStaticImport`.

Differential Revision: https://phabricator.services.mozilla.com/D218556
2024-09-03 08:10:51 +00:00
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 af59f68120 Bug 1877792 - Part 17: Extend CompileFetchedModule to handle JSON modules r=spidermonkey-reviewers,dom-core,jonco,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D204175
2024-08-22 14:21:54 +00:00
Jonatan Klemets df3d32caa7 Bug 1877792 - Part 9: Add module type to ModuleLoaderBase::{CreateStaticImport,CreateDynamicImport} r=spidermonkey-reviewers,dom-worker-reviewers,dom-core,asuth,jonco,mccr8
This patch adds a module type parameter to
`ModuleLoaderBase::{CreateStaticImport,CreateDynamicImport},` and gets rid of a
bunch of hard-coded `JS::ModuleType::JavaScript.` However, the module type is
still hard-coded when we call `CreateDynamicImport` and `CreateStaticImport`.

Differential Revision: https://phabricator.services.mozilla.com/D218556
2024-08-22 14:21:51 +00: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
Tooru Fujisawa 26225baff0 Bug 1906394 - Part 3: Add alreadyStarted out parameter for StartIncrementalEncoding. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D215834
2024-07-16 11:34:34 +00:00
Tooru Fujisawa 599af2d7d2 Bug 1899172 - Part 11: Move nsIScriptElement from ScriptFetchOptions to ScriptLoadContext. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211912
2024-05-30 05:01:18 +00:00
Tooru Fujisawa 6e5b7d5d1b Bug 1898677 - Cache the result of bytecode encoding condition. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211517
2024-05-27 06:31:16 +00:00
Tooru Fujisawa 8d9ed15dd6 Bug 1875836 - Part 1: Add ModuleLoadRequest::SetDynamicImport method. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D199278
2024-01-23 23:29:53 +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
Tooru Fujisawa 59f39b43f5 Bug 1800641 - Part 2: Add ScriptLoadRequest::Bytecode and let JSExecutionContext::Decode receive JS::TranscodeRange. r=nbp
Depends on D197839

Differential Revision: https://phabricator.services.mozilla.com/D197840
2024-01-08 14:57:36 +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