Title: [168565] trunk/Source
Revision
168565
Author
joep...@webkit.org
Date
2014-05-09 18:30:13 -0700 (Fri, 09 May 2014)

Log Message

Web Inspector: Allow Remote Inspector to entitlement check UIProcess through WebProcess
https://bugs.webkit.org/show_bug.cgi?id=132409

Reviewed by Timothy Hatcher.

Source/_javascript_Core:
Proxy applications are applications which hold WebViews for other
applications. The WebProcess (Web Content Service) is a proxy application.
For legacy reasons we were supporting a scenario where proxy applications
could potentially host WebViews for more then one other application. That
was never the case for WebProcess and it is now a scenario we don't need
to worry about supporting.

With this change, a proxy application more naturally only holds WebViews
for a single parent / host application. The proxy process can set the
parent pid / audit_token data on the RemoteInspector singleton, and
that data will be sent on to webinspectord later on to be validated.
In the WebProcess<->UIProcess relationship that information is known
and set immediately. In the Legacy iOS case that information is set
soon after, but not immediately known at the point the WebView is created.

This allows us to simplify the RemoteInspectorDebuggable interface.
We no longer need a pid per-Debuggable.

* inspector/remote/RemoteInspector.h:
* inspector/remote/RemoteInspector.mm:
(Inspector::RemoteInspector::RemoteInspector):
(Inspector::RemoteInspector::setParentProcessInformation):
(Inspector::RemoteInspector::xpcConnectionReceivedMessage):
(Inspector::RemoteInspector::listingForDebuggable):
(Inspector::RemoteInspector::receivedProxyApplicationSetupMessage):
Handle new proxy application setup message, and provide an API
for a proxy application to set the parent process information.

* inspector/remote/RemoteInspectorConstants.h:
New setup and response message for proxy applications to pass
their parent / host application information to webinspectord.

* inspector/remote/RemoteInspectorDebuggable.cpp:
(Inspector::RemoteInspectorDebuggable::info):
* inspector/remote/RemoteInspectorDebuggable.h:
(Inspector::RemoteInspectorDebuggableInfo::RemoteInspectorDebuggableInfo):
(Inspector::RemoteInspectorDebuggableInfo::hasParentProcess): Deleted.
pid per debuggable is no longer needed.

Source/WebCore:
* inspector/InspectorClient.h:
(WebCore::InspectorClient::parentProcessIdentifier): Deleted.
* page/PageDebuggable.cpp:
(WebCore::PageDebuggable::parentProcessIdentifier): Deleted.
* page/PageDebuggable.h:
pid per debuggable is no longer needed.

Source/WebKit/mac:
Simplify the legacy iOS UIWebViewController case by passing on
the host process pid and audit_token.

* WebView/WebView.mm:
(-[WebView _setHostApplicationProcessIdentifier:auditToken:]):
(-[WebView setHostApplicationBundleId:name:]): Deleted.
(-[WebView hostApplicationBundleId]): Deleted.
(-[WebView hostApplicationName]): Deleted.
* WebView/WebViewData.h:
* WebView/WebViewData.mm:
(-[WebViewPrivate dealloc]):
* WebView/WebViewPrivate.h:

Source/WebKit2:
* WebProcess/WebCoreSupport/WebInspectorClient.h:
* WebProcess/WebCoreSupport/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::parentProcessIdentifier): Deleted.
pid per debuggable is no longer needed.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
Immediately pass the parent process pid and audit_token on
to the RemoteInspector singleton when the process is created
so that it can be sent to webinspectord.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (168564 => 168565)


--- trunk/Source/_javascript_Core/ChangeLog	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-05-10 01:30:13 UTC (rev 168565)
@@ -1,3 +1,49 @@
+2014-05-09  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Allow Remote Inspector to entitlement check UIProcess through WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=132409
+
+        Reviewed by Timothy Hatcher.
+
+        Proxy applications are applications which hold WebViews for other
+        applications. The WebProcess (Web Content Service) is a proxy application.
+        For legacy reasons we were supporting a scenario where proxy applications
+        could potentially host WebViews for more then one other application. That
+        was never the case for WebProcess and it is now a scenario we don't need
+        to worry about supporting.
+
+        With this change, a proxy application more naturally only holds WebViews
+        for a single parent / host application. The proxy process can set the
+        parent pid / audit_token data on the RemoteInspector singleton, and
+        that data will be sent on to webinspectord later on to be validated.
+        In the WebProcess<->UIProcess relationship that information is known
+        and set immediately. In the Legacy iOS case that information is set
+        soon after, but not immediately known at the point the WebView is created.
+
+        This allows us to simplify the RemoteInspectorDebuggable interface.
+        We no longer need a pid per-Debuggable.
+
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/RemoteInspector.mm:
+        (Inspector::RemoteInspector::RemoteInspector):
+        (Inspector::RemoteInspector::setParentProcessInformation):
+        (Inspector::RemoteInspector::xpcConnectionReceivedMessage):
+        (Inspector::RemoteInspector::listingForDebuggable):
+        (Inspector::RemoteInspector::receivedProxyApplicationSetupMessage):
+        Handle new proxy application setup message, and provide an API
+        for a proxy application to set the parent process information.
+
+        * inspector/remote/RemoteInspectorConstants.h:
+        New setup and response message for proxy applications to pass
+        their parent / host application information to webinspectord.
+
+        * inspector/remote/RemoteInspectorDebuggable.cpp:
+        (Inspector::RemoteInspectorDebuggable::info):
+        * inspector/remote/RemoteInspectorDebuggable.h:
+        (Inspector::RemoteInspectorDebuggableInfo::RemoteInspectorDebuggableInfo):
+        (Inspector::RemoteInspectorDebuggableInfo::hasParentProcess): Deleted.
+        pid per debuggable is no longer needed.
+
 2014-05-09  Mark Hahnenberg  <mhahnenb...@apple.com>
 
         JSDOMWindow should disable property caching after a certain point

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h (168564 => 168565)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2014-05-10 01:30:13 UTC (rev 168565)
@@ -31,13 +31,14 @@
 #import "RemoteInspectorXPCConnection.h"
 #import <wtf/Forward.h>
 #import <wtf/HashMap.h>
-#import <wtf/Forward.h>
+#import <wtf/RetainPtr.h>
 
 OBJC_CLASS NSDictionary;
 OBJC_CLASS NSString;
 
 namespace Inspector {
 
+class RemoteInspectorClient;
 class RemoteInspectorDebuggable;
 class RemoteInspectorDebuggableConnection;
 struct RemoteInspectorDebuggableInfo;
@@ -60,6 +61,12 @@
     void start();
     void stop();
 
+    bool hasParentProcessInformation() const { return m_parentProcessIdentifier != 0; }
+    pid_t parentProcessIdentifier() const { return m_parentProcessIdentifier; }
+    RetainPtr<CFDataRef> parentProcessAuditData() const { return m_parentProcessAuditData; }
+    void setParentProcessInformation(pid_t, RetainPtr<CFDataRef> auditData);
+    void setParentProcessInfomationIsDelayed();
+
 private:
     RemoteInspector();
 
@@ -85,6 +92,7 @@
     void receivedDidCloseMessage(NSDictionary *userInfo);
     void receivedGetListingMessage(NSDictionary *userInfo);
     void receivedIndicateMessage(NSDictionary *userInfo);
+    void receivedProxyApplicationSetupMessage(NSDictionary *userInfo);
     void receivedConnectionDiedMessage(NSDictionary *userInfo);
 
     static bool startEnabled;
@@ -98,12 +106,17 @@
     HashMap<unsigned, std::pair<RemoteInspectorDebuggable*, RemoteInspectorDebuggableInfo>> m_debuggableMap;
     HashMap<unsigned, RefPtr<RemoteInspectorDebuggableConnection>> m_connectionMap;
     RefPtr<RemoteInspectorXPCConnection> m_xpcConnection;
+
     dispatch_queue_t m_xpcQueue;
     unsigned m_nextAvailableIdentifier;
     int m_notifyToken;
     bool m_enabled;
     bool m_hasActiveDebugSession;
     bool m_pushScheduled;
+
+    pid_t m_parentProcessIdentifier;
+    RetainPtr<CFDataRef> m_parentProcessAuditData;
+    bool m_shouldSendParentProcessInformation;
 };
 
 } // namespace Inspector

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm (168564 => 168565)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.mm	2014-05-10 01:30:13 UTC (rev 168565)
@@ -87,6 +87,8 @@
     , m_enabled(false)
     , m_hasActiveDebugSession(false)
     , m_pushScheduled(false)
+    , m_parentProcessIdentifier(0)
+    , m_shouldSendParentProcessInformation(false)
 {
 }
 
@@ -248,6 +250,22 @@
     pushListingSoon();
 }
 
+#pragma mark - Proxy Application Information
+
+void RemoteInspector::setParentProcessInformation(pid_t pid, RetainPtr<CFDataRef> auditData)
+{
+    std::lock_guard<std::mutex> lock(m_mutex);
+
+    if (m_parentProcessIdentifier || m_parentProcessAuditData)
+        return;
+
+    m_parentProcessIdentifier = pid;
+    m_parentProcessAuditData = auditData;
+
+    if (m_shouldSendParentProcessInformation)
+        receivedProxyApplicationSetupMessage(nil);
+}
+
 #pragma mark - RemoteInspectorXPCConnection::Client
 
 void RemoteInspector::xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo)
@@ -269,6 +287,8 @@
         receivedGetListingMessage(userInfo);
     else if ([messageName isEqualToString:WIRIndicateMessage])
         receivedIndicateMessage(userInfo);
+    else if ([messageName isEqualToString:WIRProxyApplicationSetupMessage])
+        receivedProxyApplicationSetupMessage(userInfo);
     else if ([messageName isEqualToString:WIRConnectionDiedMessage])
         receivedConnectionDiedMessage(userInfo);
     else
@@ -334,11 +354,6 @@
     if (debuggableInfo.hasLocalDebugger)
         [debuggableDetails setObject:@YES forKey:WIRHasLocalDebuggerKey];
 
-    if (debuggableInfo.hasParentProcess()) {
-        NSString *parentApplicationIdentifier = [NSString stringWithFormat:@"PID:%lu", (unsigned long)debuggableInfo.parentProcessIdentifier];
-        [debuggableDetails setObject:parentApplicationIdentifier forKey:WIRHostApplicationIdentifierKey];
-    }
-
     return debuggableDetails;
 }
 
@@ -506,6 +521,32 @@
     });
 }
 
+void RemoteInspector::receivedProxyApplicationSetupMessage(NSDictionary *)
+{
+    ASSERT(m_xpcConnection);
+    if (!m_xpcConnection)
+        return;
+
+    if (!m_parentProcessIdentifier || !m_parentProcessAuditData) {
+        // We are a proxy application without parent process information.
+        // Wait a bit for the information, but give up after a second.
+        m_shouldSendParentProcessInformation = true;
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            std::lock_guard<std::mutex> lock(m_mutex);
+            if (m_shouldSendParentProcessInformation)
+                stopInternal(StopSource::XPCMessage);
+        });
+        return;
+    }
+
+    m_shouldSendParentProcessInformation = false;
+
+    m_xpcConnection->sendMessage(WIRProxyApplicationSetupResponseMessage, @{
+        WIRProxyApplicationParentPIDKey: @(m_parentProcessIdentifier),
+        WIRProxyApplicationParentAuditDataKey: (NSData *)m_parentProcessAuditData.get(),
+    });
+}
+
 void RemoteInspector::receivedConnectionDiedMessage(NSDictionary *userInfo)
 {
     NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorConstants.h (168564 => 168565)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorConstants.h	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorConstants.h	2014-05-10 01:30:13 UTC (rev 168565)
@@ -81,5 +81,9 @@
 // These definitions are shared between webinspectord and WebKit.
 
 #define WIRPermissionDenied                     @"WIRPermissionDenied"
+#define WIRProxyApplicationParentPIDKey         @"WIRProxyApplicationParentPID"
+#define WIRProxyApplicationParentAuditDataKey   @"WIRProxyApplicationParentAuditData"
+#define WIRProxyApplicationSetupMessage         @"WIRProxyApplicationSetupMessage"
+#define WIRProxyApplicationSetupResponseMessage @"WIRProxyApplicationSetupResponseMessage"
 
 #endif

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggable.cpp (168564 => 168565)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggable.cpp	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggable.cpp	2014-05-10 01:30:13 UTC (rev 168565)
@@ -73,7 +73,6 @@
     info.url = ""
     info.hasLocalDebugger = hasLocalDebugger();
     info.remoteDebuggingAllowed = remoteDebuggingAllowed();
-    info.parentProcessIdentifier = parentProcessIdentifier();
     return info;
 }
 

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggable.h (168564 => 168565)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggable.h	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspectorDebuggable.h	2014-05-10 01:30:13 UTC (rev 168565)
@@ -56,7 +56,6 @@
     virtual String name() const { return String(); } // _javascript_ and Web
     virtual String url() const { return String(); } // Web
     virtual bool hasLocalDebugger() const = 0;
-    virtual pid_t parentProcessIdentifier() const { return 0; }
 
     virtual void connect(InspectorFrontendChannel*) = 0;
     virtual void disconnect() = 0;
@@ -74,19 +73,15 @@
         , type(RemoteInspectorDebuggable::_javascript_)
         , hasLocalDebugger(false)
         , remoteDebuggingAllowed(false)
-        , parentProcessIdentifier(0)
     {
     }
 
-    bool hasParentProcess() const { return !!parentProcessIdentifier; }
-
     unsigned identifier;
     RemoteInspectorDebuggable::DebuggableType type;
     String name;
     String url;
     bool hasLocalDebugger;
     bool remoteDebuggingAllowed;
-    pid_t parentProcessIdentifier;
 };
 
 } // namespace Inspector

Modified: trunk/Source/WebCore/ChangeLog (168564 => 168565)


--- trunk/Source/WebCore/ChangeLog	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebCore/ChangeLog	2014-05-10 01:30:13 UTC (rev 168565)
@@ -1,3 +1,17 @@
+2014-05-09  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Allow Remote Inspector to entitlement check UIProcess through WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=132409
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InspectorClient.h:
+        (WebCore::InspectorClient::parentProcessIdentifier): Deleted.
+        * page/PageDebuggable.cpp:
+        (WebCore::PageDebuggable::parentProcessIdentifier): Deleted.
+        * page/PageDebuggable.h:
+        pid per debuggable is no longer needed.
+
 2014-05-09  Dean Jackson  <d...@apple.com>
 
         [fullscreen] cursor should auto-hide when over video

Modified: trunk/Source/WebCore/inspector/InspectorClient.h (168564 => 168565)


--- trunk/Source/WebCore/inspector/InspectorClient.h	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebCore/inspector/InspectorClient.h	2014-05-10 01:30:13 UTC (rev 168565)
@@ -49,10 +49,6 @@
     virtual void bringFrontendToFront() = 0;
     virtual void didResizeMainFrame(Frame*) { }
 
-#if ENABLE(REMOTE_INSPECTOR)
-    virtual pid_t parentProcessIdentifier() const { return 0; }
-#endif
-
     virtual void highlight() = 0;
     virtual void hideHighlight() = 0;
 

Modified: trunk/Source/WebCore/page/PageDebuggable.cpp (168564 => 168565)


--- trunk/Source/WebCore/page/PageDebuggable.cpp	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebCore/page/PageDebuggable.cpp	2014-05-10 01:30:13 UTC (rev 168565)
@@ -29,7 +29,6 @@
 #if ENABLE(REMOTE_INSPECTOR)
 
 #include "Document.h"
-#include "InspectorClient.h"
 #include "InspectorController.h"
 #include "InspectorForwarding.h"
 #include "MainFrame.h"
@@ -71,14 +70,6 @@
     return m_page.inspectorController().hasLocalFrontend();
 }
 
-pid_t PageDebuggable::parentProcessIdentifier() const
-{
-    if (InspectorClient* inspectorClient = m_page.inspectorController().inspectorClient())
-        return inspectorClient->parentProcessIdentifier();
-
-    return 0;
-}
-
 void PageDebuggable::connect(Inspector::InspectorFrontendChannel* channel)
 {
 #if PLATFORM(IOS)

Modified: trunk/Source/WebCore/page/PageDebuggable.h (168564 => 168565)


--- trunk/Source/WebCore/page/PageDebuggable.h	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebCore/page/PageDebuggable.h	2014-05-10 01:30:13 UTC (rev 168565)
@@ -46,7 +46,6 @@
     virtual String name() const override;
     virtual String url() const override;
     virtual bool hasLocalDebugger() const override;
-    virtual pid_t parentProcessIdentifier() const override;
 
     virtual void connect(Inspector::InspectorFrontendChannel*) override;
     virtual void disconnect() override;

Modified: trunk/Source/WebKit/mac/ChangeLog (168564 => 168565)


--- trunk/Source/WebKit/mac/ChangeLog	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-05-10 01:30:13 UTC (rev 168565)
@@ -1,3 +1,23 @@
+2014-05-09  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Allow Remote Inspector to entitlement check UIProcess through WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=132409
+
+        Reviewed by Timothy Hatcher.
+
+        Simplify the legacy iOS UIWebViewController case by passing on
+        the host process pid and audit_token.
+
+        * WebView/WebView.mm:
+        (-[WebView _setHostApplicationProcessIdentifier:auditToken:]):
+        (-[WebView setHostApplicationBundleId:name:]): Deleted.
+        (-[WebView hostApplicationBundleId]): Deleted.
+        (-[WebView hostApplicationName]): Deleted.
+        * WebView/WebViewData.h:
+        * WebView/WebViewData.mm:
+        (-[WebViewPrivate dealloc]):
+        * WebView/WebViewPrivate.h:
+
 2014-05-09  Benjamin Poulain  <benja...@webkit.org>
 
         [iOS] Switch geolocation to an explicit authorization query model

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (168564 => 168565)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2014-05-10 01:30:13 UTC (rev 168565)
@@ -1918,30 +1918,11 @@
 }
 
 #if PLATFORM(IOS)
-- (void)setHostApplicationBundleId:(NSString *)bundleId name:(NSString *)name
+- (void)_setHostApplicationProcessIdentifier:(pid_t)pid auditToken:(audit_token_t)auditToken
 {
-    if (![_private->hostApplicationBundleId isEqualToString:bundleId]) {
-        [_private->hostApplicationBundleId release];
-        _private->hostApplicationBundleId = [bundleId copy];
-    }
-
-    if (![_private->hostApplicationName isEqualToString:name]) {
-        [_private->hostApplicationName release];
-        _private->hostApplicationName = [name copy];
-    }
-
-    // FIXME: This has not yet been ported to Inspector::RemoteInspectorServer.
+    RetainPtr<CFDataRef> auditData = adoptCF(CFDataCreate(nullptr, (const UInt8*)&auditToken, sizeof(auditToken)));
+    RemoteInspector::shared().setParentProcessInformation(pid, auditData);
 }
-
-- (NSString *)hostApplicationBundleId
-{
-    return _private->hostApplicationBundleId;
-}
-
-- (NSString *)hostApplicationName
-{
-    return _private->hostApplicationName;
-}
 #endif // PLATFORM(IOS)
 #endif // ENABLE(REMOTE_INSPECTOR)
 

Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (168564 => 168565)


--- trunk/Source/WebKit/mac/WebView/WebViewData.h	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h	2014-05-10 01:30:13 UTC (rev 168565)
@@ -256,8 +256,6 @@
 #if ENABLE(REMOTE_INSPECTOR)
 #if PLATFORM(IOS)
     WebIndicateLayer *indicateLayer;
-    NSString *hostApplicationBundleId;
-    NSString *hostApplicationName;
 #endif
 #endif
 

Modified: trunk/Source/WebKit/mac/WebView/WebViewData.mm (168564 => 168565)


--- trunk/Source/WebKit/mac/WebView/WebViewData.mm	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.mm	2014-05-10 01:30:13 UTC (rev 168565)
@@ -153,8 +153,6 @@
 #if ENABLE(REMOTE_INSPECTOR)
 #if PLATFORM(IOS)
     [indicateLayer release];
-    [hostApplicationBundleId release];
-    [hostApplicationName release];
 #endif
 #endif
 

Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (168564 => 168565)


--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2014-05-10 01:30:13 UTC (rev 168565)
@@ -326,27 +326,7 @@
 - (void)setShowingInspectorIndication:(BOOL)enabled;
 
 #if TARGET_OS_IPHONE
-/*!
-    @method setHostApplicationBundleId:name
-    @param bundleId The application that this WebView was created for.
-    @param name That application's localized display name.
-    @abstract When a WebView is created out of process for an application,
-    you can clarify to a Remote Debugger which application this WebView
-    is intended to belong to; the application which hosts the WebView.
-*/
-- (void)setHostApplicationBundleId:(NSString *)bundleId name:(NSString *)name;
-
-/*!
-    @method hostApplicationBundleId
-    @result Returns the host application bundle id.
-*/
-- (NSString *)hostApplicationBundleId;
-
-/*!
-    @method hostApplicationName
-    @result Returns the host application name.
-*/
-- (NSString *)hostApplicationName;
+- (void)_setHostApplicationProcessIdentifier:(pid_t)pid auditToken:(audit_token_t)auditToken;
 #endif
 
 #endif // ENABLE_REMOTE_INSPECTOR

Modified: trunk/Source/WebKit2/ChangeLog (168564 => 168565)


--- trunk/Source/WebKit2/ChangeLog	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-10 01:30:13 UTC (rev 168565)
@@ -1,3 +1,21 @@
+2014-05-09  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Allow Remote Inspector to entitlement check UIProcess through WebProcess
+        https://bugs.webkit.org/show_bug.cgi?id=132409
+
+        Reviewed by Timothy Hatcher.
+
+        * WebProcess/WebCoreSupport/WebInspectorClient.h:
+        * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
+        (WebKit::WebInspectorClient::parentProcessIdentifier): Deleted.
+        pid per debuggable is no longer needed.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        Immediately pass the parent process pid and audit_token on
+        to the RemoteInspector singleton when the process is created
+        so that it can be sent to webinspectord.
+
 2014-05-09  Enrica Casucci  <enr...@apple.com>
 
         REGRESSION (WebKit2): Tapping in search field at wikipedia.org doesn’t bring up the keyboard.

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp (168564 => 168565)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp	2014-05-10 01:30:13 UTC (rev 168565)
@@ -33,10 +33,6 @@
 #include <WebCore/InspectorController.h>
 #include <WebCore/Page.h>
 
-#if ENABLE(REMOTE_INSPECTOR)
-#include "WebProcess.h"
-#endif
-
 using namespace WebCore;
 
 namespace WebKit {
@@ -71,13 +67,6 @@
         m_page->inspector()->updateDockingAvailability();
 }
 
-#if ENABLE(REMOTE_INSPECTOR)
-pid_t WebInspectorClient::parentProcessIdentifier() const
-{
-    return WebProcess::shared().presenterApplicationPid();
-}
-#endif
-
 void WebInspectorClient::highlight()
 {
     if (!m_highlightOverlay) {

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h (168564 => 168565)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h	2014-05-10 01:30:13 UTC (rev 168565)
@@ -58,10 +58,6 @@
     virtual void bringFrontendToFront() override;
     virtual void didResizeMainFrame(WebCore::Frame*) override;
 
-#if ENABLE(REMOTE_INSPECTOR)
-    virtual pid_t parentProcessIdentifier() const override;
-#endif
-
     virtual void highlight() override;
     virtual void hideHighlight() override;
 

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (168564 => 168565)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2014-05-10 01:23:43 UTC (rev 168564)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2014-05-10 01:30:13 UTC (rev 168565)
@@ -123,6 +123,10 @@
 #include "WebResourceLoadScheduler.h"
 #endif
 
+#if ENABLE(REMOTE_INSPECTOR)
+#include <_javascript_Core/RemoteInspector.h>
+#endif
+
 #if USE(SOUP) && !ENABLE(CUSTOM_PROTOCOLS)
 #include "WebSoupRequestManager.h"
 #endif
@@ -366,6 +370,14 @@
 #if ENABLE(SERVICE_CONTROLS)
     setEnabledServices(parameters.hasImageServices, parameters.hasSelectionServices);
 #endif
+
+#if ENABLE(REMOTE_INSPECTOR)
+    audit_token_t auditToken;
+    if (parentProcessConnection()->getAuditToken(auditToken)) {
+        RetainPtr<CFDataRef> auditData = adoptCF(CFDataCreate(nullptr, (const UInt8*)&auditToken, sizeof(auditToken)));
+        Inspector::RemoteInspector::shared().setParentProcessInformation(presenterApplicationPid(), auditData);
+    }
+#endif
 }
 
 #if ENABLE(NETWORK_PROCESS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to