Граф коммитов

110 Коммитов

Автор SHA1 Сообщение Дата
Olli Pettay 93acdfad59 Bug 1777574, automate CC zone handling, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D155084
2022-09-07 11:22:51 +00:00
Yoshi Cheng-Hao Huang aa441ff9e0 Bug 1775424 - Part 3: Fix GC hazards in ImportMetaResolveImpl. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D155973
2022-08-30 18:42:54 +00:00
Yoshi Cheng-Hao Huang d17eb87e4d Bug 1775424 - Part 1: Impl import.meta.resolve() on browser. r=jonco,yulia
Define 'resolve()' function on import.meta object on browser.

Add mochitests for import.meta.resolve, as some of the wpt tests for
import.meta.resolve cannot be run due to some bugs in wpt testing framework.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1785806

Differential Revision: https://phabricator.services.mozilla.com/D154105
2022-08-30 18:42:53 +00:00
Sandor Molnar d3f5c8300e Backed out 2 changesets (bug 1775424) for causing linux hazard build bustage in js/loader/ModuleLoaderBase.cpp CLOSED TREE
Backed out changeset a043a84a771c (bug 1775424)
Backed out changeset 19bc4fafd300 (bug 1775424)
2022-08-30 02:51:29 +03:00
Yoshi Cheng-Hao Huang a9970aa2ff Bug 1775424 - Part 1: Impl import.meta.resolve() on browser. r=jonco,yulia
Define 'resolve()' function on import.meta object on browser.

Add mochitests for import.meta.resolve, as some of the wpt tests for
import.meta.resolve cannot be run due to some bugs in wpt testing framework.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1785806

Differential Revision: https://phabricator.services.mozilla.com/D154105
2022-08-29 18:12:09 +00:00
Yulia Startsev dee4b84e71 Bug 1784477 - Make ModuleLoaderBase thread-insensitive; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D147323
2022-08-12 16:18:44 +00:00
Yulia Startsev ddbc6378de Bug 1784477 - Remove Dynamic Import option; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D154529
2022-08-12 16:18:44 +00:00
Tooru Fujisawa 0bb31403fd Bug 1781124 - Use static pref for dom.importMaps.enabled in module loader. r=allstarschh
Differential Revision: https://phabricator.services.mozilla.com/D152712
2022-07-26 06:30:46 +00:00
Yulia Startsev ccd1b4e8bd Bug 1742438 - Part 13: Use ScriptLoadRequest's mURL instead of WorkerLoadContext's; r=asuth,jonco,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D146459
2022-07-14 17:07:29 +00:00
Yulia Startsev d82f1773f0 Bug 1742438 - Part 8: Use mScriptData instead of custom load context field; r=arai,asuth
This is the most substantial change in the transition from ScriptLoadInfo to ScriptLoadRequest with
regards to data representation. ScriptLoadRequests can have their data incrementally loaded,
so it is already fully decoded and ready to go by the time that we create the source buffer for
worker scripts. This simplifies some of the code, and we can add incremental loading when we are ready.

Differential Revision: https://phabricator.services.mozilla.com/D146180
2022-07-14 17:07:27 +00:00
Yulia Startsev de63d5eeab Bug 1742438 - Part 5: Rename ScriptLoadInfo to WorkerLoadContext; r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D146177
2022-07-14 17:07:26 +00:00
Yulia Startsev 0f5d54e6bc Bug 1742438 - Part 4: Rename ScriptLoadInfo files to WorkerLoadContext; r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D146176
2022-07-14 17:07:26 +00:00
Yulia Startsev adbf7d814a Bug 1742438 - Part 3: Split ScriptLoadInfo into ScriptLoadRequest and ScriptLoadInfo (as a LoadContext) classes; r=asuth,jonco
Here we split ScriptLoadInfo's representation -- we are distinguishing between "what is being loaded"
and "how it is being loaded in a worker context". Requesting review from asuth for the workers side
of things, and jonco for js/loader.

Differential Revision: https://phabricator.services.mozilla.com/D146175
2022-07-14 17:07:25 +00:00
Yulia Startsev dfb0af9f2b Bug 1742438 - Prep Part 10: Make TriggeringPrincipal optional for ScriptFetchOptions; r=jonco
I didn't realize that this would only be used in the DOM script loader, so this is now optional. In
a later stage we might move this over to the ScriptLoadContext as it looks like this might need to
propogate through the module script tree.

Differential Revision: https://phabricator.services.mozilla.com/D146172
2022-07-14 17:07:24 +00:00
Jon Coppeard 3e69adc940 Bug 1777450 - Separate error messages for module resulution failure when the specifier might be bare r=allstarschh,flod
This fixes the original case by adding an extra error reason which is used when
the specifier could be bare and and only warning about relative URLs in this
case.

The same problem happens with import maps enable where "./foo.js" produces an
error about it being a bare specifier, which it's not. For that case make
ParseURLLikeImportSpecifier return a ResolveResult and use the same approach.

Differential Revision: https://phabricator.services.mozilla.com/D151153
2022-07-08 09:58:33 +00:00
Jon Coppeard 3ca0fba399 Bug 1778076 - Part 4: Rename ModuleInstantiate with ModuleLink to follow the spec r=arai
The ModuleObject methods will be dealt with in the next patch.

Depends on D151013

Differential Revision: https://phabricator.services.mozilla.com/D151014
2022-07-05 13:04:55 +00:00
Tooru Fujisawa cd99fa9ea8 Bug 1777801 - Check for failure before attempting to instantiate module graph in mozJSModuleLoader::ImportESModule r=arai
This fixes the overly general context kind checks pointed out in the bug and
adds error checking in ImportESModule.

This also showed that JS::ClearModuleEnvironment could fail if the module's
environment had not been initialized yet.

This patch also adds a couple more tests.

Differential Revision: https://phabricator.services.mozilla.com/D151006
2022-07-05 11:38:22 +00:00
Tooru Fujisawa 4a7453191a Bug 1776832 - Clear chrome module environments in shutdown r=arai
Differential Revision: https://phabricator.services.mozilla.com/D150966
2022-07-04 14:18:54 +00:00
Matthew Gaudet 430dfe1d67 Bug 1769322 - Allow for the possibility of non-xpc globals in nsIGlobal::IsScriptForbidden r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D146347
2022-05-24 17:23:32 +00:00
Bryan Thrall 23c45ca806 Bug 1757833 - Extract methods ScriptBytecodeCompress and ScriptBytecodeDecompress r=nbp
This leaves the code in ScriptLoader and ScriptLoadHandler a lot more readable.

ScriptBytecodeCompressedDataLayout and ScriptBytecodeDataLayout simplify
locating data in the ScriptLoadRequest bytecode buffer when compressing and
decompressing it.

The interface is still error-prone. For example, these classes don't check
that the returned pointers are within the bounds of the buffer.

Differential Revision: https://phabricator.services.mozilla.com/D145011
2022-05-20 18:25:40 +00:00
Iulian Moraru c49f9ffda3 Backed out 6 changesets (bug 1757833) for causing multiple crashes with MOZ_Z_inflateInit2_. CLOSED TREE
Backed out changeset 6a7d3034db0a (bug 1757833)
Backed out changeset faa0393886db (bug 1757833)
Backed out changeset 4bffe0cf490e (bug 1757833)
Backed out changeset 189b81cc13fd (bug 1757833)
Backed out changeset a59c66e4fb68 (bug 1757833)
Backed out changeset 2b5d9869fbcb (bug 1757833)
2022-05-19 01:14:05 +03:00
Bryan Thrall 84ef677639 Bug 1757833 - Extract methods ScriptBytecodeCompress and ScriptBytecodeDecompress r=nbp
This leaves the code in ScriptLoader and ScriptLoadHandler a lot more readable.

ScriptBytecodeCompressedDataLayout and ScriptBytecodeDataLayout simplify
locating data in the ScriptLoadRequest bytecode buffer when compressing and
decompressing it.

The interface is still error-prone. For example, these classes don't check
that the returned pointers are within the bounds of the buffer.

Differential Revision: https://phabricator.services.mozilla.com/D145011
2022-05-18 21:03:48 +00:00
Sebastian Hengst 825a31e539 Backed out 6 changesets (bug 1757833) for Linux base toolchains build failure
Backed out changeset c8117edaf054 (bug 1757833)
Backed out changeset a46efd9967d0 (bug 1757833)
Backed out changeset f33955b6a7cc (bug 1757833)
Backed out changeset 71f1afa82581 (bug 1757833)
Backed out changeset 868407dccba9 (bug 1757833)
Backed out changeset 79873d83d02b (bug 1757833)
2022-05-17 19:46:50 +02:00
Bryan Thrall c88e06a519 Bug 1757833 - Extract methods ScriptBytecodeCompress and ScriptBytecodeDecompress r=nbp
This leaves the code in ScriptLoader and ScriptLoadHandler a lot more readable.

ScriptBytecodeCompressedDataLayout and ScriptBytecodeDataLayout simplify
locating data in the ScriptLoadRequest bytecode buffer when compressing and
decompressing it.

The interface is still error-prone. For example, these classes don't check
that the returned pointers are within the bounds of the buffer.

Differential Revision: https://phabricator.services.mozilla.com/D145011
2022-05-17 16:29:03 +00:00
Tooru Fujisawa bb1d312b22 Bug 1769029 - Support ESM loaded by shim in Cu.loadedModules. r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D146169
2022-05-13 22:02:41 +00:00
Tooru Fujisawa 980d04aebc Bug 1768922 - Support ESM loaded by shim in Cu.isModuleLoaded. r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D146166
2022-05-13 22:02:40 +00:00
Cristian Tuns 2bea2f32be Backed out 8 changesets (bug 1766976, bug 1768922, bug 1769029, bug 1766761, bug 1768060) for causing spidermonkey failures on Modules.cpp CLOSED TREE
Backed out changeset da102935dfd2 (bug 1769029)
Backed out changeset e080258f38a7 (bug 1768922)
Backed out changeset 36e9e0301a24 (bug 1766976)
Backed out changeset dd28b0eb27ef (bug 1768060)
Backed out changeset 682c4afbcfe9 (bug 1766761)
Backed out changeset a7a37e912b90 (bug 1766761)
Backed out changeset d8099b6d970b (bug 1766761)
Backed out changeset 435acc6d6abd (bug 1766761)
2022-05-13 12:49:49 -04:00
Tooru Fujisawa 229b059954 Bug 1769029 - Support ESM loaded by shim in Cu.loadedModules. r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D146169
2022-05-13 15:23:17 +00:00
Tooru Fujisawa 11c8544fb4 Bug 1768922 - Support ESM loaded by shim in Cu.isModuleLoaded. r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D146166
2022-05-13 15:23:17 +00:00
Jon Coppeard 10fc79714b Bug 1432901 - Part 12: Break cycles manually during shutdown r=yulia
Since mozJSComponentLoader is destroyed after the cycle collector, we need to
break cycles manually before the final cycle collection otherwise we get a
memory leak. Unload() is called at an appropriate earlier point in shutdown.

Differential Revision: https://phabricator.services.mozilla.com/D145567
2022-05-10 12:58:10 +00:00
Jon Coppeard fc72352fb5 Bug 1432901 - Part 7: Add a load context for use by the new module loader r=yulia
This will be used to hold compilation results before they are passed to the base class.

Differential Revision: https://phabricator.services.mozilla.com/D145561
2022-05-10 12:58:08 +00:00
Jon Coppeard e14763ccd7 Bug 1432901 - Part 3: Add option for synchronous module evaluation in the module loader r=yulia
This adds the parameter to the module loaders evaluation method. I also
rewrote the comments a bit to make this section clearer based on my
understanding of how this works.

Differential Revision: https://phabricator.services.mozilla.com/D145556
2022-05-10 12:58:06 +00:00
Jon Coppeard 9143d0485b Bug 1767829 - Part 5: Add EvaluateModuleInContext method to allow callers to set up and supply their own JSContext r=yulia
The main version of EvaluateModule will continue to use AutoEntryScript, but we
don't always want it's error reporting behaviour.

Differential Revision: https://phabricator.services.mozilla.com/D145492
2022-05-09 11:06:26 +00:00
Jon Coppeard 260fa6927f Bug 1767829 - Part 4: Throw an error if CreateDynamicImport returns null r=yulia
This allows derived loaders not to support dynamic import if they don't want to.

Module loading for in mozJSComponentLoader will not initially support this.

Differential Revision: https://phabricator.services.mozilla.com/D145491
2022-05-09 11:06:26 +00:00
Jon Coppeard ce9567cdac Bug 1767829 - Part 3: Add the option for derived module loaders to specifiy their own event target r=yulia
Module loaders require an event target to use with mozPromise. The default uses
the event loop so doesn't permit implementing a synchronous module loader.

Differential Revision: https://phabricator.services.mozilla.com/D145490
2022-05-09 11:06:25 +00:00
Jon Coppeard 1e506ccabd Bug 1767829 - Part 2: Give ScriptLoaderInterface a virtual destructor r=yulia
Classes with virtual methods should have a virtual destructor so deleting an
object through a base class pointer works correctly. I think I got lint
warnings about this when I added a new derived loader.

Differential Revision: https://phabricator.services.mozilla.com/D145489
2022-05-09 11:06:25 +00:00
Jon Coppeard 39651f8671 Bug 1767829 - Part 1: Give ScriptLoaderInterface caching methods default implementations which do nothing r=yulia
Give the caching interfaces default empty implementations so derived classes
don't need to implement them if they don't want any speical behaviour. We don't
use these methods for caching in mozJSComponentLoader.

Differential Revision: https://phabricator.services.mozilla.com/D145488
2022-05-09 11:06:25 +00:00
Yoshi Cheng-Hao Huang bf4ad5ae3e Bug 1688879 - Part 6: Acquiring import maps. r=jonco,yulia
Implement https://wicg.github.io/import-maps/#document-acquiring-import-maps

Differential Revision: https://phabricator.services.mozilla.com/D142074
2022-05-05 21:19:02 +00:00
Yoshi Cheng-Hao Huang 8a939e5954 Bug 1688879 - Part 5: ResolveModuleSpecifier for import maps. r=jonco,yulia,flod
Implement https://wicg.github.io/import-maps/#resolve-a-module-specifier

Differential Revision: https://phabricator.services.mozilla.com/D142072
2022-05-05 21:19:02 +00:00
Yoshi Cheng-Hao Huang 7ba3206f1c Bug 1688879 - Part 4: Refactor ResolveModuleSpecifier. r=jonco,yulia
Add ResolveResult to return nsIURI on success or return ResolveError on
failure.

Differential Revision: https://phabricator.services.mozilla.com/D142073
2022-05-05 21:19:02 +00:00
Yoshi Cheng-Hao Huang 464384bf31 Bug 1688879 - Part 3: Parse and register an import map. r=jonco,yulia
Implement
https://wicg.github.io/import-maps/#parse-an-import-map-string,
and
https://wicg.github.io/import-maps/#register-an-import-map

Differential Revision: https://phabricator.services.mozilla.com/D142071
2022-05-05 21:19:01 +00:00
Yoshi Cheng-Hao Huang afeda7dba0 Bug 1688879 - Part 2: Add support for import maps in ScriptElement/ScriptLoader/ScriptKind. r=jonco,yulia,smaug
Differential Revision: https://phabricator.services.mozilla.com/D142070
2022-05-05 21:19:01 +00:00
Butkovits Atila fb9f362af3 Backed out 11 changesets (bug 1688879) for causing build bustages. CLOSED TREE
Backed out changeset 350ddd17c7f5 (bug 1688879)
Backed out changeset 27984b95ed20 (bug 1688879)
Backed out changeset 6a5bb063965f (bug 1688879)
Backed out changeset d8edcfdb504b (bug 1688879)
Backed out changeset 77ab231310ec (bug 1688879)
Backed out changeset c2bce95a1aca (bug 1688879)
Backed out changeset f5862572ced8 (bug 1688879)
Backed out changeset 05e0a1bf32fc (bug 1688879)
Backed out changeset adeab05b7419 (bug 1688879)
Backed out changeset 0e60834e17e5 (bug 1688879)
Backed out changeset 877bb4c2ce66 (bug 1688879)
2022-05-05 19:52:05 +03:00
Yoshi Cheng-Hao Huang 98b905783d Bug 1688879 - Part 10: Fix class-varargs warnings in Windows builds. r=jonco
Error message:

/builds/worker/checkouts/gecko/js/loader/ImportMap.cpp(262,30): error: passing object of class type 'typename raw_type<char16_t, int>::type' (aka 'char16ptr_t') through variadic function [-Werror,-Wclass-varargs]
[task 2022-05-05T00:33:57.282Z] 00:33:57     INFO -                               scopePrefix.get());
[task 2022-05-05T00:33:57.283Z] 00:33:57     INFO -                               ^
[task 2022-05-05T00:33:57.283Z] 00:33:57     INFO -  1 error generated.

Differential Revision: https://phabricator.services.mozilla.com/D145602
2022-05-05 16:03:37 +00:00
Yoshi Cheng-Hao Huang 2cff7e6f2a Bug 1688879 - Part 6: Acquiring import maps. r=jonco,yulia
Implement https://wicg.github.io/import-maps/#document-acquiring-import-maps

Differential Revision: https://phabricator.services.mozilla.com/D142074
2022-05-05 16:03:17 +00:00
Yoshi Cheng-Hao Huang 098e1668c8 Bug 1688879 - Part 5: ResolveModuleSpecifier for import maps. r=jonco,yulia,flod
Implement https://wicg.github.io/import-maps/#resolve-a-module-specifier

Differential Revision: https://phabricator.services.mozilla.com/D142072
2022-05-05 16:03:17 +00:00
Yoshi Cheng-Hao Huang 1b35f68535 Bug 1688879 - Part 4: Refactor ResolveModuleSpecifier. r=jonco,yulia
Add ResolveResult to return nsIURI on success or return ResolveError on
failure.

Differential Revision: https://phabricator.services.mozilla.com/D142073
2022-05-05 16:03:17 +00:00
Yoshi Cheng-Hao Huang 48be9bcaa2 Bug 1688879 - Part 3: Parse and register an import map. r=jonco,yulia
Implement
https://wicg.github.io/import-maps/#parse-an-import-map-string,
and
https://wicg.github.io/import-maps/#register-an-import-map

Differential Revision: https://phabricator.services.mozilla.com/D142071
2022-05-05 16:03:16 +00:00
Yoshi Cheng-Hao Huang 0cb3316eb7 Bug 1688879 - Part 2: Add support for import maps in ScriptElement/ScriptLoader/ScriptKind. r=jonco,yulia,smaug
Differential Revision: https://phabricator.services.mozilla.com/D142070
2022-05-05 16:03:16 +00:00
Narcis Beleuzu a92a200e76 Backed out 9 changesets (bug 1688879) for bustages on ImportMap.cpp
Backed out changeset 44e9abe72a5e (bug 1688879)
Backed out changeset 0503d2d2ae01 (bug 1688879)
Backed out changeset 2cf08a51b184 (bug 1688879)
Backed out changeset 6f0276c3ab0e (bug 1688879)
Backed out changeset f16b14d8f677 (bug 1688879)
Backed out changeset 03b772e02d07 (bug 1688879)
Backed out changeset 39ed48a5ecc2 (bug 1688879)
Backed out changeset d7b42d8312bb (bug 1688879)
Backed out changeset 5e695bf5dd0d (bug 1688879)
2022-05-05 03:41:31 +03:00