Title: [209147] trunk/Source/WebCore
Revision
209147
Author
[email protected]
Date
2016-11-30 12:34:18 -0800 (Wed, 30 Nov 2016)

Log Message

[Cocoa] Pass the embedding app's bundle ID to new instances of NEFilterSource
https://bugs.webkit.org/show_bug.cgi?id=165168
<rdar://problem/29003618>

Reviewed by Simon Fraser.

* platform/RuntimeApplicationChecks.h: Declared applicationBundleIdentifier().
* platform/RuntimeApplicationChecks.mm:
(WebCore::applicationBundleIdentifier): Made non-static.
* platform/cocoa/NetworkExtensionContentFilter.mm:
(WebCore::NetworkExtensionContentFilter::initialize): If the new NEFilterSource instance
responds to -setSourceAppBundleID:, call it with applicationBundleIdentifier().
* platform/spi/cocoa/NEFilterSourceSPI.h: Moved NEFilterSourceOptionsRedirectURL into the
!USE(APPLE_INTERNAL_SDK) section and unconditionally declared @property sourceAppBundleID in
a new category on NEFilterSource.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209146 => 209147)


--- trunk/Source/WebCore/ChangeLog	2016-11-30 20:30:16 UTC (rev 209146)
+++ trunk/Source/WebCore/ChangeLog	2016-11-30 20:34:18 UTC (rev 209147)
@@ -1,3 +1,21 @@
+2016-11-30  Andy Estes  <[email protected]>
+
+        [Cocoa] Pass the embedding app's bundle ID to new instances of NEFilterSource
+        https://bugs.webkit.org/show_bug.cgi?id=165168
+        <rdar://problem/29003618>
+
+        Reviewed by Simon Fraser.
+
+        * platform/RuntimeApplicationChecks.h: Declared applicationBundleIdentifier().
+        * platform/RuntimeApplicationChecks.mm:
+        (WebCore::applicationBundleIdentifier): Made non-static.
+        * platform/cocoa/NetworkExtensionContentFilter.mm:
+        (WebCore::NetworkExtensionContentFilter::initialize): If the new NEFilterSource instance
+        responds to -setSourceAppBundleID:, call it with applicationBundleIdentifier().
+        * platform/spi/cocoa/NEFilterSourceSPI.h: Moved NEFilterSourceOptionsRedirectURL into the
+        !USE(APPLE_INTERNAL_SDK) section and unconditionally declared @property sourceAppBundleID in
+        a new category on NEFilterSource.
+
 2016-11-30  Brent Fulgham  <[email protected]>
 
         Use 'childOfType' template when retrieving Shadow DOM elements

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.h (209146 => 209147)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2016-11-30 20:30:16 UTC (rev 209146)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2016-11-30 20:34:18 UTC (rev 209147)
@@ -32,6 +32,7 @@
 namespace WebCore {
 
 WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&);
+String applicationBundleIdentifier();
 
 #if PLATFORM(MAC)
 

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm (209146 => 209147)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm	2016-11-30 20:30:16 UTC (rev 209146)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm	2016-11-30 20:34:18 UTC (rev 209147)
@@ -48,7 +48,7 @@
     return identifier;
 }
 
-static String applicationBundleIdentifier()
+String applicationBundleIdentifier()
 {
     // The override only gets set in WebKit2's WebProcess and NetworkProcess. If unset, we use the main bundle identifier.
     const auto& identifier = applicationBundleIdentifierOverride();

Modified: trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm (209146 => 209147)


--- trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm	2016-11-30 20:30:16 UTC (rev 209146)
+++ trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm	2016-11-30 20:34:18 UTC (rev 209147)
@@ -33,6 +33,7 @@
 #import "NEFilterSourceSPI.h"
 #import "ResourceRequest.h"
 #import "ResourceResponse.h"
+#import "RuntimeApplicationChecks.h"
 #import "SharedBuffer.h"
 #import "SoftLinking.h"
 #import "URL.h"
@@ -73,6 +74,11 @@
 #if HAVE(MODERN_NE_FILTER_SOURCE)
     ASSERT_UNUSED(url, !url);
     m_neFilterSource = adoptNS([allocNEFilterSourceInstance() initWithDecisionQueue:m_queue.get()]);
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
+    // FIXME: Remove the -respondsToSelector: check once -setSourceAppBundleID: is in an SDK (<rdar://problem/29147174>).
+    if ([m_neFilterSource respondsToSelector:@selector(setSourceAppBundleID:)])
+        [m_neFilterSource setSourceAppBundleID:applicationBundleIdentifier()];
+#endif
 #else
     ASSERT_ARG(url, url);
     m_neFilterSource = adoptNS([allocNEFilterSourceInstance() initWithURL:*url direction:NEFilterSourceDirectionInbound socketIdentifier:0]);

Modified: trunk/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h (209146 => 209147)


--- trunk/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h	2016-11-30 20:30:16 UTC (rev 209146)
+++ trunk/Source/WebCore/platform/spi/cocoa/NEFilterSourceSPI.h	2016-11-30 20:34:18 UTC (rev 209147)
@@ -62,6 +62,7 @@
 #if HAVE(MODERN_NE_FILTER_SOURCE)
 
 #define NEFilterSourceOptionsPageData @"PageData"
+#define NEFilterSourceOptionsRedirectURL @"RedirectURL"
 
 typedef void (^NEFilterSourceDecisionHandler)(NEFilterSourceStatus, NSDictionary *);
 
@@ -78,7 +79,9 @@
 
 #endif // !USE(APPLE_INTERNAL_SDK)
 
-// FIXME: Remove once NEFilterSourceOptionsRedirectURL is defined in the SDK.
-#ifndef NEFilterSourceOptionsRedirectURL
-#define NEFilterSourceOptionsRedirectURL @"RedirectURL"
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
+// FIXME: Confine this to the !USE(APPLE_INTERNAL_SDK) section once this is defined in an SDK (<rdar://problem/29147174>).
+@interface NEFilterSource (WKStaging)
+@property (copy) NSString *sourceAppBundleID;
+@end
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to