Skip to content

Commit

Permalink
[DevTools] Fix Background Service metadata entry order.
Browse files Browse the repository at this point in the history
According to https://developers.google.com/protocol-buffers/docs/proto#maps
iteration ordering of map values is undefined. This CL sorts the
metadata entries before in the DevTools frontend so
they can be presented in a consistent order.

Also remove redundant test formatting, fix the OWNERS Background Service
regexp to include the handler, and make the row counting start from 1.

Change-Id: I36024f23fbb307b1160cd67120dcf67ca8697aa1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1615251
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Reviewed-by: Alexei Filippov <alph@chromium.org>
Reviewed-by: Richard Knoll <knollr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664458}
  • Loading branch information
rayankans authored and Commit Bot committed May 29, 2019
1 parent 5d9d011 commit 8f2502b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion content/browser/devtools/OWNERS
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
caseq@chromium.org
alph@chromium.org

per-file *background_services*=rayankans@chromium.org
per-file *background_service*=rayankans@chromium.org

# COMPONENT: Platform>DevTools
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Resources.BackgroundServiceView = class extends UI.VBox {
swScope = registration.scopeURL.substr(registration.securityOrigin.length);

return {
id: this._dataGrid.rootNode().children.length,
id: this._dataGrid.rootNode().children.length + 1,
timestamp: UI.formatTimestamp(serviceEvent.timestamp * 1000, /* full= */ true),
origin: serviceEvent.origin,
swScope,
Expand Down Expand Up @@ -339,7 +339,7 @@ Resources.BackgroundServiceView.EventDataNode = class extends DataGrid.DataGridN
super(data);

/** @const {!Array<!Protocol.BackgroundService.EventMetadata>} */
this._eventMetadata = eventMetadata;
this._eventMetadata = eventMetadata.sort((m1, m2) => m1.key.compareTo(m2.key));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ Tests that the grid shows information as expected.
Grid Entries:
[empty]
Grid Entries:
0, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
1, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
Grid Entries:
0, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
1, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
Grid Entries:
0, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
1, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
Grid Entries:
0, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
1, 1556889085000, Event2, http://127.0.0.1:8080/, [blank], Instance1, [blank]
1, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
2, 1556889085000, Event2, http://127.0.0.1:8080/, [blank], Instance1, [blank]
Grid Entries:
0, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
1, 1556889085000, Event1, http://127.0.0.1:8000/, [blank], Instance1, [blank]
Grid Entries:
[empty]

0 comments on commit 8f2502b

Please sign in to comment.