25 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
26 Components.utils.import(
"resource://app/jsmodules/ArrayConverter.jsm");
27 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
28 Components.utils.import(
"resource://app/jsmodules/sbLibraryUtils.jsm");
29 Components.utils.import(
"resource://app/jsmodules/SBJobUtils.jsm");
31 const Cc = Components.classes;
32 const Ci = Components.interfaces;
33 const Cr = Components.results;
35 const SBLDBCOMP =
"@songbirdnest.com/Songbird/Library/LocalDatabase/";
40 SBJobUtils.JobBase.call(
this);
41 this._migrationHandlers = {};
49 __proto__: SBJobUtils.JobBase.prototype,
52 classID: Components.ID(
"{744f6217-4cb9-4929-8d1d-72492c1b8c83}"),
57 flags:
Ci.nsIClassInfo.DOM_OBJECT,
62 _initializedSCC:
false,
64 _publicWProps: [
"" ],
65 _publicRProps: [
"classinfo:classDescription",
66 "classinfo:contractID",
68 "classinfo:implementationLanguage",
70 _publicMethods: [
"internal:canMigrate",
71 "internal:getLatestSchemaVersion",
73 _publicInterfaces: [
Ci.nsISupports,
75 Ci.nsISecurityCheckedComponent,
76 Ci.sbILocalDatabaseMigrationHelper,
78 Ci.sbIJobCancelable ],
80 _latestSchemaVersion: 29,
81 _lowestFromSchemaVersion: Number.MAX_VALUE,
83 _migrationHandlers:
null,
89 _init:
function sbLDBM_init() {
90 this._getMigrationHandlerList();
91 this._initialized =
true;
94 _getMigrationHandlerList:
function sbLDBM_getMigrationHandlerList() {
95 this._migrationHandlers = {};
100 let migrationHandler =
101 Cc[
contractID].createInstance(
Ci.sbILocalDatabaseMigrationHandler);
102 let migrationHandlerKey = migrationHandler.fromVersion +
104 migrationHandler.toVersion;
105 this._migrationHandlers[migrationHandlerKey] = migrationHandler;
107 if(this._lowestFromSchemaVersion > migrationHandler.fromVersion) {
108 this._lowestFromSchemaVersion = migrationHandler.fromVersion;
118 getLatestSchemaVersion:
function sbLDBM_getLatestSchemaVersion() {
119 return this._latestSchemaVersion;
122 canMigrate:
function sbLDBM_canMigrate(aFromVersion, aToVersion) {
123 if(!this._initialized) {
127 var oldVersion = aFromVersion;
128 var newVersion = oldVersion + 1;
130 for(let
i = 0;
i < aToVersion - aFromVersion; ++
i) {
131 let
key = oldVersion +
"," + newVersion;
133 if(!(key in this._migrationHandlers)) {
137 oldVersion = newVersion;
144 migrate:
function sbLDBM_migrate(aFromVersion, aToVersion, aLibrary) {
145 if(!this._initialized) {
149 var oldVersion = aFromVersion;
150 var newVersion = oldVersion + 1;
152 for(let
i = 0;
i < aToVersion - aFromVersion; ++
i) {
153 let
key = oldVersion +
"," + newVersion;
155 if(!(key in this._migrationHandlers)) {
156 dump(
"Failed to find migration handler " + key +
"\n");
157 throw Cr.NS_ERROR_UNEXPECTED;
160 this._migrationHandlers[
key].migrate(aLibrary);
162 dump(
"Error in migrating " + oldVersion +
" to " + newVersion +
":\n" +
167 oldVersion = newVersion;
180 Ci.sbILocalDatabaseMigrationHelper,
184 Ci.nsISecurityCheckedComponent,
185 Ci.sbISecurityAggregator
198 Ci.nsISecurityCheckedComponent,
199 Ci.sbISecurityAggregator,
202 count.value = interfaces.length;
216 _initSCC:
function sbLDBM__initSCC() {
217 this._securityMixin =
Cc[
"@songbirdnest.com/remoteapi/security-mixin;1"]
218 .createInstance(
Ci.nsISecurityCheckedComponent);
222 .init(
this, this._publicInterfaces, this._publicInterfaces.length,
223 this._publicMethods,
this._publicMethods.length,
224 this._publicRProps,
this._publicRProps.length,
225 this._publicWProps,
this._publicWProps.length,
228 this._initializedSCC =
true;
231 canCreateWrapper:
function sbLDBM_canCreateWrapper(iid) {
232 if (! this._initializedSCC)
234 return this._securityMixin.canCreateWrapper(iid);
237 canCallMethod:
function sbLDBM_canCallMethod(iid, methodName) {
238 if (! this._initializedSCC)
240 return this._securityMixin.canCallMethod(iid, methodName);
243 canGetProperty:
function sbLDBM_canGetProperty(iid, propertyName) {
244 if (! this._initializedSCC)
246 return this._securityMixin.canGetProperty(iid, propertyName);
249 canSetProperty:
function sbLDBM_canSetProperty(iid, propertyName) {
250 if (! this._initializedSCC)
252 return this._securityMixin.canSetProperty(iid, propertyName);
261 return XPCOMUtils.generateModule([
sbDeviceFirmwareAutoCheckForUpdate prototype flags
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
sbDeviceFirmwareAutoCheckForUpdate prototype getHelperForLanguage
function sbLocalDatabaseMigrationHelper()
sbDeviceFirmwareAutoCheckForUpdate prototype classID
sbDeviceFirmwareAutoCheckForUpdate prototype getInterfaces
sbDeviceFirmwareAutoCheckForUpdate prototype interfaces
classDescription implementationLanguage
_getSelectedPageStyle s i
function NSGetModule(compMgr, fileSpec)