<?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>311872</bug_id>
          
          <creation_ts>2026-04-09 15:55:35 -0700</creation_ts>
          <short_desc>`_loadAndDecodeImage:` does not conform to the &quot;fetching an image resource&quot; algorithm</short_desc>
          <delta_ts>2026-04-09 15:55:35 -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>Page Loading</component>
          <version>WebKit Local 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></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Marcos Caceres">marcosc</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>beidson</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2198545</commentid>
    <comment_count>0</comment_count>
    <who name="Marcos Caceres">marcosc</who>
    <bug_when>2026-04-09 15:55:35 -0700</bug_when>
    <thetext>The Image Resource spec (https://w3c.github.io/image-resource/#fetching-an-image-resource) defines a &quot;fetching an image resource&quot; algorithm that requires the fetch request&apos;s Client be set to the context object&apos;s relevant settings object:

  If |request| is `undefined`:
    1. Set |request| to a new Request.
    2. Set request/URL to image&apos;s src.
    3. Set request/Destination to &quot;image&quot;.
    4. Set request/Client to the context object&apos;s relevant settings object.

  Note: Client is required here so the appropriate CSP can be applied.

The Web App Manifest spec (https://github.com/w3c/manifest/pull/1171) adds a normative requirement that user agents MUST fetch manifest image resources using this algorithm.

WebKit&apos;s current implementation of `_loadAndDecodeImage:` routes the request directly to the network process via `NetworkConnectionToWebProcess::loadImageForDecoding` → `NetworkSessionCocoa::loadImageForDecoding`, constructing a bare `NetworkLoadParameters` with only the URL set. This bypasses the document&apos;s client context, meaning:

1. CSP `img-src` directives are not applied to manifest image fetches.
2. Service workers registered for the manifest&apos;s scope cannot intercept the fetch.

The fix should route manifest image resource fetches through the page&apos;s resource loading infrastructure so that the relevant settings object is used as the fetch client, consistent with what Chrome (`DownloadImageInFrame`) and Firefox (`window.fetch()` in content) already do.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>