Title: [204909] trunk
Revision
204909
Author
[email protected]
Date
2016-08-24 11:35:48 -0700 (Wed, 24 Aug 2016)

Log Message

Add a convenience function for creating a WKFrameHandleRef from a WKFrameRef without going through WKFrameInfoRef
https://bugs.webkit.org/show_bug.cgi?id=161152

Reviewed by Anders Carlsson.

Source/WebKit2:

* UIProcess/API/C/WKFrame.cpp:
(WKFrameCreateFrameHandle): Added. Creates a handle with the frame’s frameID.
* UIProcess/API/C/WKFrame.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/FrameHandle.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (204908 => 204909)


--- trunk/Source/WebKit2/ChangeLog	2016-08-24 18:33:43 UTC (rev 204908)
+++ trunk/Source/WebKit2/ChangeLog	2016-08-24 18:35:48 UTC (rev 204909)
@@ -1,5 +1,16 @@
 2016-08-24  Dan Bernstein  <[email protected]>
 
+        Add a convenience function for creating a WKFrameHandleRef from a WKFrameRef without going through WKFrameInfoRef
+        https://bugs.webkit.org/show_bug.cgi?id=161152
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/C/WKFrame.cpp:
+        (WKFrameCreateFrameHandle): Added. Creates a handle with the frame’s frameID.
+        * UIProcess/API/C/WKFrame.h:
+
+2016-08-24  Dan Bernstein  <[email protected]>
+
         [Cocoa] Can’t "po" WKObject instances
         https://bugs.webkit.org/show_bug.cgi?id=161151
 

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKFrame.cpp (204908 => 204909)


--- trunk/Source/WebKit2/UIProcess/API/C/WKFrame.cpp	2016-08-24 18:33:43 UTC (rev 204908)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKFrame.cpp	2016-08-24 18:35:48 UTC (rev 204909)
@@ -27,6 +27,7 @@
 #include "WKFrame.h"
 
 #include "APIData.h"
+#include "APIFrameHandle.h"
 #include "APIFrameInfo.h"
 #include "WKAPICast.h"
 #include "WebCertificateInfo.h"
@@ -126,6 +127,11 @@
     return toImpl(frameRef)->isFrameSet();
 }
 
+WKFrameHandleRef WKFrameCreateFrameHandle(WKFrameRef frameRef)
+{
+    return toAPI(&API::FrameHandle::create(toImpl(frameRef)->frameID()).leakRef());
+}
+
 WKFrameInfoRef WKFrameCreateFrameInfo(WKFrameRef frameRef)
 {
     return toAPI(&API::FrameInfo::create(*toImpl(frameRef), WebCore::SecurityOrigin::createFromString(toImpl(frameRef)->url())).leakRef());

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKFrame.h (204908 => 204909)


--- trunk/Source/WebKit2/UIProcess/API/C/WKFrame.h	2016-08-24 18:33:43 UTC (rev 204908)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKFrame.h	2016-08-24 18:35:48 UTC (rev 204909)
@@ -68,6 +68,7 @@
 
 WK_EXPORT bool WKFrameIsFrameSet(WKFrameRef frame);
 
+WK_EXPORT WKFrameHandleRef WKFrameCreateFrameHandle(WKFrameRef frame);
 WK_EXPORT WKFrameInfoRef WKFrameCreateFrameInfo(WKFrameRef frame);
 
 typedef void (*WKFrameGetResourceDataFunction)(WKDataRef data, WKErrorRef error, void* functionContext);

Modified: trunk/Tools/ChangeLog (204908 => 204909)


--- trunk/Tools/ChangeLog	2016-08-24 18:33:43 UTC (rev 204908)
+++ trunk/Tools/ChangeLog	2016-08-24 18:35:48 UTC (rev 204909)
@@ -1,3 +1,15 @@
+2016-08-24  Dan Bernstein  <[email protected]>
+
+        Add a convenience function for creating a WKFrameHandleRef from a WKFrameRef without going through WKFrameInfoRef
+        https://bugs.webkit.org/show_bug.cgi?id=161152
+
+        Reviewed by Anders Carlsson.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/FrameHandle.cpp: Added.
+        (TestWebKitAPI::didFinishLoadForFrame):
+        (TestWebKitAPI::TEST):
+
 2016-08-24  Nan Wang  <[email protected]>
 
         AX: Add test for line text marker range on iOS

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (204908 => 204909)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2016-08-24 18:33:43 UTC (rev 204908)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2016-08-24 18:35:48 UTC (rev 204909)
@@ -68,6 +68,7 @@
 		33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */; };
 		33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
 		375E0E171D66674400EFEC2C /* WKNSNumber.mm in Sources */ = {isa = PBXBuildFile; fileRef = 375E0E151D66674400EFEC2C /* WKNSNumber.mm */; };
+		376C8C061D6E197C007D2BB9 /* FrameHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 376C8C041D6E197C007D2BB9 /* FrameHandle.cpp */; };
 		378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */; };
 		378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; };
 		379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 379028B814FABE49007E6B43 /* acceptsFirstMouse.html */; };
@@ -745,6 +746,7 @@
 		3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; };
 		3751AF7A169518F800764319 /* DOMNodeFromJSObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMNodeFromJSObject.mm; sourceTree = "<group>"; };
 		375E0E151D66674400EFEC2C /* WKNSNumber.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSNumber.mm; sourceTree = "<group>"; };
+		376C8C041D6E197C007D2BB9 /* FrameHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameHandle.cpp; sourceTree = "<group>"; };
 		3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorInDashboardRegions.mm; sourceTree = "<group>"; };
 		378E64711632646D00B6C676 /* InjectedBundleFrameHitTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleFrameHitTest.cpp; sourceTree = "<group>"; };
 		378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleFrameHitTest_Bundle.cpp; sourceTree = "<group>"; };
@@ -1519,6 +1521,7 @@
 				1A02C84E125D4A8400E3F4BD /* Find.cpp */,
 				C51AFB98169F49FF009CCF66 /* FindMatches.mm */,
 				1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */,
+				376C8C041D6E197C007D2BB9 /* FrameHandle.cpp */,
 				BCBD370F125AA2EB00D2C29F /* FrameMIMETypeHTML.cpp */,
 				BCBD3760125ABCFE00D2C29F /* FrameMIMETypePNG.cpp */,
 				26F52EAA182872600023D412 /* Geolocation.cpp */,
@@ -2268,6 +2271,7 @@
 				7CCE7F021A411AE600447C4C /* NewFirstVisuallyNonEmptyLayout.cpp in Sources */,
 				7CCE7F031A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutFails.cpp in Sources */,
 				7CCE7F041A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutForImages.cpp in Sources */,
+				376C8C061D6E197C007D2BB9 /* FrameHandle.cpp in Sources */,
 				7CCE7F051A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutFrames.cpp in Sources */,
 				7CCE7F251A411AF600447C4C /* OpenAndCloseWindow.mm in Sources */,
 				7CCB4DA91C83AE7300CC6918 /* PageGroup.cpp in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/FrameHandle.cpp (0 => 204909)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/FrameHandle.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/FrameHandle.cpp	2016-08-24 18:35:48 UTC (rev 204909)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_HAVE_C_SPI
+
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "Test.h"
+#include <WebKit/WKFrameHandleRef.h>
+#include <WebKit/WKFrameInfoRef.h>
+#include <WebKit/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+static bool done;
+
+static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+    done = true;
+}
+
+TEST(WebKit2, FrameHandle)
+{
+    WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+    PlatformWebView webView(context.get());
+
+    WKPageLoaderClientV0 loaderClient;
+    memset(&loaderClient, 0, sizeof(loaderClient));
+    loaderClient.base.version = 0;
+    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+    WKPageSetPageLoaderClient(webView.page(), &loaderClient.base);
+
+    WKPageLoadURL(webView.page(), adoptWK(WKURLCreateWithUTF8CString("about:blank")).get());
+    Util::run(&done);
+
+    auto frame = WKPageGetMainFrame(webView.page());
+    auto frameInfo = adoptWK(WKFrameCreateFrameInfo(frame));
+    auto handleFromInfo = WKFrameInfoGetFrameHandleRef(frameInfo.get());
+    auto handleFromFrame = adoptWK(WKFrameCreateFrameHandle(frame));
+
+    EXPECT_EQ(WKFrameHandleGetFrameID(handleFromInfo), WKFrameHandleGetFrameID(handleFromFrame.get()));
+}
+
+} // namespace TestWebKitAPI
+
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to