WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
the patch
bug-129190-20140225182301.patch (text/plain), 55.81 KB, created by
Blaze Burg
on 2014-02-25 18:23:02 PST
(
hide
)
Description:
the patch
Filename:
MIME Type:
Creator:
Blaze Burg
Created:
2014-02-25 18:23:02 PST
Size:
55.81 KB
patch
obsolete
>Subversion Revision: 164686 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b44aac1de7551db16fa9e8270891d6ab2191edc5..0a6ff9e614e17031af2228c4d6c3d56c93b869a2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2014-02-25 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 NOBODY (OOPS!). >+ >+ Convert InspectorController::isUnderTest() into a flag, and set it true >+ when resetting or injecting the Internals object during testing runs. >+ >+ Test: inspector/test-harness-trivially-works.html >+ >+ * inspector/InspectorController.cpp: >+ (WebCore::InspectorController::evaluateForTestInFrontend): >+ * inspector/InspectorController.h: >+ * testing/Internals.cpp: >+ (WebCore::Internals::resetToConsistentState): set isUnderTest(). >+ * testing/js/WebCoreTestSupport.cpp: >+ (WebCoreTestSupport::injectInternalsObject): Also reset internals >+ settings here, so that isUnderTest() is set before the first run. >+ > 2014-02-25 Samuel White <samuel_white@apple.com> > > Add accessibility search predicate support for AXOutlines >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 666fc4927e708ed950f9028c8729ec25b2ba7b56..584cdd3a3aade04400f2fcbf013fa99eac0be5cb 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,33 @@ >+2014-02-25 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 NOBODY (OOPS!). >+ >+ * 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. >+ > 2014-02-25 Andreas Kling <akling@apple.com> > > Prune dead code for Web Inspector memory instrumentation. >diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog >index 68da9c298304a422af29dedc05788789077ba56e..324eb4fc0f41033d7efbd38c0c2611b3ff2bc87c 100644 >--- a/Source/WebKit/mac/ChangeLog >+++ b/Source/WebKit/mac/ChangeLog >@@ -1,3 +1,24 @@ >+2014-02-25 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 NOBODY (OOPS!). >+ >+ 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:]): >+ > 2014-02-25 Anders Carlsson <andersca@apple.com> > > Get rid of VisitedLinkStrategy >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index a0489b150c3b64ff1b390765bc740a5e2d95890f..b4688913d328b271f28acac10916c50a14c53005 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,38 @@ >+2014-02-25 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 NOBODY (OOPS!). >+ >+ 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: >+ > 2014-02-25 Anders Carlsson <andersca@apple.com> > > VisitedLinkProvider should be refcounted >diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp >index 18f2faf043f1a2e1157610a11464b8d427196b49..e64df0bfeb7afa30f3ef118524ada1245c948365 100644 >--- a/Source/WebCore/inspector/InspectorController.cpp >+++ b/Source/WebCore/inspector/InspectorController.cpp >@@ -304,14 +304,8 @@ void InspectorController::setProcessId(long processId) > IdentifiersFactory::setProcessId(processId); > } > >-bool InspectorController::isUnderTest() >-{ >- return m_isUnderTest; >-} >- > void InspectorController::evaluateForTestInFrontend(long callId, const String& script) > { >- m_isUnderTest = true; > m_inspectorAgent->evaluateForTestInFrontend(callId, script); > } > >diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h >index 8722d676dc4b9dbb90735254c91b99e8a0f81519..0c1c864014f3690449a7b640ad27836f4f7a2369 100644 >--- a/Source/WebCore/inspector/InspectorController.h >+++ b/Source/WebCore/inspector/InspectorController.h >@@ -112,7 +112,8 @@ public: > > PassRefPtr<Inspector::InspectorObject> buildObjectForHighlightedNode() const; > >- bool isUnderTest(); >+ bool isUnderTest() const { return m_isUnderTest; } >+ void setIsUnderTest(bool isUnderTest) { m_isUnderTest = isUnderTest; } > void evaluateForTestInFrontend(long callId, const String& script); > > bool profilerEnabled() const; >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index b5734502bf7c20952ed6dac2bd134b80a16c380c..823960ded4dd5837abf40460b7ff784de7005481 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -279,6 +279,7 @@ void Internals::resetToConsistentState(Page* page) > WebCore::Settings::setUsesOverlayScrollbars(false); > #if ENABLE(INSPECTOR) > page->inspectorController().setProfilerEnabled(false); >+ page->inspectorController().setIsUnderTest(true); > #endif > #if ENABLE(VIDEO_TRACK) && !PLATFORM(WIN) > page->group().captionPreferences()->setCaptionsStyleSheetOverride(emptyString()); >diff --git a/Source/WebCore/testing/js/WebCoreTestSupport.cpp b/Source/WebCore/testing/js/WebCoreTestSupport.cpp >index 92623793c803618b4467f0f7e66ab84e478f20de..97724315f3cb950d5597a69a403f6c829a228cad 100644 >--- a/Source/WebCore/testing/js/WebCoreTestSupport.cpp >+++ b/Source/WebCore/testing/js/WebCoreTestSupport.cpp >@@ -47,6 +47,9 @@ void injectInternalsObject(JSContextRef context) > ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); > if (scriptContext->isDocument()) > globalObject->putDirect(exec->vm(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(toDocument(scriptContext)))); >+ Page* page = toDocument(scriptContext)->frame()->page(); >+ Internals::resetToConsistentState(page); >+ InternalSettings::from(page)->resetToConsistentState(); > } > > void resetInternalsObject(JSContextRef context) >diff --git a/Source/WebInspectorUI/UserInterface/Base/Test.js b/Source/WebInspectorUI/UserInterface/Base/Test.js >new file mode 100644 >index 0000000000000000000000000000000000000000..d03b0df027f519528c4f8ec6221692a81f9848ac >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Base/Test.js >@@ -0,0 +1,162 @@ >+/* >+ * 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. >+ 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()); >+ }; >+} >diff --git a/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js b/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js >index 4ae4422ff8159ac7ab23aa9bfbf85d69588a80b3..3acaddfccd5cfb08a9310b8886c22cf6eebed82e 100644 >--- a/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js >+++ b/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js >@@ -40,6 +40,7 @@ function InspectorBackendClass() > this._domainDispatchers = {}; > this._eventArgs = {}; > this._replyArgs = {}; >+ this._deferredScripts = []; > > this.dumpInspectorTimeStats = false; > this.dumpInspectorProtocolMessages = false; >@@ -218,8 +219,8 @@ InspectorBackendClass.prototype = { > console.log("time-stats: " + callback.methodName + " = " + (processingStartTime - callback.sendRequestTime) + " + " + (Date.now() - processingStartTime)); > } > >- if (this._scripts && !this._pendingResponsesCount) >- this.runAfterPendingDispatches(); >+ if (this._deferredScripts.length && !this._pendingResponsesCount) >+ this._flushPendingScripts(); > > return; > } else { >@@ -227,7 +228,7 @@ InspectorBackendClass.prototype = { > var domainName = method[0]; > var functionName = method[1]; > if (!(domainName in this._domainDispatchers)) { >- console.error("Protocol Error: the message is for non-existing domain '" + domainName + "'"); >+ console.error("Protocol Error: Attempted to dispatch method '" + functionName + "' for non-existing domain '" + domainName + "'"); > return; > } > var dispatcher = this._domainDispatchers[domainName]; >@@ -264,23 +265,27 @@ InspectorBackendClass.prototype = { > console.error("Request with id = " + messageObject.id + " failed. " + JSON.stringify(messageObject.error)); > }, > >- /** >- * @param {string=} script >- */ > runAfterPendingDispatches: function(script) > { >- if (!this._scripts) >- this._scripts = []; >+ console.assert(script); >+ console.assert(typeof script === "function"); > >- if (script) >- this._scripts.push(script); >+ if (!this._pendingResponsesCount) >+ script.call(this); >+ else >+ this._deferredScripts.push(script); >+ }, > >- if (!this._pendingResponsesCount) { >- var scripts = this._scripts; >- this._scripts = []; >- for (var id = 0; id < scripts.length; ++id) >- scripts[id].call(this); >- } >+ // Private >+ >+ _flushPendingScripts: function() >+ { >+ console.assert(!this._pendingResponsesCount); >+ >+ var scriptsToRun = this._deferredScripts; >+ this._deferredScripts = []; >+ for (var script of scriptsToRun) >+ script.call(this); > } > } > >diff --git a/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js b/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js >index 716464534d8a2a132ba2f5d625beee1c811323bc..005a26500b8e9cc8f1cc9d0c5699a26ec01b906f 100644 >--- a/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js >+++ b/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2013 Apple Inc. All rights reserved. >+ * 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 >@@ -33,9 +33,15 @@ WebInspector.InspectorObserver.prototype = { > > // Events defined by the "Inspector" domain. > >- evaluateForTestInFrontend: function(testCallId, script) >+ // FIXME: remove plumbing for callIdentifier parameter from backend, as it's not used. >+ evaluateForTestInFrontend: function(callIdentifier, script) > { >- // FIXME: Not implemented. >+ if (!InspectorFrontendHost.isUnderTest()) >+ return; >+ >+ InspectorBackend.runAfterPendingDispatches(function() { >+ window.eval(script); >+ }); > }, > > inspect: function(payload, hints) >diff --git a/Source/WebInspectorUI/UserInterface/Test.html b/Source/WebInspectorUI/UserInterface/Test.html >new file mode 100644 >index 0000000000000000000000000000000000000000..46b6219c4b2c183eaf73b73940fba085e59fc35a >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Test.html >@@ -0,0 +1,111 @@ >+<!-- >+ * 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"> >+ >+ <!-- >+ Each subsection is alphabetical, with the exception that base classes must >+ be loaded before any classes that inherit from the base class are loaded. >+ --> >+ <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> >+<div id="docked-resizer"></div> >+<div id="toolbar"></div> >+<div id="main"> >+ <div id="navigation-sidebar"></div> >+ <div id="content"> >+ <div id="content-browser"></div> >+ <div id="split-content-browser" class="hidden"></div> >+ <div id="quick-console"></div> >+ </div> >+ <div id="details-sidebar"></div> >+</div> >+</body> >+</html> >diff --git a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm >index 7910ea2aa48b12cc62627000324dd6870d778f9e..61ce69569cafa718a95f7b28017321c3e978f4e3 100644 >--- a/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm >+++ b/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm >@@ -108,8 +108,9 @@ using namespace WebCore; > BOOL _visible; > BOOL _destroyingInspectorView; > } >-- (id)initWithInspectedWebView:(WebView *)webView; >+- (id)initWithInspectedWebView:(WebView *)webView isUnderTest:(BOOL)isUnderTest; > - (NSString *)inspectorPagePath; >+- (NSString *)inspectorTestPagePath; > - (WebView *)webView; > - (void)attach; > - (void)detach; >@@ -141,7 +142,7 @@ void WebInspectorClient::inspectorDestroyed() > > InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* inspectorController) > { >- RetainPtr<WebInspectorWindowController> windowController = adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]); >+ RetainPtr<WebInspectorWindowController> windowController = adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView isUnderTest:inspectorController->isUnderTest()]); > [windowController.get() setInspectorClient:this]; > > m_frontendPage = core([windowController.get() webView]); >@@ -420,20 +421,22 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String > > [preferences release]; > >- NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL fileURLWithPath:[self inspectorPagePath]]]; >- [[_webView mainFrame] loadRequest:request]; >- [request release]; >- > [self setWindowFrameAutosaveName:@"Web Inspector 2"]; > return self; > } > >-- (id)initWithInspectedWebView:(WebView *)webView >+- (id)initWithInspectedWebView:(WebView *)webView isUnderTest:(BOOL)isUnderTest > { > if (!(self = [self init])) > return nil; > > _inspectedWebView = webView; >+ >+ NSString *pagePath = isUnderTest ? [self inspectorTestPagePath] : [self inspectorPagePath]; >+ NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL fileURLWithPath: pagePath]]; >+ [[_webView mainFrame] loadRequest:request]; >+ [request release]; >+ > return self; > } > >@@ -455,6 +458,16 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String > return path; > } > >+- (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; >+} >+ > // MARK: - > > - (WebView *)webView >@@ -749,6 +762,12 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String > return; > } > >+ // Allow loading of the test inspector file. >+ if ([[request URL] isFileURL] && [[[request URL] path] isEqualToString:[self inspectorTestPagePath]]) { >+ [listener use]; >+ return; >+ } >+ > // Prevent everything else from loading in the inspector's page. > [listener ignore]; > >diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp >index 08fe835252102061229221933cbd3c9950f21e7b..9b9c98daf0a2adb79490e9a27f1c3b3bb8d53f52 100644 >--- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp >+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp >@@ -362,15 +362,19 @@ bool WebInspectorProxy::isInspectorPage(WebPageProxy& page) > return WebInspectorPageGroups::shared().isInspectorPageGroup(page.pageGroup()); > } > >-static bool isMainInspectorPage(const WebInspectorProxy* webInspectorProxy, WKURLRequestRef requestRef) >+static bool isMainOrTestInspectorPage(const WebInspectorProxy* webInspectorProxy, WKURLRequestRef requestRef) > { > // Use URL so we can compare just the paths. >- URL inspectorURL(URL(), webInspectorProxy->inspectorPageURL()); >+ URL mainPageURL(URL(), webInspectorProxy->inspectorPageURL()); >+ URL testPageURL(URL(), webInspectorProxy->inspectorTestPageURL()); > URL requestURL(URL(), toImpl(requestRef)->resourceRequest().url()); > >- ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(inspectorURL.protocol())); >+ ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(mainPageURL.protocol())); >+ ASSERT(WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(testPageURL.protocol())); > >- return WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(requestURL.protocol()) && decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(inspectorURL.path()); >+ bool isMainPageURL = decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(mainPageURL.path()); >+ bool isTestPageURL = decodeURLEscapeSequences(requestURL.path()) == decodeURLEscapeSequences(testPageURL.path()); >+ return WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal(requestURL.protocol()) && (isMainPageURL || isTestPageURL); > } > > static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef frameRef, WKFrameNavigationType, WKEventModifiers, WKEventMouseButton, WKFrameRef, WKURLRequestRef requestRef, WKFramePolicyListenerRef listenerRef, WKTypeRef, const void* clientInfo) >@@ -385,7 +389,7 @@ static void decidePolicyForNavigationAction(WKPageRef, WKFrameRef frameRef, WKFr > ASSERT(webInspectorProxy); > > // Allow loading of the main inspector file. >- if (isMainInspectorPage(webInspectorProxy, requestRef)) { >+ if (isMainOrTestInspectorPage(webInspectorProxy, requestRef)) { > toImpl(listenerRef)->use(); > return; > } >@@ -476,6 +480,42 @@ void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCr > m_createdInspectorPage = true; > } > >+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; >+} >+ > void WebInspectorProxy::open() > { > m_isVisible = true; >diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h >index 0457c471fb32d8657c287e006c01d20b6e9df670..17a74982e749c10116a11e59098acf44a2002943 100644 >--- a/Source/WebKit2/UIProcess/WebInspectorProxy.h >+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h >@@ -134,8 +134,9 @@ public: > > static bool isInspectorPage(WebPageProxy&); > >- // Implemented the platform WebInspectorProxy file >+ // Provided by platform WebInspectorProxy implementations. > String inspectorPageURL() const; >+ String inspectorTestPageURL() const; > String inspectorBaseURL() const; > > #if ENABLE(INSPECTOR_SERVER) >@@ -173,6 +174,7 @@ private: > > // Called by WebInspectorProxy messages > void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&); >+ void createInspectorPageForTest(uint64_t& inspectorPageID, WebPageCreationParameters&); > void didClose(); > void bringToFront(); > void attachAvailabilityChanged(bool); >diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in b/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in >index 2add42f302243fea455da26c67fc91fd4e8f512f..e6c944d94634b27a434807c5c30785c0e583ba27 100644 >--- a/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in >+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in >@@ -24,6 +24,7 @@ > > messages -> WebInspectorProxy { > CreateInspectorPage() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters) >+ CreateInspectorPageForTest() -> (uint64_t inspectorPageID, WebKit::WebPageCreationParameters inspectorPageParameters) > DidClose() > BringToFront() > InspectedURLChanged(String urlString) >diff --git a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp >index f6c2a8f08848665b6652c3b2ffab006d2d7bde7b..a80ab6396411e7bfdc9ca59bbeaa5c80bd4cd529 100644 >--- a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp >+++ b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp >@@ -177,6 +177,15 @@ String WebInspectorProxy::inspectorPageURL() const > return builder.toString(); > } > >+String WebInspectorProxy::inspectorTestPageURL() const >+{ >+ StringBuilder builder; >+ builder.append(inspectorBaseURL()); >+ builder.appendLiteral("/Test.html"); >+ >+ return builder.toString(); >+} >+ > String WebInspectorProxy::inspectorBaseURL() const > { > return "file://" + WebCore::inspectorResourcePath(); >diff --git a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp >index 231bc4ffbb5f574cc3bdce83235d62d90986cc4d..579b099f84d2068717350d2264e7f9085142a743 100644 >--- a/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp >+++ b/Source/WebKit2/UIProcess/gtk/WebInspectorProxyGtk.cpp >@@ -153,6 +153,11 @@ String WebInspectorProxy::inspectorPageURL() const > return String("resource:///org/webkitgtk/inspector/UserInterface/Main.html"); > } > >+String WebInspectorProxy::inspectorTestPageURL() const >+{ >+ return String("resource:///org/webkitgtk/inspector/UserInterface/Test.html"); >+} >+ > String WebInspectorProxy::inspectorBaseURL() const > { > return String("resource:///org/webkitgtk/inspector/UserInterface/"); >diff --git a/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm b/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm >index 3e13b7a0270a1c485f3d79cf63a70abecc230a3e..ba15e833d8bc5db84b6925956e246a77d79db58b 100644 >--- a/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm >+++ b/Source/WebKit2/UIProcess/ios/WebInspectorProxyIOS.mm >@@ -112,6 +112,12 @@ String WebInspectorProxy::inspectorPageURL() const > return String(); > } > >+String WebInspectorProxy::inspectorTestPageURL() const >+{ >+ notImplemented(); >+ return String(); >+} >+ > String WebInspectorProxy::inspectorBaseURL() const > { > notImplemented(); >diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm >index 97f47677567b05a6f7fb1b95e5b4ddb09c47b2d7..b21956fe6c0efdb12977a80ffd2c93c2f595a53f 100644 >--- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm >+++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm >@@ -757,6 +757,17 @@ String WebInspectorProxy::inspectorPageURL() const > return [[NSURL fileURLWithPath:path] absoluteString]; > } > >+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]; >+} >+ > String WebInspectorProxy::inspectorBaseURL() const > { > // Call the soft link framework function to dlopen it, then [NSBundle bundleWithIdentifier:] will work. >diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp >index 76e0b8d4851198db627deb7967d48a16c1953020..bf7c307a3eba43541b5a4050bbda93a6c6b72c61 100644 >--- a/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp >+++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp >@@ -47,9 +47,9 @@ void WebInspectorClient::inspectorDestroyed() > delete this; > } > >-WebCore::InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController*) >+WebCore::InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* controller) > { >- WebPage* inspectorPage = m_page->inspector()->createInspectorPage(); >+ WebPage* inspectorPage = controller->isUnderTest() ? m_page->inspector()->createInspectorPageForTest() : m_page->inspector()->createInspectorPage(); > ASSERT_UNUSED(inspectorPage, inspectorPage); > return this; > } >diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp >index cecc9a55a05e247772659a3086b008e4f41daf43..60c8f951d257edb0902cb0b67ec9169b2f2718cf 100644 >--- a/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp >+++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp >@@ -53,8 +53,8 @@ PassRefPtr<WebInspector> WebInspector::create(WebPage* page, InspectorFrontendCh > > WebInspector::WebInspector(WebPage* page, InspectorFrontendChannel* frontendChannel) > : m_page(page) >- , m_inspectorPage(0) >- , m_frontendClient(0) >+ , m_inspectorPage(nullptr) >+ , m_frontendClient(nullptr) > , m_frontendChannel(frontendChannel) > #if PLATFORM(COCOA) > , m_hasLocalizedStringsURL(false) >@@ -69,7 +69,7 @@ WebInspector::WebInspector(WebPage* page, InspectorFrontendChannel* frontendChan > WebPage* WebInspector::createInspectorPage() > { > if (!m_page) >- return 0; >+ return nullptr; > > ASSERT(!m_inspectorPage); > ASSERT(!m_frontendClient); >@@ -80,11 +80,41 @@ WebPage* WebInspector::createInspectorPage() > if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebInspectorProxy::CreateInspectorPage(), > Messages::WebInspectorProxy::CreateInspectorPage::Reply(inspectorPageID, parameters), > m_page->pageID(), std::chrono::milliseconds::max())) { >- return 0; >+ return nullptr; > } > > if (!inspectorPageID) >- return 0; >+ 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; >+} >+ >+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); >@@ -98,9 +128,9 @@ WebPage* WebInspector::createInspectorPage() > > void WebInspector::destroyInspectorPage() > { >- m_inspectorPage = 0; >- m_frontendClient = 0; >- m_frontendChannel = 0; >+ m_inspectorPage = nullptr; >+ m_frontendClient = nullptr; >+ m_frontendChannel = nullptr; > } > > // Called from WebInspectorFrontendClient >diff --git a/Source/WebKit2/WebProcess/WebPage/WebInspector.h b/Source/WebKit2/WebProcess/WebPage/WebInspector.h >index ba3e49c8971d72210fd71a5cc563d7b266e62db4..f27d5eb9140fe3791dd8578e0525acd673a14666 100644 >--- a/Source/WebKit2/WebProcess/WebPage/WebInspector.h >+++ b/Source/WebKit2/WebProcess/WebPage/WebInspector.h >@@ -82,6 +82,7 @@ private: > > // Called from WebInspectorClient > WebPage* createInspectorPage(); >+ WebPage* createInspectorPageForTest(); > void destroyInspectorPage(); > > // Called from WebInspectorFrontendClient >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 2c1e106f2633a2cf6ddd23f1895dc3b0465f5596..6205043152e0ecd9f38c157edd14b3235560524e 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,26 @@ >+2014-02-25 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 NOBODY (OOPS!). >+ >+ 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 (by the FrameLoadDelegate), 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): >+ > 2014-02-25 Sergio Villar Senin <svillar@igalia.com> > > [CSS Grid Layout] Add ENABLE flag >diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp >index e1cad368ed9756e0901204f7b1ba86038708f159..d8a5b56ea5eab447303ba9cbeeba288c1b1e9f8a 100644 >--- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp >@@ -156,11 +156,6 @@ static bool shouldDumpAsText(const String& pathOrURL) > return pathOrURL.contains("dumpAsText/"); > } > >-static bool shouldOpenWebInspector(const String& pathOrURL) >-{ >- return pathOrURL.contains("inspector/"); >-} >- > static void sendPixelResultsEOF() > { > puts("#EOF"); >@@ -243,8 +238,6 @@ static void createTestRunner(const String& testURL, const String& expectedPixelH > gTestRunner->setDumpFrameLoadCallbacks(true); > > gTestRunner->setDeveloperExtrasEnabled(true); >- if (shouldOpenWebInspector(testURL)) >- gTestRunner->showWebInspector(); > > gTestRunner->setDumpHistoryDelegateCallbacks(isGlobalHistoryTest(testURL)); > >diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp >index 72aecb58d27bbed66037701a1c9cb01da2b15055..ee7e79cb19ebe6b6aa4f96718de3f587053c9a21 100644 >--- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp >@@ -111,11 +111,6 @@ static bool shouldLogFrameLoadDelegates(const string& pathOrURL) > return pathOrURL.find("loading/") != string::npos; > } > >-static bool shouldOpenWebInspector(const string& pathOrURL) >-{ >- return pathOrURL.find("inspector/") != string::npos; >-} >- > static bool shouldDumpAsText(const string& pathOrURL) > { > return pathOrURL.find("dumpAsText/") != string::npos; >@@ -759,8 +754,6 @@ static void runTest(const string& inputLine) > > if (shouldEnableDeveloperExtras(testURL)) { > gTestRunner->setDeveloperExtrasEnabled(true); >- if (shouldOpenWebInspector(testURL)) >- gTestRunner->showWebInspector(); > if (shouldDumpAsText(testURL)) { > gTestRunner->setDumpAsText(true); > gTestRunner->setGeneratePixelResults(false); >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >index 816e76e8734b6853355de784183f58be0896c1a9..a462d6524c9ded5097961ff9e8853f30897b48cb 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >@@ -1598,11 +1598,6 @@ static bool shouldLogHistoryDelegates(const char* pathOrURL) > return strstr(pathOrURL, "globalhistory/"); > } > >-static bool shouldOpenWebInspector(const char* pathOrURL) >-{ >- return strstr(pathOrURL, "inspector/"); >-} >- > static bool shouldDumpAsText(const char* pathOrURL) > { > return strstr(pathOrURL, "dumpAsText/"); >@@ -1765,8 +1760,6 @@ static void runTest(const string& inputLine) > > if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { > gTestRunner->setDeveloperExtrasEnabled(true); >- if (shouldOpenWebInspector(pathOrURL.c_str())) >- gTestRunner->showWebInspector(); > if (shouldDumpAsText(pathOrURL.c_str())) { > gTestRunner->setDumpAsText(true); > gTestRunner->setGeneratePixelResults(false); >diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp >index 6befaae9a79cec55acefe36e5021ad18975bd002..d2eb35c88c82f1db2b459427dee256ac1d0a2b1a 100644 >--- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp >+++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp >@@ -813,11 +813,6 @@ static bool shouldLogHistoryDelegates(const char* pathOrURL) > return strstr(pathOrURL, "/globalhistory/") || strstr(pathOrURL, "\\globalhistory\\"); > } > >-static bool shouldOpenWebInspector(const char* pathOrURL) >-{ >- return strstr(pathOrURL, "/inspector/") || strstr(pathOrURL, "\\inspector\\"); >-} >- > static bool shouldDumpAsText(const char* pathOrURL) > { > return strstr(pathOrURL, "/dumpAsText/") || strstr(pathOrURL, "\\dumpAsText\\"); >@@ -1108,11 +1103,9 @@ static void runTest(const string& inputLine) > > resetWebViewToConsistentStateBeforeTesting(); > >- if (shouldEnableDeveloperExtras(pathOrURL.c_str())) { >+ if (shouldEnableDeveloperExtras(pathOrURL.c_str())) > gTestRunner->setDeveloperExtrasEnabled(true); >- if (shouldOpenWebInspector(pathOrURL.c_str())) >- gTestRunner->showWebInspector(); >- } >+ > if (shouldDumpAsText(pathOrURL.c_str())) { > gTestRunner->setDumpAsText(true); > gTestRunner->setGeneratePixelResults(false); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 9fc53643fec9dc41f2eabad90927b112d1a4a02a..8e25185ad40938a076e2b242a9eb08b01291d4c2 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,24 @@ >+2014-02-25 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 NOBODY (OOPS!). >+ >+ * http/tests/inspector-protocol/resources/InspectorTest.js: >+ * 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. >+ > 2014-02-25 Samuel White <samuel_white@apple.com> > > Add accessibility search predicate support for AXOutlines >diff --git a/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js b/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js >index f124ebf340be03cc7fe5ac22a7e499f2e66f3159..1a522f775d2568b64ca611e36db4b6987f654fe1 100644 >--- a/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js >+++ b/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js >@@ -158,6 +158,8 @@ InspectorTest.importScript = function(scriptName) > window.eval(script); > } > >+// 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> > InspectorTest.initializeInspectorModels = function() > { > // Catch any errors and finish the test early. >diff --git a/LayoutTests/inspector/inspector-test.js b/LayoutTests/inspector/inspector-test.js >new file mode 100644 >index 0000000000000000000000000000000000000000..4e64d378e71b6ff814eac14b878aed8c72abb56d >--- /dev/null >+++ b/LayoutTests/inspector/inspector-test.js >@@ -0,0 +1,134 @@ >+/* >+ * 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(); >+ 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; >diff --git a/LayoutTests/inspector/test-harness-trivially-works-expected.txt b/LayoutTests/inspector/test-harness-trivially-works-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..63ecb0af8c376d820db85bcea5cfdc1ed08ae785 >--- /dev/null >+++ b/LayoutTests/inspector/test-harness-trivially-works-expected.txt >@@ -0,0 +1,4 @@ >+Tests that the test harness for non-stub inspector tests can load and run a test. >+ >+Logged a message from the inspector page. >+ >diff --git a/LayoutTests/inspector/test-harness-trivially-works.html b/LayoutTests/inspector/test-harness-trivially-works.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c08ae1aab711144c14ac26facbcb37008286f110 >--- /dev/null >+++ b/LayoutTests/inspector/test-harness-trivially-works.html >@@ -0,0 +1,15 @@ >+<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>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 129190
:
225208
|
225236
|
225253
|
225286
|
225293
|
225300
|
225313
|
225391