Bug 226440
Summary: | Blob url downloads fail when triggered from webextension | ||
---|---|---|---|
Product: | WebKit | Reporter: | Victor <victorhlin> |
Component: | WebKit Misc. | Assignee: | pascoe <pascoe> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | achristensen, karlcow, pascoe, timothy, webkit-bug-importer, youennf |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 14 | ||
Hardware: | Mac (Apple Silicon) | ||
OS: | macOS 11 | ||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=216918 |
Victor
Blob url downloads fail when triggered from a webextension tab. The tab is created with `chrome.tabs.create({ url: /wordlist.html })`. wordlist.html embeds a script with the following code to trigger downloads when clicking on a button:
```
let saveBlob = new Blob(['content'], { "type": "text/plain" });
let a = document.getElementById('savelink'); // tab html contains "<a id="savelink" download="download.txt"></a>"
const blobLink = URL.createObjectURL(saveBlob);
a.href = blobLink;
a.click();
```
This opens in the existing tab (replacing its content) and fails with the following safari error:
```
Safari can’t open the page “blob:safari-web-extension://20101d16-cc55-4a3f-a307-a03b6e2df273/07f5a98e-8fbd-409e-9113-58afe3c748c8”.
The error is: “The operation couldn’t be completed. (WebKitBlobResource error 1.)” (WebKitBlobResource:1)
```
I found some related bugs on non-extension pages, e.g https://bugs.webkit.org/show_bug.cgi?id=190351 (usage of target="_blank"), https://bugs.webkit.org/show_bug.cgi?id=211234 (bugs with immediately revoked object urls) , The presence of the `target` attribute doesn't seem to matter, and it seems like whatever was fixed in the latter bug doesn't apply to this extension tab case.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/78929424>
pascoe@apple.com
https://github.com/WebKit/WebKit/pull/33167/
EWS
Committed 283220@main (61868ae02c5f): <https://commits.webkit.org/283220@main>
Reviewed commits have been landed. Closing PR #33167 and removing active labels.
EWS
Committed 280938.310@safari-7619-branch (eb5a1e97b064): <https://commits.webkit.org/280938.310@safari-7619-branch>
Reviewed commits have been landed. Closing PR #1699 and removing active labels.