aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/workerglobalscope.rs
Commit message (Collapse)AuthorAgeFilesLines
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-23/+27
| | | | | * strict imports formatting * Reformat all imports
* No tracing of nop traceable fields (#29926)Samson2023-08-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Add creation url and Secure ContextsJonathan Kingston2020-11-251-0/+9
|
* ensure clean shutdown of all threads running JSGregory Terzian2020-06-301-11/+12
|
* Make url for "client" referrer mandatoryMatthias Deiml2020-06-171-1/+1
|
* remove messagaging and worker infra on workerscope exitsGregory Terzian2020-06-031-0/+5
|
* serviceworker: turn-off event-loop, don't assume current scope, clear ↵Gregory Terzian2020-05-211-9/+19
| | | | runtime on shutdown
* Share single gpu_id_hub among all threads in a processKunal Mohan2020-05-151-0/+4
|
* Auto merge of #26296 - ramyananth:master, r=jdmbors-servo2020-04-301-0/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementing createImageBitmap <!-- Please describe your changes on the following line: --> Implementing createImageBitmap method for canvas image source. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #20650 (GitHub issue number if applicable) <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
| * implemented CreateImageBitmap function for Canvas image sourceJayalakshmiV2020-04-291-0/+15
| |
* | Support connecting to worker globals from remote devtools.Josh Matthews2020-04-281-1/+2
|/
* Always pass InRealm to GlobalScope::from_context to avoid getting null globalCYBAI2020-02-161-7/+3
|
* rename compartment to realmKunal Mohan2020-01-241-2/+2
|
* queueMicrotask addedPatrick Shaughnessy2020-01-131-0/+7
|
* Add accountable-refcell as optional build time featureKunal Mohan2020-01-081-2/+1
|
* `WorkerId` changed to type UUID.Kunal Mohan2019-12-101-1/+2
|
* impl timer-task-source, dedicated time-out mechanism for service-workerGregory Terzian2019-11-191-7/+5
|
* Use TimerHandler IDL union typeKagami Sascha Rosylight2019-11-051-38/+13
|
* begin messageport, transferable objects, implKeith Yeung2019-10-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* introduce a pipeline namespace installerGregory Terzian2019-08-211-1/+3
|
* Modify *::get_cx methods to return a safe JSContext instead of a raw onemarmeladema2019-07-241-9/+10
|
* Convert CGTraitInterface to use safe JSContext instead of raw JSContextmarmeladema2019-07-241-12/+9
|
* Script: removed a few opts::get()oneturkmen2019-06-261-0/+4
|
* Upgrade to Spidermonkey 67.Josh Matthews2019-06-261-1/+1
|
* Add an inCompartments config for bindingsBastien Orivel2019-05-241-1/+3
|
* Auto merge of #23351 - CYBAI:fix-modes, r=noxbors-servo2019-05-161-1/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix modes for fetching classic worker script and introduce parser metadata for request While reading [the spec](https://html.spec.whatwg.org/multipage/#fetch-a-classic-worker-script) for `fetch a classic worker script`, I found the `mode` and `credential-mode` are opposite to the spec. So, the first commit will fix it. Also, I found there's a `parser metadata` for `request` so I tried to introduce it in this PR as well. For WPT, I found there's a `/workers/constructors/Worker/same-origin.html` which was disabled in #3180. We pass most of the tests now. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) - [x] There are tests for these changes <!-- 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/23351) <!-- Reviewable:end -->
| * Introduce parser metadata for requestCYBAI2019-05-111-1/+4
| |
* | Auto merge of #23309 - CYBAI:update-workers, r=noxbors-servo2019-05-111-0/+8
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+8
| |/
* / Update to SpiderMonkey 66.Josh Matthews2019-05-101-2/+2
|/
* Create resource timing entry for sync network fetchpylbrecht2019-05-081-15/+22
|
* set referrer in window.load_urlRussell Cousineau2019-04-191-2/+1
| | | | | | | | - this conforms to follow-hyperlinks spec step 13 - this conforms to window-open spec step 14.3 - replace uses of `referrer_url` with `referrer` - in Request class, change "no-referrer" to "" - set websocket fetch referrer to "no-referrer"
* Implementing the builder pattern for RequestInitLucas Fantacuci2019-04-101-12/+10
|
* Reintroduce parent runtimes for worker threads.Josh Matthews2019-01-151-1/+5
|
* refactored performance timing to align with updated specddh2018-11-201-5/+1
| | | | | | | | | | | | refactoring with ResourceFetchMetadata implemented deprecated window.timing functionality created ResourceTimingListener trait fixed w3c links in navigation timing updated include.ini to run resource timing tests on ci
* Update MPL license to https (part 3)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Update crossbeam-channel to 0.3Bastien Orivel2018-11-181-1/+1
|
* `cargo fix --edition-idioms`Simon Sapin2018-11-081-2/+2
|
* Reorder importsPyfisch2018-11-061-5/+5
|
* Sort `use` statementsSimon Sapin2018-11-061-11/+11
|
* `cargo fix --edition`Simon Sapin2018-11-061-30/+30
|
* Make first argument of DOMManipulationTaskSource as a Box<ScriptChan +CYBAI2018-10-181-0/+5
| | | | | | | | | | | Send> We don't have `window` for `workers`. So, if we use `global.as_window()` to get the DOMManipulationTaskSource, it will make worker panic. Instead, we should get the DOMManipulationTaskSource from each own thread. Ref: https://github.com/servo/servo/pull/20755#discussion_r193557746
* Format script componentchansuke2018-09-191-52/+98
|
* Replace mpsc with crossbeam/servo channel, update ipc-channelSimon Sapin2018-09-121-1/+1
| | | | Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
* Add Websocket task sourceAgustin Chiappe Berrini2018-09-081-0/+5
| | | | | | | | According to the doc: https://html.spec.whatwg.org/multipage/web-sockets.html#network The task source for all tasks queued in the websocket section are the websocket task source, so this commit also updates those references to use the appropriate one.
* Add the TaskSourceName to CommonScriptMsg::TaskAgustin Chiappe Berrini2018-09-041-1/+1
| | | | Update QueuedTaskConversion and the TaskQueue to use it
* introduce task-queues, and throttling the performance-timeline task-source, ↵Gregory Terzian2018-08-311-2/+0
| | | | | | in script and worker threads. queue
* Upgraded to SM 60Alan Jeffrey2018-08-201-5/+1
|
* use remote-event task source in EventSourceGregory Terzian2018-07-131-0/+5
|