Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Issue 2191183003: DevTools: extract model from DOMBreakpointsSidebarPane (Closed)

Created:
4 years, 4 months ago by chenwilliam
Modified:
4 years, 4 months ago
Reviewers:
lushnikov
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

DevTools: extract model from DOMBreakpointsSidebarPane - Extracts the domain logic from DOMBreakpointsSidebarPane into DOMBreakpointsModel - Fixes a bug and added a test for toggling “on” a DOM breakpoint checkbox - Fixes a minor bug where a DOM breakpoint on a leaf node (with no text) would not be deleted when the DOM node is deleted. DOM breakpoints should be permanently deleted when the DOM Node is deleted. - Fixes missing DOM breakpoints bug when refreshing on sources panel: https://bugs.chromium.org/p/chromium/issues/detail?id=634513 - Fixes duplicate DOM breakpoints bug when refreshing page: https://bugs.chromium.org/p/chromium/issues/detail?id=634510 BUG=627296

Patch Set 1 #

Patch Set 2 : minor style nits #

Total comments: 16

Patch Set 3 : Major refactoring #

Patch Set 4 : Nit #

Total comments: 26

Patch Set 5 : Refactor to DOMBreakpointManager #

Patch Set 6 : minor nits #

Total comments: 22

Patch Set 7 : Address CL feedback from PS6 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+483 lines, -328 lines) Patch
M third_party/WebKit/LayoutTests/http/tests/inspector/debugger-test.js View 1 2 3 4 5 6 2 chunks +10 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/inspector/sources/debugger-breakpoints/dom-breakpoints.html View 1 2 3 4 5 6 15 chunks +55 lines, -19 lines 0 comments Download
M third_party/WebKit/LayoutTests/inspector/sources/debugger-breakpoints/dom-breakpoints-editing-dom-from-inspector.html View 1 2 3 4 5 6 3 chunks +2 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/inspector/sources/debugger-breakpoints/dom-breakpoints-expected.txt View 1 2 2 chunks +18 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/inspector/sources/debugger-frameworks/frameworks-dom-xhr-event-breakpoints.html View 1 2 3 4 5 6 1 chunk +1 line, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/inspector/sources/debugger-pause/skip-pauses-until-reload.html View 1 2 3 4 5 6 1 chunk +3 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/devtools/devtools.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js View 1 2 3 4 5 6 7 chunks +34 lines, -291 lines 0 comments Download
M third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js View 1 2 3 4 5 6 2 chunks +28 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/devtools/front_end/elements/module.json View 1 2 3 4 5 6 1 chunk +1 line, -1 line 1 comment Download
M third_party/WebKit/Source/devtools/front_end/main/Main.js View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
A third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointManager.js View 1 2 3 4 5 6 1 chunk +285 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/devtools/front_end/sdk/module.json View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/devtools/front_end/sources/CallStackSidebarPane.js View 1 2 3 4 5 6 2 chunks +41 lines, -1 line 0 comments Download
M third_party/WebKit/Source/devtools/front_end/sources/module.json View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 14 (6 generated)
chenwilliam
4 years, 4 months ago (2016-07-30 01:05:44 UTC) #4
lushnikov
https://codereview.chromium.org/2191183003/diff/20001/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js File third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js (right): https://codereview.chromium.org/2191183003/diff/20001/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js#newcode60 third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js:60: }; nit: we don't put semicolons after function declaration ...
4 years, 4 months ago (2016-07-30 01:24:42 UTC) #5
chenwilliam
I've updated the CL description with info on related bugs. https://codereview.chromium.org/2191183003/diff/20001/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js File third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js (right): https://codereview.chromium.org/2191183003/diff/20001/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js#newcode60 ...
4 years, 4 months ago (2016-08-06 00:28:22 UTC) #7
lushnikov
https://codereview.chromium.org/2191183003/diff/60001/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js File third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js (right): https://codereview.chromium.org/2191183003/diff/60001/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js#newcode63 third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js:63: domDebuggerModel: function() there should be no method domDebuggerModel(): DOMBreakpointsSidebarPane ...
4 years, 4 months ago (2016-08-08 19:53:08 UTC) #8
chenwilliam
It's hard to tell from the diffs because of the file renaming, but since your ...
4 years, 4 months ago (2016-08-10 19:48:36 UTC) #9
chenwilliam
Also, I forgot to note that my latest patchsets fix this bug: https://bugs.chromium.org/p/chromium/issues/detail?id=634513 I've noted ...
4 years, 4 months ago (2016-08-10 20:03:35 UTC) #11
lushnikov
https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js File third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js (right): https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js#newcode40 third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js:40: this._breakpointElements = {}; let's use Map and type-annotate it ...
4 years, 4 months ago (2016-08-11 18:40:19 UTC) #12
chenwilliam
4 years, 4 months ago (2016-08-17 01:20:11 UTC) #14
Addresses CL feedback. Also, fixes this bug during page reloads:
https://bugs.chromium.org/p/chromium/issues/detail?id=634510

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
File
third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js
(right):

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js:40:
this._breakpointElements = {};
On 2016/08/11 18:40:18, lushnikov wrote:
> let's use Map and type-annotate it

Done.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js:67:
populateNodeContextMenu: function(node, contextMenu, createSubMenu)
On 2016/08/11 18:40:18, lushnikov wrote:
> let's move this to the elements's panel

Done.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js:231:
return `${nodeId}:${type}`;
On 2016/08/11 18:40:18, lushnikov wrote:
> nit: The former was easier to understand

Done.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/devtools/front_end/main/Main.js (right):

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/main/Main.js:197:
WebInspector.domBreakpointsSidebarPane = new
WebInspector.DOMBreakpointsSidebarPane();
On 2016/08/11 18:40:18, lushnikov wrote:
> the SidebarPane shouldn't be a singleton once there's a singleton model

Done.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
File third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointManager.js
(right):

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointManager.js:51: *
@return {!Map<string, !WebInspector.DOMBreakpointManager.Breakpoint>}
On 2016/08/11 18:40:18, lushnikov wrote:
> why do we return map here and not an array?

I was returning a map since that's how the class was storing it. I've changed it
to return an array, it's slightly more inefficient but hides the Map keys which
should be an implementation detail specific only to this class.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointManager.js:76: var
breakpoint = new WebInspector.DOMBreakpointManager.Breakpoint(node, type,
this._inspectedURL, enabled);
On 2016/08/11 18:40:18, lushnikov wrote:
> instead of using inspectedURL, we probably should use URL of the node's
document

Done.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointManager.js:130:
removeBreakpointsForNode: function(node)
On 2016/08/11 18:40:19, lushnikov wrote:
> why is this part of public API? AFAIU It's not used externally

Done.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointManager.js:148: *
@return {!Object<string, boolean>}
On 2016/08/11 18:40:19, lushnikov wrote:
> return Map<string, boolean>

Done.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointManager.js:167:
this._breakpoints = new Map();
On 2016/08/11 18:40:19, lushnikov wrote:
> this._breakpoints.clear(); to play nice with closure types

Done.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointManager.js:252:
var target = /** @type {!WebInspector.Target} */ (event.data);
On 2016/08/11 18:40:18, lushnikov wrote:
> why listen to this event altogether? it appears it should not be needed

Done.

https://codereview.chromium.org/2191183003/diff/100001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/sdk/DOMBreakpointManager.js:267:
return `${node.id}__${type}`;
On 2016/08/11 18:40:19, lushnikov wrote:
> let's be consistent and separate with colon

Done.

https://codereview.chromium.org/2191183003/diff/120001/third_party/WebKit/Sou...
File third_party/WebKit/Source/devtools/front_end/elements/module.json (right):

https://codereview.chromium.org/2191183003/diff/120001/third_party/WebKit/Sou...
third_party/WebKit/Source/devtools/front_end/elements/module.json:199:
"factoryName": "WebInspector.DOMBreakpointsSidebarPane"
I initially tried className for both elements and sources module.json but I
couldn't debug why one panel would corrupt the UI on the other panel. It's a bit
more inefficient to use factoryName but it works properly.

Powered by Google App Engine
This is Rietveld 408576698