[webkit-changes] [WebKit/WebKit] 02a0c1: Crash sending NaN in a message.

Timothy Hatcher noreply at github.com
Fri Mar 15 20:24:57 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 02a0c1da946c004a88a6c8a0bf0c67360415c017
      https://github.com/WebKit/WebKit/commit/02a0c1da946c004a88a6c8a0bf0c67360415c017
  Author: Timothy Hatcher <timothy at apple.com>
  Date:   2024-03-15 (Fri, 15 Mar 2024)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm
    M Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIRuntime.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIStorage.mm

  Log Message:
  -----------
  Crash sending NaN in a message.
https://webkit.org/b/271089
rdar://124710133

Reviewed by Brian Weinstein.

Make sure to use JSValue, which uses JSC's JSON encoder when sending messages. That
way NaN is treated as null. This matches what Safari was doing before. Also test
that storage.set handles NaN correctly, which was already using JSValue.

* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIRuntimeCocoa.mm:
(WebKit::WebExtensionContext::runtimeSendNativeMessage):
* Source/WebKit/WebProcess/Extensions/API/Cocoa/WebExtensionAPIRuntimeCocoa.mm:
(WebKit::WebExtensionContextProxy::internalDispatchRuntimeMessageEvent):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIRuntime.mm:
(TEST(WKWebExtensionAPIRuntime, SendMessageWithNaNValue)): Added.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIStorage.mm:
(TEST(WKWebExtensionAPIStorage, Get)): Test NaN.

Canonical link: https://commits.webkit.org/276222@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list