diff options
Diffstat (limited to 'WebCore/inspector/front-end/ScriptsPanel.js')
-rw-r--r-- | WebCore/inspector/front-end/ScriptsPanel.js | 108 |
1 files changed, 78 insertions, 30 deletions
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 8675f79..7521ea9 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -132,7 +132,9 @@ WebInspector.ScriptsPanel = function() this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSidebarPane(); this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); - this.sidebarPanes.breakpoints = new WebInspector.BreakpointsSidebarPane(); + this.sidebarPanes.jsBreakpoints = WebInspector.createJSBreakpointsSidebarPane(); + if (Preferences.domBreakpointsEnabled) + this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane(); this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane(); for (var pane in this.sidebarPanes) @@ -142,7 +144,9 @@ WebInspector.ScriptsPanel = function() this.sidebarPanes.callstack.addEventListener("call frame selected", this._callFrameSelected, this); this.sidebarPanes.scopechain.expanded = true; - this.sidebarPanes.breakpoints.expanded = true; + this.sidebarPanes.jsBreakpoints.expanded = true; + if (Preferences.domBreakpointsEnabled) + this.sidebarPanes.domBreakpoints.expanded = true; var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel."); var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower."); @@ -171,7 +175,6 @@ WebInspector.ScriptsPanel = function() this._debuggerEnabled = Preferences.debuggerAlwaysEnabled; WebInspector.breakpointManager.addEventListener("breakpoint-added", this._breakpointAdded, this); - WebInspector.breakpointManager.addEventListener("breakpoint-removed", this._breakpointRemoved, this); this.reset(); } @@ -227,11 +230,6 @@ WebInspector.ScriptsPanel.prototype = { WebInspector.Panel.prototype.hide.call(this); }, - get searchableViews() - { - return [ this.visibleView ]; - }, - get breakpointsActivated() { return this.toggleBreakpointsButton.toggled; @@ -312,26 +310,6 @@ WebInspector.ScriptsPanel.prototype = { sourceFrame.addBreakpoint(breakpoint); }, - _breakpointRemoved: function(event) - { - var breakpoint = event.data; - - var sourceFrame; - if (breakpoint.url) { - var resource = WebInspector.resourceURLMap[breakpoint.url]; - if (resource && resource.finished) - sourceFrame = this._sourceFrameForScriptOrResource(resource); - } - - if (breakpoint.sourceID && !sourceFrame) { - var object = this._sourceIDMap[breakpoint.sourceID] - sourceFrame = this._sourceFrameForScriptOrResource(object); - } - - if (sourceFrame) - sourceFrame.removeBreakpoint(breakpoint); - }, - canEditScripts: function() { return Preferences.canEditScriptSource; @@ -345,7 +323,7 @@ WebInspector.ScriptsPanel.prototype = { // Need to clear breakpoints and re-create them later when editing source. var breakpoints = WebInspector.breakpointManager.breakpointsForSourceID(sourceID); for (var i = 0; i < breakpoints.length; ++i) - WebInspector.breakpointManager.removeBreakpoint(breakpoints[i]); + breakpoints[i].remove(); function mycallback(success, newBodyOrErrorMessage, callFrames) { @@ -494,7 +472,9 @@ WebInspector.ScriptsPanel.prototype = { this.sidebarPanes.watchExpressions.refreshExpressions(); if (!preserveItems) { - this.sidebarPanes.breakpoints.reset(); + this.sidebarPanes.jsBreakpoints.reset(); + if (Preferences.domBreakpointsEnabled) + this.sidebarPanes.domBreakpoints.reset(); this.sidebarPanes.workers.reset(); } }, @@ -1029,6 +1009,74 @@ WebInspector.ScriptsPanel.prototype = { section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step out")); this.sidebarPanes.callstack.registerShortcuts(section); + }, + + searchCanceled: function() + { + WebInspector.updateSearchMatchesCount(0, this); + + if (this._searchView) + this._searchView.searchCanceled(); + + delete this._searchView; + delete this._searchQuery; + }, + + performSearch: function(query) + { + if (!this.visibleView) + return; + + // Call searchCanceled since it will reset everything we need before doing a new search. + this.searchCanceled(); + + this._searchView = this.visibleView; + this._searchQuery = query; + + function finishedCallback(view, searchMatches) + { + if (!searchMatches) + return; + + WebInspector.updateSearchMatchesCount(searchMatches, this); + view.jumpToFirstSearchResult(); + } + + this._searchView.performSearch(query, finishedCallback.bind(this)); + }, + + jumpToNextSearchResult: function() + { + if (!this._searchView) + return; + + if (this._searchView !== this.visibleView) { + this.performSearch(this._searchQuery); + return; + } + + if (this._searchView.showingLastSearchResult()) + this._searchView.jumpToFirstSearchResult(); + else + this._searchView.jumpToNextSearchResult(); + }, + + jumpToPreviousSearchResult: function() + { + if (!this._searchView) + return; + + if (this._searchView !== this.visibleView) { + this.performSearch(this._searchQuery); + if (this._searchView) + this._searchView.jumpToLastSearchResult(); + return; + } + + if (this._searchView.showingFirstSearchResult()) + this._searchView.jumpToLastSearchResult(); + else + this._searchView.jumpToPreviousSearchResult(); } } |