Commit graph

70 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
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
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
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
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
d814d05539
fixed the unneeded return statement warnings. (#31863) 2024-03-26 08:58:34 +00:00
Oluwatobi Sofela
3e63f8d6ee
clippy: Fix needless borrow warnings (#31813) 2024-03-21 17:48:54 +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
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
Kunal Mohan
5a3e1b8e69
rename compartment to realm 2020-01-24 20:52:36 +05:30
Bastien Orivel
292d468cd1 Use the newly added inCompartments option everywhere it can be 2019-05-25 17:28:07 +02: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
Manish Goregaokar
611dc4bc70 Remove now-unnecessary must_root and allow(unrooted_must_root) annotations 2019-01-04 15:05:07 -08:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01: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
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +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
7be32fb237 Rename JS<T> to Dom<T> 2017-09-26 09:48:55 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Anthony Ramine
d246c5cf20 Remove JSContext argument from AsyncBluetoothListener::handle_response 2017-09-22 13:56:31 +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
Anthony Ramine
31e9d81c0f Make #[dom_struct] a proc_macro attribute 2017-02-24 01:50:51 +01:00
Zakor Gyula
3ec9f0bab9 Fix comments, and lesser modifications 2017-02-13 14:58:12 +01:00
Zakor Gyula
5287cd3bea Bluetooth Permission API integration 2017-02-13 14:58:06 +01:00
Prudhvi Rampey
29340b7adf Cleaned up ripples due to MutJS to JS type change 2017-01-07 01:16:02 +05:30
Zakor Gyula
6e02cb2eb9 refactor Connect/Disconnect calls 2016-12-22 15:49:29 +01:00
Attila Dusnoki
b0103682fa Implement GetGATTChildren 2016-12-16 21:02:58 +01:00
bors-servo
6ee175bf70 Auto merge of #14567 - szeged:represented-attributes, r=jdm
Check if represented attributes are cached

<!-- Please describe your changes on the following line: -->
Improve existing cache checks in `/bluetooth/lib.rs`, and update Step comments in `script/dom` corresponding to this.

---
<!-- 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
- [x] There are tests for these changes OR

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/14567)
<!-- Reviewable:end -->
2016-12-14 15:29:43 -08:00
Zakor Gyula
c3e771274a Check if represented attributes are cached 2016-12-14 22:06:55 +01:00
Anthony Ramine
1327ebd52f Remove HeapGCValue
It could be used to have mutable JSVal fields without GC barriers.
With the removal of that trait, MutHeap and MutNullableHeap can respectively
be replaced by MutJS and MutNullableJS.
2016-12-12 10:47:54 -10:00
Corey Farwell
449f6337d4 Rename Reflectable to DomObject.
Fixes https://github.com/servo/servo/issues/8473.
2016-12-08 08:50:35 -10:00
bors-servo
2e1c40ec36 Auto merge of #14441 - szeged:attribute-instance-map, r=jdm
Move the AttributeInstanceMaps from bluetooth to bluetoothDevice.

<!-- Please describe your changes on the following line: -->
The previous implementation differed from the spec, because there was three maps instead of one. With this, they will be merged into one.
Also this map has been moved from bluetooth to bluetoothDevice, because its make more sense to store it there. There is an issue about it [here](https://github.com/WebBluetoothCG/web-bluetooth/issues/330).

---
<!-- 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

<!-- Either: -->
- [X] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/14441)
<!-- Reviewable:end -->
2016-12-06 11:14:53 -08:00
Attila Dusnoki
6749b6a2df Add missing connection check for disconnect 2016-12-05 09:04:20 +01:00
Valentin Fokin
c33d89c92c Moved the AttributeInstanceMaps from bluetooth to bluetoothDevice. 2016-12-02 12:50:53 +01:00
Zakor Gyula
8dd100f74f Step annotations for WebBluetooth functions 2016-11-29 18:24:28 +01:00
Zakor Gyula
f98fbecfda Rename blacklist to blocklist 2016-11-17 15:23:14 +01:00
Attila Dusnoki
e7e7c74c9e Webbluetooth Async behaviour 2016-11-08 13:27:56 +01:00
zakorgyula
e8c1c98a77 Return the same JS object for the same Bluetooth item. 2016-11-04 15:36:57 +01:00
fokinv
d30bcbd339 Blacklisted items are removed when calling getServices/Characteristics/Descriptors. 2016-11-04 15:36:55 +01:00
zakorgyula
b72dcf326b Check if the BluetoothDevice is connected, when calling getGATT functions. 2016-11-04 15:22:48 +01:00