aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_runtime.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move non-gfx things out of `gfx_traits` and create a `base` crate (#32296)Martin Robinson2024-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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`.
* Fixed some clippy warning by adding default implementations (#31989)komuhangi2024-04-041-2/+2
| | | | | | | | | | | * Fixed some clippy warning by adding default implementations * Updated PR that adds default implementation of structs * Clean up and extend `Default` implementations --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* clippy: Fix all errors in `components/script` (#31911)Azhar Ismagulova2024-03-281-44/+43
| | | | | * clippy: Fix errors in components/script/dom * clippy: fixed remaining errors in components/script
* clippy: Fix `unnecessary_cast` warnings in `components/script` (#31823)Oluwatobi Sofela2024-03-221-5/+1
| | | | | | | * clippy: Fix unnecessary cast warnings * clippy: Replace redundant field names with their shorthand alternatives * clippy: Delete struct pattern dereferencings
* clippy: Fix redundant field names warnings (#31793)Oluwatobi Sofela2024-03-201-2/+2
|
* clippy: Fix many warnings in `components/script` (#31717)Richard Dushime2024-03-191-5/+3
| | | | | | | | | | | | | | | | | * Fix Several clippy warnings * Fix Build errors * Fix Unused import * Fix requested changes * Fix rustfmt * Minor fixes --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Fix crash when closing window containing video element (#31413)Josh Matthews2024-02-231-0/+4
| | | | | * Forbid casting DOM objects when JS runtime is shutting down. * Remove media controls from document when element is removed from the tree.
* android: disable JIT in SM to workaround #31134 (#31270)Mukilan Thiyagarajan2024-02-071-2/+7
| | | | | | | | | | | | | | | | | The crash when loading servo.org happens in the JIT code emitted by SM's CacheIRCompiler to invoke the VM function `ProxyGetPropertyByValue`. To disable this code path, it is not sufficient to disable just the baseline JIT (which exposed in servo under the pref `js.baseline.enabled`) but also the baseline interpreter which is controlled by a different flag in SM. This PR disables renames the `js.baseline.enabled` pref in Servo to `js.baseline_jit.enabled` and introduces a new pref `js.baseline_interpreter.enabled` that controls the baseline interpreter. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-2/+2
| | | | 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.
* script: Start replacing `time` with `std::time` and `chrono` (#30639)Auguste Baum2024-01-161-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replace `time` with `chrono` in `script/animation_timeline` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/script_thread.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` and `chrono` in `script/script_thread.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/script_runtime.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/script_runtime.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/workerglobalscope.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `chrono` in `script/dom/workerglobalscope.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/htmlmedialelement.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/htmlmedialelement.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/globalscope.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `chrono` in `script/dom/globalscope.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/htmlformelement.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Replace `time` with `std::time` in `script/dom/htmlformelement.rs` Signed-off-by: Auguste Baum <auguste.apple@gmail.com> * Increase precision of animation timeline * Some fixes Use Instant a bit more and stop using chrono. Do not transition `navigation_start_precise` to Instant yet as we need to coordinate this across all crates. --------- Signed-off-by: Auguste Baum <auguste.apple@gmail.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Replace script_plugins with a clippy like rustc driver (named crown) (#30508)Samson2023-12-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Use Foo_Binding instead of FooBinding for namespace modules (#30447)Samson2023-09-301-1/+1
| | | | | * Update Codegen.py to emit Foo_Binding instead of FooBinding * s/FooBinding/Foo_Binding/g
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-65/+52
| | | | | * strict imports formatting * Reformat all imports
* Use MozTools 4 and update mozjs (#30326)Samson2023-09-111-1/+2
| | | | | | | | | | | | | | | | | | | * Update mozjs * moztools4 in bootstrap * no autoconf * tidy * switch to servo-build-deps * update mozjs for real * glue mozjs * fmt * move to servo/mozjs
* remove `extern crate` (#30311)Samson2023-09-081-0/+2
| | | | | | | | | | | * remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Use mozjs tracing infrastructure (#29918)Samson2023-08-101-2/+1
| | | | | | | * Update mozjs https://github.com/servo/mozjs/commit/64711ec2e6dc4595df691bffc7f1e5052ab86c8d also fixes https://github.com/servo/servo/issues/30043 * Move to mozjs Traceable and introduce CustomTraceable
* Fix race condition and other issues related to Worker destruction. (#30066)Mukilan Thiyagarajan2023-08-031-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Make GlobalScope.get_cx a static method.Josh Matthews2023-05-201-3/+3
|
* Clean up debug optionsMartin Robinson2023-05-011-1/+1
|
* Format.Josh Matthews2022-11-231-8/+5
|
* Changes for spidermomkey upgrade.Josh Matthews2022-11-231-7/+8
|
* refactor(script): move `crate::dom::bindings::{utils → ↵yvt2021-07-131-3/+4
| | | | principals)::ServoJSPrincipal`
* doc(script): prettify a commentyvt2021-07-121-1/+1
|
* chore(deps): update mozjsyvt2021-07-111-1/+3
| | | | - 798c5b6: Bring `RustJSPrincipals` back
* fix: accommodate to the modern ageyvt2021-07-101-1/+1
|
* Merge remote-tracking branch 'upstream/master' into feat-cow-infrayvt2021-07-101-248/+867
|\ | | | | | | | | `tests/wpt/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html` was reverted to the upstream version.
| * Formatingsagudev2021-03-121-2/+10
| |
| * Fix errorssagudev2021-03-121-9/+3
| |
| * Update mozjs.Josh Matthews2021-02-181-31/+29
| |
| * ensure clean shutdown of all threads running JSGregory Terzian2020-06-301-1/+32
| |
| * Auto merge of #26943 - jdm:promise-incumbent, r=Manishearthbors-servo2020-06-161-1/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix panic on vimeo.com The only time we end up enqueuing a promise reaction job with a null incumbent global argument is when SpiderMonkey does some weird stuff behind the scenes for its JS Debugger support (based on https://searchfox.org/mozilla-central/rev/2c1092dc68c63f7bad6da6a03c5883a5ab5ff2ca/js/src/builtin/Promise.cpp#3168). This commit works around that case and adds a regression test so we don't forget about that in the future. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #26930 - [x] There are tests for these changes
| | * dom: Avoid panic when SpiderMonkey enqueues dummy promise jobs.Josh Matthews2020-06-161-1/+6
| | |
| * | Don't pretend we support SharedArrayBuffer.Josh Matthews2020-06-161-9/+0
| |/
| * integrate readablestream with fetch and blobGregory Terzian2020-06-041-2/+2
| |
| * Use dynamic dispatch in `mozjs::panic::wrap_panic`Simon Sapin2020-05-251-102/+95
| | | | | | | | | | | | | | | | Pick up https://github.com/servo/rust-mozjs/pull/512 Fixes https://github.com/servo/servo/issues/26585 This diff is best viewed with "ignore whitespace changes", because of indentation change.
| * Implement client-side logic for WebGPU id recyclingKunal Mohan2020-05-221-0/+1
| |
| * Remove WebVRAlan Jeffrey2020-04-081-1/+0
| |
| * Auto merge of #26056 - gterzian:enable_atomics_wait_on_dedicated_worker, r=jdmbors-servo2020-03-301-4/+15
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable Atomics.wait in a dedicated worker agent <!-- Please describe your changes on the following line: --> FIX #25191 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- 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. -->
| | * enable Atomics.wait in a dedicated worker agentGregory Terzian2020-03-301-4/+15
| | |
| * | Propagate user interacting flag to timers and promisesPaul Rouget2020-03-261-1/+11
| |/
| * Update SpiderMonkeyAnthony Ramine2020-03-061-19/+20
| |
| * Always pass InRealm to GlobalScope::from_context to avoid getting null globalCYBAI2020-02-161-2/+5
| |
| * Modify `script` to prevent further violations of snake_caseKunal Mohan2020-01-181-1/+1
| |
| * Scaffold module scriptCYBAI2020-01-031-0/+3
| |
| * Now using eq_ignore_case on WASM mimetype, per #25317Patrick Shaughnessy2019-12-311-10/+7
| |
| * Add StreamConsumer wrapper and methods to responseRidhim Rastogi2019-12-031-4/+9
| |
| * Remove use of deprecated language construct.Josh Matthews2019-11-261-1/+1
| |
| * script: Ensure JS engine is initialized and deinitialized on the same thread.Josh Matthews2019-11-261-4/+26
| |
| * Bind runnable dispatching in script_runtimeAkash-Pateria2019-11-191-13/+52
| |
| * Add consume stream callbackRidhim Rastogi2019-11-111-1/+108
| |