<!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>[164830] trunk</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/164830">164830</a></dd>
<dt>Author</dt> <dd>bburg@apple.com</dd>
<dt>Date</dt> <dd>2014-02-27 14:08:10 -0800 (Thu, 27 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: model tests should use a special Test.html inspector page
https://bugs.webkit.org/show_bug.cgi?id=129190
Reviewed by Timothy Hatcher.
Source/WebCore:
Convert InspectorController::isUnderTest() into a flag, and expose an
Internals method so it can be set by the test before opening the inspector.
Test: inspector/test-harness-trivially-works.html
* inspector/InspectorController.cpp:
(WebCore::InspectorController::evaluateForTestInFrontend):
* inspector/InspectorController.h:
* testing/Internals.cpp:
(WebCore::Internals::setInspectorIsUnderTest): Added.
* testing/Internals.h:
* testing/Internals.idl:
Source/WebInspectorUI:
* UserInterface/Base/Test.js: Added.
(WebInspector.loaded):
(WebInspector.contentLoaded):
(WebInspector.updateDockedState):
(InspectorTest.log):
(InspectorTest.assert):
(InspectorTest.debugLog):
(InspectorTest.completeTest):
(InspectorTest.evaluateInPage):
(InspectorTest.addResult):
(InspectorTest.clearResults):
(InspectorTest.pageLoaded):
(InspectorTest.reportUncaughtException):
(.console.logType):
* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackendClass):
(InspectorBackendClass.prototype.dispatch):
(InspectorBackendClass.prototype.runAfterPendingDispatches):
(InspectorBackendClass.prototype._flushPendingScripts):
* UserInterface/Protocol/InspectorObserver.js:
(WebInspector.InspectorObserver.prototype.evaluateForTestInFrontend):
* UserInterface/Test.html: Added.
Source/WebKit/mac:
Support creating a separate test inspector page, based on the value of
InspectorController::isUnderTest(). Modify the navigation policy to check
the URL against both normal and test inspector pages.
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::openInspectorFrontend):
(-[WebInspectorWindowController init]):
(-[WebInspectorWindowController initWithInspectedWebView:isUnderTest:]):
Move the initial navigation of the inspector page to this method, and change
the URL based on the value of InspectorController::isUnderTest().
(-[WebInspectorWindowController inspectorTestPagePath]): Added.
(-[WebInspectorWindowController webView:decidePolicyForNavigationAction:request:frame:decisionListener:]):
Source/WebKit2:
Support creating a separate test inspector page, based on the value of
InspectorController::isUnderTest(). Add this as a separate API call for
WebInspectorProxy. Modify the navigation policy to check the URL against
both normal and test inspector pages.
* UIProcess/WebInspectorProxy.cpp:
(WebKit::isMainOrTestInspectorPage):
(WebKit::decidePolicyForNavigationAction):
(WebKit::WebInspectorProxy::createInspectorPageForTest):
* UIProcess/WebInspectorProxy.h:
* UIProcess/WebInspectorProxy.messages.in:
* UIProcess/efl/WebInspectorProxyEfl.cpp:
(WebKit::WebInspectorProxy::inspectorTestPageURL):
* UIProcess/gtk/WebInspectorProxyGtk.cpp:
(WebKit::WebInspectorProxy::inspectorTestPageURL):
* UIProcess/ios/WebInspectorProxyIOS.mm:
(WebKit::WebInspectorProxy::inspectorTestPageURL):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::inspectorTestPageURL):
* WebProcess/WebCoreSupport/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::openInspectorFrontend):
* WebProcess/WebPage/WebInspector.cpp: Some drive-by nullptr refactorings.
(WebKit::WebInspector::WebInspector):
(WebKit::WebInspector::createInspectorPage):
(WebKit::WebInspector::createInspectorPageForTest):
(WebKit::WebInspector::destroyInspectorPage):
* WebProcess/WebPage/WebInspector.h:
Tools:
Remove code that immediately opens the Web Inspector based on the file path of the test.
Instead, the test page should request that the inspector open inside its `test()` method.
This change is necessary because otherwise, the inspector would be opened too early for
InspectorController::isUnderTest to get set in time, so the normal Web Inspector page
will get loaded instead of the minimal test page.
* DumpRenderTree/efl/DumpRenderTree.cpp:
(createTestRunner):
* DumpRenderTree/gtk/DumpRenderTree.cpp:
(runTest):
* DumpRenderTree/mac/DumpRenderTree.mm:
(runTest):
* DumpRenderTree/win/DumpRenderTree.cpp:
(runTest):
LayoutTests:
Add a stripped-down version of the inspector test script that's used by
all inspector model tests. Clean up the namespaces so things accessible
from only the test page are part of the `InspectorTestProxy` object.
Add a minimal test that exercises the initialization and communication code
paths on the test page and the inspector page.
* http/tests/inspector-protocol/resources/InspectorTest.js: Add a FIXME.
* inspector/inspector-test.js: Added.
(InspectorTestProxy.register):
(runTest.initializeFrontend):
(runTest.runTestInFrontend):
(runTest):
(InspectorTestProxy.completeTest):
(InspectorTestProxy.debugLog):
(InspectorTestProxy.addResult):
(InspectorTestProxy.clearResults):
(InspectorTestProxy.reportUncaughtException):
* inspector/test-harness-trivially-works-expected.txt: Added.
* inspector/test-harness-trivially-works.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectorprotocolresourcesInspectorTestjs">trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js</a></li>
<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="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolInspectorBackendjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolInspectorObserverjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebInspectorClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm</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="#trunkSourceWebKit2UIProcessWebInspectorProxymessagesin">trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcesseflWebInspectorProxyEflcpp">trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessgtkWebInspectorProxyGtkcpp">trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebInspectorProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebInspectorProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebInspectorClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebInspectorcpp">trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebInspectorh">trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeeflDumpRenderTreecpp">trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreegtkDumpRenderTreecpp">trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreemm">trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreewinDumpRenderTreecpp">trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorinspectortestjs">trunk/LayoutTests/inspector/inspector-test.js</a></li>
<li><a href="#trunkLayoutTestsinspectortestharnesstriviallyworksexpectedtxt">trunk/LayoutTests/inspector/test-harness-trivially-works-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectortestharnesstriviallyworkshtml">trunk/LayoutTests/inspector/test-harness-trivially-works.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseTestjs">trunk/Source/WebInspectorUI/UserInterface/Base/Test.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTesthtml">trunk/Source/WebInspectorUI/UserInterface/Test.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/LayoutTests/ChangeLog        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2014-02-27 Brian Burg <bburg@apple.com>
+
+ Web Inspector: model tests should use a special Test.html inspector page
+ https://bugs.webkit.org/show_bug.cgi?id=129190
+
+ Reviewed by Timothy Hatcher.
+
+ Add a stripped-down version of the inspector test script that's used by
+ all inspector model tests. Clean up the namespaces so things accessible
+ from only the test page are part of the `InspectorTestProxy` object.
+
+ Add a minimal test that exercises the initialization and communication code
+ paths on the test page and the inspector page.
+
+ * http/tests/inspector-protocol/resources/InspectorTest.js: Add a FIXME.
+ * inspector/inspector-test.js: Added.
+ (InspectorTestProxy.register):
+ (runTest.initializeFrontend):
+ (runTest.runTestInFrontend):
+ (runTest):
+ (InspectorTestProxy.completeTest):
+ (InspectorTestProxy.debugLog):
+ (InspectorTestProxy.addResult):
+ (InspectorTestProxy.clearResults):
+ (InspectorTestProxy.reportUncaughtException):
+ * inspector/test-harness-trivially-works-expected.txt: Added.
+ * inspector/test-harness-trivially-works.html: Added.
+
</ins><span class="cx"> 2014-02-27 Dirk Schulze <krit@webkit.org>
</span><span class="cx">
</span><span class="cx"> Transform more clip-path pixel tests to reference tests
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectorprotocolresourcesInspectorTestjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -158,6 +158,8 @@
</span><span class="cx"> window.eval(script);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// FIXME: Move model tests off of the stub inspector page, and delete this function
+// since it's now implemented as Test.html. <https://webkit.org/b/129217>
</ins><span class="cx"> InspectorTest.initializeInspectorModels = function()
</span><span class="cx"> {
</span><span class="cx"> // Catch any errors and finish the test early.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorinspectortestjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/inspector-test.js (0 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/inspector-test.js         (rev 0)
+++ trunk/LayoutTests/inspector/inspector-test.js        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -0,0 +1,137 @@
</span><ins>+/*
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This namespace is injected into every test page. Its functions are invoked by
+// InspectorTest methods on the inspector page via RuntimeAgent.evaluate() calls.
+InspectorTestProxy = {};
+InspectorTestProxy._initializers = [];
+
+// Helper scripts like `debugger-test.js` must register their initialization
+// function with this method so it will be marshalled to the inspector page.
+InspectorTestProxy.register = function(initializer)
+{
+ if (typeof initializer === "function")
+ this._initializers.push(initializer.toString());
+}
+
+// This function is called by the test document's body onload handler.
+
+// It initializes the inspector and loads any `*-test.js` helper scripts
+// into the inspector page context.
+function runTest()
+{
+ // Set up the test page before the load event fires.
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+
+ if (window.internals)
+ internals.setInspectorIsUnderTest(true);
+ testRunner.showWebInspector();
+
+ // This function runs the initializer functions in the Inspector page.
+ function initializeFrontend(initializersArray)
+ {
+ for (var initializer of initializersArray) {
+ try {
+ initializer();
+ } catch (e) {
+ console.error("Exception in test initialization: " + e, e.stack || "(no stack trace)");
+ InspectorTest.completeTest();
+ }
+ }
+ }
+
+ // This function runs the test() method in the Inspector page.
+ function runTestInFrontend(testFunction)
+ {
+ try {
+ testFunction();
+ } catch (e) {
+ console.error("Exception during test execution: " + e, e.stack || "(no stack trace)");
+ InspectorTest.completeTest();
+ }
+ }
+
+ var codeStringToEvaluate = "(" + initializeFrontend.toString() + ")([" + InspectorTestProxy._initializers + "]);";
+ testRunner.evaluateInWebInspector(0, codeStringToEvaluate);
+
+ // `test` refers to a function defined in global scope in the test HTML page.
+ codeStringToEvaluate = "(" + runTestInFrontend.toString() + ")(" + test.toString() + ");";
+ testRunner.evaluateInWebInspector(0, codeStringToEvaluate);
+}
+
+InspectorTestProxy.completeTest = function()
+{
+ // Close inspector asynchrously in case we want to test tear-down behavior.
+ setTimeout(function() {
+ testRunner.closeWebInspector();
+ setTimeout(function() {
+ testRunner.notifyDone();
+ }, 0);
+ }, 0);
+}
+
+// Logs message to unbuffered process stdout, avoiding timeouts.
+// only be used to debug tests and not to produce normal test output.
+InspectorTestProxy.debugLog = function(message)
+{
+ window.alert(message);
+}
+
+// Add and clear test output from the results window.
+InspectorTestProxy.addResult = function(text)
+{
+ // For early errors triggered when loading the test page, write to stderr.
+ if (!document.body) {
+ this.debugLog(text);
+ this.completeTest();
+ }
+
+ if (!this._resultElement) {
+ this._resultElement = document.createElement("pre");
+ this._resultElement.id = "output";
+ document.body.appendChild(this._resultElement);
+ }
+ this._resultElement.appendChild(document.createTextNode(text));
+ this._resultElement.appendChild(document.createElement("br"));
+}
+
+InspectorTestProxy.clearResults = function()
+{
+ if (this._resultElement) {
+ this._resultElement.parentNode.removeChild(this._resultElement);
+ delete this._resultElement;
+ }
+}
+
+InspectorTestProxy.reportUncaughtException = function(message, url, lineNumber)
+{
+ var result = "Uncaught exception in test page: " + message + " [" + url + ":" + lineNumber + "]";
+ InspectorTestProxy.addResult(result);
+ InspectorTestProxy.completeTest();
+}
+
+// Catch syntax errors, type errors, and other exceptions. Run this before loading other files.
+window.onerror = InspectorTestProxy.reportUncaughtException;
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectortestharnesstriviallyworksexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/test-harness-trivially-works-expected.txt (0 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/test-harness-trivially-works-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector/test-harness-trivially-works-expected.txt        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+Tests that the test harness for non-stub inspector tests can load and run a test.
+
+Logged a message from the inspector page.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectortestharnesstriviallyworkshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/test-harness-trivially-works.html (0 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/test-harness-trivially-works.html         (rev 0)
+++ trunk/LayoutTests/inspector/test-harness-trivially-works.html        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+<html>
+<head>
+<script type="text/javascript" src="inspector-test.js"></script>
+<script>
+function test()
+{
+ InspectorTest.log("Logged a message from the inspector page.");
+ InspectorTest.completeTest();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests that the test harness for non-stub inspector tests can load and run a test.</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebCore/ChangeLog        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-02-27 Brian Burg <bburg@apple.com>
+
+ Web Inspector: model tests should use a special Test.html inspector page
+ https://bugs.webkit.org/show_bug.cgi?id=129190
+
+ Reviewed by Timothy Hatcher.
+
+ Convert InspectorController::isUnderTest() into a flag, and expose an
+ Internals method so it can be set by the test before opening the inspector.
+
+ Test: inspector/test-harness-trivially-works.html
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::evaluateForTestInFrontend):
+ * inspector/InspectorController.h:
+ * testing/Internals.cpp:
+ (WebCore::Internals::setInspectorIsUnderTest): Added.
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
</ins><span class="cx"> 2014-02-27 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed build fix after r164824.
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -304,14 +304,8 @@
</span><span class="cx"> IdentifiersFactory::setProcessId(processId);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool InspectorController::isUnderTest()
-{
- return m_isUnderTest;
-}
-
</del><span class="cx"> void InspectorController::evaluateForTestInFrontend(long callId, const String& script)
</span><span class="cx"> {
</span><del>- m_isUnderTest = true;
</del><span class="cx"> m_inspectorAgent->evaluateForTestInFrontend(callId, script);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.h (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.h        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebCore/inspector/InspectorController.h        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -112,7 +112,8 @@
</span><span class="cx">
</span><span class="cx"> PassRefPtr<Inspector::InspectorObject> buildObjectForHighlightedNode() const;
</span><span class="cx">
</span><del>- bool isUnderTest();
</del><ins>+ bool isUnderTest() const { return m_isUnderTest; }
+ void setIsUnderTest(bool isUnderTest) { m_isUnderTest = isUnderTest; }
</ins><span class="cx"> void evaluateForTestInFrontend(long callId, const String& script);
</span><span class="cx">
</span><span class="cx"> bool profilerEnabled() const;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebCore/testing/Internals.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -1534,6 +1534,17 @@
</span><span class="cx">
</span><span class="cx"> page->inspectorController().setProfilerEnabled(enabled);
</span><span class="cx"> }
</span><ins>+
+void Internals::setInspectorIsUnderTest(bool isUnderTest, ExceptionCode& ec)
+{
+ Page* page = contextDocument()->frame()->page();
+ if (!page) {
+ ec = INVALID_ACCESS_ERR;
+ return;
+ }
+
+ page->inspectorController().setIsUnderTest(isUnderTest);
+}
</ins><span class="cx"> #endif // ENABLE(INSPECTOR)
</span><span class="cx">
</span><span class="cx"> bool Internals::hasGrammarMarker(int from, int length, ExceptionCode&)
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebCore/testing/Internals.h        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -235,6 +235,7 @@
</span><span class="cx"> void closeDummyInspectorFrontend();
</span><span class="cx"> void setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&);
</span><span class="cx"> void setJavaScriptProfilingEnabled(bool enabled, ExceptionCode&);
</span><ins>+ void setInspectorIsUnderTest(bool isUnderTest, ExceptionCode&);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> String counterValue(Element*);
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebCore/testing/Internals.idl        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -198,6 +198,7 @@
</span><span class="cx"> [Conditional=INSPECTOR] void closeDummyInspectorFrontend();
</span><span class="cx"> [Conditional=INSPECTOR, RaisesException] void setInspectorResourcesDataSizeLimits(long maximumResourcesContentSize, long maximumSingleResourceContentSize);
</span><span class="cx"> [Conditional=INSPECTOR, RaisesException] void setJavaScriptProfilingEnabled(boolean creates);
</span><ins>+ [Conditional=INSPECTOR, RaisesException] void setInspectorIsUnderTest(boolean isUnderTest);
</ins><span class="cx">
</span><span class="cx"> DOMString counterValue(Element element);
</span><span class="cx"> long pageNumber(Element element, optional float pageWidth, optional float pageHeight);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebInspectorUI/ChangeLog        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2014-02-27 Brian Burg <bburg@apple.com>
+
+ Web Inspector: model tests should use a special Test.html inspector page
+ https://bugs.webkit.org/show_bug.cgi?id=129190
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/Test.js: Added.
+ (WebInspector.loaded):
+ (WebInspector.contentLoaded):
+ (WebInspector.updateDockedState):
+ (InspectorTest.log):
+ (InspectorTest.assert):
+ (InspectorTest.debugLog):
+ (InspectorTest.completeTest):
+ (InspectorTest.evaluateInPage):
+ (InspectorTest.addResult):
+ (InspectorTest.clearResults):
+ (InspectorTest.pageLoaded):
+ (InspectorTest.reportUncaughtException):
+ (.console.logType):
+ * UserInterface/Protocol/InspectorBackend.js:
+ (InspectorBackendClass):
+ (InspectorBackendClass.prototype.dispatch):
+ (InspectorBackendClass.prototype.runAfterPendingDispatches):
+ (InspectorBackendClass.prototype._flushPendingScripts):
+ * UserInterface/Protocol/InspectorObserver.js:
+ (WebInspector.InspectorObserver.prototype.evaluateForTestInFrontend):
+ * UserInterface/Test.html: Added.
+
</ins><span class="cx"> 2014-02-27 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: JSContext inspection should report exceptions in the console
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseTestjs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/Base/Test.js (0 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Test.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Test.js        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+/*
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.loaded = function()
+{
+ // Register observers for events from the InspectorBackend.
+ // The initialization order should match the same in Main.js.
+ InspectorBackend.registerInspectorDispatcher(new WebInspector.InspectorObserver);
+ InspectorBackend.registerPageDispatcher(new WebInspector.PageObserver);
+ InspectorBackend.registerDOMDispatcher(new WebInspector.DOMObserver);
+ InspectorBackend.registerDebuggerDispatcher(new WebInspector.DebuggerObserver);
+ InspectorBackend.registerCSSDispatcher(new WebInspector.CSSObserver);
+ InspectorBackend.registerRuntimeDispatcher(new WebInspector.RuntimeObserver);
+
+ // Instantiate controllers used by tests.
+ this.frameResourceManager = new WebInspector.FrameResourceManager;
+ this.domTreeManager = new WebInspector.DOMTreeManager;
+ this.cssStyleManager = new WebInspector.CSSStyleManager;
+ this.runtimeManager = new WebInspector.RuntimeManager;
+ this.debuggerManager = new WebInspector.DebuggerManager;
+ this.probeManager = new WebInspector.ProbeManager;
+
+ document.addEventListener("DOMContentLoaded", this.contentLoaded.bind(this));
+
+ // Enable agents.
+ InspectorAgent.enable();
+
+ // Establish communication with the InspectorBackend.
+ InspectorFrontendHost.loaded();
+}
+
+WebInspector.contentLoaded = function() {
+ // Signal that the frontend is now ready to receive messages.
+ InspectorFrontendAPI.loadCompleted();
+}
+
+// Add stubs that are called by the frontend API.
+WebInspector.updateDockedState = function()
+{
+}
+
+// InspectorTest contains extra methods that are only available to test code running
+// in the Web Inspector page. They rely on equivalents in the actual test page
+// which are provided by `inspector-test.js`.
+InspectorTest = {};
+
+// Note: Additional InspectorTest methods are included on a per-test basis from
+// files like `debugger-test.js`.
+
+// Appends a log message in the test document.
+InspectorTest.log = function(message)
+{
+ this.evaluateInPage("InspectorTestProxy.addResult(" + JSON.stringify(message) + ")");
+}
+
+// Appends an assert message in the test document.
+InspectorTest.assert = function(condition, message)
+{
+ var status = condition ? "PASS" : "FAIL";
+ this.evaluateInPage("InspectorTestProxy.addResult(" + JSON.stringify(status + ": " + message) + ")");
+}
+
+// This function should only be used to debug tests and not to produce normal test output.
+InspectorTest.debugLog = function(message)
+{
+ this.evaluateInPage("InspectorTestProxy.debugLog(" + JSON.stringify(message) + ")");
+}
+
+InspectorTest.completeTest = function()
+{
+ InspectorBackend.runAfterPendingDispatches(this.evaluateInPage.bind(this, "InspectorTestProxy.completeTest()"));
+}
+
+InspectorTest.evaluateInPage = function(codeString)
+{
+ // If we load this page outside of the inspector, or hit an early error when loading
+ // the test frontend, then defer evaluating the commands (indefinitely in the former case).
+ if (!RuntimeAgent) {
+ InspectorTest._originalConsoleMethods["error"]("Tried to evaluate in test page, but connection not yet established:", codeString);
+ return;
+ }
+
+ RuntimeAgent.evaluate(codeString, "test", false);
+}
+
+InspectorTest.addResult = function(text)
+{
+ this._results.push(text);
+ // If the test page reloaded, then we need to re-add the results from before the navigation.
+ if (this._shouldRebuildResults) {
+ delete this._shouldRebuildResults;
+
+ this.clearResults();
+ for (var result of this._results)
+ InspectorTest.evaluateInPage("InspectorTestProxy.addResult(unescape('" + escape(text) + "'))");
+ }
+
+ InspectorTest.evaluateInPage("InspectorTestProxy.addResult(unescape('" + escape(text) + "'))");
+}
+
+InspectorTest.clearResults = function(text)
+{
+ InspectorTest.evaluateInPage("InspectorTestProxy.clearResults()");
+}
+
+InspectorTest.pageLoaded = function()
+{
+ InspectorTest._shouldRebuildResults = true;
+ InspectorTest.addResult("Page reloaded.");
+}
+
+InspectorTest.reportUncaughtException = function(message, url, lineNumber)
+{
+ var result = "Uncaught exception in inspector page: " + message + " [" + url + ":" + lineNumber + "]";
+
+ // If the connection to the test page is not set up, then just dump to console and give up.
+ // Errors encountered this early can be debugged by loading Test.html in a normal browser page.
+ if (!InspectorFrontendHost || !InspectorBackend) {
+ InspectorTest._originalConsoleMethods["error"](result);
+ return;
+ }
+
+ InspectorTest.addResult(result);
+ InspectorTest.completeTest();
+}
+
+// Initialize reporting mechanisms before loading the rest of the inspector page.
+InspectorTest._results = [];
+InspectorTest._shouldRebuildResults = true;
+InspectorTest._originalConsoleMethods = {};
+
+// Catch syntax errors, type errors, and other exceptions. Run this before loading other files.
+window.onerror = InspectorTest.reportUncaughtException;
+
+for (var logType of ["log", "error", "info"]) {
+ // Redirect console methods to log messages into the test page's DOM.
+ InspectorTest._originalConsoleMethods[logType] = console[logType].bind(console);
+ console[logType] = function() {
+ InspectorTest.addResult(logType.toUpperCase() + ": " + Array.prototype.slice.call(arguments).toString());
+ };
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolInspectorBackendjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> this._domainDispatchers = {};
</span><span class="cx"> this._eventArgs = {};
</span><span class="cx"> this._replyArgs = {};
</span><ins>+ this._deferredScripts = [];
</ins><span class="cx">
</span><span class="cx"> this.dumpInspectorTimeStats = false;
</span><span class="cx"> this.dumpInspectorProtocolMessages = false;
</span><span class="lines">@@ -218,8 +219,8 @@
</span><span class="cx"> console.log("time-stats: " + callback.methodName + " = " + (processingStartTime - callback.sendRequestTime) + " + " + (Date.now() - processingStartTime));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (this._scripts && !this._pendingResponsesCount)
- this.runAfterPendingDispatches();
</del><ins>+ if (this._deferredScripts.length && !this._pendingResponsesCount)
+ this._flushPendingScripts();
</ins><span class="cx">
</span><span class="cx"> return;
</span><span class="cx"> } else {
</span><span class="lines">@@ -227,7 +228,7 @@
</span><span class="cx"> var domainName = method[0];
</span><span class="cx"> var functionName = method[1];
</span><span class="cx"> if (!(domainName in this._domainDispatchers)) {
</span><del>- console.error("Protocol Error: the message is for non-existing domain '" + domainName + "'");
</del><ins>+ console.error("Protocol Error: Attempted to dispatch method '" + functionName + "' for non-existing domain '" + domainName + "'");
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> var dispatcher = this._domainDispatchers[domainName];
</span><span class="lines">@@ -264,23 +265,27 @@
</span><span class="cx"> console.error("Request with id = " + messageObject.id + " failed. " + JSON.stringify(messageObject.error));
</span><span class="cx"> },
</span><span class="cx">
</span><del>- /**
- * @param {string=} script
- */
</del><span class="cx"> runAfterPendingDispatches: function(script)
</span><span class="cx"> {
</span><del>- if (!this._scripts)
- this._scripts = [];
</del><ins>+ console.assert(script);
+ console.assert(typeof script === "function");
</ins><span class="cx">
</span><del>- if (script)
- this._scripts.push(script);
</del><ins>+ if (!this._pendingResponsesCount)
+ script.call(this);
+ else
+ this._deferredScripts.push(script);
+ },
</ins><span class="cx">
</span><del>- if (!this._pendingResponsesCount) {
- var scripts = this._scripts;
- this._scripts = [];
- for (var id = 0; id < scripts.length; ++id)
- scripts[id].call(this);
- }
</del><ins>+ // Private
+
+ _flushPendingScripts: function()
+ {
+ console.assert(!this._pendingResponsesCount);
+
+ var scriptsToRun = this._deferredScripts;
+ this._deferredScripts = [];
+ for (var script of scriptsToRun)
+ script.call(this);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolInspectorObserverjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -33,9 +33,15 @@
</span><span class="cx">
</span><span class="cx"> // Events defined by the "Inspector" domain.
</span><span class="cx">
</span><del>- evaluateForTestInFrontend: function(testCallId, script)
</del><ins>+ // FIXME: Remove plumbing for callIdentifier parameter from backend, as it's not used.
+ evaluateForTestInFrontend: function(callIdentifier, script)
</ins><span class="cx"> {
</span><del>- // FIXME: Not implemented.
</del><ins>+ if (!InspectorFrontendHost.isUnderTest())
+ return;
+
+ InspectorBackend.runAfterPendingDispatches(function() {
+ window.eval(script);
+ });
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> inspect: function(payload, hints)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTesthtml"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/Test.html (0 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test.html         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Test.html        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -0,0 +1,98 @@
</span><ins>+<!--
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <!--
+ These resouces should match the order and groups used in Main.html.
+ -->
+ <script src="Base/WebInspector.js"></script>
+ <script src="Base/Test.js"></script>
+
+ <script src="Base/Object.js"></script>
+ <script src="Base/DOMUtilities.js"></script>
+ <script src="Base/URLUtilities.js"></script>
+ <script src="Base/Utilities.js"></script>
+
+ <script src="Protocol/InspectorBackend.js"></script>
+ <script src="Protocol/InspectorFrontendAPI.js"></script>
+ <script src="Protocol/InspectorFrontendHostStub.js"></script>
+ <script src="Protocol/LoadInspectorBackendCommands.js"></script>
+ <script src="Protocol/MessageDispatcher.js"></script>
+
+ <script src="Protocol/InspectorObserver.js"></script>
+ <script src="Protocol/CSSObserver.js"></script>
+ <script src="Protocol/DOMObserver.js"></script>
+ <script src="Protocol/DOMStorageObserver.js"></script>
+ <script src="Protocol/DebuggerObserver.js"></script>
+ <script src="Protocol/PageObserver.js"></script>
+ <script src="Protocol/RemoteObject.js"></script>
+ <script src="Protocol/RuntimeObserver.js"></script>
+
+ <script src="Models/BreakpointAction.js"></script>
+ <script src="Models/Breakpoint.js"></script>
+ <script src="Models/Color.js"></script>
+ <script src="Models/ContentFlow.js"></script>
+ <script src="Models/DOMNode.js"></script>
+ <script src="Models/DOMStorageObject.js"></script>
+ <script src="Models/DOMTree.js"></script>
+ <script src="Models/ExecutionContext.js"></script>
+ <script src="Models/ExecutionContextList.js"></script>
+ <script src="Models/Frame.js"></script>
+ <script src="Models/IndexedDatabase.js"></script>
+ <script src="Models/IndexedDatabaseObjectStore.js"></script>
+ <script src="Models/IndexedDatabaseObjectStoreIndex.js"></script>
+ <script src="Models/Probe.js"></script>
+ <script src="Models/ProbeSet.js"></script>
+ <script src="Models/ProbeSetDataFrame.js"></script>
+ <script src="Models/ProbeSetDataTable.js"></script>
+
+ <script src="Models/SourceCode.js"></script>
+ <script src="Models/Resource.js"></script>
+ <script src="Models/ResourceCollection.js"></script>
+ <script src="Models/Revision.js"></script>
+ <script src="Models/Script.js"></script>
+ <script src="Models/Setting.js"></script>
+ <script src="Models/SourceCodeLocation.js"></script>
+ <script src="Models/SourceCodeRevision.js"></script>
+ <script src="Models/SourceMapResource.js"></script>
+ <script src="Models/TextRange.js"></script>
+
+ <script src="Controllers/CSSStyleManager.js"></script>
+ <script src="Controllers/DOMTreeManager.js"></script>
+ <script src="Controllers/DebuggerManager.js"></script>
+ <script src="Controllers/FrameResourceManager.js"></script>
+ <script src="Controllers/ProbeManager.js"></script>
+ <script src="Controllers/RuntimeManager.js"></script>
+ <script src="Controllers/StorageManager.js"></script>
+
+ <script type="text/javascript">
+ WebInspector.loaded();
+ </script>
+</head>
+<body>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-02-27 Brian Burg <bburg@apple.com>
+
+ Web Inspector: model tests should use a special Test.html inspector page
+ https://bugs.webkit.org/show_bug.cgi?id=129190
+
+ Reviewed by Timothy Hatcher.
+
+ Support creating a separate test inspector page, based on the value of
+ InspectorController::isUnderTest(). Modify the navigation policy to check
+ the URL against both normal and test inspector pages.
+
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::openInspectorFrontend):
+ (-[WebInspectorWindowController init]):
+ (-[WebInspectorWindowController initWithInspectedWebView:isUnderTest:]):
+ Move the initial navigation of the inspector page to this method, and change
+ the URL based on the value of InspectorController::isUnderTest().
+
+ (-[WebInspectorWindowController inspectorTestPagePath]): Added.
+ (-[WebInspectorWindowController webView:decidePolicyForNavigationAction:request:frame:decisionListener:]):
+
</ins><span class="cx"> 2014-02-27 Pratik Solanki <psolanki@apple.com>
</span><span class="cx">
</span><span class="cx"> Assertion failure at CachedResource.h:196: ASSERT(!m_purgeableData)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebInspectorClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -108,8 +108,9 @@
</span><span class="cx"> BOOL _visible;
</span><span class="cx"> BOOL _destroyingInspectorView;
</span><span class="cx"> }
</span><del>-- (id)initWithInspectedWebView:(WebView *)webView;
</del><ins>+- (id)initWithInspectedWebView:(WebView *)webView isUnderTest:(BOOL)isUnderTest;
</ins><span class="cx"> - (NSString *)inspectorPagePath;
</span><ins>+- (NSString *)inspectorTestPagePath;
</ins><span class="cx"> - (WebView *)webView;
</span><span class="cx"> - (void)attach;
</span><span class="cx"> - (void)detach;
</span><span class="lines">@@ -141,7 +142,7 @@
</span><span class="cx">
</span><span class="cx"> InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* inspectorController)
</span><span class="cx"> {
</span><del>- RetainPtr<WebInspectorWindowController> windowController = adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]);
</del><ins>+ RetainPtr<WebInspectorWindowController> windowController = adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView isUnderTest:inspectorController->isUnderTest()]);
</ins><span class="cx"> [windowController.get() setInspectorClient:this];
</span><span class="cx">
</span><span class="cx"> m_frontendPage = core([windowController.get() webView]);
</span><span class="lines">@@ -420,20 +421,22 @@
</span><span class="cx">
</span><span class="cx"> [preferences release];
</span><span class="cx">
</span><del>- NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL fileURLWithPath:[self inspectorPagePath]]];
- [[_webView mainFrame] loadRequest:request];
- [request release];
-
</del><span class="cx"> [self setWindowFrameAutosaveName:@"Web Inspector 2"];
</span><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (id)initWithInspectedWebView:(WebView *)webView
</del><ins>+- (id)initWithInspectedWebView:(WebView *)webView isUnderTest:(BOOL)isUnderTest
</ins><span class="cx"> {
</span><span class="cx"> if (!(self = [self init]))
</span><span class="cx"> return nil;
</span><span class="cx">
</span><span class="cx"> _inspectedWebView = webView;
</span><ins>+
+ NSString *pagePath = isUnderTest ? [self inspectorTestPagePath] : [self inspectorPagePath];
+ NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL fileURLWithPath: pagePath]];
+ [[_webView mainFrame] loadRequest:request];
+ [request release];
+
</ins><span class="cx"> return self;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -455,6 +458,16 @@
</span><span class="cx"> return path;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (NSString *)inspectorTestPagePath
+{
+ // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
+ WebInspectorUILibrary();
+
+ NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"Test" ofType:@"html"];
+ ASSERT([path length]);
+ return path;
+}
+
</ins><span class="cx"> // MARK: -
</span><span class="cx">
</span><span class="cx"> - (WebView *)webView
</span><span class="lines">@@ -749,6 +762,12 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // Allow loading of the test inspector file.
+ if ([[request URL] isFileURL] && [[[request URL] path] isEqualToString:[self inspectorTestPagePath]]) {
+ [listener use];
+ return;
+ }
+
</ins><span class="cx"> // Prevent everything else from loading in the inspector's page.
</span><span class="cx"> [listener ignore];
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2014-02-27 Brian Burg <bburg@apple.com>
+
+ Web Inspector: model tests should use a special Test.html inspector page
+ https://bugs.webkit.org/show_bug.cgi?id=129190
+
+ Reviewed by Timothy Hatcher.
+
+ Support creating a separate test inspector page, based on the value of
+ InspectorController::isUnderTest(). Add this as a separate API call for
+ WebInspectorProxy. Modify the navigation policy to check the URL against
+ both normal and test inspector pages.
+
+ * UIProcess/WebInspectorProxy.cpp:
+ (WebKit::isMainOrTestInspectorPage):
+ (WebKit::decidePolicyForNavigationAction):
+ (WebKit::WebInspectorProxy::createInspectorPageForTest):
+ * UIProcess/WebInspectorProxy.h:
+ * UIProcess/WebInspectorProxy.messages.in:
+ * UIProcess/efl/WebInspectorProxyEfl.cpp:
+ (WebKit::WebInspectorProxy::inspectorTestPageURL):
+ * UIProcess/gtk/WebInspectorProxyGtk.cpp:
+ (WebKit::WebInspectorProxy::inspectorTestPageURL):
+ * UIProcess/ios/WebInspectorProxyIOS.mm:
+ (WebKit::WebInspectorProxy::inspectorTestPageURL):
+ * UIProcess/mac/WebInspectorProxyMac.mm:
+ (WebKit::WebInspectorProxy::inspectorTestPageURL):
+ * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
+ (WebKit::WebInspectorClient::openInspectorFrontend):
+ * WebProcess/WebPage/WebInspector.cpp: Some drive-by nullptr refactorings.
+ (WebKit::WebInspector::WebInspector):
+ (WebKit::WebInspector::createInspectorPage):
+ (WebKit::WebInspector::createInspectorPageForTest):
+ (WebKit::WebInspector::destroyInspectorPage):
+ * WebProcess/WebPage/WebInspector.h:
+
</ins><span class="cx"> 2014-02-27 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Make WebProcessProxy::pages() return an IteratorRange
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebInspectorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -362,15 +362,19 @@
</span><span class="cx"> return WebInspectorPageGroups::shared().isInspectorPageGroup(page.pageGroup());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool isMainInspectorPage(const WebInspectorProxy* webInspectorProxy, WKURLRequestRef requestRef)
</del><ins>+static bool isMainOrTestInspectorPage(const WebInspectorProxy* webInspectorProxy, WKURLRequestRef requestRef)
</ins><span class="cx"> {
</span><span class="cx"> // Use URL so we can compare just the paths.
</span><del>- URL inspectorURL(URL(), webInspectorProxy->inspectorPageURL());
</del><ins>+ URL mainPageURL(URL(), webInspectorProxy->inspectorPageURL());
+ URL testPageURL(URL(), webInspectorProxy->inspectorTestPageURL());
</ins><span class="cx"> URL requestURL(URL(), toImpl(requestRef)->resourceRequest().url());
</span><span class="cx">
</span><del>- ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(inspectorURL.protocol()));
</del><ins>+ ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(mainPageURL.protocol()));
+ ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(testPageURL.protocol()));
</ins><span class="cx">
</span><del>- return WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(requestURL.protocol()) && decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(inspectorURL.path());
</del><ins>+ bool isMainPageURL = decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(mainPageURL.path());
+ bool isTestPageURL = decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(testPageURL.path());
+ return WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(requestURL.protocol()) && (isMainPageURL || isTestPageURL);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef frameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef requestRef, WKFramePolicyListenerRef listenerRef, WKTypeRef, const void* clientInfo)
</span><span class="lines">@@ -385,7 +389,7 @@
</span><span class="cx"> ASSERT(webInspectorProxy);
</span><span class="cx">
</span><span class="cx"> // Allow loading of the main inspector file.
</span><del>- if (isMainInspectorPage(webInspectorProxy, requestRef)) {
</del><ins>+ if (isMainOrTestInspectorPage(webInspectorProxy, requestRef)) {
</ins><span class="cx"> toImpl(listenerRef)->use();
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="lines">@@ -476,6 +480,42 @@
</span><span class="cx"> m_createdInspectorPage = true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebInspectorProxy::createInspectorPageForTest(uint64_t& inspectorPageID, WebPageCreationParameters& inspectorPageParameters)
+{
+ inspectorPageID = 0;
+
+ if (!m_page)
+ return;
+
+ m_isAttached = false;
+
+ WebPageProxy* inspectorPage = platformCreateInspectorPage();
+ ASSERT(inspectorPage);
+ if (!inspectorPage)
+ return;
+
+ inspectorPageID = inspectorPage->pageID();
+ inspectorPageParameters = inspectorPage->creationParameters();
+
+ WKPagePolicyClientV1 policyClient = {
+ { 1, this },
+ 0, /* decidePolicyForNavigationAction_deprecatedForUseWithV0 */
+ 0, /* decidePolicyForNewWindowAction */
+ 0, /* decidePolicyForResponse_deprecatedForUseWithV0 */
+ 0, /* unableToImplementPolicy */
+ decidePolicyForNavigationAction,
+ 0, /* decidePolicyForResponse */
+ };
+
+ WKPageSetPagePolicyClient(toAPI(inspectorPage), &policyClient.base);
+
+ m_page->process().assumeReadAccessToBaseURL(inspectorBaseURL());
+
+ inspectorPage->loadRequest(URL(URL(), inspectorTestPageURL()));
+
+ m_createdInspectorPage = true;
+}
+
</ins><span class="cx"> void WebInspectorProxy::open()
</span><span class="cx"> {
</span><span class="cx"> m_isVisible = true;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebInspectorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -134,8 +134,9 @@
</span><span class="cx">
</span><span class="cx"> static bool isInspectorPage(WebPageProxy&);
</span><span class="cx">
</span><del>- // Implemented the platform WebInspectorProxy file
</del><ins>+ // Provided by platform WebInspectorProxy implementations.
</ins><span class="cx"> String inspectorPageURL() const;
</span><ins>+ String inspectorTestPageURL() const;
</ins><span class="cx"> String inspectorBaseURL() const;
</span><span class="cx">
</span><span class="cx"> #if ENABLE(INSPECTOR_SERVER)
</span><span class="lines">@@ -173,6 +174,7 @@
</span><span class="cx">
</span><span class="cx"> // Called by WebInspectorProxy messages
</span><span class="cx"> void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&);
</span><ins>+ void createInspectorPageForTest(uint64_t& inspectorPageID, WebPageCreationParameters&);
</ins><span class="cx"> void didClose();
</span><span class="cx"> void bringToFront();
</span><span class="cx"> void attachAvailabilityChanged(bool);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebInspectorProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx">
</span><span class="cx"> messages -> WebInspectorProxy {
</span><span class="cx"> CreateInspectorPage() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters)
</span><ins>+ CreateInspectorPageForTest() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters)
</ins><span class="cx"> DidClose()
</span><span class="cx"> BringToFront()
</span><span class="cx"> InspectedURLChanged(String urlString)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcesseflWebInspectorProxyEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -177,6 +177,15 @@
</span><span class="cx"> return builder.toString();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+String WebInspectorProxy::inspectorTestPageURL() const
+{
+ StringBuilder builder;
+ builder.append(inspectorBaseURL());
+ builder.appendLiteral("/Test.html");
+
+ return builder.toString();
+}
+
</ins><span class="cx"> String WebInspectorProxy::inspectorBaseURL() const
</span><span class="cx"> {
</span><span class="cx"> return "file://" + WebCore::inspectorResourcePath();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessgtkWebInspectorProxyGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -153,6 +153,11 @@
</span><span class="cx"> return String("resource:///org/webkitgtk/inspector/UserInterface/Main.html");
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+String WebInspectorProxy::inspectorTestPageURL() const
+{
+ return String("resource:///org/webkitgtk/inspector/UserInterface/Test.html");
+}
+
</ins><span class="cx"> String WebInspectorProxy::inspectorBaseURL() const
</span><span class="cx"> {
</span><span class="cx"> return String("resource:///org/webkitgtk/inspector/UserInterface/");
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebInspectorProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -112,6 +112,12 @@
</span><span class="cx"> return String();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+String WebInspectorProxy::inspectorTestPageURL() const
+{
+ notImplemented();
+ return String();
+}
+
</ins><span class="cx"> String WebInspectorProxy::inspectorBaseURL() const
</span><span class="cx"> {
</span><span class="cx"> notImplemented();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebInspectorProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -757,6 +757,17 @@
</span><span class="cx"> return [[NSURL fileURLWithPath:path] absoluteString];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+String WebInspectorProxy::inspectorTestPageURL() const
+{
+ // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
+ WebInspectorUILibrary();
+
+ NSString *path = [[NSBundle bundleWithIdentifier:@"com.apple.WebInspectorUI"] pathForResource:@"Test" ofType:@"html"];
+ ASSERT([path length]);
+
+ return [[NSURL fileURLWithPath:path] absoluteString];
+}
+
</ins><span class="cx"> String WebInspectorProxy::inspectorBaseURL() const
</span><span class="cx"> {
</span><span class="cx"> // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebInspectorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -47,9 +47,9 @@
</span><span class="cx"> delete this;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-WebCore::InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController*)
</del><ins>+WebCore::InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* controller)
</ins><span class="cx"> {
</span><del>- WebPage* inspectorPage = m_page->inspector()->createInspectorPage();
</del><ins>+ WebPage* inspectorPage = controller->isUnderTest() ? m_page->inspector()->createInspectorPageForTest() : m_page->inspector()->createInspectorPage();
</ins><span class="cx"> ASSERT_UNUSED(inspectorPage, inspectorPage);
</span><span class="cx"> return this;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebInspectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -53,8 +53,8 @@
</span><span class="cx">
</span><span class="cx"> WebInspector::WebInspector(WebPage* page, InspectorFrontendChannel* frontendChannel)
</span><span class="cx"> : m_page(page)
</span><del>- , m_inspectorPage(0)
- , m_frontendClient(0)
</del><ins>+ , m_inspectorPage(nullptr)
+ , m_frontendClient(nullptr)
</ins><span class="cx"> , m_frontendChannel(frontendChannel)
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> , m_hasLocalizedStringsURL(false)
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> WebPage* WebInspector::createInspectorPage()
</span><span class="cx"> {
</span><span class="cx"> if (!m_page)
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> ASSERT(!m_inspectorPage);
</span><span class="cx"> ASSERT(!m_frontendClient);
</span><span class="lines">@@ -80,11 +80,11 @@
</span><span class="cx"> if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebInspectorProxy::CreateInspectorPage(),
</span><span class="cx"> Messages::WebInspectorProxy::CreateInspectorPage::Reply(inspectorPageID, parameters),
</span><span class="cx"> m_page->pageID(), std::chrono::milliseconds::max())) {
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!inspectorPageID)
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> WebProcess::shared().createWebPage(inspectorPageID, parameters);
</span><span class="cx"> m_inspectorPage = WebProcess::shared().webPage(inspectorPageID);
</span><span class="lines">@@ -96,11 +96,41 @@
</span><span class="cx"> return m_inspectorPage;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+WebPage* WebInspector::createInspectorPageForTest()
+{
+ if (!m_page)
+ return nullptr;
+
+ ASSERT(!m_inspectorPage);
+ ASSERT(!m_frontendClient);
+
+ uint64_t inspectorPageID = 0;
+ WebPageCreationParameters parameters;
+
+ if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebInspectorProxy::CreateInspectorPageForTest(),
+ Messages::WebInspectorProxy::CreateInspectorPageForTest::Reply(inspectorPageID, parameters),
+ m_page->pageID(), std::chrono::milliseconds::max())) {
+ return nullptr;
+ }
+
+ if (!inspectorPageID)
+ return nullptr;
+
+ WebProcess::shared().createWebPage(inspectorPageID, parameters);
+ m_inspectorPage = WebProcess::shared().webPage(inspectorPageID);
+ ASSERT(m_inspectorPage);
+
+ auto frontendClient = std::make_unique<WebInspectorFrontendClient>(m_page, m_inspectorPage);
+ m_frontendClient = frontendClient.get();
+ m_inspectorPage->corePage()->inspectorController().setInspectorFrontendClient(std::move(frontendClient));
+ return m_inspectorPage;
+}
+
</ins><span class="cx"> void WebInspector::destroyInspectorPage()
</span><span class="cx"> {
</span><del>- m_inspectorPage = 0;
- m_frontendClient = 0;
- m_frontendChannel = 0;
</del><ins>+ m_inspectorPage = nullptr;
+ m_frontendClient = nullptr;
+ m_frontendChannel = nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Called from WebInspectorFrontendClient
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebInspectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -82,6 +82,7 @@
</span><span class="cx">
</span><span class="cx"> // Called from WebInspectorClient
</span><span class="cx"> WebPage* createInspectorPage();
</span><ins>+ WebPage* createInspectorPageForTest();
</ins><span class="cx"> void destroyInspectorPage();
</span><span class="cx">
</span><span class="cx"> // Called from WebInspectorFrontendClient
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Tools/ChangeLog        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2014-02-27 Brian Burg <bburg@apple.com>
+
+ Web Inspector: model tests should use a special Test.html inspector page
+ https://bugs.webkit.org/show_bug.cgi?id=129190
+
+ Reviewed by Timothy Hatcher.
+
+ Remove code that immediately opens the Web Inspector based on the file path of the test.
+ Instead, the test page should request that the inspector open inside its `test()` method.
+
+ This change is necessary because otherwise, the inspector would be opened too early for
+ InspectorController::isUnderTest to get set in time, so the normal Web Inspector page
+ will get loaded instead of the minimal test page.
+
+ * DumpRenderTree/efl/DumpRenderTree.cpp:
+ (createTestRunner):
+ * DumpRenderTree/gtk/DumpRenderTree.cpp:
+ (runTest):
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (runTest):
+ * DumpRenderTree/win/DumpRenderTree.cpp:
+ (runTest):
+
</ins><span class="cx"> 2014-02-27 Laszlo Vidacs <lvidacs.u-szeged@partner.samsung.com>
</span><span class="cx">
</span><span class="cx"> check-webkit-style indentation false alarm in WebKit/win/WebNodeHighlight.cpp
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeeflDumpRenderTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -156,11 +156,6 @@
</span><span class="cx"> return pathOrURL.contains("dumpAsText/");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool shouldOpenWebInspector(const String& pathOrURL)
-{
- return pathOrURL.contains("inspector/");
-}
-
</del><span class="cx"> static void sendPixelResultsEOF()
</span><span class="cx"> {
</span><span class="cx"> puts("#EOF");
</span><span class="lines">@@ -243,8 +238,6 @@
</span><span class="cx"> gTestRunner->setDumpFrameLoadCallbacks(true);
</span><span class="cx">
</span><span class="cx"> gTestRunner->setDeveloperExtrasEnabled(true);
</span><del>- if (shouldOpenWebInspector(testURL))
- gTestRunner->showWebInspector();
</del><span class="cx">
</span><span class="cx"> gTestRunner->setDumpHistoryDelegateCallbacks(isGlobalHistoryTest(testURL));
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreegtkDumpRenderTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -111,11 +111,6 @@
</span><span class="cx"> return pathOrURL.find("loading/") != string::npos;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool shouldOpenWebInspector(const string& pathOrURL)
-{
- return pathOrURL.find("inspector/") != string::npos;
-}
-
</del><span class="cx"> static bool shouldDumpAsText(const string& pathOrURL)
</span><span class="cx"> {
</span><span class="cx"> return pathOrURL.find("dumpAsText/") != string::npos;
</span><span class="lines">@@ -759,8 +754,6 @@
</span><span class="cx">
</span><span class="cx"> if (shouldEnableDeveloperExtras(testURL)) {
</span><span class="cx"> gTestRunner->setDeveloperExtrasEnabled(true);
</span><del>- if (shouldOpenWebInspector(testURL))
- gTestRunner->showWebInspector();
</del><span class="cx"> if (shouldDumpAsText(testURL)) {
</span><span class="cx"> gTestRunner->setDumpAsText(true);
</span><span class="cx"> gTestRunner->setGeneratePixelResults(false);
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -1598,11 +1598,6 @@
</span><span class="cx"> return strstr(pathOrURL, "globalhistory/");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool shouldOpenWebInspector(const char* pathOrURL)
-{
- return strstr(pathOrURL, "inspector/");
-}
-
</del><span class="cx"> static bool shouldDumpAsText(const char* pathOrURL)
</span><span class="cx"> {
</span><span class="cx"> return strstr(pathOrURL, "dumpAsText/");
</span><span class="lines">@@ -1765,8 +1760,6 @@
</span><span class="cx">
</span><span class="cx"> if (shouldEnableDeveloperExtras(pathOrURL.c_str())) {
</span><span class="cx"> gTestRunner->setDeveloperExtrasEnabled(true);
</span><del>- if (shouldOpenWebInspector(pathOrURL.c_str()))
- gTestRunner->showWebInspector();
</del><span class="cx"> if (shouldDumpAsText(pathOrURL.c_str())) {
</span><span class="cx"> gTestRunner->setDumpAsText(true);
</span><span class="cx"> gTestRunner->setGeneratePixelResults(false);
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinDumpRenderTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (164829 => 164830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp        2014-02-27 21:50:14 UTC (rev 164829)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp        2014-02-27 22:08:10 UTC (rev 164830)
</span><span class="lines">@@ -813,11 +813,6 @@
</span><span class="cx"> return strstr(pathOrURL, "/globalhistory/") || strstr(pathOrURL, "\\globalhistory\\");
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool shouldOpenWebInspector(const char* pathOrURL)
-{
- return strstr(pathOrURL, "/inspector/") || strstr(pathOrURL, "\\inspector\\");
-}
-
</del><span class="cx"> static bool shouldDumpAsText(const char* pathOrURL)
</span><span class="cx"> {
</span><span class="cx"> return strstr(pathOrURL, "/dumpAsText/") || strstr(pathOrURL, "\\dumpAsText\\");
</span><span class="lines">@@ -1108,11 +1103,9 @@
</span><span class="cx">
</span><span class="cx"> resetWebViewToConsistentStateBeforeTesting();
</span><span class="cx">
</span><del>- if (shouldEnableDeveloperExtras(pathOrURL.c_str())) {
</del><ins>+ if (shouldEnableDeveloperExtras(pathOrURL.c_str()))
</ins><span class="cx"> gTestRunner->setDeveloperExtrasEnabled(true);
</span><del>- if (shouldOpenWebInspector(pathOrURL.c_str()))
- gTestRunner->showWebInspector();
- }
</del><ins>+
</ins><span class="cx"> if (shouldDumpAsText(pathOrURL.c_str())) {
</span><span class="cx"> gTestRunner->setDumpAsText(true);
</span><span class="cx"> gTestRunner->setGeneratePixelResults(false);
</span></span></pre>
</div>
</div>
</body>
</html>