Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1ec49c531096be196d67726d6bb20bf0ce7d3ceb
      
https://github.com/WebKit/WebKit/commit/1ec49c531096be196d67726d6bb20bf0ce7d3ceb
  Author: Kiara Rose <[email protected]>
  Date:   2024-06-14 (Fri, 14 Jun 2024)

  Changed paths:
    M Source/WebKit/Shared/Extensions/WebExtensionFrameIdentifier.h
    M Source/WebKit/Shared/Extensions/WebExtensionTabIdentifier.h
    M Source/WebKit/Shared/Extensions/WebExtensionWindowIdentifier.h
    M 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIWebNavigationCocoa.mm
    M 
Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionDynamicScriptsCocoa.mm

  Log Message:
  -----------
  IPC decoding fails for some extension API message replies
https://bugs.webkit.org/show_bug.cgi?id=275516
rdar://129546020

Reviewed by Timothy Hatcher, Charlie Wolfe and Brian Weinstein.

If we get a nil mainFrame back from `WebKit::WKWebView:_frames:`, we can get
into a bad state where we create an invalid WebExtensionFrameIdentifier and
pass it back to the completion handler, causing the IPC decoding to fail.
To fix this, we should return early if the mainFrame is nil.

In addition, we should update 
WebExtensionFrameIdentifier::toWebExtensionFrameIdentifier()
to return WebExtensionFrameConstants::NoneIdentifier for invalid results to 
prevent an
invalid identifier from being returned.

Testing:
Verified that the WKWebExtensionWebNavigation.GetAllFrames test doesn't crash in
WebKit::WebExtensionContext::didReceiveMessage if an empty main frame object is 
passed
back from WebPageProxy::getAllFrames().

* Source/WebKit/Shared/Extensions/WebExtensionFrameIdentifier.h:
(WebKit::toWebExtensionFrameIdentifier):
* Source/WebKit/Shared/Extensions/WebExtensionTabIdentifier.h:
(WebKit::toWebExtensionTabIdentifier):
* Source/WebKit/Shared/Extensions/WebExtensionWindowIdentifier.h:
(WebKit::toWebExtensionWindowIdentifier):
* 
Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPIWebNavigationCocoa.mm:
(WebKit::WebExtensionContext::webNavigationGetFrame):
(WebKit::WebExtensionContext::webNavigationGetAllFrames):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionDynamicScriptsCocoa.mm:
(WebKit::WebExtensionDynamicScripts::executeScript):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to