Bug 957086 - patch 1 - nsIDataStore instead DataStore.jsm, r=ehsan

--HG--
rename : dom/datastore/DataStoreImpl.jsm => dom/datastore/DataStoreImpl.js
This commit is contained in:
Andrea Marchesini 2014-06-03 15:36:46 +01:00
parent e6bc3e5aef
commit de0abe6219
8 changed files with 46 additions and 12 deletions

View File

@ -814,6 +814,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/components/DataStore.manifest
@BINPATH@/components/DataStoreService.js
@BINPATH@/components/DataStoreImpl.js
@BINPATH@/components/dom_datastore.xpt
#ifdef MOZ_WEBSPEECH

View File

@ -858,6 +858,7 @@ bin/libfreebl_32int64_3.so
@BINPATH@/components/DataStore.manifest
@BINPATH@/components/DataStoreService.js
@BINPATH@/components/DataStoreImpl.js
@BINPATH@/components/dom_datastore.xpt

View File

@ -1,2 +1,4 @@
component {db5c9602-030f-4bff-a3de-881a8de370f2} DataStoreImpl.js
contract @mozilla.org/dom/datastore;1 {db5c9602-030f-4bff-a3de-881a8de370f2}
component {d193d0e2-c677-4a7b-bb0a-19155b470f2e} DataStoreService.js
contract @mozilla.org/datastore-service;1 {d193d0e2-c677-4a7b-bb0a-19155b470f2e}

View File

@ -6,8 +6,6 @@
'use strict'
this.EXPORTED_SYMBOLS = ["DataStore"];
function debug(s) {
//dump('DEBUG DataStore: ' + s + '\n');
}
@ -59,17 +57,17 @@ function validateId(aId) {
}
/* DataStore object */
this.DataStore = function(aWindow, aName, aOwner, aReadOnly) {
function DataStore() {
debug("DataStore created");
this.init(aWindow, aName, aOwner, aReadOnly);
this.wrappedJSObject = this;
}
this.DataStore.prototype = {
DataStore.prototype = {
classDescription: "DataStore XPCOM Component",
classID: Components.ID("{db5c9602-030f-4bff-a3de-881a8de370f2}"),
contractID: "@mozilla.org/dom/datastore-impl;1",
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports,
Components.interfaces.nsIObserver]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDataStore, Ci.nsISupports,
Ci.nsIObserver]),
callbacks: [],
@ -536,3 +534,5 @@ this.DataStore.prototype = {
return exposedCursor;
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DataStore]);

View File

@ -16,7 +16,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/DataStoreImpl.jsm');
Cu.import("resource://gre/modules/DataStoreDB.jsm");
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
@ -350,10 +349,16 @@ DataStoreService.prototype = {
}
for (let i = 0; i < aStores.length; ++i) {
let obj = new DataStore(aWindow, aStores[i].name,
aStores[i].owner, aStores[i].readOnly);
let obj = Cc["@mozilla.org/dom/datastore;1"]
.createInstance(Ci.nsIDataStore);
if (!obj || !obj.wrappedJSObject) {
dump("Failed to create a DataStore object.\n");
return;
}
let storeImpl = aWindow.DataStoreImpl._create(aWindow, obj);
obj.init(aWindow, aStores[i].name, aStores[i].owner, aStores[i].readOnly);
let storeImpl = aWindow.DataStoreImpl._create(aWindow, obj.wrappedJSObject);
let exposedStore = new aWindow.DataStore();
exposedStore.setDataStoreImpl(storeImpl);

View File

@ -5,6 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'nsIDataStore.idl',
'nsIDataStoreService.idl',
]
@ -26,6 +27,7 @@ LOCAL_INCLUDES += [
EXTRA_COMPONENTS += [
'DataStore.manifest',
'DataStoreImpl.js',
'DataStoreService.js',
]
@ -33,7 +35,6 @@ EXTRA_JS_MODULES += [
'DataStoreChangeNotifier.jsm',
'DataStoreCursorImpl.jsm',
'DataStoreDB.jsm',
'DataStoreImpl.jsm',
'DataStoreServiceInternal.jsm',
]

View File

@ -0,0 +1,23 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIDOMWindow;
// NOTE: This is a temporary interface.
// It will be removed in the next patches for rewriting DataStore in C++.
[scriptable, uuid(0b41fef5-14ba-48b0-923c-3d8fb64692ae)]
interface nsIDataStore : nsISupports
{
void init(in nsIDOMWindow window,
in DOMString name,
in DOMString manifestURL,
in boolean readOnly);
attribute jsval exposedObject;
void retrieveRevisionId(in jsval cb);
};

View File

@ -625,4 +625,5 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/components/DataStore.manifest
@BINPATH@/components/DataStoreService.js
@BINPATH@/components/DataStoreImpl.js
@BINPATH@/components/dom_datastore.xpt