Closed Bug 1019194 Opened 5 years ago Closed 5 years ago

Get rid of nsIIndexedDatabaseManager

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Keywords: dev-doc-complete)

Attachments

(3 files)

It's not needed anymore.
Paul, could you review the devtools changes?  Dave, can you review the addon SDK changes?
Attachment #8433060 - Flags: review?(paul)
Attachment #8433060 - Flags: review?(khuey)
Attachment #8433060 - Flags: review?(dtownsend+bugmail)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8433060 [details] [diff] [review]
Get rid of nsIIndexedDatabaseManager

r+ for app-projects.js and storage.js.

I'm not sure we want to attach the indexedDB property to devtools modules from the addons sdk loader though. Can it be done from toolkit/devtools/Loader.jsm? Mossop will know.
Attachment #8433060 - Flags: review?(paul) → review+
Yeah, I'm not a huge fan of that part either, but I couldn't find any existing APIs for us to pass in the fact that we need indexeddb down to the addon-sdk code that actually creates the sandbox.  :(
Comment on attachment 8433060 [details] [diff] [review]
Get rid of nsIIndexedDatabaseManager

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

::: js/xpconnect/src/dom_quickstubs.qsconf
@@ -79,5 @@
>  irregularFilenames = {
>      # stowaways
>      'nsIDOMBlob': 'nsIDOMFile',
> -    'nsIIndexedDatabaseUsageCallback': 'nsIIndexedDatabaseManager',
> -    'nsITelephoneCallback': 'nsITelephone',

I assume this nsITelephone bit is not actually related to the indexedDB stuff.
Attachment #8433060 - Flags: review?(khuey) → review+
That's correct.  It was just dead code.
Comment on attachment 8433060 [details] [diff] [review]
Get rid of nsIIndexedDatabaseManager

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

::: addon-sdk/source/lib/toolkit/loader.js
@@ +288,5 @@
>      prototype: create(globals, descriptors),
>      wantXrays: false,
> +    wantGlobalProperties: (module.id == "sdk/indexed-db" ||
> +			   module.id == "devtools/app-manager/app-projects" ||
> +			   module.id == "devtools/server/actors/storage") ? ["indexedDB"] : [],

These modules should be able to just do |var { indexedDB } = require('sdk/indexed-db');| to get what they need I think.
Attachment #8433060 - Flags: review?(dtownsend+bugmail) → review-
> These modules should be able to just do |var { indexedDB } = require('sdk/indexed-db');| 

No, doesn't work.  The thing that provides you only has open(), cmp() (brokenly), and deleteDatabase() methods.  The devtools code needs things like openForPrincipal().

That said, adding openForPrincipal on there makes the devtools tests happy, looks like.
Attachment #8441424 - Flags: review?(paul)
Attachment #8441424 - Flags: review?(dtownsend+bugmail)
Attachment #8441424 - Flags: review?(paul) → review+
Attachment #8441424 - Flags: review?(dtownsend+bugmail) → review+
Flags: in-testsuite-
Target Milestone: --- → mozilla33
Blocks: 1027008
Commit pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/ae38002da16d8f5a00b24a450769d8234bfd0ddd
Bug 1019194 part 1. Get rid of nsIIndexedDatabaseManager. r=paul,khuey,mossop
Hi,
what is the alternate method of accessing the IndexedDB in Firefox 33 from Sandbox (iMacros addon). 
After updating Firefox to v.33 my app crashes on these lines:

var sandbox = this;
Components.classes["@mozilla.org/dom/indexeddb/manager;1"].getService(Components.interfaces.nsIIndexedDatabaseManager).initWindowless(sandbox);

with the following error:

Components.classes['@mozilla.org/dom/indexeddb/manager;1'] is undefined

Thanks in advance!
> what is the alternate method of accessing the IndexedDB in Firefox 33 from Sandbox

Pass { wantGlobalProperties: ["indexedDB"] } as the last argument to your sandbox constructor.

Then you can just use "indexedDB" in the sandbox and it will work.
Thank you Boris. This works perfect for the newly created Sandbox object. But what if I'm working with the sandbox that is already created by another vendor. Can I augment the existing Sandbox with IndexedDB?
In that case, Components.utils.importGlobalProperties(["indexedDB"]) from inside the sandbox, if it's system-privileged.

If it's not system-privileged, I'm not sure there's a way to do it...
Boris, thank you very much! 
I've searched all over the internet and even posted a question on StackOverflow with no luck to find an answer. You've made my day! =)
Alex, you're welcome!
Depends on: 1083973
Jared, I've had a go at updating the page. Please let me know if it looks all right: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB_in_chrome.
Flags: needinfo?(6a68)
Looks great, Will! Thanks for the update :-)
Flags: needinfo?(6a68)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.