Changeset 65939 in webkit


Ignore:
Timestamp:
Aug 24, 2010 3:16:55 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-08-24 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: show DOM breakpoints in sidebar pane
https://bugs.webkit.org/show_bug.cgi?id=44424

  • inspector/dom-breakpoints.html:

2010-08-24 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: show DOM breakpoints in sidebar pane
https://bugs.webkit.org/show_bug.cgi?id=44424

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65937 r65939  
     12010-08-24  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: show DOM breakpoints in sidebar pane
     6        https://bugs.webkit.org/show_bug.cgi?id=44424
     7
     8        * inspector/dom-breakpoints.html:
     9
    1102010-08-24  Dumitru Daniliuc  <dumi@chromium.org>
    211
  • trunk/LayoutTests/inspector/dom-breakpoints.html

    r65799 r65939  
    2525    {
    2626        InspectorTest.addResult("Found div element.");
    27         InspectorBackend.setDOMBreakpoint(node.id, WebInspector.ElementsTreeElement.DOMBreakpointTypeSubtreeModified);
     27        WebInspector.domBreakpointManager.setBreakpoint(node, WebInspector.DOMBreakpoint.Types.SubtreeModified);
    2828        InspectorTest.addResult("Set DOM breakpoint.");
    2929        InspectorTest.evaluateInConsole("appendElement()");
  • trunk/WebCore/ChangeLog

    r65938 r65939  
     12010-08-24  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: show DOM breakpoints in sidebar pane
     6        https://bugs.webkit.org/show_bug.cgi?id=44424
     7
     8        * inspector/front-end/BreakpointManager.js:
     9        (WebInspector.BreakpointManager.prototype._setBreakpoint):
     10        (WebInspector.BreakpointManager.prototype._breakpointRemoved):
     11        (WebInspector.BreakpointManager.prototype._setBreakpointOnBackend):
     12        (WebInspector.Breakpoint.prototype.set enabled):
     13        (WebInspector.Breakpoint.prototype.set condition):
     14        (WebInspector.Breakpoint.prototype.remove):
     15        * inspector/front-end/BreakpointsSidebarPane.js:
     16        (WebInspector.BreakpointsSidebarPane):
     17        (WebInspector.BreakpointsSidebarPane.prototype.addBreakpoint):
     18        (WebInspector.BreakpointsSidebarPane.prototype._breakpointRemoved):
     19        (WebInspector.BreakpointsSidebarPane.prototype._contextMenuEventFired):
     20        (WebInspector.BreakpointItem):
     21        (WebInspector.BreakpointItem.prototype.element):
     22        (WebInspector.BreakpointItem.prototype.remove):
     23        (WebInspector.BreakpointItem.prototype._checkboxClicked):
     24        (WebInspector.BreakpointItem.prototype._enableChanged):
     25        (WebInspector.BreakpointItem.prototype._removed):
     26        (WebInspector.JSBreakpointItem):
     27        (WebInspector.JSBreakpointItem.prototype._textChanged):
     28        (WebInspector.DOMBreakpointItem):
     29        (WebInspector.DOMBreakpointItem.prototype.compareTo):
     30        * inspector/front-end/DOMAgent.js:
     31        (WebInspector.DOMBreakpointManager):
     32        (WebInspector.DOMBreakpointManager.prototype.setBreakpoint):
     33        (WebInspector.DOMBreakpointManager.prototype.removeBreakpointsForNode):
     34        (WebInspector.DOMBreakpointManager.prototype._breakpointRemoved):
     35        (WebInspector.DOMBreakpoint):
     36        (WebInspector.DOMBreakpoint.prototype.get enabled):
     37        (WebInspector.DOMBreakpoint.prototype.set enabled):
     38        (WebInspector.DOMBreakpoint.prototype.remove):
     39        * inspector/front-end/ElementsPanel.js:
     40        (WebInspector.ElementsPanel):
     41        (WebInspector.ElementsPanel.prototype.reset):
     42        * inspector/front-end/ElementsTreeOutline.js:
     43        (WebInspector.ElementsTreeElement.prototype._populateTagContextMenu):
     44        * inspector/front-end/ScriptView.js:
     45        (WebInspector.ScriptView):
     46        * inspector/front-end/ScriptsPanel.js:
     47        (WebInspector.ScriptsPanel):
     48        (WebInspector.ScriptsPanel.prototype._breakpointAdded):
     49        (WebInspector.ScriptsPanel.prototype.reset):
     50        * inspector/front-end/SourceFrame.js:
     51        (WebInspector.SourceFrame):
     52        (WebInspector.SourceFrame.prototype.set visible):
     53        (WebInspector.SourceFrame.prototype.addBreakpoint):
     54        (WebInspector.SourceFrame.prototype._breakpointRemoved):
     55        (WebInspector.SourceFrame.prototype._addBreakpointToSource):
     56        (WebInspector.SourceFrame.prototype._removeBreakpointFromSource):
     57        (WebInspector.SourceFrame.prototype._contextMenu.addConditionalBreakpoint):
     58        (WebInspector.SourceFrame.prototype._contextMenu):
     59        (WebInspector.SourceFrame.prototype._mouseDown):
     60        * inspector/front-end/SourceView.js:
     61        (WebInspector.SourceView):
     62        (WebInspector.SourceView.prototype.updateLocalContent):
     63        * inspector/front-end/inspector.js:
     64        (WebInspector.createJSBreakpointsSidebarPane.breakpointAdded):
     65        (WebInspector.createJSBreakpointsSidebarPane):
     66        (WebInspector.createDOMBreakpointsSidebarPane.breakpointAdded):
     67        (WebInspector.createDOMBreakpointsSidebarPane):
     68        (WebInspector.doLoadedDone):
     69
    1702010-08-24  Stephen White  <senorblanco@chromium.org>
    271
  • trunk/WebCore/inspector/front-end/BreakpointManager.js

    r65810 r65939  
    6363    },
    6464
    65     removeBreakpoint: function(breakpoint)
    66     {
    67         if (this._removeBreakpoint(breakpoint))
    68             InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line);
    69     },
    70 
    7165    breakpointsForSourceID: function(sourceID)
    7266    {
     
    10397            delete this._oneTimeBreakpoint;
    10498        this._breakpoints[breakpoint.id] = breakpoint;
     99        breakpoint.addEventListener("removed", this._breakpointRemoved, this);
    105100        this.dispatchEventToListeners("breakpoint-added", breakpoint);
    106101        return breakpoint;
    107102    },
    108103
    109     _removeBreakpoint: function(breakpoint)
    110     {
    111         if (!(breakpoint.id in this._breakpoints))
    112             return false;
    113         breakpoint.dispatchEventToListeners("removed");
    114         breakpoint.removeAllListeners();
    115         delete breakpoint._breakpointManager;
    116         delete this._breakpoints[breakpoint.id];
    117         return true;
     104    _breakpointRemoved: function(event)
     105    {
     106        delete this._breakpoints[event.target.id];
    118107    },
    119108
     
    130119                    delete this._oneTimeBreakpoint;
    131120            } else {
    132                 this._removeBreakpoint(breakpoint);
     121                breakpoint.remove();
    133122                if (success)
    134123                    this._setBreakpoint(breakpoint.sourceID, breakpoint.url, line, breakpoint.enabled, breakpoint.condition);
     
    166155        this._enabled = x;
    167156        this._breakpointManager._setBreakpointOnBackend(this);
    168         if (this._enabled)
    169             this.dispatchEventToListeners("enabled");
    170         else
    171             this.dispatchEventToListeners("disabled");
     157        this.dispatchEventToListeners("enable-changed");
    172158    },
    173159
     
    203189            this._breakpointManager._setBreakpointOnBackend(this);
    204190        this.dispatchEventToListeners("condition-changed");
     191    },
     192
     193    remove: function()
     194    {
     195        InspectorBackend.removeBreakpoint(this.sourceID, this.line);
     196        this.dispatchEventToListeners("removed");
     197        this.removeAllListeners();
     198        delete this._breakpointManager;
    205199    }
    206200}
  • trunk/WebCore/inspector/front-end/BreakpointsSidebarPane.js

    r65810 r65939  
    2424 */
    2525
    26 WebInspector.BreakpointsSidebarPane = function()
    27 {
    28     WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints"));
     26WebInspector.BreakpointsSidebarPane = function(title)
     27{
     28    WebInspector.SidebarPane.call(this, title);
    2929
    3030    this.listElement = document.createElement("ol");
     
    4848    },
    4949
    50     addBreakpoint: function(breakpoint)
    51     {
    52         breakpoint.addEventListener("removed", this._breakpointRemoved, this);
    53 
    54         var breakpointElement = breakpoint.element();
    55         breakpointElement._breakpointObject = breakpoint;
     50    addBreakpoint: function(breakpointItem)
     51    {
     52        breakpointItem.addEventListener("removed", this._breakpointRemoved, this);
     53
     54        var element = breakpointItem.element();
     55        element._breakpointItem = breakpointItem;
    5656
    5757        var currentElement = this.listElement.firstChild;
    5858        while (currentElement) {
    59              if (currentElement._breakpointObject.compareTo(breakpointElement._breakpointObject) > 0) {
    60                 this.listElement.insertBefore(breakpointElement, currentElement);
     59             if (currentElement._breakpointItem.compareTo(element._breakpointItem) > 0) {
     60                this.listElement.insertBefore(element, currentElement);
    6161                break;
    6262            }
     
    6464        }
    6565        if (!currentElement)
    66             this.listElement.appendChild(breakpointElement);
     66            this.listElement.appendChild(element);
     67
     68        element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this, breakpointItem), true);
    6769
    6870        if (this.emptyElement.parentElement) {
     
    7981            this.bodyElement.appendChild(this.emptyElement);
    8082        }
     83    },
     84
     85    _contextMenuEventFired: function(breakpointItem, event)
     86    {
     87        var contextMenu = new WebInspector.ContextMenu();
     88        contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), breakpointItem.remove.bind(breakpointItem));
     89        contextMenu.show(event);
    8190    }
    8291}
     
    8493WebInspector.BreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
    8594
    86 WebInspector.JSBreakpointItem = function(breakpoint)
     95WebInspector.BreakpointItem = function(breakpoint)
    8796{
    8897    this._breakpoint = breakpoint;
    8998
    9099    this._element = document.createElement("li");
    91     this._element.addEventListener("click", this._breakpointClicked.bind(this), false);
    92100
    93101    var checkboxElement = document.createElement("input");
     
    98106    this._element.appendChild(checkboxElement);
    99107
     108    this._breakpoint.addEventListener("enable-changed", this._enableChanged, this);
     109    this._breakpoint.addEventListener("removed", this._removed, this);
     110}
     111
     112WebInspector.BreakpointItem.prototype = {
     113    element: function()
     114    {
     115        return this._element;
     116    },
     117
     118    remove: function()
     119    {
     120        this._breakpoint.remove();
     121    },
     122
     123    _checkboxClicked: function(event)
     124    {
     125        this._breakpoint.enabled = !this._breakpoint.enabled;
     126
     127        // without this, we'd switch to the source of the clicked breakpoint
     128        event.stopPropagation();
     129    },
     130
     131    _enableChanged: function()
     132    {
     133        var checkbox = this._element.firstChild;
     134        checkbox.checked = this._breakpoint.enabled;
     135    },
     136
     137    _removed: function()
     138    {
     139        this.dispatchEventToListeners("removed");
     140    }
     141}
     142
     143WebInspector.BreakpointItem.prototype.__proto__ = WebInspector.Object.prototype;
     144
     145WebInspector.JSBreakpointItem = function(breakpoint)
     146{
     147    WebInspector.BreakpointItem.call(this, breakpoint);
     148
     149    this._element.addEventListener("click", this._breakpointClicked.bind(this), false);
     150
    100151    var displayName = this._breakpoint.url ? WebInspector.displayNameForURL(this._breakpoint.url) : WebInspector.UIString("(program)");
    101152    var labelElement = document.createTextNode(displayName + ":" + this._breakpoint.line);
     
    107158    this._element.appendChild(sourceTextElement);
    108159
    109     this._breakpoint.addEventListener("enabled", this._enableChanged, this);
    110     this._breakpoint.addEventListener("disabled", this._enableChanged, this);
    111160    this._breakpoint.addEventListener("text-changed", this._textChanged, this);
    112     this._breakpoint.addEventListener("removed", this._removed, this);
    113161}
    114162
     
    123171    },
    124172
    125     element: function()
    126     {
    127         return this._element;
    128     },
    129 
    130173    _breakpointClicked: function()
    131174    {
    132175        WebInspector.panels.scripts.showSourceLine(this._breakpoint.url, this._breakpoint.line);
    133     },
    134 
    135     _checkboxClicked: function(event)
    136     {
    137         this._breakpoint.enabled = !this._breakpoint.enabled;
    138 
    139         // without this, we'd switch to the source of the clicked breakpoint
    140         event.stopPropagation();
    141     },
    142 
    143     _enableChanged: function()
    144     {
    145         var checkbox = this._element.firstChild;
    146         checkbox.checked = this._breakpoint.enabled;
    147176    },
    148177
     
    151180        var sourceTextElement = this._element.firstChild.nextSibling.nextSibling;
    152181        sourceTextElement.textContent = this._breakpoint.sourceText;
    153     },
    154 
    155     _removed: function()
    156     {
    157         this.dispatchEventToListeners("removed");
    158     }
    159 }
    160 
    161 WebInspector.JSBreakpointItem.prototype.__proto__ = WebInspector.Object.prototype;
     182    }
     183}
     184
     185WebInspector.JSBreakpointItem.prototype.__proto__ = WebInspector.BreakpointItem.prototype;
     186
     187WebInspector.DOMBreakpointItem = function(breakpoint)
     188{
     189    WebInspector.BreakpointItem.call(this, breakpoint);
     190
     191    var link = WebInspector.panels.elements.linkifyNodeReference(this._breakpoint.node);
     192    this._element.appendChild(link);
     193
     194    var type = WebInspector.DOMBreakpoint.Labels[this._breakpoint.type];
     195    var typeElement = document.createTextNode(" - " + type);
     196    this._element.appendChild(typeElement);
     197}
     198
     199WebInspector.DOMBreakpointItem.prototype = {
     200    compareTo: function(other)
     201    {
     202        if (this._breakpoint.type != other._breakpoint.type)
     203            return this._breakpoint.type < other._breakpoint.type ? -1 : 1;
     204        return 0;
     205    }
     206}
     207
     208WebInspector.DOMBreakpointItem.prototype.__proto__ = WebInspector.BreakpointItem.prototype;
  • trunk/WebCore/inspector/front-end/DOMAgent.js

    r65248 r65939  
    678678}
    679679
     680WebInspector.DOMBreakpointManager = function()
     681{
     682    this._breakpoints = {};
     683}
     684
     685WebInspector.DOMBreakpointManager.prototype = {
     686    setBreakpoint: function(node, type)
     687    {
     688        if (!(node.id in this._breakpoints))
     689            this._breakpoints[node.id] = {};
     690        else if (type in this._breakpoints[node.id])
     691            return;
     692
     693        var breakpoint = new WebInspector.DOMBreakpoint(node, type);
     694        this._breakpoints[node.id][type] = breakpoint;
     695        breakpoint.addEventListener("removed", this._breakpointRemoved, this);
     696
     697        this.dispatchEventToListeners("dom-breakpoint-added", breakpoint);
     698    },
     699
     700    removeBreakpointsForNode: function(node)
     701    {
     702        var nodeBreakpoints = this._breakpoints[node.id];
     703        for (var type in nodeBreakpoints)
     704            nodeBreakpoints[type].remove();
     705    },
     706
     707    _breakpointRemoved: function(event)
     708    {
     709        var breakpoint = event.target;
     710
     711        var nodeBreakpoints = this._breakpoints[breakpoint.node.id];
     712        delete nodeBreakpoints[breakpoint.type];
     713        for (var type in nodeBreakpoints)
     714            return;
     715        delete this._breakpoints[breakpoint.node.id];
     716    }
     717}
     718
     719WebInspector.DOMBreakpointManager.prototype.__proto__ = WebInspector.Object.prototype;
     720
     721WebInspector.DOMBreakpoint = function(node, type)
     722{
     723    this.node = node;
     724    this.type = type;
     725    this._enabled = true;
     726
     727    InspectorBackend.setDOMBreakpoint(this.node.id, this.type);
     728}
     729
     730WebInspector.DOMBreakpoint.Types = {
     731    SubtreeModified: 0
     732};
     733
     734WebInspector.DOMBreakpoint.Labels = {};
     735WebInspector.DOMBreakpoint.Labels[WebInspector.DOMBreakpoint.Types.SubtreeModified] = WebInspector.UIString("Subtree Modified");
     736
     737WebInspector.DOMBreakpoint.prototype = {
     738    get enabled()
     739    {
     740        return this._enabled;
     741    },
     742
     743    set enabled(enabled)
     744    {
     745        if (this._enabled === enabled)
     746            return;
     747
     748        this._enabled = enabled;
     749        if (this._enabled)
     750            InspectorBackend.setDOMBreakpoint(this.node.id, this.type);
     751        else
     752            InspectorBackend.removeDOMBreakpoint(this.node.id, this.type);
     753
     754        this.dispatchEventToListeners("enable-changed");
     755    },
     756
     757    remove: function()
     758    {
     759        if (this._enabled)
     760            InspectorBackend.removeDOMBreakpoint(this.node.id, this.type);
     761        this.dispatchEventToListeners("removed");
     762    }
     763}
     764
     765WebInspector.DOMBreakpoint.prototype.__proto__ = WebInspector.Object.prototype;
     766
  • trunk/WebCore/inspector/front-end/ElementsPanel.js

    r65248 r65939  
    7575    this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
    7676    this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane();
     77    if (Preferences.domBreakpointsEnabled)
     78        this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane();
    7779    this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPane();
    7880
     
    9193    this.sidebarElement.id = "elements-sidebar";
    9294
    93     this.sidebarElement.appendChild(this.sidebarPanes.computedStyle.element);
    94     this.sidebarElement.appendChild(this.sidebarPanes.styles.element);
    95     this.sidebarElement.appendChild(this.sidebarPanes.metrics.element);
    96     this.sidebarElement.appendChild(this.sidebarPanes.properties.element);
    97     this.sidebarElement.appendChild(this.sidebarPanes.eventListeners.element);
     95    for (var pane in this.sidebarPanes)
     96        this.sidebarElement.appendChild(this.sidebarPanes[pane].element);
    9897
    9998    this.sidebarResizeElement = document.createElement("div");
     
    180179
    181180        delete this.currentQuery;
     181
     182        if (Preferences.domBreakpointsEnabled)
     183            this.sidebarPanes.domBreakpoints.reset();
    182184    },
    183185
  • trunk/WebCore/inspector/front-end/ElementsTreeOutline.js

    r65731 r65939  
    327327].keySet();
    328328
    329 WebInspector.ElementsTreeElement.DOMBreakpointTypeSubtreeModified = 0;
    330 
    331329WebInspector.ElementsTreeElement.prototype = {
    332330    highlightSearchResults: function(searchQuery)
     
    768766            // Add debbuging-related actions
    769767            contextMenu.appendSeparator();
     768
    770769            contextMenu.appendItem(WebInspector.UIString("Stop on subtree modifications"),
    771                 InspectorBackend.setDOMBreakpoint.bind(InspectorBackend, this.representedObject.id, WebInspector.ElementsTreeElement.DOMBreakpointTypeSubtreeModified));
     770                WebInspector.domBreakpointManager.setBreakpoint.bind(WebInspector.domBreakpointManager, this.representedObject, WebInspector.DOMBreakpoint.Types.SubtreeModified));
     771
    772772            contextMenu.appendItem(WebInspector.UIString("Remove Breakpoints"),
    773                 InspectorBackend.removeDOMBreakpoint.bind(InspectorBackend, this.representedObject.id, WebInspector.ElementsTreeElement.DOMBreakpointTypeSubtreeModified));
     773                WebInspector.domBreakpointManager.removeBreakpointsForNode.bind(WebInspector.domBreakpointManager, this.representedObject));
    774774        }
    775775    },
  • trunk/WebCore/inspector/front-end/ScriptView.js

    r65052 r65939  
    3535    this._sourceFrameSetup = false;
    3636    var canEditScripts = WebInspector.panels.scripts.canEditScripts();
    37     this.sourceFrame = new WebInspector.SourceFrame(this.element, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this));
     37    this.sourceFrame = new WebInspector.SourceFrame(this.element, this._addBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this));
    3838}
    3939
     
    130130    showingLastSearchResult: WebInspector.SourceView.prototype.showingLastSearchResult,
    131131    _jumpToSearchResult: WebInspector.SourceView.prototype._jumpToSearchResult,
    132     _removeBreakpoint: WebInspector.SourceView.prototype._removeBreakpoint,
    133132    _editLine: WebInspector.SourceView.prototype._editLine,
    134133    resize: WebInspector.SourceView.prototype.resize
  • trunk/WebCore/inspector/front-end/ScriptsPanel.js

    r65810 r65939  
    133133    this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane();
    134134    this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane();
    135     this.sidebarPanes.breakpoints = new WebInspector.BreakpointsSidebarPane();
     135    this.sidebarPanes.jsBreakpoints = WebInspector.createJSBreakpointsSidebarPane();
     136    if (Preferences.domBreakpointsEnabled)
     137        this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane();
    136138    this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane();
    137139
     
    143145
    144146    this.sidebarPanes.scopechain.expanded = true;
    145     this.sidebarPanes.breakpoints.expanded = true;
     147    this.sidebarPanes.jsBreakpoints.expanded = true;
     148    if (Preferences.domBreakpointsEnabled)
     149        this.sidebarPanes.domBreakpoints.expanded = true;
    146150
    147151    var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
     
    296300        var breakpoint = event.data;
    297301
    298         breakpoint.addEventListener("removed", this._breakpointRemoved, this);
    299         this.sidebarPanes.breakpoints.addBreakpoint(new WebInspector.JSBreakpointItem(event.data));
    300 
    301302        var sourceFrame;
    302303        if (breakpoint.url) {
     
    315316    },
    316317
    317     _breakpointRemoved: function(event)
    318     {
    319         var breakpoint = event.target;
    320 
    321         var sourceFrame;
    322         if (breakpoint.url) {
    323             var resource = WebInspector.resourceURLMap[breakpoint.url];
    324             if (resource && resource.finished)
    325                 sourceFrame = this._sourceFrameForScriptOrResource(resource);
    326         }
    327 
    328         if (breakpoint.sourceID && !sourceFrame) {
    329             var object = this._sourceIDMap[breakpoint.sourceID]
    330             sourceFrame = this._sourceFrameForScriptOrResource(object);
    331         }
    332 
    333         if (sourceFrame)
    334             sourceFrame.removeBreakpoint(breakpoint);
    335     },
    336 
    337318    canEditScripts: function()
    338319    {
     
    348329        var breakpoints = WebInspector.breakpointManager.breakpointsForSourceID(sourceID);
    349330        for (var i = 0; i < breakpoints.length; ++i)
    350             WebInspector.breakpointManager.removeBreakpoint(breakpoints[i]);
     331            breakpoints[i].remove();
    351332
    352333        function mycallback(success, newBodyOrErrorMessage, callFrames)
     
    497478        this.sidebarPanes.watchExpressions.refreshExpressions();
    498479        if (!preserveItems) {
    499             this.sidebarPanes.breakpoints.reset();
     480            this.sidebarPanes.jsBreakpoints.reset();
     481            if (Preferences.domBreakpointsEnabled)
     482                this.sidebarPanes.domBreakpoints.reset();
    500483            this.sidebarPanes.workers.reset();
    501484        }
  • trunk/WebCore/inspector/front-end/SourceFrame.js

    r65810 r65939  
    2929 */
    3030
    31 WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate, removeBreakpointDelegate, editDelegate, continueToHereDelegate)
     31WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate, editDelegate, continueToHereDelegate)
    3232{
    3333    this._parentElement = parentElement;
     
    4545    this._continueToHereDelegate = continueToHereDelegate;
    4646    this._addBreakpointDelegate = addBreakpointDelegate;
    47     this._removeBreakpointDelegate = removeBreakpointDelegate;
    4847    this._editDelegate = editDelegate;
    4948    this._popoverObjectGroup = "popover";
     
    5655        this._visible = visible;
    5756        this._createViewerIfNeeded();
    58        
     57
    5958        if (visible) {
    6059            if (this._textViewer && this._scrollTop)
     
    10099    {
    101100        this.breakpoints.push(breakpoint);
     101        breakpoint.addEventListener("removed", this._breakpointRemoved, this);
    102102        if (this._textViewer)
    103103            this._addBreakpointToSource(breakpoint);
    104104    },
    105105
    106     removeBreakpoint: function(breakpoint)
    107     {
     106    _breakpointRemoved: function(event)
     107    {
     108        var breakpoint = event.target;
     109
    108110        this.breakpoints.remove(breakpoint);
    109         breakpoint.removeEventListener("enabled", null, this);
    110         breakpoint.removeEventListener("disabled", null, this);
    111         breakpoint.removeEventListener("condition-changed", null, this);
    112111        if (this._textViewer)
    113112            this._removeBreakpointFromSource(breakpoint);
     
    382381    _addBreakpointToSource: function(breakpoint)
    383382    {
    384         breakpoint.addEventListener("enabled", this._breakpointChanged, this);
    385         breakpoint.addEventListener("disabled", this._breakpointChanged, this);
     383        breakpoint.addEventListener("enable-changed", this._breakpointChanged, this);
    386384        breakpoint.addEventListener("condition-changed", this._breakpointChanged, this);
    387385
     
    404402    _removeBreakpointFromSource: function(breakpoint)
    405403    {
     404        breakpoint.removeEventListener("enable-changed", null, this);
     405        breakpoint.removeEventListener("condition-changed", null, this);
     406
    406407        var lineNumber = breakpoint.line - 1;
    407408        this._textViewer.beginUpdates();
     
    433434            contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._addBreakpointDelegate.bind(this, lineNumber + 1));
    434435
    435             function addConditionalBreakpoint() 
     436            function addConditionalBreakpoint()
    436437            {
    437438                this._addBreakpointDelegate(lineNumber + 1);
     
    444445        } else {
    445446            // This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable.
    446             contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._removeBreakpointDelegate.bind(this, breakpoint));
     447            contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), breakpoint.remove.bind(breakpoint));
    447448            contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), this._editBreakpointCondition.bind(this, breakpoint));
    448449            if (breakpoint.enabled)
     
    477478                breakpoint.enabled = !breakpoint.enabled;
    478479            else
    479                 this._removeBreakpointDelegate(breakpoint);
     480                breakpoint.remove();
    480481        } else
    481482            this._addBreakpointDelegate(lineNumber + 1);
  • trunk/WebCore/inspector/front-end/SourceView.js

    r64133 r65939  
    3434
    3535    var canEditScripts = WebInspector.panels.scripts && WebInspector.panels.scripts.canEditScripts() && resource.type === WebInspector.Resource.Type.Script;
    36     this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this));
     36    this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this));
    3737    resource.addEventListener("finished", this._resourceLoadingFinished, this);
    3838    this._frameNeedsSetup = true;
     
    131131        if (!WebInspector.panels.scripts.breakpointsActivated)
    132132            WebInspector.panels.scripts.toggleBreakpointsClicked();
    133     },
    134 
    135     _removeBreakpoint: function(breakpoint)
    136     {
    137         WebInspector.breakpointManager.removeBreakpoint(breakpoint);
    138133    },
    139134
     
    214209            this.localContentElement.className = "resource-view-content";
    215210            this.tabbedPane.appendTab("local", WebInspector.UIString("Local"), this.localContentElement, this.selectLocalContentTab.bind(this));
    216             this.localSourceFrame = new WebInspector.SourceFrame(this.localContentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this), null, this._continueToLine.bind(this));
     211            this.localSourceFrame = new WebInspector.SourceFrame(this.localContentElement, this._addBreakpoint.bind(this), null, this._continueToLine.bind(this));
    217212        }
    218213        this.localSourceFrame.setContent(mimeType, content, "");
  • trunk/WebCore/inspector/front-end/inspector.js

    r65905 r65939  
    198198    },
    199199
     200    createJSBreakpointsSidebarPane: function()
     201    {
     202        var pane = new WebInspector.BreakpointsSidebarPane(WebInspector.UIString("Breakpoints"));
     203        function breakpointAdded(event)
     204        {
     205            pane.addBreakpoint(new WebInspector.JSBreakpointItem(event.data));
     206        }
     207        WebInspector.breakpointManager.addEventListener("breakpoint-added", breakpointAdded);
     208        return pane;
     209    },
     210
     211    createDOMBreakpointsSidebarPane: function()
     212    {
     213        var pane = new WebInspector.BreakpointsSidebarPane(WebInspector.UIString("DOM Breakpoints"));
     214        function breakpointAdded(event)
     215        {
     216            pane.addBreakpoint(new WebInspector.DOMBreakpointItem(event.data));
     217        }
     218        WebInspector.domBreakpointManager.addEventListener("dom-breakpoint-added", breakpointAdded);
     219        return pane;
     220    },
     221
    200222    _createPanels: function()
    201223    {
     
    497519
    498520    this.breakpointManager = new WebInspector.BreakpointManager();
     521    this.domBreakpointManager = new WebInspector.DOMBreakpointManager();
    499522    this.cssModel = new WebInspector.CSSStyleModel();
    500523
Note: See TracChangeset for help on using the changeset viewer.