You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a problem regarding the implementation: https://w3c.github.io/FileAPI/#requestResponseModel. Here it mentions the model of "request". However, first it sounds a pretty counterintuitive thing to think about how to handle request in a browser; second, as I observed, in current implementation we will somehow intercept the LoadData message in resource_thread.rs's CoreResourceManager::load based on the url scheme and dispatch to some special loaders like about_loader and file_loader.
I am proposing to handle blob: in a similar way, however, we still don't fix the GET method problem (as specified in the spec). That is to say, our model is more like somehow internalize the "request" (which has headers, method as protocol says) into a "load" one.
Well, there's already a switch on a scheme in both http_loader and fetch, we just add an entry to that. It's possible to filter on GET, and I think XHR does this for us anyway.
Where to put Blob URL Store? Currently I prefer to manage it under CoreResourceManager, and accessible through message interface from script thread.
And the above question will determine how loader will communicate with the Blob Store. Since the loader is called directly in core_resource_thread, so we can directly call it with load requests if we choose the example impl above.
URL origin check (currently I unicode_serialization the origin and do a simple comparison, I thought we have already better checking logics for this somewhere but I have not yet try to find it for now).
And finally the GET method problem, I inspected some dispatch on scheme code (in http_loader etc.), but not yet found anything particular interesting. Will track more in coming days.
Where to put Blob URL Store? Currently I prefer to manage it under CoreResourceManager,
CRM seems fine for now. FileManager is also okay with me
and accessible through message interface from script thread.
Does script ever need to directly fetch a blob URI? I thought we'd only have to think about HTTP and XHR loads on blob: uris, and switching in resource_thread will fix that (for XHR, you can add a similar switch in fetch, this is already specced)
so we can directly call it with load requests if we choose the example impl above.
yep. might need to be spawned in a temporary thread or loaded in the file manager thread event loop to avoid the resource task getting clogged, since there's an IPC copy involved.
URL origin check (currently I unicode_serialization the origin and do a simple comparison,
Fetch currently checks if o.ascii_serialization() is equal. XHR does the same with "as_str". I'm not sure why a simple PartialEq check on the url::Origin won't work, though.
I think it would be convenient to implement the same-origin check inside Origin. Also, derive serialize/deserialize for it. (Oddly url doesn't derive it now, and does't use #[derive(Ser...)] feature either)
Activity
jdm commentedon Apr 12, 2016
Please note, this is part of a GSoC project and anyone who wants to work on this should talk to me before doing anything.
bpowers commentedon Apr 23, 2016
hi @jdm, did this end up as part of an accepted GSoC project?
jdm commentedon Apr 23, 2016
It did!
izgzhen commentedon May 24, 2016
Just about to file an issue and found this one :D. Can someone help me to label it as assigned?
And some other related info:
izgzhen commentedon May 26, 2016
I found a problem regarding the implementation: https://w3c.github.io/FileAPI/#requestResponseModel. Here it mentions the model of "request". However, first it sounds a pretty counterintuitive thing to think about how to handle request in a browser; second, as I observed, in current implementation we will somehow intercept the
LoadDatamessage inresource_thread.rs'sCoreResourceManager::loadbased on the url scheme and dispatch to some special loaders likeabout_loaderandfile_loader.I am proposing to handle
blob:in a similar way, however, we still don't fix the GET method problem (as specified in the spec). That is to say, our model is more like somehow internalize the "request" (which has headers, method as protocol says) into a "load" one.Manishearth commentedon May 26, 2016
Well, there's already a switch on a scheme in both http_loader and fetch, we just add an entry to that. It's possible to filter on GET, and I think XHR does this for us anyway.
izgzhen commentedon May 27, 2016
Some experimental code:
https://github.com/izgzhen/servo/tree/blob-loader and https://github.com/izgzhen/servo/tree/url-interface-mock (the latest commit)
Some problems:
CoreResourceManager, and accessible through message interface from script thread.core_resource_thread, so we can directly call it with load requests if we choose the example impl above.unicode_serializationthe origin and do a simple comparison, I thought we have already better checking logics for this somewhere but I have not yet try to find it for now).And finally the
GETmethod problem, I inspected some dispatch onschemecode (inhttp_loaderetc.), but not yet found anything particular interesting. Will track more in coming days.jdm commentedon May 27, 2016
I think @Manishearth meant switching on the scheme in
resource_thread.rs, nothttp_loader.rs.Manishearth commentedon May 27, 2016
Yeah, basically.
CRM seems fine for now. FileManager is also okay with me
Does script ever need to directly fetch a blob URI? I thought we'd only have to think about HTTP and XHR loads on blob: uris, and switching in resource_thread will fix that (for XHR, you can add a similar switch in fetch, this is already specced)
yep. might need to be spawned in a temporary thread or loaded in the file manager thread event loop to avoid the resource task getting clogged, since there's an IPC copy involved.
Fetch currently checks if
o.ascii_serialization()is equal. XHR does the same with "as_str". I'm not sure why a simple PartialEq check on theurl::Originwon't work, though.Manishearth commentedon May 27, 2016
It depends which of these two you need. https://html.spec.whatwg.org/multipage/browsers.html#same-origin . "same origin-domain" is something you'd have to implement manually.
Manishearth commentedon May 27, 2016
We should really start using typed origins everywhere
izgzhen commentedon May 27, 2016
I think it would be convenient to implement the same-origin check inside
Origin. Also, derive serialize/deserialize for it. (Oddlyurldoesn't derive it now, and does't use#[derive(Ser...)]feature either)Manishearth commentedon May 27, 2016
the same-origin check is already inside Origin 😄
8 remaining items
Auto merge of #11534 - izgzhen:add-blob-url-store, r=Manishearth
Auto merge of #11536 - izgzhen:add-blob-loader, r=Manishearth
Auto merge of #11716 - izgzhen:impl-blob-url-dom, r=<try>
Auto merge of #11716 - izgzhen:impl-blob-url-dom, r=Manishearth
Auto merge of #11716 - izgzhen:impl-blob-url-dom, r=Manishearth
Auto merge of #11716 - izgzhen:impl-blob-url-dom, r=Manishearth
Auto merge of #11716 - izgzhen:impl-blob-url-dom, r=<try>
Auto merge of #11716 - izgzhen:impl-blob-url-dom, r=<try>
Auto merge of #11716 - izgzhen:impl-blob-url-dom, r=Manishearth
Auto merge of #12440 - izgzhen:blob-online, r=<try>
Auto merge of #12440 - izgzhen:blob-online, r=<try>
Auto merge of #12440 - izgzhen:blob-online, r=<try>
Auto merge of #12440 - izgzhen:blob-online, r=<try>
Auto merge of #12440 - izgzhen:blob-online, r=Manishearth