Changeset 255582 in webkit


Ignore:
Timestamp:
Feb 3, 2020 12:44:49 PM (4 years ago)
Author:
youenn@apple.com
Message:

[ macOS wk2 ] http/tests/media/media-stream/get-display-media-prompt.html is flaky failure
https://bugs.webkit.org/show_bug.cgi?id=206958
<rdar://problem/59003765>

Reviewed by Eric Carlson.

We added a rule to only allow one getDisplayMedia call per gesture.
For that reason, we were storing a pointer to the gesture event and
resetting in case the current gesture event was equal to the stored pointer.
Instead, store a WeakPtr which ensures that if the previous event is destroyed,
the weak pointer will be null and so will not have the same value as the new gesture event.
Covered by existing tests no longer being flaky.

  • Modules/mediastream/MediaDevices.cpp:

(WebCore::MediaDevices::computeUserGesturePriviledge):

  • Modules/mediastream/MediaDevices.h:
  • dom/UserGestureIndicator.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r255581 r255582  
     12020-02-03  youenn fablet  <youenn@apple.com>
     2
     3        [ macOS wk2 ] http/tests/media/media-stream/get-display-media-prompt.html is flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=206958
     5        <rdar://problem/59003765>
     6
     7        Reviewed by Eric Carlson.
     8
     9        We added a rule to only allow one getDisplayMedia call per gesture.
     10        For that reason, we were storing a pointer to the gesture event and
     11        resetting in case the current gesture event was equal to the stored pointer.
     12        Instead, store a WeakPtr which ensures that if the previous event is destroyed,
     13        the weak pointer will be null and so will not have the same value as the new gesture event.
     14        Covered by existing tests no longer being flaky.
     15
     16        * Modules/mediastream/MediaDevices.cpp:
     17        (WebCore::MediaDevices::computeUserGesturePriviledge):
     18        * Modules/mediastream/MediaDevices.h:
     19        * dom/UserGestureIndicator.h:
     20
    1212020-02-03  Eric Carlson  <eric.carlson@apple.com>
    222
  • trunk/Source/WebCore/Modules/mediastream/MediaDevices.cpp

    r252207 r255582  
    110110{
    111111    auto* currentGestureToken = UserGestureIndicator::currentUserGesture().get();
    112     if (m_currentGestureToken != currentGestureToken) {
    113         m_currentGestureToken = currentGestureToken;
     112    if (m_currentGestureToken.get() != currentGestureToken) {
     113        m_currentGestureToken = makeWeakPtr(currentGestureToken);
    114114        m_requestTypesForCurrentGesture = { };
    115115    }
  • trunk/Source/WebCore/Modules/mediastream/MediaDevices.h

    r252046 r255582  
    126126
    127127    OptionSet<GestureAllowedRequest> m_requestTypesForCurrentGesture;
    128     UserGestureToken* m_currentGestureToken { nullptr };
     128    WeakPtr<UserGestureToken> m_currentGestureToken;
    129129};
    130130
  • trunk/Source/WebCore/dom/UserGestureIndicator.h

    r254178 r255582  
    3232#include <wtf/RefCounted.h>
    3333#include <wtf/Vector.h>
     34#include <wtf/WeakPtr.h>
    3435
    3536namespace WebCore {
     
    4546enum class UserGestureType { EscapeKey, Other };
    4647
    47 class UserGestureToken : public RefCounted<UserGestureToken> {
     48class UserGestureToken : public RefCounted<UserGestureToken>, public CanMakeWeakPtr<UserGestureToken> {
    4849public:
    4950    static Ref<UserGestureToken> create(ProcessingUserGestureState state, UserGestureType gestureType)
Note: See TracChangeset for help on using the changeset viewer.