<!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>[192756] trunk/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/192756">192756</a></dd>
<dt>Author</dt> <dd>bburg@apple.com</dd>
<dt>Date</dt> <dd>2015-11-23 18:49:51 -0800 (Mon, 23 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: inspector settings should not be shared between different inspection levels
https://bugs.webkit.org/show_bug.cgi?id=151151

Reviewed by Timothy Hatcher.

Source/WebCore:

InspectorController and InspectorFrontendClient should know how to compute their
inspection levels, so that this level can be exposed to the Inspector frontend for
preference disambiguation by inspection level.

 - A Page with normal web content has an inspection level of 0.
 - The first Web Inspector has an inspection level of 1.
 - The second Web Inspector that inspects the Inspector has an inspection level of 2.
 - And so forth...

For local frontend clients (WK1 and the ProtocolTestStub), the inspection level of
a Page computed as follows:

- If the page's inspector controller has no frontend client, then the Page
is normal web content (level 0).
- If the page's inspector controller has a frontend client, ask for its inspection level.
A frontend client looks at the inspection level reported by inspected page's inspector
controller and increments by one to account for the crossed inspection boundary.

No new tests, this is blocked by test infrastructure fixes (https://webkit.org/b/151573).

* inspector/InspectorController.cpp:
(WebCore::InspectorController::inspectionLevel): Added.
(WebCore::InspectorController::hasInspectorFrontendClient): Deleted.
* inspector/InspectorController.h:
* inspector/InspectorFrontendClient.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::canAttachWindow): Check inspectionLevel().
(WebCore::InspectorFrontendClientLocal::inspectionLevel): Added.
* inspector/InspectorFrontendClientLocal.h:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::inspectionLevel): Added.
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::populate): Check inspectionLevel().

Source/WebInspectorUI:

It's really annoying to have shared settings between Inspector^1 and Inspector^2, because
they are not designed to respond to external changes to local storage keys. As a result,
the two inspectors seemingly have different settings while both are open, but the settings
clobber each other depending on which inspector is closed first. On the next inspector
being opened, it has settings that reflect whichever inspector closed last.

To fix this, alter the local storage key prefix to incude the inspection level when it is
greater than 1 (i.e., inspecting the inspector). The storage prefix becomes
&quot;com.apple.WebInspector-${inspectionLevel}.&quot; in this case.
This is backwards-compatible for normal Inspector, who keeps the same storage prefix.

Alternate approaches that were considered and abandoned:

 - Use separate WKWebSiteDataStores for each inspection level. This API (as it currently is)
does not support multiple on-disk storage locations. We don't want to add an entirely new
Library directory for each inspector level, and sharing a single location doesn't fix the
shared-settings bug. Changing storage location would lose all existing Inspector settings.

 - Sync settings between multiple open Inspectors. This would be catastrophic, as changing
the active tab on one inspector would immediately propagate to the other open inspectors.

* UserInterface/Models/Setting.js:
(WebInspector.Setting):
* UserInterface/Protocol/InspectorFrontendHostStub.js:
(window.InspectorFrontendHost.WebInspector.InspectorFrontendHostStub.prototype.inspectionLevel):

Source/WebKit2:

In WebKit2, we already track the inspection level of WebPages in order to give inspectors
different page groups. Send the inspection level to WebInspectorUI WebProcess when
establishing a connection from the UIProcess. Use this number in the FrontendClient.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::inspectionLevel): Renamed from inspectorLevel to be consistent.
(WebKit::WebInspectorProxy::inspectorPageGroupIdentifier):
(WebKit::WebInspectorProxy::didRelaunchInspectorPageProcess):
(WebKit::WebInspectorProxy::eagerlyCreateInspectorPage):
(WebKit::WebInspectorProxy::createInspectorPage):
(WebKit::WebInspectorProxy::inspectorLevel): Deleted.
* UIProcess/WebInspectorProxy.h:
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::updateInspectorWindowTitle):
* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::establishConnection):
* WebProcess/WebPage/WebInspectorUI.h:
* WebProcess/WebPage/WebInspectorUI.messages.in:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorControllercpp">trunk/Source/WebCore/inspector/InspectorController.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorControllerh">trunk/Source/WebCore/inspector/InspectorController.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorFrontendClienth">trunk/Source/WebCore/inspector/InspectorFrontendClient.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorFrontendClientLocalcpp">trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorFrontendClientLocalh">trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorFrontendHostcpp">trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorFrontendHosth">trunk/Source/WebCore/inspector/InspectorFrontendHost.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorFrontendHostidl">trunk/Source/WebCore/inspector/InspectorFrontendHost.idl</a></li>
<li><a href="#trunkSourceWebCorepageContextMenuControllercpp">trunk/Source/WebCore/page/ContextMenuController.cpp</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsSettingjs">trunk/Source/WebInspectorUI/UserInterface/Models/Setting.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolInspectorFrontendHostStubjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendHostStub.js</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebInspectorProxycpp">trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebInspectorProxyh">trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebInspectorProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebInspectorUIcpp">trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebInspectorUIh">trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebInspectorUImessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/ChangeLog        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2015-11-23  Brian Burg  &lt;bburg@apple.com&gt;
+
+        Web Inspector: inspector settings should not be shared between different inspection levels
+        https://bugs.webkit.org/show_bug.cgi?id=151151
+
+        Reviewed by Timothy Hatcher.
+
+        InspectorController and InspectorFrontendClient should know how to compute their
+        inspection levels, so that this level can be exposed to the Inspector frontend for
+        preference disambiguation by inspection level.
+
+         - A Page with normal web content has an inspection level of 0.
+         - The first Web Inspector has an inspection level of 1.
+         - The second Web Inspector that inspects the Inspector has an inspection level of 2.
+         - And so forth...
+
+        For local frontend clients (WK1 and the ProtocolTestStub), the inspection level of
+        a Page computed as follows:
+
+        - If the page's inspector controller has no frontend client, then the Page
+        is normal web content (level 0).
+        - If the page's inspector controller has a frontend client, ask for its inspection level.
+        A frontend client looks at the inspection level reported by inspected page's inspector
+        controller and increments by one to account for the crossed inspection boundary.
+
+        No new tests, this is blocked by test infrastructure fixes (https://webkit.org/b/151573).
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::inspectionLevel): Added.
+        (WebCore::InspectorController::hasInspectorFrontendClient): Deleted.
+        * inspector/InspectorController.h:
+        * inspector/InspectorFrontendClient.h:
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::canAttachWindow): Check inspectionLevel().
+        (WebCore::InspectorFrontendClientLocal::inspectionLevel): Added.
+        * inspector/InspectorFrontendClientLocal.h:
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::inspectionLevel): Added.
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.idl:
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::populate): Check inspectionLevel().
+
</ins><span class="cx"> 2015-11-20  Brian Burg  &lt;bburg@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: RemoteInspector should track targets and connections for remote automation
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.cpp        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -219,9 +219,9 @@
</span><span class="cx">     return m_frontendRouter-&gt;hasRemoteFrontend();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool InspectorController::hasInspectorFrontendClient() const
</del><ins>+unsigned InspectorController::inspectionLevel() const
</ins><span class="cx"> {
</span><del>-    return m_inspectorFrontendClient;
</del><ins>+    return m_inspectorFrontendClient ? m_inspectorFrontendClient-&gt;inspectionLevel() : 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorController::didClearWindowObjectInWorld(Frame&amp; frame, DOMWrapperWorld&amp; world)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.h (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.h        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/inspector/InspectorController.h        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -84,7 +84,7 @@
</span><span class="cx">     WEBCORE_EXPORT void show();
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void setInspectorFrontendClient(InspectorFrontendClient*);
</span><del>-    bool hasInspectorFrontendClient() const;
</del><ins>+    unsigned inspectionLevel() const;
</ins><span class="cx">     void didClearWindowObjectInWorld(Frame&amp;, DOMWrapperWorld&amp;);
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void dispatchMessageFromFrontend(const String&amp; message);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorFrontendClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorFrontendClient.h (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorFrontendClient.h        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClient.h        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx">     virtual void moveWindowBy(float x, float y) = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual String localizedStringsURL() = 0;
</span><ins>+    virtual unsigned inspectionLevel() const = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual void bringToFront() = 0;
</span><span class="cx">     virtual void closeWindow() = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorFrontendClientLocalcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -185,7 +185,7 @@
</span><span class="cx"> bool InspectorFrontendClientLocal::canAttachWindow()
</span><span class="cx"> {
</span><span class="cx">     // Don't allow attaching to another inspector -- two inspectors in one window is too much!
</span><del>-    bool isInspectorPage = m_inspectedPageController-&gt;hasInspectorFrontendClient();
</del><ins>+    bool isInspectorPage = m_inspectedPageController-&gt;inspectionLevel() &gt; 0;
</ins><span class="cx">     if (isInspectorPage)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="lines">@@ -357,6 +357,11 @@
</span><span class="cx">     return m_inspectedPageController-&gt;isUnderTest();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+unsigned InspectorFrontendClientLocal::inspectionLevel() const
+{
+    return m_inspectedPageController-&gt;inspectionLevel() + 1;
+}
+
</ins><span class="cx"> bool InspectorFrontendClientLocal::evaluateAsBoolean(const String&amp; expression)
</span><span class="cx"> {
</span><span class="cx">     Deprecated::ScriptValue value = m_frontendPage-&gt;mainFrame().script().executeScript(expression);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorFrontendClientLocalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -79,6 +79,7 @@
</span><span class="cx">     WEBCORE_EXPORT virtual void sendMessageToBackend(const String&amp; message) override final;
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT virtual bool isUnderTest() override final;
</span><ins>+    WEBCORE_EXPORT virtual unsigned inspectionLevel() const override final;
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT bool canAttachWindow();
</span><span class="cx">     WEBCORE_EXPORT void setDockingUnavailable(bool);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorFrontendHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -236,6 +236,11 @@
</span><span class="cx">     return ASCIILiteral(&quot;web&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+unsigned InspectorFrontendHost::inspectionLevel()
+{
+    return m_client ? m_client-&gt;inspectionLevel() : 1;
+}
+
</ins><span class="cx"> String InspectorFrontendHost::platform()
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(MAC) || PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorFrontendHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> 
</span><span class="cx">     String localizedStringsURL();
</span><span class="cx">     String debuggableType();
</span><ins>+    unsigned inspectionLevel();
</ins><span class="cx"> 
</span><span class="cx">     String platform();
</span><span class="cx">     String port();
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorFrontendHostidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> 
</span><span class="cx">     DOMString localizedStringsURL();
</span><span class="cx">     DOMString debuggableType();
</span><ins>+    unsigned long inspectionLevel();
</ins><span class="cx"> 
</span><span class="cx">     void copyText(DOMString text);
</span><span class="cx">     void killText(DOMString text, boolean shouldPrependToKillRing, boolean shouldStartNewSequence);
</span></span></pre></div>
<a id="trunkSourceWebCorepageContextMenuControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/ContextMenuController.cpp        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -897,7 +897,7 @@
</span><span class="cx">                 appendItem(SpeechMenuItem, m_contextMenu.get());
</span><span class="cx"> #endif                
</span><span class="cx">             } else {
</span><del>-                if (!(frame-&gt;page() &amp;&amp; (frame-&gt;page()-&gt;inspectorController().hasInspectorFrontendClient() || frame-&gt;page()-&gt;inspectorController().hasRemoteFrontend()))) {
</del><ins>+                if (!(frame-&gt;page() &amp;&amp; (frame-&gt;page()-&gt;inspectorController().inspectionLevel() &gt; 0 || frame-&gt;page()-&gt;inspectorController().hasRemoteFrontend()))) {
</ins><span class="cx"> 
</span><span class="cx">                 // In GTK+ unavailable items are not hidden but insensitive.
</span><span class="cx"> #if PLATFORM(GTK)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -1,5 +1,38 @@
</span><span class="cx"> 2015-11-23  Brian Burg  &lt;bburg@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: inspector settings should not be shared between different inspection levels
+        https://bugs.webkit.org/show_bug.cgi?id=151151
+
+        Reviewed by Timothy Hatcher.
+
+        It's really annoying to have shared settings between Inspector^1 and Inspector^2, because
+        they are not designed to respond to external changes to local storage keys. As a result,
+        the two inspectors seemingly have different settings while both are open, but the settings
+        clobber each other depending on which inspector is closed first. On the next inspector
+        being opened, it has settings that reflect whichever inspector closed last.
+
+        To fix this, alter the local storage key prefix to incude the inspection level when it is
+        greater than 1 (i.e., inspecting the inspector). The storage prefix becomes
+        &quot;com.apple.WebInspector-${inspectionLevel}.&quot; in this case.
+        This is backwards-compatible for normal Inspector, who keeps the same storage prefix. 
+
+        Alternate approaches that were considered and abandoned:
+
+         - Use separate WKWebSiteDataStores for each inspection level. This API (as it currently is)
+        does not support multiple on-disk storage locations. We don't want to add an entirely new
+        Library directory for each inspector level, and sharing a single location doesn't fix the
+        shared-settings bug. Changing storage location would lose all existing Inspector settings.
+
+         - Sync settings between multiple open Inspectors. This would be catastrophic, as changing
+        the active tab on one inspector would immediately propagate to the other open inspectors.
+
+        * UserInterface/Models/Setting.js:
+        (WebInspector.Setting):
+        * UserInterface/Protocol/InspectorFrontendHostStub.js:
+        (window.InspectorFrontendHost.WebInspector.InspectorFrontendHostStub.prototype.inspectionLevel):
+
+2015-11-23  Brian Burg  &lt;bburg@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: use Cmd-Option-L and Cmd-Option-R for toggling navigation and details sidebars
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=151572
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsSettingjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Setting.js (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Setting.js        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Setting.js        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -36,7 +36,10 @@
</span><span class="cx">         super();
</span><span class="cx"> 
</span><span class="cx">         this._name = name;
</span><del>-        this._localStorageKey = WebInspector.Setting.LocalStorageKeyPrefix + name;
</del><ins>+
+        let inspectionLevel = InspectorFrontendHost.inspectionLevel();
+        let levelString = inspectionLevel &gt; 1 ? &quot;-&quot; + inspectionLevel : &quot;&quot;;
+        this._localStorageKey = `com.apple.WebInspector${levelString}.${name}`;
</ins><span class="cx">         this._defaultValue = defaultValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -86,8 +89,6 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-WebInspector.Setting.LocalStorageKeyPrefix = &quot;com.apple.WebInspector.&quot;;
-
</del><span class="cx"> WebInspector.Setting.Event = {
</span><span class="cx">     Changed: &quot;setting-changed&quot;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolInspectorFrontendHostStubjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendHostStub.js (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendHostStub.js        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendHostStub.js        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -110,6 +110,11 @@
</span><span class="cx">             return &quot;web&quot;;
</span><span class="cx">         },
</span><span class="cx"> 
</span><ins>+        inspectionLevel: function()
+        {
+            return 1;
+        },
+
</ins><span class="cx">         inspectedURLChanged: function(title)
</span><span class="cx">         {
</span><span class="cx">             document.title = title;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebKit2/ChangeLog        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2015-11-23  Brian Burg  &lt;bburg@apple.com&gt;
+
+        Web Inspector: inspector settings should not be shared between different inspection levels
+        https://bugs.webkit.org/show_bug.cgi?id=151151
+
+        Reviewed by Timothy Hatcher.
+
+        In WebKit2, we already track the inspection level of WebPages in order to give inspectors
+        different page groups. Send the inspection level to WebInspectorUI WebProcess when
+        establishing a connection from the UIProcess. Use this number in the FrontendClient.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::inspectionLevel): Renamed from inspectorLevel to be consistent.
+        (WebKit::WebInspectorProxy::inspectorPageGroupIdentifier):
+        (WebKit::WebInspectorProxy::didRelaunchInspectorPageProcess):
+        (WebKit::WebInspectorProxy::eagerlyCreateInspectorPage):
+        (WebKit::WebInspectorProxy::createInspectorPage):
+        (WebKit::WebInspectorProxy::inspectorLevel): Deleted.
+        * UIProcess/WebInspectorProxy.h:
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::updateInspectorWindowTitle):
+        * WebProcess/WebPage/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::establishConnection):
+        * WebProcess/WebPage/WebInspectorUI.h:
+        * WebProcess/WebPage/WebInspectorUI.messages.in:
+
</ins><span class="cx"> 2015-11-23  Gyuyoung Kim  &lt;gyuyoung.kim@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r188206): [EFL] Missing to adjust scrollbar size to ewk_view_contents_size_get API test
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebInspectorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-unsigned WebInspectorProxy::inspectorLevel() const
</del><ins>+unsigned WebInspectorProxy::inspectionLevel() const
</ins><span class="cx"> {
</span><span class="cx">     auto findResult = pageLevelMap().find(inspectedPage());
</span><span class="cx">     if (findResult != pageLevelMap().end())
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> 
</span><span class="cx"> String WebInspectorProxy::inspectorPageGroupIdentifier() const
</span><span class="cx"> {
</span><del>-    return String::format(&quot;__WebInspectorPageGroupLevel%u__&quot;, inspectorLevel());
</del><ins>+    return String::format(&quot;__WebInspectorPageGroupLevel%u__&quot;, inspectionLevel());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebPreferences&amp; WebInspectorProxy::inspectorPagePreferences() const
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx">     // When didRelaunchInspectorPageProcess is called we can assume it is during a load request.
</span><span class="cx">     // Any messages we would have sent to a terminated process need to be re-sent.
</span><span class="cx"> 
</span><del>-    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::EstablishConnection(m_connectionIdentifier, m_inspectedPage-&gt;pageID(), m_underTest), m_inspectorPage-&gt;pageID());
</del><ins>+    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::EstablishConnection(m_connectionIdentifier, m_inspectedPage-&gt;pageID(), m_underTest, inspectionLevel()), m_inspectorPage-&gt;pageID());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebInspectorProxy::showConsole()
</span><span class="lines">@@ -442,7 +442,7 @@
</span><span class="cx">     if (!m_inspectorPage)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    pageLevelMap().set(m_inspectorPage, inspectorLevel());
</del><ins>+    pageLevelMap().set(m_inspectorPage, inspectionLevel());
</ins><span class="cx"> 
</span><span class="cx">     WKPagePolicyClientV1 policyClient = {
</span><span class="cx">         { 1, this },
</span><span class="lines">@@ -530,7 +530,7 @@
</span><span class="cx"> 
</span><span class="cx">     m_connectionIdentifier = WTF::move(connectionIdentifier);
</span><span class="cx"> 
</span><del>-    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::EstablishConnection(m_connectionIdentifier, m_inspectedPage-&gt;pageID(), m_underTest), m_inspectorPage-&gt;pageID());
</del><ins>+    m_inspectorPage-&gt;process().send(Messages::WebInspectorUI::EstablishConnection(m_connectionIdentifier, m_inspectedPage-&gt;pageID(), m_underTest, inspectionLevel()), m_inspectorPage-&gt;pageID());
</ins><span class="cx"> 
</span><span class="cx">     if (!m_underTest) {
</span><span class="cx">         m_canAttach = platformCanAttach(canAttach);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebInspectorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -208,9 +208,10 @@
</span><span class="cx"> 
</span><span class="cx">     void open();
</span><span class="cx"> 
</span><del>-    // The inspector level is used to give different preferences to each inspector
-    // level by setting a per-level page group identifier.
-    unsigned inspectorLevel() const;
</del><ins>+    // The inspection level is used to give different preferences to each inspector
+    // by setting a per-level page group identifier. Local storage settings in the frontend
+    // also use the inspection level in the key prefix to disambiguate persistent view state.
+    unsigned inspectionLevel() const;
</ins><span class="cx">     String inspectorPageGroupIdentifier() const;
</span><span class="cx">     WebPreferences&amp; inspectorPagePreferences() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebInspectorProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -328,9 +328,9 @@
</span><span class="cx">     if (!m_inspectorWindow)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    unsigned inspectionLevel = inspectorLevel();
-    if (inspectionLevel &gt; 1) {
-        NSString *debugTitle = [NSString stringWithFormat:WEB_UI_STRING(&quot;Web Inspector [%d] — %@&quot;, &quot;Web Inspector window title when inspecting Web Inspector&quot;), inspectionLevel, (NSString *)m_urlString];
</del><ins>+    unsigned level = inspectionLevel();
+    if (level &gt; 1) {
+        NSString *debugTitle = [NSString stringWithFormat:WEB_UI_STRING(&quot;Web Inspector [%d] — %@&quot;, &quot;Web Inspector window title when inspecting Web Inspector&quot;), level, (NSString *)m_urlString];
</ins><span class="cx">         [m_inspectorWindow setTitle:debugTitle];
</span><span class="cx">     } else {
</span><span class="cx">         NSString *title = [NSString stringWithFormat:WEB_UI_STRING(&quot;Web Inspector — %@&quot;, &quot;Web Inspector window title&quot;), (NSString *)m_urlString];
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebInspectorUIcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebInspectorUI::establishConnection(IPC::Attachment encodedConnectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest)
</del><ins>+void WebInspectorUI::establishConnection(IPC::Attachment encodedConnectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel)
</ins><span class="cx"> {
</span><span class="cx"> #if USE(UNIX_DOMAIN_SOCKETS)
</span><span class="cx">     IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.releaseFileDescriptor());
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx">     m_inspectedPageIdentifier = inspectedPageIdentifier;
</span><span class="cx">     m_frontendAPIDispatcher.reset();
</span><span class="cx">     m_underTest = underTest;
</span><ins>+    m_inspectionLevel = inspectionLevel;
</ins><span class="cx"> 
</span><span class="cx">     m_frontendController = &amp;m_page.corePage()-&gt;inspectorController();
</span><span class="cx">     m_frontendController-&gt;setInspectorFrontendClient(this);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebInspectorUIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">     virtual IPC::ProcessType remoteProcessType() override { return IPC::ProcessType::Web; }
</span><span class="cx"> 
</span><span class="cx">     // Called by WebInspectorUI messages
</span><del>-    void establishConnection(IPC::Attachment connectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest);
</del><ins>+    void establishConnection(IPC::Attachment connectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel);
</ins><span class="cx"> 
</span><span class="cx">     void showConsole();
</span><span class="cx">     void showResources();
</span><span class="lines">@@ -104,6 +104,7 @@
</span><span class="cx">     void sendMessageToBackend(const String&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     bool isUnderTest() override { return m_underTest; }
</span><ins>+    unsigned inspectionLevel() const override { return m_inspectionLevel; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     explicit WebInspectorUI(WebPage&amp;);
</span><span class="lines">@@ -120,6 +121,7 @@
</span><span class="cx">     uint64_t m_inspectedPageIdentifier { 0 };
</span><span class="cx">     bool m_underTest { false };
</span><span class="cx">     DockSide m_dockSide { DockSide::Undocked };
</span><ins>+    unsigned m_inspectionLevel { 1 };
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     mutable String m_localizedStringsURL;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebInspectorUImessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in (192755 => 192756)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in        2015-11-24 02:43:36 UTC (rev 192755)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.messages.in        2015-11-24 02:49:51 UTC (rev 192756)
</span><span class="lines">@@ -21,7 +21,7 @@
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> 
</span><span class="cx"> messages -&gt; WebInspectorUI {
</span><del>-    EstablishConnection(IPC::Attachment connectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest)
</del><ins>+    EstablishConnection(IPC::Attachment connectionIdentifier, uint64_t inspectedPageIdentifier, bool underTest, unsigned inspectionLevel)
</ins><span class="cx"> 
</span><span class="cx">     AttachedBottom()
</span><span class="cx">     AttachedRight()
</span></span></pre>
</div>
</div>

</body>
</html>