<?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>226509</bug_id>
          
          <creation_ts>2021-06-01 12:59:56 -0700</creation_ts>
          <short_desc>[iOS] Need API to save currently-displayed PDF blob</short_desc>
          <delta_ts>2022-05-09 07:42:28 -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 API</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <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="Ali Juma">ajuma</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>achristensen</cc>
    
    <cc>beidson</cc>
    
    <cc>gambard</cc>
    
    <cc>ggaren</cc>
    
    <cc>thorton</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1765712</commentid>
    <comment_count>0</comment_count>
    <who name="Ali Juma">ajuma</who>
    <bug_when>2021-06-01 12:59:56 -0700</bug_when>
    <thetext>Steps to reproduce:
1. Visit https://alijuma.github.io/test-pdf.html
2. Tap on “Generate”

This produces a PDF blob and then loads this PDF.

In Safari, it’s possible to save this PDF (tap on the sharing icon, and then “Save to Files”).

However, a WKWebView embedder like Chrome cannot implement the same functionality since there’s no API to save the currently-displayed PDF. Since the blob object no longer exists (since we navigated away from it), the WKWebView download API doesn’t work (the load fails with a WebKitBlobResource error).

Also, since the blob link produced in step (2) doesn’t have a ‘download’ attribute, WKNavigationAction’s |shouldPerformDownload| attribute was false on navigation to the PDF, so the embedder would not have preemptively downloaded the file.

Safari seems to be using SPI to save the PDF after it’s displayed.

WKWebView’s |_getMainResourceDataWithCompletionHandler:| SPI does work in this case, so making this public would be one way to address this issue.

I&apos;ve also filed FB9124664 for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1767868</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-06-08 13:00:21 -0700</bug_when>
    <thetext>&lt;rdar://problem/79029343&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1867631</commentid>
    <comment_count>2</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2022-05-09 07:42:28 -0700</bug_when>
    <thetext>rdar://78728238</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>