Commit graph

5314 commits

Author SHA1 Message Date
bors-servo
c3f0c9054f Auto merge of #15145 - SwagColoredKitteh:issue-15101, r=emilio
Prevent crashing when a link tag has two or more in-flight requests (fix for issue #15101)

<!-- Please describe your changes on the following line: -->
The `HTMLLinkElement::set_stylesheet` function now checks whether there already is a stylesheet, and if there is, calls `Document::invalidate_stylesheets` after modifying `self.stylesheet`.

This PR also includes a minimal WPT that causes the panic.

This is fundamentally a timing issue, so while this fix prevents the crash, it does not fix the underlying issue. Making a &lt;link&gt; element send a second request before the first can finish and then getting the two stylesheet responses out-of-order will apply the wrong stylesheet, as demonstrated with https://gist.github.com/SwagColoredKitteh/2c24c7fac635445042eda4a30e10420e.

r? @emilio

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15101 (github issue number if applicable).

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

<!-- 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/15145)
<!-- Reviewable:end -->
2017-01-24 07:06:51 -08:00
SwagColoredKitteh
bb2826e41f fix issue #15101 and make sure out-of-order stylesheet loads work correctly for the same element 2017-01-24 15:52:01 +01:00
Anthony Ramine
3dd3736b00 Remove some convenience methods on Event
They don't need to exist anymore now that dom::eventdispatcher has been removed.
2017-01-22 15:31:48 +01:00
Anthony Ramine
7dd5945237 Inline dom::eventdispatcher into dom::event 2017-01-22 15:31:47 +01:00
Anthony Ramine
7aea6e6ea3 Kill AutoDOMEventMarker 2017-01-22 15:02:34 +01:00
Roman Zaynetdinov
f0c72cb7fd Removing style element's styles when elements is removed from dom 2017-01-22 08:52:59 +02:00
Roman Zaynetdinov
b3ce08f1b5 Remove styles when link node is removed from document 2017-01-22 08:52:52 +02:00
Anthony Ramine
a5acf50b58 Expose Location only in Window 2017-01-21 15:16:27 +01:00
Anthony Ramine
03d79185ff Support document.createElement("beforeunloadevent") 2017-01-21 15:16:19 +01:00
Anthony Ramine
7b4050ea10 Make TransitionEvent::new_inherited private 2017-01-21 15:16:18 +01:00
Anthony Ramine
1f8106a1dc Expose PopStateEvent only in Window 2017-01-21 15:16:14 +01:00
Anthony Ramine
bd5ffd2833 Expose PageTransitionEvent only in Window 2017-01-21 15:16:02 +01:00
Anthony Ramine
ba0bf3a066 Explicitly expose MouseEvent only in Window 2017-01-21 15:15:54 +01:00
Anthony Ramine
2221203359 Expose HashChangeEvent only in Window 2017-01-21 15:15:50 +01:00
Anthony Ramine
ee1ff1d385 Make FocusEvent::new_uninitialized take a &Window 2017-01-21 14:32:37 +01:00
Anthony Ramine
707f8f881e Make TransitionEvent::new take a &Window 2017-01-21 14:32:34 +01:00
Anthony Ramine
e3980e6235 Expose BeforeUnloadEvent only in Window 2017-01-21 14:32:32 +01:00
Anthony Ramine
969e6e5ac3 Add some comments for the end 2017-01-20 23:55:32 +01:00
Anthony Ramine
6c788feaf7 Process pending parsing blocking script before deferred scripts
Processing the blocking script beforehand may allow the parser to finish parsing,
in which case deferred scripts have the opportunity to get executed.
2017-01-20 23:54:42 +01:00
bors-servo
830fe189ad Auto merge of #15128 - nox:load-fixes, r=Ms2ger
Simplify how we handle script scheduling and delaying the load event

<!-- 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/15128)
<!-- Reviewable:end -->
2017-01-20 13:41:32 -08:00
bors-servo
15c542d3a1 Auto merge of #14646 - canaltinova:origin-clean, r=jdm
Support origins in CSSOM stylesheets

<!-- Please describe your changes on the following line: -->
I still need to pass the origin clean flag to constructors. `style::stylesheets::Stylesheet` has an origin field but I don't think that's relevant.
I can get href in htmllinkelement.rs like this:
```rust
let element = self.upcast::<Element>();
let href = element.get_string_attribute(&local_name!("href"));
```
But I'm not sure how to proceed after here.
@Manishearth any opinions?

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14327 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes

<!-- 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/14646)
<!-- Reviewable:end -->
2017-01-20 11:12:59 -08:00
Nazım Can Altınova
fd950a7309 Support origins in CSSOM stylesheets 2017-01-20 22:00:49 +03:00
bors-servo
5cd0425933 Auto merge of #15127 - servo:RootedTraceableSet, r=jdm
Privatize RootedTraceableSet.

<!-- 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/15127)
<!-- Reviewable:end -->
2017-01-20 10:17:38 -08:00
bors-servo
eade32ed16 Auto merge of #15099 - servo:phf-no-macros, r=jdm
Remove usage of phf_macros.

It’s a compiler plugin that uses unstable compiler APIs that are not on a path to stabilization.

With this changes, there is one less thing that might break when we update the compiler. For example: https://github.com/sfackler/rust-phf/pull/101

<!-- 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: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

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

<!-- 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/15099)
<!-- Reviewable:end -->
2017-01-20 08:59:26 -08:00
Josh Matthews
e5eaab3523 Use Heap in DOM object reflector implementation to ensure GC barriers are used. 2017-01-20 11:32:19 -05:00
bors-servo
e6f661c984 Auto merge of #15117 - servo:fileapi, r=nox
Fix and annotate some FileAPI test failures.

<!-- 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/15117)
<!-- Reviewable:end -->
2017-01-20 08:03:41 -08:00
Anthony Ramine
e9feb20775 Simplify processing of deferred scripts
It is now done on-demand when a deferred script finished loading, and when
the page source finished loading.
2017-01-20 16:41:49 +01:00
Anthony Ramine
abdb390da8 Simplify processing of pending parsing-blocking scripts
This is done outside of finish_load in a more straightforward way now.
2017-01-20 16:30:34 +01:00
Ms2ger
eccf0a2932 Privatize RootedTraceableSet. 2017-01-20 16:09:35 +01:00
Anthony Ramine
1bf0db5537 Process deferred scripts less often
Only do it from finish_load when a stylesheet finished loading, and from
deferred_script_loaded directly.
2017-01-20 16:08:59 +01:00
Ms2ger
6a6f339b29 Support dictionaries in unions.
Fixes #11612.
2017-01-20 16:06:33 +01:00
Anthony Ramine
9912721f06 Simplify processing of asap scripts in order 2017-01-20 15:35:22 +01:00
Anthony Ramine
f7df804630 Simplify the processing of asap scripts 2017-01-20 15:25:24 +01:00
bors-servo
29d4f7d467 Auto merge of #15083 - potocpav:issue-14497, r=KiChjang
Fix #14497: WeakMediaQueryListVec assumes its contents are still alive

<!-- Please describe your changes on the following line: -->
First time contributor here. Noticed this issue is easily solved, so I did it. I am very unsure about how things work here: Is a test needed? What should it look like? Should the "unwrap" be avoided (making bigger changes to the code)?

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14497  (github issue number if applicable).

- [X] There are tests for these changes

<!-- 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/15083)
<!-- Reviewable:end -->
2017-01-19 14:10:33 -08:00
Simon Sapin
0b9ff576e0 script codegen: Avoid modifying in-place a generated file. 2017-01-19 17:13:35 +01:00
bors-servo
6272cb5a51 Auto merge of #15098 - nox:load-fixes, r=jdm
Mark the page source as loaded only after parsing is done

<!-- 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/15098)
<!-- Reviewable:end -->
2017-01-19 07:32:45 -08:00
Anthony Ramine
0f244d6948 Mark the page source as loaded only after parsing is done 2017-01-19 16:17:14 +01:00
Ms2ger
2c7c8fd2be Use an ArrayBuffer to implement readAsArrayBuffer. 2017-01-19 15:41:16 +01:00
Ms2ger
2071e41e64 Don't try to get the global of an object while it's being destroyed.
Fixes #15070.
Fixes #15097.
2017-01-19 10:08:48 +01:00
Dexter Haslem
94f0ceb4aa squash: convert less interesting debug! logs to traces 2017-01-18 22:21:41 -07:00
bors-servo
5e888b5504 Auto merge of #15089 - Manishearth:less-vec, r=SimonSapin
Reduce allocator churn when parsing property declaration blocks

fixes #15060

cc @emilio

r? @SimonSapin

<!-- 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/15089)
<!-- Reviewable:end -->
2017-01-18 17:41:05 -08:00
Manish Goregaokar
b5cb401aef Reduce allocator churn when parsing property declaration blocks (fixes #15060) 2017-01-18 16:31:46 -08:00
bors-servo
ba59ee6627 Auto merge of #15053 - emilio:image-width, r=jdm
Return the intrinsic image dimension when the image is not rendered

See individual commits for details.

r? @jdm

<!-- 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/15053)
<!-- Reviewable:end -->
2017-01-18 08:43:19 -08:00
Emilio Cobos Álvarez
728ce16b9d
script: Properly implement the image width and height getter.
Per https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-width:

    The IDL attributes width and height must return the rendered width and
    height of the image, in CSS pixels, if the image is being rendered, and is
    being rendered to a visual medium; or else the density-corrected intrinsic
    width and height of the image, in CSS pixels, if the image has intrinsic
    dimensions and is available but not being rendered to a visual medium; or
    else 0, if the image is not available or does not have intrinsic dimensions.
2017-01-18 16:49:53 +01:00
Emilio Cobos Álvarez
bdd7cb9753
script: Rename bounding_content_box to bounding_content_box_or_zero.
And make bounding_content_box preserve whether the element is rendered.
2017-01-18 16:49:52 +01:00
bors-servo
80c6383140 Auto merge of #15072 - nox:load-fixes, r=jdm
Refactor some things related to script loading

<!-- 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/15072)
<!-- Reviewable:end -->
2017-01-18 02:17:17 -08:00
bors-servo
f010fb58fd Auto merge of #15065 - Manishearth:box-calclop, r=heycam
Use Box<CalcLengthOrPercentage> in specified values to avoid bloating inline sizes

For #15061

CalcLOP is a large struct, and gets used quite often. While #15063 reduces its size a bit,
it will still be much larger than any of the other variants in the `specified::Length*` types,
so it will still bloat sizes, especially for specified values that contain many lengths.

This change boxes it in the length types, so that it just takes one word.

r? @heycam

<!-- 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/15065)
<!-- Reviewable:end -->
2017-01-17 11:49:52 -08:00
Pavel Potocek
0d9b4e858c Fix #14497: WeakMediaQueryListVec assumes its contents are still alive 2017-01-17 18:35:49 +01:00
Manish Goregaokar
f59557d2f2 Box CalcLengthOrPercentage to reduce inline size of PropertyDeclaration(s) 2017-01-17 08:09:54 -08:00
Anthony Ramine
44fd53fd48 Reorder some steps in ServoParser::finish 2017-01-17 14:25:23 +01:00