Title: [253355] trunk/Tools
Revision
253355
Author
pvol...@apple.com
Date
2019-12-10 17:19:00 -0800 (Tue, 10 Dec 2019)

Log Message

Fix API test failure after r253351
https://bugs.webkit.org/show_bug.cgi?id=205089

Reviewed by Brent Fulgham.

With the patch landed in r253351, the NetworkExtension framework will not be loaded in the WebContent process unless
[NEFilterSource filterRequired] returns YES. Swizzle this method to return YES in the UI process.

* TestWebKitAPI/Tests/WebKitCocoa/ContentFiltering.mm:
(filterRequired):
(TEST):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (253354 => 253355)


--- trunk/Tools/ChangeLog	2019-12-10 23:59:25 UTC (rev 253354)
+++ trunk/Tools/ChangeLog	2019-12-11 01:19:00 UTC (rev 253355)
@@ -1,3 +1,17 @@
+2019-12-10  Per Arne Vollan  <pvol...@apple.com>
+
+        Fix API test failure after r253351
+        https://bugs.webkit.org/show_bug.cgi?id=205089
+
+        Reviewed by Brent Fulgham.
+
+        With the patch landed in r253351, the NetworkExtension framework will not be loaded in the WebContent process unless
+        [NEFilterSource filterRequired] returns YES. Swizzle this method to return YES in the UI process.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ContentFiltering.mm:
+        (filterRequired):
+        (TEST):
+
 2019-12-10  Chris Dumez  <cdu...@apple.com>
 
         Gyroscope (DeviceMotion related) permission cannot be requested in WKWebView unless the client app sets a WKUIDelegate

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContentFiltering.mm (253354 => 253355)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContentFiltering.mm	2019-12-10 23:59:25 UTC (rev 253354)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContentFiltering.mm	2019-12-11 01:19:00 UTC (rev 253355)
@@ -38,8 +38,13 @@
 #import <WebKit/_WKDownloadDelegate.h>
 #import <WebKit/_WKRemoteObjectInterface.h>
 #import <WebKit/_WKRemoteObjectRegistry.h>
+#import <pal/spi/cocoa/NEFilterSourceSPI.h>
 #import <wtf/RetainPtr.h>
+#import <wtf/SoftLinking.h>
 
+SOFT_LINK_FRAMEWORK_OPTIONAL(NetworkExtension);
+SOFT_LINK_CLASS_OPTIONAL(NetworkExtension, NEFilterSource);
+
 using Decision = WebCore::MockContentFilterSettings::Decision;
 using DecisionPoint = WebCore::MockContentFilterSettings::DecisionPoint;
 
@@ -375,8 +380,17 @@
 
 @end
 
+static BOOL filterRequired(id self, SEL _cmd)
+{
+    return YES;
+}
+
 TEST(ContentFiltering, LazilyLoadPlatformFrameworks)
 {
+    // Swizzle [NEFilterSource filterRequired] to return YES in the UI process since NetworkExtension will not be loaded otherwise.
+    Method method = class_getClassMethod(getNEFilterSourceClass(), @selector(filterRequired));
+    method_setImplementation(method, reinterpret_cast<IMP>(filterRequired));
+
     @autoreleasepool {
         auto controller = adoptNS([[LazilyLoadPlatformFrameworksController alloc] init]);
         [controller expectParentalControlsLoaded:NO networkExtensionLoaded:NO];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to