Right-click 'Refresh' on database now updates object store view, also fixed IndexedDB view crash.
The crash was being caused by a null pointer exception in the view constructor since _database in Resources.IDBDatabaseTreeElement was not loaded/stored before the view was constructed. Adding a null check before constructing the view stops the exception.
BUG=727908, 728450
Review-Url: https://codereview.chromium.org/2914293002
Cr-Commit-Position: refs/heads/master@{#478073}
Committed: https://chromium.googlesource.com/chromium/src/+/525c53f0d081a4533b6c55d9b2b991ecfc9d2bec
Description was changed from ========== [IndexedDB] [DevTools] Right-click 'Refresh' on database now updates object store ...
3 years, 6 months ago
(2017-06-01 21:29:15 UTC)
#1
Description was changed from
==========
[IndexedDB] [DevTools] Right-click 'Refresh' on database now updates object
store view, also fixed IndexedDB view crash
BUG=727908, 728450
==========
to
==========
Right-click 'Refresh' on database now updates object store view, also fixed
IndexedDB view crash.
The crash was being caused by a null pointer exception in the view constructor
since _database in Resources.IDBDatabaseTreeElement was not loaded/stored before
the view was constructed. Adding a null check before constructing the view stops
the exception.
BUG=727908, 728450
==========
Moved null handling into IDBDatabaseView, otherwise user would be presented with a blank view until ...
3 years, 6 months ago
(2017-06-02 00:16:56 UTC)
#5
Moved null handling into IDBDatabaseView, otherwise user would be presented with
a blank view until they navigate away.
https://codereview.chromium.org/2914293002/diff/1/third_party/WebKit/LayoutTe...
File
third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html
(right):
https://codereview.chromium.org/2914293002/diff/1/third_party/WebKit/LayoutTe...
third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html:186:
await InspectorTest.evaluateInPageAsync("addIDBValue('" + databaseName + "', '"
+ objectStoreName2 + "', 'testKey2', 'testValue2')");
On 2017/06/01 22:50:31, dmurph wrote:
> Can you use this:
>
https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/http/test...
>
> or create a different utility wrapper that uses promises?
Since those function uses callbacks, I made the above promise based utility
functions instead (using InspectorTest.evaluateInPageAsync). Moved those
functions to indexeddb-test.js.
https://codereview.chromium.org/2914293002/diff/1/third_party/WebKit/LayoutTe...
third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html:195:
objectStoreTreeElement.onselect(false);
On 2017/06/01 22:50:31, dmurph wrote:
> Can you comment what this does? This selects the tree element, and opens that
> view?
Ah, you're right, it doesn't do anything. Removed!
dmurph
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html File third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html (right): https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html#newcode26 third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html:26: function waitRefreshDatabaseRightClick(callback) { You use a lot of these ...
3 years, 6 months ago
(2017-06-02 19:22:06 UTC)
#6
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Layo...
File
third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html
(right):
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html:26:
function waitRefreshDatabaseRightClick(callback) {
You use a lot of these callback in promises. Can you just have them return
promises? (unless you specifically need the callback version).
Also, please use variables instead of declaring as function. So:
var waitRefreshDatabaseRightClick = function() {
return new Promise((resolve, reject) => {
InspectorTest.addSniffer(Resources.IDBDataView.prototype,
"_updatedDataForTests", resolve, false);
idbDatabaseTreeElement._refreshIndexedDB();
});
}
You don't technically need the reject callback there for this example.
Then, instead of always creating a new promise to wrap this callback, you can
just say:
await waitRefreshDatabaseRightClick();
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Layo...
File
third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js
(right):
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js:318:
var promise = new Promise((fulfill) => callback = fulfill);
Can you make this in the form:
return new Promise((resolve, reject) => {
var request = indexedDB.open(databaseName);
....
});
The constructor will execute right away, and the resolve, reject callbacks will
trigger resolution of the promise. If you don't want to use the reject callback
and instead use the onIndexedDBError, that's fine.
Example from a web platform test:
https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/external/...
dgozman
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js File third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js (right): https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js#newcode318 third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/indexeddb-test.js:318: var promise = new Promise((fulfill) => callback = fulfill); ...
3 years, 6 months ago
(2017-06-02 21:48:42 UTC)
#7
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html File third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html (right): https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html#newcode26 third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html:26: function waitRefreshDatabaseRightClick(callback) { On 2017/06/02 19:22:05, dmurph wrote: > ...
3 years, 6 months ago
(2017-06-03 01:42:44 UTC)
#8
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Layo...
File
third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html
(right):
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/http/tests/inspector/indexeddb/database-refresh-view.html:26:
function waitRefreshDatabaseRightClick(callback) {
On 2017/06/02 19:22:05, dmurph wrote:
> You use a lot of these callback in promises. Can you just have them return
> promises? (unless you specifically need the callback version).
>
> Also, please use variables instead of declaring as function. So:
>
>
> var waitRefreshDatabaseRightClick = function() {
> return new Promise((resolve, reject) => {
> InspectorTest.addSniffer(Resources.IDBDataView.prototype,
> "_updatedDataForTests", resolve, false);
> idbDatabaseTreeElement._refreshIndexedDB();
> });
> }
>
> You don't technically need the reject callback there for this example.
>
> Then, instead of always creating a new promise to wrap this callback, you can
> just say:
>
> await waitRefreshDatabaseRightClick();
Good point! Changed all but the event listeners to promises (need to keep the
callback to remove the listeners after resolving)
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Sour...
File
third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js
(right):
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js:1089:
indexedDBModel.refreshDatabaseNames(); // Adds IDBDatabaseTreeElements.
On 2017/06/02 21:48:41, dgozman wrote:
> I think we should not rely on this face. After all, we are calling into model,
> which does not guarantee to add any elements.
Unfortunately unless refreshDatabaseNames is called, the event listener
IndexedDBModel.Events.DatabaseAdded won't be triggered. That seems to be the
only way in the model to see if databases were added or not.
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js
(right):
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js:44: var
databaseName = 'Loading...'; // If database was not loaded yet when view was
created
On 2017/06/02 21:48:41, dgozman wrote:
> We wrap any user-readable strings with Common.UIString call:
> Common.UIString('Loading\u2026')
Done.
https://codereview.chromium.org/2914293002/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/devtools/front_end/resources/IndexedDBViews.js:81: if
(database) {
On 2017/06/02 21:48:41, dgozman wrote:
> The database is marked as non-null in line 78. How come it could be null?
The constructor calls update with a null database (line 65), so I added the null
check here. Went ahead and moved it to the constructor.
dmurph
non-owners lgtm :)
3 years, 6 months ago
(2017-06-05 21:47:39 UTC)
#9
non-owners lgtm :)
dgozman
https://codereview.chromium.org/2914293002/diff/40001/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js File third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js (right): https://codereview.chromium.org/2914293002/diff/40001/third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js#newcode1091 third_party/WebKit/Source/devtools/front_end/resources/ApplicationPanelSidebar.js:1091: this._idbDatabaseTreeElements[i]._refreshIndexedDB(); Instead of calling this directly, tree elements should ...
3 years, 6 months ago
(2017-06-06 21:32:26 UTC)
#10
CQ is committing da patch. Bot data: {"patchset_id": 160001, "attempt_start_ts": 1496945979888810, "parent_rev": "6e088010a03470db917e004be9e64cc04c69e9a0", "commit_rev": "525c53f0d081a4533b6c55d9b2b991ecfc9d2bec"}
3 years, 6 months ago
(2017-06-08 20:37:10 UTC)
#22
CQ is committing da patch.
Bot data: {"patchset_id": 160001, "attempt_start_ts": 1496945979888810,
"parent_rev": "6e088010a03470db917e004be9e64cc04c69e9a0", "commit_rev":
"525c53f0d081a4533b6c55d9b2b991ecfc9d2bec"}
commit-bot: I haz the power
Description was changed from ========== Right-click 'Refresh' on database now updates object store view, also ...
3 years, 6 months ago
(2017-06-08 20:37:24 UTC)
#23
Message was sent while issue was closed.
Description was changed from
==========
Right-click 'Refresh' on database now updates object store view, also fixed
IndexedDB view crash.
The crash was being caused by a null pointer exception in the view constructor
since _database in Resources.IDBDatabaseTreeElement was not loaded/stored before
the view was constructed. Adding a null check before constructing the view stops
the exception.
BUG=727908, 728450
==========
to
==========
Right-click 'Refresh' on database now updates object store view, also fixed
IndexedDB view crash.
The crash was being caused by a null pointer exception in the view constructor
since _database in Resources.IDBDatabaseTreeElement was not loaded/stored before
the view was constructed. Adding a null check before constructing the view stops
the exception.
BUG=727908, 728450
Review-Url: https://codereview.chromium.org/2914293002
Cr-Commit-Position: refs/heads/master@{#478073}
Committed:
https://chromium.googlesource.com/chromium/src/+/525c53f0d081a4533b6c55d9b2b9...
==========
commit-bot: I haz the power
Committed patchset #6 (id:160001) as https://chromium.googlesource.com/chromium/src/+/525c53f0d081a4533b6c55d9b2b991ecfc9d2bec
3 years, 6 months ago
(2017-06-08 20:37:25 UTC)
#24
Issue 2914293002: [IndexedDB] [DevTools] Right-click 'Refresh' on database now updates object store view, also fixed …
(Closed)
Created 3 years, 6 months ago by kristipark
Modified 3 years, 6 months ago
Reviewers: dmurph, dgozman
Base URL:
Comments: 24