Draft
Conversation
…ed rejections On modern WebKit (macOS 11+, iOS 14+), postMessage() returns a Promise via WKScriptMessageHandlerWithReply. When a native handler is missing for a feature, the promise rejects. The notify() method (fire-and-forget) was not catching this rejection, causing unhandled promise rejections that interfere with bot-check scripts like Cloudflare Turnstile. This adds a .catch() guard on the promise returned by wkSend() in the WebkitMessagingTransport.notify() method, aligning with the fire-and-forget semantics of notifications. Includes unit tests verifying no unhandled rejections occur when postMessage rejects, resolves, or returns undefined.
Tests cover: - FCP notification is sent when firstContentfulPaint is enabled - Expanded metrics notification is sent after page load - vitalsResult is sent in response to getVitals subscription - No FCP/expanded messages when sub-settings are disabled - Expanded metrics are not sent when only FCP is enabled - Expanded metrics include firstContentfulPaint value - FCP/expanded metrics are not sent in iframes (isBeingFramed guard)
✅ Deploy Preview for content-scope-scripts ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Temporary Branch UpdateThe temporary branch has been updated with the latest changes. Below are the details:
Please use the above install command to update to the latest version. |
Contributor
[Beta] Generated file diffTime updated: Sat, 07 Feb 2026 15:36:16 GMT Android
File has changed Chrome-mv3File has changed FirefoxFile has changed Integration
File has changed Windows
File has changed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Asana Task/Github Issue: https://app.asana.com/1/137249556945/task/1213169335457201
Description
The
performanceMetricsfeature is missing an handler on the Apple side, and the way we currently handle this seems to be causing bot breakage possibly due to one or more of the following:unhandledrejectionevents from isolated content worlds can leak to the page's window, making them visible to page scripts.Proposed fix:
The
notify()method in WebkitMessagingTransport (webkit.js) should catch the promise rejection frompostMessage()to prevent unhandled rejections even when a native handler is missing. Something like catching the return value ofwkSendwith.catch(() => {})for the modern WebKit API path would align with the fire-and-forget semantics of notifications.Testing Steps
Checklist
Please tick all that apply:
Note
Medium Risk
Behavior change in the WebKit messaging transport could mask real native-side failures for notifications, and the added async handling affects all notification sends on modern WebKit.
Overview
Prevents WebKit notification sends from leaking unhandled promise rejections by having
WebkitMessagingTransport.notify()detect a promise return fromwkSend()and attach a no-op.catch().Adds automated coverage: new unit tests validate
notify()doesn’t create process-levelunhandledRejections for rejecting/resolving/syncpostMessagereturns, and new Playwright integration tests plus fixture pages/configs exerciseperformanceMetricsmessage emission (FCP, expanded metrics, vitals subscription) including disabled-settings and iframe cases.Written by Cursor Bugbot for commit b94278a. This will update automatically on new commits. Configure here.