Closed Bug 1331291 Opened 7 years ago Closed 7 years ago

stylo: URL is incorrectly resolved when it is from a stylesheet loaded via @import

Categories

(Core :: CSS Parsing and Computation, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox53 --- affected
firefox56 --- fixed

People

(Reporter: xidorn, Assigned: xidorn)

References

Details

Attachments

(1 file, 1 obsolete file)

Having the following code in "/test.html":
<!DOCTYPE html>
<style>
@import url(res/test.css);
</style>
<div id="test></div>

and the following code in "/res/test.css":
#test { background-image: url(a.png); }

The background-image of #test is resolved to "/a.png" rather than the expected result "/res/a.png".

(This is a failure revealed by layout/style/test/test_bug397427.html, although that test is meant to check effect of stylesheet redirection.)
This looks baseURI-related. Xidorn is looking at similar stuff in bug 1343964.
Assignee: nobody → xidorn+moz
Priority: -- → P1
I really hope I had left some note to myself... I think I had idea about how this should be fixed before...
Tried to think a bit, I think the idea was that, we need to change Stylesheet::update_from_str. We need to make that method take a UrlExtraData (at url_data) rather than having a reference, and assign url_data to Stylesheet.url_data. We may need to wrap RwLock around url_data for this.
Comment on attachment 8875570 [details]
Bug 1331291 part 1 - Set stylesheet url_data correctly for import rule.

https://reviewboard.mozilla.org/r/146988/#review152226
Attachment #8875570 - Flags: review?(cam) → review+
Comment on attachment 8875571 [details]
Bug 1331291 part 2 - Add test for inserting rule into imported stylesheet.

https://reviewboard.mozilla.org/r/146990/#review152228
Attachment #8875571 - Flags: review?(cam) → review+
Servo side: servo/servo#17286
Attachment #8875570 - Attachment is obsolete: true
Pushed by xquan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1aac46ac7a39
part 2 - Add test for inserting rule into imported stylesheet. r=heycam
Pushed by xquan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/678273a09bc0
followup - Disable the new test added.
Pushed by xquan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/62c2763b9dd6
followup 2 - Fix the test added in the bug and enable it.
https://hg.mozilla.org/mozilla-central/rev/1aac46ac7a39
https://hg.mozilla.org/mozilla-central/rev/678273a09bc0
https://hg.mozilla.org/mozilla-central/rev/62c2763b9dd6
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: