<?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>259637</bug_id>
          
          <creation_ts>2023-07-30 14:41:01 -0700</creation_ts>
          <short_desc>Unable to use OPFS in web extension because of changing origin</short_desc>
          <delta_ts>2023-08-06 14:41:12 -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 Extensions</component>
          <version>Safari 16</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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="OlegWock">olegwock</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1968799</commentid>
    <comment_count>0</comment_count>
    <who name="OlegWock">olegwock</who>
    <bug_when>2023-07-30 14:41:01 -0700</bug_when>
    <thetext>I&apos;m porting my Web Extension to Safari. This extension has a feature where user can upload images which later can be used in the extension. In chrome/firefox I currently use OPFS (https://webkit.org/blog/12257/the-file-system-access-api-with-origin-private-file-system/) to store icons. But because Safari changes extension&apos;s origin on every browser restart, extension can&apos;t utilize OPFS, since it will lost access to it after browser restart (which makes it unusable for persisting data).

This is a bit related to this bug https://bugs.webkit.org/show_bug.cgi?id=244330
In a way that it&apos;s caused by same thing

I assume origin is changed on every run to resist fingerprinting, so making it stable probably isn&apos;t a feasible solution. But can we have some alternative way to use OPFS in web extension? For example, webkit can use extension id (`browser.runtime.id`) as origin to persist OPFS between runs?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1968804</commentid>
    <comment_count>1</comment_count>
    <who name="OlegWock">olegwock</who>
    <bug_when>2023-07-30 15:47:14 -0700</bug_when>
    <thetext>After a bit more searching I found mention from Timothy Hatcher (https://github.com/w3c/webextensions/blob/main/_minutes/2023-05-11-wecg.md) that Safari currently migrates DOM Storage when origin changes. So my initial proposal (to use extension id as origin) doesn&apos;t make much sense anymore, as there is already established solution for this kind of problem (just for other storage types). If we could get same treatment form OPFS that would be awesome</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1969869</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-08-06 14:41:12 -0700</bug_when>
    <thetext>&lt;rdar://problem/113473959&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>