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

Changeset 293707 in webkit


Ignore:
Timestamp:
May 2, 2022, 6:32:11 PM (4 years ago)
Author:
gnavamarino@apple.com
Message:

Crash in WebKit::ModelElementController::modelElementCreateRemotePreview
​https://bugs.webkit.org/show_bug.cgi?id=239985

Reviewed by Dean Jackson.

Add a check before using m_modelElementController, as it's not guaranteed
to be initialized in the constructor, and can be invalidated in WebPageProxy::resetState.

Test: fast/html/model-element-controller-crash.html

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::modelElementGetCamera):
(WebKit::WebPageProxy::modelElementSetCamera):
(WebKit::WebPageProxy::modelElementIsPlayingAnimation):
(WebKit::WebPageProxy::modelElementSetAnimationIsPlaying):
(WebKit::WebPageProxy::modelElementIsLoopingAnimation):
(WebKit::WebPageProxy::modelElementSetIsLoopingAnimation):
(WebKit::WebPageProxy::modelElementAnimationDuration):
(WebKit::WebPageProxy::modelElementAnimationCurrentTime):
(WebKit::WebPageProxy::modelElementSetAnimationCurrentTime):
(WebKit::WebPageProxy::modelElementHasAudio):
(WebKit::WebPageProxy::modelElementIsMuted):
(WebKit::WebPageProxy::modelElementSetIsMuted):
(WebKit::WebPageProxy::takeModelElementFullscreen):
(WebKit::WebPageProxy::modelElementSetInteractionEnabled):
(WebKit::WebPageProxy::modelElementCreateRemotePreview):
(WebKit::WebPageProxy::modelElementLoadRemotePreview):
(WebKit::WebPageProxy::modelElementDestroyRemotePreview):
(WebKit::WebPageProxy::modelElementSizeDidChange):
(WebKit::WebPageProxy::handleMouseDownForModelElement):
(WebKit::WebPageProxy::handleMouseMoveForModelElement):
(WebKit::WebPageProxy::handleMouseUpForModelElement):
(WebKit::WebPageProxy::modelInlinePreviewUUIDs):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r293697 r293707  
     12022-05-02  Gabriel Nava Marino  <gnavamarino@apple.com>
     2
     3        Crash in WebKit::ModelElementController::modelElementCreateRemotePreview
     4        https://bugs.webkit.org/show_bug.cgi?id=239985
     5
     6        Reviewed by Dean Jackson.
     7
     8        Add a check before using m_modelElementController, as it's not guaranteed
     9        to be initialized in the constructor, and can be invalidated in WebPageProxy::resetState.
     10
     11        Test: fast/html/model-element-controller-crash.html
     12
     13        * UIProcess/WebPageProxy.cpp:
     14        (WebKit::WebPageProxy::modelElementGetCamera):
     15        (WebKit::WebPageProxy::modelElementSetCamera):
     16        (WebKit::WebPageProxy::modelElementIsPlayingAnimation):
     17        (WebKit::WebPageProxy::modelElementSetAnimationIsPlaying):
     18        (WebKit::WebPageProxy::modelElementIsLoopingAnimation):
     19        (WebKit::WebPageProxy::modelElementSetIsLoopingAnimation):
     20        (WebKit::WebPageProxy::modelElementAnimationDuration):
     21        (WebKit::WebPageProxy::modelElementAnimationCurrentTime):
     22        (WebKit::WebPageProxy::modelElementSetAnimationCurrentTime):
     23        (WebKit::WebPageProxy::modelElementHasAudio):
     24        (WebKit::WebPageProxy::modelElementIsMuted):
     25        (WebKit::WebPageProxy::modelElementSetIsMuted):
     26        (WebKit::WebPageProxy::takeModelElementFullscreen):
     27        (WebKit::WebPageProxy::modelElementSetInteractionEnabled):
     28        (WebKit::WebPageProxy::modelElementCreateRemotePreview):
     29        (WebKit::WebPageProxy::modelElementLoadRemotePreview):
     30        (WebKit::WebPageProxy::modelElementDestroyRemotePreview):
     31        (WebKit::WebPageProxy::modelElementSizeDidChange):
     32        (WebKit::WebPageProxy::handleMouseDownForModelElement):
     33        (WebKit::WebPageProxy::handleMouseMoveForModelElement):
     34        (WebKit::WebPageProxy::handleMouseUpForModelElement):
     35        (WebKit::WebPageProxy::modelInlinePreviewUUIDs):
     36
    1372022-05-02  Alex Christensen  <achristensen@webkit.org>
    238
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r293681 r293707  
    1111411114void WebPageProxy::modelElementGetCamera(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<WebCore::HTMLModelElementCamera, ResourceError>)>&& completionHandler)
    1111511115{
    11116     modelElementController()->getCameraForModelElement(modelIdentifier, WTFMove(completionHandler));
     11116    if (m_modelElementController)
     11117        m_modelElementController->getCameraForModelElement(modelIdentifier, WTFMove(completionHandler));
    1111711118}
    1111811119
    1111911120void WebPageProxy::modelElementSetCamera(ModelIdentifier modelIdentifier, WebCore::HTMLModelElementCamera camera, CompletionHandler<void(bool)>&& completionHandler)
    1112011121{
    11121     modelElementController()->setCameraForModelElement(modelIdentifier, camera, WTFMove(completionHandler));
     11122    if (m_modelElementController)
     11123        m_modelElementController->setCameraForModelElement(modelIdentifier, camera, WTFMove(completionHandler));
    1112211124}
    1112311125
    1112411126void WebPageProxy::modelElementIsPlayingAnimation(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, ResourceError>)>&& completionHandler)
    1112511127{
    11126     modelElementController()->isPlayingAnimationForModelElement(modelIdentifier, WTFMove(completionHandler));
     11128    if (m_modelElementController)
     11129        m_modelElementController->isPlayingAnimationForModelElement(modelIdentifier, WTFMove(completionHandler));
    1112711130}
    1112811131
    1112911132void WebPageProxy::modelElementSetAnimationIsPlaying(ModelIdentifier modelIdentifier, bool isPlaying, CompletionHandler<void(bool)>&& completionHandler)
    1113011133{
    11131     modelElementController()->setAnimationIsPlayingForModelElement(modelIdentifier, isPlaying, WTFMove(completionHandler));
     11134    if (m_modelElementController)
     11135        m_modelElementController->setAnimationIsPlayingForModelElement(modelIdentifier, isPlaying, WTFMove(completionHandler));
    1113211136}
    1113311137
    1113411138void WebPageProxy::modelElementIsLoopingAnimation(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, ResourceError>)>&& completionHandler)
    1113511139{
    11136     modelElementController()->isLoopingAnimationForModelElement(modelIdentifier, WTFMove(completionHandler));
     11140    if (m_modelElementController)
     11141        m_modelElementController->isLoopingAnimationForModelElement(modelIdentifier, WTFMove(completionHandler));
    1113711142}
    1113811143
    1113911144void WebPageProxy::modelElementSetIsLoopingAnimation(ModelIdentifier modelIdentifier, bool isLooping, CompletionHandler<void(bool)>&& completionHandler)
    1114011145{
    11141     modelElementController()->setIsLoopingAnimationForModelElement(modelIdentifier, isLooping, WTFMove(completionHandler));
     11146    if (m_modelElementController)
     11147        m_modelElementController->setIsLoopingAnimationForModelElement(modelIdentifier, isLooping, WTFMove(completionHandler));
    1114211148}
    1114311149
    1114411150void WebPageProxy::modelElementAnimationDuration(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<Seconds, WebCore::ResourceError>)>&& completionHandler)
    1114511151{
    11146     modelElementController()->animationDurationForModelElement(modelIdentifier, WTFMove(completionHandler));
     11152    if (m_modelElementController)
     11153        m_modelElementController->animationDurationForModelElement(modelIdentifier, WTFMove(completionHandler));
    1114711154}
    1114811155
    1114911156void WebPageProxy::modelElementAnimationCurrentTime(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<Seconds, WebCore::ResourceError>)>&& completionHandler)
    1115011157{
    11151     modelElementController()->animationCurrentTimeForModelElement(modelIdentifier, WTFMove(completionHandler));
     11158    if (m_modelElementController)
     11159        m_modelElementController->animationCurrentTimeForModelElement(modelIdentifier, WTFMove(completionHandler));
    1115211160}
    1115311161
    1115411162void WebPageProxy::modelElementSetAnimationCurrentTime(ModelIdentifier modelIdentifier, Seconds currentTime, CompletionHandler<void(bool)>&& completionHandler)
    1115511163{
    11156     modelElementController()->setAnimationCurrentTimeForModelElement(modelIdentifier, currentTime, WTFMove(completionHandler));
     11164    if (m_modelElementController)
     11165        m_modelElementController->setAnimationCurrentTimeForModelElement(modelIdentifier, currentTime, WTFMove(completionHandler));
    1115711166}
    1115811167
    1115911168void WebPageProxy::modelElementHasAudio(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, ResourceError>)>&& completionHandler)
    1116011169{
    11161     modelElementController()->hasAudioForModelElement(modelIdentifier, WTFMove(completionHandler));
     11170    if (m_modelElementController)
     11171        m_modelElementController->hasAudioForModelElement(modelIdentifier, WTFMove(completionHandler));
    1116211172}
    1116311173
    1116411174void WebPageProxy::modelElementIsMuted(ModelIdentifier modelIdentifier, CompletionHandler<void(Expected<bool, ResourceError>)>&& completionHandler)
    1116511175{
    11166     modelElementController()->isMutedForModelElement(modelIdentifier, WTFMove(completionHandler));
     11176    if (m_modelElementController)
     11177        m_modelElementController->isMutedForModelElement(modelIdentifier, WTFMove(completionHandler));
    1116711178}
    1116811179
    1116911180void WebPageProxy::modelElementSetIsMuted(ModelIdentifier modelIdentifier, bool isMuted, CompletionHandler<void(bool)>&& completionHandler)
    1117011181{
    11171     modelElementController()->setIsMutedForModelElement(modelIdentifier, isMuted, WTFMove(completionHandler));
     11182    if (m_modelElementController)
     11183        m_modelElementController->setIsMutedForModelElement(modelIdentifier, isMuted, WTFMove(completionHandler));
    1117211184}
    1117311185#endif
    … …  
    1117611188void WebPageProxy::takeModelElementFullscreen(ModelIdentifier modelIdentifier)
    1117711189{
    11178     modelElementController()->takeModelElementFullscreen(modelIdentifier, URL { currentURL() });
     11190    if (m_modelElementController)
     11191        m_modelElementController->takeModelElementFullscreen(modelIdentifier, URL { currentURL() });
    1117911192}
    1118011193
    1118111194void WebPageProxy::modelElementSetInteractionEnabled(ModelIdentifier modelIdentifier, bool isInteractionEnabled)
    1118211195{
    11183     modelElementController()->setInteractionEnabledForModelElement(modelIdentifier, isInteractionEnabled);
     11196    if (m_modelElementController)
     11197        m_modelElementController->setInteractionEnabledForModelElement(modelIdentifier, isInteractionEnabled);
    1118411198}
    1118511199
    … …  
    1119911213void WebPageProxy::modelElementCreateRemotePreview(const String& uuid, const FloatSize& size, CompletionHandler<void(Expected<std::pair<String, uint32_t>, ResourceError>)>&& completionHandler)
    1120011214{
    11201     modelElementController()->modelElementCreateRemotePreview(uuid, size, WTFMove(completionHandler));
     11215    if (m_modelElementController)
     11216        m_modelElementController->modelElementCreateRemotePreview(uuid, size, WTFMove(completionHandler));
    1120211217}
    1120311218
    1120411219void WebPageProxy::modelElementLoadRemotePreview(const String& uuid, const URL& url, CompletionHandler<void(std::optional<WebCore::ResourceError>&&)>&& completionHandler)
    1120511220{
    11206     modelElementController()->modelElementLoadRemotePreview(uuid, url, WTFMove(completionHandler));
     11221    if (m_modelElementController)
     11222        m_modelElementController->modelElementLoadRemotePreview(uuid, url, WTFMove(completionHandler));
    1120711223}
    1120811224
    1120911225void WebPageProxy::modelElementDestroyRemotePreview(const String& uuid)
    1121011226{
    11211     modelElementController()->modelElementDestroyRemotePreview(uuid);
     11227    if (m_modelElementController)
     11228        m_modelElementController->modelElementDestroyRemotePreview(uuid);
    1121211229}
    1121311230
    1121411231void WebPageProxy::modelElementSizeDidChange(const String& uuid, WebCore::FloatSize size, CompletionHandler<void(Expected<MachSendRight, WebCore::ResourceError>)>&& completionHandler)
    1121511232{
    11216     modelElementController()->modelElementSizeDidChange(uuid, size, WTFMove(completionHandler));
     11233    if (m_modelElementController)
     11234        m_modelElementController->modelElementSizeDidChange(uuid, size, WTFMove(completionHandler));
    1121711235}
    1121811236
    1121911237void WebPageProxy::handleMouseDownForModelElement(const String& uuid, const WebCore::LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
    1122011238{
    11221     modelElementController()->handleMouseDownForModelElement(uuid, flippedLocationInElement, timestamp);
     11239    if (m_modelElementController)
     11240        m_modelElementController->handleMouseDownForModelElement(uuid, flippedLocationInElement, timestamp);
    1122211241}
    1122311242
    1122411243void WebPageProxy::handleMouseMoveForModelElement(const String& uuid, const WebCore::LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
    1122511244{
    11226     modelElementController()->handleMouseMoveForModelElement(uuid, flippedLocationInElement, timestamp);
     11245    if (m_modelElementController)
     11246        m_modelElementController->handleMouseMoveForModelElement(uuid, flippedLocationInElement, timestamp);
    1122711247}
    1122811248
    1122911249void WebPageProxy::handleMouseUpForModelElement(const String& uuid, const WebCore::LayoutPoint& flippedLocationInElement, MonotonicTime timestamp)
    1123011250{
    11231     modelElementController()->handleMouseUpForModelElement(uuid, flippedLocationInElement, timestamp);
     11251    if (m_modelElementController)
     11252        m_modelElementController->handleMouseUpForModelElement(uuid, flippedLocationInElement, timestamp);
    1123211253}
    1123311254
    1123411255void WebPageProxy::modelInlinePreviewUUIDs(CompletionHandler<void(Vector<String>&&)>&& completionHandler)
    1123511256{
    11236     modelElementController()->inlinePreviewUUIDs(WTFMove(completionHandler));
     11257    if (m_modelElementController)
     11258        m_modelElementController->inlinePreviewUUIDs(WTFMove(completionHandler));
    1123711259}
    1123811260#endif
Note: See TracChangeset for help on using the changeset viewer.