⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 292902 in webkit


Ignore:
Timestamp:
Apr 15, 2022, 2:37:47 AM (4 years ago)
Author:
graouts@webkit.org
Message:

[model] ASVInlinePreview objects don't get cleared when the model source changes
https://bugs.webkit.org/show_bug.cgi?id=239064
<rdar://problem/90391037>

Reviewed by Dean Jackson.

Source/WebCore:

Expose two new window.internals methods for tests to be able to query the list of UUIDs
currently loaded in the UI process and get the UUID for a given <model> element.

Test: model-element/model-element-inline-preview-deletion-upon-source-change.html

  • Modules/model-element/HTMLModelElement.cpp:

(WebCore::HTMLModelElement::inlinePreviewUUIDForTesting const):

  • Modules/model-element/HTMLModelElement.h:
  • Modules/model-element/HTMLModelElement.idl:
  • Modules/model-element/ModelPlayer.cpp:

(WebCore::ModelPlayer::inlinePreviewUUIDForTesting const):

  • Modules/model-element/ModelPlayer.h:
  • loader/FrameLoaderClient.h:
  • testing/Internals.cpp:

(WebCore::Internals::modelInlinePreviewUUIDs const):
(WebCore::Internals::modelInlinePreviewUUIDForModelElement const):

  • testing/Internals.h:
  • testing/Internals.idl:

Source/WebKit:

We add a new ModelElementDestroyRemotePreview message going from the Web process to the
UI process to notify that an ASVInlinePreview with a given UUID should be cleared. This
message is sent via ~ARKitInlinePreviewModelPlayerMac since any unused resource will
trigger the destruction of such objects.

For testing purposes, we also add a new ModelInlinePreviewUUIDs message going from the
Web process to the UI process to retreive the list of UUIDs for the ASVInlinePreview
objects currently loaded in the UI process. This will allow tests to check whether
the UUID for a given <model> element is correctly removed from the UI process.

  • UIProcess/Cocoa/ModelElementControllerCocoa.mm:

(WebKit::ModelElementController::modelElementDestroyRemotePreview):
(WebKit::ModelElementController::inlinePreviewUUIDs):

  • UIProcess/ModelElementController.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::modelElementDestroyRemotePreview):
(WebKit::WebPageProxy::modelInlinePreviewUUIDs):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h:
  • WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm:

(WebKit::ARKitInlinePreviewModelPlayerMac::~ARKitInlinePreviewModelPlayerMac):
(WebKit::ARKitInlinePreviewModelPlayerMac::inlinePreviewUUIDForTesting const):

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::modelInlinePreviewUUIDs const):

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.h:

LayoutTests:

Add a new test which loads a <model> element with a valid resource, checks its UUID against
those loaded in the UI process, and then removes the <model> source to check that same UUID
is not longer loaded.

This test is currently disabled on OpenSource bots.

  • model-element/model-element-inline-preview-deletion-upon-source-change-expected.txt: Added.
  • model-element/model-element-inline-preview-deletion-upon-source-change.html: Added.
  • platform/ios/TestExpectations:
  • platform/mac/TestExpectations:
Location:
trunk
Files:
2 added
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r292897 r292902  
     12022-04-14  Antoine Quint  <graouts@apple.com>
     2
     3        [model] ASVInlinePreview objects don't get cleared when the model source changes
     4        https://bugs.webkit.org/show_bug.cgi?id=239064
     5        <rdar://problem/90391037>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Add a new test which loads a <model> element with a valid resource, checks its UUID against
     10        those loaded in the UI process, and then removes the <model> source to check that same UUID
     11        is not longer loaded.
     12
     13        This test is currently disabled on OpenSource bots.
     14
     15        * model-element/model-element-inline-preview-deletion-upon-source-change-expected.txt: Added.
     16        * model-element/model-element-inline-preview-deletion-upon-source-change.html: Added.
     17        * platform/ios/TestExpectations:
     18        * platform/mac/TestExpectations:
     19
    1202022-04-14  Matteo Flores  <matteo_flores@apple.com>
    221
  • trunk/LayoutTests/platform/ios/TestExpectations

    r292859 r292902  
    34293429model-element/model-element-camera.html [ Skip ]
    34303430model-element/model-element-interactive-dragging.html [ Skip ]
     3431model-element/model-element-inline-preview-deletion-upon-source-change.html [ Skip ]
    34313432
    34323433# webkit.org/b/201982 These are flaky failures on iOS
  • trunk/LayoutTests/platform/mac/TestExpectations

    r292875 r292902  
    111111model-element/model-element-camera.html [ Skip ]
    112112model-element/model-element-interactive-dragging.html [ Skip ]
     113model-element/model-element-inline-preview-deletion-upon-source-change.html [ Skip ]
    113114
    114115# Accessibility tests for notifications that don't exist or aren't needed on Mac OS X.
  • trunk/Source/WebCore/ChangeLog

    r292901 r292902  
     12022-04-14  Antoine Quint  <graouts@apple.com>
     2
     3        [model] ASVInlinePreview objects don't get cleared when the model source changes
     4        https://bugs.webkit.org/show_bug.cgi?id=239064
     5        <rdar://problem/90391037>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Expose two new window.internals methods for tests to be able to query the list of UUIDs
     10        currently loaded in the UI process and get the UUID for a given <model> element.
     11
     12        Test: model-element/model-element-inline-preview-deletion-upon-source-change.html
     13
     14        * Modules/model-element/HTMLModelElement.cpp:
     15        (WebCore::HTMLModelElement::inlinePreviewUUIDForTesting const):
     16        * Modules/model-element/HTMLModelElement.h:
     17        * Modules/model-element/HTMLModelElement.idl:
     18        * Modules/model-element/ModelPlayer.cpp:
     19        (WebCore::ModelPlayer::inlinePreviewUUIDForTesting const):
     20        * Modules/model-element/ModelPlayer.h:
     21        * loader/FrameLoaderClient.h:
     22        * testing/Internals.cpp:
     23        (WebCore::Internals::modelInlinePreviewUUIDs const):
     24        (WebCore::Internals::modelInlinePreviewUUIDForModelElement const):
     25        * testing/Internals.h:
     26        * testing/Internals.idl:
     27
    1282022-04-14  Martin Robinson  <mrobinson@webkit.org>
    229
  • trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp

    r291395 r292902  
    669669}
    670670
     671#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     672String HTMLModelElement::inlinePreviewUUIDForTesting() const
     673{
     674    if (!m_modelPlayer)
     675        return emptyString();
     676    return m_modelPlayer->inlinePreviewUUIDForTesting();
     677}
     678#endif
     679
    671680}
    672681
  • trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h

    r291245 r292902  
    110110    void sizeMayHaveChanged();
    111111
     112#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     113    WEBCORE_EXPORT String inlinePreviewUUIDForTesting() const;
     114#endif
     115
    112116private:
    113117    HTMLModelElement(const QualifiedName&, Document&);
  • trunk/Source/WebCore/Modules/model-element/HTMLModelElement.idl

    r288728 r292902  
    2727    Conditional=MODEL_ELEMENT,
    2828    EnabledBySetting=ModelElementEnabled,
     29    ExportToWrappedFunction,
    2930    Exposed=Window,
     31    JSGenerateToNativeObject
    3032] interface HTMLModelElement : HTMLElement {
    3133    [URL] readonly attribute USVString currentSrc;
  • trunk/Source/WebCore/Modules/model-element/ModelPlayer.cpp

    r288728 r292902  
    4545}
    4646
     47String ModelPlayer::inlinePreviewUUIDForTesting() const
     48{
     49    return emptyString();
    4750}
     51
     52}
  • trunk/Source/WebCore/Modules/model-element/ModelPlayer.h

    r289495 r292902  
    6666    virtual void isMuted(CompletionHandler<void(std::optional<bool>&&)>&&) = 0;
    6767    virtual void setIsMuted(bool, CompletionHandler<void(bool success)>&&) = 0;
     68    virtual String inlinePreviewUUIDForTesting() const;
    6869#if PLATFORM(COCOA)
    6970    virtual Vector<RetainPtr<id>> accessibilityChildren() = 0;
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r292477 r292902  
    390390
    391391    virtual bool isParentProcessAFullWebBrowser() const { return false; }
     392
     393#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     394    virtual void modelInlinePreviewUUIDs(CompletionHandler<void(Vector<String>)>&&) const { }
     395#endif
    392396};
    393397
  • trunk/Source/WebCore/testing/Internals.cpp

    r292899 r292902  
    364364#endif
    365365
     366#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     367#include "HTMLModelElement.h"
     368#endif
     369
    366370using JSC::CallData;
    367371using JSC::CodeBlock;
     
    67646768}
    67656769
     6770#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     6771
     6772void Internals::modelInlinePreviewUUIDs(ModelInlinePreviewUUIDsPromise&& promise) const
     6773{
     6774    auto* document = contextDocument();
     6775    if (!document) {
     6776        promise.reject(InvalidStateError);
     6777        return;
     6778    }
     6779
     6780    auto* frame = document->frame();
     6781    if (!frame) {
     6782        promise.reject(InvalidStateError);
     6783        return;
     6784    }
     6785
     6786    CompletionHandler<void(Vector<String>&&)> completionHandler = [promise = WTFMove(promise)] (Vector<String> uuids) mutable {
     6787        promise.resolve(uuids);
     6788    };
     6789
     6790    frame->loader().client().modelInlinePreviewUUIDs(WTFMove(completionHandler));
     6791}
     6792
     6793String Internals::modelInlinePreviewUUIDForModelElement(const HTMLModelElement& modelElement) const
     6794{
     6795    return modelElement.inlinePreviewUUIDForTesting();
     6796}
     6797
     6798#endif
     6799
    67666800} // namespace WebCore
  • trunk/Source/WebCore/testing/Internals.h

    r292859 r292902  
    158158#endif
    159159
     160#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     161class HTMLModelElement;
     162#endif
     163
    160164namespace ImageOverlay {
    161165class CroppedImage;
     
    12971301    void overrideModalContainerSearchTermForTesting(const String& term);
    12981302
     1303#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     1304    using ModelInlinePreviewUUIDsPromise = DOMPromiseDeferred<IDLSequence<IDLDOMString>>;
     1305    void modelInlinePreviewUUIDs(ModelInlinePreviewUUIDsPromise&&) const;
     1306    String modelInlinePreviewUUIDForModelElement(const HTMLModelElement&) const;
     1307#endif
     1308
    12991309private:
    13001310    explicit Internals(Document&);
  • trunk/Source/WebCore/testing/Internals.idl

    r292859 r292902  
    11381138
    11391139    undefined overrideModalContainerSearchTermForTesting(DOMString term);
    1140 };
     1140
     1141    [Conditional=ARKIT_INLINE_PREVIEW_MAC] Promise<sequence<DOMString>> modelInlinePreviewUUIDs();
     1142    [Conditional=ARKIT_INLINE_PREVIEW_MAC] DOMString modelInlinePreviewUUIDForModelElement(HTMLModelElement modelElement);
     1143};
  • trunk/Source/WebKit/ChangeLog

    r292898 r292902  
     12022-04-14  Antoine Quint  <graouts@apple.com>
     2
     3        [model] ASVInlinePreview objects don't get cleared when the model source changes
     4        https://bugs.webkit.org/show_bug.cgi?id=239064
     5        <rdar://problem/90391037>
     6
     7        Reviewed by Dean Jackson.
     8
     9        We add a new ModelElementDestroyRemotePreview message going from the Web process to the
     10        UI process to notify that an ASVInlinePreview with a given UUID should be cleared. This
     11        message is sent via ~ARKitInlinePreviewModelPlayerMac since any unused resource will
     12        trigger the destruction of such objects.
     13
     14        For testing purposes, we also add a new ModelInlinePreviewUUIDs message going from the
     15        Web process to the UI process to retreive the list of UUIDs for the ASVInlinePreview
     16        objects currently loaded in the UI process. This will allow tests to check whether
     17        the UUID for a given <model> element is correctly removed from the UI process.
     18
     19        * UIProcess/Cocoa/ModelElementControllerCocoa.mm:
     20        (WebKit::ModelElementController::modelElementDestroyRemotePreview):
     21        (WebKit::ModelElementController::inlinePreviewUUIDs):
     22        * UIProcess/ModelElementController.h:
     23        * UIProcess/WebPageProxy.cpp:
     24        (WebKit::WebPageProxy::modelElementDestroyRemotePreview):
     25        (WebKit::WebPageProxy::modelInlinePreviewUUIDs):
     26        * UIProcess/WebPageProxy.h:
     27        * UIProcess/WebPageProxy.messages.in:
     28        * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h:
     29        * WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm:
     30        (WebKit::ARKitInlinePreviewModelPlayerMac::~ARKitInlinePreviewModelPlayerMac):
     31        (WebKit::ARKitInlinePreviewModelPlayerMac::inlinePreviewUUIDForTesting const):
     32        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     33        (WebKit::WebFrameLoaderClient::modelInlinePreviewUUIDs const):
     34        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     35
    1362022-04-14  Wenson Hsieh  <wenson_hsieh@apple.com>
    237
  • trunk/Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm

    r291393 r292902  
    241241}
    242242
     243void ModelElementController::modelElementDestroyRemotePreview(String uuid)
     244{
     245    m_inlinePreviews.remove(uuid);
     246}
     247
    243248RetainPtr<ASVInlinePreview> ModelElementController::previewForUUID(const String& uuid)
    244249{
     
    300305}
    301306
     307void ModelElementController::inlinePreviewUUIDs(CompletionHandler<void(Vector<String>&&)>&& completionHandler)
     308{
     309    completionHandler(WTF::map(m_inlinePreviews, [](auto& entry) {
     310        return entry.key;
     311    }));
     312}
    302313#endif
    303314
  • trunk/Source/WebKit/UIProcess/ModelElementController.h

    r291393 r292902  
    7676    void modelElementCreateRemotePreview(String, WebCore::FloatSize, CompletionHandler<void(Expected<std::pair<String, uint32_t>, WebCore::ResourceError>)>&&);
    7777    void modelElementLoadRemotePreview(String, URL, CompletionHandler<void(std::optional<WebCore::ResourceError>&&)>&&);
     78    void modelElementDestroyRemotePreview(String);
    7879    void modelElementSizeDidChange(const String& uuid, WebCore::FloatSize, CompletionHandler<void(Expected<MachSendRight, WebCore::ResourceError>)>&&);
    7980    void handleMouseDownForModelElement(const String&, const WebCore::LayoutPoint&, MonotonicTime);
    8081    void handleMouseMoveForModelElement(const String&, const WebCore::LayoutPoint&, MonotonicTime);
    8182    void handleMouseUpForModelElement(const String&, const WebCore::LayoutPoint&, MonotonicTime);
     83    void inlinePreviewUUIDs(CompletionHandler<void(Vector<String>&&)>&&);
    8284#endif
    8385
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r292800 r292902  
    1121911219}
    1122011220
     11221void WebPageProxy::modelElementDestroyRemotePreview(const String& uuid)
     11222{
     11223    modelElementController()->modelElementDestroyRemotePreview(uuid);
     11224}
     11225
    1122111226void WebPageProxy::modelElementSizeDidChange(const String& uuid, WebCore::FloatSize size, CompletionHandler<void(Expected<MachSendRight, WebCore::ResourceError>)>&& completionHandler)
    1122211227{
     
    1123711242{
    1123811243    modelElementController()->handleMouseUpForModelElement(uuid, flippedLocationInElement, timestamp);
     11244}
     11245
     11246void WebPageProxy::modelInlinePreviewUUIDs(CompletionHandler<void(Vector<String>&&)>&& completionHandler)
     11247{
     11248    modelElementController()->inlinePreviewUUIDs(WTFMove(completionHandler));
    1123911249}
    1124011250#endif
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r292898 r292902  
    618618    void modelElementCreateRemotePreview(const String&, const WebCore::FloatSize&, CompletionHandler<void(Expected<std::pair<String, uint32_t>, WebCore::ResourceError>)>&&);
    619619    void modelElementLoadRemotePreview(const String&, const URL&, CompletionHandler<void(std::optional<WebCore::ResourceError>&&)>&&);
     620    void modelElementDestroyRemotePreview(const String&);
    620621    void modelElementSizeDidChange(const String&, WebCore::FloatSize, CompletionHandler<void(Expected<MachSendRight, WebCore::ResourceError>)>&&);
    621622    void handleMouseDownForModelElement(const String&, const WebCore::LayoutPoint&, MonotonicTime);
    622623    void handleMouseMoveForModelElement(const String&, const WebCore::LayoutPoint&, MonotonicTime);
    623624    void handleMouseUpForModelElement(const String&, const WebCore::LayoutPoint&, MonotonicTime);
     625    void modelInlinePreviewUUIDs(CompletionHandler<void(Vector<String>&&)>&&);
    624626#endif
    625627
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r292812 r292902  
    598598    ModelElementCreateRemotePreview(String uuid, WebCore::FloatSize size) -> (Expected<std::pair<String, uint32_t>, WebCore::ResourceError> result)
    599599    ModelElementLoadRemotePreview(String uuid, URL url) -> (std::optional<WebCore::ResourceError> error)
     600    ModelElementDestroyRemotePreview(String uuid)
    600601    ModelElementSizeDidChange(String uuid, WebCore::FloatSize size) -> (Expected<MachSendRight, WebCore::ResourceError> result)
    601602    HandleMouseDownForModelElement(String uuid, WebCore::LayoutPoint flippedLocationInElement, MonotonicTime timestamp)
    602603    HandleMouseMoveForModelElement(String uuid, WebCore::LayoutPoint flippedLocationInElement, MonotonicTime timestamp)
    603604    HandleMouseUpForModelElement(String uuid, WebCore::LayoutPoint flippedLocationInElement, MonotonicTime timestamp)
     605    ModelInlinePreviewUUIDs() -> (Vector<String> uuids)
    604606#endif
    605607#if ENABLE(ARKIT_INLINE_PREVIEW)
  • trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.h

    r291393 r292902  
    5959    void handleMouseMove(const WebCore::LayoutPoint&, MonotonicTime) override;
    6060    void handleMouseUp(const WebCore::LayoutPoint&, MonotonicTime) override;
     61    String inlinePreviewUUIDForTesting() const override;
    6162
    6263    void createFile(WebCore::Model&);
  • trunk/Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm

    r291842 r292902  
    5656ARKitInlinePreviewModelPlayerMac::~ARKitInlinePreviewModelPlayerMac()
    5757{
     58    if (m_inlinePreview) {
     59        if (auto* page = this->page())
     60            page->send(Messages::WebPageProxy::ModelElementDestroyRemotePreview([m_inlinePreview uuid].UUIDString));
     61    }
    5862    clearFile();
    5963}
     
    296300}
    297301
     302String ARKitInlinePreviewModelPlayerMac::inlinePreviewUUIDForTesting() const
     303{
     304    if (!m_inlinePreview)
     305        return emptyString();
     306    return [m_inlinePreview uuid].UUIDString;
     307}
     308
    298309}
    299310
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r292477 r292902  
    20152015}
    20162016
     2017#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     2018void WebFrameLoaderClient::modelInlinePreviewUUIDs(CompletionHandler<void(Vector<String>)>&& completionHandler) const
     2019{
     2020    auto* webPage = m_frame->page();
     2021    if (!webPage) {
     2022        completionHandler({ });
     2023        return;
     2024    }
     2025
     2026    webPage->sendWithAsyncReply(Messages::WebPageProxy::ModelInlinePreviewUUIDs(), WTFMove(completionHandler));
     2027}
     2028#endif
     2029
    20172030} // namespace WebKit
    20182031
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

    r292477 r292902  
    297297
    298298    bool isParentProcessAFullWebBrowser() const final;
     299
     300#if ENABLE(ARKIT_INLINE_PREVIEW_MAC)
     301    void modelInlinePreviewUUIDs(CompletionHandler<void(Vector<String>)>&&) const final;
     302#endif
    299303};
    300304
Note: See TracChangeset for help on using the changeset viewer.