Changeset 281126 in webkit


Ignore:
Timestamp:
Aug 16, 2021 9:32:23 PM (11 months ago)
Author:
Devin Rousso
Message:

Web Share CanShare() should be called after transient activation check
https://bugs.webkit.org/show_bug.cgi?id=229132

Reviewed by Tim Horton.

LayoutTests/imported/w3c:

  • web-platform-tests/web-share/share-consume-activation.https-expected.txt:

Source/WebCore:

Test: web-platform-tests/web-share/share-consume-activation.https.html

  • page/Navigator.cpp:

(WebCore::Navigator::share):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r281125 r281126  
     12021-08-16  Devin Rousso  <drousso@apple.com>
     2
     3        Web Share CanShare() should be called after transient activation check
     4        https://bugs.webkit.org/show_bug.cgi?id=229132
     5
     6        Reviewed by Tim Horton.
     7
     8        * web-platform-tests/web-share/share-consume-activation.https-expected.txt:
     9
    1102021-08-16  Alex Christensen  <achristensen@webkit.org>
    211
  • trunk/LayoutTests/imported/w3c/web-platform-tests/web-share/share-consume-activation.https-expected.txt

    r264564 r281126  
    11
    2 FAIL Calling share consumes user activation promise_rejects_dom: function "function () { throw e }" threw object "TypeError: Type error" that is not a DOMException NotAllowedError: property "code" is equal to undefined, expected 0
     2PASS Calling share consumes user activation
    33
  • trunk/Source/WebCore/ChangeLog

    r281125 r281126  
     12021-08-16  Devin Rousso  <drousso@apple.com>
     2
     3        Web Share CanShare() should be called after transient activation check
     4        https://bugs.webkit.org/show_bug.cgi?id=229132
     5
     6        Reviewed by Tim Horton.
     7
     8        Test: web-platform-tests/web-share/share-consume-activation.https.html
     9
     10        * page/Navigator.cpp:
     11        (WebCore::Navigator::share):
     12
    1132021-08-16  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Source/WebCore/page/Navigator.cpp

    r278253 r281126  
    144144void Navigator::share(Document& document, const ShareData& data, Ref<DeferredPromise>&& promise)
    145145{
     146    if (m_hasPendingShare) {
     147        promise->reject(NotAllowedError);
     148        return;
     149    }
     150
     151    auto* window = this->window();
     152    if (!window || !window->consumeTransientActivation()) {
     153        promise->reject(NotAllowedError);
     154        return;
     155    }
     156
    146157    if (!canShare(document, data)) {
    147158        promise->reject(TypeError);
    148         return;
    149     }
    150 
    151     auto* window = this->window();
    152     // Note that the specification does not indicate we should consume user activation. We are intentionally stricter here.
    153     if (!window || !window->consumeTransientActivation() || m_hasPendingShare) {
    154         promise->reject(NotAllowedError);
    155159        return;
    156160    }
Note: See TracChangeset for help on using the changeset viewer.