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

Changeset 259629 in webkit


Ignore:
Timestamp:
Apr 7, 2020, 12:55:57 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Use GlobalFrameIdentifier in NavigationAction
https://bugs.webkit.org/show_bug.cgi?id=210036

Patch by Rob Buis <rbuis@igalia.com> on 2020-04-07
Reviewed by Darin Adler.

Source/WebCore:

Use GlobalFrameIdentifier in NavigationAction rather than adding
yet another custom data type.

  • loader/NavigationAction.cpp:

(WebCore::createGlobalFrameIdentifier):
(WebCore::m_globalFrameIdentifier):

  • loader/NavigationAction.h:

(WebCore::NavigationAction::Requester::globalFrameIdentifier const):
(WebCore::NavigationAction::Requester::pageID const): Deleted.
(WebCore::NavigationAction::Requester::frameID const): Deleted.

Source/WebKit:

Adapt to API change.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r259624 r259629  
     12020-04-07  Rob Buis  <rbuis@igalia.com>
     2
     3        Use GlobalFrameIdentifier in NavigationAction
     4        https://bugs.webkit.org/show_bug.cgi?id=210036
     5
     6        Reviewed by Darin Adler.
     7
     8        Use GlobalFrameIdentifier in NavigationAction rather than adding
     9        yet another custom data type.
     10
     11        * loader/NavigationAction.cpp:
     12        (WebCore::createGlobalFrameIdentifier):
     13        (WebCore::m_globalFrameIdentifier):
     14        * loader/NavigationAction.h:
     15        (WebCore::NavigationAction::Requester::globalFrameIdentifier const):
     16        (WebCore::NavigationAction::Requester::pageID const): Deleted.
     17        (WebCore::NavigationAction::Requester::frameID const): Deleted.
     18
    1192020-04-06  Jack Lee  <shihchieh_lee@apple.com>
    220
  • trunk/Source/WebCore/loader/NavigationAction.cpp

    r248713 r259629  
    3939namespace WebCore {
    4040
     41static GlobalFrameIdentifier createGlobalFrameIdentifier(const Document& document)
     42{
     43    if (document.frame())
     44        return { document.frame()->loader().client().pageID().valueOr(PageIdentifier { }), document.frame()->loader().client().frameID().valueOr(FrameIdentifier { }) };
     45    return GlobalFrameIdentifier();
     46}
     47
    4148NavigationAction::Requester::Requester(const Document& document)
    4249    : m_url { URL { document.url() } }
    4350    , m_origin { makeRefPtr(document.securityOrigin()) }
    44     , m_pageIDAndFrameIDPair { document.frame() ? std::make_pair(document.frame()->loader().client().pageID().valueOr(PageIdentifier { }), document.frame()->loader().client().frameID().valueOr(FrameIdentifier { })) : std::make_pair<PageIdentifier, FrameIdentifier>({ }, { }) }
     51    , m_globalFrameIdentifier(createGlobalFrameIdentifier(document))
    4552{
    4653}
  • trunk/Source/WebCore/loader/NavigationAction.h

    r248713 r259629  
    3131#include "AdClickAttribution.h"
    3232#include "BackForwardItemIdentifier.h"
    33 #include "FrameIdentifier.h"
    3433#include "FrameLoaderTypes.h"
     34#include "GlobalFrameIdentifier.h"
    3535#include "LayoutPoint.h"
    36 #include "PageIdentifier.h"
    3736#include "ResourceRequest.h"
    3837#include "SecurityOrigin.h"
     
    6665    NavigationAction& operator=(NavigationAction&&);
    6766
    68     using PageIDAndFrameIDPair = std::pair<PageIdentifier, FrameIdentifier>; // FIXME: Use GlobalFrameIdentifier.
    6967    class Requester {
    7068    public:
     
    7371        const URL& url() const { return m_url; }
    7472        const SecurityOrigin& securityOrigin() const { return *m_origin; }
    75         PageIdentifier pageID() const { return m_pageIDAndFrameIDPair.first; }
    76         FrameIdentifier frameID() const { return m_pageIDAndFrameIDPair.second; }
     73        const GlobalFrameIdentifier& globalFrameIdentifier() const { return m_globalFrameIdentifier; }
    7774    private:
    7875        URL m_url;
    7976        RefPtr<SecurityOrigin> m_origin;
    80         PageIDAndFrameIDPair m_pageIDAndFrameIDPair;
     77        GlobalFrameIdentifier m_globalFrameIdentifier;
    8178    };
    8279    const Optional<Requester>& requester() const { return m_requester; }
  • trunk/Source/WebKit/ChangeLog

    r259615 r259629  
     12020-04-07  Rob Buis  <rbuis@igalia.com>
     2
     3        Use GlobalFrameIdentifier in NavigationAction
     4        https://bugs.webkit.org/show_bug.cgi?id=210036
     5
     6        Reviewed by Darin Adler.
     7
     8        Adapt to API change.
     9
     10        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     11        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
     12
    1132020-04-06  Kate Cheney  <katherine_cheney@apple.com>
    214
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r259187 r259629  
    928928    auto requester = navigationAction.requester().value();
    929929
    930     auto* requestingFrame = requester.frameID() ? WebProcess::singleton().webFrame(requester.frameID()) : nullptr;
     930    auto* requestingFrame = requester.globalFrameIdentifier().frameID ? WebProcess::singleton().webFrame(requester.globalFrameIdentifier().frameID) : nullptr;
    931931    Optional<WebCore::FrameIdentifier> originatingFrameID;
    932932    Optional<WebCore::FrameIdentifier> parentFrameID;
     
    946946
    947947    Optional<WebPageProxyIdentifier> originatingPageID;
    948     if (requester.pageID()) {
    949         if (auto* webPage = WebProcess::singleton().webPage(requester.pageID()))
     948    if (auto& pageID = requester.globalFrameIdentifier().pageID) {
     949        if (auto* webPage = WebProcess::singleton().webPage(pageID))
    950950            originatingPageID = webPage->webPageProxyIdentifier();
    951951    }
Note: See TracChangeset for help on using the changeset viewer.