Last active
December 23, 2015 13:49
-
-
Save autonome/6644198 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function installAppFromManifestObj(obj) { | |
//const {Cc, Ci, Cu, Cm} = require('chrome') | |
var Cu = Components.utils | |
Cu.import("resource://gre/modules/WebappsInstaller.jsm") | |
var installParam = { | |
app: { | |
manifest : obj, | |
origin: obj.url | |
} | |
} | |
console.log(installParam) | |
try { | |
var app = WebappsInstaller.init(installParam) | |
WebappsInstaller.install(installParam, obj).then(function success() { | |
console.log('success!') | |
}, function failure(error) { | |
console.log('error', error) | |
}) | |
} catch(error) { | |
console.log('exception', error) | |
} | |
} | |
installAppFromManifestObj({ | |
"app": { | |
"manifest": { | |
"name":"Zimbra Web Client Sign In", | |
"launch_path":"/zimbra/#1", | |
"url":"https://mail.mozilla.com/zimbra/#1", | |
"description":"Standalone: The Web in an App Form-factor.", | |
"icons":{"16":"https://mail.mozilla.com/zimbra/img/logo/favicon.ico"} | |
}, | |
"origin":"https://mail.mozilla.com/zimbra/#1" | |
} | |
}) |
Gist updated to use new promises code. I'm not getting the typeerror exception anymore, but just silent failure now.
Felipe, in the new code, the manifest object appears to be passed to WebappsInstaller in three places, which is seems weird. Is that right?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try:
totally untested! if it doesn't work, look at webappsUI.jsm:195... I based it from there