mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Fix Blob URL origin when scheme is file
This commit is contained in:
parent
a77cc9950f
commit
573610bb4f
1 changed files with 14 additions and 1 deletions
|
@ -117,7 +117,7 @@ impl URL {
|
||||||
pub fn CreateObjectURL(global: GlobalRef, blob: &Blob) -> DOMString {
|
pub fn CreateObjectURL(global: GlobalRef, blob: &Blob) -> DOMString {
|
||||||
/// XXX: Second field is an unicode-serialized Origin, it is a temporary workaround
|
/// 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
|
/// 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() {
|
if blob.IsClosed() {
|
||||||
// Generate a dummy id
|
// Generate a dummy id
|
||||||
|
@ -196,6 +196,19 @@ impl URL {
|
||||||
|
|
||||||
result
|
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 {
|
impl URLMethods for URL {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue