Diff
Modified: trunk/Source/WebKit/ChangeLog (253722 => 253723)
--- trunk/Source/WebKit/ChangeLog 2019-12-18 22:29:38 UTC (rev 253722)
+++ trunk/Source/WebKit/ChangeLog 2019-12-18 22:52:03 UTC (rev 253723)
@@ -1,3 +1,18 @@
+2019-12-18 Alex Christensen <[email protected]>
+
+ Add ObjC version of WKBundleFrameIsMainFrame
+ https://bugs.webkit.org/show_bug.cgi?id=205415
+
+ Reviewed by Brian Weinstein.
+
+ I need this for rdar://problem/57132290
+ Covered by API tests.
+
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h:
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm:
+ (-[WKWebProcessPlugInFrame isMainFrame]):
+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h:
+
2019-12-18 Eric Carlson <[email protected]>
Remove more unused MediaPlayer methods
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h (253722 => 253723)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h 2019-12-18 22:29:38 UTC (rev 253722)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.h 2019-12-18 22:52:03 UTC (rev 253723)
@@ -41,6 +41,7 @@
@property (nonatomic, readonly) NSURL *URL;
@property (nonatomic, readonly) NSArray *childFrames;
@property (nonatomic, readonly) BOOL containsAnyFormElements;
+@property (nonatomic, readonly) BOOL isMainFrame;
@property (nonatomic, readonly) _WKFrameHandle *handle;
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm (253722 => 253723)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm 2019-12-18 22:29:38 UTC (rev 253722)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm 2019-12-18 22:52:03 UTC (rev 253723)
@@ -99,6 +99,11 @@
return !!_frame->containsAnyFormElements();
}
+- (BOOL)isMainFrame
+{
+ return !!_frame->isMainFrame();
+}
+
- (_WKFrameHandle *)handle
{
return wrapper(API::FrameHandle::create(_frame->frameID()));
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h (253722 => 253723)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h 2019-12-18 22:29:38 UTC (rev 253722)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInLoadDelegate.h 2019-12-18 22:52:03 UTC (rev 253723)
@@ -27,7 +27,7 @@
#import <WebKit/_WKRenderingProgressEvents.h>
#import <WebKit/_WKSameDocumentNavigationType.h>
-@class WKWebProcessPlugInBrowsingContextController;
+@class WKWebProcessPlugInBrowserContextController;
@class WKWebProcessPlugInFrame;
@class WKWebProcessPlugInScriptWorld;
Modified: trunk/Tools/ChangeLog (253722 => 253723)
--- trunk/Tools/ChangeLog 2019-12-18 22:29:38 UTC (rev 253722)
+++ trunk/Tools/ChangeLog 2019-12-18 22:52:03 UTC (rev 253723)
@@ -1,3 +1,18 @@
+2019-12-18 Alex Christensen <[email protected]>
+
+ Add ObjC version of WKBundleFrameIsMainFrame
+ https://bugs.webkit.org/show_bug.cgi?id=205415
+
+ Reviewed by Brian Weinstein.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UserContentWorld.mm:
+ (-[UserContentWorldRemoteObject didObserveMainFrame]):
+ (-[UserContentWorldRemoteObject didObserveSubframe]):
+ (TEST):
+ * TestWebKitAPI/Tests/WebKitCocoa/UserContentWorldPlugIn.mm:
+ (-[UserContentWorldPlugIn webProcessPlugInBrowserContextController:globalObjectIsAvailableForFrame:inScriptWorld:]):
+ * TestWebKitAPI/Tests/WebKitCocoa/UserContentWorldProtocol.h:
+
2019-12-18 Jonathan Bedard <[email protected]>
results.webkit.org: Serve files in uploaded archive
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorld.mm (253722 => 253723)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorld.mm 2019-12-18 22:29:38 UTC (rev 253722)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorld.mm 2019-12-18 22:52:03 UTC (rev 253723)
@@ -29,6 +29,7 @@
#import "PlatformUtilities.h"
#import "Test.h"
#import "TestNavigationDelegate.h"
+#import "TestURLSchemeHandler.h"
#import "UserContentWorldProtocol.h"
#import "WKWebViewConfigurationExtras.h"
#import <WebKit/WKProcessPoolPrivate.h>
@@ -112,6 +113,8 @@
static bool didObserveNormalWorld;
static bool didObserveWorldWithName;
+static bool didObserveMainFrame;
+static bool didObserveSubframe;
@interface UserContentWorldRemoteObject : NSObject <UserContentWorldProtocol>
@end
@@ -123,6 +126,16 @@
didObserveNormalWorld = true;
}
+- (void)didObserveMainFrame
+{
+ didObserveMainFrame = true;
+}
+
+- (void)didObserveSubframe
+{
+ didObserveSubframe = true;
+}
+
- (void)didObserveWorldWithName:(NSString *)name
{
EXPECT_WK_STREQ(@"TestWorld", name);
@@ -140,6 +153,8 @@
RetainPtr<_WKUserContentWorld> isolatedWorld = [_WKUserContentWorld worldWithName:@"TestWorld"];
RetainPtr<WKUserScript> userScript = adoptNS([[WKUserScript alloc] _initWithSource:@"window.setFromUserScript = true;" injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES legacyWhitelist:@[] legacyBlacklist:@[] userContentWorld:isolatedWorld.get()]);
[[configuration userContentController] addUserScript:userScript.get()];
+ RetainPtr<TestURLSchemeHandler> schemeHandler = adoptNS([[TestURLSchemeHandler alloc] init]);
+ [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"testscheme"];
RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
@@ -147,8 +162,23 @@
_WKRemoteObjectInterface *interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(UserContentWorldProtocol)];
[[webView _remoteObjectRegistry] registerExportedObject:object.get() interface:interface];
- [webView loadHTMLString:@"<body style='background-color: red;'></body>" baseURL:nil];
+ schemeHandler.get().startURLSchemeTaskHandler = ^(WKWebView *, id <WKURLSchemeTask> task) {
+ NSString *body;
+ if ([task.request.URL.path isEqualToString:@"/mainresource"])
+ body = @"<body style='background-color: red;'><iframe src=''></iframe></body>";
+ else {
+ EXPECT_WK_STREQ(task.request.URL.path, "/iframesrc");
+ body = @"iframe content";
+ }
+ [task didReceiveResponse:[[[NSURLResponse alloc] initWithURL:task.request.URL MIMEType:@"text/html" expectedContentLength:body.length textEncodingName:nil] autorelease]];
+ [task didReceiveData:[body dataUsingEncoding:NSUTF8StringEncoding]];
+ [task didFinish];
+ };
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"testscheme:///mainresource"]]];
+
TestWebKitAPI::Util::run(&didObserveNormalWorld);
TestWebKitAPI::Util::run(&didObserveWorldWithName);
+ TestWebKitAPI::Util::run(&didObserveMainFrame);
+ TestWebKitAPI::Util::run(&didObserveSubframe);
}
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorldPlugIn.mm (253722 => 253723)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorldPlugIn.mm 2019-12-18 22:29:38 UTC (rev 253722)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorldPlugIn.mm 2019-12-18 22:52:03 UTC (rev 253723)
@@ -62,6 +62,11 @@
- (void)webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController*)controller globalObjectIsAvailableForFrame:(WKWebProcessPlugInFrame *)frame inScriptWorld:(WKWebProcessPlugInScriptWorld *)scriptWorld
{
+ if (frame.isMainFrame)
+ [_remoteObject didObserveMainFrame];
+ else
+ [_remoteObject didObserveSubframe];
+
if (scriptWorld == [WKWebProcessPlugInScriptWorld normalWorld]) {
[_remoteObject didObserveNormalWorld];
return;
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorldProtocol.h (253722 => 253723)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorldProtocol.h 2019-12-18 22:29:38 UTC (rev 253722)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UserContentWorldProtocol.h 2019-12-18 22:52:03 UTC (rev 253723)
@@ -29,5 +29,7 @@
- (void)didObserveNormalWorld;
- (void)didObserveWorldWithName:(NSString *)name;
+- (void)didObserveMainFrame;
+- (void)didObserveSubframe;
@end