Closed Bug 1060947 Opened 10 years ago Closed 8 years ago

Listing indexedDB databases throws if any of them have 0 objectStores

Categories

(DevTools :: Storage Inspector, defect)

x86
macOS
defect
Not set
normal

Tracking

(firefox48 fixed)

RESOLVED FIXED
Firefox 48
Tracking Status
firefox48 --- fixed

People

(Reporter: canuckistani, Assigned: jsnajdr)

Details

Attachments

(1 file, 2 obsolete files)

I saw the following error, I assume this should be caught if it is the expected behaviour when there isn't any indexedDB data:

EMITTING: emit(select, localStorage, undefined) from TreeWidget.prototype.onClick() -> resource:///modules/devtools/shared/widgets/TreeWidget.js:328
EMITTING: emit(select, indexedDB,https://developer.mozilla.org, undefined) from TreeWidget.prototype.onClick() -> resource:///modules/devtools/shared/widgets/TreeWidget.js:328
DBG-SERVER: Packet 54 sent to "conn2.indexedDB119"
DBG-SERVER: Received packet 54: {
  "type": "getStoreObjects",
  "host": "https://developer.mozilla.org",
  "names": null,
  "to": "conn2.indexedDB119"
}
*************************
A coding exception was thrown and uncaught in a Task.

Full message: TypeError: this.str is undefined
Full stack: exports.LongStringActor<.initialize@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/string.js:22:5
constructor@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/core/heritage.js:145:23
.toStoreObject@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:1336:14
StorageActors.defaults/<.getStoreObjects</toReturn.data<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:393:28
StorageActors.defaults/<.getStoreObjects<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:390:27
TaskImpl_run@resource://gre/modules/Task.jsm:314:40
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:865:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:744:7

*************************
console.error:
DBG-SERVER: Packet 20 sent from "conn3.console6"
  Message: TypeError: this.str is undefined
  Stack:
    exports.LongStringActor<.initialize@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/string.js:22:5
constructor@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/core/heritage.js:145:23
.toStoreObject@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:1336:14
StorageActors.defaults/<.getStoreObjects</toReturn.data<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:393:28
StorageActors.defaults/<.getStoreObjects<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:390:27
TaskImpl_run@resource://gre/modules/Task.jsm:314:40
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:865:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:744:7

exports.LongStringActor<.initialize@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/string.js:22:5
constructor@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/core/heritage.js:145:23
.toStoreObject@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:1336:14
StorageActors.defaults/<.getStoreObjects</toReturn.data<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:393:28
StorageActors.defaults/<.getStoreObjects<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:390:27
TaskImpl_run@resource://gre/modules/Task.jsm:314:40
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:865:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:744:7
DBG-SERVER: Packet 55 sent from "conn2.indexedDB119"
DBG-SERVER: Received packet 20: {
  "from": "conn3.console6",
  "type": "consoleAPICall",
  "message": {
    "level": "error",
    "filename": "resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js",
    "lineNumber": 852,
    "functionName": "Actor<.writeError",
    "timeStamp": 1409511618443,
    "arguments": [
      {
        "type": "object",
        "class": "Error",
        "actor": "conn3.obj116",
        "extensible": true,
        "frozen": false,
        "sealed": false,
        "preview": {
          "kind": "Error",
          "name": "TypeError",
          "message": "this.str is undefined",
          "stack": "exports.LongStringActor<.initialize@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/string.js:22:5\nconstructor@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/core/heritage.js:145:23\n.toStoreObject@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:1336:14\nStorageActors.defaults/<.getStoreObjects</toReturn.data<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:393:28\nStorageActors.defaults/<.getStoreObjects<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/storage.js:390:27\nTaskImpl_run@resource://gre/modules/Task.jsm:314:40\nHandler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:865:23\nthis.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:744:7\n",
          "fileName": "resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/string.js",
          "lineNumber": 22,
          "columnNumber": 4
        }
      }
    ],
    "styles": []
  }
}
DBG-SERVER: Received packet 55: {
  "from": "conn2.indexedDB119",
  "error": "unknownError",
  "message": "TypeError: this.str is undefined"
}
console.error:
DBG-SERVER: Packet 21 sent from "conn3.console6"
  Protocol error: TypeError: this.str is undefined
DBG-SERVER: Received packet 21: {
  "from": "conn3.console6",
  "type": "consoleAPICall",
  "message": {
    "level": "error",
    "filename": "resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js",
    "lineNumber": 16,
    "functionName": "promiseDone",
    "timeStamp": 1409511618445,
    "arguments": [
      "Protocol error: TypeError: this.str is undefined"
    ],
    "styles": []
  }
}
EMITTING: emit(messages-added, [object Set]) from WCF__flushMessageQueue() -> resource:///modules/devtools/webconsole/webconsole.js:2153
The main issue is that I have a check like if (item.objectStores) {do stuff for db}

which fails if a db has 0 objectStores.

This plus another issue leads to removal of empty databases from the UI, both tree and table.

Fix coming shortly.
Assignee: nobody → scrapmachines
Status: NEW → ASSIGNED
Summary: Error clicking on indexedDB on MDN → Listing indexedDB databases throws if any of them have 0 objectStores
Attached patch patch v1 (obsolete) — Splinter Review
This fixes the check which I do in the form method for indexed db objects.

It also makes sure that if a db does not have object store, it is still added in the form. (The double for loop change)

Added a test to make sure empty db are listed both in tree and table.

try : https://tbpl.mozilla.org/?tree=Try&rev=4524acd32461
Attachment #8485171 - Flags: review?(mratcliffe)
Attachment #8485171 - Flags: review?(mratcliffe) → review+
Taking this... it looks like we forgot to land it.
Assignee: scrapmachines → mratcliffe
I adapted the existing patch to the current code case (especially the test required some effort), ready for review and landing. Doesn't throw an error if a database doesn't have any objectstore, and shows the db in the tree (wasn't displayed previously).
Attachment #8740395 - Flags: review?(mratcliffe)
Attachment #8485171 - Attachment is obsolete: true
Assignee: mratcliffe → jsnajdr
Fixed the test: forgot to add "yield" before "finishTests()". The test then failed to cleanup its indexedDB databases when finished, making subsequent tests to fail.
Attachment #8740837 - Flags: review?(mratcliffe)
Attachment #8740395 - Attachment is obsolete: true
Attachment #8740395 - Flags: review?(mratcliffe)
Comment on attachment 8740837 [details] [diff] [review]
Listing indexedDB databases throws if any of them have 0 objectStores.

Review of attachment 8740837 [details] [diff] [review]:
-----------------------------------------------------------------

Looks perfect and we all like a 100% green try run!
Attachment #8740837 - Flags: review?(mratcliffe) → review+
Checkin only after patches from bug 1261785 have landed - will cause conflicts otherwise.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/7cfb8c8a1ba4
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.