Commit graph

298 commits

Author SHA1 Message Date
Josh Matthews
c94ac5bccb
Move various reflector types and traits to script_bindings (#35279)
* script: Move Reflector to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Extract global() helper from DomObject into new trait. Move DomObject and related traits to script_bindings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-02-04 06:58:08 +00:00
Delan Azabani
5e9de2cb61
Include WebViewId into EmbedderMsg variants where possible (#35211)
`EmbedderMsg` was previously paired with an implicit
`Option<WebViewId>`, even though almost all variants were either always
`Some` or always `None`, depending on whether there was a `WebView
involved.

This patch adds the `WebViewId` to as many `EmbedderMsg` variants as
possible, so we can call their associated `WebView` delegate methods
without needing to check and unwrap the `Option`. In many cases, this
required more changes to plumb through the `WebViewId`.

Notably, all `Request`s now explicitly need a `WebView` or not, in order
to ensure that it is passed when appropriate.

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-01-30 11:15:35 +00:00
Josh Matthews
8bb50fa3c9
Make worker script errors more informative. (#35070)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-19 07:55:26 +00:00
Josh Matthews
c94d909a86
script: Limit public exports. (#34915)
* script: Restrict reexport visibility of DOM types.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Mass pub->pub(crate) conversion.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Hide existing dead code warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix unit tests.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* More formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-10 08:19:19 +00:00
Martin Robinson
77bc7f415d
script: Use enums for event loop senders and receivers (#34896)
Previously, senders and receivers to different kinds of event loops (the
main `ScriptThread`, different types of workers) used a rust `trait`
mechanism to implement dynamic behavior. This led to having many unused
implementations of this `trait`. This change moves to using an `enum`
based approach for these senders and receivers and removes all of the
dead code.

In addition, to allowing for use of rust's dead code detection, it
simplifies the code a great deal. All of these generic senders and
receivers are moved to the `messaging.rs` file and given proper
documentation.

Finally, empty an `JSTraceable` implementation is made for all
crossbeam `Sender<...>`s to avoid having to manually skip them everytime
they are included in structs. The pre-existing empty `MallocSizeOf`
implementation is used more thoroughly.

Other unecessary wrappers around these senders and receivers are removed
as well.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-08 21:33:29 +00:00
Martin Robinson
fe8a22b72c
script: Unsilence all main thread TaskQueue errors (#34849)
No longer hide errors while queueing tasks on the main thread. This
requires creating two types of `TaskSource`s: one for the main thread
and one that can be sent to other threads. This makes queueing a bit
more efficient on the main thread and more importantly, no longer hides
task queue errors.

Fixes #25688.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2025-01-07 03:36:39 +00:00
Martin Robinson
b2eda71952
script: Move TaskManager to GlobalScope (#34827)
This is a simplification of the internal `TaskQueue` API that moves the
`TaskManager` to the `GlobalScope` itself. In addition, the handling of
cancellers is moved to the `TaskManager` as well. This means that no
arguments other than the `task` are necessary for queueing tasks, which
makes the API a lot easier to use and cleaner.

`TaskSource` now also keeps a copy of the canceller with it, so that
they always know the proper way to cancel any tasks queued on them.

There is one complication here. The event loop `sender` for dedicated
workers is constantly changing as it is set to `None` when not handling
messages. This is because this sender keeps a handle to the main
thread's `Worker` object, preventing garbage collection while any
messages are still in flight or being handled. This change allows
setting the `sender` on the `TaskManager` to `None` to allow proper
garbabge collection.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-04 08:41:50 +00:00
Martin Robinson
621ddd749c
Elide lifetimes where possible after rustup (#34824)
The new version of rust allows us to elide some lifetimes and clippy is
now complaining about this. This change elides them where possible and
removes the clippy exceptions.

Fixes #34804.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-03 18:54:44 +00:00
Martin Robinson
77cfca65c4
script: Eliminate code duplication in the task queue (#34798)
Instead of creating a type for each `TaskSource` variety have each `TaskSource`
hold the same kind of sender (this was inconsistent before, but each
sender was effectively the same trait object), a pipeline, and a
`TaskSourceName`. This elminates the need to reimplement the same
queuing code for every task source.

In addition, have workers hold their own `TaskManager`. This allows just
exposing the manager on the `GlobalScope`. Currently the `TaskCanceller`
is different, but this will also be eliminated in a followup change.

This is a the first step toward having a shared set of `Sender`s on
`GlobalScope`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-01 13:50:52 +00:00
Martin Robinson
5f927a2c28
script: Refactor channels in ScriptThread into receivers and senders (#34776)
Create two new data structures in the `script` crate to hold senders and
receiver:

- `ScriptThreadSenders`: holds all outgoing channels from the
  `ScriptThread` including a channel to the `ScriptThread` itself. The
  ultimate goal with this is to reduce duplication by giving a boxed
  version of this this to `Window`s.
- `ScriptThradReceivers`: holds all incoming channels to the
  `ScriptThread`. This isn't cloenable like the senders. This is used to
  abstract away `recv()` and `try_recv()` methods used to make the
  `ScriptThread` event loop easier to read.

In addition:

- The many duplicated `ScriptThread` self-senders for the `TaskManager`
  have been removed and, in general, a lot of boilerplate is removed as
  well.
- Visibilty of all methods affected by this change is changed to
  `pub(crate)` in order to take advantage of dead code detection. Some
  dead code produced from macros is removed.
- Some conversion code is refactord into implementations of the `From`
  trait.
- The names of channels uses a standard "sender" and "receiver" naming
  as well as trying to be descriptive of where they go in `ScriptThread`
  as well as `InitialScriptState`

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-12-26 03:34:54 +00:00
Martin Robinson
226299380d
script: Make timers per-process (#34581)
Before all timers were managed by the Constellation process, meaning
that they had to trigger IPC calls to be scheduled and fired. Currently,
timers are only used in the `ScriptThread`, so it makes sense that they
are per-process.

This change restores the timer thread functionality that existed before
avoided entirely. Completion is done using a callback that is sent to
the timer thread similarly to how fetch is done. This allows reusing the
existing task queue without making any new channels.

Fixes #15219.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-12-24 09:53:35 +00:00
atbrakhi
1591a3b506
Add webgpu feature flag (#34444)
* Move script gpu files into webgpu folder

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* Modify gpu webidls

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* move gpu realted webidl

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* add webgpu feature to script

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* add dummy implementation for gpucanvascontext

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* fmt

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* add skip-if CARGO_FEATURE_WEBGPU

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* Move NavigatorGPU and workerNavigator GPU to webgpu idl

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* fmt and cleanup

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* review fix

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* enable webgpu by default and also some fmt fix

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

* Add pref back, fix imports, small cleanups

Signed-off-by: atbrakhi <atbrakhi@igalia.com>

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
2024-12-05 16:07:27 +00:00
Josh Matthews
e956f3124c
Generate a trait abstracting over all known DOM interfaces (#34357)
* script: Generate trait for all DOM interfaces and parameterize generated Methods traits over it.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Update trait implementations with new generic type.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-11-24 07:35:14 +00:00
tanishka
fd6c100489
CanGc fixes in messageport.rs & workerglobalscope.rs (#34003)
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-25 13:53:53 +00:00
chickenleaf
7ad8822d94
cangc fixes in several files + event.rs + rtcpeerconnection.rs (#34002)
Signed-off-by: L Ashwin B <lashwinib@gmail.com>
2024-10-25 12:44:15 +00:00
tanishka
ea875f0a51
CanGc fixes from EventTarget::fire_event (#33985)
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-23 22:48:19 +00:00
tanishka
7015e0fb5f
CanGc fixes in errorevent.rs (#33960)
* CanGc fixes in errorevent.rs

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

* Allow too_many_arguments to avoid lint error

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

---------

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-22 10:08:55 +00:00
Josh Matthews
b85093ad74
Prevent moving CanGc values between threads/tasks (#33902)
* Make CanGc non-sendable, and add documentation.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Update CanGc usage to fix usages that were moved between threads/tasks.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-10-18 17:26:54 +00:00
chickenleaf
af6154cf63
More files with CanGc fixes (#33892)
* More files with CanGc fixes

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

* removed the can_gc inside !task

Signed-off-by: L Ashwin B <lashwinib@gmail.com>

---------

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
2024-10-18 13:42:43 +00:00
tanishka
f826698d6e
CanGc fixes in components/script/dom (#33891)
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-17 22:36:04 +00:00
Martin Robinson
30abb99287
clippy: Add safety documentation and clean up unsafe methods (#33748)
This change:

1. Adds safety documentation where it was missing.
2. Limits the scope of unsafe code in some cases to where it is actually
   unsafe.
3. Converts some free functions to associated functions and methods,
   thereby making them more likely to be called safely.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-10-16 08:11:31 +00:00
Samson
7cd73ef4a7
use ThreadSafeJSContext instead of ContextForRequestInterrupt (#33769)
* use `ThreadSafeJSContext` instead of `ContextForRequestInterrupt`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* use servo/mozjs

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-10-10 09:43:51 +00:00
Samson
24ad2a0526
chore: Update wgpu (#33506)
* Update wgpu

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* use all backends at runtime

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* clean up some adapter stuff

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update expectations

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* flakes

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-09-21 04:20:18 +00:00
Taym Haddadi
747e562ff0
Make CanGc derive Copy and Clone (#33407)
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-09-12 10:24:44 +00:00
Andriy Sultanov
e5150dbda1
Propagate CanGc from Document::new() (#33386)
* Add canGc as a parameter to autogenerated trait methods

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>

* Propagate CanGc from Document::new()

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>

---------

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
2024-09-09 22:38:01 +00:00
Taym Haddadi
08eb4faf4d
Initial structuredClone implementation (#32960)
* Initial structuredClone implementation

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Rename PostMessageOptions to StructuredSerializeOptions

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Update wpt test 2020 layout result

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Remove dublicated StructuredClone implementation

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Remove comment from StructuredSerializeOptions webidl

Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
2024-08-08 10:12:45 +00:00
派卡 (pi-cla)
650af7db92
webgpu: Remove mutex around Identities (#32682) 2024-07-03 18:39:45 +00:00
Peter Mikola
0a641816bf
clippy fixes regarding clone_from (#32482) 2024-06-12 17:09:56 +00:00
Martin Robinson
3398fc017b
Move non-gfx things out of gfx_traits and create a base crate (#32296)
For a long time, `gfx_traits` has held a lot of things unrelated to graphics
and also unrelated to the `gfx` crate (which is mostly about fonts).
This is a cleanup which does a few things:

1. Move non `gfx` crate things out of `gfx_traits`. This is important in
   order to prevent dependency cycles with a different integration between
   layout, script, and fonts.
2. Rename the `msg` crate to `base`. It didn't really contain anything
   to do with messages and instead mostly holds ids, which are used
   across many different crates in Servo. This new crate will hold the
   *rare* data types that are widely used.

Details:

 - All BackgroundHangMonitor-related things from base to a new
   `background_hang_monitor_api` crate.
 - Moved `TraversalDirection` to `script_traits`
 - Moved `Epoch`-related things from `gfx_traits` to `base`.
 - Moved `PrintTree` to base. This should be widely useful in Servo.
 - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it
   to `WebRenderFontApi`.
2024-05-17 12:28:58 +00:00
Pi-Cla
160c7c0b0f
Fix some clippy warnings in components/gfx and components/script (#32215)
* clippy: Squish warnings and errors in gfx

warning: redundant closure (gfx/font.rs:415:18)

warning: useless conversion to the same type (gfx/font.rs:534:9)

warning: the following explicit lifetimes could be elided: 'a (gfx/font.rs:619:16)

error: this loop never actually loops (gfx/font_cache_thread.rs:112:9)

warning: this expression creates a reference which is immediately dereferenced by the compiler  (gfx/font_cache_thread.rs:229:51)

warning: redundant closure (gfx/font_cache_thread.rs:551:18)

3 instances of:
warning: casting integer literal to `f64` is unnecessary (gfx/platform/freetype/font_list.rs:271-273)

* clippy: methods called `from_*` usually take no `self`

It reports that by standard convention, from_* methods should not take any `&self` parameter

* clippy: you should consider adding a `Default` implementation

It reports that public types with a pub fn new() -> Self should have a Default implementation since they can be constructed without arguments

* clippy: casting to the same type is unnecessary (`f32` -> `f32`)

* clippy: use of `unwrap_or_else` to construct default value

* clippy: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self`

* clippy: manual `!RangeInclusive::contains` implementation

contains expresses the intent better and has less failure modes (such as fencepost errors or using || instead of &&)

* clippy: this function has an empty `#[must_use]` attribute, but returns a type already marked as `#[must_use]`

* clippy: Fix some new warnings

warning: this `if` statement can be collapsed (gfx/font.rs:468:130)

warning: this lifetime isn't used in the impl (gfx/platform/freetype/font.rs:341:6)

warning: field assignment outside of initializer for an instance created with Default::default() (compositor.rs:881:17)
2024-05-02 20:02:21 +00:00
Aarya Khandelwal
275fad8b78
Clippy: Fix the error of variants having the same prefix. (#31953)
* fix error: all variants have same prefix

* made the suggested changes

* fixed errors caused by commit

* silenced the clippy warning.

* ran ./mach fmt

* Update components/script/dom/htmlmediaelement.rs

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>

---------

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
2024-04-05 16:31:41 +00:00
eri
cc082efbfd
clippy: Allow too_many_arguments for existing functions (#31974)
* Allow `too_many_arguments` for existing functions

* fix: Surround ASCII with code block in rustdoc
2024-04-02 12:50:45 +00:00
Ekta Siwach
1bc63801e7
fix redundant closures in component/script/dom (#31917)
* fixed unnecessary conversions

* resolved conflicts

* resolved conflicts

* fix redundant closures in component/script/dom

* resolved conflicts

* fixed formatting
2024-03-28 09:06:02 +00:00
Aarya Khandelwal
f7669b5238
fixes dereferencing on an immutable reference (#31864) 2024-03-26 08:37:44 +00:00
Aarya Khandelwal
bd39e03eeb
changed match to 'matches!' (#31850) 2024-03-25 11:28:12 +00:00
Oluwatobi Sofela
3e63f8d6ee
clippy: Fix needless borrow warnings (#31813) 2024-03-21 17:48:54 +00:00
Oluwatobi Sofela
2789e98876
clippy: Fix redundant field names warnings (#31793) 2024-03-20 23:05:29 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
2024-01-22 13:13:48 +00:00
Gregory Terzian
90a9300f69
Script: ensure child JS runtimes are dropped before parent (#30896)
* clear js runtime of dedicated worker that immediately exits

* dedicated worker: clear js runtime if loading script fails

* when the script thread crashes, deallocate worker runtimes before dropping main runtime

* clear runtime if service worker script fails to load

* ensure worker enter their realm before executing script
2024-01-04 09:47:41 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
9514f670d1
No tracing of nop traceable fields (#29926)
* Add `no_trace` option to JSTraceable derive

* NoTrace wrapper

* Port some types to no_trace schematics

* Fixing my unsafe mistakes (not tracing traceables)

* Add docs & safety guards for no_trace

Safety guards (trait shenanigans) guarantees safety usage of `no_trace`

* Port canvas_traits to no_trace

* Port servo_media to no_trace

* Port net_traits to no_trace

* Port style to no_trace

* Port webgpu to no_trace

* Port script_traits to no_trace

* Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace

* unrooted_must_root lint in seperate file

* Add trace_in_no_trace_lint as script_plugin

* Composable types in must_not_have_traceable

* Introduced HashMapTracedValues wrapper

* `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>`

* Port rest of servo's types to no_trace

* Port html5ever, euclid, mime and http to no_trace

* Port remaining externals to no_trace

* Port webxr and Arc<Mutex<_>>

* Fix spelling in notrace doc
2023-08-04 10:17:43 +00:00
Mukilan Thiyagarajan
5305c507c2
Fix race condition and other issues related to Worker destruction. (#30066)
* Fix race condition in Worker destruction

During shutdown, the main script thread calls
JS_RequestInterruptCallback(cx) for each worker thread it owns
where cx is the JSContext* created for that worker.
Although JS_RequestInterruptCallback is safe to call
from threads other than the worker thread, it is possible
the JSContext* has already been destroyed

For example, as noted in #30022, since the main thread sets
the worker's `closing` flag to true to signal termination before it
calls JS_RequestInterruptCallback, we can have a race condition
where the worker exits its event loop when `closing` flags is set
and then it (worker thread) destroys its own JSContext and JSRuntime.
When the main thread resumes, it will call
JS_RequestInterruptCallback for the worker's context, leading to
a use-after-free bug.

This patch solves this issue by improving the existing
`ContextForRequestInterrupt` abstraction used for sharing the Worker's
associated JSContext* with the parent script thread.
Instead of simply wrapping a plain `*mut JSContext`, we now wrap the
`*mut JSContext` in a nullable mutex i.e Mutex<Option<*mut JSContext>>

The mutex lock needs to be held by the parent thread when it
calls JS_RequestInterruptCallback.
Similary, before the worker destroys its JSContext, it locks and
sets the Option to None, signaling that the JSContext can no longer
be used for interrupting the worker.

This patch also fixes the issue in #30052 by enforcing the use
of ContextForRequestInterrupt abstraction which ensures the correct
JSContext is used by the main thread when Worker.terminate is called.

Fixes #30022, #30052

* Fix Worker.importScripts to handle termination

Fixing #30052 uncovered this issue in the implementation
of `importScripts` method. After the fix for #30052,
the WPT test `/workers/Worker-terminate-forever-during-evaluation.html`
started to crash because when evaluation doesn't succeed
`importScripts` always returns Error::JSFailed code to the caller,
which indicates that there is a Dom/JS exception to be thrown. However,
this is not true when the script is terminated, which causes
the generated binding layer for 'importScript` to fail
the assertion that there is a pending exception.

This patch makes `importScripts` work similar to the [logic that
evaluates the top-level script][1] of the Worker - it simply prints
`evaluate_script failed - (terminated)' if the worker is terminating

[1]: 3fea90a231/components/script/dom/workerglobalscope.rs (L434)
2023-08-03 23:33:21 +00:00
yvt
41b3726271 feat: shorten thread names
The Linux kernel imposes a 15-byte limit on thread names[1]. This means
information that does not fit in this limit, e.g., the pipeline ID of
layout and script threads, is lost in a debugger and profiler (see the
first column of the table below).

This commit shortens the thread names used in Servo to maximize the
amount of information conveyed. It also rectifies some inconsistencies
in the names.

|       Before      |       After       |
|-------------------|-------------------|
| `BluetoothThread` | `Bluetooth`       |
| `CanvasThread`    | `Canvas`          |
| `display alert d` | `AlertDialog`     |
| `FontCacheThread` | `FontCache`       |
| `GLPlayerThread`  | `GLPlayer`        |
| `HTML Parser`     | `Parse:www.examp` |
| `LayoutThread Pi` | `Layout(1,1)`     |
| `Memory profiler` | `MemoryProfiler`  |
| `Memory profiler` | `MemoryProfTimer` |
| `OfflineAudioCon` | `OfflineACResolv` |
| `PullTimelineMar` | `PullTimelineDat` |
| `ScriptThread Pi` | `Script(1,1)`     |
| `WebWorker for h` | `WW:www.example.` |
| `ServiceWorker f` | `SW:www.example.` |
| `ServiceWorkerMa` | `SvcWorkerManage` |
| `Time profiler t` | `TimeProfTimer`   |
| `Time profiler`   | `TimeProfiler`    |
| `WebGL thread`    | `WebGL`           |
| `Choose a device` | `DevicePicker`    |
| `Pick a file`     | `FilePicker`      |
| `Pick files`      | `FilePicker`      |

[1]: https://stackoverflow.com/questions/5026531/thread-name-longer-than-15-chars
2021-07-19 00:57:48 +09:00
yvt
52c60e0bf5
doc(script): use the recommended format of a WHATWG link
Enforced by `./mach test-tidy`
2021-07-13 12:19:49 +09:00
yvt
65aa3b0b4d doc(script): update comments in run_worker_scope and run_serviceworker_scope
The step numbers changed over time.

Note that service workers and non-service workers use different steps
defined in different specifications.
2021-07-13 09:31:17 +09:00
yvt
e9af95ec0f fix(script): Set DedicatedWorkerGlobalScope's origin correctly
<https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model>

> 10.2.4 Processing model
>
> When a user agent is to run a worker for a script with `Worker` or
> `SharedWorker` object `worker`, [...] it must run the following steps.
>
> [...]
>
> 8. Set up a worker environment settings object with `realm execution
>    context` and `outside settings`, and let `inside settings` be the
>    result.

<https://html.spec.whatwg.org/multipage/workers.html#script-settings-for-workers>

> To **set up a worker environment settings object**, given a JavaScript
> execution context `execution context` and environment settings object
> `outside settings`:
>
> 1. Let `inherited origin` be `outside settings`'s origin.
>
> 2. Let `realm` be the value of `execution context`'s Realm component.
>
> 3. Let `worker global scope` be `realm`'s global object.
>
> 4. Let `settings object` be a new environment settings object whose
>    algorithms are defined as follows:
>
>    **The origin** Return a unique opaque origin if `worker global
>    scope`'s url's scheme is "data", and `inherited origin` otherwise.
2021-07-13 09:31:15 +09:00
Gregory Terzian
44ebca72da ensure clean shutdown of all threads running JS 2020-06-30 13:22:38 +08:00
Matthias Deiml
fa18cf620f Make url for "client" referrer mandatory 2020-06-17 19:07:14 +02:00
Gregory Terzian
6f34b52e39 properly shutdown dedicated workers when the owning scope shuts-down 2020-06-03 12:32:45 +08:00
Gregory Terzian
947fa8bbb7 add a control chan to workers, use to signal shutdown 2020-06-03 12:32:47 +08:00