<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[168644] branches/safari-538.34-branch/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/168644">168644</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2014-05-12 14:07:57 -0700 (Mon, 12 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/168565">r168565</a>.  </pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari53834branchSourceJavaScriptCoreChangeLog">branches/safari-538.34-branch/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectorh">branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspector.h</a></li>
<li><a href="#branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectormm">branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm</a></li>
<li><a href="#branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectorConstantsh">branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h</a></li>
<li><a href="#branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggablecpp">branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp</a></li>
<li><a href="#branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableh">branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCoreChangeLog">branches/safari-538.34-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari53834branchSourceWebCoreinspectorInspectorClienth">branches/safari-538.34-branch/Source/WebCore/inspector/InspectorClient.h</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepagePageDebuggablecpp">branches/safari-538.34-branch/Source/WebCore/page/PageDebuggable.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebCorepagePageDebuggableh">branches/safari-538.34-branch/Source/WebCore/page/PageDebuggable.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKitmacChangeLog">branches/safari-538.34-branch/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#branchessafari53834branchSourceWebKitmacWebViewWebViewmm">branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#branchessafari53834branchSourceWebKitmacWebViewWebViewDatah">branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewData.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKitmacWebViewWebViewDatamm">branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewData.mm</a></li>
<li><a href="#branchessafari53834branchSourceWebKitmacWebViewWebViewPrivateh">branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewPrivate.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2ChangeLog">branches/safari-538.34-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2WebProcessWebCoreSupportWebInspectorClientcpp">branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2WebProcessWebCoreSupportWebInspectorClienth">branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h</a></li>
<li><a href="#branchessafari53834branchSourceWebKit2WebProcessWebProcesscpp">branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari53834branchSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/JavaScriptCore/ChangeLog (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/JavaScriptCore/ChangeLog        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/JavaScriptCore/ChangeLog        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2014-04-17  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
+        Merge r168565
+
+    2014-05-09  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+            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&lt;-&gt;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.
+
</ins><span class="cx"> 2014-05-06  Michael Saboff  &lt;msaboff@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewd build fix for C-LOOP after r168396.
</span></span></pre></div>
<a id="branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectorh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspector.h (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspector.h        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -31,13 +31,14 @@
</span><span class="cx"> #import &quot;RemoteInspectorXPCConnection.h&quot;
</span><span class="cx"> #import &lt;wtf/Forward.h&gt;
</span><span class="cx"> #import &lt;wtf/HashMap.h&gt;
</span><del>-#import &lt;wtf/Forward.h&gt;
</del><ins>+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> OBJC_CLASS NSDictionary;
</span><span class="cx"> OBJC_CLASS NSString;
</span><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="cx"> 
</span><ins>+class RemoteInspectorClient;
</ins><span class="cx"> class RemoteInspectorDebuggable;
</span><span class="cx"> class RemoteInspectorDebuggableConnection;
</span><span class="cx"> struct RemoteInspectorDebuggableInfo;
</span><span class="lines">@@ -60,6 +61,12 @@
</span><span class="cx">     void start();
</span><span class="cx">     void stop();
</span><span class="cx"> 
</span><ins>+    bool hasParentProcessInformation() const { return m_parentProcessIdentifier != 0; }
+    pid_t parentProcessIdentifier() const { return m_parentProcessIdentifier; }
+    RetainPtr&lt;CFDataRef&gt; parentProcessAuditData() const { return m_parentProcessAuditData; }
+    void setParentProcessInformation(pid_t, RetainPtr&lt;CFDataRef&gt; auditData);
+    void setParentProcessInfomationIsDelayed();
+
</ins><span class="cx"> private:
</span><span class="cx">     RemoteInspector();
</span><span class="cx"> 
</span><span class="lines">@@ -85,6 +92,7 @@
</span><span class="cx">     void receivedDidCloseMessage(NSDictionary *userInfo);
</span><span class="cx">     void receivedGetListingMessage(NSDictionary *userInfo);
</span><span class="cx">     void receivedIndicateMessage(NSDictionary *userInfo);
</span><ins>+    void receivedProxyApplicationSetupMessage(NSDictionary *userInfo);
</ins><span class="cx">     void receivedConnectionDiedMessage(NSDictionary *userInfo);
</span><span class="cx"> 
</span><span class="cx">     static bool startEnabled;
</span><span class="lines">@@ -98,12 +106,17 @@
</span><span class="cx">     HashMap&lt;unsigned, std::pair&lt;RemoteInspectorDebuggable*, RemoteInspectorDebuggableInfo&gt;&gt; m_debuggableMap;
</span><span class="cx">     HashMap&lt;unsigned, RefPtr&lt;RemoteInspectorDebuggableConnection&gt;&gt; m_connectionMap;
</span><span class="cx">     RefPtr&lt;RemoteInspectorXPCConnection&gt; m_xpcConnection;
</span><ins>+
</ins><span class="cx">     dispatch_queue_t m_xpcQueue;
</span><span class="cx">     unsigned m_nextAvailableIdentifier;
</span><span class="cx">     int m_notifyToken;
</span><span class="cx">     bool m_enabled;
</span><span class="cx">     bool m_hasActiveDebugSession;
</span><span class="cx">     bool m_pushScheduled;
</span><ins>+
+    pid_t m_parentProcessIdentifier;
+    RetainPtr&lt;CFDataRef&gt; m_parentProcessAuditData;
+    bool m_shouldSendParentProcessInformation;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectormm"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspector.mm        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -87,6 +87,8 @@
</span><span class="cx">     , m_enabled(false)
</span><span class="cx">     , m_hasActiveDebugSession(false)
</span><span class="cx">     , m_pushScheduled(false)
</span><ins>+    , m_parentProcessIdentifier(0)
+    , m_shouldSendParentProcessInformation(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -248,6 +250,22 @@
</span><span class="cx">     pushListingSoon();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark - Proxy Application Information
+
+void RemoteInspector::setParentProcessInformation(pid_t pid, RetainPtr&lt;CFDataRef&gt; auditData)
+{
+    std::lock_guard&lt;std::mutex&gt; lock(m_mutex);
+
+    if (m_parentProcessIdentifier || m_parentProcessAuditData)
+        return;
+
+    m_parentProcessIdentifier = pid;
+    m_parentProcessAuditData = auditData;
+
+    if (m_shouldSendParentProcessInformation)
+        receivedProxyApplicationSetupMessage(nil);
+}
+
</ins><span class="cx"> #pragma mark - RemoteInspectorXPCConnection::Client
</span><span class="cx"> 
</span><span class="cx"> void RemoteInspector::xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo)
</span><span class="lines">@@ -269,6 +287,8 @@
</span><span class="cx">         receivedGetListingMessage(userInfo);
</span><span class="cx">     else if ([messageName isEqualToString:WIRIndicateMessage])
</span><span class="cx">         receivedIndicateMessage(userInfo);
</span><ins>+    else if ([messageName isEqualToString:WIRProxyApplicationSetupMessage])
+        receivedProxyApplicationSetupMessage(userInfo);
</ins><span class="cx">     else if ([messageName isEqualToString:WIRConnectionDiedMessage])
</span><span class="cx">         receivedConnectionDiedMessage(userInfo);
</span><span class="cx">     else
</span><span class="lines">@@ -334,11 +354,6 @@
</span><span class="cx">     if (debuggableInfo.hasLocalDebugger)
</span><span class="cx">         [debuggableDetails setObject:@YES forKey:WIRHasLocalDebuggerKey];
</span><span class="cx"> 
</span><del>-    if (debuggableInfo.hasParentProcess()) {
-        NSString *parentApplicationIdentifier = [NSString stringWithFormat:@&quot;PID:%lu&quot;, (unsigned long)debuggableInfo.parentProcessIdentifier];
-        [debuggableDetails setObject:parentApplicationIdentifier forKey:WIRHostApplicationIdentifierKey];
-    }
-
</del><span class="cx">     return debuggableDetails;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -506,6 +521,32 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+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&lt;std::mutex&gt; lock(m_mutex);
+            if (m_shouldSendParentProcessInformation)
+                stopInternal(StopSource::XPCMessage);
+        });
+        return;
+    }
+
+    m_shouldSendParentProcessInformation = false;
+
+    m_xpcConnection-&gt;sendMessage(WIRProxyApplicationSetupResponseMessage, @{
+        WIRProxyApplicationParentPIDKey: @(m_parentProcessIdentifier),
+        WIRProxyApplicationParentAuditDataKey: (NSData *)m_parentProcessAuditData.get(),
+    });
+}
+
</ins><span class="cx"> void RemoteInspector::receivedConnectionDiedMessage(NSDictionary *userInfo)
</span><span class="cx"> {
</span><span class="cx">     NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];
</span></span></pre></div>
<a id="branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectorConstantsh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -81,5 +81,9 @@
</span><span class="cx"> // These definitions are shared between webinspectord and WebKit.
</span><span class="cx"> 
</span><span class="cx"> #define WIRPermissionDenied                     @&quot;WIRPermissionDenied&quot;
</span><ins>+#define WIRProxyApplicationParentPIDKey         @&quot;WIRProxyApplicationParentPID&quot;
+#define WIRProxyApplicationParentAuditDataKey   @&quot;WIRProxyApplicationParentAuditData&quot;
+#define WIRProxyApplicationSetupMessage         @&quot;WIRProxyApplicationSetupMessage&quot;
+#define WIRProxyApplicationSetupResponseMessage @&quot;WIRProxyApplicationSetupResponseMessage&quot;
</ins><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggablecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -73,7 +73,6 @@
</span><span class="cx">     info.url = url();
</span><span class="cx">     info.hasLocalDebugger = hasLocalDebugger();
</span><span class="cx">     info.remoteDebuggingAllowed = remoteDebuggingAllowed();
</span><del>-    info.parentProcessIdentifier = parentProcessIdentifier();
</del><span class="cx">     return info;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari53834branchSourceJavaScriptCoreinspectorremoteRemoteInspectorDebuggableh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -56,7 +56,6 @@
</span><span class="cx">     virtual String name() const { return String(); } // JavaScript and Web
</span><span class="cx">     virtual String url() const { return String(); } // Web
</span><span class="cx">     virtual bool hasLocalDebugger() const = 0;
</span><del>-    virtual pid_t parentProcessIdentifier() const { return 0; }
</del><span class="cx"> 
</span><span class="cx">     virtual void connect(InspectorFrontendChannel*) = 0;
</span><span class="cx">     virtual void disconnect() = 0;
</span><span class="lines">@@ -74,19 +73,15 @@
</span><span class="cx">         , type(RemoteInspectorDebuggable::JavaScript)
</span><span class="cx">         , hasLocalDebugger(false)
</span><span class="cx">         , remoteDebuggingAllowed(false)
</span><del>-        , parentProcessIdentifier(0)
</del><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool hasParentProcess() const { return !!parentProcessIdentifier; }
-
</del><span class="cx">     unsigned identifier;
</span><span class="cx">     RemoteInspectorDebuggable::DebuggableType type;
</span><span class="cx">     String name;
</span><span class="cx">     String url;
</span><span class="cx">     bool hasLocalDebugger;
</span><span class="cx">     bool remoteDebuggingAllowed;
</span><del>-    pid_t parentProcessIdentifier;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/ChangeLog (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/ChangeLog        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebCore/ChangeLog        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-04-17  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
+        Merge r168565
+
+    2014-05-09  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+            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.
+
</ins><span class="cx"> 2014-05-09  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r168460
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCoreinspectorInspectorClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/inspector/InspectorClient.h (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/inspector/InspectorClient.h        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebCore/inspector/InspectorClient.h        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -49,10 +49,6 @@
</span><span class="cx">     virtual void bringFrontendToFront() = 0;
</span><span class="cx">     virtual void didResizeMainFrame(Frame*) { }
</span><span class="cx"> 
</span><del>-#if ENABLE(REMOTE_INSPECTOR)
-    virtual pid_t parentProcessIdentifier() const { return 0; }
-#endif
-
</del><span class="cx">     virtual void highlight() = 0;
</span><span class="cx">     virtual void hideHighlight() = 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepagePageDebuggablecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/page/PageDebuggable.cpp (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/PageDebuggable.cpp        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebCore/page/PageDebuggable.cpp        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><del>-#include &quot;InspectorClient.h&quot;
</del><span class="cx"> #include &quot;InspectorController.h&quot;
</span><span class="cx"> #include &quot;InspectorForwarding.h&quot;
</span><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="lines">@@ -71,14 +70,6 @@
</span><span class="cx">     return m_page.inspectorController().hasLocalFrontend();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-pid_t PageDebuggable::parentProcessIdentifier() const
-{
-    if (InspectorClient* inspectorClient = m_page.inspectorController().inspectorClient())
-        return inspectorClient-&gt;parentProcessIdentifier();
-
-    return 0;
-}
-
</del><span class="cx"> void PageDebuggable::connect(Inspector::InspectorFrontendChannel* channel)
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(IOS)
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebCorepagePageDebuggableh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebCore/page/PageDebuggable.h (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebCore/page/PageDebuggable.h        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebCore/page/PageDebuggable.h        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -46,7 +46,6 @@
</span><span class="cx">     virtual String name() const override;
</span><span class="cx">     virtual String url() const override;
</span><span class="cx">     virtual bool hasLocalDebugger() const override;
</span><del>-    virtual pid_t parentProcessIdentifier() const override;
</del><span class="cx"> 
</span><span class="cx">     virtual void connect(Inspector::InspectorFrontendChannel*) override;
</span><span class="cx">     virtual void disconnect() override;
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit/mac/ChangeLog (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit/mac/ChangeLog        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebKit/mac/ChangeLog        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-04-17  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
+        Merge r168565
+
+    2014-05-09  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+            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:
+
</ins><span class="cx"> 2014-05-08  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r168500
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebView.mm (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebView.mm        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebView.mm        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -1923,30 +1923,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-- (void)setHostApplicationBundleId:(NSString *)bundleId name:(NSString *)name
</del><ins>+- (void)_setHostApplicationProcessIdentifier:(pid_t)pid auditToken:(audit_token_t)auditToken
</ins><span class="cx"> {
</span><del>-    if (![_private-&gt;hostApplicationBundleId isEqualToString:bundleId]) {
-        [_private-&gt;hostApplicationBundleId release];
-        _private-&gt;hostApplicationBundleId = [bundleId copy];
-    }
-
-    if (![_private-&gt;hostApplicationName isEqualToString:name]) {
-        [_private-&gt;hostApplicationName release];
-        _private-&gt;hostApplicationName = [name copy];
-    }
-
-    // FIXME: This has not yet been ported to Inspector::RemoteInspectorServer.
</del><ins>+    RetainPtr&lt;CFDataRef&gt; auditData = adoptCF(CFDataCreate(nullptr, (const UInt8*)&amp;auditToken, sizeof(auditToken)));
+    RemoteInspector::shared().setParentProcessInformation(pid, auditData);
</ins><span class="cx"> }
</span><del>-
-- (NSString *)hostApplicationBundleId
-{
-    return _private-&gt;hostApplicationBundleId;
-}
-
-- (NSString *)hostApplicationName
-{
-    return _private-&gt;hostApplicationName;
-}
</del><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> #endif // ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKitmacWebViewWebViewDatah"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewData.h (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewData.h        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewData.h        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -256,8 +256,6 @@
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     WebIndicateLayer *indicateLayer;
</span><del>-    NSString *hostApplicationBundleId;
-    NSString *hostApplicationName;
</del><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKitmacWebViewWebViewDatamm"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewData.mm (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewData.mm        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewData.mm        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -153,8 +153,6 @@
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     [indicateLayer release];
</span><del>-    [hostApplicationBundleId release];
-    [hostApplicationName release];
</del><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKitmacWebViewWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewPrivate.h (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewPrivate.h        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebKit/mac/WebView/WebViewPrivate.h        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -326,27 +326,7 @@
</span><span class="cx"> - (void)setShowingInspectorIndication:(BOOL)enabled;
</span><span class="cx"> 
</span><span class="cx"> #if TARGET_OS_IPHONE
</span><del>-/*!
-    @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;
</del><ins>+- (void)_setHostApplicationProcessIdentifier:(pid_t)pid auditToken:(audit_token_t)auditToken;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE_REMOTE_INSPECTOR
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/ChangeLog (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/ChangeLog        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebKit2/ChangeLog        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -1,5 +1,27 @@
</span><span class="cx"> 2014-04-17  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r168565
+
+    2014-05-09  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+            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-04-17  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
</ins><span class="cx">         Merge r168582
</span><span class="cx"> 
</span><span class="cx">     2014-05-10  Anders Carlsson  &lt;andersca@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2WebProcessWebCoreSupportWebInspectorClientcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -33,10 +33,6 @@
</span><span class="cx"> #include &lt;WebCore/InspectorController.h&gt;
</span><span class="cx"> #include &lt;WebCore/Page.h&gt;
</span><span class="cx"> 
</span><del>-#if ENABLE(REMOTE_INSPECTOR)
-#include &quot;WebProcess.h&quot;
-#endif
-
</del><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -71,13 +67,6 @@
</span><span class="cx">         m_page-&gt;inspector()-&gt;updateDockingAvailability();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if ENABLE(REMOTE_INSPECTOR)
-pid_t WebInspectorClient::parentProcessIdentifier() const
-{
-    return WebProcess::shared().presenterApplicationPid();
-}
-#endif
-
</del><span class="cx"> void WebInspectorClient::highlight()
</span><span class="cx"> {
</span><span class="cx">     if (!m_highlightOverlay) {
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2WebProcessWebCoreSupportWebInspectorClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -58,10 +58,6 @@
</span><span class="cx">     virtual void bringFrontendToFront() override;
</span><span class="cx">     virtual void didResizeMainFrame(WebCore::Frame*) override;
</span><span class="cx"> 
</span><del>-#if ENABLE(REMOTE_INSPECTOR)
-    virtual pid_t parentProcessIdentifier() const override;
-#endif
-
</del><span class="cx">     virtual void highlight() override;
</span><span class="cx">     virtual void hideHighlight() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari53834branchSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebProcess.cpp (168643 => 168644)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebProcess.cpp        2014-05-12 21:06:53 UTC (rev 168643)
+++ branches/safari-538.34-branch/Source/WebKit2/WebProcess/WebProcess.cpp        2014-05-12 21:07:57 UTC (rev 168644)
</span><span class="lines">@@ -123,6 +123,10 @@
</span><span class="cx"> #include &quot;WebResourceLoadScheduler.h&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(REMOTE_INSPECTOR)
+#include &lt;JavaScriptCore/RemoteInspector.h&gt;
+#endif
+
</ins><span class="cx"> #if USE(SOUP) &amp;&amp; !ENABLE(CUSTOM_PROTOCOLS)
</span><span class="cx"> #include &quot;WebSoupRequestManager.h&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -366,6 +370,14 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     setEnabledServices(parameters.hasImageServices, parameters.hasSelectionServices);
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(REMOTE_INSPECTOR)
+    audit_token_t auditToken;
+    if (parentProcessConnection()-&gt;getAuditToken(auditToken)) {
+        RetainPtr&lt;CFDataRef&gt; auditData = adoptCF(CFDataCreate(nullptr, (const UInt8*)&amp;auditToken, sizeof(auditToken)));
+        Inspector::RemoteInspector::shared().setParentProcessInformation(presenterApplicationPid(), auditData);
+    }
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span></span></pre>
</div>
</div>

</body>
</html>