Title: [255998] trunk
Revision
255998
Author
beid...@apple.com
Date
2020-02-06 18:26:36 -0800 (Thu, 06 Feb 2020)

Log Message

Cleanup and promote WKContentWorld and its clients in WKWebView.
https://bugs.webkit.org/show_bug.cgi?id=207351

Reviewed by Alex Christensen.

Source/WebKit:

Renames and updated comments.

API tests updated.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):

* SourcesCocoa.txt:

* UIProcess/API/Cocoa/WKContentWorld.h: Renamed from Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.h.
* UIProcess/API/Cocoa/WKContentWorld.mm: Renamed from Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.mm.
(+[WKContentWorld pageWorld]):
(+[WKContentWorld defaultClientWorld]):
(+[WKContentWorld worldWithName:]):
(-[WKContentWorld dealloc]):
(-[WKContentWorld name]):
(-[WKContentWorld _apiObject]):
* UIProcess/API/Cocoa/WKContentWorldInternal.h: Renamed from Source/WebKit/UIProcess/API/Cocoa/_WKContentWorldInternal.h.

* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView evaluateJavaScript:completionHandler:]):
(-[WKWebView evaluateJavaScript:inContentWorld:completionHandler:]):
(-[WKWebView callAsyncJavaScript:arguments:inContentWorld:completionHandler:]):
(-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:completionHandler:inWorld:]):
(-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]):
(-[WKWebView _callAsyncJavaScriptFunction:withArguments:inWorld:completionHandler:]): Deleted.
(-[WKWebView _evaluateJavaScript:inWorld:completionHandler:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

* WebKit.xcodeproj/project.pbxproj:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm:
(TEST):
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[WKWebView objectByCallingAsyncFunction:withArguments:error:]):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (255997 => 255998)


--- trunk/Source/WebKit/ChangeLog	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/ChangeLog	2020-02-07 02:26:36 UTC (rev 255998)
@@ -1,3 +1,42 @@
+2020-02-06  Brady Eidson  <beid...@apple.com>
+
+        Cleanup and promote WKContentWorld and its clients in WKWebView.
+        https://bugs.webkit.org/show_bug.cgi?id=207351
+
+        Reviewed by Alex Christensen.
+
+        Renames and updated comments.
+        
+        API tests updated.
+
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject):
+
+        * SourcesCocoa.txt:
+
+        * UIProcess/API/Cocoa/WKContentWorld.h: Renamed from Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.h.
+        * UIProcess/API/Cocoa/WKContentWorld.mm: Renamed from Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.mm.
+        (+[WKContentWorld pageWorld]):
+        (+[WKContentWorld defaultClientWorld]):
+        (+[WKContentWorld worldWithName:]):
+        (-[WKContentWorld dealloc]):
+        (-[WKContentWorld name]):
+        (-[WKContentWorld _apiObject]):
+        * UIProcess/API/Cocoa/WKContentWorldInternal.h: Renamed from Source/WebKit/UIProcess/API/Cocoa/_WKContentWorldInternal.h.
+
+        * UIProcess/API/Cocoa/WKWebView.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView evaluateJavaScript:completionHandler:]):
+        (-[WKWebView evaluateJavaScript:inContentWorld:completionHandler:]):
+        (-[WKWebView callAsyncJavaScript:arguments:inContentWorld:completionHandler:]):
+        (-[WKWebView _evaluateJavaScript:asAsyncFunction:withArguments:forceUserGesture:completionHandler:inWorld:]):
+        (-[WKWebView _evaluateJavaScriptWithoutUserGesture:completionHandler:]):
+        (-[WKWebView _callAsyncJavaScriptFunction:withArguments:inWorld:completionHandler:]): Deleted.
+        (-[WKWebView _evaluateJavaScript:inWorld:completionHandler:]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
+        * WebKit.xcodeproj/project.pbxproj:
+
 2020-02-06  Fujii Hironori  <hironori.fu...@sony.com>
 
         [Win][MiniBrowser] Accelerator keys don't work unless the main window is focused

Modified: trunk/Source/WebKit/Shared/Cocoa/APIObject.mm (255997 => 255998)


--- trunk/Source/WebKit/Shared/Cocoa/APIObject.mm	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/Shared/Cocoa/APIObject.mm	2020-02-07 02:26:36 UTC (rev 255998)
@@ -33,6 +33,7 @@
 #import "WKConnectionInternal.h"
 #import "WKContentRuleListInternal.h"
 #import "WKContentRuleListStoreInternal.h"
+#import "WKContentWorldInternal.h"
 #import "WKContextMenuElementInfoInternal.h"
 #import "WKFrameInfoInternal.h"
 #import "WKHTTPCookieStoreInternal.h"
@@ -71,7 +72,6 @@
 #import "_WKAttachmentInternal.h"
 #import "_WKAutomationSessionInternal.h"
 #import "_WKContentRuleListActionInternal.h"
-#import "_WKContentWorldInternal.h"
 #import "_WKCustomHeaderFieldsInternal.h"
 #import "_WKDownloadInternal.h"
 #import "_WKExperimentalFeatureInternal.h"
@@ -348,7 +348,7 @@
         break;
 
     case Type::ContentWorld:
-        wrapper = [_WKContentWorld alloc];
+        wrapper = [WKContentWorld alloc];
         break;
 
     case Type::UserContentWorld:

Modified: trunk/Source/WebKit/SourcesCocoa.txt (255997 => 255998)


--- trunk/Source/WebKit/SourcesCocoa.txt	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2020-02-07 02:26:36 UTC (rev 255998)
@@ -295,6 +295,7 @@
 UIProcess/API/Cocoa/WKConnection.mm
 UIProcess/API/Cocoa/WKContentRuleList.mm
 UIProcess/API/Cocoa/WKContentRuleListStore.mm
+UIProcess/API/Cocoa/WKContentWorld.mm
 UIProcess/API/Cocoa/WKContextMenuElementInfo.mm
 UIProcess/API/Cocoa/WKError.mm
 UIProcess/API/Cocoa/WKFindConfiguration.mm

Added: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorld.h (0 => 255998)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorld.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorld.h	2020-02-07 02:26:36 UTC (rev 255998)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2020 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 <WebKit/WKFoundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/*! @abstract A WKContentWorld object allows you to seperate your application's interaction with content displayed in a WKWebView into different roles that cannot interfere with one another.
+@discussion WKContentWorld objects should be treated as namespaces. This is useful for keeping your application's web content environment separate from the environment of the web page content itself,
+as well as managing multiple different environments within your own application.
+For example:
+- If you have complex scripting logic to bridge your web content to your application but your web content also has complex scripting libraries of its own,
+  you avoid possible conflicts by using a client WKContentWorld.
+- If you are writing a general purpose web browser that supports _javascript_ extensions, you would use a different client WKContentWorld for each extension.
+
+Since a WKContentWorld object is a namespace it does not contain any data itself.
+For example:
+- If you store a variable in _javascript_ in the scope of a particular WKContentWorld while viewing a particular web page document, after navigating to a new document that variable will be gone.
+- If you store a variable in _javascript_ in the scope of a particular WKContentWorld in one WKWebView, that variable will not exist in the same world in another WKWebView.
+*/
+WK_CLASS_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA))
+@interface WKContentWorld : NSObject
+
++ (instancetype)new NS_UNAVAILABLE;
+- (instancetype)init NS_UNAVAILABLE;
+
+/*! @abstract Retrieve the main world that page content itself uses.
+@discussion When interacting with page content in a WKWebView using the page content world you can disrupt the operation of page content (e.g. by conflicting with variable names in _javascript_ set by the web page content itself).
+*/
+@property (class, nonatomic, readonly) WKContentWorld *pageWorld;
+
+/*! @abstract Retrieve the default world for API client use.
+@discussion When using a content world different from the page content world you can still manipulate the DOM and built-in DOM APIs but without conflicting with other aspects of the page content (e.g. _javascript_ from the web page content itself)
+Repeated calls will retrieve the same WKContentWorld instance.
+*/
+@property (class, nonatomic, readonly) WKContentWorld *defaultClientWorld;
+
+/*! @abstract Retrieves a named content world for API client use.
+@param name The name of the WKContentWorld to retrieve.
+@discussion When using a content world different from the page content world you can still manipulate the DOM and built-in DOM APIs but without conflicting with other aspects of the page content (e.g. _javascript_ from the web page content itself)
+As long as a particular named WKContentWorld instance has not been deallocated, repeated calls with the same name will retrieve that same WKContentWorld instance.
+Each named content world is distinct from all other named content worlds, the defaultClientWorld, and the pageWorld.
+The name can be used to keep distinct worlds identifiable anywhere a world might be surfaced in a user interface. For example, the different worlds used in your application will be surfaced by name in the WebKit Web Inspector.
+*/
++ (WKContentWorld *)worldWithName:(NSString *)name NS_REFINED_FOR_SWIFT;
+
+/*! @abstract The name of the WKContentWorld
+@discussion The pageWorld and defaultClientWorld instances will have a nil name.
+All other instances will have the non-nil name they were accessed by.
+*/
+@property (nullable, nonatomic, readonly, copy) NSString *name;
+
+@end
+
+NS_ASSUME_NONNULL_END

Copied: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorld.mm (from rev 255997, trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.mm) (0 => 255998)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorld.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorld.mm	2020-02-07 02:26:36 UTC (rev 255998)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2020 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 "WKContentWorldInternal.h"
+
+@implementation WKContentWorld
+
++ (WKContentWorld *)pageWorld
+{
+    return wrapper(API::ContentWorld::pageContentWorld());
+}
+
++ (WKContentWorld *)defaultClientWorld
+{
+    return wrapper(API::ContentWorld::defaultClientWorld());
+}
+
++ (WKContentWorld *)worldWithName:(NSString *)name
+{
+    return wrapper(API::ContentWorld::sharedWorldWithName(name));
+}
+
+- (void)dealloc
+{
+    _contentWorld->~ContentWorld();
+
+    [super dealloc];
+}
+
+- (NSString *)name
+{
+    if (_contentWorld->name().isNull())
+        return nil;
+
+    return _contentWorld->name();
+}
+
+#pragma mark WKObject protocol implementation
+
+- (API::Object&)_apiObject
+{
+    return *_contentWorld;
+}
+
+@end

Copied: trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorldInternal.h (from rev 255997, trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorldInternal.h) (0 => 255998)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorldInternal.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKContentWorldInternal.h	2020-02-07 02:26:36 UTC (rev 255998)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2020 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 "WKContentWorld.h"
+
+#import "APIContentWorld.h"
+#import "WKObject.h"
+#import <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+template<> struct WrapperTraits<API::ContentWorld> {
+    using WrapperClass = WKContentWorld;
+};
+
+}
+
+@interface WKContentWorld () <WKObject> {
+@package
+    API::ObjectStorage<API::ContentWorld> _contentWorld;
+}
+@end

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h (255997 => 255998)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.h	2020-02-07 02:26:36 UTC (rev 255998)
@@ -35,6 +35,7 @@
 
 @class WKBackForwardList;
 @class WKBackForwardListItem;
+@class WKContentWorld;
 @class WKFindConfiguration;
 @class WKFindResult;
 @class WKNavigation;
@@ -222,6 +223,72 @@
 */
 - (void)evaluateJavaScript:(NSString *)_javascript_String completionHandler:(void (^ _Nullable)(_Nullable id, NSError * _Nullable error))completionHandler;
 
+/* @abstract Evaluates the given _javascript_ string.
+ @param _javascript_String The _javascript_ string to evaluate.
+ @param contentWorld The WKContentWorld in which to evaluate the _javascript_ string.
+ @param completionHandler A block to invoke when script evaluation completes or fails.
+ @discussion The completionHandler is passed the result of the script evaluation or an error.
+ No matter which WKContentWorld you use to evaluate your _javascript_ string, you can make changes to the underlying web content. (e.g. the Document and its DOM structure)
+ Such changes will be visible to script executing in all WKContentWorlds.
+ Evaluating your _javascript_ string can leave behind other changes to global state visibile to _javascript_. (e.g. `window.myVariable = 1;`)
+ Those changes will only be visibile to scripts executed in the same WKContentWorld.
+ evaluateJavaScript: is a great way to set up global state for future _javascript_ execution in a given world. (e.g. Importing libraries/utilities that future _javascript_ execution will rely on)
+ Once your global state is set up, consider using callAsyncJavaScriptFunction: for more flexible interaction with the _javascript_ programming model.
+*/
+- (void)evaluateJavaScript:(NSString *)_javascript_String inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^ _Nullable)(_Nullable id, NSError * _Nullable error))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
+/* @abstract Calls the given _javascript_ string as an async _javascript_ function, passing the given named arguments to that function.
+ @param functionBody The _javascript_ string to use as the function body.
+ @param arguments A dictionary representing the arguments to be passed to the function call.
+ @param contentWorld The WKContentWorld in which to call the _javascript_ function.
+ @param completionHandler A block to invoke with the return value of the function call, or with the asynchronous resolution of the function's return value.
+ @discussion The functionBody string is treated as an anonymous _javascript_ function body that can be called with named arguments.
+ Do not format your string as one of the variants of function call available in _javascript_.
+ Instead pass in a _javascript_ string representing the function body, formatted for evaluation.
+ For example do not pass in the string:
+     function(x, y, z) { return x ? y : z; }
+ Instead pass in the string:
+     return x ? y : z;
+
+ The arguments dictionary supplies the values for those arguments which are serialized into _javascript_ equivalents.
+ For example:
+     @{ @"x" : @YES, @"y" : @1, @"z" : @"hello world" };
+
+ Combining the above arguments dictionary with the above functionBody string, a function with the arguments named "x", "y", and "z" is called with values YES, 1, and "hello world" respectively.
+
+ Allowed argument types are:
+ NSNumber, NSString, NSDate, NSArray, NSDictionary, and NSNull.
+ Any NSArray or NSDictionary containers can only contain objects of those types.
+
+ No matter which WKContentWorld you use to call your _javascript_ function, you can make changes to the underlying web content. (e.g. the Document and its DOM structure)
+ Such changes will be visible to script executing in all WKContentWorlds.
+ Calling your _javascript_ function can leave behind other changes to global state visibile to _javascript_. (e.g. `window.myVariable = 1;`)
+ Those changes will only be visibile to scripts executed in the same WKContentWorld.
+
+ Your completion handler will be called with the explicit return value of your _javascript_ function.
+ If your _javascript_ does not explicitly return any value, that undefined result manifests as nil being passed to your completion handler.
+ If your _javascript_ returns null, that result manifests as NSNull being passed to your completion handler.
+
+ _javascript_ has the concept of a "thenable" object, which is any _javascript_ object that has a callable "then" property.
+ The most well known example of a "thenable" object is a _javascript_ promise.
+ If your _javascript_ returns a "thenable" object WebKit will call "then" on the resulting object and wait for it to be resolved.
+
+ If the object resolves successfully (e.g. Calls the "fulfill" function) your completion handler will be called with the result.
+ If the object rejects (e.g. Calls the "reject" function) your completion handler will be called with a WKErrorJavaScriptAsyncFunctionResultRejected error containing the reject reason in the userInfo dictionary.
+ If the object is garbage collected before it is resolved, your completion handler will be called with a WKErrorJavaScriptAsyncFunctionResultUnreachable error indicating that it will never be resolved.
+
+ Since the function is a _javascript_ "async" function you can use _javascript_ "await" on thenable objects inside your function body.
+ For example:
+     var p = new Promise(function (f) {
+         window.setTimeout("f(42)", 1000);
+     });
+     await p;
+     return p;
+
+ The above function text will create a promise that will fulfull with the value 42 after a one second delay, wait for it to resolve, then return the fulfillment value of 42.
+*/
+- (void)callAsyncJavaScript:(NSString *)functionBody arguments:(nullable NSDictionary<NSString *, id> *)arguments inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^ _Nullable)(_Nullable id, NSError * _Nullable error))completionHandler NS_REFINED_FOR_SWIFT WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 /*! @abstract Get a snapshot for the visible viewport of WKWebView.
  @param snapshotConfiguration An object that specifies how the snapshot is configured.
  @param completionHandler A block to invoke when the snapshot is ready.

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (255997 => 255998)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2020-02-07 02:26:36 UTC (rev 255998)
@@ -55,6 +55,7 @@
 #import "WKBackForwardListInternal.h"
 #import "WKBackForwardListItemInternal.h"
 #import "WKBrowsingContextHandleInternal.h"
+#import "WKContentWorldInternal.h"
 #import "WKErrorInternal.h"
 #import "WKFindConfiguration.h"
 #import "WKFindResultInternal.h"
@@ -91,7 +92,6 @@
 #import "WebURLSchemeHandlerCocoa.h"
 #import "WebViewImpl.h"
 #import "_WKActivatedElementInfoInternal.h"
-#import "_WKContentWorldInternal.h"
 #import "_WKDiagnosticLoggingDelegate.h"
 #import "_WKFindDelegate.h"
 #import "_WKFrameHandleInternal.h"
@@ -817,9 +817,19 @@
 
 - (void)evaluateJavaScript:(NSString *)_javascript_String completionHandler:(void (^)(id, NSError *))completionHandler
 {
-    [self _evaluateJavaScript:_javascript_String asAsyncFunction:NO withArguments:nil forceUserGesture:YES completionHandler:completionHandler inWorld:_WKContentWorld.pageContentWorld];
+    [self _evaluateJavaScript:_javascript_String asAsyncFunction:NO withArguments:nil forceUserGesture:YES completionHandler:completionHandler inWorld:WKContentWorld.pageWorld];
 }
 
+- (void)evaluateJavaScript:(NSString *)_javascript_String inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *))completionHandler
+{
+    [self _evaluateJavaScript:_javascript_String asAsyncFunction:NO withArguments:nil forceUserGesture:YES completionHandler:completionHandler inWorld:contentWorld];
+}
+
+- (void)callAsyncJavaScript:(NSString *)_javascript_String arguments:(NSDictionary<NSString *, id> *)arguments inContentWorld:(WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *error))completionHandler
+{
+    [self _evaluateJavaScript:_javascript_String asAsyncFunction:YES withArguments:arguments forceUserGesture:YES completionHandler:completionHandler inWorld:contentWorld];
+}
+
 static bool validateArgument(id argument)
 {
     if ([argument isKindOfClass:[NSString class]] || [argument isKindOfClass:[NSNumber class]] || [argument isKindOfClass:[NSDate class]] || [argument isKindOfClass:[NSNull class]])
@@ -854,7 +864,7 @@
     return false;
 }
 
-- (void)_evaluateJavaScript:(NSString *)_javascript_String asAsyncFunction:(BOOL)asAsyncFunction withArguments:(NSDictionary<NSString *, id> *)arguments forceUserGesture:(BOOL)forceUserGesture completionHandler:(void (^)(id, NSError *))completionHandler inWorld:(_WKContentWorld *)world
+- (void)_evaluateJavaScript:(NSString *)_javascript_String asAsyncFunction:(BOOL)asAsyncFunction withArguments:(NSDictionary<NSString *, id> *)arguments forceUserGesture:(BOOL)forceUserGesture completionHandler:(void (^)(id, NSError *))completionHandler inWorld:(WKContentWorld *)world
 {
     auto handler = adoptNS([completionHandler copy]);
 
@@ -1507,16 +1517,6 @@
 
 #pragma mark - macOS/iOS WKPrivate
 
-- (void)_callAsyncJavaScriptFunction:(NSString *)_javascript_String withArguments:(NSDictionary<NSString *, id> *)arguments inWorld:(_WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *error))completionHandler
-{
-    [self _evaluateJavaScript:_javascript_String asAsyncFunction:YES withArguments:arguments forceUserGesture:YES completionHandler:completionHandler inWorld:contentWorld];
-}
-
-- (void)_evaluateJavaScript:(NSString *)_javascript_String inWorld:(_WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *))completionHandler
-{
-    [self _evaluateJavaScript:_javascript_String asAsyncFunction:NO withArguments:nil forceUserGesture:YES completionHandler:completionHandler inWorld:contentWorld];
-}
-
 - (_WKSelectionAttributes)_selectionAttributes
 {
     return _selectionAttributes;
@@ -2157,7 +2157,7 @@
 
 - (void)_evaluateJavaScriptWithoutUserGesture:(NSString *)_javascript_String completionHandler:(void (^)(id, NSError *))completionHandler
 {
-    [self _evaluateJavaScript:_javascript_String asAsyncFunction:NO withArguments:nil forceUserGesture:NO completionHandler:completionHandler inWorld:_WKContentWorld.pageContentWorld];
+    [self _evaluateJavaScript:_javascript_String asAsyncFunction:NO withArguments:nil forceUserGesture:NO completionHandler:completionHandler inWorld:WKContentWorld.pageWorld];
 }
 
 - (void)_updateWebsitePolicies:(_WKWebsitePolicies *)websitePolicies

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (255997 => 255998)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2020-02-07 02:26:36 UTC (rev 255998)
@@ -106,7 +106,6 @@
 @class WKBrowsingContextHandle;
 @class WKWebpagePreferences;
 @class _WKApplicationManifest;
-@class _WKContentWorld;
 @class _WKFrameHandle;
 @class _WKHitTestResult;
 @class _WKInspector;
@@ -327,73 +326,6 @@
 - (void)_focusTextInputContext:(_WKTextInputContext *)textInputElement completionHandler:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(macos(10.15), ios(13.0));
 
 - (void)_takePDFSnapshotWithConfiguration:(WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(NSData *pdfSnapshotData, NSError *error))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
-
-/* @abstract Calls the given _javascript_ string as a function, passing the given named arguments to that function.
- @param _javascript_String The _javascript_ string to call as a function.
- @param arguments A dictionary representing the arguments to be passed to the function call.
- @param contentWorld The WKContentWorld in which to call the _javascript_ function.
- @param completionHandler A block to invoke with the return value of the function call, or with the asynchronous resolution of the function's return value.
- @discussion The _javascript_ string is treated as an anonymous _javascript_ function that can be called with named arguments.
- Do not format your string as one of the variants of function call available in _javascript_.
- Instead pass in a _javascript_ string representing the function text, formatted for evaluation.
- For example do not pass in the string:
-     function(x, y, z) { return x ? y : z; }
- Instead pass in the string:
-     return x ? y : z;
-
- The arguments dictionary supplies the values for those arguments which are serialized into _javascript_ equivalents.
- For example:
-     @{ @"x" : @YES, @"y" : @1, @"z" : @2 };
-
- Combining the above arguments dictionary with the above _javascript_ string, a function with the arguments "x", "y", and "z" is called with values YES, 1, and 2 respectively.
-
- Allowed argument types are:
- NSNumber, NSString, NSDate, NSArray, NSDictionary, and NSNull.
- Any NSArray or NSDictionary containers can only contain objects of those types.
-
- No matter which WKContentWorld you use to call your _javascript_ function, you can make changes to the underlying web content. (e.g. the Document and its DOM structure)
- Such changes will be visible to script executing in all WKContentWorlds.
- Calling your _javascript_ function can leave behind other changes to global state visibile to _javascript_. (e.g. `window.myVariable = 1;`)
- Those changes will only be visibile to scripts executed in the same WKContentWorld.
-
- Your completion handler will be called with the return value of your _javascript_ function.
- If your _javascript_ does not explicitly return any value, that undefined result manifests as nil being passed to your completion handler.
- If your _javascript_ returns null, that result manifests as NSNull being passed to your completion handler.
-
- _javascript_ has the concept of a "thenable" object, which is any _javascript_ object that has a callable "then" property.
- The most well known example of a "thenable" object is a _javascript_ promise.
- If your _javascript_ returns a "thenable" object WebKit will call "then" on the resulting object and wait for it to be resolved.
-
- If the object calls "fulfill", your completion handler will be called with the result.
- If the object calls "reject", your completion handler will be called with a WKErrorJavaScriptAsyncFunctionResultRejected error containing the reject reason in the userInfo dictionary.
- If the object is garbage collected before it is resolved, your completion handler will be called with an error indicating that it will never be resolved.
-
- Since the function is a _javascript_ "async" function you can use _javascript_ "await" on those objects inside your function text.
- For example:
-     var p = new Promise(function (r) {
-         r(42);
-     });
-     await p;
-     return p;
-
- The above function text will create a promise that will fulfull with the value 42, wait for it to resolve, then return the fulfillment value of 42.
-*/
-- (void)_callAsyncJavaScriptFunction:(NSString *)_javascript_String withArguments:(NSDictionary<NSString *, id> *)arguments inWorld:(_WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *error))completionHandler;
-
-/* @abstract Evaluates the given _javascript_ string.
- @param _javascript_String The _javascript_ string to evaluate.
- @param contentWorld The WKContentWorld in which to evaluate the _javascript_ string.
- @param completionHandler A block to invoke when script evaluation completes or fails.
- @discussion The completionHandler is passed the result of the script evaluation or an error.
- No matter which WKContentWorld you use to evaluate your _javascript_ string, you can make changes to the underlying web content. (e.g. the Document and its DOM structure)
- Such changes will be visible to script executing in all WKContentWorlds.
- Evaluating your _javascript_ string can leave behind other changes to global state visibile to _javascript_. (e.g. `window.myVariable = 1;`)
- Those changes will only be visibile to scripts executed in the same WKContentWorld.
- evaluateJavaScript: is the best way to set up global state for future _javascript_ execution in a given world. (e.g. Importing libraries/utilities that future _javascript_ execution will rely on)
- Once your global state is set up, consider using callAsyncJavaScriptFunction: for more flexible interaction with the _javascript_ programming model.
-*/
-- (void)_evaluateJavaScript:(NSString *)_javascript_String inWorld:(_WKContentWorld *)contentWorld completionHandler:(void (^)(id, NSError *error))completionHandler;
-
 @end
 
 #if TARGET_OS_IPHONE

Deleted: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.h (255997 => 255998)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.h	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.h	2020-02-07 02:26:36 UTC (rev 255998)
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2020 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 <WebKit/WKFoundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/*!
-A WKContentWorld object allows you to seperate your application's interaction with content displayed in a WKWebView into different roles that cannot interfere with one another.
-*/
-WK_CLASS_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA))
-@interface _WKContentWorld : NSObject
-
-+ (instancetype)new NS_UNAVAILABLE;
-- (instancetype)init NS_UNAVAILABLE;
-
-/*! @abstract Retrieve the main world that page content itself uses.
- @discussion When interacting with page content in a WKWebView using the page content world you can disrupt the operation of page content (e.g. by conflicting with variable names in _javascript_ set by the web page content itself).
-*/
-@property (class, nonatomic, readonly) _WKContentWorld *pageContentWorld;
-
-/*! @abstract Retrieve the default non-page content world for API clients.
- @discussion Interacting with page content in a WKWebView using a content world different from the page content world enables using DOM and built-in DOM APIs
- without conflicting with other aspects of the page content (e.g. _javascript_ from the web page content itself)
-*/
-@property (class, nonatomic, readonly) _WKContentWorld *defaultClientWorld;
-
-/*! @abstract Retrieves a named content world for API users.
- @param name The name of the WKContentWorld to retrieve.
- @discussion By interacting with page content in a WKWebView using a non-main content world you can interact with the DOM and built-in DOM APIs
- without conflicting with other aspects of the page content (e.g. _javascript_ from the web content itself)
- Repeated calls with the same name will retrieve the same WKContentWorld instance.
- Each named content world is distinct from all other named content worlds, the defaultClientWorld, and the pageContentWorld.
- The name can be used to keep distinct worlds identifiable anywhere a world might be surfaced in a user interface.
- For example, the different worlds used in your application will be surfaced by name in the WebKit Web Inspector.
-*/
-+ (_WKContentWorld *)worldWithName:(NSString *)name NS_REFINED_FOR_SWIFT;
-
-/*! @abstract The name of the WKContentWorld
- @discussion The pageContentWorld and defaultClientWorld instances will have a nil name.
- All other instances will have the non-nil name they were accessed by.
-*/
-@property (nullable, nonatomic, readonly, copy) NSString *name;
-
-@end
-
-NS_ASSUME_NONNULL_END

Deleted: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.mm (255997 => 255998)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.mm	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorld.mm	2020-02-07 02:26:36 UTC (rev 255998)
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2020 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 "_WKContentWorldInternal.h"
-
-@implementation _WKContentWorld
-
-+ (_WKContentWorld *)pageContentWorld
-{
-    return wrapper(API::ContentWorld::pageContentWorld());
-}
-
-+ (_WKContentWorld *)defaultClientWorld
-{
-    return wrapper(API::ContentWorld::defaultClientWorld());
-}
-
-+ (_WKContentWorld *)worldWithName:(NSString *)name
-{
-    return wrapper(API::ContentWorld::sharedWorldWithName(name));
-}
-
-- (void)dealloc
-{
-    _contentWorld->~ContentWorld();
-
-    [super dealloc];
-}
-
-- (NSString *)name
-{
-    if (_contentWorld->name().isNull())
-        return nil;
-
-    return _contentWorld->name();
-}
-
-#pragma mark WKObject protocol implementation
-
-- (API::Object&)_apiObject
-{
-    return *_contentWorld;
-}
-
-@end

Deleted: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorldInternal.h (255997 => 255998)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorldInternal.h	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKContentWorldInternal.h	2020-02-07 02:26:36 UTC (rev 255998)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2020 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 "_WKContentWorld.h"
-
-#import "APIContentWorld.h"
-#import "WKObject.h"
-#import <wtf/text/WTFString.h>
-
-namespace WebKit {
-
-template<> struct WrapperTraits<API::ContentWorld> {
-    using WrapperClass = _WKContentWorld;
-};
-
-}
-
-@interface _WKContentWorld () <WKObject> {
-@package
-    API::ObjectStorage<API::ContentWorld> _contentWorld;
-}
-@end

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (255997 => 255998)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-02-07 02:26:36 UTC (rev 255998)
@@ -973,6 +973,8 @@
 		510F59101DDE296900412FF5 /* _WKIconLoadingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5143B25E1DDCDFD10014FAC6 /* _WKIconLoadingDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		510F59111DDE297000412FF5 /* _WKLinkIconParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C0C9791DDD78540032CAD3 /* _WKLinkIconParameters.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		510FBB9B1288C95E00AFFDF4 /* WebContextMenuItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = 510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */; };
+		511065FC23EC9572005443D6 /* WKContentWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = 511065FA23EC956B005443D6 /* WKContentWorld.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		511065FD23EC957B005443D6 /* WKContentWorldInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 511065FB23EC956B005443D6 /* WKContentWorldInternal.h */; };
 		5110AE0D133C16CB0072717A /* WKIconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5110AE0B133C16CB0072717A /* WKIconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		511F7D411EB1BCF500E47B83 /* WebsiteDataStoreParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F7D401EB1BCEE00E47B83 /* WebsiteDataStoreParameters.h */; };
 		511F8A7B138B460900A95F44 /* SecItemShimLibrary.h in Headers */ = {isa = PBXBuildFile; fileRef = 511F8A77138B460900A95F44 /* SecItemShimLibrary.h */; };
@@ -1032,9 +1034,6 @@
 		517CF0E3163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */; };
 		517CF0E3163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517CF0E1163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp */; };
 		517CF0E4163A486C00C2950E /* NetworkProcessConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */; };
-		5183721D23CE85F60003CF83 /* _WKContentWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = 5183721A23CD49B20003CF83 /* _WKContentWorld.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		5183721E23CE85FB0003CF83 /* _WKContentWorldInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5183721C23CD4A740003CF83 /* _WKContentWorldInternal.h */; };
-		5183721F23CE95210003CF83 /* _WKContentWorld.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5183721B23CD49B20003CF83 /* _WKContentWorld.mm */; };
 		5183722223CE97410003CF83 /* APIContentWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = 5183722023CE973A0003CF83 /* APIContentWorld.h */; };
 		51871B5C127CB89D00F76232 /* WebContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 51871B5A127CB89D00F76232 /* WebContextMenu.h */; };
 		518ACAEA12AEE6BB00B04B83 /* WKProtectionSpaceTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 518ACAE912AEE6BB00B04B83 /* WKProtectionSpaceTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3535,6 +3534,9 @@
 		510CC7EB16138E7200D03ED3 /* NetworkProcessProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProcessProxy.h; sourceTree = "<group>"; };
 		510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebContextMenuItemData.cpp; sourceTree = "<group>"; };
 		510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMenuItemData.h; sourceTree = "<group>"; };
+		511065F923EC956B005443D6 /* WKContentWorld.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentWorld.mm; sourceTree = "<group>"; };
+		511065FA23EC956B005443D6 /* WKContentWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentWorld.h; sourceTree = "<group>"; };
+		511065FB23EC956B005443D6 /* WKContentWorldInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContentWorldInternal.h; sourceTree = "<group>"; };
 		5110AE0A133C16CB0072717A /* WKIconDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKIconDatabase.cpp; sourceTree = "<group>"; };
 		5110AE0B133C16CB0072717A /* WKIconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKIconDatabase.h; sourceTree = "<group>"; };
 		5118E9A21F295963003EF9F5 /* StorageProcessProxyMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StorageProcessProxyMessages.h; path = DerivedSources/WebKit2/StorageProcessProxyMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -3641,9 +3643,6 @@
 		517CF0E1163A486C00C2950E /* NetworkProcessConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkProcessConnectionMessageReceiver.cpp; path = DerivedSources/WebKit2/NetworkProcessConnectionMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
 		517CF0E1163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CacheStorageEngineConnectionMessageReceiver.cpp; path = DerivedSources/WebKit2/CacheStorageEngineConnectionMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
 		517CF0E2163A486C00C2950E /* NetworkProcessConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkProcessConnectionMessages.h; path = DerivedSources/WebKit2/NetworkProcessConnectionMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
-		5183721A23CD49B20003CF83 /* _WKContentWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKContentWorld.h; sourceTree = "<group>"; };
-		5183721B23CD49B20003CF83 /* _WKContentWorld.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKContentWorld.mm; sourceTree = "<group>"; };
-		5183721C23CD4A740003CF83 /* _WKContentWorldInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKContentWorldInternal.h; sourceTree = "<group>"; };
 		5183722023CE973A0003CF83 /* APIContentWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIContentWorld.h; sourceTree = "<group>"; };
 		5183722123CE973A0003CF83 /* APIContentWorld.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIContentWorld.cpp; sourceTree = "<group>"; };
 		5183B3931379F85C00E8754E /* Shim.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Shim.xcconfig; sourceTree = "<group>"; };
@@ -6814,9 +6813,6 @@
 				5C4609E222430E4C009943C2 /* _WKContentRuleListAction.h */,
 				5C4609E322430E4D009943C2 /* _WKContentRuleListAction.mm */,
 				5C4609E422430E4D009943C2 /* _WKContentRuleListActionInternal.h */,
-				5183721A23CD49B20003CF83 /* _WKContentWorld.h */,
-				5183721B23CD49B20003CF83 /* _WKContentWorld.mm */,
-				5183721C23CD4A740003CF83 /* _WKContentWorldInternal.h */,
 				1A5704F61BE01FF400874AF1 /* _WKContextMenuElementInfo.h */,
 				1A5704F51BE01FF400874AF1 /* _WKContextMenuElementInfo.mm */,
 				5C5D2389227A1892000B9BDA /* _WKCustomHeaderFields.h */,
@@ -6956,6 +6952,9 @@
 				5CD2864E1E722F440094FDC8 /* WKContentRuleListStore.mm */,
 				5CD2864F1E722F440094FDC8 /* WKContentRuleListStoreInternal.h */,
 				5CD286501E722F440094FDC8 /* WKContentRuleListStorePrivate.h */,
+				511065FA23EC956B005443D6 /* WKContentWorld.h */,
+				511065F923EC956B005443D6 /* WKContentWorld.mm */,
+				511065FB23EC956B005443D6 /* WKContentWorldInternal.h */,
 				5CE0C369229F2D4A003695F0 /* WKContextMenuElementInfo.h */,
 				5CE0C368229F2D4A003695F0 /* WKContextMenuElementInfo.mm */,
 				5CE0C36B229F2D4B003695F0 /* WKContextMenuElementInfoInternal.h */,
@@ -9973,8 +9972,6 @@
 				990D28B11C65208D00986977 /* _WKAutomationSessionInternal.h in Headers */,
 				5C4609E7224317B4009943C2 /* _WKContentRuleListAction.h in Headers */,
 				5C4609E8224317BB009943C2 /* _WKContentRuleListActionInternal.h in Headers */,
-				5183721D23CE85F60003CF83 /* _WKContentWorld.h in Headers */,
-				5183721E23CE85FB0003CF83 /* _WKContentWorldInternal.h in Headers */,
 				1A5704F81BE01FF400874AF1 /* _WKContextMenuElementInfo.h in Headers */,
 				5C5D238C227A2CDA000B9BDA /* _WKCustomHeaderFields.h in Headers */,
 				83891B691A68BEBC0030F386 /* _WKDiagnosticLoggingDelegate.h in Headers */,
@@ -10905,6 +10902,8 @@
 				0FCB4E4C18BBE044000FCFC9 /* WKContentView.h in Headers */,
 				0FCB4E6C18BBF26A000FCFC9 /* WKContentViewInteraction.h in Headers */,
 				0F04159E23C7CC730060A3E2 /* WKContentViewMac.h in Headers */,
+				511065FC23EC9572005443D6 /* WKContentWorld.h in Headers */,
+				511065FD23EC957B005443D6 /* WKContentWorldInternal.h in Headers */,
 				BCB9E24B1120E15C00A137E0 /* WKContext.h in Headers */,
 				1AE52F981920267200A1FA37 /* WKContextConfigurationRef.h in Headers */,
 				1A445BA5184D5FDA004B3414 /* WKContextConnectionClient.h in Headers */,
@@ -12061,7 +12060,6 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				5183721F23CE95210003CF83 /* _WKContentWorld.mm in Sources */,
 				5CBD595C2280EDF4002B22AA /* _WKCustomHeaderFields.mm in Sources */,
 				49FBEFFD239B011D00BD032F /* _WKResourceLoadStatisticsFirstParty.mm in Sources */,
 				49FBEFFF239B012F00BD032F /* _WKResourceLoadStatisticsThirdParty.mm in Sources */,

Modified: trunk/Tools/ChangeLog (255997 => 255998)


--- trunk/Tools/ChangeLog	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Tools/ChangeLog	2020-02-07 02:26:36 UTC (rev 255998)
@@ -1,3 +1,17 @@
+2020-02-06  Brady Eidson  <beid...@apple.com>
+
+        Cleanup and promote WKContentWorld and its clients in WKWebView.
+        https://bugs.webkit.org/show_bug.cgi?id=207351
+
+        Reviewed by Alex Christensen.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm:
+        (TEST):
+        * TestWebKitAPI/cocoa/TestWKWebView.mm:
+        (-[WKWebView objectByCallingAsyncFunction:withArguments:error:]):
+
 2020-02-06  Fujii Hironori  <hironori.fu...@sony.com>
 
         [Win][MiniBrowser] Accelerator keys don't work unless the main window is focused

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm (255997 => 255998)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm	2020-02-07 02:26:36 UTC (rev 255998)
@@ -28,9 +28,9 @@
 #import "PlatformUtilities.h"
 #import "Test.h"
 #import "TestWKWebView.h"
+#import <WebKit/WKContentWorld.h>
 #import <WebKit/WKProcessPoolPrivate.h>
 #import <WebKit/WKWebViewPrivate.h>
-#import <WebKit/_WKContentWorld.h>
 
 namespace TestWebKitAPI {
 
@@ -186,7 +186,7 @@
     NSString *functionBody = @"return new Promise(function(resolve, reject) { setTimeout(function(){ resolve(42) }, 0); })";
 
     bool done = false;
-    [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+    [webView callAsyncJavaScript:functionBody arguments:nil inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
         EXPECT_NULL(error);
         EXPECT_TRUE([result isKindOfClass:[NSNumber class]]);
         EXPECT_TRUE([result isEqualToNumber:@42]);
@@ -198,7 +198,7 @@
     functionBody = @"return new Promise(function(resolve, reject) { setTimeout(function(){ reject('Rejected!') }, 0); })";
 
     done = false;
-    [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+    [webView callAsyncJavaScript:functionBody arguments:nil inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
         EXPECT_NULL(result);
         EXPECT_TRUE(error != nil);
         EXPECT_TRUE([[error description] containsString:@"Rejected!"]);
@@ -209,7 +209,7 @@
     functionBody = @"let p = new Proxy(function(resolve, reject) { setTimeout(function() { resolve(42); }, 0); }, { }); return { then: p };";
 
     done = false;
-    [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+    [webView callAsyncJavaScript:functionBody arguments:nil inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
         EXPECT_NULL(error);
         EXPECT_TRUE([result isKindOfClass:[NSNumber class]]);
         EXPECT_TRUE([result isEqualToNumber:@42]);
@@ -220,7 +220,7 @@
     functionBody = @"let p = new Proxy(function(resolve, reject) { setTimeout(function() { reject('Rejected!'); }, 0); }, { }); return { then: p };";
 
     done = false;
-    [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+    [webView callAsyncJavaScript:functionBody arguments:nil inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
         EXPECT_NULL(result);
         EXPECT_TRUE(error != nil);
         EXPECT_TRUE([[error description] containsString:@"Rejected!"]);
@@ -232,7 +232,7 @@
     functionBody = @"var r = 0; var p = new Promise(function(fulfill, reject) { setTimeout(function(){ r = 42; fulfill(); }, 5);}); await p; return r;";
 
     done = false;
-    [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+    [webView callAsyncJavaScript:functionBody arguments:nil inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
         EXPECT_NULL(error);
         EXPECT_TRUE([result isKindOfClass:[NSNumber class]]);
         EXPECT_TRUE([result isEqualToNumber:@42]);
@@ -244,7 +244,7 @@
     functionBody = @"var p = new Promise(function(fulfill, reject) { setTimeout(function(){ fulfill('Fulfilled!') }, 5);}); await p; return p;";
 
     done = false;
-    [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+    [webView callAsyncJavaScript:functionBody arguments:nil inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
         EXPECT_NULL(error);
         EXPECT_TRUE([result isKindOfClass:[NSString class]]);
         EXPECT_TRUE([result isEqualToString:@"Fulfilled!"]);
@@ -256,7 +256,7 @@
     functionBody = @"var p = new Promise(function (r) { r(new Promise(function (r) { r(42); })); }); await p; return 'Done';";
 
     done = false;
-    [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+    [webView callAsyncJavaScript:functionBody arguments:nil inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
         EXPECT_NULL(error);
         EXPECT_TRUE([result isKindOfClass:[NSString class]]);
         EXPECT_TRUE([result isEqualToString:@"Done"]);
@@ -268,7 +268,7 @@
     done = false;
     functionBody = @"return new Promise(function(resolve, reject) { })";
     for (int i = 0; i < 500; ++i) {
-        [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+        [webView callAsyncJavaScript:functionBody arguments:nil inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
             EXPECT_NULL(result);
             EXPECT_TRUE(error != nil);
             EXPECT_TRUE([[error description] containsString:@"no longer reachable"]);

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm (255997 => 255998)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEvaluateJavaScript.mm	2020-02-07 02:26:36 UTC (rev 255998)
@@ -31,9 +31,9 @@
 #import "Test.h"
 #import "TestNavigationDelegate.h"
 #import "TestWKWebView.h"
+#import <WebKit/WKContentWorld.h>
 #import <WebKit/WKErrorPrivate.h>
 #import <WebKit/WKWebViewPrivate.h>
-#import <WebKit/_WKContentWorld.h>
 #import <wtf/RetainPtr.h>
 
 static bool isDone;
@@ -117,13 +117,13 @@
 
 TEST(WKWebView, WKContentWorld)
 {
-    EXPECT_NULL(_WKContentWorld.pageContentWorld.name);
-    EXPECT_NULL(_WKContentWorld.defaultClientWorld.name);
-    EXPECT_FALSE(_WKContentWorld.pageContentWorld == _WKContentWorld.defaultClientWorld);
+    EXPECT_NULL(WKContentWorld.pageWorld.name);
+    EXPECT_NULL(WKContentWorld.defaultClientWorld.name);
+    EXPECT_FALSE(WKContentWorld.pageWorld == WKContentWorld.defaultClientWorld);
 
-    _WKContentWorld *namedWorld = [_WKContentWorld worldWithName:@"Name"];
+    WKContentWorld *namedWorld = [WKContentWorld worldWithName:@"Name"];
     EXPECT_TRUE([namedWorld.name isEqualToString:@"Name"]);
-    EXPECT_EQ(namedWorld, [_WKContentWorld worldWithName:@"Name"]);
+    EXPECT_EQ(namedWorld, [WKContentWorld worldWithName:@"Name"]);
 }
 
 TEST(WKWebView, EvaluateJavaScriptInWorlds)
@@ -138,8 +138,8 @@
     }];
     isDone = false;
 
-    // Verify that value is visible when evaluating in the pageContentWorld
-    [webView _evaluateJavaScript:@"foo" inWorld:_WKContentWorld.pageContentWorld completionHandler:^(id result, NSError *error) {
+    // Verify that value is visible when evaluating in the pageWorld
+    [webView evaluateJavaScript:@"foo" inContentWorld:WKContentWorld.pageWorld completionHandler:^(id result, NSError *error) {
         EXPECT_TRUE([result isKindOfClass:[NSString class]]);
         EXPECT_TRUE([result isEqualToString:@"bar"]);
         isDone = true;
@@ -147,14 +147,14 @@
     isDone = false;
 
     // Verify that value is not visible when evaluating in the defaultClientWorld
-    [webView _evaluateJavaScript:@"foo" inWorld:_WKContentWorld.defaultClientWorld completionHandler:^(id result, NSError *error) {
+    [webView evaluateJavaScript:@"foo" inContentWorld:WKContentWorld.defaultClientWorld completionHandler:^(id result, NSError *error) {
         EXPECT_NULL(result);
         isDone = true;
     }];
     isDone = false;
 
-    // Verify that value is visible when calling a function in the pageContentWorld
-    [webView _callAsyncJavaScriptFunction:@"return foo" withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+    // Verify that value is visible when calling a function in the pageWorld
+    [webView callAsyncJavaScript:@"return foo" arguments:nil inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
         EXPECT_TRUE([result isKindOfClass:[NSString class]]);
         EXPECT_TRUE([result isEqualToString:@"bar"]);
         isDone = true;
@@ -162,7 +162,7 @@
     isDone = false;
 
     // Verify that value is not visible when calling a function in the defaultClientWorld
-    [webView _callAsyncJavaScriptFunction:@"return foo" withArguments:nil inWorld:_WKContentWorld.defaultClientWorld completionHandler:[&] (id result, NSError *error) {
+    [webView callAsyncJavaScript:@"return foo" arguments:nil inContentWorld:WKContentWorld.defaultClientWorld completionHandler:[&] (id result, NSError *error) {
         EXPECT_NULL(result);
         isDone = true;
     }];
@@ -169,8 +169,8 @@
     isDone = false;
 
     // Set a varibale value in a named world.
-    RetainPtr<_WKContentWorld> namedWorld = [_WKContentWorld worldWithName:@"NamedWorld"];
-    [webView _evaluateJavaScript:@"var bar = baz" inWorld:namedWorld.get() completionHandler:^(id result, NSError *error) {
+    RetainPtr<WKContentWorld> namedWorld = [WKContentWorld worldWithName:@"NamedWorld"];
+    [webView evaluateJavaScript:@"var bar = baz" inContentWorld:namedWorld.get() completionHandler:^(id result, NSError *error) {
         EXPECT_NULL(result);
         isDone = true;
     }];
@@ -177,7 +177,7 @@
     isDone = false;
 
     // Set a global varibale value in a named world via a function call.
-    [webView _callAsyncJavaScriptFunction:@"window.baz = bat" withArguments:nil inWorld:namedWorld.get() completionHandler:^(id result, NSError *error) {
+    [webView callAsyncJavaScript:@"window.baz = bat" arguments:nil inContentWorld:namedWorld.get() completionHandler:^(id result, NSError *error) {
         EXPECT_NULL(result);
         EXPECT_NULL(error);
         isDone = true;
@@ -185,7 +185,7 @@
     isDone = false;
 
     // Verify they are there in that named world.
-    [webView _evaluateJavaScript:@"bar" inWorld:namedWorld.get() completionHandler:^(id result, NSError *error) {
+    [webView evaluateJavaScript:@"bar" inContentWorld:namedWorld.get() completionHandler:^(id result, NSError *error) {
         EXPECT_TRUE([result isKindOfClass:[NSString class]]);
         EXPECT_TRUE([result isEqualToString:@"baz"]);
         isDone = true;
@@ -192,7 +192,7 @@
     }];
     isDone = false;
 
-    [webView _evaluateJavaScript:@"window.baz" inWorld:namedWorld.get() completionHandler:^(id result, NSError *error) {
+    [webView evaluateJavaScript:@"window.baz" inContentWorld:namedWorld.get() completionHandler:^(id result, NSError *error) {
         EXPECT_TRUE([result isKindOfClass:[NSString class]]);
         EXPECT_TRUE([result isEqualToString:@"bat"]);
         isDone = true;
@@ -200,26 +200,26 @@
     isDone = false;
 
     // Verify they aren't there in the defaultClientWorld.
-    [webView _evaluateJavaScript:@"bar" inWorld:_WKContentWorld.defaultClientWorld completionHandler:^(id result, NSError *error) {
+    [webView evaluateJavaScript:@"bar" inContentWorld:WKContentWorld.defaultClientWorld completionHandler:^(id result, NSError *error) {
         EXPECT_NULL(result);
         isDone = true;
     }];
     isDone = false;
 
-    [webView _evaluateJavaScript:@"window.baz" inWorld:_WKContentWorld.defaultClientWorld completionHandler:^(id result, NSError *error) {
+    [webView evaluateJavaScript:@"window.baz" inContentWorld:WKContentWorld.defaultClientWorld completionHandler:^(id result, NSError *error) {
         EXPECT_NULL(result);
         isDone = true;
     }];
     isDone = false;
 
-    // Verify they aren't there in the pageContentWorld.
-    [webView _evaluateJavaScript:@"bar" inWorld:_WKContentWorld.pageContentWorld completionHandler:^(id result, NSError *error) {
+    // Verify they aren't there in the pageWorld.
+    [webView evaluateJavaScript:@"bar" inContentWorld:WKContentWorld.pageWorld completionHandler:^(id result, NSError *error) {
         EXPECT_NULL(result);
         isDone = true;
     }];
     isDone = false;
 
-    [webView _evaluateJavaScript:@"window.baz" inWorld:_WKContentWorld.pageContentWorld completionHandler:^(id result, NSError *error) {
+    [webView evaluateJavaScript:@"window.baz" inContentWorld:WKContentWorld.pageWorld completionHandler:^(id result, NSError *error) {
         EXPECT_NULL(result);
         isDone = true;
     }];

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (255997 => 255998)


--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm	2020-02-07 02:09:56 UTC (rev 255997)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm	2020-02-07 02:26:36 UTC (rev 255998)
@@ -31,10 +31,10 @@
 #import "TestNavigationDelegate.h"
 #import "Utilities.h"
 
+#import <WebKit/WKContentWorld.h>
 #import <WebKit/WKWebViewConfigurationPrivate.h>
 #import <WebKit/WebKitPrivate.h>
 #import <WebKit/_WKActivatedElementInfo.h>
-#import <WebKit/_WKContentWorld.h>
 #import <WebKit/_WKProcessPoolConfiguration.h>
 #import <objc/runtime.h>
 #import <wtf/RetainPtr.h>
@@ -187,7 +187,7 @@
         *errorOut = nil;
 
     RetainPtr<id> evalResult;
-    [self _callAsyncJavaScriptFunction:script withArguments:arguments inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+    [self callAsyncJavaScript:script arguments:arguments inContentWorld:WKContentWorld.pageWorld completionHandler:[&] (id result, NSError *error) {
         evalResult = result;
         if (errorOut)
             *errorOut = [error retain];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to