Commit graph

61 commits

Author SHA1 Message Date
Tooru Fujisawa
d56e00ca0e 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
7e60adcb96 Bug 1899172 - Part 10: Add dedicate ScriptLoadContext::GetScriptElement* methods for each purpose. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211911
2024-05-30 05:01:18 +00:00
Tooru Fujisawa
80ca462be0 Bug 1899172 - Part 9: Add ScriptLoadContext::GetScriptOwnerDocument. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211910
2024-05-30 05:01:18 +00:00
Tooru Fujisawa
acfb4f7d07 Bug 1899172 - Part 8: Add ScriptLoadContext::{UnblockParser,ContinueParserAsync}. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211908
2024-05-30 05:01:17 +00:00
Tooru Fujisawa
a40fa17672 Bug 1899172 - Part 7: Add ScriptLoadContext::{BeginEvaluatingTopLevel,EndEvaluatingTopLevel}. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211907
2024-05-30 05:01:17 +00:00
Tooru Fujisawa
a8b92db6dc Bug 1899172 - Part 5: Add ScriptLoadContext::HasScriptElement. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211905
2024-05-30 05:01:16 +00:00
Tooru Fujisawa
bb80dd52b1 Bug 1899172 - Part 4: Add ScriptLoadContext::{GetScriptLineNumber,GetScriptColumnNumber}. r=nbp
They'll be reworked in later patch not to depend on script element.

Differential Revision: https://phabricator.services.mozilla.com/D211904
2024-05-30 05:01:15 +00:00
Tooru Fujisawa
cff9da24d5 Bug 1899172 - Part 3: Add ScriptLoadContext::GetHintCharset. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211903
2024-05-30 05:01:15 +00:00
Tooru Fujisawa
c0957a7fc8 Bug 1899172 - Part 2: Add ScriptLoadContext::GetInlineScriptText. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211902
2024-05-30 05:01:15 +00:00
Jon Coppeard
81c18a4a24 Bug 1877703 - Part 1: Remove speculatively preloaded modules from the module map when import map is registered r=smaug,allstarschh
The initial problem reported in the bug is that we try to speculatively load a
bareword import before the import map is dynamically inserted that makes that
load valid. The load fails and then we cache the failure in the module map.

The more general problem is that import maps change the locations that imports
are resolved to so if when there is a dynamically inserted import map
speculative preload may load and cache the wrong things.

This patch fixes this problem by removing any preloaded modules from the module
map when an import map is registered.

Previously we used to do something like this but it was changed because I
wasn't confident that it wouldn't remove too much. However it appears that this
is necessary to handle this situation, so it's implemented here but with more
checks that it only removes preloaded modules. This is handled by adding extra
flags where necessary so we have the information on hand to check.

I've made these diagnostic asserts so that this actually gets check in real use.

Differential Revision: https://phabricator.services.mozilla.com/D202611
2024-03-19 10:07:34 +00:00
Norisz Fay
66f73c547b Backed out 4 changesets (bug 1877703) as requested by dev for causing Bug 1885443
Backed out changeset 5eb60e36ef79 (bug 1877703)
Backed out changeset 5921d1fb831e (bug 1877703)
Backed out changeset 64281b11237e (bug 1877703)
Backed out changeset 7ee0827809fb (bug 1877703)
2024-03-15 13:28:07 +02:00
Jon Coppeard
a8ad63760a Bug 1877703 - Part 1: Remove speculatively preloaded modules from the module map when import map is registered r=smaug,allstarschh
The initial problem reported in the bug is that we try to speculatively load a
bareword import before the import map is dynamically inserted that makes that
load valid. The load fails and then we cache the failure in the module map.

The more general problem is that import maps change the locations that imports
are resolved to so if when there is a dynamically inserted import map
speculative preload may load and cache the wrong things.

This patch fixes this problem by removing any preloaded modules from the module
map when an import map is registered.

Previously we used to do something like this but it was changed because I
wasn't confident that it wouldn't remove too much. However it appears that this
is necessary to handle this situation, so it's implemented here but with more
checks that it only removes preloaded modules. This is handled by adding extra
flags where necessary so we have the information on hand to check.

I've made these diagnostic asserts so that this actually gets check in real use.

Differential Revision: https://phabricator.services.mozilla.com/D202611
2024-03-13 13:25:29 +00:00
Norisz Fay
2700ed8b59 Backed out 4 changesets (bug 1877703) for causing ScriptLoader related wpt failures
Backed out changeset 6b99c1c567b4 (bug 1877703)
Backed out changeset bc9c70289244 (bug 1877703)
Backed out changeset 1e17b87ab7f8 (bug 1877703)
Backed out changeset 591b5483bcd8 (bug 1877703)
2024-03-12 23:43:16 +02:00
Jon Coppeard
4043264813 Bug 1877703 - Part 1: Remove speculatively preloaded modules from the module map when import map is registered r=smaug,allstarschh
The initial problem reported in the bug is that we try to speculatively load a
bareword import before the import map is dynamically inserted that makes that
load valid. The load fails and then we cache the failure in the module map.

The more general problem is that import maps change the locations that imports
are resolved to so if when there is a dynamically inserted import map
speculative preload may load and cache the wrong things.

This patch fixes this problem by removing any preloaded modules from the module
map when an import map is registered.

Previously we used to do something like this but it was changed because I
wasn't confident that it wouldn't remove too much. However it appears that this
is necessary to handle this situation, so it's implemented here but with more
checks that it only removes preloaded modules. This is handled by adding extra
flags where necessary so we have the information on hand to check.

I've made these diagnostic asserts so that this actually gets check in real use.

Differential Revision: https://phabricator.services.mozilla.com/D202611
2024-03-12 16:43:48 +00:00
Tooru Fujisawa
e550bdfb92 Bug 1864168 - Part 6: Use 1-origin column number in ScriptLoader and nsIScriptElement. r=smaug,devtools-reviewers,hsivonen,ochameau
Also fix opSetScriptLineAndColumnNumberAndFreeze::mColumnNumber to point the
first character of the script source, instead of '>' of the start tag.

Differential Revision: https://phabricator.services.mozilla.com/D193374
2023-11-22 12:31:32 +00:00
Natalia Csoregi
705aa81869 Backed out 14 changesets (bug 1865005, bug 1864168, bug 1864155, bug 1862814, bug 1862693) for causing bustage on nsRFPService.cpp. CLOSED TREE
Backed out changeset a4f3e7625abf (bug 1865005)
Backed out changeset ab38141e470b (bug 1862814)
Backed out changeset a679b50dc4a9 (bug 1862814)
Backed out changeset e340886ce62a (bug 1862814)
Backed out changeset 1378502e64b0 (bug 1862814)
Backed out changeset 8ee94e5e79c2 (bug 1862814)
Backed out changeset 6d4ef1cdfabb (bug 1864168)
Backed out changeset 2c30c4d757fc (bug 1864168)
Backed out changeset d4db9576559b (bug 1864168)
Backed out changeset 8ffec0d83028 (bug 1864168)
Backed out changeset fa77d852b494 (bug 1864168)
Backed out changeset f6646771a26a (bug 1864168)
Backed out changeset 7bd0ff6986df (bug 1864155)
Backed out changeset 39867b503289 (bug 1862693)
2023-11-22 14:01:55 +02:00
Tooru Fujisawa
78e7224834 Bug 1864168 - Part 6: Use 1-origin column number in ScriptLoader and nsIScriptElement. r=smaug,devtools-reviewers,hsivonen,ochameau
Also fix opSetScriptLineAndColumnNumberAndFreeze::mColumnNumber to point the
first character of the script source, instead of '>' of the start tag.

Differential Revision: https://phabricator.services.mozilla.com/D193374
2023-11-22 11:13:56 +00:00
Mirko Brodesser
6a36108054 Bug 1839315: part 3) Remove no-op method PreloaderBase::PrioritizeAsPreload. r=necko-reviewers,valentin
Because it's confusing.

Differential Revision: https://phabricator.services.mozilla.com/D190015
2023-10-11 10:21:56 +00:00
Tooru Fujisawa
eaf4a57860 Bug 1853480 - Part 1: Use TaskController thread stack size as JS stack quota in ScriptLoader off-thread compilation. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D188556
2023-09-19 11:12:52 +00:00
Narcis Beleuzu
4ddc9496d3 Backed out 4 changesets (bug 1853480) for bustages on ScriptPreloader.cpp . CLOSED TREE
Backed out changeset 153828203749 (bug 1853480)
Backed out changeset f686d2dccfd6 (bug 1853480)
Backed out changeset 975251abd222 (bug 1853480)
Backed out changeset d29bfc33c3e8 (bug 1853480)
2023-09-19 13:44:52 +03:00
Tooru Fujisawa
a10325d739 Bug 1853480 - Part 1: Use TaskController thread stack size as JS stack quota in ScriptLoader off-thread compilation. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D188556
2023-09-19 09:46:25 +00:00
Tooru Fujisawa
7436d5d4b4 Bug 1845668 - Part 1: Rewrite OffThreadCompilationCompleteRunnable based on Task. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D184898
2023-08-29 12:07:18 +00:00
Tooru Fujisawa
70c40a1658 Bug 1845638 - Part 1: Use JS::FrontendContext APIs and TaskController in compilation and decode in ScriptLoader. r=smaug,bthrall
Differential Revision: https://phabricator.services.mozilla.com/D184896
2023-08-29 12:07:18 +00:00
Em Zhan
cf3f789fba Bug 1425310 - Implement modulepreload for link rel. r=yulia,smaug,jonco
Does perform the optional step of fetching descendants and linking:
https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts:fetch-the-descendants-of-and-link-a-module-script-2

Partially implements some new destinations ("as" attribute values) for
modulepreload only (not for preload or link attribute reflection)

Differential Revision: https://phabricator.services.mozilla.com/D172368
2023-05-14 10:49:46 +00:00
Natalia Csoregi
e0961833bd Backed out changeset 3bb8a8b46f3c (bug 1425310) for causing failures on /preload/modulepreload.html. CLOSED TREE 2023-05-13 21:02:02 +03:00
Em Zhan
23e08c0b13 Bug 1425310 - Implement modulepreload for link rel. r=yulia,smaug,jonco
Does perform the optional step of fetching descendants and linking:
https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts:fetch-the-descendants-of-and-link-a-module-script-2

Partially implements some new destinations ("as" attribute values) for
modulepreload only (not for preload or link attribute reflection)

Differential Revision: https://phabricator.services.mozilla.com/D172368
2023-05-13 16:09:03 +00:00
Cristian Tuns
e106133337 Backed out changeset 0054de12b39c (bug 1425310) while the issue is being investigated(Bug 1832361) CLOSED TREE 2023-05-10 14:49:41 -04:00
Em Zhan
1fb37f2836 Bug 1425310 - Implement modulepreload for link rel. r=yulia,smaug,jonco
Does perform the optional step of fetching descendants and linking:
https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts:fetch-the-descendants-of-and-link-a-module-script-2

Partially implements some new destinations ("as" attribute values) for
modulepreload only (not for preload or link attribute reflection)

Differential Revision: https://phabricator.services.mozilla.com/D172368
2023-05-09 12:35:52 +00:00
Noemi Erli
cd34e6e230 Backed out changeset 1ef27d4a851e (bug 1425310) for causing build bustages in nsHtml5TreeBuilderCppSupplement.h 2023-05-08 18:08:45 +03:00
Em Zhan
aa8c113862 Bug 1425310 - Implement modulepreload for link rel. r=yulia,smaug,jonco
Does perform the optional step of fetching descendants and linking:
https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts:fetch-the-descendants-of-and-link-a-module-script-2

Partially implements some new destinations ("as" attribute values) for
modulepreload only (not for preload or link attribute reflection)

Differential Revision: https://phabricator.services.mozilla.com/D172368
2023-05-08 13:12:30 +00:00
Cristina Horotan
82a7ee4839 Backed out changeset b288a387f790 (bug 1425310) for causing Reflection related failures. CLOSED TREE 2023-04-21 18:37:11 +03:00
Em Zhan
3005df8d1d Bug 1425310 - Implement modulepreload for link rel. r=yulia,smaug,jonco
Does perform the optional step of fetching descendants and linking:
https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts:fetch-the-descendants-of-and-link-a-module-script-2

Differential Revision: https://phabricator.services.mozilla.com/D172368
2023-04-21 14:32:30 +00:00
Cosmin Sabou
e95c76d3bf Backed out changeset be054669251a (bug 1425310) for causing browser-chrome leaks on nsStringBuffer. 2023-04-14 13:26:56 +03:00
Em Zhan
268390f013 Bug 1425310 - Implement modulepreload for link rel. r=yulia,smaug,jonco
Does perform the optional step of fetching descendants and linking:
https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts:fetch-the-descendants-of-and-link-a-module-script-2

Differential Revision: https://phabricator.services.mozilla.com/D172368
2023-04-14 08:09:49 +00:00
Nicolas Chevobbe
a1645740cc Bug 1815937 - Set ScriptLoadContext column number for inline scripts. r=smaug,devtools-reviewers,ochameau.
Differential Revision: https://phabricator.services.mozilla.com/D170580
2023-03-21 17:27:48 +00:00
Marian-Vasile Laza
1c28d89a7e Backed out 3 changesets (bug 1823335, bug 1815937, bug 1823399) for devtools failures on browser_dbg-features-breakable-positions.js. CLOSED TREE
Backed out changeset f931921c97f2 (bug 1823399)
Backed out changeset 077d67ccc0d5 (bug 1823335)
Backed out changeset 103bf8d93883 (bug 1815937)
2023-03-21 00:01:11 +02:00
Nicolas Chevobbe
4aa1bc2655 Bug 1815937 - Set ScriptLoadContext column number for inline scripts. r=smaug,devtools-reviewers,ochameau.
Differential Revision: https://phabricator.services.mozilla.com/D170580
2023-03-20 19:25:19 +00:00
Cristina Horotan
588b393945 Backed out 2 changesets (bug 1815937) for causing wpt failures at blockeduri-inline.html CLOSED TREE
Backed out changeset 668971329051 (bug 1815937)
Backed out changeset a4a3430c9bab (bug 1815937)
2023-03-17 15:52:33 +02:00
Nicolas Chevobbe
c0be3c7697 Bug 1815937 - Set ScriptLoadContext column number for inline scripts. r=smaug,devtools-reviewers,ochameau.
Differential Revision: https://phabricator.services.mozilla.com/D170580
2023-03-17 08:03:07 +00:00
Nicolas Chevobbe
4d4cc89d5e Bug 1818768 - Turn ScriptLoadContext mLineNo unsigned. r=hsivonen.
Differential Revision: https://phabricator.services.mozilla.com/D170919
2023-02-28 12:07:31 +00:00
Jon Coppeard
9041daf265 Bug 1809861 - Part 1: Simplify and clean up off-main thread script compilation r=smaug
The main change in this patch is to prevent access to main-thread objects
while off-thread. This is done by using nsMainThreadPtrHandle to wrap main
thread pointers in the runnable. This prevents access to their targets when
off thread and ensure they are only released on the main thread.

This means that mRunnable is now only accessed on the main thread and so it
doesn't need to be atomic and can be a normal RefPtr. We also don't need to
leak a reference to it in AttemptOffThreadScriptCompile.

This also requires that timing data is moved to the runnable.

Cancellation should always have happened by unlink or destruction of
ScriptLoadContext so handling for that is removed.

Differential Revision: https://phabricator.services.mozilla.com/D166667
2023-01-17 17:06:50 +00:00
Stanca Serban
6a0d860e76 Backed out 3 changesets (bug 1809861) for causing bustages in ScriptLoader.cpp. CLOSED TREE
Backed out changeset d8b7cb85d87f (bug 1809861)
Backed out changeset fa4190d9f97e (bug 1809861)
Backed out changeset 15b4b4f318a7 (bug 1809861)
2023-01-17 17:56:26 +02:00
Jon Coppeard
62c190d44c Bug 1809861 - Part 1: Simplify and clean up off-main thread script compilation r=smaug
The main change in this patch is to prevent access to main-thread objects
while off-thread. This is done by using nsMainThreadPtrHandle to wrap main
thread pointers in the runnable. This prevents access to their targets when
off thread and ensure they are only released on the main thread.

This means that mRunnable is now only accessed on the main thread and so it
doesn't need to be atomic and can be a normal RefPtr. We also don't need to
leak a reference to it in AttemptOffThreadScriptCompile.

This also requires that timing data is moved to the runnable.

Cancellation should always have happened by unlink or destruction of
ScriptLoadContext so handling for that is removed.

Differential Revision: https://phabricator.services.mozilla.com/D166667
2023-01-17 14:37:06 +00:00
Yulia Startsev
32c96913a6 Bug 1800496 - Re-introduce Cycle Collected LoadContextBase for Workers; r=jonco
The non-cycle collected LoadContextBase caused failures for Module Workers. This reverts that change

Differential Revision: https://phabricator.services.mozilla.com/D162214
2022-11-18 10:02:26 +00:00
Yulia Startsev
17fd034c7a Bug 1797327 - Introduce CC'd and non CC'd variants of LoadContextBase; r=jonco
In order to use the WorkerLoadContext as a handle for ScriptLoadRequests in the main thread portion
of worker loading, we need to make it thread safe. Which means, it cannot be CC'd, and we need to
manually break cycles. This patch does the first portion of this work, which is inroduce two new
loadContextBase classes, that are either cc'd or not cc'd. For the DOM and mozJSComponent loader, we
continue to use a CC'd LoadContextBase. Workers however now have a non-cc'd variant.

Differential Revision: https://phabricator.services.mozilla.com/D160333
2022-11-01 18:03:34 +00:00
Kagami Sascha Rosylight
544bfe11bc Bug 1768189 - Part 26: Apply modernize-concat-nested-namespaces to dom/reporting/ReportingHeader.cpp ... r=andi
Depends on D145759

Differential Revision: https://phabricator.services.mozilla.com/D145760
2022-05-09 20:41:13 +00:00
Yulia Startsev
f1dd84285f Bug 1763372 - Add LoadContextBase; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D143036
2022-04-22 13:24:09 +00:00
Yulia Startsev
9c4d96a57d Bug 1763586 - Adjust ScriptFetchOptions to be more accurate; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143137
2022-04-21 09:53:33 +00:00
criss
1a5e600ac1 Backed out 4 changesets (bug 1763586) for causing mochitest failures on test_Debugger.Source.prototype.elementAttribute.html. CLOSED TREE
Backed out changeset 8da9574159d3 (bug 1763586)
Backed out changeset 8f964a9e2f31 (bug 1763586)
Backed out changeset 420105516ec3 (bug 1763586)
Backed out changeset 68cd444d018e (bug 1763586)
2022-04-19 16:28:30 +03:00
Yulia Startsev
edce198b19 Bug 1763586 - Adjust ScriptFetchOptions to be more accurate; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143137
2022-04-19 12:28:48 +00:00