aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/worker.rs
Commit message (Collapse)AuthorAgeFilesLines
* clippy: Fix more clippy warnings in `components/scripts/dom` (#31914)Rosemary Ajayi2024-03-281-1/+1
| | | | | * refrence to a reference * refrence to a reference
* clippy: Fix option_map_unit_fn warnings (#31906)Oluwatobi Sofela2024-03-271-4/+3
|
* clippy: Fix redundant field names warnings (#31793)Oluwatobi Sofela2024-03-201-3/+3
|
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-3/+3
| | | | 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.
* Replace script_plugins with a clippy like rustc driver (named crown) (#30508)Samson2023-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove script_plugins * Use crown instead of script_plugins * crown_is_not_used * Use crown in command base * bootstrap crown * tidy happy * disable sccache * Bring crown in tree * Install crown from tree * fix windows ci * fix warning * fix mac libscript_plugins.dylib is not available anymore * Update components/script/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> * Update for nightly-2023-03-18 Mostly just based off https://github.com/servo/servo/pull/30630 * Always install crown it's slow only when there is new version * Run crown test with `mach test-unit` * Small fixups; better trace_in_no_trace tests * Better doc * crown in config.toml * Fix tidy for real * no sccache on rustc_wrapper * document rustc overrides * fixup of compiletest * Make a few minor comment adjustments * Fix a typo in python/servo/platform/base.py Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com> * Proper test types * Ignore tidy on crown/tests --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-14/+15
| | | | | * strict imports formatting * Reformat all imports
* No tracing of nop traceable fields (#29926)Samson2023-08-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Fix race condition and other issues related to Worker destruction. (#30066)Mukilan Thiyagarajan2023-08-031-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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]: https://github.com/servo/servo/blob/3fea90a231a94338d67712398fe3d2ba9d402211/components/script/dom/workerglobalscope.rs#L434
* Rename reflect_dom_object2.Josh Matthews2023-05-311-2/+2
|
* Formatting.Josh Matthews2023-05-281-1/+5
|
* Support arbitrary protos when wrapping DOM objects with constructors.Josh Matthews2023-05-281-5/+7
|
* Make GlobalScope.get_cx a static method.Josh Matthews2023-05-201-2/+2
|
* ensure clean shutdown of all threads running JSGregory Terzian2020-06-301-1/+7
|
* add a control chan to workers, use to signal shutdownGregory Terzian2020-06-031-1/+4
|
* add mechanism to join on service- and dedicated-worker threadsGregory Terzian2020-05-291-3/+4
|
* Share single gpu_id_hub among all threads in a processKunal Mohan2020-05-151-0/+1
|
* Support connecting to worker globals from remote devtools.Josh Matthews2020-04-281-10/+23
|
* Support navigating browsing contexts in the devtools.Josh Matthews2020-04-261-1/+1
| | | | | | | | | | | | | Break the association between pipelines and browsing context actors. Now there is one browsing context actor per actual browsing context, and individual actors keep track of known pipelines as necessary. There is also one console/performance/timeline/inspector/etc. actor per browsing context. This also centralizes more information in the browsing context actor. Rather than duplicating state for the active pipeline in actors that need to use it, each actor now remembers the name of its associated browsing context actor and obtains that state whenever it's necessary.
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-6/+1
|
* rename compartment to realmKunal Mohan2020-01-241-1/+1
|
* Modify `script` to prevent further violations of snake_caseKunal Mohan2020-01-181-1/+1
|
* Remove `origin` parameter from `Worker::handle_message`Kunal Mohan2020-01-041-13/+2
|
* Remove Optional pipeline_idWarren Fisher2019-12-191-1/+1
|
* `WorkerId` changed to type UUID.Kunal Mohan2019-12-101-2/+3
|
* Use IDL sequence default valueKagami Sascha Rosylight2019-11-041-2/+0
|
* continue messageport, transferable, postmessage optionsGregory Terzian2019-10-191-14/+61
|
* begin messageport, transferable objects, implKeith Yeung2019-10-191-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Accept transfer argument for StructuredCloneData::write Allow structured clone reads to return a boolean Add Transferable trait Add basic skeletons to MessagePort Implement transfer and transfer-receiving steps on MessagePort Use transfer and transfer_receive in StructuredClone callbacks Implement MessageChannel Freeze the array object for the MessageEvent ports attribute Implement transfer argument on window.postMessage Use ReentrantMutex instead for MessagePortInternal Accept origin as a parameter in dispatch_jsval Fix BorrowMut crash with pending_port_message Detach port on closure and check for detached during transfer Enable webmessaging tests fix webidl fix
* Modify *::get_cx methods to return a safe JSContext instead of a raw onemarmeladema2019-07-241-2/+2
|
* Convert CGTraitInterface to use safe JSContext instead of raw JSContextmarmeladema2019-07-241-4/+4
|
* Create a helper API for entering a DOM object's compartmentKamil Niski2019-06-291-2/+3
| | | | | | Revert some unnecessary changes Fix fmt errors
* Extract canvas operations for reuse by OffscreenCanvas.Maharsh2019-05-221-0/+1
|
* Auto merge of #23309 - CYBAI:update-workers, r=noxbors-servo2019-05-111-3/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support WorkerOptions for Worker I'd like to start working on updating SW related codes and I found it will have some algorithms related to module workers. And I found parts of the spec update is related to [fetch a module worker script graph](https://html.spec.whatwg.org/multipage/#fetch-a-module-worker-script-tree), maybe it's worth being a separate PR? --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #23308 - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23309) <!-- Reviewable:end -->
| * Update Worker webidl to support WorkerOptionsCYBAI2019-05-111-3/+12
| |
* | Update to SpiderMonkey 66.Josh Matthews2019-05-101-2/+2
|/
* Provide the source window as part of postMessage events.Josh Matthews2019-01-071-1/+1
|
* Fix new warningsSimon Sapin2019-01-041-4/+0
|
* Update MPL license to https (part 3)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Update crossbeam-channel to 0.3Bastien Orivel2018-11-181-2/+2
|
* Reorder importsPyfisch2018-11-061-3/+5
|
* Sort `use` statementsSimon Sapin2018-11-061-2/+2
|
* `cargo fix --edition`Simon Sapin2018-11-061-17/+17
|
* Format script componentchansuke2018-09-191-21/+36
|
* Replace mpsc with crossbeam/servo channel, update ipc-channelSimon Sapin2018-09-121-1/+1
| | | | Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
* introduce task-queues, and throttling the performance-timeline task-source, ↵Gregory Terzian2018-08-311-5/+5
| | | | | | in script and worker threads. queue
* Auto merge of #21430 - Eijebong:ws-origin, r=jdmbors-servo2018-08-221-1/+1
|\ | | | | | | | | | | | | | | Properly set the origin on websocket messages <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21430) <!-- Reviewable:end -->
| * Properly set the origin on websocket messagesBastien Orivel2018-08-161-1/+1
| |
* | Upgraded to SM 60Alan Jeffrey2018-08-201-10/+7
|/
* Adapt Servo for mozjs 0.6 and the changes introduced in servo/rust-mozjs#393Marcin Mielniczuk2018-03-281-1/+2
|
* added autoclose workerNupur Baghel2018-02-221-0/+1
|
* Replace all uses of the `heapsize` crate with `malloc_size_of`.Nicholas Nethercote2017-10-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`. `malloc_size_of` is better -- it handles various cases that `heapsize` does not -- so this patch changes Servo to use `malloc_size_of`. This patch makes the following changes to the `malloc_size_of` crate. - Adds `MallocSizeOf` trait implementations for numerous types, some built-in (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`). - Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't support that operation. - For `HashSet`/`HashMap`, falls back to a computed estimate when `enclosing_size_of_op` isn't available. - Adds an extern "C" `malloc_size_of` function that does the actual heap measurement; this is based on the same functions from the `heapsize` crate. This patch makes the following changes elsewhere. - Converts all the uses of `heapsize` to instead use `malloc_size_of`. - Disables the "heapsize"/"heap_size" feature for the external crates that provide it. - Removes the `HeapSizeOf` implementation from `hashglobe`. - Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of` doesn't derive those types, unlike `heapsize`.