Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ca4dc0387b4055b3743ed35c86a1580673123378
      
https://github.com/WebKit/WebKit/commit/ca4dc0387b4055b3743ed35c86a1580673123378
  Author: Timothy Hatcher <timo...@apple.com>
  Date:   2024-04-04 (Thu, 04 Apr 2024)

  Changed paths:
    M Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.mm
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm

  Log Message:
  -----------
  REGRESSION (277022@main): [ MacOS iOS ] 2X TestWebKitAPI.WKWebExtension are 
constant failures and 1 is a constant crash.
https://webkit.org/b/272177
rdar://problem/125924822

Reviewed by Brian Weinstein.

Only consider an extension updated if it has bundle hashes to compare. When 
running tests,
both lastSeenBundleHash and currentBundleHash will be nil, meaning the 
isEqualToData:
will always be NO, but we set the inverse in extensionDidChange.

Also the crash in WKWebExtensionDataRecord.GetDataRecordsForMultipleContexts 
was due to the
extension thinking it was updated, so the registered content script database 
was being deleted.
In this case the extension folder was freshly created before the load, so it 
was empty. When
a database gets deleted, the empty containing folder is also deleted. This 
causes an error when
we go to save the State.plist file in the folder that should exist. That in 
turn caused the
record lookup to only find one of two extensions, leading to an exception in 
the array access.

Stop having the database code delete the empty parent directory, since that is 
a holdover from Safari
storage structure where there wasn't a State.plist file, and only database 
storage was inside the
extension directory.

* Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteStore.mm:
(-[_WKWebExtensionSQLiteStore _deleteDatabase]): Remove call to 
_deleteExtensionStorageFolderIfEmpty.
(-[_WKWebExtensionSQLiteStore _deleteExtensionStorageFolderIfEmpty]): Deleted.
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::determineInstallReasonDuringLoad): Check 
lastSeenBundleHash and currentBundleHash
for nil before calling isEqualToData:.

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



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

Reply via email to