aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorZhen Zhang <izgzhen@gmail.com>2016-07-01 21:27:01 +0800
committerZhen Zhang <izgzhen@gmail.com>2016-07-03 23:34:21 +0800
commit573610bb4fbe297d97355907b0839b0c7d50f13d (patch)
treed0e5d5f54bac3d2670517fa85b9be20a40d24ea8 /components/script/dom
parenta77cc9950fb13ccd674a10e46c2327bfa0735dab (diff)
downloadservo-573610bb4fbe297d97355907b0839b0c7d50f13d.tar.gz
servo-573610bb4fbe297d97355907b0839b0c7d50f13d.zip
Fix Blob URL origin when scheme is file
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/url.rs15
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 {