Changeset 231910 in webkit


Ignore:
Timestamp:
May 17, 2018 11:16:56 AM (6 years ago)
Author:
Brent Fulgham
Message:

Storage Access API: Allow documents that have been granted storage access to also do a popup
https://bugs.webkit.org/show_bug.cgi?id=185615
<rdar://problem/39105791>

Reviewed by Chris Dumez.

Source/WebCore:

  • dom/Document.cpp:

(WebCore::Document::consumeTemporaryUserGesture): Added. Clear the document's active one-time user
activity (for window opening) state.
(WebCore::Document::enableTemporaryUserGesture): Added. Establish a new active one-time user
activity (for window opening) state.
(WebCore::Document::requestStorageAccess): If the user approves Storage Access, establish a new
UserInteraction scope, then resolve the promise. Also post a task to clear the one-time user
gesture state.

LayoutTests:

  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt: Added.
  • http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window.html: Added.
  • http/tests/storageAccess/resources/request-storage-access-iframe-and-pop-window.html: Added.
  • http/tests/storageAccess/resources/request-storage-access-second-window.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r231907 r231910  
     12018-05-17  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Storage Access API: Allow documents that have been granted storage access to also do a popup
     4        https://bugs.webkit.org/show_bug.cgi?id=185615
     5        <rdar://problem/39105791>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window-expected.txt: Added.
     10        * http/tests/storageAccess/request-and-grant-storage-access-cross-origin-non-sandboxed-iframe-pop-window.html: Added.
     11        * http/tests/storageAccess/resources/request-storage-access-iframe-and-pop-window.html: Added.
     12        * http/tests/storageAccess/resources/request-storage-access-second-window.html: Added.
     13
    1142018-05-17  Antoine Quint  <graouts@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r231909 r231910  
     12018-05-17  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Storage Access API: Allow documents that have been granted storage access to also do a popup
     4        https://bugs.webkit.org/show_bug.cgi?id=185615
     5        <rdar://problem/39105791>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * dom/Document.cpp:
     10        (WebCore::Document::consumeTemporaryUserGesture): Added. Clear the document's active one-time user
     11        activity (for window opening) state.
     12        (WebCore::Document::enableTemporaryUserGesture): Added. Establish a new active one-time user
     13        activity (for window opening) state.
     14        (WebCore::Document::requestStorageAccess): If the user approves Storage Access, establish a new
     15        UserInteraction scope, then resolve the promise. Also post a task to clear the one-time user
     16        gesture state.
     17
    1182018-05-17  Zalan Bujtas  <zalan@apple.com>
    219
  • trunk/Source/WebCore/dom/Document.cpp

    r231849 r231910  
    123123#include "MediaQueryMatcher.h"
    124124#include "MessageEvent.h"
     125#include "Microtasks.h"
    125126#include "MouseEventWithHitTestResults.h"
    126127#include "MutationEvent.h"
     
    76107611    }
    76117612
    7612     page->chrome().client().requestStorageAccess(WTFMove(iframeHost), WTFMove(topHost), frameID.value(), pageID.value(), [documentReference = m_weakFactory.createWeakPtr(*this), promise = WTFMove(promise)] (bool wasGranted) {
     7613    page->chrome().client().requestStorageAccess(WTFMove(iframeHost), WTFMove(topHost), frameID.value(), pageID.value(), [documentReference = m_weakFactory.createWeakPtr(*this), promise = WTFMove(promise)] (bool wasGranted) mutable {
    76137614        Document* document = documentReference.get();
    76147615        if (!document)
     
    76177618        if (wasGranted) {
    76187619            document->setHasFrameSpecificStorageAccess(true);
     7620            MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([documentReference = document->m_weakFactory.createWeakPtr(*document)] () {
     7621                if (auto* document = documentReference.get())
     7622                    document->enableTemporaryTimeUserGesture();
     7623            }));
    76197624            promise->resolve();
     7625            MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([documentReference = WTFMove(documentReference)] () {
     7626                if (auto* document = documentReference.get())
     7627                    document->consumeTemporaryTimeUserGesture();
     7628            }));
    76207629        } else
    76217630            promise->reject();
     
    76247633    promise->reject();
    76257634#endif
     7635}
     7636
     7637void Document::enableTemporaryTimeUserGesture()
     7638{
     7639    m_temporaryUserGesture = std::make_unique<UserGestureIndicator>(ProcessingUserGesture, this);
     7640}
     7641
     7642void Document::consumeTemporaryTimeUserGesture()
     7643{
     7644    m_temporaryUserGesture = nullptr;
    76267645}
    76277646
  • trunk/Source/WebCore/dom/Document.h

    r231849 r231910  
    14301430    String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL&);
    14311431
     1432    void consumeTemporaryTimeUserGesture();
     1433
    14321434protected:
    14331435    enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
     
    15421544
    15431545    bool domainIsRegisterable(const String&) const;
     1546
     1547    void enableTemporaryTimeUserGesture();
    15441548
    15451549    const Ref<Settings> m_settings;
     
    19201924    String m_primaryDomainRequestedPageSpecificStorageAccessWithUserInteraction { };
    19211925#endif
     1926   
     1927    std::unique_ptr<UserGestureIndicator> m_temporaryUserGesture;
    19221928};
    19231929
Note: See TracChangeset for help on using the changeset viewer.