diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebKit/chromium/src/js | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebKit/chromium/src/js')
-rw-r--r-- | WebKit/chromium/src/js/DebuggerAgent.js | 113 | ||||
-rw-r--r-- | WebKit/chromium/src/js/DebuggerScript.js | 211 | ||||
-rw-r--r-- | WebKit/chromium/src/js/DevTools.js | 300 | ||||
-rw-r--r-- | WebKit/chromium/src/js/DevToolsHostStub.js | 5 | ||||
-rw-r--r-- | WebKit/chromium/src/js/HeapProfilerPanel.js | 4 | ||||
-rwxr-xr-x | WebKit/chromium/src/js/Images/segmentChromium2.png | bin | 0 -> 4376 bytes | |||
-rwxr-xr-x | WebKit/chromium/src/js/Images/segmentHoverChromium2.png | bin | 0 -> 4126 bytes | |||
-rwxr-xr-x | WebKit/chromium/src/js/Images/segmentSelectedChromium2.png | bin | 0 -> 4099 bytes | |||
-rwxr-xr-x | WebKit/chromium/src/js/Images/statusbarBackgroundChromium2.png | bin | 0 -> 4118 bytes | |||
-rwxr-xr-x | WebKit/chromium/src/js/Images/statusbarMenuButtonChromium2.png | bin | 0 -> 4639 bytes | |||
-rw-r--r-- | WebKit/chromium/src/js/InjectDispatch.js | 7 | ||||
-rw-r--r-- | WebKit/chromium/src/js/InspectorControllerImpl.js | 133 | ||||
-rw-r--r-- | WebKit/chromium/src/js/ProfilerAgent.js | 78 | ||||
-rw-r--r-- | WebKit/chromium/src/js/Tests.js | 101 |
14 files changed, 546 insertions, 406 deletions
diff --git a/WebKit/chromium/src/js/DebuggerAgent.js b/WebKit/chromium/src/js/DebuggerAgent.js index bb655c7..8230616 100644 --- a/WebKit/chromium/src/js/DebuggerAgent.js +++ b/WebKit/chromium/src/js/DebuggerAgent.js @@ -117,12 +117,17 @@ devtools.DebuggerAgent = function() */ this.urlToBreakpoints_ = {}; - /** * Exception message that is shown to user while on exception break. * @type {WebInspector.ConsoleMessage} */ this.currentExceptionMessage_ = null; + + /** + * Whether breakpoints should suspend execution. + * @type {boolean} + */ + this.breakpointsActivated_ = true; }; @@ -176,7 +181,7 @@ devtools.DebuggerAgent.prototype.initUI = function() // pending addition into the UI. for (var scriptId in this.parsedScripts_) { var script = this.parsedScripts_[scriptId]; - WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset()); + WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset() + 1); } return; } @@ -210,11 +215,14 @@ devtools.DebuggerAgent.prototype.resolveScriptSource = function(scriptId, callba // Force v8 execution so that it gets to processing the requested command. RemoteDebuggerAgent.processDebugCommands(); + var self = this; this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) { if (msg.isSuccess()) { var scriptJson = msg.getBody()[0]; - if (scriptJson) + if (scriptJson) { + script.source = scriptJson.source; callback(scriptJson.source); + } else callback(null); } else @@ -295,6 +303,36 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, condit /** + * Changes given line of the script. + */ +devtools.DebuggerAgent.prototype.editScriptLine = function(sourceId, line, newContent, callback) +{ + var script = this.parsedScripts_[sourceId]; + if (!script || !script.source) + return; + + var lines = script.source.split("\n"); + lines[line] = newContent; + + var commandArguments = { + "script_id": sourceId, + "new_source": lines.join("\n") + }; + + var cmd = new devtools.DebugCommand("changelive", commandArguments); + devtools.DebuggerAgent.sendCommand_(cmd); + this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) { + if (!msg.isSuccess()) + WebInspector.log("Unable to modify source code within given scope. Only function bodies are editable at the moment.", WebInspector.ConsoleMessage.MessageLevel.Warning); + this.resolveScriptSource(sourceId, callback); + if (WebInspector.panels.scripts.paused) + this.requestBacktrace_(); + }.bind(this); + RemoteDebuggerAgent.processDebugCommands(); +}; + + +/** * @param {number} sourceId Id of the script for the breakpoint. * @param {number} line Number of the line for the breakpoint. */ @@ -309,6 +347,8 @@ devtools.DebuggerAgent.prototype.removeBreakpoint = function(sourceId, line) var breakpointInfo; if (script.getUrl()) { var breakpoints = this.urlToBreakpoints_[script.getUrl()]; + if (!breakpoints) + return; breakpointInfo = breakpoints[line]; delete breakpoints[line]; } else { @@ -334,34 +374,11 @@ devtools.DebuggerAgent.prototype.removeBreakpoint = function(sourceId, line) /** - * @param {number} sourceId Id of the script for the breakpoint. - * @param {number} line Number of the line for the breakpoint. - * @param {?string} condition New breakpoint condition. + * @param {boolean} activated Whether breakpoints should be activated. */ -devtools.DebuggerAgent.prototype.updateBreakpoint = function(sourceId, line, condition) +devtools.DebuggerAgent.prototype.setBreakpointsActivated = function(activated) { - var script = this.parsedScripts_[sourceId]; - if (!script) - return; - - line = devtools.DebuggerAgent.webkitToV8LineNumber_(line); - - var breakpointInfo; - if (script.getUrl()) { - var breakpoints = this.urlToBreakpoints_[script.getUrl()]; - breakpointInfo = breakpoints[line]; - } else - breakpointInfo = script.getBreakpointInfo(line); - - var id = breakpointInfo.getV8Id(); - - // If we don't know id of this breakpoint in the v8 debugger we cannot send - // the "changebreakpoint" request. - if (id !== -1) { - // TODO(apavlov): make use of the real values for "enabled" and - // "ignoreCount" when appropriate. - this.requestChangeBreakpoint_(id, true, condition, null); - } + this.breakpointsActivated_ = activated; }; @@ -663,25 +680,6 @@ devtools.DebuggerAgent.prototype.requestClearBreakpoint_ = function(breakpointId /** - * Changes breakpoint parameters in the v8 debugger. - * @param {number} breakpointId Id of the breakpoint in the v8 debugger. - * @param {boolean} enabled Whether to enable the breakpoint. - * @param {?string} condition New breakpoint condition. - * @param {number} ignoreCount New ignore count for the breakpoint. - */ -devtools.DebuggerAgent.prototype.requestChangeBreakpoint_ = function(breakpointId, enabled, condition, ignoreCount) -{ - var cmd = new devtools.DebugCommand("changebreakpoint", { - "breakpoint": breakpointId, - "enabled": enabled, - "condition": condition, - "ignoreCount": ignoreCount - }); - devtools.DebuggerAgent.sendCommand_(cmd); -}; - - -/** * Sends "backtrace" request to v8. */ devtools.DebuggerAgent.prototype.requestBacktrace_ = function() @@ -800,6 +798,8 @@ devtools.DebuggerAgent.prototype.handleDebuggerOutput_ = function(output) this.invokeCallbackForResponse_(msg); else if (msg.getCommand() === "setbreakpoint") this.handleSetBreakpointResponse_(msg); + else if (msg.getCommand() === "changelive") + this.invokeCallbackForResponse_(msg); else if (msg.getCommand() === "clearbreakpoint") this.handleClearBreakpointResponse_(msg); else if (msg.getCommand() === "backtrace") @@ -819,7 +819,12 @@ devtools.DebuggerAgent.prototype.handleDebuggerOutput_ = function(output) */ devtools.DebuggerAgent.prototype.handleBreakEvent_ = function(msg) { - // Force scrips panel to be shown first. + if (!this.breakpointsActivated_) { + this.resumeExecution(); + return; + } + + // Force scripts panel to be shown first. WebInspector.currentPanel = WebInspector.panels.scripts; var body = msg.getBody(); @@ -834,9 +839,6 @@ devtools.DebuggerAgent.prototype.handleBreakEvent_ = function(msg) */ devtools.DebuggerAgent.prototype.handleExceptionEvent_ = function(msg) { - // Force scrips panel to be shown first. - WebInspector.currentPanel = WebInspector.panels.scripts; - var body = msg.getBody(); // No script field in the body means that v8 failed to parse the script. We // resume execution on parser errors automatically. @@ -844,6 +846,9 @@ devtools.DebuggerAgent.prototype.handleExceptionEvent_ = function(msg) var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(body.sourceLine); this.createExceptionMessage_(body.script.name, line, body.exception.text); this.requestBacktrace_(); + + // Force scripts panel to be shown. + WebInspector.currentPanel = WebInspector.panels.scripts; } else this.resumeExecution(); }; @@ -956,7 +961,7 @@ devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg) this.parsedScripts_[script.id] = new devtools.ScriptInfo(script.id, script.name, script.lineOffset, contextType); if (this.scriptsPanelInitialized_) { // Only report script as parsed after scripts panel has been shown. - WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset); + WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset + 1); } }; @@ -994,7 +999,7 @@ devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_ = function(msg) this.callFrames_.push(this.formatCallFrame_(frames[i])); WebInspector.pausedScript(this.callFrames_); this.showPendingExceptionMessage_(); - InspectorFrontendHost.activateWindow(); + InspectorFrontendHost.bringToFront(); }; diff --git a/WebKit/chromium/src/js/DebuggerScript.js b/WebKit/chromium/src/js/DebuggerScript.js new file mode 100644 index 0000000..75c5467 --- /dev/null +++ b/WebKit/chromium/src/js/DebuggerScript.js @@ -0,0 +1,211 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * 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 + * OWNER 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. + */ + +function debuggerScriptConstructor() { + +var DebuggerScript = {}; +DebuggerScript._breakpoints = {}; + + +DebuggerScript.getAfterCompileScript = function(execState, args) +{ + return DebuggerScript._formatScript(args.eventData.script_.script_); +} + +DebuggerScript.getScripts = function(execState, args) +{ + var scripts = Debug.scripts(); + var result = []; + for (var i = 0; i < scripts.length; ++i) { + result.push(DebuggerScript._formatScript(scripts[i])); + } + return result; +} + +DebuggerScript._formatScript = function(script) +{ + return { + id: script.id, + name: script.name, + source: script.source, + lineOffset: script.line_offset, + lineCount: script.lineCount(), + contextData: script.context_data + }; +} + +DebuggerScript.setBreakpoint = function(execState, args) +{ + args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber); + var key = args.scriptId + ":" + args.lineNumber; + var breakId = DebuggerScript._breakpoints[key]; + if (breakId) { + if (args.enabled) + Debug.enableScriptBreakPoint(breakId); + else + Debug.disableScriptBreakPoint(breakId); + Debug.changeScriptBreakPointCondition(breakId, args.condition); + return breakId; + } + + breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, 0 /* column */, args.condition); + DebuggerScript._breakpoints[key] = breakId; + if (!args.enabled) + Debug.disableScriptBreakPoint(breakId); + return breakId; +} + +DebuggerScript.removeBreakpoint = function(execState, args) +{ + args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber); + var key = args.scriptId + ":" + args.lineNumber; + var breakId = DebuggerScript._breakpoints[key]; + if (breakId) + Debug.findBreakPoint(breakId, true); + delete DebuggerScript._breakpoints[key]; +} + +DebuggerScript.currentCallFrame = function(execState, args) +{ + var frameCount = execState.frameCount(); + if (frameCount === 0) + return undefined; + + var topFrame; + for (var i = frameCount - 1; i >= 0; i--) { + var frameMirror = execState.frame(i); + topFrame = DebuggerScript._frameMirrorToJSCallFrame(frameMirror, topFrame); + } + return topFrame; +} + +DebuggerScript.stepIntoStatement = function(execState, args) +{ + execState.prepareStep(Debug.StepAction.StepIn, 1); +} + +DebuggerScript.stepOverStatement = function(execState, args) +{ + execState.prepareStep(Debug.StepAction.StepNext, 1); +} + +DebuggerScript.stepOutOfFunction = function(execState, args) +{ + execState.prepareStep(Debug.StepAction.StepOut, 1); +} + +DebuggerScript.clearBreakpoints = function(execState, args) +{ + for (var key in DebuggerScript._breakpoints) { + var breakId = DebuggerScript._breakpoints[key]; + Debug.findBreakPoint(breakId, true); + } + DebuggerScript._breakpoints = {}; +} + +DebuggerScript.setBreakpointsActivated = function(execState, args) +{ + for (var key in DebuggerScript._breakpoints) { + var breakId = DebuggerScript._breakpoints[key]; + if (args.enabled) + Debug.enableScriptBreakPoint(breakId); + else + Debug.disableScriptBreakPoint(breakId); + } +} + +DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) +{ + // Get function name. + var func; + try { + func = frameMirror.func(); + } catch(e) { + } + var functionName; + if (func) + functionName = func.name() || func.inferredName(); + if (!functionName) + functionName = "[anonymous]"; + + // Get script ID. + var script = func.script(); + var sourceID = script && script.id(); + + // Get line number. + var line = DebuggerScript._v8ToWwebkitLineNumber(frameMirror.sourceLine()); + + // Get this object. + var thisObject = frameMirror.details_.receiver(); + + // Get scope chain array in format: [<scope type>, <scope object>, <scope type>, <scope object>,...] + var scopeChain = []; + var scopeType = []; + for (var i = 0; i < frameMirror.scopeCount(); i++) { + var scopeMirror = frameMirror.scope(i); + var scopeObjectMirror = scopeMirror.scopeObject(); + var properties = scopeObjectMirror.properties(); + var scopeObject = {}; + for (var j = 0; j < properties.length; j++) + scopeObject[properties[j].name()] = properties[j].value_; + scopeType.push(scopeMirror.scopeType()); + scopeChain.push(scopeObject); + } + + function evaluate(expression) { + return frameMirror.evaluate(expression, false).value(); + } + + return { + "sourceID": sourceID, + "line": line, + "functionName": functionName, + "type": "function", + "thisObject": thisObject, + "scopeChain": scopeChain, + "scopeType": scopeType, + "evaluate": evaluate, + "caller": callerFrame + }; +} + +DebuggerScript._webkitToV8LineNumber = function(line) +{ + return line - 1; +}; + +DebuggerScript._v8ToWwebkitLineNumber = function(line) +{ + return line + 1; +}; + +return DebuggerScript; + +} diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index dcb181b..a530fe5 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -151,31 +151,12 @@ devtools.ToolsAgent.prototype.evaluate = function(expr) /** - * Enables / disables resources panel in the ui. - * @param {boolean} enabled New panel status. - */ -WebInspector.setResourcesPanelEnabled = function(enabled) -{ - InspectorBackend._resourceTrackingEnabled = enabled; - WebInspector.panels.resources.reset(); -}; - - -/** * Prints string to the inspector console or shows alert if the console doesn't * exist. * @param {string} text */ function debugPrint(text) { - var console = WebInspector.console; - if (console) { - console.addMessage(new WebInspector.ConsoleMessage( - WebInspector.ConsoleMessage.MessageSource.JS, - WebInspector.ConsoleMessage.MessageType.Log, - WebInspector.ConsoleMessage.MessageLevel.Log, - 1, "chrome://devtools/<internal>", undefined, -1, text)); - } else - alert(text); + WebInspector.log(text); } @@ -200,54 +181,17 @@ WebInspector.loaded = function() Preferences.ignoreWhitespace = false; Preferences.samplingCPUProfiler = true; Preferences.heapProfilerPresent = true; + Preferences.debuggerAlwaysEnabled = true; + Preferences.profilerAlwaysEnabled = true; + RemoteDebuggerAgent.setDebuggerScriptSource("(" + debuggerScriptConstructor + ")();"); + oldLoaded.call(this); InspectorFrontendHost.loaded(); }; -(function() -{ - - /** - * Handles an F3 keydown event to focus the Inspector search box. - * @param {KeyboardEvent} event Event to optionally handle - * @return {boolean} whether the event has been handled - */ - function handleF3Keydown(event) { - if (event.keyIdentifier === "F3" && !event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) { - var searchField = document.getElementById("search"); - searchField.focus(); - searchField.select(); - event.preventDefault(); - return true; - } - return false; - } - - - var oldKeyDown = WebInspector.documentKeyDown; - /** - * This override allows to intercept keydown events we want to handle in a - * custom way. Some nested documents (iframes) delegate keydown handling to - * WebInspector.documentKeyDown (e.g. SourceFrame). - * @param {KeyboardEvent} event - * @override - */ - WebInspector.documentKeyDown = function(event) { - var isHandled = handleF3Keydown(event); - if (!isHandled) { - // Mute refresh action. - if (event.keyIdentifier === "F5") - event.preventDefault(); - else if (event.keyIdentifier === "U+0052" /* "R" */ && (event.ctrlKey || event.metaKey)) - event.preventDefault(); - else - oldKeyDown.call(this, event); - } - }; -})(); - +if (!window.v8ScriptDebugServerEnabled) { /** * This override is necessary for adding script source asynchronously. @@ -279,24 +223,12 @@ WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded = function() */ WebInspector.ScriptView.prototype.didResolveScriptSource_ = function() { - this.sourceFrame.setContent("text/javascript", this.script.source); + this.sourceFrame.setContent("text/javascript", this._prependWhitespace(this.script.source)); this._sourceFrameSetup = true; delete this._frameNeedsSetup; }; -/** - * @param {string} type Type of the the property value("object" or "function"). - * @param {string} className Class name of the property value. - * @constructor - */ -WebInspector.UnresolvedPropertyValue = function(type, className) -{ - this.type = type; - this.className = className; -}; - - (function() { var oldShow = WebInspector.ScriptsPanel.prototype.show; @@ -309,6 +241,47 @@ WebInspector.UnresolvedPropertyValue = function(type, className) })(); +(function () { +var orig = InjectedScriptAccess.prototype.getProperties; +InjectedScriptAccess.prototype.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback) +{ + if (objectProxy.isScope) + devtools.tools.getDebuggerAgent().resolveScope(objectProxy.objectId, callback); + else if (objectProxy.isV8Ref) + devtools.tools.getDebuggerAgent().resolveChildren(objectProxy.objectId, callback, false); + else + orig.apply(this, arguments); +}; +})(); + + +(function() +{ +InjectedScriptAccess.prototype.evaluateInCallFrame = function(callFrameId, code, objectGroup, callback) +{ + //TODO(pfeldman): remove once 49084 is rolled. + if (!callback) + callback = objectGroup; + devtools.tools.getDebuggerAgent().evaluateInCallFrame(callFrameId, code, callback); +}; +})(); + + +(function() +{ +var orig = InjectedScriptAccess.prototype.getCompletions; +InjectedScriptAccess.prototype.getCompletions = function(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions) +{ + if (typeof callFrameId === "number") + devtools.tools.getDebuggerAgent().resolveCompletionsOnFrame(expressionString, callFrameId, reportCompletions); + else + return orig.apply(this, arguments); +}; +})(); + +} + + (function InterceptProfilesPanelEvents() { var oldShow = WebInspector.ProfilesPanel.prototype.show; @@ -333,6 +306,17 @@ WebInspector.UIString = function(string) return String.vsprintf(string, Array.prototype.slice.call(arguments, 1)); }; +// Activate window upon node search complete. This will go away once InspectorFrontendClient is landed. +(function() { + var original = WebInspector.searchingForNodeWasDisabled; + WebInspector.searchingForNodeWasDisabled = function() + { + if (this.panels.elements._nodeSearchButton.toggled) + InspectorFrontendHost.bringToFront(); + original.apply(this, arguments); + } +})(); + // There is no clear way of setting frame title yet. So sniffing main resource // load. @@ -392,81 +376,6 @@ WebInspector.UIString = function(string) })(); -(function () { -var orig = InjectedScriptAccess.prototype.getProperties; -InjectedScriptAccess.prototype.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback) -{ - if (objectProxy.isScope) - devtools.tools.getDebuggerAgent().resolveScope(objectProxy.objectId, callback); - else if (objectProxy.isV8Ref) - devtools.tools.getDebuggerAgent().resolveChildren(objectProxy.objectId, callback, false); - else - orig.apply(this, arguments); -}; -})(); - - -(function() -{ -InjectedScriptAccess.prototype.evaluateInCallFrame = function(callFrameId, code, objectGroup, callback) -{ - //TODO(pfeldman): remove once 49084 is rolled. - if (!callback) - callback = objectGroup; - devtools.tools.getDebuggerAgent().evaluateInCallFrame(callFrameId, code, callback); -}; -})(); - - -WebInspector.resourceTrackingWasEnabled = function() -{ - InspectorBackend._resourceTrackingEnabled = true; - this.panels.resources.resourceTrackingWasEnabled(); -}; - -WebInspector.resourceTrackingWasDisabled = function() -{ - InspectorBackend._resourceTrackingEnabled = false; - this.panels.resources.resourceTrackingWasDisabled(); -}; - -(function() -{ -var orig = WebInspector.ConsoleMessage.prototype.setMessageBody; -WebInspector.ConsoleMessage.prototype.setMessageBody = function(args) -{ - for (var i = 0; i < args.length; ++i) { - if (typeof args[i] === "string") - args[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(args[i]); - } - orig.call(this, args); -}; -})(); - - -(function() -{ -var orig = InjectedScriptAccess.prototype.getCompletions; -InjectedScriptAccess.prototype.getCompletions = function(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions) -{ - if (typeof callFrameId === "number") - devtools.tools.getDebuggerAgent().resolveCompletionsOnFrame(expressionString, callFrameId, reportCompletions); - else - return orig.apply(this, arguments); -}; -})(); - - -(function() -{ -WebInspector.ElementsPanel.prototype._nodeSearchButtonClicked = function( event) -{ - InspectorBackend.toggleNodeSearch(); - this.nodeSearchButton.toggled = !this.nodeSearchButton.toggled; -}; -})(); - - // We need to have a place for postponed tasks // which should be executed when all the messages between agent and frontend // are processed. @@ -498,7 +407,92 @@ InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element) }; })(); -WebInspector.pausedScript = function(callFrames) +// Chromium theme support. +WebInspector.setToolbarColors = function(backgroundColor, color) { - this.panels.scripts.debuggerPaused(callFrames); -}; + if (!WebInspector._themeStyleElement) { + WebInspector._themeStyleElement = document.createElement("style"); + document.head.appendChild(WebInspector._themeStyleElement); + } + WebInspector._themeStyleElement.textContent = + "body #toolbar, body.inactive #toolbar {\ + background-image: none !important;\ + background-color: " + backgroundColor + " !important;\ + }\ + \ + body .status-bar {\ + background-image: url(Images/statusbarBackgroundChromium2.png) !important;\ + background-color: " + backgroundColor + " !important;\ + }\ + \ + body button.status-bar-item {\ + background-image: none !important;\ + }\ + \ + button.status-bar-item {\ + background-image: none;\ + border-right: 1px solid " + backgroundColor + ";\ + }\ + \ + .status-bar {\ + background-image: none;\ + color: " + color + ";\ + }\ + \ + body #drawer {\ + background-image: none !important;\ + }\ + \ + #drawer-status-bar {\ + background-image: url(Images/statusbarBackgroundChromium2.png);\ + background-color: " + backgroundColor + ";\ + }\ + \ + \ + body.drawer-visible #main-status-bar {\ + background-image: url(Images/statusbarBackgroundChromium2.png) !important;\ + }\ + \ + body .crumbs .crumb, body .crumbs .crumb.end {\ + -webkit-border-image: url(Images/segmentChromium2.png) 0 12 0 2 !important;\ + background-color: " + backgroundColor + " !important;\ + }\ + \ + body .crumbs .crumb:hover, body .crumbs .crumb.dimmed:hover {\ + -webkit-border-image: url(Images/segmentHoverChromium2.png) 0 12 0 2 !important;\ + }\ + \ + body .crumbs .crumb.end {\ + -webkit-border-image: url(Images/segmentChromium2.png) 0 12 0 2 !important;\ + }\ + \ + body .crumbs .crumb.selected:hover, body .crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {\ + -webkit-border-image: url(Images/segmentSelectedChromium2.png) 0 12 0 2 !important;\ + }\ + \ + body select.status-bar-item {\ + -webkit-border-image: url(Images/statusbarMenuButtonChromium2.png) 0 17 0 2 !important;\ + background-color: " + backgroundColor + " !important;\ + text-shadow: none !important;\ + }\ + \ + .glyph {\ + background-color: " + color + ";\ + }\ + \ + button.status-bar-item .glyph.shadow {\ + display: none;\ + }\ + \ + .crumbs, .crumbs .crumb:hover, #drawer .scope-bar:not(.console-filter-top) li, .toolbar-label, select.status-bar-item {\ + text-shadow: none;\ + color: " + color + ";\ + }"; +} + +WebInspector.resetToolbarColors = function() +{ + if (WebInspector._themeStyleElement) + WebInspector._themeStyleElement.textContent = ""; + +} diff --git a/WebKit/chromium/src/js/DevToolsHostStub.js b/WebKit/chromium/src/js/DevToolsHostStub.js index 8b2f46b..cae4a1e 100644 --- a/WebKit/chromium/src/js/DevToolsHostStub.js +++ b/WebKit/chromium/src/js/DevToolsHostStub.js @@ -55,6 +55,11 @@ RemoteDebuggerAgentStub.prototype.processDebugCommands = function() }; +RemoteDebuggerAgentStub.prototype.setDebuggerScriptSource = function(source) +{ +}; + + /** * @constructor */ diff --git a/WebKit/chromium/src/js/HeapProfilerPanel.js b/WebKit/chromium/src/js/HeapProfilerPanel.js index abbf580..0fc4418 100644 --- a/WebKit/chromium/src/js/HeapProfilerPanel.js +++ b/WebKit/chromium/src/js/HeapProfilerPanel.js @@ -205,7 +205,7 @@ WebInspector.HeapSnapshotView.prototype = { // Call searchCanceled since it will reset everything we need before doing a new search. this.searchCanceled(); - query = query.trimWhitespace(); + query = query.trim(); if (!query.length) return; @@ -937,7 +937,7 @@ WebInspector.HeapSnapshotProfileType.prototype = { get welcomeMessage() { - return WebInspector.UIString("Get a heap snapshot by pressing<br>the %s button on the status bar."); + return WebInspector.UIString("Get a heap snapshot by pressing the %s button on the status bar."); }, createSidebarTreeElementForProfile: function(profile) diff --git a/WebKit/chromium/src/js/Images/segmentChromium2.png b/WebKit/chromium/src/js/Images/segmentChromium2.png Binary files differnew file mode 100755 index 0000000..e94f570 --- /dev/null +++ b/WebKit/chromium/src/js/Images/segmentChromium2.png diff --git a/WebKit/chromium/src/js/Images/segmentHoverChromium2.png b/WebKit/chromium/src/js/Images/segmentHoverChromium2.png Binary files differnew file mode 100755 index 0000000..4d4a211 --- /dev/null +++ b/WebKit/chromium/src/js/Images/segmentHoverChromium2.png diff --git a/WebKit/chromium/src/js/Images/segmentSelectedChromium2.png b/WebKit/chromium/src/js/Images/segmentSelectedChromium2.png Binary files differnew file mode 100755 index 0000000..f2b695b --- /dev/null +++ b/WebKit/chromium/src/js/Images/segmentSelectedChromium2.png diff --git a/WebKit/chromium/src/js/Images/statusbarBackgroundChromium2.png b/WebKit/chromium/src/js/Images/statusbarBackgroundChromium2.png Binary files differnew file mode 100755 index 0000000..12d62b1 --- /dev/null +++ b/WebKit/chromium/src/js/Images/statusbarBackgroundChromium2.png diff --git a/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium2.png b/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium2.png Binary files differnew file mode 100755 index 0000000..9527ac8 --- /dev/null +++ b/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium2.png diff --git a/WebKit/chromium/src/js/InjectDispatch.js b/WebKit/chromium/src/js/InjectDispatch.js index e070c42..30caaf2 100644 --- a/WebKit/chromium/src/js/InjectDispatch.js +++ b/WebKit/chromium/src/js/InjectDispatch.js @@ -104,3 +104,10 @@ function dispatch(method, var_args) { var call = JSON.stringify(args); DevToolsAgentHost.dispatch(call); }; + +function close() { + // This method is called when InspectorFrontend closes in layout tests. +} + +function inspectedPageDestroyed() { +} diff --git a/WebKit/chromium/src/js/InspectorControllerImpl.js b/WebKit/chromium/src/js/InspectorControllerImpl.js index c92a94c..becc076 100644 --- a/WebKit/chromium/src/js/InspectorControllerImpl.js +++ b/WebKit/chromium/src/js/InspectorControllerImpl.js @@ -38,23 +38,30 @@ if (!this.devtools) devtools.InspectorBackendImpl = function() { WebInspector.InspectorBackendStub.call(this); + this.installInspectorControllerDelegate_("addScriptToEvaluateOnLoad"); this.installInspectorControllerDelegate_("clearMessages"); this.installInspectorControllerDelegate_("copyNode"); this.installInspectorControllerDelegate_("deleteCookie"); this.installInspectorControllerDelegate_("didEvaluateForTestInFrontend"); this.installInspectorControllerDelegate_("disableResourceTracking"); + this.installInspectorControllerDelegate_("disableSearchingForNode"); this.installInspectorControllerDelegate_("disableTimeline"); this.installInspectorControllerDelegate_("enableResourceTracking"); + this.installInspectorControllerDelegate_("enableSearchingForNode"); this.installInspectorControllerDelegate_("enableTimeline"); this.installInspectorControllerDelegate_("getChildNodes"); this.installInspectorControllerDelegate_("getCookies"); this.installInspectorControllerDelegate_("getDatabaseTableNames"); this.installInspectorControllerDelegate_("getDOMStorageEntries"); this.installInspectorControllerDelegate_("getEventListenersForNode"); + this.installInspectorControllerDelegate_("getProfile"); + this.installInspectorControllerDelegate_("getProfileHeaders"); this.installInspectorControllerDelegate_("getResourceContent"); this.installInspectorControllerDelegate_("highlightDOMNode"); this.installInspectorControllerDelegate_("hideDOMNodeHighlight"); this.installInspectorControllerDelegate_("releaseWrapperObjectGroup"); + this.installInspectorControllerDelegate_("removeAllScriptsToEvaluateOnLoad"); + this.installInspectorControllerDelegate_("reloadPage"); this.installInspectorControllerDelegate_("removeAttribute"); this.installInspectorControllerDelegate_("removeDOMStorageItem"); this.installInspectorControllerDelegate_("removeNode"); @@ -63,25 +70,39 @@ devtools.InspectorBackendImpl = function() this.installInspectorControllerDelegate_("setDOMStorageItem"); this.installInspectorControllerDelegate_("setInjectedScriptSource"); this.installInspectorControllerDelegate_("setTextNodeValue"); + this.installInspectorControllerDelegate_("startProfiling"); this.installInspectorControllerDelegate_("startTimelineProfiler"); + this.installInspectorControllerDelegate_("stopProfiling"); this.installInspectorControllerDelegate_("stopTimelineProfiler"); this.installInspectorControllerDelegate_("storeLastActivePanel"); -}; -devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype; - -/** - * {@inheritDoc}. - */ -devtools.InspectorBackendImpl.prototype.toggleNodeSearch = function() -{ - WebInspector.InspectorBackendStub.prototype.toggleNodeSearch.call(this); - this.callInspectorController_.call(this, "toggleNodeSearch"); - if (!this.searchingForNode()) { - // This is called from ElementsPanel treeOutline's focusNodeChanged(). - DevToolsHost.activateWindow(); + this.installInspectorControllerDelegate_("getAllStyles"); + this.installInspectorControllerDelegate_("getStyles"); + this.installInspectorControllerDelegate_("getComputedStyle"); + this.installInspectorControllerDelegate_("getInlineStyle"); + this.installInspectorControllerDelegate_("applyStyleText"); + this.installInspectorControllerDelegate_("setStyleText"); + this.installInspectorControllerDelegate_("setStyleProperty"); + this.installInspectorControllerDelegate_("toggleStyleEnabled"); + this.installInspectorControllerDelegate_("setRuleSelector"); + this.installInspectorControllerDelegate_("addRule"); + + if (window.v8ScriptDebugServerEnabled) { + this.installInspectorControllerDelegate_("disableDebugger"); + this.installInspectorControllerDelegate_("enableDebugger"); + this.installInspectorControllerDelegate_("setBreakpoint"); + this.installInspectorControllerDelegate_("removeBreakpoint"); + this.installInspectorControllerDelegate_("activateBreakpoints"); + this.installInspectorControllerDelegate_("deactivateBreakpoints"); + this.installInspectorControllerDelegate_("pauseInDebugger"); + this.installInspectorControllerDelegate_("resumeDebugger"); + this.installInspectorControllerDelegate_("stepIntoStatementInDebugger"); + this.installInspectorControllerDelegate_("stepOutOfFunctionInDebugger"); + this.installInspectorControllerDelegate_("stepOverStatementInDebugger"); + this.installInspectorControllerDelegate_("setPauseOnExceptionsState"); } }; +devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype; /** @@ -102,9 +123,13 @@ devtools.InspectorBackendImpl.prototype.profilerEnabled = function() }; -devtools.InspectorBackendImpl.prototype.addBreakpoint = function(sourceID, line, condition) +if (!window.v8ScriptDebugServerEnabled) { + +devtools.InspectorBackendImpl.prototype.setBreakpoint = function(sourceID, line, enabled, condition) { - devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, condition); + this.removeBreakpoint(sourceID, line); + if (enabled) + devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, condition); }; @@ -113,11 +138,27 @@ devtools.InspectorBackendImpl.prototype.removeBreakpoint = function(sourceID, li devtools.tools.getDebuggerAgent().removeBreakpoint(sourceID, line); }; -devtools.InspectorBackendImpl.prototype.updateBreakpoint = function(sourceID, line, condition) + +devtools.InspectorBackendImpl.prototype.editScriptLine = function(callID, sourceID, line, newContent) +{ + devtools.tools.getDebuggerAgent().editScriptLine(sourceID, line, newContent, function(newFullBody) { + WebInspector.didEditScriptLine(callID, newFullBody); + }); +}; + + +devtools.InspectorBackendImpl.prototype.activateBreakpoints = function() +{ + devtools.tools.getDebuggerAgent().setBreakpointsActivated(true); +}; + + +devtools.InspectorBackendImpl.prototype.deactivateBreakpoints = function() { - devtools.tools.getDebuggerAgent().updateBreakpoint(sourceID, line, condition); + devtools.tools.getDebuggerAgent().setBreakpointsActivated(false); }; + devtools.InspectorBackendImpl.prototype.pauseInDebugger = function() { devtools.tools.getDebuggerAgent().pauseExecution(); @@ -155,16 +196,10 @@ devtools.InspectorBackendImpl.prototype.setPauseOnExceptionsState = function(sta this._setPauseOnExceptionsState = state; // TODO(yurys): support all three states. See http://crbug.com/32877 var enabled = (state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions); - return devtools.tools.getDebuggerAgent().setPauseOnExceptions(enabled); + WebInspector.updatePauseOnExceptionsState(enabled ? WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions : WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions); + devtools.tools.getDebuggerAgent().setPauseOnExceptions(enabled); }; -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.pauseOnExceptionsState = function() -{ - return (this._setPauseOnExceptionsState || WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions); -}; /** * @override @@ -183,53 +218,7 @@ devtools.InspectorBackendImpl.prototype.setPauseOnExceptions = function(value) return devtools.tools.getDebuggerAgent().setPauseOnExceptions(value); }; - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.startProfiling = function() -{ - devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU); -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.stopProfiling = function() -{ - devtools.tools.getProfilerAgent().stopProfiling( devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU); -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.getProfileHeaders = function(callId) -{ - WebInspector.didGetProfileHeaders(callId, []); -}; - - -/** - * Emulate WebKit InspectorController behavior. It stores profiles on renderer side, - * and is able to retrieve them by uid using "getProfile". - */ -devtools.InspectorBackendImpl.prototype.addFullProfile = function(profile) -{ - WebInspector.__fullProfiles = WebInspector.__fullProfiles || {}; - WebInspector.__fullProfiles[profile.uid] = profile; -}; - - -/** - * @override - */ -devtools.InspectorBackendImpl.prototype.getProfile = function(callId, uid) -{ - if (WebInspector.__fullProfiles && (uid in WebInspector.__fullProfiles)) - WebInspector.didGetProfile(callId, WebInspector.__fullProfiles[uid]); -}; +} /** diff --git a/WebKit/chromium/src/js/ProfilerAgent.js b/WebKit/chromium/src/js/ProfilerAgent.js index e08c5d2..29de4a3 100644 --- a/WebKit/chromium/src/js/ProfilerAgent.js +++ b/WebKit/chromium/src/js/ProfilerAgent.js @@ -41,18 +41,6 @@ devtools.ProfilerAgent = function() RemoteProfilerAgent.didGetLogLines = this._didGetLogLines.bind(this); /** - * Active profiler modules flags. - * @type {number} - */ - this._activeProfilerModules = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE; - - /** - * Interval for polling profiler state. - * @type {number} - */ - this._getActiveProfilerModulesInterval = null; - - /** * Profiler log position. * @type {number} */ @@ -65,12 +53,6 @@ devtools.ProfilerAgent = function() this._lastRequestedLogPosition = -1; /** - * Whether log contents retrieval must be forced next time. - * @type {boolean} - */ - this._forceGetLogLines = false; - - /** * Profiler processor instance. * @type {devtools.profiler.Processor} */ @@ -92,50 +74,11 @@ devtools.ProfilerAgent.ProfilerModules = { /** - * Sets up callbacks that deal with profiles processing. - */ -devtools.ProfilerAgent.prototype.setupProfilerProcessorCallbacks = function() -{ - // A temporary icon indicating that the profile is being processed. - var processingIcon = new WebInspector.SidebarTreeElement( - "profile-sidebar-tree-item", - WebInspector.UIString("Processing..."), - '', null, false); - var profilesSidebar = WebInspector.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).treeElement; - - this._profilerProcessor.setCallbacks( - function onProfileProcessingStarted() { - // Set visually empty string. Subtitle hiding is done via styles - // manipulation which doesn't play well with dynamic append / removal. - processingIcon.subtitle = " "; - profilesSidebar.appendChild(processingIcon); - }, - function onProfileProcessingStatus(ticksCount) { - processingIcon.subtitle = WebInspector.UIString("%d ticks processed", ticksCount); - }, - function onProfileProcessingFinished(profile) { - profilesSidebar.removeChild(processingIcon); - profile.typeId = WebInspector.CPUProfileType.TypeId; - InspectorBackend.addFullProfile(profile); - WebInspector.addProfileHeader(profile); - // If no profile is currently shown, show the new one. - var profilesPanel = WebInspector.panels.profiles; - if (!profilesPanel.visibleView) { - profilesPanel.showProfile(profile); - } - } - ); -}; - - -/** * Initializes profiling state. */ devtools.ProfilerAgent.prototype.initializeProfiling = function() { - this.setupProfilerProcessorCallbacks(); - this._forceGetLogLines = true; - this._getActiveProfilerModulesInterval = setInterval(function() { RemoteProfilerAgent.getActiveProfilerModules(); }, 1000); + this._getNextLogLines(false); }; @@ -193,16 +136,6 @@ devtools.ProfilerAgent.prototype.stopProfiling = function(modules) */ devtools.ProfilerAgent.prototype._didGetActiveProfilerModules = function(modules) { - var profModules = devtools.ProfilerAgent.ProfilerModules; - var profModuleNone = profModules.PROFILER_MODULE_NONE; - if (this._forceGetLogLines || (modules !== profModuleNone && this._activeProfilerModules === profModuleNone)) { - this._forceGetLogLines = false; - // Start to query log data. - this._getNextLogLines(true); - } - this._activeProfilerModules = modules; - // Update buttons. - WebInspector.setRecordingProfile(modules & profModules.PROFILER_MODULE_CPU); }; @@ -214,14 +147,11 @@ devtools.ProfilerAgent.prototype._didGetActiveProfilerModules = function(modules devtools.ProfilerAgent.prototype._didGetLogLines = function(pos, log) { this._logPosition = pos; - if (log.length > 0) + if (log.length > 0) { this._profilerProcessor.processLogChunk(log); - else { + this._getNextLogLines(); + } else { // Allow re-reading from the last position. this._lastRequestedLogPosition = this._logPosition - 1; - if (this._activeProfilerModules === devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE) - // No new data and profiling is stopped---suspend log reading. - return; } - this._getNextLogLines(); }; diff --git a/WebKit/chromium/src/js/Tests.js b/WebKit/chromium/src/js/Tests.js index fa0c99f..758b8c0 100644 --- a/WebKit/chromium/src/js/Tests.js +++ b/WebKit/chromium/src/js/Tests.js @@ -295,19 +295,19 @@ TestSuite.prototype.testResourceContentLength = function() var resource = WebInspector.resources[identifier]; if (!resource || !resource.url) return; - if (resource.url.search("image.html$") !== -1) { + if (resource.url.search("image.html") !== -1) { var expectedLength = 87; test.assertTrue( - resource.contentLength <= expectedLength, + resource.resourceSize <= expectedLength, "image.html content length is greater thatn expected."); - if (expectedLength === resource.contentLength) + if (expectedLength === resource.resourceSize) html = true; } else if (resource.url.search("image.png") !== -1) { var expectedLength = 257796; test.assertTrue( - resource.contentLength <= expectedLength, + resource.resourceSize <= expectedLength, "image.png content length is greater than expected."); - if (expectedLength === resource.contentLength) + if (expectedLength === resource.resourceSize) png = true; } if (html && png) { @@ -425,39 +425,38 @@ TestSuite.prototype.testProfilerTab = function() { this.showPanel("profiles"); + var panel = WebInspector.panels.profiles; var test = this; - this.addSniffer(WebInspector.panels.profiles, "addProfileHeader", - function(typeOrProfile, profile) { - if (!profile) - profile = typeOrProfile; - var panel = WebInspector.panels.profiles; - panel.showProfile(profile); - var node = panel.visibleView.profileDataGridTree.children[0]; - // Iterate over displayed functions and search for a function - // that is called "fib" or "eternal_fib". If found, it will mean - // that we actually have profiled page's code. - while (node) { - if (node.functionName.indexOf("fib") !== -1) - test.releaseControl(); - node = node.traverseNextNode(true, null, true); - } - test.fail(); - }); - var ticksCount = 0; - var tickRecord = "\nt,"; - this.addSniffer(RemoteProfilerAgent, "didGetLogLines", - function(posIgnored, log) { - var pos = 0; - while ((pos = log.indexOf(tickRecord, pos)) !== -1) { - pos += tickRecord.length; - ticksCount++; - } - if (ticksCount > 100) - InspectorBackend.stopProfiling(); - }, true); + function findDisplayedNode() { + var node = panel.visibleView.profileDataGridTree.children[0]; + if (!node) { + // Profile hadn't been queried yet, re-schedule. + window.setTimeout(findDisplayedNode, 100); + return; + } - InspectorBackend.startProfiling(); + // Iterate over displayed functions and search for a function + // that is called "fib" or "eternal_fib". If found, this will mean + // that we actually have profiled page's code. + while (node) { + if (node.functionName.indexOf("fib") !== -1) + test.releaseControl(); + node = node.traverseNextNode(true, null, true); + } + + test.fail(); + } + + function findVisibleView() { + if (!panel.visibleView) { + setTimeout(findVisibleView, 0); + return; + } + setTimeout(findDisplayedNode, 0); + } + + findVisibleView(); this.takeControl(); }; @@ -470,7 +469,7 @@ TestSuite.prototype.testShowScriptsTab = function() this.showPanel("scripts"); var test = this; // There should be at least main page script. - this._waitUntilScriptsAreParsed(["debugger_test_page.html$"], + this._waitUntilScriptsAreParsed(["debugger_test_page.html"], function() { test.releaseControl(); }); @@ -502,7 +501,7 @@ TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function() var parsed = devtools.tools.getDebuggerAgent().parsedScripts_; for (var id in parsed) { var url = parsed[id].getUrl(); - if (url && url.search("debugger_test_page.html$") !== -1) { + if (url && url.search("debugger_test_page.html") !== -1) { checkScriptsPanel(); return; } @@ -512,7 +511,7 @@ TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function() function checkScriptsPanel() { test.showPanel("scripts"); - test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html$"]), "Inspected script not found in the scripts list"); + test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Inspected script not found in the scripts list"); test.releaseControl(); } @@ -530,7 +529,7 @@ TestSuite.prototype.testContentScriptIsPresent = function() var test = this; test._waitUntilScriptsAreParsed( - ["page_with_content_script.html$", "simple_content_script.js$"], + ["page_with_content_script.html", "simple_content_script.js"], function() { test.releaseControl(); }); @@ -568,7 +567,7 @@ TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function() function checkScriptsPanel() { test.assertTrue(!!WebInspector.panels.scripts.visibleView, "No visible script view."); - test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html$"]), "Some scripts are missing."); + test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Some scripts are missing."); checkNoDuplicates(); test.releaseControl(); } @@ -584,7 +583,7 @@ TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function() } test._waitUntilScriptsAreParsed( - ["debugger_test_page.html$"], + ["debugger_test_page.html"], function() { checkNoDuplicates(); setTimeout(switchToElementsTab, 0); @@ -635,15 +634,15 @@ TestSuite.prototype.testPauseOnException = function() // TODO(yurys): remove else branch once the states are supported. if (WebInspector.ScriptsPanel.PauseOnExceptionsState) { - while (WebInspector.currentPanel.pauseOnExceptionButton.state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions) - WebInspector.currentPanel.pauseOnExceptionButton.element.click(); + while (WebInspector.currentPanel._pauseOnExceptionButton.state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions) + WebInspector.currentPanel._pauseOnExceptionButton.element.click(); } else { // Make sure pause on exceptions is on. - if (!WebInspector.currentPanel.pauseOnExceptionButton.toggled) - WebInspector.currentPanel.pauseOnExceptionButton.element.click(); + if (!WebInspector.currentPanel._pauseOnExceptionButton.toggled) + WebInspector.currentPanel._pauseOnExceptionButton.element.click(); } - this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html$"]); + this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html"]); this._waitForScriptPause( { @@ -913,7 +912,7 @@ TestSuite.prototype.testCompletionOnPause = function() { this.showPanel("scripts"); var test = this; - this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html$"]); + this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html"]); this._waitForScriptPause( { @@ -974,7 +973,7 @@ TestSuite.prototype.testAutoContinueOnSyntaxError = function() // InjectedScript._ensureCommandLineAPIInstalled) since the page script // contains a syntax error. for (var i = 0 ; i < options.length; i++) { - if (options[i].text.search("script_syntax_error.html$") !== -1) + if (options[i].text.search("script_syntax_error.html") !== -1) test.fail("Script with syntax error should not be in the list of parsed scripts."); } } @@ -1173,7 +1172,7 @@ TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callb */ TestSuite.prototype._executeFunctionForStepTest = function() { - this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html$", "debugger_step.js$"]); + this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html", "debugger_step.js"]); }; @@ -1437,7 +1436,7 @@ TestSuite.prototype.testExpandScope = function() this.showPanel("scripts"); var test = this; - this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html$"]); + this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html"]); this._waitForScriptPause( { @@ -1551,7 +1550,7 @@ TestSuite.prototype.testDebugIntrinsicProperties = function() this.showPanel("scripts"); var test = this; - this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html$"]); + this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html"]); this._waitForScriptPause( { |