<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>226440</bug_id>
          
          <creation_ts>2021-05-30 16:59:22 -0700</creation_ts>
          <short_desc>Blob url downloads fail when triggered from webextension</short_desc>
          <delta_ts>2024-09-06 12:17:42 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>Safari 14</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 11</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=216918</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Victor">victorhlin</reporter>
          <assigned_to name="pascoe@apple.com">pascoe</assigned_to>
          <cc>achristensen</cc>
    
    <cc>karlcow</cc>
    
    <cc>pascoe</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1765271</commentid>
    <comment_count>0</comment_count>
    <who name="Victor">victorhlin</who>
    <bug_when>2021-05-30 16:59:22 -0700</bug_when>
    <thetext>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([&apos;content&apos;], { &quot;type&quot;: &quot;text/plain&quot; });
        let a = document.getElementById(&apos;savelink&apos;); // tab html contains &quot;&lt;a id=&quot;savelink&quot; download=&quot;download.txt&quot;&gt;&lt;/a&gt;&quot;
        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=&quot;_blank&quot;), https://bugs.webkit.org/show_bug.cgi?id=211234 (bugs with immediately revoked object urls) ,  The presence of the `target` attribute doesn&apos;t seem to matter, and it seems like whatever was fixed in the latter bug doesn&apos;t apply to this extension tab case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1767259</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-06-06 17:00:22 -0700</bug_when>
    <thetext>&lt;rdar://problem/78929424&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057946</commentid>
    <comment_count>2</comment_count>
    <who name="pascoe@apple.com">pascoe</who>
    <bug_when>2024-09-05 10:04:16 -0700</bug_when>
    <thetext>https://github.com/WebKit/WebKit/pull/33167/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057963</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-09-05 10:36:02 -0700</bug_when>
    <thetext>Committed 283220@main (61868ae02c5f): &lt;https://commits.webkit.org/283220@main&gt;

Reviewed commits have been landed. Closing PR #33167 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058258</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-09-06 12:17:42 -0700</bug_when>
    <thetext>Committed 280938.310@safari-7619-branch (eb5a1e97b064): &lt;https://commits.webkit.org/280938.310@safari-7619-branch&gt;

Reviewed commits have been landed. Closing PR #1699 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>