WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP (Mac)
bug-147955-20150814111649.patch (text/plain), 70.21 KB, created by
Blaze Burg
on 2015-08-14 11:17:09 PDT
(
hide
)
Description:
WIP (Mac)
Filename:
MIME Type:
Creator:
Blaze Burg
Created:
2015-08-14 11:17:09 PDT
Size:
70.21 KB
patch
obsolete
>Subversion Revision: 188407 >diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 7ee481620c6ef14a97890071588c0f3081fbd175..917a8d48ef744a7f457ca8368aa66be38280eb9c 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,53 @@ >+2015-08-14 Brian Burg <bburg@apple.com> >+ >+ Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle >+ https://bugs.webkit.org/show_bug.cgi?id=147955 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UserInterface/Base/TestStub.js: Renamed from LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js. >+ (InjectedTestHarness): >+ (InjectedTestHarness.prototype.completeTest): >+ (InjectedTestHarness.prototype.addResult): >+ (InjectedTestHarness.prototype.debugLog): >+ (InjectedTestHarness.prototype.evaluateInPage): >+ (InjectedTestHarness.prototype.createAsyncSuite): >+ (InjectedTestHarness.prototype.createSyncSuite): >+ (InjectedTestHarness.prototype.importScript): >+ (InjectedTestHarness.prototype.get logCount): >+ (InjectedTestHarness.prototype.log): >+ (InjectedTestHarness.prototype.assert): >+ (InjectedTestHarness.prototype.expectThat): >+ (InjectedTestHarness.AsyncTestSuite): >+ (InjectedTestHarness.AsyncTestSuite.prototype.get passCount): >+ (InjectedTestHarness.AsyncTestSuite.prototype.get skipCount): >+ (InjectedTestHarness.AsyncTestSuite.prototype.addTestCase): >+ (InjectedTestHarness.AsyncTestSuite.prototype.runTestCasesAndFinish.finish): >+ (InjectedTestHarness.AsyncTestSuite.prototype.runTestCasesAndFinish): >+ (InjectedTestHarness.AsyncTestSuite.prototype.runTestCases): >+ (InjectedTestHarness.SyncTestSuite): >+ (InjectedTestHarness.SyncTestSuite.prototype.get passCount): >+ (InjectedTestHarness.SyncTestSuite.prototype.get skipCount): >+ (InjectedTestHarness.SyncTestSuite.prototype.addTestCase): >+ (InjectedTestHarness.SyncTestSuite.prototype.runTestCasesAndFinish): >+ (InjectedTestHarness.SyncTestSuite.prototype.runTestCases): >+ (ProtocolTestHarness.prototype.completeTest): >+ (ProtocolTestHarness.prototype.addResult): >+ (ProtocolTestHarness.prototype.debugLog): >+ (ProtocolTestHarness.prototype.evaluateInPage): >+ (ProtocolTestHarness): >+ (InspectorProtocol.sendCommand): >+ (InspectorProtocol.awaitCommand): >+ (InspectorProtocol.awaitEvent.): >+ (InspectorProtocol.awaitEvent): >+ (InspectorProtocol.addEventListener): >+ (InspectorProtocol.sendMessage): >+ (InspectorProtocol.checkForError): >+ (InspectorFrontendAPI.dispatchMessageAsync): >+ * UserInterface/TestStub.html: Renamed from LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html. >+ * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj: >+ * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters: >+ > 2015-08-13 Joseph Pecoraro <pecoraro@apple.com> > > Web Inspector: Watch Expressions >diff --git a/Source/WebInspectorUI/UserInterface/Base/TestStub.js b/Source/WebInspectorUI/UserInterface/Base/TestStub.js >new file mode 100644 >index 0000000000000000000000000000000000000000..ce7ad984e4836c6bf66c9f713978521cb1dd5e16 >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/Base/TestStub.js >@@ -0,0 +1,498 @@ >+/* >+ * Copyright (C) 2012 Samsung Electronics. All rights reserved. >+ * Copyright (C) 2014, 2015 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 APPLE AND ITS 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 APPLE OR ITS 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. >+ */ >+InspectorFrontendAPI = {}; >+ >+InjectedTestHarness = class InjectedTestHarness >+{ >+ constructor() >+ { >+ this._logCount = 0; >+ this.forceSyncDebugLogging = false; >+ } >+ >+ completeTest() >+ { >+ throw new Error("Must be implemented by subclasses."); >+ } >+ >+ addResult() >+ { >+ throw new Error("Must be implemented by subclasses."); >+ } >+ >+ debugLog() >+ { >+ throw new Error("Must be implemented by subclasses."); >+ } >+ >+ evaluateInPage(string, callback) >+ { >+ throw new Error("Must be implemented by subclasses."); >+ } >+ >+ createAsyncSuite(name) >+ { >+ return new InjectedTestHarness.AsyncTestSuite(this, name); >+ } >+ >+ createSyncSuite(name) >+ { >+ return new InjectedTestHarness.SyncTestSuite(this, name); >+ } >+ >+ importScript(scriptName) >+ { >+ var xhr = new XMLHttpRequest(); >+ var isAsyncRequest = false; >+ xhr.open("GET", scriptName, isAsyncRequest); >+ xhr.send(null); >+ if (xhr.status !== 0 && xhr.status !== 200) >+ throw new Error("Invalid script URL: " + scriptName); >+ var script = `// From InjectedTestHarness.importScript(${scriptName}) >+try { >+ ${xhr.responseText} >+} catch (e) { >+ alert(${JSON.stringify("Error in: " + scriptName)}); >+ throw e; >+}`; >+ window.eval(script); >+ } >+ >+ get logCount() >+ { >+ return this._logCount; >+ } >+ >+ log(message) >+ { >+ ++this._logCount; >+ >+ if (this.forceSyncDebugLogging) >+ this.debugLog(message); >+ else >+ this.addResult(message); >+ } >+ >+ assert(condition, message) >+ { >+ if (condition) >+ return; >+ >+ let stringifiedMessage = typeof message !== "object" ? message : JSON.stringify(message); >+ this.addResult("ASSERT: " + stringifiedMessage); >+ } >+ >+ expectThat(condition, message) >+ { >+ let prefix = condition ? "PASS" : "FAIL"; >+ let stringifiedMessage = typeof message !== "object" ? message : JSON.stringify(message); >+ this.addResult(prefix + ": " + stringifiedMessage); >+ } >+} >+ >+InjectedTestHarness.AsyncTestSuite = class AsyncTestSuite >+{ >+ constructor(harness, name) { >+ if (!(harness instanceof InjectedTestHarness)) >+ throw new Error("Must pass the test's harness as the first argument."); >+ >+ if (!name || typeof name !== "string") >+ throw new Error("Tried to create AsyncTestSuite without string suite name."); >+ >+ this.name = name; >+ this._harness = harness; >+ >+ this.testcases = []; >+ this.runCount = 0; >+ this.failCount = 0; >+ } >+ >+ get passCount() >+ { >+ return this.runCount - this.failCount; >+ } >+ >+ get skipCount() >+ { >+ if (this.failCount) >+ return this.testcases.length - this.runCount; >+ else >+ return 0; >+ } >+ >+ addTestCase(testcase) >+ { >+ if (!testcase || !(testcase instanceof Object)) >+ throw new Error("Tried to add non-object test case."); >+ >+ if (typeof testcase.name !== "string") >+ throw new Error("Tried to add test case without a name."); >+ >+ if (typeof testcase.test !== "function") >+ throw new Error("Tried to add test case without `test` function."); >+ >+ this.testcases.push(testcase); >+ } >+ >+ // Use this if the test file only has one suite, and no handling >+ // of the promise returned by runTestCases() is needed. >+ runTestCasesAndFinish() >+ { >+ function finish() { >+ this._harness.completeTest(); >+ } >+ >+ this.runTestCases() >+ .then(finish.bind(this)) >+ .catch(finish.bind(this)); >+ } >+ >+ runTestCases() >+ { >+ if (!this.testcases.length) >+ throw new Error("Tried to call runTestCases() for suite with no test cases"); >+ if (this._startedRunning) >+ throw new Error("Tried to call runTestCases() more than once."); >+ >+ this._startedRunning = true; >+ >+ this._harness.log(""); >+ this._harness.log("== Running test suite: " + this.name); >+ >+ // Avoid adding newlines if nothing was logged. >+ var priorLogCount = this._harness.logCount; >+ var suite = this; >+ var result = this.testcases.reduce(function(chain, testcase, i) { >+ return chain.then(function() { >+ if (i > 0 && priorLogCount + 1 < suite._harness.logCount) >+ suite._harness.log(""); >+ >+ priorLogCount = suite._harness.logCount; >+ suite._harness.log("-- Running test case: " + testcase.name); >+ suite.runCount++; >+ return new Promise(testcase.test); >+ }); >+ }, Promise.resolve()); >+ >+ return result.catch(function(e) { >+ suite.failCount++; >+ var message = e; >+ if (e instanceof Error) >+ message = e.message; >+ >+ if (typeof message !== "string") >+ message = JSON.stringify(message); >+ >+ suite._harness.log("!! EXCEPTION: " + message); >+ throw e; // Reject this promise by re-throwing the error. >+ }); >+ } >+} >+ >+InjectedTestHarness.SyncTestSuite = class SyncTestSuite >+{ >+ constructor(harness, name) { >+ if (!(harness instanceof InjectedTestHarness)) >+ throw new Error("Must pass the test's harness as the first argument."); >+ >+ if (!name || typeof name !== "string") >+ throw new Error("Tried to create SyncTestSuite without string suite name."); >+ >+ this.name = name; >+ this._harness = harness; >+ >+ this.testcases = []; >+ this.runCount = 0; >+ this.failCount = 0; >+ } >+ >+ get passCount() >+ { >+ return this.runCount - this.failCount; >+ } >+ >+ get skipCount() >+ { >+ if (this.failCount) >+ return this.testcases.length - this.runCount; >+ else >+ return 0; >+ } >+ >+ addTestCase(testcase) >+ { >+ if (!testcase || !(testcase instanceof Object)) >+ throw new Error("Tried to add non-object test case."); >+ >+ if (typeof testcase.name !== "string") >+ throw new Error("Tried to add test case without a name."); >+ >+ if (typeof testcase.test !== "function") >+ throw new Error("Tried to add test case without `test` function."); >+ >+ this.testcases.push(testcase); >+ } >+ >+ // Use this if the test file only has one suite. >+ runTestCasesAndFinish() >+ { >+ this.runTestCases(); >+ this._harness.completeTest(); >+ } >+ >+ runTestCases() >+ { >+ if (!this.testcases.length) >+ throw new Error("Tried to call runTestCases() for suite with no test cases"); >+ if (this._startedRunning) >+ throw new Error("Tried to call runTestCases() more than once."); >+ >+ this._startedRunning = true; >+ >+ this._harness.log(""); >+ this._harness.log("== Running test suite: " + this.name); >+ >+ var priorLogCount = this._harness.logCount; >+ var suite = this; >+ for (var i = 0; i < this.testcases.length; i++) { >+ var testcase = this.testcases[i]; >+ if (i > 0 && priorLogCount + 1 < this._harness.logCount) >+ this._harness.log(""); >+ >+ priorLogCount = this._harness.logCount; >+ >+ this._harness.log("-- Running test case: " + testcase.name); >+ suite.runCount++; >+ try { >+ var result = testcase.test.call(null); >+ if (result === false) { >+ suite.failCount++; >+ return false; >+ } >+ } catch (e) { >+ suite.failCount++; >+ var message = e; >+ if (e instanceof Error) >+ message = e.message; >+ else >+ e = new Error(e); >+ >+ if (typeof message !== "string") >+ message = JSON.stringify(message); >+ >+ this._harness.log("!! EXCEPTION: " + message); >+ return false; >+ } >+ } >+ >+ return true; >+ } >+} >+ >+class ProtocolTestHarness extends InjectedTestHarness >+{ >+ // InjectedTestHarness Overrides >+ >+ completeTest() >+ { >+ this.evaluateInPage("closeTest();"); >+ } >+ >+ addResult(message) >+ { >+ // Unfortunately, every string argument must be escaped because tests are not consistent >+ // with respect to escaping with single or double quotes. Some exceptions use single quotes. >+ var stringifiedMessage = typeof message !== "string" ? JSON.stringify(message) : message; >+ this.evaluateInPage("log(unescape('" + escape(stringifiedMessage) + "'));"); >+ } >+ >+ debugLog(message) >+ { >+ var stringifiedMessage = typeof message !== "string" ? JSON.stringify(message) : message; >+ this.evaluateInPage("debugLog(unescape('" + escape(stringifiedMessage) + "'));") >+ } >+ >+ evaluateInPage(expression, callback) >+ { >+ let args = { >+ method: "Runtime.evaluate", >+ params: {expression} >+ } >+ >+ if (typeof callback === "function") >+ InspectorProtocol.sendCommand(args, callback); >+ else >+ return InspectorProtocol.awaitCommand(args); >+ } >+} >+ >+window.ProtocolTest = new ProtocolTestHarness(); >+ >+InspectorProtocol = {}; >+InspectorProtocol._dispatchTable = []; >+InspectorProtocol._requestId = -1; >+InspectorProtocol.eventHandler = {}; >+ >+InspectorProtocol.dumpInspectorProtocolMessages = false; >+ >+InspectorProtocol.sendCommand = function(methodOrObject, params, handler) >+{ >+ // Allow new-style arguments object, as in awaitCommand. >+ var method = methodOrObject; >+ if (typeof methodOrObject === "object") >+ var {method, params, handler} = methodOrObject; >+ >+ this._dispatchTable[++this._requestId] = handler; >+ var messageObject = {method, params, "id": this._requestId}; >+ this.sendMessage(messageObject); >+ >+ return this._requestId; >+} >+ >+InspectorProtocol.awaitCommand = function(args) >+{ >+ var {method, params} = args; >+ return new Promise(function(resolve, reject) { >+ this._dispatchTable[++this._requestId] = {resolve, reject}; >+ var messageObject = {method, params, "id": this._requestId}; >+ this.sendMessage(messageObject); >+ }.bind(this)); >+} >+ >+InspectorProtocol.awaitEvent = function(args) >+{ >+ var {event} = args; >+ if (typeof event !== "string") >+ throw new Error("Event must be a string."); >+ >+ return new Promise(function(resolve, reject) { >+ InspectorProtocol.eventHandler[event] = function(message) { >+ InspectorProtocol.eventHandler[event] = undefined; >+ resolve(message); >+ } >+ }); >+} >+ >+InspectorProtocol.addEventListener = function(eventTypeOrObject, listener) >+{ >+ var event = eventTypeOrObject; >+ if (typeof eventTypeOrObject === "object") >+ var {event, listener} = eventTypeOrObject; >+ >+ if (typeof event !== "string") >+ throw new Error("Event name must be a string."); >+ >+ if (typeof listener !== "function") >+ throw new Error("Event listener must be callable."); >+ >+ // Convert to an array of listeners. >+ var listeners = InspectorProtocol.eventHandler[event]; >+ if (!listeners) >+ listeners = InspectorProtocol.eventHandler[event] = []; >+ else if (typeof listeners === "function") >+ listeners = InspectorProtocol.eventHandler[event] = [listeners]; >+ >+ // Prevent registering multiple times. >+ if (listeners.includes(listener)) >+ throw new Error("Cannot register the same listener more than once."); >+ >+ listeners.push(listener); >+} >+ >+InspectorProtocol.sendMessage = function(messageObject) >+{ >+ // This matches the debug dumping in InspectorBackend, which is bypassed >+ // by InspectorProtocol. Return messages should be dumped by InspectorBackend. >+ if (InspectorProtocol.dumpInspectorProtocolMessages) >+ console.log("frontend: " + JSON.stringify(messageObject)); >+ >+ InspectorFrontendHost.sendMessageToBackend(JSON.stringify(messageObject)); >+} >+ >+InspectorProtocol.checkForError = function(responseObject) >+{ >+ if (responseObject.error) { >+ ProtocolTest.log("PROTOCOL ERROR: " + JSON.stringify(responseObject.error)); >+ ProtocolTest.completeTest(); >+ throw "PROTOCOL ERROR"; >+ } >+} >+ >+InspectorFrontendAPI.dispatchMessageAsync = function(messageObject) >+{ >+ // This matches the debug dumping in InspectorBackend, which is bypassed >+ // by InspectorProtocol. Return messages should be dumped by InspectorBackend. >+ if (InspectorProtocol.dumpInspectorProtocolMessages) >+ console.log("backend: " + JSON.stringify(messageObject)); >+ >+ // If the message has an id, then it is a reply to a command. >+ var messageId = messageObject["id"]; >+ if (typeof messageId === "number") { >+ var handler = InspectorProtocol._dispatchTable[messageId]; >+ if (!handler) >+ return; >+ >+ if (typeof handler === "function") >+ handler(messageObject); >+ else if (typeof handler === "object") { >+ var {resolve, reject} = handler; >+ if ("error" in messageObject) >+ reject(messageObject.error.message); >+ else >+ resolve(messageObject.result); >+ } >+ // Otherwise, it is an event. >+ } else { >+ var eventName = messageObject["method"]; >+ var handler = InspectorProtocol.eventHandler[eventName]; >+ if (!handler) >+ return; >+ >+ if (typeof handler === "function") >+ handler(messageObject); >+ else if (handler instanceof Array) { >+ handler.map(function(listener) { >+ listener.call(null, messageObject); >+ }); >+ } else if (typeof handler === "object") { >+ var {resolve, reject} = handler; >+ if ("error" in messageObject) >+ reject(messageObject.error.message); >+ else >+ resolve(messageObject.result); >+ } >+ } >+} >+ >+window.addEventListener("message", function(event) { >+ try { >+ eval(event.data); >+ } catch (e) { >+ alert(e.stack); >+ ProtocolTest.completeTest(); >+ throw e; >+ } >+}); >\ No newline at end of file >diff --git a/Source/WebInspectorUI/UserInterface/TestStub.html b/Source/WebInspectorUI/UserInterface/TestStub.html >new file mode 100644 >index 0000000000000000000000000000000000000000..61d91f93dfe7e3dcc7e53e703c85d9ba8fad1bf1 >--- /dev/null >+++ b/Source/WebInspectorUI/UserInterface/TestStub.html >@@ -0,0 +1,29 @@ >+<!-- >+Copyright (C) 2015 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 APPLE AND ITS 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 APPLE OR ITS 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. >+--> >+<html> >+<head> >+ <script type="text/javascript" src="Base/TestStub.js"></script> >+</head> >+</html> >diff --git a/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj b/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj >index 864eb3542176edf465e9053034a4ff2306fc454f..9ea6b2f2bae88774229c8e01899a1b1c8b845f3a 100644 >--- a/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj >+++ b/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj >@@ -803,6 +803,10 @@ > <None Include="..\UserInterface\StyleRuleIcons.css" /> > <None Include="..\UserInterface\SyntaxHighlightingDefaultTheme.css" /> > <None Include="..\UserInterface\SyntaxHighlightingSupport.js" /> >+ <None Include="..\UserInterface\Test.html" /> >+ <None Include="..\UserInterface\Test.js" /> >+ <None Include="..\UserInterface\TestStub.html" /> >+ <None Include="..\UserInterface\TestStub.js" /> > <None Include="..\UserInterface\TextContentView.css" /> > <None Include="..\UserInterface\TextContentView.js" /> > <None Include="..\UserInterface\TextEditor.css" /> >diff --git a/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters b/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters >index fdd2672d0d6cc9917f3e07d17d22a0aa334d93f4..93ee81bcb86515a6dba66b620bbab52467869c90 100644 >--- a/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters >+++ b/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters >@@ -978,6 +978,18 @@ > <None Include="..\UserInterface\SyntaxHighlightingSupport.js"> > <Filter>UserInterface</Filter> > </None> >+ <None Include="..\UserInterface\Test.html"> >+ <Filter>UserInterface</Filter> >+ </None> >+ <None Include="..\UserInterface\Test.js"> >+ <Filter>UserInterface</Filter> >+ </None> >+ <None Include="..\UserInterface\TestStub.html"> >+ <Filter>UserInterface</Filter> >+ </None> >+ <None Include="..\UserInterface\TestStub.js"> >+ <Filter>UserInterface</Filter> >+ </None> > <None Include="..\UserInterface\TextContentView.css"> > <Filter>UserInterface</Filter> > </None> >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 4e7fc76f2db0a40ffd83e587ed8239b5c7f0c1c4..ba5333bf5f8f34eefa2c83f15522f1040ba0f98a 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,22 @@ >+2015-08-14 Brian Burg <bburg@apple.com> >+ >+ Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle >+ https://bugs.webkit.org/show_bug.cgi?id=147955 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * DumpRenderTree/TestRunner.cpp: >+ (getInspectorTestStubURLCallback): >+ (TestRunner::staticValues): >+ * DumpRenderTree/TestRunner.h: >+ * DumpRenderTree/mac/TestRunnerMac.mm: >+ (SOFT_LINK_STAGED_FRAMEWORK): >+ (TestRunner::inspectorTestStubURL): >+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: >+ * WebKitTestRunner/InjectedBundle/TestRunner.h: >+ * WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm: >+ (WTR::TestRunner::inspectorTestStubURL): >+ > 2015-08-13 Filip Pizlo <fpizlo@apple.com> > > WTF should have a compact Condition object to use with Lock >diff --git a/Tools/DumpRenderTree/TestRunner.cpp b/Tools/DumpRenderTree/TestRunner.cpp >index 95140d26a21c2bcc1e942a314ef9cbdc6e7953b8..814fda4e0084649b66614039497d39d5c983c0b6 100644 >--- a/Tools/DumpRenderTree/TestRunner.cpp >+++ b/Tools/DumpRenderTree/TestRunner.cpp >@@ -1790,6 +1790,13 @@ static JSValueRef getTitleTextDirectionCallback(JSContextRef context, JSObjectRe > return JSValueMakeString(context, titleDirection.get()); > } > >+static JSValueRef getInspectorTestStubURLCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) >+{ >+ TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); >+ JSRetainPtr<JSStringRef> url(Adopt, controller->inspectorTestStubURL()); >+ return JSValueMakeString(context, url.get()); >+} >+ > static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) > { > TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject)); >@@ -1983,6 +1990,7 @@ JSStaticValue* TestRunner::staticValues() > { "titleTextDirection", getTitleTextDirectionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, > { "databaseDefaultQuota", getDatabaseDefaultQuotaCallback, setDatabaseDefaultQuotaCallback, kJSPropertyAttributeNone }, > { "databaseMaxQuota", getDatabaseMaxQuotaCallback, setDatabaseMaxQuotaCallback, kJSPropertyAttributeNone }, >+ { "inspectorTestStubURL", getInspectorTestStubURLCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, > { 0, 0, 0, 0 } > }; > return staticValues; >diff --git a/Tools/DumpRenderTree/TestRunner.h b/Tools/DumpRenderTree/TestRunner.h >index 8e6d74128570bca3b5cd3281a8cdc1a520d3664e..ab779ae0f1212e383eb7969c190a28fe87e96c11 100644 >--- a/Tools/DumpRenderTree/TestRunner.h >+++ b/Tools/DumpRenderTree/TestRunner.h >@@ -308,6 +308,8 @@ public: > void showWebInspector(); > void closeWebInspector(); > void evaluateInWebInspector(JSStringRef script); >+ JSStringRef inspectorTestStubURL(); >+ > void evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script); > void evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script); > >diff --git a/Tools/DumpRenderTree/mac/TestRunnerMac.mm b/Tools/DumpRenderTree/mac/TestRunnerMac.mm >index f2cb41057af4229482fdfe5064d13045c2e8afef..b92eb7dbe7d27d10a7fb50e96b2639d4d7d90031 100644 >--- a/Tools/DumpRenderTree/mac/TestRunnerMac.mm >+++ b/Tools/DumpRenderTree/mac/TestRunnerMac.mm >@@ -42,6 +42,7 @@ > #import <JavaScriptCore/JSRetainPtr.h> > #import <JavaScriptCore/JSStringRef.h> > #import <JavaScriptCore/JSStringRefCF.h> >+#import <WebCore/SoftLinking.h> > #import <WebCore/GeolocationPosition.h> > #import <WebKit/DOMDocument.h> > #import <WebKit/DOMElement.h> >@@ -88,6 +89,8 @@ > #import <WebKit/WebDOMOperationsPrivate.h> > #endif > >+SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A) >+ > #if !PLATFORM(IOS) > @interface CommandValidationTarget : NSObject <NSValidatedUserInterfaceItem> > { >@@ -780,6 +783,23 @@ void TestRunner::evaluateInWebInspector(JSStringRef script) > [[[mainFrame webView] inspector] evaluateInFrontend:nil script:scriptNS]; > } > >+JSStringRef TestRunner::inspectorTestStubURL() >+{ >+ // Call the soft link framework function to dlopen it, then CFBundleGetBundleWithIdentifier will work. >+ WebInspectorUILibrary(); >+ >+ CFBundleRef inspectorBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebInspectorUI")); >+ if (!inspectorBundle) >+ return nullptr; >+ >+ RetainPtr<CFURLRef> url = adoptCF(CFBundleCopyResourceURL(inspectorBundle, CFSTR("TestStub"), CFSTR("html"), CFSTR("Resources"))); >+ if (!url) >+ return nullptr; >+ >+ CFStringRef urlString = CFURLGetString(url.get()); >+ return JSStringCreateWithCFString(urlString); >+} >+ > typedef HashMap<unsigned, RetainPtr<WebScriptWorld> > WorldMap; > static WorldMap& worldMap() > { >diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >index 2625443928a3ac9d58af9036514608320bd0598f..1b307590c176919f810a2803660aed1fa2f512ad 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl >@@ -125,6 +125,7 @@ interface TestRunner { > void showWebInspector(); > void closeWebInspector(); > void evaluateInWebInspector(DOMString script); >+ readonly attribute DOMString inspectorTestStubURL; > > void setPOSIXLocale(DOMString locale); > >diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >index 41406b31681054636437c1630ca711e5c49a3467..81d62b619603a794f5591020b9d0aabcb2a9d471 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h >@@ -199,6 +199,7 @@ public: > void showWebInspector(); > void closeWebInspector(); > void evaluateInWebInspector(JSStringRef script); >+ JSRetainPtr<JSStringRef> inspectorTestStubURL(); > > void setPOSIXLocale(JSStringRef); > >diff --git a/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm b/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm >index 23f5b690516e9b81c6c3a0a67b04fc394d23c793..3b0b7e8103dc41ac655467b43f3826c9cb16d15a 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm >+++ b/Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm >@@ -26,6 +26,10 @@ > #include "TestRunner.h" > > #include "InjectedBundle.h" >+#include <WebCore/SoftLinking.h> >+#include <JavaScriptCore/JSStringRefCF.h> >+ >+SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A) > > namespace WTR { > >@@ -62,4 +66,21 @@ JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url) > return JSStringRetain(url); // Do nothing on mac. > } > >+JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL() >+{ >+ // Call the soft link framework function to dlopen it, then CFBundleGetBundleWithIdentifier will work. >+ WebInspectorUILibrary(); >+ >+ CFBundleRef inspectorBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebInspectorUI")); >+ if (!inspectorBundle) >+ return nullptr; >+ >+ RetainPtr<CFURLRef> url = adoptCF(CFBundleCopyResourceURL(inspectorBundle, CFSTR("TestStub"), CFSTR("html"), NULL)); >+ if (!url) >+ return nullptr; >+ >+ CFStringRef urlString = CFURLGetString(url.get()); >+ return adopt(JSStringCreateWithCFString(urlString)); >+} >+ > } // namespace WTR >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 2ea510630353625b4c0f17f5b54838a1f896152a..defe80a3dffb0b218eded2083ea3592daf9c487f 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,34 @@ >+2015-08-14 Brian Burg <bburg@apple.com> >+ >+ Web Inspector: load ProtocolTestStub from the WebInspectorUI bundle >+ https://bugs.webkit.org/show_bug.cgi?id=147955 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/inspector/dom/resources/InspectorDOMListener.js: >+ * http/tests/inspector/resources/console-test.js: >+ * http/tests/inspector/resources/probe-test.js: >+ * http/tests/inspector/resources/protocol-test.js: >+ (ProtocolTestProxy.registerInitializer): >+ (log): >+ (runTest.runInitializationMethodsInFrontend): >+ (runTest.runTestMethodInFrontend): >+ (runTest): >+ * inspector/console/console-message.html: >+ * inspector/console/css-source-locations-expected.txt: >+ * inspector/console/css-source-locations.html: >+ * inspector/console/js-source-locations-expected.txt: >+ * inspector/console/js-source-locations.html: >+ * inspector/console/x-frame-options-message-expected.txt: >+ * inspector/console/x-frame-options-message.html: >+ * inspector/debugger/didSampleProbe-multiple-probes.html: >+ * inspector/debugger/setBreakpoint-actions.html: >+ * inspector/debugger/setBreakpoint-options-exception.html: >+ * inspector/dom/dom-search-expected.txt: >+ * inspector/dom/dom-search-with-context.html: >+ * inspector/dom/dom-search.html: >+ * inspector/dom/resources/dom-search-queries.js: >+ > 2015-08-13 Joseph Pecoraro <pecoraro@apple.com> > > Web Inspector: Watch Expressions >diff --git a/LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js b/LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js >index 5d19fa1390c8a78fec6aa93ef1217f9f42851695..bcadd1cc38e25eb05948792824bf8f2c74477e84 100644 >--- a/LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js >+++ b/LayoutTests/http/tests/inspector/dom/resources/InspectorDOMListener.js >@@ -27,7 +27,9 @@ > * SUCH DAMAGE. > */ > >-function createDOMListener() >+ProtocolTestProxy.registerInitializer(function(){ >+ >+window.createDOMListener = function() > { > var nodesById = {}; > >@@ -101,3 +103,5 @@ function createDOMListener() > collectNode: collectNode > }; > } >+ >+}); >diff --git a/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html b/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html >deleted file mode 100644 >index ac23ce8078cb79a5781b7888b8e44d9f55b248ae..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.html >+++ /dev/null >@@ -1,30 +0,0 @@ >-<!-- >-Copyright (C) 2012 Samsung Electronics. All rights reserved. >-Copyright (C) 2015 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 APPLE AND ITS 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 APPLE OR ITS 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. >---> >-<html> >-<head> >- <script type="text/javascript" src="ProtocolTestStub.js"></script> >-</head> >-</html> >diff --git a/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js b/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js >deleted file mode 100644 >index ce7ad984e4836c6bf66c9f713978521cb1dd5e16..0000000000000000000000000000000000000000 >--- a/LayoutTests/http/tests/inspector/resources/ProtocolTestStub.js >+++ /dev/null >@@ -1,498 +0,0 @@ >-/* >- * Copyright (C) 2012 Samsung Electronics. All rights reserved. >- * Copyright (C) 2014, 2015 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 APPLE AND ITS 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 APPLE OR ITS 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. >- */ >-InspectorFrontendAPI = {}; >- >-InjectedTestHarness = class InjectedTestHarness >-{ >- constructor() >- { >- this._logCount = 0; >- this.forceSyncDebugLogging = false; >- } >- >- completeTest() >- { >- throw new Error("Must be implemented by subclasses."); >- } >- >- addResult() >- { >- throw new Error("Must be implemented by subclasses."); >- } >- >- debugLog() >- { >- throw new Error("Must be implemented by subclasses."); >- } >- >- evaluateInPage(string, callback) >- { >- throw new Error("Must be implemented by subclasses."); >- } >- >- createAsyncSuite(name) >- { >- return new InjectedTestHarness.AsyncTestSuite(this, name); >- } >- >- createSyncSuite(name) >- { >- return new InjectedTestHarness.SyncTestSuite(this, name); >- } >- >- importScript(scriptName) >- { >- var xhr = new XMLHttpRequest(); >- var isAsyncRequest = false; >- xhr.open("GET", scriptName, isAsyncRequest); >- xhr.send(null); >- if (xhr.status !== 0 && xhr.status !== 200) >- throw new Error("Invalid script URL: " + scriptName); >- var script = `// From InjectedTestHarness.importScript(${scriptName}) >-try { >- ${xhr.responseText} >-} catch (e) { >- alert(${JSON.stringify("Error in: " + scriptName)}); >- throw e; >-}`; >- window.eval(script); >- } >- >- get logCount() >- { >- return this._logCount; >- } >- >- log(message) >- { >- ++this._logCount; >- >- if (this.forceSyncDebugLogging) >- this.debugLog(message); >- else >- this.addResult(message); >- } >- >- assert(condition, message) >- { >- if (condition) >- return; >- >- let stringifiedMessage = typeof message !== "object" ? message : JSON.stringify(message); >- this.addResult("ASSERT: " + stringifiedMessage); >- } >- >- expectThat(condition, message) >- { >- let prefix = condition ? "PASS" : "FAIL"; >- let stringifiedMessage = typeof message !== "object" ? message : JSON.stringify(message); >- this.addResult(prefix + ": " + stringifiedMessage); >- } >-} >- >-InjectedTestHarness.AsyncTestSuite = class AsyncTestSuite >-{ >- constructor(harness, name) { >- if (!(harness instanceof InjectedTestHarness)) >- throw new Error("Must pass the test's harness as the first argument."); >- >- if (!name || typeof name !== "string") >- throw new Error("Tried to create AsyncTestSuite without string suite name."); >- >- this.name = name; >- this._harness = harness; >- >- this.testcases = []; >- this.runCount = 0; >- this.failCount = 0; >- } >- >- get passCount() >- { >- return this.runCount - this.failCount; >- } >- >- get skipCount() >- { >- if (this.failCount) >- return this.testcases.length - this.runCount; >- else >- return 0; >- } >- >- addTestCase(testcase) >- { >- if (!testcase || !(testcase instanceof Object)) >- throw new Error("Tried to add non-object test case."); >- >- if (typeof testcase.name !== "string") >- throw new Error("Tried to add test case without a name."); >- >- if (typeof testcase.test !== "function") >- throw new Error("Tried to add test case without `test` function."); >- >- this.testcases.push(testcase); >- } >- >- // Use this if the test file only has one suite, and no handling >- // of the promise returned by runTestCases() is needed. >- runTestCasesAndFinish() >- { >- function finish() { >- this._harness.completeTest(); >- } >- >- this.runTestCases() >- .then(finish.bind(this)) >- .catch(finish.bind(this)); >- } >- >- runTestCases() >- { >- if (!this.testcases.length) >- throw new Error("Tried to call runTestCases() for suite with no test cases"); >- if (this._startedRunning) >- throw new Error("Tried to call runTestCases() more than once."); >- >- this._startedRunning = true; >- >- this._harness.log(""); >- this._harness.log("== Running test suite: " + this.name); >- >- // Avoid adding newlines if nothing was logged. >- var priorLogCount = this._harness.logCount; >- var suite = this; >- var result = this.testcases.reduce(function(chain, testcase, i) { >- return chain.then(function() { >- if (i > 0 && priorLogCount + 1 < suite._harness.logCount) >- suite._harness.log(""); >- >- priorLogCount = suite._harness.logCount; >- suite._harness.log("-- Running test case: " + testcase.name); >- suite.runCount++; >- return new Promise(testcase.test); >- }); >- }, Promise.resolve()); >- >- return result.catch(function(e) { >- suite.failCount++; >- var message = e; >- if (e instanceof Error) >- message = e.message; >- >- if (typeof message !== "string") >- message = JSON.stringify(message); >- >- suite._harness.log("!! EXCEPTION: " + message); >- throw e; // Reject this promise by re-throwing the error. >- }); >- } >-} >- >-InjectedTestHarness.SyncTestSuite = class SyncTestSuite >-{ >- constructor(harness, name) { >- if (!(harness instanceof InjectedTestHarness)) >- throw new Error("Must pass the test's harness as the first argument."); >- >- if (!name || typeof name !== "string") >- throw new Error("Tried to create SyncTestSuite without string suite name."); >- >- this.name = name; >- this._harness = harness; >- >- this.testcases = []; >- this.runCount = 0; >- this.failCount = 0; >- } >- >- get passCount() >- { >- return this.runCount - this.failCount; >- } >- >- get skipCount() >- { >- if (this.failCount) >- return this.testcases.length - this.runCount; >- else >- return 0; >- } >- >- addTestCase(testcase) >- { >- if (!testcase || !(testcase instanceof Object)) >- throw new Error("Tried to add non-object test case."); >- >- if (typeof testcase.name !== "string") >- throw new Error("Tried to add test case without a name."); >- >- if (typeof testcase.test !== "function") >- throw new Error("Tried to add test case without `test` function."); >- >- this.testcases.push(testcase); >- } >- >- // Use this if the test file only has one suite. >- runTestCasesAndFinish() >- { >- this.runTestCases(); >- this._harness.completeTest(); >- } >- >- runTestCases() >- { >- if (!this.testcases.length) >- throw new Error("Tried to call runTestCases() for suite with no test cases"); >- if (this._startedRunning) >- throw new Error("Tried to call runTestCases() more than once."); >- >- this._startedRunning = true; >- >- this._harness.log(""); >- this._harness.log("== Running test suite: " + this.name); >- >- var priorLogCount = this._harness.logCount; >- var suite = this; >- for (var i = 0; i < this.testcases.length; i++) { >- var testcase = this.testcases[i]; >- if (i > 0 && priorLogCount + 1 < this._harness.logCount) >- this._harness.log(""); >- >- priorLogCount = this._harness.logCount; >- >- this._harness.log("-- Running test case: " + testcase.name); >- suite.runCount++; >- try { >- var result = testcase.test.call(null); >- if (result === false) { >- suite.failCount++; >- return false; >- } >- } catch (e) { >- suite.failCount++; >- var message = e; >- if (e instanceof Error) >- message = e.message; >- else >- e = new Error(e); >- >- if (typeof message !== "string") >- message = JSON.stringify(message); >- >- this._harness.log("!! EXCEPTION: " + message); >- return false; >- } >- } >- >- return true; >- } >-} >- >-class ProtocolTestHarness extends InjectedTestHarness >-{ >- // InjectedTestHarness Overrides >- >- completeTest() >- { >- this.evaluateInPage("closeTest();"); >- } >- >- addResult(message) >- { >- // Unfortunately, every string argument must be escaped because tests are not consistent >- // with respect to escaping with single or double quotes. Some exceptions use single quotes. >- var stringifiedMessage = typeof message !== "string" ? JSON.stringify(message) : message; >- this.evaluateInPage("log(unescape('" + escape(stringifiedMessage) + "'));"); >- } >- >- debugLog(message) >- { >- var stringifiedMessage = typeof message !== "string" ? JSON.stringify(message) : message; >- this.evaluateInPage("debugLog(unescape('" + escape(stringifiedMessage) + "'));") >- } >- >- evaluateInPage(expression, callback) >- { >- let args = { >- method: "Runtime.evaluate", >- params: {expression} >- } >- >- if (typeof callback === "function") >- InspectorProtocol.sendCommand(args, callback); >- else >- return InspectorProtocol.awaitCommand(args); >- } >-} >- >-window.ProtocolTest = new ProtocolTestHarness(); >- >-InspectorProtocol = {}; >-InspectorProtocol._dispatchTable = []; >-InspectorProtocol._requestId = -1; >-InspectorProtocol.eventHandler = {}; >- >-InspectorProtocol.dumpInspectorProtocolMessages = false; >- >-InspectorProtocol.sendCommand = function(methodOrObject, params, handler) >-{ >- // Allow new-style arguments object, as in awaitCommand. >- var method = methodOrObject; >- if (typeof methodOrObject === "object") >- var {method, params, handler} = methodOrObject; >- >- this._dispatchTable[++this._requestId] = handler; >- var messageObject = {method, params, "id": this._requestId}; >- this.sendMessage(messageObject); >- >- return this._requestId; >-} >- >-InspectorProtocol.awaitCommand = function(args) >-{ >- var {method, params} = args; >- return new Promise(function(resolve, reject) { >- this._dispatchTable[++this._requestId] = {resolve, reject}; >- var messageObject = {method, params, "id": this._requestId}; >- this.sendMessage(messageObject); >- }.bind(this)); >-} >- >-InspectorProtocol.awaitEvent = function(args) >-{ >- var {event} = args; >- if (typeof event !== "string") >- throw new Error("Event must be a string."); >- >- return new Promise(function(resolve, reject) { >- InspectorProtocol.eventHandler[event] = function(message) { >- InspectorProtocol.eventHandler[event] = undefined; >- resolve(message); >- } >- }); >-} >- >-InspectorProtocol.addEventListener = function(eventTypeOrObject, listener) >-{ >- var event = eventTypeOrObject; >- if (typeof eventTypeOrObject === "object") >- var {event, listener} = eventTypeOrObject; >- >- if (typeof event !== "string") >- throw new Error("Event name must be a string."); >- >- if (typeof listener !== "function") >- throw new Error("Event listener must be callable."); >- >- // Convert to an array of listeners. >- var listeners = InspectorProtocol.eventHandler[event]; >- if (!listeners) >- listeners = InspectorProtocol.eventHandler[event] = []; >- else if (typeof listeners === "function") >- listeners = InspectorProtocol.eventHandler[event] = [listeners]; >- >- // Prevent registering multiple times. >- if (listeners.includes(listener)) >- throw new Error("Cannot register the same listener more than once."); >- >- listeners.push(listener); >-} >- >-InspectorProtocol.sendMessage = function(messageObject) >-{ >- // This matches the debug dumping in InspectorBackend, which is bypassed >- // by InspectorProtocol. Return messages should be dumped by InspectorBackend. >- if (InspectorProtocol.dumpInspectorProtocolMessages) >- console.log("frontend: " + JSON.stringify(messageObject)); >- >- InspectorFrontendHost.sendMessageToBackend(JSON.stringify(messageObject)); >-} >- >-InspectorProtocol.checkForError = function(responseObject) >-{ >- if (responseObject.error) { >- ProtocolTest.log("PROTOCOL ERROR: " + JSON.stringify(responseObject.error)); >- ProtocolTest.completeTest(); >- throw "PROTOCOL ERROR"; >- } >-} >- >-InspectorFrontendAPI.dispatchMessageAsync = function(messageObject) >-{ >- // This matches the debug dumping in InspectorBackend, which is bypassed >- // by InspectorProtocol. Return messages should be dumped by InspectorBackend. >- if (InspectorProtocol.dumpInspectorProtocolMessages) >- console.log("backend: " + JSON.stringify(messageObject)); >- >- // If the message has an id, then it is a reply to a command. >- var messageId = messageObject["id"]; >- if (typeof messageId === "number") { >- var handler = InspectorProtocol._dispatchTable[messageId]; >- if (!handler) >- return; >- >- if (typeof handler === "function") >- handler(messageObject); >- else if (typeof handler === "object") { >- var {resolve, reject} = handler; >- if ("error" in messageObject) >- reject(messageObject.error.message); >- else >- resolve(messageObject.result); >- } >- // Otherwise, it is an event. >- } else { >- var eventName = messageObject["method"]; >- var handler = InspectorProtocol.eventHandler[eventName]; >- if (!handler) >- return; >- >- if (typeof handler === "function") >- handler(messageObject); >- else if (handler instanceof Array) { >- handler.map(function(listener) { >- listener.call(null, messageObject); >- }); >- } else if (typeof handler === "object") { >- var {resolve, reject} = handler; >- if ("error" in messageObject) >- reject(messageObject.error.message); >- else >- resolve(messageObject.result); >- } >- } >-} >- >-window.addEventListener("message", function(event) { >- try { >- eval(event.data); >- } catch (e) { >- alert(e.stack); >- ProtocolTest.completeTest(); >- throw e; >- } >-}); >\ No newline at end of file >diff --git a/LayoutTests/http/tests/inspector/resources/console-test.js b/LayoutTests/http/tests/inspector/resources/console-test.js >index 2d4e37fe0a4fbf0ff6747839ba5bba74252fa58c..23e92d30f1bdd82499f1066dee64c2c35bd9f539 100644 >--- a/LayoutTests/http/tests/inspector/resources/console-test.js >+++ b/LayoutTests/http/tests/inspector/resources/console-test.js >@@ -1,3 +1,5 @@ >+ProtocolTestProxy.registerInitializer(function() { >+ > ProtocolTest.Console = {}; > > ProtocolTest.Console.sanitizeConsoleMessage = function(messageObject) >@@ -73,3 +75,5 @@ ProtocolTest.Console.addTestCase = function(suite, args) > } > }); > } >+ >+}); >diff --git a/LayoutTests/http/tests/inspector/resources/probe-test.js b/LayoutTests/http/tests/inspector/resources/probe-test.js >index 053f9f9e78219403326dbeffc415a0c7b6753342..c57c72384c13331a05f37c9efde7a08330137c31 100644 >--- a/LayoutTests/http/tests/inspector/resources/probe-test.js >+++ b/LayoutTests/http/tests/inspector/resources/probe-test.js >@@ -1,3 +1,5 @@ >+ProtocolTestProxy.registerInitializer(function() { >+ > ProtocolTest.Probe = {}; > > ProtocolTest.Probe.sanitizeProbeSample = function(messageObject) >@@ -125,3 +127,5 @@ ProtocolTest.Probe.installTracingListeners = function() > InspectorTest.log("Probe set's probe count: " + probeSet.probes.length); > }); > } >+ >+}); >diff --git a/LayoutTests/http/tests/inspector/resources/protocol-test.js b/LayoutTests/http/tests/inspector/resources/protocol-test.js >index f881d474ed6e50f4ab0c2192f7e10a91d8b4e8f6..2c79758ca895964cadc76323a9f1ac5cb761253e 100644 >--- a/LayoutTests/http/tests/inspector/resources/protocol-test.js >+++ b/LayoutTests/http/tests/inspector/resources/protocol-test.js >@@ -23,7 +23,21 @@ > * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF > * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ >-var outputElement; >+ >+// This namespace is injected into every test page. Its functions are invoked by >+// ProtocolTest methods on the inspector page via RuntimeAgent.evaluate() calls. >+ProtocolTestProxy = {}; >+ProtocolTestProxy._initializers = []; >+ >+// Helper scripts like `console-test.js` must register their initialization >+// function with this method so it will be marshalled to the inspector page. >+ProtocolTestProxy.registerInitializer = function(initializer) >+{ >+ if (typeof initializer === "function") >+ this._initializers.push(initializer.toString()); >+} >+ >+let outputElement; > > /** > * Logs message to process stdout via alert (hopefully implemented with immediate flush). >@@ -40,10 +54,10 @@ function debugLog(text) > function log(text) > { > if (!outputElement) { >- var intermediate = document.createElement("div"); >+ let intermediate = document.createElement("div"); > document.body.appendChild(intermediate); > >- var intermediate2 = document.createElement("div"); >+ let intermediate2 = document.createElement("div"); > intermediate.appendChild(intermediate2); > > outputElement = document.createElement("div"); >@@ -77,27 +91,46 @@ function runTest() > testRunner.waitUntilDone(); > testRunner.setCanOpenWindows(true); > >- var scriptTags = document.getElementsByTagName("script"); >- var scriptUrlBasePath = ""; >- for (var i = 0; i < scriptTags.length; ++i) { >- var index = scriptTags[i].src.lastIndexOf("/protocol-test.js"); >- if (index > -1 ) { >- scriptUrlBasePath = scriptTags[i].src.slice(0, index); >- break; >+ let testFunction = window.test; >+ if (!(typeof testFunction === "function")) { >+ alert("Failed to send test() because it is not a function."); >+ testRunner.notifyDone(); >+ } >+ >+ let url = testRunner.inspectorTestStubURL; >+ if (!url) { >+ alert("Failed to obtain inspector test stub URL."); >+ testRunner.notifyDone(); >+ } >+ >+ function runInitializationMethodsInFrontend(initializers) >+ { >+ for (let initializer of initializers) { >+ try { >+ initializer(); >+ } catch (e) { >+ ProtocolTest.log("Exception in test initialization: " + e, e.stack || "(no stack trace)"); >+ ProtocolTest.completeTest(); >+ } > } > } > >- var url = scriptUrlBasePath + "/ProtocolTestStub.html"; >- var inspectorFrontend = window.internals.openDummyInspectorFrontend(url); >- inspectorFrontend.addEventListener("load", function(event) { >- // FIXME: rename this 'test' global field across all tests. >- var testFunction = window.test; >- if (typeof testFunction === "function") { >- inspectorFrontend.postMessage("(" + testFunction.toString() +")();", "*"); >- return; >+ function runTestMethodInFrontend(testFunction) >+ { >+ try { >+ testFunction(); >+ } catch (e) { >+ ProtocolTest.log("Exception during test execution: " + e, e.stack || "(no stack trace)"); >+ ProtocolTest.completeTest(); > } >- // Kill waiting process if failed to send. >- alert("Failed to send test function"); >- testRunner.notifyDone(); >+ } >+ >+ let inspectorFrontend = window.internals.openDummyInspectorFrontend(url); >+ inspectorFrontend.addEventListener("load", function(event) { >+ let initializationCodeString = `(${runInitializationMethodsInFrontend.toString()})([${ProtocolTestProxy._initializers}]);`; >+ let testFunctionCodeString = `(${runTestMethodInFrontend.toString()})(${testFunction.toString()});`; >+ >+ inspectorFrontend.postMessage(initializationCodeString, "*"); >+ inspectorFrontend.postMessage(testFunctionCodeString, "*"); > }); > } >diff --git a/LayoutTests/inspector/console/console-message.html b/LayoutTests/inspector/console/console-message.html >index 8fb3f96e6909d3d71731662932518921bfd80d71..82116094881f02b47437ac8f76ff74e4ea877c7c 100644 >--- a/LayoutTests/inspector/console/console-message.html >+++ b/LayoutTests/inspector/console/console-message.html >@@ -2,6 +2,7 @@ > <html> > <head> > <script src="../../http/tests/inspector/resources/protocol-test.js"></script> >+<script src="../../http/tests/inspector/resources/console-test.js"></script> > <script> > function generateSimpleConsoleMessages() > { >@@ -14,7 +15,6 @@ function generateSimpleConsoleMessages() > > function test() > { >- ProtocolTest.importScript("console-test.js"); > > var suite = ProtocolTest.createAsyncSuite("Console.MessagesFromCommandLineAPI"); > >diff --git a/LayoutTests/inspector/console/css-source-locations-expected.txt b/LayoutTests/inspector/console/css-source-locations-expected.txt >index 95a638df5043b97118c1440413bd6aa1313e1d7b..dfd1444af4b05addb82499b8065c7e498fadfe95 100644 >--- a/LayoutTests/inspector/console/css-source-locations-expected.txt >+++ b/LayoutTests/inspector/console/css-source-locations-expected.txt >@@ -1,8 +1,8 @@ > Tests that CSS parser warnings from inline style tags and external stylesheets are sent to the console with correct line and column information. >-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:6:20"} >-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:7:14"} >-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:8:7"} >-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:10:8"} >+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:7:20"} >+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:8:14"} >+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:9:7"} >+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:11:8"} > {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:7"} > {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:29"} > {"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:4:5"} >diff --git a/LayoutTests/inspector/console/css-source-locations.html b/LayoutTests/inspector/console/css-source-locations.html >index daaa0da56992f40534baae913cdb8d0c92ec0839..59dc0eee93849d7f32fc6c799a23c01ef09cc288 100644 >--- a/LayoutTests/inspector/console/css-source-locations.html >+++ b/LayoutTests/inspector/console/css-source-locations.html >@@ -2,6 +2,7 @@ > <html> > <head> > <script src="../../http/tests/inspector/resources/protocol-test.js"></script> >+<script src="../../http/tests/inspector/resources/console-test.js"></script> > <link rel="stylesheet" href="resources/errors.css"> > <style> div { * color: red; }</style> > <style>div { * color: red; } >@@ -15,8 +16,6 @@ div { * color: red; } > <script> > function test() > { >- ProtocolTest.importScript("console-test.js"); >- > var consoleMessageCount = 0; > const expectedConsoleMessageCount = 7; > >diff --git a/LayoutTests/inspector/console/js-source-locations-expected.txt b/LayoutTests/inspector/console/js-source-locations-expected.txt >index d9fe85890bcfa83c8959a201dde0706386d81737..c0d77c5b5c0b8d0a22f4511b98a2e14943f2bf20 100644 >--- a/LayoutTests/inspector/console/js-source-locations-expected.txt >+++ b/LayoutTests/inspector/console/js-source-locations-expected.txt >@@ -2,17 +2,17 @@ CONSOLE MESSAGE: line 1: error script > CONSOLE MESSAGE: line 1: warn script > CONSOLE MESSAGE: line 5: error script > CONSOLE MESSAGE: line 6: warn script >-CONSOLE MESSAGE: line 6: TypeError: undefined is not an object (evaluating '[].x.x') >-CONSOLE MESSAGE: line 8: warn 1 >-CONSOLE MESSAGE: line 8: error 1 >-CONSOLE MESSAGE: line 9: error 2 >+CONSOLE MESSAGE: line 7: TypeError: undefined is not an object (evaluating '[].x.x') >+CONSOLE MESSAGE: line 9: warn 1 >+CONSOLE MESSAGE: line 9: error 1 >+CONSOLE MESSAGE: line 10: error 2 > Tests that JavaScript errors and warnings from inline script tags and external files are sent to the console with correct line and column information. > {"source":"console-api","level":"error","text":"error script","location":"errors.js:1:14","parameters":[{"type":"string"}]} > {"source":"console-api","level":"warning","text":"warn script","location":"errors.js:1:44","parameters":[{"type":"string"}]} > {"source":"console-api","level":"error","text":"error script","location":"errors.js:5:18","parameters":[{"type":"string"}]} > {"source":"console-api","level":"warning","text":"warn script","location":"errors.js:6:17","parameters":[{"type":"string"}]} >-{"source":"javascript","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"js-source-locations.html:6:18"} >-{"source":"console-api","level":"warning","text":"warn 1","location":"js-source-locations.html:8:13","parameters":[{"type":"string"}]} >-{"source":"console-api","level":"error","text":"error 1","location":"js-source-locations.html:8:38","parameters":[{"type":"string"}]} >-{"source":"console-api","level":"error","text":"error 2","location":"js-source-locations.html:9:17","parameters":[{"type":"string"}]} >+{"source":"javascript","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"js-source-locations.html:7:18"} >+{"source":"console-api","level":"warning","text":"warn 1","location":"js-source-locations.html:9:13","parameters":[{"type":"string"}]} >+{"source":"console-api","level":"error","text":"error 1","location":"js-source-locations.html:9:38","parameters":[{"type":"string"}]} >+{"source":"console-api","level":"error","text":"error 2","location":"js-source-locations.html:10:17","parameters":[{"type":"string"}]} > >diff --git a/LayoutTests/inspector/console/js-source-locations.html b/LayoutTests/inspector/console/js-source-locations.html >index 630fd8c2ef1ce549d770a61feb0f592207a298ae..c8787bfcbe851d6b480f7e9b71db382139836610 100644 >--- a/LayoutTests/inspector/console/js-source-locations.html >+++ b/LayoutTests/inspector/console/js-source-locations.html >@@ -2,6 +2,7 @@ > <html> > <head> > <script src="../../http/tests/inspector/resources/protocol-test.js"></script> >+<script src="../../http/tests/inspector/resources/console-test.js"></script> > <script src="resources/errors.js"></script> > <script> [].x.x </script> > <script> >@@ -11,8 +12,6 @@ console.warn("warn 1"); console.error("error 1"); > <script> > function test() > { >- ProtocolTest.importScript("console-test.js"); >- > var consoleMessageCount = 0; > const expectedConsoleMessageCount = 8; > >diff --git a/LayoutTests/inspector/console/x-frame-options-message-expected.txt b/LayoutTests/inspector/console/x-frame-options-message-expected.txt >index b98fd75e4ad3b2d87dd5f60ea76a15e171c2b0e8..8769bcd0de4f6282679d2a2d8e0eeb1e2708ec8b 100644 >--- a/LayoutTests/inspector/console/x-frame-options-message-expected.txt >+++ b/LayoutTests/inspector/console/x-frame-options-message-expected.txt >@@ -1,4 +1,4 @@ >-CONSOLE MESSAGE: line 42: Refused to display 'x-frame-options-message.html' in a frame because it set 'X-Frame-Options' to 'deny'. >+CONSOLE MESSAGE: line 41: Refused to display 'x-frame-options-message.html' in a frame because it set 'X-Frame-Options' to 'deny'. > > > == Running test suite: Console.XFrameOptionsMessages >diff --git a/LayoutTests/inspector/console/x-frame-options-message.html b/LayoutTests/inspector/console/x-frame-options-message.html >index 9670df1a7c7e13d1bd48cc8c083cf716085b0c05..737ab1f9b39d2b01e93b585818dea2fcadea04ec 100644 >--- a/LayoutTests/inspector/console/x-frame-options-message.html >+++ b/LayoutTests/inspector/console/x-frame-options-message.html >@@ -2,11 +2,10 @@ > <html> > <head> > <script src="../../http/tests/inspector/resources/protocol-test.js"></script> >+<script src="../../http/tests/inspector/resources/console-test.js"></script> > <script> > function test() > { >- ProtocolTest.importScript("console-test.js"); >- > let suite = ProtocolTest.createAsyncSuite("Console.XFrameOptionsMessages"); > > ProtocolTest.Console.addTestCase(suite, { >diff --git a/LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html b/LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html >index 35d0799f28e2d8db2e9cbd57d2eff847901efc90..4a402b96b10bbeec699cbf6767b39c4b4af7acb8 100644 >--- a/LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html >+++ b/LayoutTests/inspector/debugger/didSampleProbe-multiple-probes.html >@@ -1,12 +1,11 @@ > <html> > <head> > <script src="../../http/tests/inspector/resources/protocol-test.js"></script> >+<script src="../../http/tests/inspector/resources/probe-test.js"></script> > <script src="resources/breakpoint.js"></script> > <script> > function test() > { >- ProtocolTest.importScript("probe-test.js"); >- > InspectorProtocol.sendCommand("Debugger.enable", {}); > > var samples = []; >diff --git a/LayoutTests/inspector/debugger/setBreakpoint-actions.html b/LayoutTests/inspector/debugger/setBreakpoint-actions.html >index 4ad4bf31e3cc0ac36f0cfdb86aa61983a2407447..34304d8e455ca6cef271feaf809268dfded40a5f 100644 >--- a/LayoutTests/inspector/debugger/setBreakpoint-actions.html >+++ b/LayoutTests/inspector/debugger/setBreakpoint-actions.html >@@ -1,13 +1,12 @@ > <html> > <head> > <script src="../../http/tests/inspector/resources/protocol-test.js"></script> >+<script src="../../http/tests/inspector/resources/console-test.js"></script> >+<script src="../../http/tests/inspector/resources/probe-test.js"></script> > <script src="resources/breakpoint.js"></script> > <script> > function test() > { >- ProtocolTest.importScript("console-test.js"); >- ProtocolTest.importScript("probe-test.js"); >- > InspectorProtocol.sendCommand("Console.enable", {}); > InspectorProtocol.sendCommand("Debugger.enable", {}); > >diff --git a/LayoutTests/inspector/debugger/setBreakpoint-options-exception.html b/LayoutTests/inspector/debugger/setBreakpoint-options-exception.html >index cf91e2437196d2701aa2c92ccd495aaa03b9109b..796ddb8c36c623d93727ffd34a848d4bd90127c1 100644 >--- a/LayoutTests/inspector/debugger/setBreakpoint-options-exception.html >+++ b/LayoutTests/inspector/debugger/setBreakpoint-options-exception.html >@@ -1,12 +1,11 @@ > <html> > <head> > <script src="../../http/tests/inspector/resources/protocol-test.js"></script> >+<script src="../../http/tests/inspector/resources/console-test.js"></script> > <script src="resources/breakpoint.js"></script> > <script> > function test() > { >- ProtocolTest.importScript("console-test.js"); >- > InspectorProtocol.sendCommand("Console.enable", {}); > InspectorProtocol.sendCommand("Debugger.enable", {}); > >diff --git a/LayoutTests/inspector/dom/dom-search-expected.txt b/LayoutTests/inspector/dom/dom-search-expected.txt >index d57ae0c439d50c236fb576fdb8b932d4e2ae2633..690e663e0a6e2fdca14fdc8316777ac6c401995c 100644 >--- a/LayoutTests/inspector/dom/dom-search-expected.txt >+++ b/LayoutTests/inspector/dom/dom-search-expected.txt >@@ -48,11 +48,13 @@ body.main-frame > === Query: ".body-inside-iframe" === > Count: 0 > === Query: "*" === >-Count: 12 >+Count: 14 > html > head > script > script >+script >+script > body.main-frame > p > iframe >diff --git a/LayoutTests/inspector/dom/dom-search-with-context.html b/LayoutTests/inspector/dom/dom-search-with-context.html >index 328c30f5eb814bd271153bd45b29555a46a38bf8..e8f9b67536d45ad14e10193ff17e623efef5a701 100644 >--- a/LayoutTests/inspector/dom/dom-search-with-context.html >+++ b/LayoutTests/inspector/dom/dom-search-with-context.html >@@ -1,11 +1,11 @@ > <html> > <head> > <script type="text/javascript" src="../../http/tests/inspector/resources/protocol-test.js"></script> >+<script type="text/javascript" src="../../http/tests/inspector/dom/resources/InspectorDOMListener.js"></script> > <script> > function test() > { > // Create a DOM listener to convert nodeIds to tag names. >- ProtocolTest.importScript("../dom/resources/InspectorDOMListener.js"); > var dom = createDOMListener(); > > // Caching the output to avoid searching through the log. >diff --git a/LayoutTests/inspector/dom/dom-search.html b/LayoutTests/inspector/dom/dom-search.html >index 63b4ab6ed7ff2521e4fbcdc80544c4419cf4114c..c196946a56ec43338a0e1983153627d40fe6c68e 100644 >--- a/LayoutTests/inspector/dom/dom-search.html >+++ b/LayoutTests/inspector/dom/dom-search.html >@@ -1,14 +1,16 @@ > <html> > <head> > <script type="text/javascript" src="../../http/tests/inspector/resources/protocol-test.js"></script> >+<script type="text/javascript" src="../../http/tests/inspector/dom/resources/InspectorDOMListener.js"></script> >+<script type="text/javascript" src="resources/dom-search-queries.js"></script> > <script> > function test() > { > // Loading the queries from external file to avoid having them show up in the results. >- ProtocolTest.importScript("../../../../inspector/dom/resources/dom-search-queries.js"); >+ //ProtocolTest.importScript("../../../../inspector/dom/resources/dom-search-queries.js"); > > // Create a DOM listener to convert nodeIds to tag names. >- ProtocolTest.importScript("../dom/resources/InspectorDOMListener.js"); >+ //ProtocolTest.importScript("../dom/resources/InspectorDOMListener.js"); > var dom = createDOMListener(); > > // Caching the output to avoid searching through the log. >diff --git a/LayoutTests/inspector/dom/resources/dom-search-queries.js b/LayoutTests/inspector/dom/resources/dom-search-queries.js >index 8e652e597eabe525da3940804af4b1e2ade23e13..a34eed87960c182fa9550f945e8d2da83cb68cc5 100644 >--- a/LayoutTests/inspector/dom/resources/dom-search-queries.js >+++ b/LayoutTests/inspector/dom/resources/dom-search-queries.js >@@ -1,6 +1,8 @@ >+ProtocolTestProxy.registerInitializer(function() { >+ > // Having the queries in an external file, so that DOM search will not find the script when searching for values. > >-var domSearchQueries = [ >+window.domSearchQueries = [ > "body", > "<body", > "body>", >@@ -28,4 +30,6 @@ var domSearchQueries = [ > "/html/body", > "/html/body/@onload", > "/HTML/BODY" >-]; >\ No newline at end of file >+]; >+ >+}); >\ No newline at end of file
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 147955
:
259008
|
259014
|
259016
|
259035
|
259038
|
259040
|
259043
|
259300