<?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>310393</bug_id>
          
          <creation_ts>2026-03-20 14:25:16 -0700</creation_ts>
          <short_desc>Reduce memory overhead of user scripts and user styles in extensions with many distinct match patterns</short_desc>
          <delta_ts>2026-03-30 21:21:00 -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>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>
          <dependson>310651</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ben Nham">nham</reporter>
          <assigned_to name="Ben Nham">nham</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2192173</commentid>
    <comment_count>0</comment_count>
    <who name="Ben Nham">nham</who>
    <bug_when>2026-03-20 14:25:16 -0700</bug_when>
    <thetext>Extensions can specify user scripts and user styles with many distinct match patterns, either directly via the extension manifest or due to user behavior (e.g. if the user decides to load extensions only selectively on certain origins and that origin list is very long). In the current implementation of web extensions, this can lead to memory explosion because each distinct match pattern carries its own copy of the same exact user script and user style strings (see how `WebExtensionContext::addInjectedContent` loops over each pattern and creates an `API::UserScript` object for each pattern).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2192174</commentid>
    <comment_count>1</comment_count>
    <who name="Ben Nham">nham</who>
    <bug_when>2026-03-20 14:25:49 -0700</bug_when>
    <thetext>rdar://169436824</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2192180</commentid>
    <comment_count>2</comment_count>
    <who name="Ben Nham">nham</who>
    <bug_when>2026-03-20 14:46:03 -0700</bug_when>
    <thetext>https://github.com/WebKit/WebKit/pull/61039</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2192835</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-03-23 11:44:01 -0700</bug_when>
    <thetext>Committed 309775@main (4ed5ff4bf1ee): &lt;https://commits.webkit.org/309775@main&gt;

Reviewed commits have been landed. Closing PR #61039 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2193225</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2026-03-24 13:14:01 -0700</bug_when>
    <thetext>Re-opened since this is blocked by bug 310651</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2194003</commentid>
    <comment_count>5</comment_count>
    <who name="Ben Nham">nham</who>
    <bug_when>2026-03-26 10:41:40 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/61422</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2194203</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-03-26 22:29:31 -0700</bug_when>
    <thetext>Committed 310050@main (2bea83cfe53c): &lt;https://commits.webkit.org/310050@main&gt;

Reviewed commits have been landed. Closing PR #61422 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195412</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-03-30 21:21:00 -0700</bug_when>
    <thetext>Committed 305413.598@safari-7624-branch (8c2beed1f79f): &lt;https://commits.webkit.org/305413.598@safari-7624-branch&gt;

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

    </bug>

</bugzilla>