Commit graph

100 commits

Author SHA1 Message Date
Josh Matthews
a6218b42ea
bindings: Move string-related bindings code to script_bindings. (#35172)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-29 07:40:25 +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
Martin Robinson
621ddd749c
Elide lifetimes where possible after rustup (#34824)
The new version of rust allows us to elide some lifetimes and clippy is
now complaining about this. This change elides them where possible and
removes the clippy exceptions.

Fixes #34804.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-01-03 18:54:44 +00:00
Oriol Brufau
ed908f3fd4
Fix rustdoc problems (#33458)
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
2024-09-14 18:32:41 +00:00
Ali
ed6b1b5e6a
clippy: Fix suggestions in script, libservo, and servoshell (#33453)
* fix clone on copy warning in servoshell

Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com>

* Remove unecessary borrow in libservo

Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com>

* Ignore too many arguments warning on create_constellation()

Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com>

* fix explicit auto-deref warning

Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com>

* Autofix multiple clippy warnings in components/script

Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com>

---------

Signed-off-by: Ali Zein Yousuf <azy5030@gmail.com>
2024-09-14 08:41:13 +00:00
Martin Robinson
8842fe9df5
script: Use time@0.3 for input elements and do conversion in a &str trait (#33355)
This changes converts all input element parsing and normalization to use
`time` instead of `chrono`. `time` is used by our dependencies, so it
makes sense to work toward removing the Servo dependency on chrono.

In addition, parsing and normalization also moves to a trait on &str to
prepare for the possibility of all script parsers moving to a separate
crate that can have unit tests written against it.

Code duplication is eliminated when possible and more conversion is done
using integer types. These two things together mean we pass more tests
now.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-09 14:33:16 +00:00
Hayashi Mikihiro
a797969efe
Replace the lazy_static crate whth std::sync::LazyLock in components/script (#33004)
* replace in str.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace navigator.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace htmlmetaelement.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace document.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace cssstyledeclaration.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace script_runtime.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* replace window_named_properties.rs

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* reduce dependency lazy_static

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

* reduce lazy in script_runtime.rs

 `Mutex::new()`  is const contexts. I think that `JS_ENGINE` is need not lazy initialize.

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>

---------

Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
2024-08-12 07:30:35 +00:00
Martin Robinson
26624a109f
clippy: Fix a bunch of warnings in script (#32680)
This is just a portion of the errors that are remaining to be fixed.
2024-07-04 11:40:23 +00:00
shanehandley
8eeb888010
fix: Implement additional logic in DOMString::set_best_representation_of_the_floating_point_number in order to correct some failing tests related to -0 values. (#32272) 2024-05-13 08:07:48 +00:00
eri
a7ad92d9a3
clippy: Fix from_over_into warnings (#31946) 2024-03-30 11:30:14 +00:00
Ekta Siwach
b0196ad373
clippy: Fix a variety of warnings in components/script/dom (#31894) 2024-03-29 14:43:10 +00:00
Oluwatobi Sofela
c3b6d40f90
clippy: Fix len_zero warnings (#31935) 2024-03-29 10:05:20 +00:00
Azhar Ismagulova
0728378424
clippy: remove unneeded return statements (#31923) 2024-03-28 16:17:47 +00:00
Rosemary Ajayi
7100465d1a
clippy: Fix various clippy warnings in components/scripts/dom/bindings (#31901)
* single-character string constant used as pattern

* singuse of  with literal radix of 16
2024-03-28 11:49:36 +00:00
Azhar Ismagulova
ff95ce5abd
fix: omitted the let bindings (#31908) 2024-03-27 20:22:51 +00:00
Rosemary Ajayi
a5bcae212a
clippy: Fix clippy problems in components/script/dom (#31891)
* deref on an immutable reference

* use of  with literal radix of 10

* fix
2024-03-27 18:36:16 +00:00
Oluwatobi Sofela
b71de92569
clippy: Fix single_match warnings (#31876) 2024-03-26 14:01:10 +00:00
Oluwatobi Sofela
bae77671f8
clippy: Fix unnecessary_cast warnings in components/script (#31823)
* clippy: Fix unnecessary cast warnings

* clippy: Replace redundant field names with their shorthand alternatives

* clippy: Delete struct pattern dereferencings
2024-03-22 13:48:03 +00:00
eri
da696b7e57
clippy: fix result_unit_err warnings (#31791)
* clippy: fix `result_unit_err` warnings

* feat: fix result warnings in script

* doc: document `generate_key` return type

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* feat: add back result to RangeRequestBounds::get_final

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-03-21 12:51:45 +00:00
Oluwatobi Sofela
8cbad332c3
rusdoc: Fix idl warning in components/script/dom/bindings (#31643)
* rusdoc: Add valid domstring link

* rustdoc: Replace unused idl link ref
2024-03-13 17:59:27 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
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.
2024-01-22 13:13:48 +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
711dbbd4af
remove extern crate (#30311)
* 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>
2023-09-08 12:11:31 +00:00
Martin Robinson
bd2503ceac
Fix warnings after chrono upgrade (#30165)
Some functions are now deprecated, so use the suggested ones and do a
general cleanup of the affected lines of code.
2023-08-23 00:44:00 +00:00
teapotd
779552ee7d Form constraints validation 2020-04-02 10:16:46 +02:00
Patrick Shaughnessy
6dc8f67f8f Make sure input value=12:30:01 doesn't turn into 12:30:1 2020-02-12 11:50:40 -05:00
Patrick Shaughnessy
87e86c81b9 stepUp, stepDown, valueAsNumber, valueAsDate, and list work and have tests 2020-01-10 20:09:51 -05:00
glowe
576f51f598 Add DOMString floating point string test and fix
Fixes an issue where DOMString::is_valid_floating_point_number_string
was returning true for strings that began with whitespace characters-
TAB, LF, FF, or CR. Also added a unit test to cover this since the
corresponding web-platform-tests are incomplete.
2019-11-30 23:29:09 -05:00
Kagami Sascha Rosylight
b697621b05 Support WebIDL record<> 2019-10-15 17:14:00 +09:00
Simon Sapin
1d38bc0419 Fix some new warnings 2019-06-22 14:59:09 +02:00
est31
8b6ed3d182 Remove unused code from script* crates 2019-06-02 07:12:26 +02:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Dan Robertson
c46508e497
Update src/href attributes to be a USVString
The following IDLs have the src/href attributes typed as a DOMString
while in the spec the attribute has been updated to be a USVString:

 - HTMLIFrameElement
 - HTMLImageElement
 - HTMLInputElement
 - HTMLLinkElement
 - HTMLMediaElement
 - HTMLScriptElement
2018-12-17 15:28:42 +00:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Jim Berlage
1f99bf4631 Fixes panic on DOMString::strip_leading_and_trailing_ascii_whitespace 2018-11-08 16:16:28 -06:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Simon Sapin
3d6614e314 Upgrade to rustc 1.27.0-nightly (056f589fb 2018-04-07) 2018-04-09 21:43:25 +02:00
tigercosmos
b29230bd76 implement range input sanitization 2018-01-17 16:27:21 +08:00
Nathan
5b6e821559 input type=number validations 2018-01-09 20:08:09 -06:00
tigercosmos
b43424111e implement valid Date time Local input 2018-01-07 18:31:32 +08:00
tigercosmos
54c6028033 implement valid week string 2017-12-17 16:57:01 +08:00
tigercosmos
927fd1d044 implement "Date type inputs", "Month type inputs" 2017-12-05 09:44:51 +08:00
Simon Wörner
a999239f28 Added time input sanitization:
- Implemented is_valid_time_string for DOMString.
- Use is_valid_time_string for sanitize_value with time input.
- Improved input type change test
2017-12-04 11:21:28 +01:00
bors-servo
338e2ae520 Auto merge of #18262 - KiChjang:value-sanitization, r=nox
Implement value sanitization on HTMLInputElement

https://html.spec.whatwg.org/multipage/input.html#value-sanitization-algorithm

<!-- 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/18262)
<!-- Reviewable:end -->
2017-11-09 18:35:07 -06:00
Simon Sapin
793bebfc0e Upgrade to rustc 1.23.0-nightly (02004ef78 2017-11-08) 2017-11-09 16:56:39 +01:00
Keith Yeung
9d60333af9 Implement string stripping utilities from the Infra spec 2017-11-08 11:58:18 -08: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
Josh Matthews
16166d6673 Derive the Default trait for dictionaries containing GC values. 2017-09-25 16:10:58 -04:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00