diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-07-03 11:59:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-03 11:59:26 -0700 |
commit | b832f2b79f8d2fd08b2e610b004591162155ce7c (patch) | |
tree | 0d30af22761bbbc67ae3cca4cf18baaad166fde0 /components/script/dom | |
parent | 194fb3e199922ef0e1ce7943036800ecac5bbfe3 (diff) | |
parent | 573610bb4fbe297d97355907b0839b0c7d50f13d (diff) | |
download | servo-b832f2b79f8d2fd08b2e610b004591162155ce7c.tar.gz servo-b832f2b79f8d2fd08b2e610b004591162155ce7c.zip |
Auto merge of #12195 - izgzhen:fix-url-blob, r=Manishearth
Fix Blob URL origin when scheme is file
<!-- Please describe your changes on the following line: -->
r? @Manishearth
---
<!-- 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
<!-- Either: -->
- [x] These changes do not require tests because it needs future integration
<!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12195)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/url.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/components/script/dom/url.rs b/components/script/dom/url.rs index c6d23bd7d4c..2a41f7c7bae 100644 --- a/components/script/dom/url.rs +++ b/components/script/dom/url.rs @@ -117,7 +117,7 @@ impl URL { pub fn CreateObjectURL(global: GlobalRef, blob: &Blob) -> DOMString { /// XXX: Second field is an unicode-serialized Origin, it is a temporary workaround /// and should not be trusted. See issue https://github.com/servo/servo/issues/11722 - let origin = global.get_url().origin().unicode_serialization(); + let origin = URL::get_blob_origin(&global.get_url()); if blob.IsClosed() { // Generate a dummy id @@ -196,6 +196,19 @@ impl URL { result } + + // XXX: change String to FileOrigin + /* NOTE(izgzhen): WebKit will return things like blob:file:///XXX + while Chrome will return blob:null/XXX + This is not well-specified, and I prefer the WebKit way here + */ + fn get_blob_origin(url: &Url) -> String { + if url.scheme() == "file" { + "file://".to_string() + } else { + url.origin().unicode_serialization() + } + } } impl URLMethods for URL { |