Commit graph

215 commits

Author SHA1 Message Date
Valentin Gosu
8021d46fcb Bug 1785678 - Move IsValidProtocolString check earlier r=necko-reviewers,kershaw
We should check the valid protocol before we actually instantiate WebSocketImplProxy

Differential Revision: https://phabricator.services.mozilla.com/D208596
2024-04-25 19:14:57 +00:00
Eden Chuang
2f65cf28ae Bug 1769913 - P3 Remove WorkerRunnable::mWorkerPrivate. r=dom-worker-reviewers,asuth
WorkerRunnable no longer keeps a raw pointer(mWorkerPrivate) for the associated WorkerPrivate in this patch.
Removing the WorkerRunnable::mWorkerPrivate needs to fix the following problems.

1. Thread assertions in WorkerRunnable::Dispatch()

To fix this problem, the associated WorkerPrivate is as a parameter and passed to WorkerRunnable::Dispatch() for the dispatching thread assertions. This associated WorkerPrivate is also propagated to PreDispatch() and PostDispatch() for the children classes of WorkerRunnable()

2. Get the associated WorkerPrivate in WorkerRunnable::Run() for environment setup(GlobabObject, JSContext setting for the runnable)

- For WorkerThreadRunnable

Since WorkerThreadRunnable is supposed to run on the worker thread, it does not need to keep a raw pointer to WorkerPrivate as its class member. GetCurrentThreadWorkerPrivate() should always get the correct WorkerPrivate for WorkerThreadRunnable.

- For WorkerParentThreadRunnable

WorkerParentRef is introduced to keep a RefPtr<WorkerPrivate> for WorkerParentThreadRunnable instead of using a raw pointer.
Checking the associated WorkerPrivate existence by WorkerParentRef at the beginning of WorkerParentThreadRunnable::Run(). If the Worker has already shut down, WorkerParentThreadRunnable cannot do anything with the associated WorkerPrivate, so WorkerParentThreadRunnable::Run() will return NS_OK directly but with a warning.

The associated WorkerPrivate is also passed into WorkerRun(), PreRun(), and PostRun(), so the majority of implementations of child classes of WorkerRunnable do not need to be changed.

If there are any cases in which the child classes of WorkerThreadRunnable/WorkerParentThreadRunnable want to keep the associated WorkerPrivate, they should use WorkerRefs instead of raw pointers.

Depends on D205679

Differential Revision: https://phabricator.services.mozilla.com/D207039
2024-04-19 09:41:58 +00:00
Eden Chuang
8f38838e6e Bug 1769913 - P2 WorkerParentThreadRunnable for the runnables dispatched to worker's parent thread. r=dom-worker-reviewers,asuth
In this patch, WorkerParentThreadRunnable is extracted from WorkerThreadRunnable for runnable on the parent thread.

WorkerParentControlRunnable and WorkerParentDebuggeeRunnable are also created for control runnable and debuggee runnable on the parent thread.

Instead of using WorkerRunnable::Target to indicate the thread target, inheriting WorkerThreadRunnable or WorkerParentThreadRunnable to point out that this runnable should run on the worker thread or on the parent thread. So WorkerRunnable::Target is removed in this patch.

This patch also move the dispatching logic into WorkerPrivate to simplify WorkerRunnable::DispatchInternal()'s implementation.

Depends on D205178

Differential Revision: https://phabricator.services.mozilla.com/D205679
2024-04-19 09:41:57 +00:00
Eden Chuang
e22d6ca385 Bug 1769913 - P1 Make WorkerRunnable to be a base class for runnables on Worker thread and Worker's parent thread. r=dom-worker-reviewers,asuth
This is the first step in splitting the parent thread runnable out of WorkerRunnable.

To reuse the runnable dispatching codes in Worker, we still need a base class for runnable on the worker thread and the parent thread.

In this patch, we rename the original WorkerRunnable to WorkerThreadRunnable and make WorkerRunnable to be WorkerThreadRunnable's parent class.

In the second patch, we will create WorkerParentThreadRunnable and its sub-classes, split from WorkerThreadRunnable for runnable on the Worker's parent thread.

And in the third patch, we will re-structure the content of WorkerParentThreadRunnable to remove unnecessary members.

Differential Revision: https://phabricator.services.mozilla.com/D205178
2024-04-19 09:41:57 +00:00
Jens Stutte
a4a855b0e3 Bug 1880233 - Add names to MainThreadWorkerRunnable derived runnables. r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D201812
2024-02-14 16:13:24 +00:00
Kershaw Chang
4b94532a31 Bug 1877744 - Make sure WebSocketImpl::OnStart is called on target thread, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D200368
2024-02-12 10:12:04 +00:00
Stanca Serban
c3672410f7 Backed out changeset 6ab0ac80ff45 (bug 1877744) for causing build bustages in WebSocket.cpp. CLOSED TREE 2024-02-06 15:25:17 +02:00
Kershaw Chang
3d9e128594 Bug 1877744 - Make sure WebSocketImpl::OnStart is called on target thread, r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D200368
2024-02-06 12:32:14 +00:00
Jens Stutte
a2709c2f0e Bug 1875800 - Add name support to WorkerRunnable. r=dom-worker-reviewers,asuth,smaug
Differential Revision: https://phabricator.services.mozilla.com/D199228
2024-01-24 16:00:26 +00:00
Oliver Medhurst
1dbadb53c7 Bug 1797449 - [websocket] Allow relative URLs and http(s) scheme r=valentin
Add support to WebSocket for http: and https: URLs,
as well as having them be relative to a base URI.

Spec: https://github.com/whatwg/websockets/issues/20

Passes new WPT tests for this in /websockets, with other tests unaffected.

Also updated our tests to expect these URLs to be successful instead of fail.

Differential Revision: https://phabricator.services.mozilla.com/D160330
2024-01-23 17:23:17 +00:00
Cristian Tuns
741982b984 Backed out changeset f3efca74da0f (bug 1875800) for causing build bustages in WorkerPrivate.cpp CLOSED TREE 2024-01-23 11:20:38 -05:00
Jens Stutte
2594dc03cd Bug 1875800 - Add name support to WorkerRunnable. r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D199228
2024-01-23 11:23:41 +00:00
Norisz Fay
5064e6c34d Backed out changeset f27806eac17b (bug 1797449) for causing mochitest failure on test_websocket1.html CLOSED TREE 2024-01-23 00:42:33 +02:00
Oliver Medhurst
b94e95b889 Bug 1797449 - [websocket] Allow relative URLs and http(s) scheme r=valentin
Add support to WebSocket for http: and https: URLs,
as well as having them be relative to a base URI.

Spec: https://github.com/whatwg/websockets/issues/20

Passes new WPT tests for this in /websockets, with other tests unaffected.

Differential Revision: https://phabricator.services.mozilla.com/D160330
2024-01-22 19:06:50 +00:00
Tom Schuster
346cecd51c Bug 1872839 - Remove aMimeTypeGuess parameter from nsIContentPolicy. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D197794
2024-01-08 15:47:42 +00:00
Randell Jesup
0e77e52b38 Bug 1868177: Add ProofOfRef arguments to WebSocketImpl methods r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D195346
2023-12-08 03:34:09 +00:00
Peter Van der Beken
76d5680b9b Bug 1867945 - Use WeakPtr<Document> instead of nsWeakPtr. r=dom-core,farre
Differential Revision: https://phabricator.services.mozilla.com/D195342
2023-12-07 18:47:44 +00:00
Iulian Moraru
5050d77483 Backed out changeset f03b7de13ed6 (bug 1867945) for causing leaks at WeakReference. CLOSED TREE 2023-12-07 16:24:40 +02:00
Peter Van der Beken
b0e0b34ea6 Bug 1867945 - Use WeakPtr<Document> instead of nsWeakPtr. r=dom-core,farre
Differential Revision: https://phabricator.services.mozilla.com/D195342
2023-12-07 13:42:07 +00:00
Iulian Moraru
90a1a93d02 Backed out changeset 5bb6f99c6029 (bug 1868177) for causing multiple failures related to websocket. 2023-12-05 05:40:59 +02:00
Randell Jesup
4faadd5909 Bug 1868177: Add ProofOfRef arguments to WebSocketImpl methods r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D195346
2023-12-04 22:26:45 +00:00
Olli Pettay
c7c9a42f7c Bug 1846328, follow COM-rules when calling impl methods, r=jesup
Differential Revision: https://phabricator.services.mozilla.com/D195337
2023-12-04 16:40:04 +00:00
Olli Pettay
2a425d001a Bug 1867927 - WebSocketImpl::Dispatch may try to dispatch to main thread too late, r=jesup
Differential Revision: https://phabricator.services.mozilla.com/D195336
2023-12-03 19:43:01 +00:00
Peter Van der Beken
1af728d973 Bug 1866008 - Remove nsContentUtils::CreateArrayBuffer. r=farre
Differential Revision: https://phabricator.services.mozilla.com/D194460
2023-11-24 08:46:22 +00:00
Tooru Fujisawa
244ca5ae28 Bug 1864168 - Part 4: Use 1-origin column number for WebSocket-related console message. r=smaug,devtools-reviewers,ochameau
Differential Revision: https://phabricator.services.mozilla.com/D193372
2023-11-22 12:31:32 +00:00
Tooru Fujisawa
8c59289f4f Bug 1864168 - Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D193369
2023-11-22 12:31:30 +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
24c1f43199 Bug 1864168 - Part 4: Use 1-origin column number for WebSocket-related console message. r=smaug,devtools-reviewers,ochameau
Differential Revision: https://phabricator.services.mozilla.com/D193372
2023-11-22 11:13:55 +00:00
Tooru Fujisawa
a4a513ad86 Bug 1864168 - Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D193369
2023-11-22 11:13:54 +00:00
Eden Chuang
76d6e6b69c Bug 1836700 - Remove BusyCount of WorkerPrivate. r=asuth,ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D182718
2023-11-13 04:00:40 +00:00
Tooru Fujisawa
c8916f8e8e Bug 1862692 - Part 16: Use 1-origin column number type in JS::DescribeScriptedCaller. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D193029
2023-11-09 11:41:10 +00:00
Emilio Cobos Álvarez
25c0d10932 Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
june wilde
692c851b42 Bug 1844646 - Add check for data and blob URIs in WebSocketImpl::IsSecure; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D184954
2023-09-29 22:26:04 +00:00
Peter Van der Beken
627ac90e0c Bug 1690111 - Use new TypedArray APIs for processing data. r=farre,media-playback-reviewers,padenot,chunmin,sfink
Depends on D152497

Differential Revision: https://phabricator.services.mozilla.com/D152498
2023-09-20 09:42:02 +00:00
Peter Van der Beken
cdd05c282d Bug 1690111 - Use new TypedArray APIs for appending data to a container. r=farre,extension-reviewers,media-playback-reviewers,kmag,alwu,padenot
Depends on D152494

Differential Revision: https://phabricator.services.mozilla.com/D152495
2023-09-20 09:42:01 +00:00
Cosmin Sabou
680b4364c7 Backed out 13 changesets (bug 1690111) for causing fetch related crashes.
Backed out changeset 5f2c25d194ad (bug 1690111)
Backed out changeset 76c408bcd053 (bug 1690111)
Backed out changeset 6d0649fdafff (bug 1690111)
Backed out changeset c1330b5e8c43 (bug 1690111)
Backed out changeset 5fa36d8fd2a5 (bug 1690111)
Backed out changeset daf7d747853a (bug 1690111)
Backed out changeset f70e09a7f5c6 (bug 1690111)
Backed out changeset 40c6d6eed7f8 (bug 1690111)
Backed out changeset 692f2a759573 (bug 1690111)
Backed out changeset 7140866dd9f6 (bug 1690111)
Backed out changeset 2865fe682139 (bug 1690111)
Backed out changeset 9dcd2416f8a5 (bug 1690111)
Backed out changeset 9c411bf84079 (bug 1690111)
2023-09-11 17:55:24 +03:00
Peter Van der Beken
5738c01ba3 Bug 1690111 - Use new TypedArray APIs for processing data. r=farre,media-playback-reviewers,padenot,chunmin,sfink
Depends on D152497

Differential Revision: https://phabricator.services.mozilla.com/D152498
2023-09-11 12:52:20 +00:00
Peter Van der Beken
39cc003472 Bug 1690111 - Use new TypedArray APIs for appending data to a container. r=farre,extension-reviewers,media-playback-reviewers,kmag,alwu,padenot
Depends on D152494

Differential Revision: https://phabricator.services.mozilla.com/D152495
2023-09-11 12:52:20 +00:00
Kershaw Chang
a8a7c5bf02 Bug 1846328 - Add more release assertions, r=necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D186618
2023-09-01 06:17:30 +00:00
Tooru Fujisawa
357b9c51d8 Bug 1847469 - Part 24: Use column number types in JS::DescribeScriptedCaller. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185762
2023-08-16 17:31:42 +00:00
Tooru Fujisawa
264b992ca0 Bug 1847469 - Part 23: Use uint32_t for line and column in DescribeScriptedCaller* functions as a preparation to use column number types. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185761
2023-08-16 17:31:41 +00:00
Cristian Tuns
4fe9ed8f30 Backed out 27 changesets (bug 1847469) for causing spidermonkey bustages in Script.cpp CLOSED TREE
Backed out changeset 9d6e2651a013 (bug 1847469)
Backed out changeset 9b72d668efd2 (bug 1847469)
Backed out changeset 86abf5cf0a22 (bug 1847469)
Backed out changeset 46833087f8ac (bug 1847469)
Backed out changeset f3e2207fdeec (bug 1847469)
Backed out changeset aed75776cfff (bug 1847469)
Backed out changeset 8292a38bd99f (bug 1847469)
Backed out changeset 1320f83fb8c7 (bug 1847469)
Backed out changeset df9f925f9837 (bug 1847469)
Backed out changeset 69f32cf1862a (bug 1847469)
Backed out changeset b2ddddec8818 (bug 1847469)
Backed out changeset 056eed7abc97 (bug 1847469)
Backed out changeset 5df4f43ac0bf (bug 1847469)
Backed out changeset cb57923f6532 (bug 1847469)
Backed out changeset a0993f2a2195 (bug 1847469)
Backed out changeset 782499fbedf2 (bug 1847469)
Backed out changeset cf84fb98c5e1 (bug 1847469)
Backed out changeset 1fa5ab59814b (bug 1847469)
Backed out changeset f5f78944df81 (bug 1847469)
Backed out changeset aa14337bf5c6 (bug 1847469)
Backed out changeset 6757db4575d7 (bug 1847469)
Backed out changeset 236ff135701e (bug 1847469)
Backed out changeset 9b4d5b435020 (bug 1847469)
Backed out changeset a0f789621bc8 (bug 1847469)
Backed out changeset c19b81f48055 (bug 1847469)
Backed out changeset b4521e546d7e (bug 1847469)
Backed out changeset f26a10289316 (bug 1847469)
2023-08-16 07:08:01 -04:00
Tooru Fujisawa
5c4dc17c44 Bug 1847469 - Part 24: Use column number types in JS::DescribeScriptedCaller. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185762
2023-08-16 10:26:33 +00:00
Tooru Fujisawa
f61ba91ee2 Bug 1847469 - Part 23: Use uint32_t for line and column in DescribeScriptedCaller* functions as a preparation to use column number types. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185761
2023-08-16 10:26:33 +00:00
Peter Van der Beken
3f4ffadbe1 Bug 1846277 - Untangle nsGlobalWindow*.h includes. r=dom-core,media-playback-reviewers,sessionstore-reviewers,padenot,farre
Differential Revision: https://phabricator.services.mozilla.com/D184978
2023-08-02 20:41:49 +00:00
Peter Van der Beken
9fba1d5220 Bug 1846277 - Remove nsGlobalWindow.h. r=dom-core,necko-reviewers,jesup,farre
Differential Revision: https://phabricator.services.mozilla.com/D184973
2023-08-02 20:41:48 +00:00
Nika Layzell
1fdee2314c Bug 1839920 - Rename Get{ASCII,UTF}Origin to GetWebExposedOriginSerialization, r=smaug,necko-reviewers,anti-tracking-reviewers,bvandersloot,jesup
This should make uses of the type more clearly indicating where the
origin came from, and should help avoid potential confusion between this
origin and nsIPrincipal::origin in new code.

This new name is long, but explicit. The string returned from this
function corresponds to the "serialization of an origin" from the WHATWG
html spec:
https://html.spec.whatwg.org/multipage/browsers.html#ascii-serialisation-of-an-origin

Differential Revision: https://phabricator.services.mozilla.com/D181794
2023-06-27 19:59:15 +00:00
Nika Layzell
9f4d22f4e0 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
CanadaHonk
40a377c3dc Bug 1819280 - [websocket] Enforce full subprotocol char checks r=valentin
Enforce all subprotocol character checks as per RFC 6455 with a new method.
(See bug for full check details.)

Differential Revision: https://phabricator.services.mozilla.com/D171219
2023-03-08 07:34:26 +00:00
Norisz Fay
cdf729cb6b Backed out changeset ed459cc665d8 (bug 1819280) for causing websocket wpt failures CLOSED TREE 2023-03-06 18:17:22 +02:00