Commit Graph

435 Commits

Author SHA1 Message Date
Yulia Startsev
ee9409f288 Bug 1764598 - LoadHandler part 4: Rename CacheScriptLoader and LoaderListener to {Cache,Network}LoadHandler; r=asuth
This makes the relationship between these classes and the dom ScriptLoadHandler clearer. Once we
move to ScriptLoadRequests, these three classes will share a loadhandler class which will take care
of script decoding.

Differential Revision: https://phabricator.services.mozilla.com/D145063
2022-05-03 10:16:58 +00:00
Yulia Startsev
0e661b2f30 Bug 1764598 - LoadHandler part 3: Move {DataReceivedFromCache,DataReceived} from WorkerScriptLoader to CacheScriptLoader; r=asuth
Similar to what was done with the prior patch, this can be described as the companion method to
loading from the network in the LoaderListener, with special requirements in terms of how it populates the loaded request
data and updates the WorkerPrivate. At some point, it may make sense to have the service worker loader as a child class of the
main worker loader, but that won't be done here (I hope anyway).

Differential Revision: https://phabricator.services.mozilla.com/D144838
2022-05-03 10:16:57 +00:00
Yulia Startsev
198e57869b Bug 1764598 - LoadHandler Part 2: Rename LoaderListener {OnStartRequest, OnStreamComplete}Internal methods; r=asuth
We don't have a correlation to these methods in the ScriptLoadHandler on the DOM side. For now,
rename them to make the difference clear.

Differential Revision: https://phabricator.services.mozilla.com/D144837
2022-05-03 10:16:57 +00:00
Yulia Startsev
0e7fc59155 Bug 1764598 - LoadHandler Part 1: Move onStreamComplete and onStartRequest methods from WorkerScriptLoader to LoaderListener; r=asuth
The LoaderListener is currently used to forward events to WorkerScriptLoader. It fills a similar
role to the ScriptLoadHandler on the DOM both for OnStartRequest and OnStreamComplete. In the case
of the DOM loader, the responsibility for performing certain channel related tasks is left to the
ScriptLoadHandler, in particular the decoding of the string into UTF8 or UTF16.

While the decoding is embedded in the onStreamCompleteInternal method, it is not a 1:1 mapping.
Some of the responsibilities handled in the `OnStreamCompleteInternal` method are instead handled in
`ScriptLoader::PrepareLoadedRequest`, such as populating the SourceMaps field, managing the channel,
etc are normally handled within the ScriptLoader.

However, in the case of the WorkerScriptLoader we have two paths to reach a completed load:
* from the network
* from the cache

These have different requirements in terms of preparing the loaded request, for example the cache
does not forward a SourceMap.

In the interest of not complicating things too much, for now the method is moved wholesale into
LoaderListener. In a separate PR I will handle renaming. The next step will be to do a similar move
for the CacheScriptLoader.

Differential Revision: https://phabricator.services.mozilla.com/D144836
2022-05-03 10:16:57 +00:00
Yulia Startsev
f956eab21f Bug 1764598 - WSL Part 6: Rename WorkerScriptLoader Evaluation methods; r=asuth
This just brings us a bit closer to the DOM pattern of Script Loading. One difference is that we
evaluate a source buffer instead of a JSScript, so rather than "Execute", we will still ahandle data
using "Evaluate". Maybe later we can make these two methods on the SpiderMonkey side a bit more
descriptive. For now this gets us pretty close to the goal of "if you know the DOM script loader, you know the
Worker Script loader" and vice-versa.

Differential Revision: https://phabricator.services.mozilla.com/D145065
2022-05-03 10:16:56 +00:00
Yulia Startsev
144954b1fd Bug 1764598 - WSL Part 5: Rename ExecuteFinishedScripts to "DispatchProcessPendingRequests"; r=asuth
This is mostly to bring us in line with the naming of everything else, and also make it clear that
we are crossing a thread boundary.

Differential Revision: https://phabricator.services.mozilla.com/D144990
2022-05-03 10:16:56 +00:00
Yulia Startsev
d9d7613ba9 Bug 1764598 - WSL Part 4: Move contents of Prerun and WorkerRun to named functions on WorkerScriptLoader; r=asuth
Continuation of integrating methods from the ScriptExecutorRunnable into the WorkerScriptLoader. In this
case, the primarily function being moved here is the batch evaluation of scripts. This roughly
aligns with the ProcessPendingRequests. The function has been renamed to reflect the similarity of
responsibilities between the two classes.

As a driveby change -- the prerun function now only has one responsibility, and it is related to
loading so this has been moved and named.

Differential Revision: https://phabricator.services.mozilla.com/D144961
2022-05-03 10:16:56 +00:00
Yulia Startsev
5bf297f41e Bug 1764598 - WSL Part 3: Move ScriptExecutorRunnable methods to WorkerScriptLoader; r=asuth
Part 1 of integrating the operations that the ScriptExecutorRunnable was doing on the
WorkerScriptLoader into the WorkerScriptLoader itself. This first pass moves some of the smaller,
contained functions over to the WorkerScriptLoader: The shutdown, evaluate and logging methods.

Differential Revision: https://phabricator.services.mozilla.com/D144327
2022-05-03 10:16:55 +00:00
Yulia Startsev
562439e0f3 Bug 1764598 - WSL Part 2: Create a DispatchLoadScripts method; r=asuth
This encompasses the dispatching of the loader runnable as part of the api of WorkerScriptLoader.
The same pattern will be used for the ScriptExecutorRunnable. We might be able to just use an NS
runnable method instead here, if that is preferred.

Differential Revision: https://phabricator.services.mozilla.com/D144991
2022-05-03 10:16:55 +00:00
Yulia Startsev
980230049a Bug 1764598 - WSL Part 1: Separate Runnable from WorkerScriptLoader; r=asuth
We are gradually moving closer towards a ScriptLoader implementation based on the DOM ScriptLoader.

The patch is done in three parts:

* WorkerScriptLoader adjustments (WSL Parts 1-6)
* LoaderHandler class adjustments (LoadHandler Parts 1-4)
* Cleanups

The class ScriptLoaderRunnable was being passed between runnables to access information
that was shared. That role will now be done by the WorkerScriptLoader which will eventually inherit
from ScriptLoaderInterface. This is the basis for building up the Module Loader implementation for
workers. This first patch splits the responsibility of the runnable and the data holding class.

In the next few patches, methods from the ScriptExecutorRunnable will also be moved into this class,
and the runnables themselves will no longer hold execution information. Instead, they will be used
as dispatchers to have the work run in the correct place. In the next step, the same pattern will be
done with the ScriptExecutorRunnable.

Differential Revision: https://phabricator.services.mozilla.com/D144326
2022-05-03 10:16:55 +00:00
Yulia Startsev
8cb8dbd6b2 Bug 1764596 - record muted error flag on first failure on mScriptLoader; r=asuth
Depends on D144276

Differential Revision: https://phabricator.services.mozilla.com/D144277
2022-04-26 14:24:28 +00:00
Yulia Startsev
4a73f38cf5 Bug 1764596 - remove aLoadInfosAlreadyExecuted span; r=asuth
aLoadInfosAlreadyExecuted is used to track two pieces of state, but we are doing iteration to do
this. Instead, we can track the same state by two booleans: We know all scripts are ready to execute
if we are at the end of the mLoadInfos list. We know that we have failed if we record if any script
fails on mScriptLoader.

Depends on D143621

Differential Revision: https://phabricator.services.mozilla.com/D144276
2022-04-26 14:24:28 +00:00
Yulia Startsev
8ac4c40a41 Bug 1764596 - Pass script urls directly rather than constructing ScriptLoadInfo; r=asuth
Depends on D143620

Differential Revision: https://phabricator.services.mozilla.com/D143621
2022-04-26 14:24:28 +00:00
Yulia Startsev
f81fffe570 Bug 1764596 - Remove mReservedClientInfo from ScriptLoadInfo; r=asuth
Depends on D143619

Differential Revision: https://phabricator.services.mozilla.com/D143620
2022-04-26 14:24:27 +00:00
Yulia Startsev
1cab1857c4 Bug 1764596 - Remove nsLoadFlags from ScriptLoadInfo; r=asuth
Depends on D143037

Differential Revision: https://phabricator.services.mozilla.com/D143619
2022-04-26 14:24:27 +00:00
Emilio Cobos Álvarez
76b6dc6000 Bug 1755947 - Simplify nsIPrincipal.isSameOrigin(). r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D139030
2022-02-17 18:11:58 +00:00
Frederik Braun
b3a4644f47 Bug 1754301 - remove pref security.csp.enable r=ckerschb,mccr8
This removes the pref `security.csp.enable` and amends various callers
in dom/, which no longer have to take this pref into consideration.

Furthermore, we can remove the test in dom/base/test/browser_bug593387.js
The test used the pref to test that external content can be embedded into
about:plugins, which is historic baggage from a previous architecture of
said page that we no longer require. It's also an anti-pattern that we
do not want to support any longer. In fact, the test had to jump through
additional hoops to make that work at all.

Differential Revision: https://phabricator.services.mozilla.com/D138661
2022-02-15 16:03:27 +00:00
Sylvestre Ledru
35a175aa33 Bug 1754767 - Remove duplicate includes r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D138441
2022-02-11 10:01:15 +00:00
Jan Rio Krause
d038b5a589 Bug 1748503 - Consistent error messages for blocked scripts. r=dom-storage-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D136535
2022-01-26 18:27:07 +00:00
Eden Chuang
fe1a5665bf Bug 1744025 - Replace include "mozilla/dom/WorkerPrivate.h" with include "mozilla/dom/WorkerScope.h" where WorkerPrivate->GlobalScope() is called. r=dom-worker-reviewers,smaug,jstutte
#include "mozilla/dom/WorkerScope.h" is removed from WorkerPrivate.h, where calling WorkerPrivate::GlobalScope() without include "WorkerScope.h" makes WorkerScope as an incomplete type.


Depends on 132800

Depends on D132800

Differential Revision: https://phabricator.services.mozilla.com/D133483
2022-01-25 08:53:03 +00:00
Matthew Gaudet
108063d593 Bug 1748888 - Add ErrorResult parameter to PromiseNativeHandler callbacks r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D136423
2022-01-20 19:11:39 +00:00
Jens Stutte
d600f5b7bb Bug 1741182: Harmonize WorkerRunnable derived classes' overrides of Cancel. r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D135679
2022-01-12 14:43:09 +00:00
Jan Rio Krause
6c3b1c17e8 Bug 1740985 - Consistent error messages for scripts which failed to load. r=dom-storage-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D133515
2021-12-17 16:18:24 +00:00
Norisz Fay
20994191cc Backed out 9 changesets (bug 1744025) for causing wpt failures on CheckedUnsafePtr.h CLOSED TREE
Backed out changeset 89dca4fc5940 (bug 1744025)
Backed out changeset 7aa395dcdbe4 (bug 1744025)
Backed out changeset 1580a4ea1a85 (bug 1744025)
Backed out changeset af171636a87f (bug 1744025)
Backed out changeset a5edfa1c9cd6 (bug 1744025)
Backed out changeset 8abd6ba69815 (bug 1744025)
Backed out changeset cfb822df5b3f (bug 1744025)
Backed out changeset 5598943a94fd (bug 1744025)
Backed out changeset 43186fbbf8b4 (bug 1744025)
2021-12-15 18:46:01 +02:00
Eden Chuang
08515f6937 Bug 1744025 - Replace include "mozilla/dom/WorkerPrivate.h" with include "mozilla/dom/WorkerScope.h" where WorkerPrivate->GlobalScope() is called. r=dom-worker-reviewers,smaug,jstutte
#include "mozilla/dom/WorkerScope.h" is removed from WorkerPrivate.h, where calling WorkerPrivate::GlobalScope() without include "WorkerScope.h" makes WorkerScope as an incomplete type.


Depends on 132800

Depends on D132800

Differential Revision: https://phabricator.services.mozilla.com/D133483
2021-12-15 13:48:19 +00:00
Tim Huang
6c6ca2d4ff Bug 1731982 - Part 11: Set the IsThirdPartyContextToTopWindow flag to the main worker script loading channel. r=asuth
When loading the main worker script, we will need to get the clientInfo
for the loading channel. However, the loading channel is created in
content processes and the `IsThirdPartyContextToTopWindow` won't be set
in this case. So, we will get an incorrect clientInfo with a wrong
foreign patitioned principal.

To resolve this, we have to set the flag in the content processes so
that we can get a correct clientInfo. The flag comes from the
workerPrivate which reflects the fact if the worker was created in a
third-party context. And the loading channel should have the same flag
as the document which creates the worker.

Differential Revision: https://phabricator.services.mozilla.com/D129060
2021-11-25 13:11:33 +00:00
Alexandru Michis
53e33238e3 Backed out 12 changesets (bug 1731982, bug 1736401) for causing crashes. a=backout
DONTBUILD

Backed out changeset ab85eef8a4fd (bug 1736401)
Backed out changeset 347ce2439936 (bug 1731982)
Backed out changeset fa0ff1505daa (bug 1731982)
Backed out changeset 5b1f2b0a5673 (bug 1731982)
Backed out changeset 4adc65d2f1a3 (bug 1731982)
Backed out changeset a8700204af07 (bug 1731982)
Backed out changeset 88bd00ed8d94 (bug 1731982)
Backed out changeset 80bd8c79b931 (bug 1731982)
Backed out changeset 58ca3a94fec0 (bug 1731982)
Backed out changeset 0b28570dea43 (bug 1731982)
Backed out changeset 23524ce67bb9 (bug 1731982)
Backed out changeset d29cc06a65db (bug 1731982)
2021-11-09 09:23:38 +02:00
Tim Huang
8cf271c8bb Bug 1731982 - Part 11: Set the IsThirdPartyContextToTopWindow flag to the main worker script loading channel. r=asuth
When loading the main worker script, we will need to get the clientInfo
for the loading channel. However, the loading channel is created in
content processes and the `IsThirdPartyContextToTopWindow` won't be set
in this case. So, we will get an incorrect clientInfo with a wrong
foreign patitioned principal.

To resolve this, we have to set the flag in the content processes so
that we can get a correct clientInfo. The flag comes from the
workerPrivate which reflects the fact if the worker was created in a
third-party context. And the loading channel should have the same flag
as the document which creates the worker.

Differential Revision: https://phabricator.services.mozilla.com/D129060
2021-11-08 14:30:57 +00:00
Eden Chuang
d545418095 Bug 1577346 - P3 Make InternalResponse be SafeRefcounted. r=dom-worker-reviewers,ytausky
Depends on D126243

Differential Revision: https://phabricator.services.mozilla.com/D126244
2021-11-08 13:29:32 +00:00
Simon Giesecke
c85dd9850f Bug 1678561 - Fix includes in dom/workers to some degree. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D97741
2020-11-26 13:21:15 +00:00
Simon Giesecke
46908cfb51 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Andi-Bogdan Postelnicu
7ac411be49 Bug 1626555 - Add dom/workers to the list of non-unified-build-compatible directories. r=sg
Differential Revision: https://phabricator.services.mozilla.com/D97170
2020-11-16 19:57:14 +00:00
Razvan Maries
f99b00ee89 Backed out 2 changesets (bug 1626555) as per Andi's request. CLOSED TREE
Backed out changeset 22e23d9340a2 (bug 1626555)
Backed out changeset 02ea10ade875 (bug 1626555)
2020-11-16 18:45:15 +02:00
Andi-Bogdan Postelnicu
9d17b80020 Bug 1626555 - Add dom/workers to the list of non-unified-build-compatible directories. r=sg
Differential Revision: https://phabricator.services.mozilla.com/D97170
2020-11-16 15:56:30 +00:00
Christoph Kerschbaumer
4bfa1cbf21 Bug 1552168: Remove pref security.data_uri.unique_opaque_origin. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D92087
2020-10-08 16:55:25 +00:00
Christoph Kerschbaumer
df7d9d5329 Bug 1666751: Use simple and never failing LoadInfo() getter because all channels should have a loadinfo r=freddyb,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D91119
2020-09-23 12:49:40 +00:00
Sonia Singla
031ef8acbe Bug 1528649 - Remove the context parameter from nsInputStreamPump::AsyncRead. r=valentin,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D85154
2020-08-05 11:21:51 +00:00
Andrew Sutherland
e18cc98142 Bug 1634872 - Correct spec compliance issue. r=baku
Differential Revision: https://phabricator.services.mozilla.com/D81114
2020-07-19 18:05:10 +00:00
Simon Giesecke
c7bc939952 Bug 1652960 - Remove unnecessary includes from Document.h. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D83634
2020-07-15 15:48:53 +00:00
Frederik Braun
617d3006d9 Bug 1366973: Rename security flags to not contain DATA anymore r=geckoview-reviewers,ckerschb,snorp
Differential Revision: https://phabricator.services.mozilla.com/D83490
2020-07-15 11:20:45 +00:00
Logan Smyth
af5b174fa2 Bug 780269 - Pass (X-)SourceMap header to SpiderMonkey for workers. r=perry
Differential Revision: https://phabricator.services.mozilla.com/D70293
2020-07-07 21:19:58 +00:00
Simon Giesecke
a69d79b6db Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Simon Giesecke
e99ddcd933 Bug 1648449 - Use NotNull for CacheCreator::mLoaders. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D81076
2020-06-30 08:35:19 +00:00
Simon Giesecke
4f3e68f174 Bug 1648449 - Use TransformIntoNewArray in Load. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D81075
2020-06-30 08:35:01 +00:00
Simon Giesecke
8d4eeb1092 Bug 1648449 - Remove intermediate conversion from iterators to indexes. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D81073
2020-06-30 08:34:49 +00:00
Simon Giesecke
a459bb4459 Bug 1648449 - Pass Span instead of indexes to ScriptExecutorRunnable. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D81072
2020-06-30 08:34:36 +00:00
Simon Giesecke
7ec1c7e87d Bug 1648449 - Use range-based for for iterating mLoadInfos. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D81070
2020-06-30 08:34:21 +00:00
Simon Giesecke
940f4f9b99 Bug 1648449 - Stop passing around indexes to mLoadInfos. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D81069
2020-06-30 08:34:09 +00:00
Simon Giesecke
08555f2d4f Bug 1648449 - Improve variable naming and comments related to script scheduling. r=asuth,dom-workers-and-storage-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D81499
2020-06-30 08:33:51 +00:00
Simon Giesecke
b6858c46d9 Bug 1648449 - Use nsTArrayView for ScriptLoaderRunnable::mLoadInfos. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D81068
2020-06-29 11:58:28 +00:00