Commit graph

359 commits

Author SHA1 Message Date
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
CYBAI
f2007751dd Scaffold module script 2020-01-03 13:02:31 +09:00
Josh Matthews
55eb34b8a9 Issue warning to devtools when module scripts in use. 2019-12-12 15:42:37 -05:00
Michael Howell
b8f3e8bb2e Add simple implementation of content-security-policy on scripts / styles
This needs a lot more hooks before it'll actually be a good
implementation, but for a start it can help get some feedback on if this
is the right way to go about it.

Part of servo/servo#4577
2019-10-16 19:46:45 +00:00
Josh Matthews
1df8d57dc6 Support CORS attributes for image elements. 2019-10-04 15:08:40 -04:00
Alan Jeffrey
1aeb97b281 Prefetch img and scripts during parsing 2019-09-10 16:13:49 -05:00
CYBAI
95ddfb3930 Show warning when the script is a module
The warning can be removed in #23545.
2019-09-06 13:35:40 +09:00
CYBAI
70c5cfdbdb Add type_ for script origin to distinguish module or classic 2019-09-06 13:35:40 +09:00
CYBAI
19eb2392f5 Rename ClassicScript to ScriptOrigin
This is basically revert 965370c0bf. After introducing module script, we
can reuse this struct and add field to see the type of script.
2019-09-06 13:35:40 +09:00
CYBAI
608c44f103 Rename ScriptContext to ClassicContext 2019-09-06 13:35:39 +09:00
CYBAI
47d8c572ce Recognize module as script type 2019-09-06 13:35:39 +09:00
CYBAI
96ed5ac84d Update spec step number 2019-09-06 12:44:37 +09:00
Simon Sapin
c38c964f1b Upgrade to rustc 1.38.0-nightly (dddb7fca0 2019-07-30) 2019-07-31 13:34:01 +02:00
marmeladema
88cacfb009 Modify *::get_cx methods to return a safe JSContext instead of a raw one 2019-07-24 09:53:10 +01:00
oneturkmen
42569280e2 Script: removed a few opts::get() 2019-06-26 22:23:07 -06:00