Auto merge of #12691 - heycam:style-sheet-base, r=bholley

Parse style sheets with a real base URL in geckolib.

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

Corresponding Gecko change is [bug 1291207](https://bugzilla.mozilla.org/show_bug.cgi?id=1291207).

r? @bholley

---
<!-- 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
- [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
- [X] 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/12691)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-08-02 12:56:11 -05:00 committed by GitHub
commit 7807895d58
2 changed files with 6 additions and 2 deletions

View file

@ -313,6 +313,8 @@ extern "C" {
pub fn Gecko_ReleaseCalcArbitraryThread(aPtr: *mut Calc);
pub fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8, length: u32,
parsing_mode: SheetParsingMode,
base_bytes: *const u8,
base_length: u32,
base: *mut ThreadSafeURIHolder,
referrer: *mut ThreadSafeURIHolder,
principal:

View file

@ -153,6 +153,8 @@ pub extern "C" fn Servo_DropNodeData(data: *mut ServoNodeData) -> () {
pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8,
length: u32,
mode: SheetParsingMode,
base_bytes: *const u8,
base_length: u32,
base: *mut ThreadSafeURIHolder,
referrer: *mut ThreadSafeURIHolder,
principal: *mut ThreadSafePrincipalHolder)
@ -165,8 +167,8 @@ pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8,
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
};
// FIXME(heycam): Pass in the real base URL.
let url = Url::parse("about:none").unwrap();
let base_str = unsafe { from_utf8_unchecked(slice::from_raw_parts(base_bytes, base_length as usize)) };
let url = Url::parse(base_str).unwrap();
let extra_data = ParserContextExtraData {
base: Some(GeckoArcURI::new(base)),
referrer: Some(GeckoArcURI::new(referrer)),