Rahul Menon
b5932e5abf
script: Implement QuotaExceededError WebIDL interface ( #38507 )
...
Implements the new WebIDL interface for QuotaExceededError and uses it
in appropriate places.
Testing: WPT tests. Now passing many more in
`tests/wpt/tests/WebCryptoAPI/getRandomValues.any.js` and
`tests/wpt/tests/webstorage/storage_session_setitem_quotaexceedederr.window.js`.
Fixes : #38489
---------
Signed-off-by: Rahul Menon <menonrahul02@gmail.com >
2025-08-14 17:58:50 +00:00
Simon Wülker
3d320fa96a
Update rustfmt to the 2024 style edition ( #35764 )
...
* Use 2024 style edition
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de >
* Reformat all code
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de >
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de >
2025-03-03 11:26:53 +00:00
Yerkebulan Tulibergenov
67bd557f30
refactor: add CanGc as argument to methods in CSSGroupingRule, CSSKeyframesRule, Crypto ( #35743 )
...
Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com >
2025-03-02 07:16:06 +00:00
Auguste Baum
863d2ce871
Propagate CanGc arguments through callers in constructors ( #35541 )
...
Signed-off-by: Auguste Baum <auguste.apple@gmail.com >
2025-02-20 16:17:45 +00:00
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
Simon Wülker
c73e4baca2
Preference-gate crypto.subtle ( #34295 )
...
* Update Crypto idl bindings
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de >
* Pref-gate Crypto.subtle attribute
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de >
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de >
2024-11-19 22:54:59 +00:00
Daniel Adams
fc0d4d8157
crypto: Begin SubtleCrypto implementation ( #33628 )
...
* Update IDLs and Bindings conf
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Add AES crate
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Implement DOM interfaces
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* IDL tidy
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Remove deriveKey from inRealms for now until implemented
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Fix CryptoKey rustdoc comments
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Move string constants to top of file
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Use properly rooted CryptoKey
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Code clarity
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Rework NormalizedAlgorithm to not hold a DOMString
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Add Rustdoc for CryptoKey interface
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Move ignore mallocsizeof to rand crate, remove from crypto
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Update cargo lock
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Fix key handling, implement exportKey with JWK TODO
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Add missing spec link
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Use create_buffer_source, remove aes dep from libservo
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Fix crash when running in worker
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Update expectations
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* fmt
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Move CryptoKey and SubtleCrypto behind pref for now
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Update expectations
Signed-off-by: Daniel Adams <msub2official@gmail.com >
* Readd timeout expectation
Signed-off-by: Daniel Adams <msub2official@gmail.com >
---------
Signed-off-by: Daniel Adams <msub2official@gmail.com >
2024-10-08 03:51:08 +00:00
Daniel Adams
632d832704
Add checks for BigInt/BigUint in getRandomValues ( #33485 )
...
Signed-off-by: Daniel Adams <msub2official@gmail.com >
2024-09-18 04:07:05 +00:00
webbeef
9a1051c917
Implement crypto.randomUUID() ( #33158 )
...
Signed-off-by: webbeef <me@webbeef.org >
2024-08-22 04:56:37 +00:00
eri
e3d6b66d5f
clippy: Fix match_like_matches warnings ( #31947 )
...
* clippy: Fix `match_like_matches` warnings
* Fix link to custom element state in specification.
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com >
2024-03-30 10:06:26 +00:00
Aarya Khandelwal
d814d05539
fixed the unneeded return statement warnings. ( #31863 )
2024-03-26 08:58:34 +00:00
sandeep
77f5175efc
removed mutable compile warnings ( #31822 )
...
Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local >
Co-authored-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local >
2024-03-22 09:58:27 +00:00
Oluwatobi Sofela
3e63f8d6ee
clippy: Fix needless borrow warnings ( #31813 )
2024-03-21 17:48:54 +00:00
sandeep
64d013d473
Fix clippy warnings in components/rand ( #31549 )
...
* resolved clippy warnings in components/rand
Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local >
* replaced new() with default()
Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local >
* replaced ServoRng::new() with ServoRng::default()
Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local >
* moved the contents of the new() method into the default() method
Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local >
---------
Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local >
Co-authored-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local >
2024-03-07 23:16:42 +00:00
Taym Haddadi
c3e3e72cf2
WebIDL: Use ArrayBufferViewU8 instead of raw JSObject in bindings ( #31325 )
...
* WebIDL: Use ArrayBufferViewU8 instead of raw JSObject in bindings
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
* Remove unused imports
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
* Address review comments
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
---------
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com >
2024-02-16 11:22:16 +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
Samson
450f8193a5
Use mozjs tracing infrastructure ( #29918 )
...
* Update mozjs
64711ec2e6 also fixes https://github.com/servo/servo/issues/30043
* Move to mozjs Traceable and introduce CustomTraceable
2023-08-10 21:46:06 +00:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function
2020-03-20 22:16:56 -04:00
Bastien Orivel
c693ef7025
Update rand to 0.6
...
I changed the isaac random to always be the 32 bits one because the 64
bits version doesn't work with ReseedingRng as it requires the
generator's output to be u32 for some reasons.
The other main change is that the reseed method doesn't exist anymore
and now rand recreates a new generator when it needs to reseed so I had
to add a new method for when we don't want a generator to be reseeded.
Closes #23558
2019-08-11 20:50:22 +02:00
marmeladema
2c5d0a6ebc
Convert CGTraitInterface to use safe JSContext instead of raw JSContext
2019-07-24 08:24:50 +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
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
Christian Poveda
723e03ef01
getRandomValues uses ArrayBufferView now
2018-03-22 12:12:16 -05:00
Simon Sapin
52eda6082f
Replace NonNullJSObjectPtr with std::ptr::NonNull<JSObject>
2018-01-22 17:41:25 +01:00
Nicholas Nethercote
4506f0d30c
Replace all uses of the heapsize crate with malloc_size_of.
...
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`.
2017-10-18 22:20:37 +11:00
Simon Sapin
e2fafd2dfc
Replace NonZero<*mut JSObject> with a wrapper to enable local trait impls.
2017-10-16 20:19:56 +02: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
577370746e
Rename DOMRefCell<T> to DomRefCell<T>
...
I don't want to do such a gratuitous rename, but with all the other types
now having "Dom" as part of their name, and especially with "DomOnceCell",
I feel like the other cell type that we already have should also follow
the convention. That argument loses weight though when we realise there
is still DOMString and other things.
2017-09-26 09:49:08 +02:00
Anthony Ramine
0e3c54c191
Rename dom::bindings::js to dom::bindings::root
2017-09-26 02:19:05 +02:00
Simon Sapin
a205c82264
Upgrade to rustc 1.21.0-nightly (599be0d18 2017-07-26)
2017-07-27 02:21:01 +02:00
Anthony Ramine
31e9d81c0f
Make #[dom_struct] a proc_macro attribute
2017-02-24 01:50:51 +01:00
Sam Liu
4fc3e7e75d
Replace uses of spidermonkey-specific JS_GetArrayBufferViewType with ArrayBufferView impl's method get_array_type()
2017-02-20 23:13:47 -08:00
Alan Jeffrey
7ace30f9bd
An in-memory RNG that shares its file descriptor.
2017-01-05 13:51:53 +00:00
deror1869107
684db8bd29
Rewrite Crypto::GetRandomValues to use typed array API
...
Fix mut typed_array
Redundant code
2016-12-26 11:15:42 +08:00
Anthony Ramine
620a67ff14
Mark JSTraceable and its method as unsafe
2016-12-06 13:15:06 -10:00
Abelardo E. Mendoza
b372e7c98f
script creates methods taking '*mut JSContext' unsafe
...
rebase + marked the necessary new code as unsafe
2016-11-14 11:06:17 +01:00
Anthony Ramine
fcb59d3057
Make reflect_dom_object take a &GlobalScope
2016-10-06 20:59:09 +02:00
Anthony Ramine
6e1523f4ae
Compile WebIDL return type "object" to NonZero<*mut JSObject>
2016-08-30 19:07:13 +02:00
Anthony Ramine
cb5cd8d881
Say farewell to in-tree HeapSizeOf
2016-02-04 22:03:32 +01:00
Emilio Cobos Álvarez
43d395a682
conversions: Add a checked version to array_buffer_view_data
2016-01-04 15:29:24 +01:00
Emilio Cobos Álvarez
9ad49c8aa1
conversion: Extrapolate array_buffer_view_data
...
And use it instead of the raw jsapi calls.
2016-01-04 15:19:29 +01:00
Ms2ger
0c61be7a57
Rustfmt some of script.
2015-11-18 11:14:05 +01:00
rohan.prinja
45224028db
more refactoring
2015-10-30 20:26:29 +09:00
Ravi Shankar
889eec364b
sorted the extern crate, mod & use declarations
2015-09-24 02:12:45 +05:30