[webkit-changes] [WebKit/WebKit] 5e785e: Fix flaky WKWebExtensionAPIWebRequest tests

Brian Weinstein noreply at github.com
Mon Mar 11 21:39:28 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5e785e867f363d114dcce1fc32056b63005c163e
      https://github.com/WebKit/WebKit/commit/5e785e867f363d114dcce1fc32056b63005c163e
  Author: Brian Weinstein <bweinstein at apple.com>
  Date:   2024-03-11 (Mon, 11 Mar 2024)

  Changed paths:
    M Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm
    M Source/WebKit/UIProcess/Extensions/WebExtensionContext.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebRequest.mm

  Log Message:
  -----------
  Fix flaky WKWebExtensionAPIWebRequest tests
https://bugs.webkit.org/show_bug.cgi?id=270824
rdar://124401551

Reviewed by Timothy Hatcher.

There were a few cascading issues here.

1) For webRequest, we were trying to create a persistent background page with manifest v3. This is not a supported
configuration, so it was being forced into being non-persistent.

This meant that the background page could sometimes unload, leading to the flakiness described in the bug.

2) After making this change, I discovered that we were attempting to load the background page before it was safe (before
moveLocalStorageIfNeeded was called).

To fix this, add a new variable tracking if it's safe to load the background view. This is set to true in loadBackgroundWebViewDuringLoad,
and checked in loadBackgroundWebViewIfNeeded before attempting to load the background web view.

* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm:
(WebKit::WebExtensionContext::loadBackgroundWebViewDuringLoad):
(WebKit::WebExtensionContext::loadBackgroundWebViewIfNeeded):
(WebKit::WebExtensionContext::loadBackgroundWebView):
* Source/WebKit/UIProcess/Extensions/WebExtensionContext.h:
(WebKit::WebExtensionContext::safeToLoadBackgroundContent const):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebRequest.mm:

Canonical link: https://commits.webkit.org/275955@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