Closed Bug 1331291 Opened 6 years ago Closed 5 years ago

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


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




Tracking Status
firefox53 --- affected
firefox56 --- fixed


(Reporter: xidorn, Assigned: xidorn)




(1 file, 1 obsolete file)

Having the following code in "/test.html":
<!DOCTYPE html>
@import url(res/test.css);
<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.
Attachment #8875570 - Flags: review?(cam) → review+
Comment on attachment 8875571 [details]
Bug 1331291 part 2 - Add test for inserting rule into imported stylesheet.
Attachment #8875571 - Flags: review?(cam) → review+
Servo side: servo/servo#17286
Attachment #8875570 - Attachment is obsolete: true
Pushed by
part 2 - Add test for inserting rule into imported stylesheet. r=heycam
Pushed by
followup - Disable the new test added.
Pushed by
followup 2 - Fix the test added in the bug and enable it.
Closed: 5 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.