Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement Blob URLs #10539
Implement Blob URLs #10539
Comments
|
Please note, this is part of a GSoC project and anyone who wants to work on this should talk to me before doing anything. |
|
hi @jdm, did this end up as part of an accepted GSoC project? |
|
It did! |
|
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:
|
|
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 I am proposing to handle |
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. |
|
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:
And finally the |
|
I think @Manishearth meant switching on the scheme in |
|
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 |
|
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. |
|
We should really start using typed origins everywhere |
|
I think it would be convenient to implement the same-origin check inside |
|
the same-origin check is already inside Origin |
|
Why are we using strings at all though? You can obtain typed origins from typed URLs, and we have typed URLs. |
No, the communication between script thread and store the |
|
Well, the file thread will handle creation. We only need a revocation message. |
|
Check just by And for the "creation", it is to create a URL from existing |
|
same-origin is structural Well, the existing blob is probably in the file manager thread anyway. But yeah, that depends on your caching strategy, and which in-memory data goes where. The file manager thread will be creating some blob URIs at any rate. |
Add Blob URL store Spec: https://w3c.github.io/FileAPI/#BlobURLStore. I finally decide to put the store under `ScriptThread` and interpret the "global object" as the script thread itself. The new APIs will be used during the page loading (if scheme is `blob`) and `URL.createObjectURL/revokeObjectURL`. Related to #11131. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539 <!-- Either: --> - [x] These changes do not require tests because it is new stub code which needs further integrating PRs. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11534) <!-- Reviewable:end -->
Add Blob URL store Spec: https://w3c.github.io/FileAPI/#BlobURLStore. I finally decide to put the store under `ScriptThread` and interpret the "global object" as the script thread itself. The new APIs will be used during the page loading (if scheme is `blob`) and `URL.createObjectURL/revokeObjectURL`. Related to #11131. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539 <!-- Either: --> - [x] These changes do not require tests because it is new stub code which needs further integrating PRs. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11534) <!-- Reviewable:end -->
Add Blob URL store Spec: https://w3c.github.io/FileAPI/#BlobURLStore. I finally decide to put the store under `ScriptThread` and interpret the "global object" as the script thread itself. The new APIs will be used during the page loading (if scheme is `blob`) and `URL.createObjectURL/revokeObjectURL`. Related to #11131. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539 <!-- Either: --> - [x] These changes do not require tests because it is new stub code which needs further integrating PRs. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11534) <!-- Reviewable:end -->
Add Blob URL store Spec: https://w3c.github.io/FileAPI/#BlobURLStore. I finally decide to put the store under `ScriptThread` and interpret the "global object" as the script thread itself. The new APIs will be used during the page loading (if scheme is `blob`) and `URL.createObjectURL/revokeObjectURL`. Related to #11131. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539 <!-- Either: --> - [x] These changes do not require tests because it is new stub code which needs further integrating PRs. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11534) <!-- Reviewable:end -->
Add blob loader Add a blob loader to implement [Blob URL](https://w3c.github.io/FileAPI/#url). The related interfaces to script thread are also declared. Progressing in parallel with PR #11534. Related to #11131. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539 <!-- Either: --> - [x] These changes do not require tests because not integrated yet. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11536) <!-- Reviewable:end -->
Implement Blob URL's DOM interfaces r? @Manishearth Implement the two functions in `URL` to create/revoke Blob URLs, and related code to approximate our proposed design to make things work together. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539, related to #11131 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11716) <!-- Reviewable:end -->
Implement Blob URL's DOM interfaces r? @Manishearth Implement the two functions in `URL` to create/revoke Blob URLs, and related code to approximate our proposed design to make things work together. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539, related to #11131 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11716) <!-- Reviewable:end -->
Implement Blob URL's DOM interfaces r? @Manishearth Implement the two functions in `URL` to create/revoke Blob URLs, and related code to approximate our proposed design to make things work together. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539, related to #11131 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11716) <!-- Reviewable:end -->
Implement Blob URL's DOM interfaces r? @Manishearth Implement the two functions in `URL` to create/revoke Blob URLs, and related code to approximate our proposed design to make things work together. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539, related to #11131 <!-- Either: --> - [x] There are tests for these changes OR <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11716) <!-- Reviewable:end -->
Implement Blob URL's DOM interfaces r? @Manishearth Implement the two functions in `URL` to create/revoke Blob URLs, and related code to approximate our proposed design to make things work together. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539, related to #11131 <!-- Either: --> - [x] There are tests for these changes OR <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11716) <!-- Reviewable:end -->
Implement Blob URL's DOM interfaces r? @Manishearth Implement the two functions in `URL` to create/revoke Blob URLs, and related code to approximate our proposed design to make things work together. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539, related to #11131 <!-- Either: --> - [x] There are tests for these changes OR <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11716) <!-- Reviewable:end -->
Implement Blob URL's DOM interfaces r? @Manishearth Implement the two functions in `URL` to create/revoke Blob URLs, and related code to approximate our proposed design to make things work together. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #10539, related to #11131 <!-- Either: --> - [x] There are tests for these changes OR <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11716) <!-- Reviewable:end -->
Put Blob URL online This PR connects the resource requests with file manager thread, including: + `script_thread` load request + `image_cache_thread` load request + XHR load request (the responding part code yet not implemented due to unfamiliarity with fetch standard, but the infra is here) One notable change is the introduction of "long-live validity", to handle the case specified in WPT test FileAPI/blob/Blob-XHR-revoke.html. r? @Manishearth <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #10539 - [x] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12440) <!-- Reviewable:end -->
Put Blob URL online This PR connects the resource requests with file manager thread, including: + `script_thread` load request + `image_cache_thread` load request + XHR load request (the responding part code yet not implemented due to unfamiliarity with fetch standard, but the infra is here) One notable change is the introduction of "long-live validity", to handle the case specified in WPT test FileAPI/blob/Blob-XHR-revoke.html. r? @Manishearth <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #10539 - [x] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12440) <!-- Reviewable:end -->
Put Blob URL online This PR connects the resource requests with file manager thread, including: + `script_thread` load request + `image_cache_thread` load request + XHR load request (the responding part code yet not implemented due to unfamiliarity with fetch standard, but the infra is here) One notable change is the introduction of "long-live validity", to handle the case specified in WPT test FileAPI/blob/Blob-XHR-revoke.html. r? @Manishearth <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #10539 - [x] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12440) <!-- Reviewable:end -->
Put Blob URL online This PR connects the resource requests with file manager thread, including: + `script_thread` load request + `image_cache_thread` load request + XHR load request (the responding part code yet not implemented due to unfamiliarity with fetch standard, but the infra is here) One notable change is the introduction of "long-live validity", to handle the case specified in WPT test FileAPI/blob/Blob-XHR-revoke.html. r? @Manishearth <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #10539 - [x] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12440) <!-- Reviewable:end -->
Put Blob URL online This PR connects the resource requests with file manager thread, including: + `script_thread` load request + `image_cache_thread` load request + XHR load request (the responding part code yet not implemented due to unfamiliarity with fetch standard, but the infra is here) One notable change is the introduction of "long-live validity", to handle the case specified in WPT test FileAPI/blob/Blob-XHR-revoke.html. r? @Manishearth <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #10539 - [x] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12440) <!-- Reviewable:end -->
This is not an easy bug.
This will need integration with the URL parser.