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
875e387004
script: Feature-gate all crown support. ( #35055 )
...
* script: Feature-gate all crown support.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Use cfg(crown) instead of a cargo feature.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-18 21:36:15 +00:00
Martin Robinson
0e616e0c5d
api: Flatten and simplify Servo preferences ( #34966 )
...
Flatten and simplify Servo's preferences code. In addition, have both
preferences and options passed in as arguments to `Servo::new()` and
make sure not to use the globally set preferences in `servoshell` (as
much as possible now).
Instead of a complex procedural macro to generate preferences, just
expose a very simple derive macro that adds string based getters and
setters.
- All command-line parsing is moved to servoshell.
- There is no longer the concept of a missing preference.
- Preferences no longer have to be part of the resources bundle because
they now have reasonable default values.
- servoshell specific preferences are no longer part of the preferences
exposed by the Servo API.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-14 13:54:06 +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
Domenico Rizzo
0e9746fbbe
Add CanGc argument to reflect_dom_object ( #34606 )
...
* applied mach fmt
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
Refinements
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
Modified reflect_dom_object signature and all its calls
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* fix function calls when parameter is passed up
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
---------
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2024-12-13 15:51:59 +00:00
Josh Matthews
e0cbab2fbb
Rewrite From/TryFrom conversions on generated types to avoid future orphan rule violations ( #34554 )
...
* script: Add traits to allow converting between types that are not defined in the script crate.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Rewrite all From/TryFrom implementations on generated WebIDL types to use new Convert/TryConvert traits.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-12-11 05:52:48 +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
Samson
6c2b840e37
Support associated types in must_root lint ( #34163 )
...
* Support associated types in must_root lint
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* fix
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* fixups
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* fixup
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Fix crown violations
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* fix eng
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* make new test use RUSTC_BOOTSTRAP=1
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2024-11-06 18:48:57 +00:00
tanishka
7fbd2a521e
CanGc fixes from eventtarget.rs ( #33973 )
...
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-22 22:43:52 +00:00
Josh Matthews
575e885529
Mark promise creation methods with CanGc ( #33928 )
...
* Add CanGc annotations to promise constructor.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Propagate CanGc arguments for Promise::new_in_current_realm.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Fix out-of-order entries.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Propagate CanGc from Promise::new.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Suppress clippy warning.
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-10-22 09:35:20 +00:00
Aarya Khandelwal
bd39e03eeb
changed match
to 'matches!' ( #31850 )
2024-03-25 11:28:12 +00:00
Ekta Siwach
d8adeb1b44
clippy: Fix some warnings in components/script
( #31849 )
...
* clippy: fixed some warnings in components/script
* fixed formatting
* fix formatting
2024-03-25 10:22:21 +00:00
Aarya Khandelwal
9b26dca141
Fixed the .clone() warnings. ( #31819 )
2024-03-22 05:41:17 +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
Josh Matthews
5e5669b945
Remove unused argument from AlreadyInRealm::assert.
2023-05-20 11:05:09 -04:00
Josh Matthews
fca5833e21
Remove global argument from Promise::new_in_current_realm.
2023-05-20 11:05:09 -04:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function
2020-03-20 22:16:56 -04:00
Iulian Gabriel Radu
f75d547c61
Delegate permission prompt dialog formatting to embedders
2020-02-28 11:44:33 +02:00
gatowololo
675b36dde5
Move tinyfiledialog out of script into embedder.
2020-02-27 01:01:08 +02:00
gatowololo
24c14ac94e
Factored out permission_state_invocation_results API to GlobalScope
...
Instead of Window
2020-02-27 00:02:04 +02:00
Kunal Mohan
5a3e1b8e69
rename compartment to realm
2020-01-24 20:52:36 +05:30
Kunal Mohan
f7db4b7f80
Modify script
to prevent further violations of snake_case
2020-01-18 14:22:15 +05:30
marmeladema
4a5f51e079
Remove some usage of unsafe code in Permissions
2019-08-09 00:02:09 +01:00
marmeladema
2c5d0a6ebc
Convert CGTraitInterface to use safe JSContext instead of raw JSContext
2019-07-24 08:24:50 +01:00
marmeladema
808fa65aef
Convert internal methods to handle safe JSContext instead of raw JSContext
2019-07-24 08:18:22 +01:00
Julien Tregoat
28fcde9e10
Propagate JSFailed error & conditionally execute initial assertion when converting error to JS value.
2019-07-03 13:48:48 -04:00
oneturkmen
42569280e2
Script: removed a few opts::get()
2019-06-26 22:23:07 -06:00
Aron Zwaan
e2e6e2ac94
Pass InCompartment by value
2019-04-25 11:37:35 +02:00
Aron Zwaan
1b6949d4cf
Add proof parameter to Promise::new_in_current_compartment
2019-04-24 19:46:10 +02:00
Aron Zwaan
782b58587a
Rename Promise::new to Promise::new_in_current_compartment
2019-04-03 20:45:30 +02:00
Peter Hall
8bfd4dc1e2
#8539 Config preferences backend restructure
2019-03-20 15:01:26 +00:00
Piotr Szpetkowski
abd577bfd4
Update bool pattern matching into if-else
2019-01-30 20:54:12 +01:00
Manish Goregaokar
611dc4bc70
Remove now-unnecessary must_root and allow(unrooted_must_root) annotations
2019-01-04 15:05:07 -08:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3)
2018-11-19 14:47:12 +01:00
Pyfisch
9e92eb205a
Reorder imports
2018-11-06 22:35:07 +01:00
Simon Sapin
76e59a46d3
Sort use
statements
2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee
cargo fix --edition
2018-11-06 15:26:02 +01:00
chansuke
c37a345dc9
Format script component
2018-09-19 17:40:47 -04:00
Simon Sapin
aa15dc269f
Remove use of unstable box syntax.
...
http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.
This is expected since `Box::new` is defined as:
```rust
impl<T> Box<T> {
#[inline(always)]
pub fn new(x: T) -> Box<T> {
box x
}
}
```
With inlining, it should compile to the same as box syntax.
2017-10-16 17:16:20 +02:00
Anthony Ramine
f87c2a8d76
Rename Root<T> to DomRoot<T>
...
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
2017-09-26 09:49:10 +02:00
Anthony Ramine
0e3c54c191
Rename dom::bindings::js to dom::bindings::root
2017-09-26 02:19:05 +02:00
Anthony Ramine
af2e83f378
Make Promise::reject_error sound
2017-09-22 02:15:22 +02:00
Anthony Ramine
5addc2dfa3
Make Promise::resolve_native actually sound
...
We shouldn't have to pass a raw JSContext pointer, and to enter the
promise's context's compartment by hand.
2017-09-21 16:00:48 +02:00
Jyotsna Prakash
433cd90bc3
return Option from GlobalScope::current
...
handles the case where GlobalScope::current calls CurrentGlobalOrNull
and the result is null
2017-06-22 10:04:06 -07:00
Lucjan Suski
9a059b49c5
Use servo_config::opts only on linux target.
...
It's not used for other architectures and triggers warnings.
2017-03-21 15:55:45 +01:00
Alan Jeffrey
f05577cb29
Disabled tinyfiledialogs when running headless.
2017-03-16 08:48:33 -05:00
Anthony Ramine
31e9d81c0f
Make #[dom_struct] a proc_macro attribute
2017-02-24 01:50:51 +01:00
Zakor Gyula
462a825bd1
previous invocation results
2017-02-14 15:01:27 +01:00
Attila Dusnoki
4a62562b0f
Add pref to ignore popup in testing
2017-02-13 14:58:13 +01:00