Repository navigation
[Performance Issue] Runaway WebContent memory after closing apps.apple.com with Dark Reader enabled in WKWebExtensionController #15872
Description
Prerequisites
- I searched for any existing report about this bug to avoid opening a duplicate.
- I can reproduce this bug in a new, unmodified web browser profile with Dark Reader installed as the only extension.
- I understand I need to use the Broken Website Report template if this bug I am reporting occurs on a single website.
Bug Description
Bug description
When the Dark Reader Safari Web Extension is loaded in a third-party macOS browser through the public WKWebExtensionController API, repeatedly opening an Apple App Store page and immediately closing its tab can leave the tab's WebContent process running indefinitely.
The closed process continues allocating memory until it becomes unresponsive. Disabling only Dark Reader, while leaving everything else unchanged, completely prevents the issue.
This may ultimately be a WebKit bug triggered by Dark Reader, but I am reporting it here because Dark Reader is the isolated trigger.
Website Address
https://apps.apple.com/cn/iphone/today
Steps To Reproduce
- Enable Dark Reader in a macOS browser using
WKWebExtensionController. - Open a page on X (
https://x.com/i/historyin my reproduction). - Click a link that opens:
https://apps.apple.com/cn/iphone/today - As soon as the Apple page starts rendering, close the new tab.
- Repeat this several times.
- Observe the closed page's WebContent process in Activity Monitor.
Expected Behavior
After the tab is closed, Dark Reader should stop processing the document and the WebContent process should stop allocating memory and release its resources.
Actual Behavior
The tab and WKWebView are closed and released, but the WebContent process remains alive and continuously allocates memory.
In a controlled reproduction:
- WebContent process started at
15:46:52. - The tab was closed at
15:46:55. - WebKit reported
pageCount=0. - Three seconds later WebKit reported
didBecomeUnresponsive. - RSS reached approximately 2.16 GB after 40 seconds.
- Physical footprint reached 5.3 GB after approximately 64 seconds.
- An earlier repeated reproduction reached 39.82 GB.
- The process eventually had to be killed with
SIGKILL.
The host performs all normal cleanup:
- Calls
WKWebExtensionController.didCloseTab - Calls
pauseAllMediaPlayback - Calls
stopLoading - Clears the navigation and UI delegates
- Removes the
WKWebViewfrom its superview - Releases all strong references to the
WKWebView
WebKit confirms that the page itself has been removed:
WebPageProxy::close
WebProcessProxy::removeWebPage
pageCount=0
m_shutdownPreventingScopeCounter=1
WebProcessProxy::didBecomeUnresponsive
Isolation results
Dark Reader enabled: reproducible.
Dark Reader disabled: no runaway process or memory growth after repeating the same steps.
All other browser settings and extensions remained unchanged.
Disabling ManagedMediaSource did not affect the problem.
Explicitly stopping media playback during tab cleanup did not affect the problem.
Process sample
The WebContent main thread was stuck in a deeply repeating JavaScriptCore JIT call chain containing:
operationStringProtoFuncReplaceRegExpString
JSC::RegExp::match
JSC::Yarr::interpret
JSC::Yarr::Interpreter::matchDisjunction
The same sample repeatedly contains calls to:
WebCore::jsCSSStyleDeclarationPrototypeFunction_removeProperty
WebCore::jsLocation_origin
Unified WebKit logging also recorded dom.openOrClosedShadowRoot() during Dark Reader content-script initialization shortly before the runaway execution began.
These operations correspond to functionality present in Dark Reader's global inject/index.js content script, although the native sample cannot directly recover JavaScript function names from the JIT frames.
### Screenshots
<img width="957" height="72" alt="Image" src="https://github.com/user-attachments/assets/76cd822e-e7e9-4423-b12c-dbae7ecd8d01" />
[menubro-webcontent-97093.sample.zip](https://github.com/user-attachments/files/31060240/menubro-webcontent-97093.sample.zip)
### Operating System
macOS
### Web Browser name and version
safari Version 26.5.2 (21624.2.5.11.8)
### Dark Reader version
4.9.125
### Additional Context
_No response_
Activity
Myshor commentedon Aug 16, 2026
You are using an outdated version (4.9.125 vs current 4.9.129). Update and retest.
Also note that for native Safari, the official build is completely separate (version 1.5.9 from the Mac App Store) => https://apps.apple.com/pl/app/dark-reader-for-safari/id1438243180