Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Blob URL origin when scheme is file #12195

Merged
merged 1 commit into from Jul 3, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Fix Blob URL origin when scheme is file

  • Loading branch information
izgzhen committed Jul 3, 2016
commit 573610bb4fbe297d97355907b0839b0c7d50f13d
@@ -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 {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.