Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (166858 => 166859)
--- trunk/Source/WebKit/mac/ChangeLog 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-04-06 23:41:10 UTC (rev 166859)
@@ -1,3 +1,11 @@
+2014-04-06 Sam Weinig <s...@webkit.org>
+
+ Document user content related APIs
+
+ Reviewed by Anders Carlsson.
+
+ * MigrateHeaders.make:
+
2014-04-06 Darin Adler <da...@apple.com>
Refactor post-attach and HTMLObjectElement-related code
Modified: trunk/Source/WebKit/mac/MigrateHeaders.make (166858 => 166859)
--- trunk/Source/WebKit/mac/MigrateHeaders.make 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit/mac/MigrateHeaders.make 2014-04-06 23:41:10 UTC (rev 166859)
@@ -276,10 +276,11 @@
WKProcessPoolPrivate.h \
WKScriptMessage.h \
WKScriptMessageHandler.h \
- WKScriptWorld.h \
+ WKScriptMessagePrivate.h \
WKUIDelegate.h \
WKUIDelegatePrivate.h \
WKUserContentController.h \
+ WKUserContentControllerPrivate.h \
WKWebView.h \
WKWebViewConfiguration.h \
WKWebViewConfigurationPrivate.h \
@@ -287,6 +288,7 @@
_WKActivatedElementInfo.h \
_WKElementAction.h \
_WKProcessPoolConfiguration.h \
+ _WKScriptWorld.h \
_WKThumbnailView.h \
_WKVisitedLinkProvider.h \
_WKVisitedLinkProviderPrivate.h \
Modified: trunk/Source/WebKit2/ChangeLog (166858 => 166859)
--- trunk/Source/WebKit2/ChangeLog 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit2/ChangeLog 2014-04-06 23:41:10 UTC (rev 166859)
@@ -1,3 +1,34 @@
+2014-04-06 Sam Weinig <s...@webkit.org>
+
+ Document user content related APIs..
+
+ Reviewed by Anders Carlsson.
+
+ - Also demote WKScriptWorld to SPI.
+
+ * UIProcess/API/Cocoa/WKScriptMessage.h:
+ * UIProcess/API/Cocoa/WKScriptMessage.mm:
+ (-[WKScriptMessage _scriptWorld]):
+ (-[WKScriptMessage scriptWorld]): Deleted.
+ * UIProcess/API/Cocoa/WKScriptMessageHandler.h:
+ * UIProcess/API/Cocoa/WKScriptMessagePrivate.h: Added.
+ * UIProcess/API/Cocoa/WKScriptWorld.h: Removed.
+ * UIProcess/API/Cocoa/WKScriptWorld.mm: Removed.
+ * UIProcess/API/Cocoa/WKUserContentController.h:
+ * UIProcess/API/Cocoa/WKUserContentController.mm:
+ (-[WKUserContentController addScriptMessageHandler:name:]):
+ (-[WKUserContentController removeScriptMessageHandlerForName:]):
+ (-[WKUserContentController _addScriptMessageHandler:name:world:]):
+ (-[WKUserContentController _removeScriptMessageHandlerForName:world:]):
+ (-[WKUserContentController addScriptMessageHandler:name:world:]): Deleted.
+ (-[WKUserContentController removeScriptMessageHandlerForName:world:]): Deleted.
+ * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: Added.
+ * UIProcess/API/Cocoa/_WKScriptWorld.h: Copied from WebKit2/UIProcess/API/Cocoa/WKScriptWorld.h.
+ * UIProcess/API/Cocoa/_WKScriptWorld.mm: Copied from WebKit2/UIProcess/API/Cocoa/WKScriptWorld.mm.
+ (+[_WKScriptWorld defaultWorld]):
+ (+[WKScriptWorld defaultWorld]): Deleted.
+ * WebKit2.xcodeproj/project.pbxproj:
+
2014-04-04 Brian J. Burg <b...@cs.washington.edu>
Enable WEB_REPLAY for PLATFORM(MAC)
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.h (166858 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.h 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.h 2014-04-06 23:41:10 UTC (rev 166859)
@@ -29,19 +29,21 @@
#if WK_API_ENABLED
@class WKWebView;
-@class WKScriptWorld;
+/*! A @link WKScriptMessage @/link object contains information about a message being sent from a web page.
+ */
WK_API_CLASS
@interface WKScriptMessage : NSObject
+/*! @abstract The body of the message. Allowed types are NSDictionary, NSArray, NSNumber, NSNull, NSString, and NSDate. */
@property (nonatomic, readonly) id body;
+/*! @abstract The web view the message is coming from. */
@property (nonatomic, readonly, weak) WKWebView *webView;
+
+/*! @abstract The name of the message handler this message is being sent to. */
@property (nonatomic, readonly) NSString *name;
-@property (nonatomic, readonly) WKScriptWorld *scriptWorld;
-// FIXME: Consider adding the navigation as well.
-
@end
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm (166858 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessage.mm 2014-04-06 23:41:10 UTC (rev 166859)
@@ -24,10 +24,12 @@
*/
#import "config.h"
-#import "WKScriptMessage.h"
+#import "WKScriptMessagePrivate.h"
#if WK_API_ENABLED
+// FIXME: Consider adding the navigation as well.
+
@implementation WKScriptMessage
- (id)body
@@ -48,8 +50,13 @@
return nil;
}
-- (WKScriptWorld *)scriptWorld
+@end
+
+@implementation WKScriptMessage (WKPrivate)
+
+- (_WKScriptWorld *)_scriptWorld
{
+ // FIXME: Implement.
return nil;
}
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageHandler.h (166858 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageHandler.h 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessageHandler.h 2014-04-06 23:41:10 UTC (rev 166859)
@@ -32,10 +32,16 @@
@class WKScriptMessage;
@class WKUserContentController;
+/*! A class that conforms to WKScriptMessageHandler provides a method for recieving messages from _javascript_ running in a web page.
+ */
@protocol WKScriptMessageHandler <NSObject>
@required
+/*! @abstract Invoked when a script message is recieved from a web page.
+ @param userContentController The WKUserContentController invoking the delegate method.
+ @param message The script message being received.
+ */
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message;
@end
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h (0 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptMessagePrivate.h 2014-04-06 23:41:10 UTC (rev 166859)
@@ -0,0 +1,38 @@
+/*
+ * 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/WKScriptMessage.h>
+
+#if WK_API_ENABLED
+
+@class _WKScriptWorld;
+
+@interface WKScriptMessage (WKPrivate)
+
+@property (nonatomic, readonly) _WKScriptWorld *_scriptWorld;
+
+@end
+
+#endif
Deleted: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptWorld.h (166858 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptWorld.h 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptWorld.h 2014-04-06 23:41:10 UTC (rev 166859)
@@ -1,38 +0,0 @@
-/*
- * 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 <Foundation/Foundation.h>
-#import <WebKit2/WKFoundation.h>
-
-#if WK_API_ENABLED
-
-WK_API_CLASS
-@interface WKScriptWorld : NSObject
-
-+ (instancetype)defaultWorld;
-
-@end
-
-#endif
Deleted: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptWorld.mm (166858 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptWorld.mm 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptWorld.mm 2014-04-06 23:41:10 UTC (rev 166859)
@@ -1,70 +0,0 @@
-/*
- * 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 "WKScriptWorld.h"
-
-#if WK_API_ENABLED
-
-@implementation WKScriptWorld {
- uint64_t _worldID;
-}
-
-static uint64_t generateWorldID()
-{
- std::atomic<uint64_t> worldID;
-
- return ++worldID;
-}
-
-+ (instancetype)defaultWorld
-{
- static dispatch_once_t onceToken;
- static WKScriptWorld *defaultWorld;
-
- dispatch_once(&onceToken, ^{
- defaultWorld = [[WKScriptWorld alloc] _initWithWorldID:0];
- });
-
- return defaultWorld;
-}
-
-- (instancetype)init
-{
- return [self _initWithWorldID:generateWorldID()];
-}
-
-- (instancetype)_initWithWorldID:(uint64_t)worldID
-{
- if (!(self = [super init]))
- return nil;
-
- _worldID = worldID;
- return self;
-}
-
-@end
-
-#endif
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h (166858 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.h 2014-04-06 23:41:10 UTC (rev 166859)
@@ -28,15 +28,26 @@
#if WK_API_ENABLED
-@class WKScriptWorld;
@protocol WKScriptMessageHandler;
+/*! WKUserContentController provides a way for _javascript_ to post messages to the @link WKWebView @/link.
+ A @link WKWebView @/link can specify which WKUserContentController object it uses through its @link WKWebViewConfiguration @/link.
+ */
WK_API_CLASS
@interface WKUserContentController : NSObject
-- (void)addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name world:(WKScriptWorld *)world;
-- (void)removeScriptMessageHandlerForName:(NSString *)name world:(WKScriptWorld *)world;
+/*! @abstract Adds a script message handler.
+ @param scriptMessageHandler The message handler where the messages should be delivered.
+ @param name The name of the message handler.
+ @discussion Adding a scriptMessageHandler adds a function window.webkit.messaging.<name>.postMessage(<messageBody>) for all frames.
+ */
+- (void)addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name;
+/*! @abstract Removes a script message handler.
+ @param name The name of the message handler to remove.
+ */
+- (void)removeScriptMessageHandlerForName:(NSString *)name;
+
@end
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm (166858 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm 2014-04-06 23:41:10 UTC (rev 166859)
@@ -23,19 +23,35 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#include "WKUserContentController.h"
+#import "config.h"
+#import "WKUserContentControllerPrivate.h"
#if WK_API_ENABLED
+#import "_WKScriptWorld.h"
+
@implementation WKUserContentController
-- (void)addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name world:(WKScriptWorld *)world
+- (void)addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name
{
+ [self _addScriptMessageHandler:scriptMessageHandler name:name world:[_WKScriptWorld defaultWorld]];
+}
+
+- (void)removeScriptMessageHandlerForName:(NSString *)name
+{
+ [self _removeScriptMessageHandlerForName:name world:[_WKScriptWorld defaultWorld]];
+}
+
+@end
+
+@implementation WKUserContentController (WKPrivate)
+
+- (void)_addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name world:(_WKScriptWorld *)world
+{
// FIXME: Implement.
}
-- (void)removeScriptMessageHandlerForName:(NSString *)name world:(WKScriptWorld *)world
+- (void)_removeScriptMessageHandlerForName:(NSString *)name world:(_WKScriptWorld *)world
{
// FIXME: Implement.
}
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h (0 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h 2014-04-06 23:41:10 UTC (rev 166859)
@@ -0,0 +1,41 @@
+/*
+ * 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/WKUserContentController.h>
+
+#if WK_API_ENABLED
+
+@class _WKScriptWorld;
+
+@interface WKUserContentController (WKPrivate)
+
+- (void)_addScriptMessageHandler:(id <WKScriptMessageHandler>)scriptMessageHandler name:(NSString *)name world:(_WKScriptWorld *)world;
+- (void)_removeScriptMessageHandlerForName:(NSString *)name world:(_WKScriptWorld *)world;
+
+@end
+
+#endif
+
+
Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKScriptWorld.h (from rev 166808, trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptWorld.h) (0 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKScriptWorld.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKScriptWorld.h 2014-04-06 23:41:10 UTC (rev 166859)
@@ -0,0 +1,38 @@
+/*
+ * 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 <Foundation/Foundation.h>
+#import <WebKit2/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+WK_API_CLASS
+@interface _WKScriptWorld : NSObject
+
++ (instancetype)defaultWorld;
+
+@end
+
+#endif
Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKScriptWorld.mm (from rev 166808, trunk/Source/WebKit2/UIProcess/API/Cocoa/WKScriptWorld.mm) (0 => 166859)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKScriptWorld.mm (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKScriptWorld.mm 2014-04-06 23:41:10 UTC (rev 166859)
@@ -0,0 +1,70 @@
+/*
+ * 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 "_WKScriptWorld.h"
+
+#if WK_API_ENABLED
+
+@implementation _WKScriptWorld {
+ uint64_t _worldID;
+}
+
+static uint64_t generateWorldID()
+{
+ std::atomic<uint64_t> worldID;
+
+ return ++worldID;
+}
+
++ (instancetype)defaultWorld
+{
+ static dispatch_once_t onceToken;
+ static _WKScriptWorld *defaultWorld;
+
+ dispatch_once(&onceToken, ^{
+ defaultWorld = [[_WKScriptWorld alloc] _initWithWorldID:0];
+ });
+
+ return defaultWorld;
+}
+
+- (instancetype)init
+{
+ return [self _initWithWorldID:generateWorldID()];
+}
+
+- (instancetype)_initWithWorldID:(uint64_t)worldID
+{
+ if (!(self = [super init]))
+ return nil;
+
+ _worldID = worldID;
+ return self;
+}
+
+@end
+
+#endif
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (166858 => 166859)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-04-06 23:21:46 UTC (rev 166858)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-04-06 23:41:10 UTC (rev 166859)
@@ -258,8 +258,8 @@
1A79D9F218EB5EF100914CC5 /* WKBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A79D9F118EB5EF100914CC5 /* WKBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
1A7C6CDA1378950800B9C04D /* EnvironmentVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7C6CD81378950800B9C04D /* EnvironmentVariables.cpp */; };
1A7C6CDB1378950800B9C04D /* EnvironmentVariables.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7C6CD91378950800B9C04D /* EnvironmentVariables.h */; };
- 1A7E376D18E3CA57003D0FFF /* WKScriptWorld.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A7E376B18E3CA57003D0FFF /* WKScriptWorld.mm */; };
- 1A7E376E18E3CA57003D0FFF /* WKScriptWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7E376C18E3CA57003D0FFF /* WKScriptWorld.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 1A7E376D18E3CA57003D0FFF /* _WKScriptWorld.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A7E376B18E3CA57003D0FFF /* _WKScriptWorld.mm */; };
+ 1A7E376E18E3CA57003D0FFF /* _WKScriptWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7E376C18E3CA57003D0FFF /* _WKScriptWorld.h */; settings = {ATTRIBUTES = (Public, ); }; };
1A7E377518E4A33A003D0FFF /* WKScriptMessageHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7E377418E4A33A003D0FFF /* WKScriptMessageHandler.h */; settings = {ATTRIBUTES = (Public, ); }; };
1A7E377818E4A4FE003D0FFF /* WKScriptMessage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A7E377618E4A4FE003D0FFF /* WKScriptMessage.mm */; };
1A7E377918E4A4FE003D0FFF /* WKScriptMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7E377718E4A4FE003D0FFF /* WKScriptMessage.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -972,6 +972,8 @@
7CB16FF21724BA28007A0A95 /* com.macromedia.Flash Player.plugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7CB16FE51724B9B5007A0A95 /* com.macromedia.Flash Player.plugin.sb */; };
7CB16FF31724BA2F007A0A95 /* com.microsoft.SilverlightPlugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7CB16FE61724B9B5007A0A95 /* com.microsoft.SilverlightPlugin.sb */; };
7CB16FF41724BA30007A0A95 /* com.oracle.java.JavaAppletPlugin.sb in Copy Plug-in Sandbox Profiles */ = {isa = PBXBuildFile; fileRef = 7CB16FE71724B9B5007A0A95 /* com.oracle.java.JavaAppletPlugin.sb */; };
+ 7CC99A3418EF7B120048C8B4 /* WKUserContentControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC99A3318EF7B120048C8B4 /* WKUserContentControllerPrivate.h */; };
+ 7CC99A3618EF7CBC0048C8B4 /* WKScriptMessagePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC99A3518EF7CBC0048C8B4 /* WKScriptMessagePrivate.h */; };
7CD102DA1866770600ED429D /* AutoCorrectionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD102D91866770600ED429D /* AutoCorrectionCallback.h */; };
7CD5EBB81746A15B000C1C45 /* WKObjCTypeWrapperRef.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CD5EBB61746A15B000C1C45 /* WKObjCTypeWrapperRef.mm */; };
7CD5EBB91746A15B000C1C45 /* WKObjCTypeWrapperRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD5EBB71746A15B000C1C45 /* WKObjCTypeWrapperRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2029,8 +2031,8 @@
1A79D9F118EB5EF100914CC5 /* WKBackForwardListPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardListPrivate.h; sourceTree = "<group>"; };
1A7C6CD81378950800B9C04D /* EnvironmentVariables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EnvironmentVariables.cpp; sourceTree = "<group>"; };
1A7C6CD91378950800B9C04D /* EnvironmentVariables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EnvironmentVariables.h; sourceTree = "<group>"; };
- 1A7E376B18E3CA57003D0FFF /* WKScriptWorld.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKScriptWorld.mm; sourceTree = "<group>"; };
- 1A7E376C18E3CA57003D0FFF /* WKScriptWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKScriptWorld.h; sourceTree = "<group>"; };
+ 1A7E376B18E3CA57003D0FFF /* _WKScriptWorld.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKScriptWorld.mm; sourceTree = "<group>"; };
+ 1A7E376C18E3CA57003D0FFF /* _WKScriptWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKScriptWorld.h; sourceTree = "<group>"; };
1A7E377418E4A33A003D0FFF /* WKScriptMessageHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKScriptMessageHandler.h; sourceTree = "<group>"; };
1A7E377618E4A4FE003D0FFF /* WKScriptMessage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKScriptMessage.mm; sourceTree = "<group>"; };
1A7E377718E4A4FE003D0FFF /* WKScriptMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKScriptMessage.h; sourceTree = "<group>"; };
@@ -2825,6 +2827,8 @@
7CB16FE51724B9B5007A0A95 /* com.macromedia.Flash Player.plugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "com.macromedia.Flash Player.plugin.sb"; sourceTree = "<group>"; };
7CB16FE61724B9B5007A0A95 /* com.microsoft.SilverlightPlugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.microsoft.SilverlightPlugin.sb; sourceTree = "<group>"; };
7CB16FE71724B9B5007A0A95 /* com.oracle.java.JavaAppletPlugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.oracle.java.JavaAppletPlugin.sb; sourceTree = "<group>"; };
+ 7CC99A3318EF7B120048C8B4 /* WKUserContentControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentControllerPrivate.h; sourceTree = "<group>"; };
+ 7CC99A3518EF7CBC0048C8B4 /* WKScriptMessagePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKScriptMessagePrivate.h; sourceTree = "<group>"; };
7CD102D91866770600ED429D /* AutoCorrectionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoCorrectionCallback.h; sourceTree = "<group>"; };
7CD5EBB61746A15B000C1C45 /* WKObjCTypeWrapperRef.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObjCTypeWrapperRef.mm; sourceTree = "<group>"; };
7CD5EBB71746A15B000C1C45 /* WKObjCTypeWrapperRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKObjCTypeWrapperRef.h; sourceTree = "<group>"; };
@@ -4652,6 +4656,8 @@
005D158E18E4C4EB00734619 /* _WKFindDelegate.h */,
1A43E828188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h */,
1A43E827188F3CDC009E4D30 /* _WKProcessPoolConfiguration.mm */,
+ 1A7E376C18E3CA57003D0FFF /* _WKScriptWorld.h */,
+ 1A7E376B18E3CA57003D0FFF /* _WKScriptWorld.mm */,
2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */,
2D6B371A18A967AD0042AE80 /* _WKThumbnailView.mm */,
2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */,
@@ -4692,12 +4698,12 @@
1A7E377718E4A4FE003D0FFF /* WKScriptMessage.h */,
1A7E377618E4A4FE003D0FFF /* WKScriptMessage.mm */,
1A7E377418E4A33A003D0FFF /* WKScriptMessageHandler.h */,
- 1A7E376C18E3CA57003D0FFF /* WKScriptWorld.h */,
- 1A7E376B18E3CA57003D0FFF /* WKScriptWorld.mm */,
+ 7CC99A3518EF7CBC0048C8B4 /* WKScriptMessagePrivate.h */,
1AD8790918B6C38A006CAFD7 /* WKUIDelegate.h */,
3743925718BC4C60001C8675 /* WKUIDelegatePrivate.h */,
1AFA3AC718E61C61003CCBAE /* WKUserContentController.h */,
1AFA3AC618E61C61003CCBAE /* WKUserContentController.mm */,
+ 7CC99A3318EF7B120048C8B4 /* WKUserContentControllerPrivate.h */,
1A3CC16518906ACF001E6ED8 /* WKWebView.h */,
1A3CC16418906ACF001E6ED8 /* WKWebView.mm */,
1ADF59191890528E0043C145 /* WKWebViewConfiguration.h */,
@@ -6677,7 +6683,7 @@
371B32DE184D67490013E2B2 /* WKNSURLProtectionSpace.h in Headers */,
2984F589164BA095004BC0C6 /* CustomProtocolManagerMessages.h in Headers */,
C5FA1ED318E1062200B3F402 /* WKAirPlayRoutePicker.h in Headers */,
- 1A7E376E18E3CA57003D0FFF /* WKScriptWorld.h in Headers */,
+ 1A7E376E18E3CA57003D0FFF /* _WKScriptWorld.h in Headers */,
29AD3093164B4C5D0072DEA9 /* CustomProtocolManagerProxy.h in Headers */,
2984F57D164B915F004BC0C6 /* CustomProtocolManagerProxyMessages.h in Headers */,
518353DF1887128B00D9FE44 /* KeyedDecoder.h in Headers */,
@@ -6776,6 +6782,7 @@
1A2328FF162C866A00D82F7A /* MessageEncoder.h in Headers */,
1AC4C82916B876A90069DCCD /* MessageFlags.h in Headers */,
1AE00D6C18327C1200087DD7 /* StringReference.h in Headers */,
+ 7CC99A3618EF7CBC0048C8B4 /* WKScriptMessagePrivate.h in Headers */,
1A3EED12161A53D600AEB4F5 /* MessageReceiver.h in Headers */,
1A3EED0F161A535400AEB4F5 /* MessageReceiverMap.h in Headers */,
C0E3AA7C1209E83C00A49D01 /* Module.h in Headers */,
@@ -7151,6 +7158,7 @@
BCE2315D122C30CA00D5C35A /* APIURLRequest.h in Headers */,
BC90A1D2122DD55E00CC8C50 /* APIURLResponse.h in Headers */,
F6113E25126CE1820057D0A7 /* WebUserContentURLPattern.h in Headers */,
+ 7CC99A3418EF7B120048C8B4 /* WKUserContentControllerPrivate.h in Headers */,
29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h in Headers */,
BCDDB32D124EC2E10048D13C /* WKAPICast.h in Headers */,
512E34E5130B4D0500ABD19A /* WKApplicationCacheManager.h in Headers */,
@@ -8647,7 +8655,7 @@
BC407628124FF0400068F20A /* WKCertificateInfoMac.mm in Sources */,
515E7727183DD6F60007203F /* AsyncRequest.cpp in Sources */,
BCA284D61492F2C7001F9042 /* WKConnection.mm in Sources */,
- 1A7E376D18E3CA57003D0FFF /* WKScriptWorld.mm in Sources */,
+ 1A7E376D18E3CA57003D0FFF /* _WKScriptWorld.mm in Sources */,
0F0C365818C051BA00F607D7 /* RemoteLayerTreeHostIOS.mm in Sources */,
0F0C365C18C05CA100F607D7 /* RemoteScrollingCoordinatorProxyIOS.mm in Sources */,
BC4A6296147313A0006C681A /* WKConnectionRef.cpp in Sources */,