window.open() does not return a valid object since MacOS14.4

I have the following html that is opened in a WKWebView.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Popup Window Test</title>
  </head>
  <body>
    <textarea id="myTextarea" cols="5" rows="1">Empty</textarea>
    <script>
      function openWindow() {
        const popup = window.open(
          "https://www.apple.com/",
          "PopupSample",
          "width=400,height=400,dialog=yes,dependent=yes,scrollbars=yes,location=yes"
        );
        console.log("Popup closed: ", popup.closed);
        document.getElementById("myTextarea").value = popup.closed
          ? "Closed"
          : "Open";
        const timer = setInterval(() => {
          console.log(popup.location.href);
          if (popup.closed) {
            clearInterval(timer);
            console.log("Popup closed: ", popup.closed);
            document.getElementById("myTextarea").value = "Closed";
          }
        }, 1000);
      }
    </script>
    <button onclick="openWindow()">Open Window</button>
  </body>
</html>

When I click the button and open page "https://www.apple.com/" in another WKWebView, the javascript code does not work as expected here, the popup object returned from window.open() does not refer to the valid window object, and the closed property is set to true even the new popup window is still alive.

This is a regression since MacOS14.4 updated, I've reported to apple DTS, but they said it's out of their scope.

Does anyone has any clue about this?

window.open() does not return a valid object since MacOS14.4
 
 
Q