diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/apps/AppsService.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/apps/AppsService.js')
-rw-r--r-- | dom/apps/AppsService.js | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/dom/apps/AppsService.js b/dom/apps/AppsService.js new file mode 100644 index 000000000..e0a7ea041 --- /dev/null +++ b/dom/apps/AppsService.js @@ -0,0 +1,114 @@ +/* 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/. */ + +"use strict" + +function debug(s) { + //dump("-*- AppsService.js: " + s + "\n"); +} + +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; +const Cr = Components.results; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/Promise.jsm"); + +const APPS_SERVICE_CID = Components.ID("{05072afa-92fe-45bf-ae22-39b69c117058}"); + +function AppsService() +{ + debug("AppsService Constructor"); + this.inParent = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime) + .processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT; + debug("inParent: " + this.inParent); + if (!this.inParent) { + Cu.import("resource://gre/modules/AppsServiceChild.jsm"); + } +} + +AppsService.prototype = { + + isInvalidId: function(localId) { + return (localId == Ci.nsIScriptSecurityManager.NO_APP_ID || + localId == Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID); + }, + + getAppByManifestURL: function getAppByManifestURL(aManifestURL) { + debug("GetAppByManifestURL( " + aManifestURL + " )"); + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + }, + + getManifestFor: function getManifestFor(aManifestURL) { + debug("getManifestFor(" + aManifestURL + ")"); + if (this.inParent) { + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + } else { + return Promise.reject( + new Error("Calling getManifestFor() from child is not supported")); + } + }, + + getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aManifestURL) { + debug("getAppLocalIdByManifestURL( " + aManifestURL + " )"); + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + }, + + getAppLocalIdByStoreId: function getAppLocalIdByStoreId(aStoreId) { + debug("getAppLocalIdByStoreId( " + aStoreId + " )"); + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + }, + + getAppByLocalId: function getAppByLocalId(aLocalId) { + debug("getAppByLocalId( " + aLocalId + " )"); + if (this.isInvalidId(aLocalId)) { + return null; + } + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + }, + + getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) { + debug("getManifestURLByLocalId( " + aLocalId + " )"); + if (this.isInvalidId(aLocalId)) { + return null; + } + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + }, + + getCoreAppsBasePath: function getCoreAppsBasePath() { + debug("getCoreAppsBasePath()"); + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + }, + + getWebAppsBasePath: function getWebAppsBasePath() { + debug("getWebAppsBasePath()"); + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + }, + + areAnyAppsInstalled: function() { + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + }, + + getAppInfo: function getAppInfo(aAppId) { + debug("getAppInfo()"); + throw Cr.NS_ERROR_NOT_IMPLEMENTED; + }, + + getScopeByLocalId: function(aLocalId) { + debug("getScopeByLocalId( " + aLocalId + " )"); + if (this.isInvalidId(aLocalId)) { + return null; + } + // TODO : implement properly! + // We just return null for now to not break PushService.jsm + return null; + }, + + classID : APPS_SERVICE_CID, + QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService]) +} + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AppsService]) |