Commit graph

109 commits

Author SHA1 Message Date
Martin Robinson
bce7622cde
Switch to rustls and webpki-roots (#30025)
This change replaces OpenSSL with rustls and also the manually curated
CA certs file with webpki-roots (effectively the same thing, but as a
crate).

Generally speaking the design of the network stack is the same. Changes:

- Code around certificate overrides needed to be refactored to work with
  rustls so the various thread-safe list of certificates is refactored
  into `CertificateErrorOverrideManager`
- hyper-rustls takes care of setting ALPN protocols for HTTP requests,
  so for WebSockets this is moved to the WebSocket code.
- The safe set of cypher suites is chosen, which seem to correspond to
  the "Modern" configuration from [1]. This can be adjusted later.
- Instead of passing a string of PEM CA certificates around, an enum is
  used that includes parsed Certificates (or the default which reads
  them from webpki-roots).
- Code for starting up an SSL server for testing is cleaned up a little,
  due to the fact that the certificates need to be overriden explicitly
  now. This is due to the fact that the `webpki` crate is more stringent
  with self-signed certificates than SSL (CA certificates cannot used as
  end-entity certificates). [2]

1. https://wiki.mozilla.org/Security/Server_Side_TLS
2. https://github.com/briansmith/webpki/issues/114

Fixes #7888.
Fixes #13749.
Fixes #26835.
Fixes #29291.
2023-08-08 14:00:10 +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
Nipun Garg
41fe94244a
Refactor ServoParser Tokenizer to return TokenizerResult 2023-06-22 13:45:20 +02:00
Josh Matthews
dbff26bce0 Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
Josh Matthews
dcf02caf81 Enter realms when creating special same-origin iframes. 2023-05-20 18:32:08 -04:00
Josh Matthews
864e072d5c Enter realms more consistently during the script event loop. 2023-05-20 14:30:22 -04:00
Martin Robinson
0d7284dc34 Allow displaying content with "application/json" mime type
For me this allows the WPT test
performance-timeline/tentative/include-frames-one-remote-child.sub.html
to match expected results. The wptserver is sending a 404 JSON response
because the URL that the test requests is not found.
2023-01-16 10:21:41 +01:00
Andreu Botella
d2b9e64cf3 Clean up the code to BOM sniff.
See https://github.com/servo/servo/pull/28006#discussion_r551968553
2021-01-09 19:18:22 +01:00
Andreu Botella
cd34f156f6 Fix document.characterSet not reflecting byte order marks.
The process of decoding the network byte stream to Unicode is backed by
an instance of `encoding_rs::Decoder`, which will switch the encoding it
uses if it finds a BOM in the byte stream. However, this change in
encoding is not communicated back to the caller and so
`document.characterSet` gives the wrong result. This change fixes that.

See whatwg/html#5359 and whatwg/encoding#203 for the spec-level backing
for this change.

Signed-off-by: Andreu Botella <abb@randomunok.com>
2020-12-31 13:43:33 +01:00
Gregory Terzian
558a55c0b2 do not trace pending parsers 2020-06-17 22:49:19 +08:00
Josh Matthews
6a6662195e net: Add option to temporarily accept certs that failed the handshake. 2020-06-09 15:03:18 -04:00
Josh Matthews
0ce2aa917a net: Pass certs that fail the SSL handshake out of the network layer. 2020-06-09 15:03:18 -04:00
Josh Matthews
b7a640b517 net: Treat SSL handshake errors differently from other hyper errors. 2020-06-09 15:03:18 -04:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
Patrick Shaughnessy
345470b6b7 inserting an element from normal parser uses a CE reaction queue 2020-02-13 10:35:36 -05:00
Patrick Shaughnessy
c725f9e84d Add microtask checkpoints on </script> and CE construct 2020-01-15 11:49:52 -05:00
Patrick Shaughnessy
87e86c81b9 stepUp, stepDown, valueAsNumber, valueAsDate, and list work and have tests 2020-01-10 20:09:51 -05:00
Shinichi Morimoto
d25d658219 #24468 call update_entry API from process_response_eof 2019-12-13 13:41:48 -05:00
Shinichi Morimoto
91287216f5 #24468 Performance::queue_entries return the index of the added performance entry 2019-12-13 13:41:47 -05:00
Shinichi Morimoto
faee09ffa9 #24468 call submit_resource_timing after creating the document parser 2019-12-13 13:41:47 -05:00
Simon Sapin
bea73951db Use #![register_tool] instead of #![register_attr]
CC https://github.com/rust-lang/rust/issues/66079
2019-11-15 17:24:42 +01: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
Alan Jeffrey
49a5e84fb1 Responding to review comments 2019-09-11 11:40:50 -05:00
Alan Jeffrey
1aeb97b281 Prefetch img and scripts during parsing 2019-09-10 16:13:49 -05:00
Simon Sapin
c38c964f1b Upgrade to rustc 1.38.0-nightly (dddb7fca0 2019-07-30) 2019-07-31 13:34:01 +02:00
Fernando Jiménez Moreno
8eba587547 Merge Node::shadow_including_inclusive_ancestors into inclusive_ancestors 2019-04-26 11:42:38 +02:00
Peter Hall
8bfd4dc1e2 #8539 Config preferences backend restructure 2019-03-20 15:01:26 +00:00
Anthony Ramine
5fe5e5d6de Remove most RootedReference uses
We can replace all uses of RootedReference for Option<T> by Option::deref calls.
2019-03-10 17:51:35 +01:00
bors-servo
66223ee105
Auto merge of #22121 - gterzian:remove_constellation_block_in_navigation, r=paulrouget
Remove sync constellation -> embedder communication

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #22042 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

<!-- 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/22121)
<!-- Reviewable:end -->
2018-12-26 01:53:20 -05:00
Gregory Terzian
cca354b217 set document ready state to complete in step 4 of parser abort 2018-12-23 17:39:20 +08: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
Anthony Ramine
a2abfc6301 Make the parser decode input from document's encoding
The document's encoding is only computed from the Content-Type header for now,
with no sniffing at all.
2018-12-12 13:50:27 +01:00
Anthony Ramine
848a4e256a Fix an ignore_malloc_size_of comment 2018-12-12 11:29:14 +01:00
Anthony Ramine
d1d79bf947 Remove an argument to ServoParser::parse_html_script_input
Since the spec of document.open was updated, this argument became useless.
2018-12-12 11:29:14 +01:00
Anthony Ramine
b4448a9fe7 Use Utf8LossyDecoder instead of IncompleteUtf8 2018-12-05 16:39:07 +01:00
ddh
26007fddd3 refactored performance timing to align with updated spec
refactoring with ResourceFetchMetadata

implemented deprecated window.timing functionality

created ResourceTimingListener trait

fixed w3c links in navigation timing

updated include.ini to run resource timing tests on ci
2018-11-20 16:21:32 +00: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
76e59a46d3 Sort use statements 2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
Bastien Orivel
024b40b39d Update hyper to 0.12 2018-11-01 19:17:36 +01:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Gregory Terzian
31da37fa6c stopping tokenizer if parser is aborted 2018-07-29 16:42:59 +08:00
Gregory Terzian
e49c8e7f26 spec compliant active parser concept 2018-07-29 16:42:59 +08:00
Paul Rouget
9fb5795f37 delegate resource reading to embedder 2018-04-27 15:34:52 +08:00
CYBAI
9a358014f9 Use specific assertion for DOM servoparser 2018-01-26 01:18:57 +08:00
Connor Brewster
4593195b49 Implement throw-on-dynamic-markup-insertion-counter 2018-01-11 11:14:10 -05:00
Connor Brewster
43526c80bb Add a check for when the js execution stack is empty 2018-01-11 11:14:10 -05:00
Connor Brewster
87475b11d3 Implement the create an element for token algorithm 2018-01-11 11:14:10 -05:00