Title: [259629] trunk/Source
Revision
259629
Author
commit-qu...@webkit.org
Date
2020-04-07 00:55:57 -0700 (Tue, 07 Apr 2020)

Log Message

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

Patch by Rob Buis <rb...@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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259628 => 259629)


--- trunk/Source/WebCore/ChangeLog	2020-04-07 07:17:30 UTC (rev 259628)
+++ trunk/Source/WebCore/ChangeLog	2020-04-07 07:55:57 UTC (rev 259629)
@@ -1,3 +1,21 @@
+2020-04-07  Rob Buis  <rb...@igalia.com>
+
+        Use GlobalFrameIdentifier in NavigationAction
+        https://bugs.webkit.org/show_bug.cgi?id=210036
+
+        Reviewed by Darin Adler.
+
+        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.
+
 2020-04-06  Jack Lee  <shihchieh_...@apple.com>
 
         Nullptr crash in CompositeEditCommand::splitTreeToNode when inserting image in anchor element that has uneditable parent

Modified: trunk/Source/WebCore/loader/NavigationAction.cpp (259628 => 259629)


--- trunk/Source/WebCore/loader/NavigationAction.cpp	2020-04-07 07:17:30 UTC (rev 259628)
+++ trunk/Source/WebCore/loader/NavigationAction.cpp	2020-04-07 07:55:57 UTC (rev 259629)
@@ -38,10 +38,17 @@
 
 namespace WebCore {
 
+static GlobalFrameIdentifier createGlobalFrameIdentifier(const Document& document)
+{
+    if (document.frame())
+        return { document.frame()->loader().client().pageID().valueOr(PageIdentifier { }), document.frame()->loader().client().frameID().valueOr(FrameIdentifier { }) };
+    return GlobalFrameIdentifier();
+}
+
 NavigationAction::Requester::Requester(const Document& document)
     : m_url { URL { document.url() } }
     , m_origin { makeRefPtr(document.securityOrigin()) }
-    , 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>({ }, { }) }
+    , m_globalFrameIdentifier(createGlobalFrameIdentifier(document))
 {
 }
 

Modified: trunk/Source/WebCore/loader/NavigationAction.h (259628 => 259629)


--- trunk/Source/WebCore/loader/NavigationAction.h	2020-04-07 07:17:30 UTC (rev 259628)
+++ trunk/Source/WebCore/loader/NavigationAction.h	2020-04-07 07:55:57 UTC (rev 259629)
@@ -30,10 +30,9 @@
 
 #include "AdClickAttribution.h"
 #include "BackForwardItemIdentifier.h"
-#include "FrameIdentifier.h"
 #include "FrameLoaderTypes.h"
+#include "GlobalFrameIdentifier.h"
 #include "LayoutPoint.h"
-#include "PageIdentifier.h"
 #include "ResourceRequest.h"
 #include "SecurityOrigin.h"
 #include "UserGestureIndicator.h"
@@ -65,7 +64,6 @@
     NavigationAction(NavigationAction&&);
     NavigationAction& operator=(NavigationAction&&);
 
-    using PageIDAndFrameIDPair = std::pair<PageIdentifier, FrameIdentifier>; // FIXME: Use GlobalFrameIdentifier.
     class Requester {
     public:
         Requester(const Document&);
@@ -72,12 +70,11 @@
 
         const URL& url() const { return m_url; }
         const SecurityOrigin& securityOrigin() const { return *m_origin; }
-        PageIdentifier pageID() const { return m_pageIDAndFrameIDPair.first; }
-        FrameIdentifier frameID() const { return m_pageIDAndFrameIDPair.second; }
+        const GlobalFrameIdentifier& globalFrameIdentifier() const { return m_globalFrameIdentifier; }
     private:
         URL m_url;
         RefPtr<SecurityOrigin> m_origin;
-        PageIDAndFrameIDPair m_pageIDAndFrameIDPair;
+        GlobalFrameIdentifier m_globalFrameIdentifier;
     };
     const Optional<Requester>& requester() const { return m_requester; }
 

Modified: trunk/Source/WebKit/ChangeLog (259628 => 259629)


--- trunk/Source/WebKit/ChangeLog	2020-04-07 07:17:30 UTC (rev 259628)
+++ trunk/Source/WebKit/ChangeLog	2020-04-07 07:55:57 UTC (rev 259629)
@@ -1,3 +1,15 @@
+2020-04-07  Rob Buis  <rb...@igalia.com>
+
+        Use GlobalFrameIdentifier in NavigationAction
+        https://bugs.webkit.org/show_bug.cgi?id=210036
+
+        Reviewed by Darin Adler.
+
+        Adapt to API change.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
+
 2020-04-06  Kate Cheney  <katherine_che...@apple.com>
 
         Create a way to signal if the WKAppBoundDomains list is empty

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (259628 => 259629)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-04-07 07:17:30 UTC (rev 259628)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-04-07 07:55:57 UTC (rev 259629)
@@ -927,7 +927,7 @@
     ASSERT(navigationAction.requester());
     auto requester = navigationAction.requester().value();
 
-    auto* requestingFrame = requester.frameID() ? WebProcess::singleton().webFrame(requester.frameID()) : nullptr;
+    auto* requestingFrame = requester.globalFrameIdentifier().frameID ? WebProcess::singleton().webFrame(requester.globalFrameIdentifier().frameID) : nullptr;
     Optional<WebCore::FrameIdentifier> originatingFrameID;
     Optional<WebCore::FrameIdentifier> parentFrameID;
     if (requestingFrame) {
@@ -945,8 +945,8 @@
     };
 
     Optional<WebPageProxyIdentifier> originatingPageID;
-    if (requester.pageID()) {
-        if (auto* webPage = WebProcess::singleton().webPage(requester.pageID()))
+    if (auto& pageID = requester.globalFrameIdentifier().pageID) {
+        if (auto* webPage = WebProcess::singleton().webPage(pageID))
             originatingPageID = webPage->webPageProxyIdentifier();
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to