Skip to content

Implement Blob URLs #10539

Closed
Closed

Description

@Ms2ger

This is not an easy bug.

This will need integration with the URL parser.

Activity

  1. jdm commented on Apr 12, 2016

    @jdm
    Member

    Please note, this is part of a GSoC project and anyone who wants to work on this should talk to me before doing anything.

  2. bpowers commented on Apr 23, 2016

    @bpowers

    hi @jdm, did this end up as part of an accepted GSoC project?

  3. jdm commented on Apr 23, 2016

    @jdm
    Member

    It did!

  4. izgzhen commented on May 24, 2016

    @izgzhen
    Contributor
  5. added
    C-assigned
    on May 24, 2016
  6. izgzhen commented on May 26, 2016

    @izgzhen
    Contributor

    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.

  7. Manishearth commented on May 26, 2016

    @Manishearth
    Member

    somehow intercept the

    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.

  8. izgzhen commented on May 27, 2016

    @izgzhen
    Contributor

    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:

    1. Where to put Blob URL Store? Currently I prefer to manage it under CoreResourceManager, and accessible through message interface from script thread.
    2. 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.
    3. 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.

  9. jdm commented on May 27, 2016

    @jdm
    Member

    I think @Manishearth meant switching on the scheme in resource_thread.rs, not http_loader.rs.

  10. Manishearth commented on May 27, 2016

    @Manishearth
    Member

    Yeah, basically.

    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.

  11. Manishearth commented on May 27, 2016

    @Manishearth
    Member

    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.

  12. Manishearth commented on May 27, 2016

    @Manishearth
    Member

    We should really start using typed origins everywhere

  13. izgzhen commented on May 27, 2016

    @izgzhen
    Contributor

    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)

  14. Manishearth commented on May 27, 2016

    @Manishearth
    Member

    the same-origin check is already inside Origin 😄

  15. 8 remaining items

  16. added 9 commits that reference this issue on Jun 3, 2016
  17. added 5 commits that reference this issue on Jul 15, 2016
    a7ec87c
    c961e71
    4cc4bc3
    db547d0
    0e5893d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-networkC-assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions