[webkit-changes] [WebKit/WebKit] babc4f: Merge 255496 at main - [WK2] constexpr-ify IPC encodi...

Sihui noreply at github.com
Fri Oct 14 05:52:35 PDT 2022


  Branch: refs/heads/webkitglib/2.38
  Home:   https://github.com/WebKit/WebKit
  Commit: babc4fead524d13368f614946044508534bd5103
      https://github.com/WebKit/WebKit/commit/babc4fead524d13368f614946044508534bd5103
  Author: Žan Doberšek <zan at falconsigh.net>
  Date:   2022-10-14 (Fri, 14 Oct 2022)

  Changed paths:
    M Source/WebKit/Platform/IPC/ArgumentCoders.h

  Log Message:
  -----------
  Merge 255496 at main - [WK2] constexpr-ify IPC encoding, decoding of std::tuple<> objects
https://bugs.webkit.org/show_bug.cgi?id=246149

Reviewed by Kimmo Kinnunen.

Simplify the ArgumentCoder<std::tuple<>> specialization, removing helper structs
and leaning into constexpr for a finer implementation.

The encoding remains the same, just the helper struct's methods inlined into the
ArgumentCoder specialization.

The decoding methods are reworked to use constexpr to make compile-time codepaths.
For each desired element, decoding is done into std::optional<> values that are
then passed through tuples of rvalue references into recursive calls, with the
index sequence adjusted each time to address the next element. Once all elements
are successfully decoded, the final tuple is constructed, with the decoded objects
all moved into that tuple. If decoding was unsuccessful at any point, a nullopt
value is returned immediately, as before.

This avoids concatenating tuples that was occurring for each decoded element, and
was ending up moving each contained element into the concatenation result for each
such concatenation.

* Source/WebKit/Platform/IPC/ArgumentCoders.h:
(IPC::TupleEncoder::encode): Deleted.
(IPC::TupleDecoder<>::decode): Deleted.

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

(cherry picked from commit b807bfd9ce0a83f31884a9b093d37a127cca7d5a)


  Commit: f4a67f5bbaca01e1ab78ef09348aae1f6df51302
      https://github.com/WebKit/WebKit/commit/f4a67f5bbaca01e1ab78ef09348aae1f6df51302
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2022-10-14 (Fri, 14 Oct 2022)

  Changed paths:
    M LayoutTests/editing/execCommand/show-modal-dialog-during-execCommand-expected.txt
    M LayoutTests/fast/animation/request-animation-frame-during-modal-expected.txt
    M LayoutTests/fast/dom/Window/delete-operations-expected.txt
    M LayoutTests/fast/dom/Window/forbid-showModalDialog-expected.txt
    M LayoutTests/fast/dom/Window/open-window-min-size-expected.txt
    M LayoutTests/fast/dom/Window/showModalDialog-mandatory-parameter-expected.txt
    M LayoutTests/fast/dom/Window/window-function-frame-getter-precedence-expected.txt
    M LayoutTests/fast/dom/Window/window-function-name-getter-precedence-expected.txt
    M LayoutTests/fast/dom/Window/window-lookup-precedence-expected.txt
    M LayoutTests/fast/dom/null-page-show-modal-dialog-crash-expected.txt
    M LayoutTests/fast/dom/wrapper-identity-expected.txt
    M LayoutTests/http/tests/cookies/document-cookie-after-showModalDialog-expected.txt
    M LayoutTests/http/tests/security/cross-frame-access-call-expected.txt
    M LayoutTests/http/tests/security/cross-frame-access-put-expected.txt
    M LayoutTests/http/tests/security/cross-origin-modal-dialog-base-expected.txt
    M LayoutTests/http/tests/security/navigate-when-restoring-cached-page-expected.txt
    M LayoutTests/http/tests/security/showModalDialog-sync-cross-origin-page-load2-expected.txt
    M LayoutTests/js/dom/function-length-expected.txt
    M LayoutTests/js/dom/global-function-resolve-expected.txt
    M LayoutTests/platform/gtk/fast/dom/Window/window-lookup-precedence-expected.txt
    M LayoutTests/platform/mac-wk1/fast/events/beforeunload-showModalDialog-expected.txt
    M LayoutTests/platform/mac-wk1/fast/events/pagehide-showModalDialog-expected.txt
    M LayoutTests/platform/mac-wk1/fast/events/unload-showModalDialog-expected.txt
    M LayoutTests/platform/mac-wk2/fast/dom/Window/window-lookup-precedence-expected.txt
    M Source/WebCore/bindings/js/JSDOMWindowBase.cpp
    M Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/Quirks.h

  Log Message:
  -----------
  Merge 255521 at main - Regression(252759 at main) Unable to log into pandora.com
https://bugs.webkit.org/show_bug.cgi?id=246430
rdar://100243111

Reviewed by Geoffrey Garen and Ryosuke Niwa.

We're unable to log into pandora.com since un-exposing window.showModalDialog()
in 252759 at main. Pandora does not actually seem to call showModalDialog() but
they are calling its getter on the Window object. It is unclear why this is
causing log in to fail since there is no JS error (and other browsers don't
expose showModalDialog either).

To resolve the issue for now, I am adding a quirk to re-expose showModalDialog
on pandora.com. However, since they're not calling it, I am merely using
`undefined` as value for the property.

* Source/WebCore/bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::finishCreation):
* Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSC_DEFINE_CUSTOM_GETTER):
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::shouldExposeShowModalDialog const):
* Source/WebCore/page/Quirks.h:

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

(cherry picked from commit 93d276254db4805331fa1eb9465f70d6d1b43c33)


  Commit: 236b0b56aa6e0421242eb39663aade1a3a24092d
      https://github.com/WebKit/WebKit/commit/236b0b56aa6e0421242eb39663aade1a3a24092d
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2022-10-14 (Fri, 14 Oct 2022)

  Changed paths:
    M Source/WebKit/NetworkProcess/NetworkProcess.cpp
    M Source/WebKit/NetworkProcess/NetworkProcess.h
    M Source/WebKit/NetworkProcess/NetworkSession.cpp
    M Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp
    M Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h

  Log Message:
  -----------
  Merge 255492 at main - NetworkStorageManager can be destroyed on wrong thread
https://bugs.webkit.org/show_bug.cgi?id=246375
rdar://101056611

Reviewed by Chris Dumez.

As Kimmo pointed out in bug 245869, NetworkStorageManager can be destroyed on the wrong thread. Here is an example of
the issue:
1. (MainThread) NetworkSession::invalidateAndCancel() is called: NetworkStorageManager::close dispatches a close task to
WorkQueue
2. (MainThread) NetworkProcess::didClose is called: NetworkStorageManager::syncLocalStorage dispatches a task to
WorkQueue
3. (WorkQueue) Task dispatched in step 1 finishes, and a task is dispatched to main thread to release reference of
NetworkStorageManager
4. (MainThread) Main thread task dispatched in step 3 finishes
5. (WorkQueue) Task dispatched in step 2 finishes, and release the last reference of NetworkStorageManager =>
NetworkStorageManager gets destroyed on the wrong thead

The direct cause is syncLocalStorage does not hold strong reference of NetworkStorageManager until completionHandler is
called -- it releases the reference when tasks finishes on background thread. We may fix this by making syncLocalStorage
hold the reference longer, but that's not intuitive, because close() should be the last operation before
NetworkStorageManager gets destroyed. If NetworkStorageManager is closing (close() is called but the tasks have not
finished), we don't need to call syncLocalStorage on it; we just need to wait for the tasks to finish.

To fix this, now we transfer the reference from NetworkSession to NetworkProcess when session is removed and
NetworkStorageManager is closing. This makes sure NetworkProcess has access to all NetworkStorageManagers.
NetworkProcess::didClose only invokes syncLocalStorage on active NetworkStorageManagers, and network process would wait
for closing NetworkStorageManagers to finish before stopping runloop.

* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::stopRunLoopIfNecessary):
(WebKit::NetworkProcess::didClose):
(WebKit::NetworkProcess::destroySession):
* Source/WebKit/NetworkProcess/NetworkProcess.h:
* Source/WebKit/NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::invalidateAndCancel):
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::NetworkStorageManager):
(WebKit::NetworkStorageManager::~NetworkStorageManager):
(WebKit::NetworkStorageManager::close):
(WebKit::NetworkStorageManager::clearStorageForTesting):
(WebKit::NetworkStorageManager::clearStorageForWebPage):
(WebKit::NetworkStorageManager::didIncreaseQuota):
(WebKit::NetworkStorageManager::handleLowMemoryWarning):
(WebKit::NetworkStorageManager::syncLocalStorage):
(WebKit::NetworkStorageManager::registerTemporaryBlobFilePaths):
(WebKit::NetworkStorageManager::requestSpace):
(WebKit::NetworkStorageManager::setBackupExclusionPeriodForTesting):
(WebKit::allNetworkStorageManagers): Deleted.
(WebKit::NetworkStorageManager::forEach): Deleted.
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h:

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

(cherry picked from commit 70536044af3a29b21961944725e332001d67e9ca)


Compare: https://github.com/WebKit/WebKit/compare/4bb4bb03fe64...236b0b56aa6e


More information about the webkit-changes mailing list