Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle properly alternate stylesheet #14911

Merged
merged 3 commits into from Jan 11, 2017

Conversation

@charlesvdv
Copy link
Contributor

charlesvdv commented Jan 7, 2017

Alternate stylesheet are now fetched and then desactivated instead of ignoring them.

I don't know if tests are required to check if the stylesheet is correctly loaded and disabled ?

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14881 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Jan 7, 2017

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @cbrewster (or someone else) soon.

@highfive
Copy link

highfive commented Jan 7, 2017

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/htmllinkelement.rs, components/script/stylesheet_loader.rs
  • @KiChjang: components/script/dom/htmllinkelement.rs, components/script/stylesheet_loader.rs
@highfive
Copy link

highfive commented Jan 7, 2017

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@jdm
Copy link
Member

jdm commented Jan 7, 2017

An automated reference test that verifies that the style present in an alternate stylesheet is not applied would be valuable. It could be created in tests/wpt/mozilla/tests/css.

@@ -147,6 +150,9 @@ impl FetchResponseListener for StylesheetContext {
}
StylesheetContextSource::Import(ref import) => {
let import = import.read();
if elem.downcast::<HTMLLinkElement>().unwrap().is_alternate() {

This comment has been minimized.

@jdm

jdm Jan 7, 2017

Member

I suspect this will break if we have <style>@import 'foo.css'</style>, since the element is a HTMLStyleElement. Try running ./mach test-wpt tests/wpt/mozilla/tests/mozilla/restyle-out-of-document.html to verify this.

This comment has been minimized.

@charlesvdv

charlesvdv Jan 7, 2017

Author Contributor

The test pass.

But it's true that's bizarre. As style also support alternate I should also create a method is_alternate for the Import type ?

This comment has been minimized.

@jdm

jdm Jan 7, 2017

Member

My mistake, that test doesn't include any stylesheets. Try ./mach test-wpt tests/wpt/mozilla/tests/mozilla/stylesheet-adopt-panic.html instead.

My reading of the spec doesn't include any way of specifying a style element as an alternate stylesheet. Where did you see that?

This comment has been minimized.

@charlesvdv

charlesvdv Jan 7, 2017

Author Contributor

Indeed it fails. I will rebase with the change.

And indeed it say alternate flags Unset. So I guess it's not a flag after all.

@jdm jdm added the S-needs-tests label Jan 7, 2017
@charlesvdv
Copy link
Contributor Author

charlesvdv commented Jan 7, 2017

@jdm this test is already done by #10319

@jdm
Copy link
Member

jdm commented Jan 7, 2017

You're right!

@jdm jdm removed the S-needs-tests label Jan 7, 2017
@charlesvdv charlesvdv force-pushed the charlesvdv:alternate-stylesheet branch from b74e41a to d20695f Jan 7, 2017
@jdm
Copy link
Member

jdm commented Jan 8, 2017

@charlesvdv Could you modify the test from #10319 to verify that imported stylesheets from alternate stylesheets do not get applied?

@charlesvdv
Copy link
Contributor Author

charlesvdv commented Jan 8, 2017

@jdm the test pass without code modification.

@cbrewster
Copy link
Member

cbrewster commented Jan 9, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Jan 9, 2017

📌 Commit fc149a8 has been approved by cbrewster

@bors-servo
Copy link
Contributor

bors-servo commented Jan 10, 2017

Testing commit fc149a8 with merge 1e871ea...

bors-servo added a commit that referenced this pull request Jan 10, 2017
Handle properly alternate stylesheet

<!-- Please describe your changes on the following line: -->
Alternate stylesheet are now fetched and then desactivated instead of ignoring them.

I don't know if tests are required to check if the stylesheet is correctly loaded and disabled ?
<!-- 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 #14881 (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/14911)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 10, 2017

💔 Test failed - mac-rel-wpt1

@jdm
Copy link
Member

jdm commented Jan 10, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Jan 10, 2017

Testing commit fc149a8 with merge d5795f7...

@bors-servo
Copy link
Contributor

bors-servo commented Jan 10, 2017

💔 Test failed - linux-rel-wpt

@jdm
Copy link
Member

jdm commented Jan 10, 2017


  ▶ OK [expected TIMEOUT] /subresource-integrity/subresource-integrity.sub.html

  ▶ Unexpected subtest result in /subresource-integrity/subresource-integrity.sub.html:
  └ PASS [expected NOTRUN] Style: Same-origin with incorrect sha256 and sha512 hash, rel='alternate stylesheet' enabled

  ▶ Unexpected subtest result in /subresource-integrity/subresource-integrity.sub.html:
  │ FAIL [expected NOTRUN] Style: Same-origin with correct sha256 and sha512 hash, rel='alternate stylesheet' enabled
  │   → assert_equals: expected "rgb(255, 0, 0)" but got "rgba(0, 0, 0, 0)"
  │ 
  │ SRIStyleTest.prototype.execute/</<@http://web-platform.test:8000/subresource-integrity/subresource-integrity.sub.html:127:21
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1406:20
  └ SRIStyleTest.prototype.execute/<@http://web-platform.test:8000/subresource-integrity/subresource-integrity.sub.html:125:17

Good, we're fixing the test behaviour that made us file #14881!

@charlesvdv
Copy link
Contributor Author

charlesvdv commented Jan 10, 2017

nice !👍 Should I check which test pass and enable them ?

@emilio
Copy link
Member

emilio commented Jan 10, 2017

@Charlesdv: yes :)

@charlesvdv charlesvdv force-pushed the charlesvdv:alternate-stylesheet branch from fc149a8 to f25efc3 Jan 11, 2017
@charlesvdv charlesvdv force-pushed the charlesvdv:alternate-stylesheet branch from f25efc3 to cb9940f Jan 11, 2017
@jdm
Copy link
Member

jdm commented Jan 11, 2017

@bors-servo: r=cbrewster

@bors-servo
Copy link
Contributor

bors-servo commented Jan 11, 2017

📌 Commit cb9940f has been approved by cbrewster

@bors-servo
Copy link
Contributor

bors-servo commented Jan 11, 2017

Testing commit cb9940f with merge cfc74e2...

bors-servo added a commit that referenced this pull request Jan 11, 2017
Handle properly alternate stylesheet

<!-- Please describe your changes on the following line: -->
Alternate stylesheet are now fetched and then desactivated instead of ignoring them.

I don't know if tests are required to check if the stylesheet is correctly loaded and disabled ?
<!-- 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 #14881 (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/14911)
<!-- Reviewable:end -->
@bors-servo bors-servo merged commit cb9940f into servo:master Jan 11, 2017
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
@bors-servo bors-servo mentioned this pull request Jan 11, 2017
3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.