Commit graph

323 commits

Author SHA1 Message Date
Oluwatobi Sofela
66ad795014
clippy: Fix mem_replace_with_default warnings (#31921) 2024-03-28 13:10:37 +00:00
Oluwatobi Sofela
da518823ff
clippy: Fix op_ref warnings (#31900) 2024-03-27 16:45:58 +00:00
Aarya Khandelwal
f7669b5238
fixes dereferencing on an immutable reference (#31864) 2024-03-26 08:37:44 +00:00
Oluwatobi Sofela
3c05b58221
clippy: Fix explicit_auto_deref warnings in components/script (#31837)
* clippy: Fix explicit auto-deref warnings

* clippy: Fix explicit auto-deref warnings

* refactor: Tidy up code

* refactor: Fix method not found errors
2024-03-23 11:29:20 +00:00
Aarya Khandelwal
9b26dca141
Fixed the .clone() warnings. (#31819) 2024-03-22 05:41:17 +00:00
Oluwatobi Sofela
2789e98876
clippy: Fix redundant field names warnings (#31793) 2024-03-20 23:05:29 +00:00
Oluwatobi Sofela
15bf32a4e6
clippy: Fix unneeded return statement warnings (#31776) 2024-03-20 14:11:40 +00:00
Oluwatobi Sofela
02a0cdd6fa
clippy: Fix dereferenced warnings (#31770) 2024-03-20 08:07:22 +00:00
Martin Robinson
9a6973d629
style: Remove dependency on servo_url (#31358)
In order for stylo to be a separate crate, it needs to depend on less
things from Servo. This change makes it so that stylo no longer depends
on servo_url.
2024-02-16 11:56:35 +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
604979e367
Replace script_plugins with a clippy like rustc driver (named crown) (#30508)
* 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>
2023-12-01 15:50:52 +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
Li-Hsuan Hsieh
42c705b4ad
Fix type attribute for module script not in case insensitive issue (#30206)
* fix(htmlscriptelement): Make sure type for module is in case insensitive

* fix(htmlscripthtml): Remove related .ini file since the tests are passed
2023-08-25 18:28:51 +00:00
Samson
9514f670d1
No tracing of nop traceable fields (#29926)
* Add `no_trace` option to JSTraceable derive

* NoTrace wrapper

* Port some types to no_trace schematics

* Fixing my unsafe mistakes (not tracing traceables)

* Add docs & safety guards for no_trace

Safety guards (trait shenanigans) guarantees safety usage of `no_trace`

* Port canvas_traits to no_trace

* Port servo_media to no_trace

* Port net_traits to no_trace

* Port style to no_trace

* Port webgpu to no_trace

* Port script_traits to no_trace

* Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace

* unrooted_must_root lint in seperate file

* Add trace_in_no_trace_lint as script_plugin

* Composable types in must_not_have_traceable

* Introduced HashMapTracedValues wrapper

* `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>`

* Port rest of servo's types to no_trace

* Port html5ever, euclid, mime and http to no_trace

* Port remaining externals to no_trace

* Port webxr and Arc<Mutex<_>>

* Fix spelling in notrace doc
2023-08-04 10:17:43 +00:00
Josh Matthews
0e8ac3fdac Formatting. 2023-05-28 23:54:02 -04:00
Josh Matthews
dbff26bce0 Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
Josh Matthews
f79e1e327d Make GlobalScope.get_cx a static method. 2023-05-20 11:05:09 -04:00
Josh Matthews
f76bb20c2e Format. 2022-11-23 10:04:53 -05:00
Josh Matthews
bd77a4043c Changes for spidermomkey upgrade. 2022-11-23 10:04:50 -05:00
sagudev
a265a2a7e6 Formating 2021-03-12 18:30:13 +01:00
sagudev
425057c432 Fix errors 2021-03-12 16:26:27 +01:00
Josh Matthews
5c4939599e Update mozjs. 2021-02-18 09:35:45 -05:00
YUAN LYU
a999850b24 Implement referrerPolicy for HTMLLinkElement and HTMLScriptElement 2020-12-01 00:37:16 -05:00
Sudarsan
f8c9ee4eff Update mozjs to 0.14.1
This update pulls in improvements on mozjs that now removes the need to
pass pointers to CompileOptionsWraper::new(), allows NewProxyObject to
now accept a Singleton bool and JSClass and removes an unsafe
Handle::new usage.
2020-08-28 20:54:18 +08:00
Arjun Ramachandrula
6014710538 Removed unnecessary conversion from UTF-8 to UTF-16 2020-07-27 21:45:20 -04:00
Josh Matthews
a271ed9150 Pass C string pointer to CompileOptionsWrapper. 2020-07-22 12:30:27 -04:00
AbhishekSharma102
1119dd119e Added off thread compilation
Co-authored-by: Gregory Terzian <2792687+gterzian@users.noreply.github.com>
Co-authored-by: Abhishek Sharma <20724848+AbhishekSharma102@users.noreply.github.com>
2020-07-21 16:20:51 -04:00
bors-servo
086556e706
Auto merge of #27026 - CYBAI:dynamic-module, r=jdm
Introduce dynamic module

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #25439
- [x] There are tests for these changes
2020-07-19 09:29:50 -04:00
bors-servo
b63ce282aa
Auto merge of #27303 - camelid:async-to-asynch, r=jdm
Use `asynch` instead of `r#async`

<!-- Please describe your changes on the following line: -->
This is a vestige of the transition from 2015 to 2018 edition Rust.
`async` was added as a keyword in 2018 edition Rust, so `cargo fix`
changed the variable name here to `r#async`.

---
<!-- 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
- [x] These changes do not require tests because this is just an internal name change

<!-- 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. -->
2020-07-17 22:51:12 -04:00
CYBAI
d1715918f0 Set private reference for classic script
Web developers can use `Dynamic Import` in a classic script; thus, we
need to save the script's private reference so that we can reuse it when
we're going to fetch a dynamic import module for a classic script.

Besides, because it's possible to use different executing context for a
dynamic import module (like `dynamic-import/string-compilation-other-document.html` WPT test),
we can't initialize a module owner at the timing of `SetScriptPrivate`;
thus, if the private module script doesn't hold an owner, we'll use a
DynamicImport owner for it.
2020-07-18 00:43:34 +09:00
Josh Matthews
1aef31bb2f checkpoint - dynamic load inside of a module and classic script works. 2020-07-18 00:43:34 +09:00
Camelid
a62a30ef83 Use asynch instead of r#async
This is a vestige of the transition from 2015 to 2018 edition Rust.
`async` was added as a keyword in 2018 edition Rust, so `cargo fix`
changed the variable name here to `r#async`.
2020-07-16 20:52:19 -07:00
Camelid
cdfd4d9075 One fewer Rc::clone() 2020-07-16 19:32:42 -07:00
Camelid
3f440bd6dc Fewer clones 2020-07-16 19:29:57 -07:00
Camelid
69881e8b06 Use Rc instead of cloning the DOMString
Specifically, I changed the `text` field of `ScriptOrigin` from a
`DOMString` to an `Rc<DOMString>`. Then I updated all the related code
to work with an `Rc`.

This is just a first pass to get the code to compile. There are probably
more things I can do that will improve the code and further reduce
cloning.
2020-07-14 20:34:01 -07:00
Matthias Deiml
47355766ed Fix invalid use of ReferrerUrl 2020-06-17 19:07:15 +02:00
Matthias Deiml
fa18cf620f Make url for "client" referrer mandatory 2020-06-17 19:07:14 +02:00
CYBAI
dc2c2c8dfb Move away from Promise.all way and check if we need to finish manually
In the previous Promise.all way, we registered a promise for every
module script which means we will need to do many complex checkings like
"is this top level?" and it will make us much more difficult to understand
how the module script algorithm works.

In the new manual checking way, we will only register promises for top
level modules to notify its owner (e.g. the script element) to finish
the load. So, we can understand it much more easily and would be more
spec-aligned.

Also, I think the `Ready` and `FetchFailed` status are quite confusing
and we actually don't need them so they're removed in this patch. Then,
we will always go to `Finished` instead.

It would basically be following steps:

                                          +-----------------+
                                          | Failed to fetch | ----------+
+--------------+       +----------+     / +-----------------+           |
| Fetch module | ----> | Fetching | ---+                                v
+--------------+       +----------+     \ +---------+        +---------------------+
                                          | Fetched |        | Advance to Finished |
                                          +---------+        +---------------------+
                                               |                        ^
                                               v                        |
                                      +-------------------+             |
                                      | Fetch descendants | ----- if no descendants
                                      +-------------------+
                                               |
                                               V
                                     +----------------------+
                                     | Fetching Descendants |
                                     +----------------------+

In `Advance to Finished`, it means that module script is about to finished so it will

1. Notify all of its `ready` and `not finished` parents to finish
2. Link (instantiate) the module
3. Resolve its promise to notify owner(s) to finish
2020-06-13 11:11:25 +09:00
skrzyp1
ee6906443f reading unminified scripts from disk 2020-06-02 21:23:45 +02:00
CYBAI
a0df94bddc Set currentScript to null for module scripts
I misunderstood the test case when I worked on #23545. That test case is
actually not related to dynamic import; instead, the reason why it
crashes is, `currentScript` should be updated to `null`.
2020-05-27 11:22:04 +09:00
Josh Matthews
8f4cb28a6d Use temporary files instead of pipes for JS unminification. 2020-05-22 14:40:50 -04:00
bors-servo
a9965db69f
Auto merge of #26005 - jdm:hubs-csp, r=nox
Update content-security-policy.

This allows hubs.mozilla.org to load instead of panicking due to unimplemented CSP features.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24702
- [x] These changes do not require tests because we never enabled the CSP testsuite
2020-03-25 13:33:23 -04:00
Josh Matthews
19216627d3 Update content-security-policy. 2020-03-25 09:11:09 -04:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
Simon Sapin
708d3737df Upgrade to rustc 1.43.0-nightly (5d04ce67f 2020-02-13) 2020-02-14 12:27:14 +01:00
Kunal Mohan
f7db4b7f80
Modify script to prevent further violations of snake_case 2020-01-18 14:22:15 +05:30
CYBAI
1cc6435cfc Implement nomodule attribute 2020-01-03 13:04:21 +09:00
CYBAI
5c9536acdc Support module script credentials mode 2020-01-03 13:04:19 +09:00
CYBAI
cfad32cffd Support integrity for module script 2020-01-03 13:03:18 +09:00