Title: [163629] trunk/Source/WebKit2
Revision
163629
Author
[email protected]
Date
2014-02-07 10:32:04 -0800 (Fri, 07 Feb 2014)

Log Message

[Cocoa] API::FrameHandle has a generic wrapper
https://bugs.webkit.org/show_bug.cgi?id=128366

Reviewed by Anders Carlsson.

Added WKFrameHandle.

* Shared/API/Cocoa/WKFrameHandle.h: Added.
* Shared/API/Cocoa/WKFrameHandle.mm: Added.
(-[WKFrameHandle dealloc]): Calls the API::FrameHandle destructor.
(-[WKFrameHandle isEqual:]): Checks for frame ID equality.
(-[WKFrameHandle hash]): Returns the frame ID.
(-[WKFrameHandle _frameID]): Ditto.
(-[WKFrameHandle copyWithZone:]): Retains self.
(+[WKFrameHandle supportsSecureCoding]): Returns YES.
(-[WKFrameHandle initWithCoder:]): Decodes the frame ID and constructs an API::FrameHandle
with it.
(-[WKFrameHandle encodeWithCoder:]): Encodes the frame ID.
(-[WKFrameHandle _apiObject]): Returns the wrapped API::FrameHandle.
* Shared/API/Cocoa/WKFrameHandleInternal.h: Added.
(WebKit::wrapper): Added. Returns an API::FrameHandle’s wrapper as a WKFrameHandle.

* Shared/APIFrameHandle.cpp:
(API::FrameHandle::create): Changed to return a PassRefPtr.
* Shared/APIFrameHandle.h: Made the constructor public for -[WKFrameHandle initWithCoder:].

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject): Allocate a WKFrameHandle if the object is an API::FrameHandle.

* WebKit2.xcodeproj/project.pbxproj: Added references to new files.

* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h: Declared handle property.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
(+[WKWebProcessPlugInFrame lookUpFrameFromHandle:]): Added. Calls WebProcess::webFrame to
look up a frame with the given handle’s frame ID.
(-[WKWebProcessPlugInFrame handle]): Added. Returns a new handle with the frame’s ID.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h: Updated #import.
* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (163628 => 163629)


--- trunk/Source/WebKit2/ChangeLog	2014-02-07 18:31:29 UTC (rev 163628)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-07 18:32:04 UTC (rev 163629)
@@ -1,5 +1,46 @@
 2014-02-07  Dan Bernstein  <[email protected]>
 
+        [Cocoa] API::FrameHandle has a generic wrapper
+        https://bugs.webkit.org/show_bug.cgi?id=128366
+
+        Reviewed by Anders Carlsson.
+
+        Added WKFrameHandle.
+
+        * Shared/API/Cocoa/WKFrameHandle.h: Added.
+        * Shared/API/Cocoa/WKFrameHandle.mm: Added.
+        (-[WKFrameHandle dealloc]): Calls the API::FrameHandle destructor.
+        (-[WKFrameHandle isEqual:]): Checks for frame ID equality.
+        (-[WKFrameHandle hash]): Returns the frame ID.
+        (-[WKFrameHandle _frameID]): Ditto.
+        (-[WKFrameHandle copyWithZone:]): Retains self.
+        (+[WKFrameHandle supportsSecureCoding]): Returns YES.
+        (-[WKFrameHandle initWithCoder:]): Decodes the frame ID and constructs an API::FrameHandle
+        with it.
+        (-[WKFrameHandle encodeWithCoder:]): Encodes the frame ID.
+        (-[WKFrameHandle _apiObject]): Returns the wrapped API::FrameHandle.
+        * Shared/API/Cocoa/WKFrameHandleInternal.h: Added.
+        (WebKit::wrapper): Added. Returns an API::FrameHandle’s wrapper as a WKFrameHandle.
+
+        * Shared/APIFrameHandle.cpp:
+        (API::FrameHandle::create): Changed to return a PassRefPtr.
+        * Shared/APIFrameHandle.h: Made the constructor public for -[WKFrameHandle initWithCoder:].
+
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject): Allocate a WKFrameHandle if the object is an API::FrameHandle.
+
+        * WebKit2.xcodeproj/project.pbxproj: Added references to new files.
+
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h: Declared handle property.
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
+        (+[WKWebProcessPlugInFrame lookUpFrameFromHandle:]): Added. Calls WebProcess::webFrame to
+        look up a frame with the given handle’s frame ID.
+        (-[WKWebProcessPlugInFrame handle]): Added. Returns a new handle with the frame’s ID.
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h: Updated #import.
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h: Added.
+
+2014-02-07  Dan Bernstein  <[email protected]>
+
         [Cocoa] WKWebProcessPlugInNodeHandle methods leak and may crash
         https://bugs.webkit.org/show_bug.cgi?id=128365
 

Added: trunk/Source/WebKit2/Shared/API/Cocoa/WKFrameHandle.h (0 => 163629)


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKFrameHandle.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKFrameHandle.h	2014-02-07 18:32:04 UTC (rev 163629)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#import <WebKit2/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <Foundation/Foundation.h>
+
+WK_API_CLASS
+@interface WKFrameHandle : NSObject <NSCopying, NSSecureCoding>
+
+@end
+
+#endif // WK_API_ENABLED

Added: trunk/Source/WebKit2/Shared/API/Cocoa/WKFrameHandle.mm (0 => 163629)


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKFrameHandle.mm	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKFrameHandle.mm	2014-02-07 18:32:04 UTC (rev 163629)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#import "config.h"
+#import "WKFrameHandleInternal.h"
+
+#if WK_API_ENABLED
+
+using namespace WebKit;
+
+@implementation WKFrameHandle {
+    API::ObjectStorage<API::FrameHandle> _frameHandle;
+}
+
+- (void)dealloc
+{
+    _frameHandle->~FrameHandle();
+
+    [super dealloc];
+}
+
+- (BOOL)isEqual:(id)object
+{
+    if (object == self)
+        return YES;
+
+    if (![object isKindOfClass:[WKFrameHandle self]])
+        return NO;
+
+    return _frameHandle->frameID() == ((WKFrameHandle *)object)->_frameHandle->frameID();
+}
+
+- (NSUInteger)hash
+{
+    return _frameHandle->frameID();
+}
+
+- (uint64_t)_frameID
+{
+    return _frameHandle->frameID();
+}
+
+#pragma mark NSCopying protocol implementation
+
+- (id)copyWithZone:(NSZone *)zone
+{
+    return [self retain];
+}
+
+#pragma mark NSSecureCoding protocol implementation
+
++ (BOOL)supportsSecureCoding
+{
+    return YES;
+}
+
+- (id)initWithCoder:(NSCoder *)decoder
+{
+    if (!(self = [super init]))
+        return nil;
+
+    NSNumber *frameID = [decoder decodeObjectOfClass:[NSNumber self] forKey:@"frameID"];
+    if (![frameID isKindOfClass:[NSNumber self]]) {
+        [self release];
+        return nil;
+    }
+
+    API::Object::constructInWrapper<API::FrameHandle>(self, frameID.unsignedLongLongValue);
+
+    return self;
+}
+
+- (void)encodeWithCoder:(NSCoder *)coder
+{
+    [coder encodeObject:@(_frameHandle->frameID()) forKey:@"frameID"];
+}
+
+#pragma mark WKObject protocol implementation
+
+- (API::Object&)_apiObject
+{
+    return *_frameHandle;
+}
+
+@end
+
+#endif // WK_API_ENABLED

Added: trunk/Source/WebKit2/Shared/API/Cocoa/WKFrameHandleInternal.h (0 => 163629)


--- trunk/Source/WebKit2/Shared/API/Cocoa/WKFrameHandleInternal.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/API/Cocoa/WKFrameHandleInternal.h	2014-02-07 18:32:04 UTC (rev 163629)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#import "WKFrameHandle.h"
+
+#if WK_API_ENABLED
+
+#import "APIFrameHandle.h"
+#import "WKObject.h"
+
+namespace WebKit {
+
+inline WKFrameHandle *wrapper(API::FrameHandle& frameHandle)
+{
+    ASSERT([frameHandle.wrapper() isKindOfClass:[WKFrameHandle self]]);
+    return (WKFrameHandle *)frameHandle.wrapper();
+}
+
+}
+
+@interface WKFrameHandle () <WKObject>
+
+@property (nonatomic, readonly) uint64_t _frameID;
+
+@end
+
+#endif // WK_API_ENABLED

Modified: trunk/Source/WebKit2/Shared/APIFrameHandle.cpp (163628 => 163629)


--- trunk/Source/WebKit2/Shared/APIFrameHandle.cpp	2014-02-07 18:31:29 UTC (rev 163628)
+++ trunk/Source/WebKit2/Shared/APIFrameHandle.cpp	2014-02-07 18:32:04 UTC (rev 163629)
@@ -28,7 +28,7 @@
 
 namespace API {
 
-RefPtr<FrameHandle> FrameHandle::create(uint64_t frameID)
+PassRefPtr<FrameHandle> FrameHandle::create(uint64_t frameID)
 {
     return adoptRef(new FrameHandle(frameID));
 }

Modified: trunk/Source/WebKit2/Shared/APIFrameHandle.h (163628 => 163629)


--- trunk/Source/WebKit2/Shared/APIFrameHandle.h	2014-02-07 18:31:29 UTC (rev 163628)
+++ trunk/Source/WebKit2/Shared/APIFrameHandle.h	2014-02-07 18:32:04 UTC (rev 163629)
@@ -33,14 +33,14 @@
 
 class FrameHandle : public ObjectImpl<Object::Type::FrameHandle> {
 public:
-    static RefPtr<FrameHandle> create(uint64_t frameID);
+    explicit FrameHandle(uint64_t frameID);
+
+    static PassRefPtr<FrameHandle> create(uint64_t frameID);
     virtual ~FrameHandle();
 
     uint64_t frameID() const { return m_frameID; }
 
 private:
-    explicit FrameHandle(uint64_t frameID);
-
     uint64_t m_frameID;
 };
 

Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (163628 => 163629)


--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm	2014-02-07 18:31:29 UTC (rev 163628)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm	2014-02-07 18:32:04 UTC (rev 163629)
@@ -33,6 +33,7 @@
 #import "WKBrowsingContextControllerInternal.h"
 #import "WKBrowsingContextGroupInternal.h"
 #import "WKConnectionInternal.h"
+#import "WKFrameHandleInternal.h"
 #import "WKNSArray.h"
 #import "WKNSData.h"
 #import "WKNSDictionary.h"
@@ -116,6 +117,10 @@
         wrapper = NSAllocateObject([WKNSError self], size, nullptr);
         break;
 
+    case Type::FrameHandle:
+        wrapper = [WKFrameHandle alloc];
+        break;
+
     case Type::NavigationData:
         wrapper = [WKNavigationData alloc];
         break;

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (163628 => 163629)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-02-07 18:31:29 UTC (rev 163628)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2014-02-07 18:32:04 UTC (rev 163629)
@@ -565,6 +565,11 @@
 		373CEAD5185417AE008C363D /* WKNSData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 373CEAD3185417AE008C363D /* WKNSData.mm */; };
 		373CEAD6185417AE008C363D /* WKNSData.h in Headers */ = {isa = PBXBuildFile; fileRef = 373CEAD4185417AE008C363D /* WKNSData.h */; };
 		373CEAD81859553F008C363D /* WKPagePolicyClientInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 373CEAD71859553F008C363D /* WKPagePolicyClientInternal.h */; };
+		373D122218A473010066D9CC /* WKFrameHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 373D122018A473010066D9CC /* WKFrameHandle.mm */; };
+		373D122318A473010066D9CC /* WKFrameHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 373D122118A473010066D9CC /* WKFrameHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		373D122518A473B30066D9CC /* WKBrowsingContextHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 373D122418A473B30066D9CC /* WKBrowsingContextHandleInternal.h */; };
+		373D122718A473F60066D9CC /* WKFrameHandleInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 373D122618A473F60066D9CC /* WKFrameHandleInternal.h */; };
+		373D122D18A4B6EB0066D9CC /* WKWebProcessPlugInFramePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 373D122C18A4B6A80066D9CC /* WKWebProcessPlugInFramePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		374436881820E7240049579F /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 374436871820E7240049579F /* WKObject.mm */; };
 		3760881E150413E900FC82C7 /* WebRenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3760881C150413E900FC82C7 /* WebRenderObject.cpp */; };
 		3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3760881D150413E900FC82C7 /* WebRenderObject.h */; };
@@ -2270,6 +2275,11 @@
 		373CEAD3185417AE008C363D /* WKNSData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKNSData.mm; sourceTree = "<group>"; };
 		373CEAD4185417AE008C363D /* WKNSData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNSData.h; sourceTree = "<group>"; };
 		373CEAD71859553F008C363D /* WKPagePolicyClientInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPagePolicyClientInternal.h; sourceTree = "<group>"; };
+		373D122018A473010066D9CC /* WKFrameHandle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKFrameHandle.mm; sourceTree = "<group>"; };
+		373D122118A473010066D9CC /* WKFrameHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFrameHandle.h; sourceTree = "<group>"; };
+		373D122418A473B30066D9CC /* WKBrowsingContextHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextHandleInternal.h; sourceTree = "<group>"; };
+		373D122618A473F60066D9CC /* WKFrameHandleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFrameHandleInternal.h; sourceTree = "<group>"; };
+		373D122C18A4B6A80066D9CC /* WKWebProcessPlugInFramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInFramePrivate.h; sourceTree = "<group>"; };
 		374436871820E7240049579F /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = "<group>"; };
 		375FB4731883415600BE34D4 /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = "<group>"; };
 		3760881C150413E900FC82C7 /* WebRenderObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebRenderObject.cpp; sourceTree = "<group>"; };
@@ -4094,6 +4104,7 @@
 				1F0181691858DC1500F92884 /* WKWebProcessPlugInFrame.h */,
 				1F01816A1858DC1500F92884 /* WKWebProcessPlugInFrame.mm */,
 				1F01816B1858DC1500F92884 /* WKWebProcessPlugInFrameInternal.h */,
+				373D122C18A4B6A80066D9CC /* WKWebProcessPlugInFramePrivate.h */,
 				1F01816C1858DC1500F92884 /* WKWebProcessPlugInHitTestResult.h */,
 				1F01816D1858DC1600F92884 /* WKWebProcessPlugInHitTestResult.mm */,
 				1F01816E1858DC1600F92884 /* WKWebProcessPlugInHitTestResultInternal.h */,
@@ -4389,6 +4400,10 @@
 				1AE00D4A182D6EB000087DD7 /* WKBrowsingContextHandle.mm */,
 				1AE00D4E182D6F5000087DD7 /* WKBrowsingContextHandleInternal.h */,
 				37DFA6FF1810BB92001F4A9F /* WKFoundation.h */,
+				373D122118A473010066D9CC /* WKFrameHandle.h */,
+				373D122018A473010066D9CC /* WKFrameHandle.mm */,
+				373D122618A473F60066D9CC /* WKFrameHandleInternal.h */,
+				373D122418A473B30066D9CC /* WKBrowsingContextHandleInternal.h */,
 				1A9E32991822E1CC00F5D04C /* WKRemoteObject.h */,
 				1A9E32981822E1CC00F5D04C /* WKRemoteObject.mm */,
 				1A9E329D1822FEDD00F5D04C /* WKRemoteObjectCoder.h */,
@@ -6269,6 +6284,7 @@
 				518E8F0A16B2093700E91429 /* DownloadAuthenticationClient.h in Headers */,
 				518E8F0C16B2093700E91429 /* DownloadManager.h in Headers */,
 				1AB7D4CA1288AAA700CFD08C /* DownloadProxy.h in Headers */,
+				373D122D18A4B6EB0066D9CC /* WKWebProcessPlugInFramePrivate.h in Headers */,
 				1AD25E96167AB08100EA9BCD /* DownloadProxyMap.h in Headers */,
 				1AB7D61A1288B9D900CFD08C /* DownloadProxyMessages.h in Headers */,
 				C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */,
@@ -6441,6 +6457,7 @@
 				BC597075116591D000551FCA /* ProcessModel.h in Headers */,
 				1AB16AEA164B3A8800290D62 /* RemoteLayerTreeContext.h in Headers */,
 				1AB16ADE1648598400290D62 /* RemoteLayerTreeDrawingArea.h in Headers */,
+				373D122518A473B30066D9CC /* WKBrowsingContextHandleInternal.h in Headers */,
 				1AB16AE21648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h in Headers */,
 				1AA3D75C1651B44F008713D0 /* RemoteLayerTreeHost.h in Headers */,
 				1AF1AC6C1651759E00C17D7F /* RemoteLayerTreeTransaction.h in Headers */,
@@ -6603,6 +6620,7 @@
 				1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */,
 				51032F1E180F791700961BB7 /* DatabaseToWebProcessConnectionMessages.h in Headers */,
 				51A9E1061315CCFC009E7031 /* WebKeyValueStorageManager.h in Headers */,
+				373D122718A473F60066D9CC /* WKFrameHandleInternal.h in Headers */,
 				1AE00D611831792100087DD7 /* FrameLoadState.h in Headers */,
 				BCB63478116BF10600603215 /* WebKit2_C.h in Headers */,
 				BC9BA5051697C45300E44616 /* WebKit2Initialize.h in Headers */,
@@ -6807,6 +6825,7 @@
 				BC1DFE8F12B31CA8005DF730 /* WKOpenPanelResultListener.h in Headers */,
 				BCD597D7112B56DC00EC8C23 /* WKPage.h in Headers */,
 				2D6CD119189058A500E5A4A0 /* ViewSnapshotStore.h in Headers */,
+				373D122318A473010066D9CC /* WKFrameHandle.h in Headers */,
 				BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */,
 				BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */,
 				93BDEB01171DD7AF00BFEE1B /* WKPageLoadTypesPrivate.h in Headers */,
@@ -8115,6 +8134,7 @@
 				51290992183ACEAF005522A6 /* WebIDBServerConnection.cpp in Sources */,
 				BC204EEE11C83EC8008F3375 /* WKBundle.cpp in Sources */,
 				935EEB9E127761AC003322B8 /* WKBundleBackForwardList.cpp in Sources */,
+				373D122218A473010066D9CC /* WKFrameHandle.mm in Sources */,
 				935EEBA0127761AC003322B8 /* WKBundleBackForwardListItem.cpp in Sources */,
 				51FA2D7715212E2600C1BA0B /* WKBundleDOMWindowExtension.cpp in Sources */,
 				BCD25F1811D6BDE100169B0E /* WKBundleFrame.cpp in Sources */,

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h (163628 => 163629)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h	2014-02-07 18:31:29 UTC (rev 163628)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h	2014-02-07 18:32:04 UTC (rev 163629)
@@ -31,6 +31,7 @@
 #import <Foundation/Foundation.h>
 #import <_javascript_Core/JSContext.h>
 
+@class WKFrameHandle;
 @class WKWebProcessPlugInHitTestResult;
 @class WKWebProcessPlugInNodeHandle;
 @class WKWebProcessPlugInScriptWorld;
@@ -42,6 +43,8 @@
 @property (nonatomic, readonly) NSArray *childFrames;
 @property (nonatomic, readonly) BOOL containsAnyFormElements;
 
+@property (nonatomic, readonly) WKFrameHandle *handle;
+
 - (JSContext *)jsContextForWorld:(WKWebProcessPlugInScriptWorld *)world;
 - (WKWebProcessPlugInHitTestResult *)hitTest:(CGPoint)point;
 - (JSValue *)jsNodeForNodeHandle:(WKWebProcessPlugInNodeHandle *)nodeHandle inWorld:(WKWebProcessPlugInScriptWorld *)world;

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm (163628 => 163629)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm	2014-02-07 18:31:29 UTC (rev 163628)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm	2014-02-07 18:32:04 UTC (rev 163629)
@@ -28,11 +28,13 @@
 
 #if WK_API_ENABLED
 
+#import "WKFrameHandleInternal.h"
 #import "WKNSArray.h"
 #import "WKNSURLExtras.h"
 #import "WKWebProcessPlugInHitTestResultInternal.h"
 #import "WKWebProcessPlugInNodeHandleInternal.h"
 #import "WKWebProcessPlugInScriptWorldInternal.h"
+#import "WebProcess.h"
 #import <_javascript_Core/JSValue.h>
 #import <WebCore/IntPoint.h>
 
@@ -42,6 +44,15 @@
     API::ObjectStorage<WebFrame> _frame;
 }
 
++ (instancetype)lookUpFrameFromHandle:(WKFrameHandle *)handle
+{
+    WebFrame* webFrame = WebProcess::shared().webFrame(handle._frameID);
+    if (!webFrame)
+        return nil;
+
+    return wrapper(*webFrame);
+}
+
 - (void)dealloc
 {
     _frame->~WebFrame();
@@ -80,6 +91,11 @@
     return !!_frame->containsAnyFormElements();
 }
 
+- (WKFrameHandle *)handle
+{
+    return [wrapper(*API::FrameHandle::create(_frame->frameID()).leakRef()) autorelease];
+}
+
 #pragma mark WKObject protocol implementation
 
 - (API::Object&)_apiObject

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h (163628 => 163629)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h	2014-02-07 18:31:29 UTC (rev 163628)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrameInternal.h	2014-02-07 18:32:04 UTC (rev 163629)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "WKWebProcessPlugInFrame.h"
+#import "WKWebProcessPlugInFramePrivate.h"
 
 #if WK_API_ENABLED
 

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h (0 => 163629)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFramePrivate.h	2014-02-07 18:32:04 UTC (rev 163629)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#import "WKWebProcessPlugInFrame.h"
+
+#if WK_API_ENABLED
+
+@interface WKWebProcessPlugInFrame (WKPrivate)
+
++ (instancetype)lookUpFrameFromHandle:(WKFrameHandle *)handle;
+
+@end
+
+#endif // WK_API_ENABLED
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to