Hi everybody! Is jpm really compatible with Fennec? I faced problems right from the start.
I have: PC (Windows 7 + Nightly), Samsung tablet SM-T525 (Android 4.4.2 + Nightly).
My simple steps:
1) md something;
2) "jpm init" there;
4) replaced index.js content with this:
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import('resource://gre/modules/Services.jsm');
let windows = Services.wm.getEnumerator("navigator:browser");
while (windows.hasMoreElements()) {
let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
}
5) "jpm xpi";
6) uploaded something-bla-bla.xpi to my website;
7) connected tablet to PC (USB);
8) started jpm-mobile (it can't inject anything there due to some filesystem restrictions, but it doesn't matter - I use it only for console logging);
10) gave permission to load;
11) gave permission to install;
12) got NOTHING except this in the log:
I/GeckoConsole(16487): Sending message
I/GeckoConsole(16487): 1429951726631 addons.xpi WARN Failed to set permissions 755 on /storage/emulated/legacy/jetpack-
profile/extensions/trash: [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.permis
sions]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)" location: "JS frame :: resource://gre/modules/addons/XPIProvider.js
m :: setFilePermissions :: line 276" data: no] Stack trace: setFilePermissions()@resource://gre/modules/addons/XPIProvider.jsm:27
6 < recursiveRemove()@resource://gre/modules/addons/XPIProvider.jsm:1313 < DirInstallLocation_installAddon()@resource://gre/module
s/addons/XPIProvider.jsm:7441 < AI_startInstall/<()@resource://gre/modules/addons/XPIProvider.jsm:5816 < next()@self-hosted:674 <
TaskImpl_run()@resource://gre/modules/Task.jsm:330 < Handler.prototype.process()@resource://gre/modules/Promise.jsm -> resource://
gre/modules/Promise-backend.js:867 < this.PromiseWalker.walkerLoop()@resource://gre/modules/Promise.jsm -> resource://gre/modules/
Promise-backend.j
I/GeckoConsole(16487): 1429951726649 addons.xpi WARN failed to set lastModifiedTime on /storage/emulated/legacy/jetpack
-profile/extensions/some...@mydomain.org.xpi: [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_D
ENIED) [nsIFile.lastModifiedTime]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)" location: "JS frame :: resource://gre/mo
dules/addons/XPIProvider.jsm :: DirInstallLocation_installAddon :: line 7451" data: no] Stack trace: DirInstallLocation_installAd
don()@resource://gre/modules/addons/XPIProvider.jsm:7451 < AI_startInstall/<()@resource://gre/modules/addons/XPIProvider.jsm:5816
< next()@self-hosted:674 < TaskImpl_run()@resource://gre/modules/Task.jsm:330 < Handler.prototype.process()@resource://gre/modules
/Promise.jsm -> resource://gre/modules/Promise-backend.js:867 < this.PromiseWalker.walkerLoop()@resource://gre/modules/Promise.jsm
-> resource://gre/modules/Promise-backend.js:746 < this.PromiseWalker.scheduleWalkerLoop/<()@resource://gre/modules/Promise.jsm -
> resource://gre/
I/GeckoConsole(16487): 1429951726947 addons.xpi WARN Failed to set permissions 755 on /storage/emulated/legacy/jetpack-
profile/extensions/staged: [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.permi
ssions]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)" location: "JS frame :: resource://gre/modules/addons/XPIProvider.j
sm :: setFilePermissions :: line 276" data: no] Stack trace: setFilePermissions()@resource://gre/modules/addons/XPIProvider.jsm:2
76 < DirectoryInstallLocation.prototype.cleanStagingDir()@resource://gre/modules/addons/XPIProvider.jsm:7320 < DirectoryInstallLoc
ation.prototype.releaseStagingDir()@resource://gre/modules/addons/XPIProvider.jsm:7284 < AI_startInstall/<()@resource://gre/module
s/addons/XPIProvider.jsm:5890 < Handler.prototype.process()@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-b
ackend.js:867 < this.PromiseWalker.walkerLoop()@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:74
6 < this.PromiseW
W/GeckoConsole(16487): [JavaScript Error: "A promise chain failed to handle a rejection. Did you forget to '.catch', or did you fo
rget to 'return'?
W/GeckoConsole(16487):
W/GeckoConsole(16487): Date: Sat Apr 25 2015 13:48:47 GMT+0500 (ORAT)
W/GeckoConsole(16487): Full Message: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIAppShellSer
vice.hiddenDOMWindow]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/modules/commonjs/toolkit/
loader.js -> resource://gre/modules/commonjs/sdk/window/utils.js :: getHiddenWindow :: line 65" data: no]
W/GeckoConsole(16487): Full Stack: @undefined:65:undefined
W/GeckoConsole(16487): getHiddenWindow@resource://gre/modules/commonjs/sdk/window/utils.js:65:3
W/GeckoConsole(16487): @resource://gre/modules/commonjs/sdk/addon/window.js:20:20
W/GeckoConsole(16487): startup/<@resource://gre/modules/commonjs/sdk/addon/runner.js:71:19
W/GeckoConsole(16487): Handler.prototype.process@resource://gre/modules/Promise-backend.js:867:23
W/GeckoConsole(16487): this.PromiseWalker.walkerLoop@resource://gre/modules/Promise-backend.js:746:7
W/GeckoConsole(16487): this.PromiseWalker.scheduleWalk
BTW, when I removed this:
const { startup, shutdown, install, uninstall } = new Bootstrap(rootURI);
from bootstrap.js and moved everything from index.js to bootstrap.js (into startup() of'course) - it started to work!
It seems the last line in bootstrap.js doesn't work giving no significant errors.
Moreover, at desktop I have no problems with it at all - works just fine.
Actually, I want to build a single firefox addon, which should be able to work on desktop and on fennec as well. I know it should possible with something
like this:
var desktop = (require("chrome").Cc["@mozilla.org/xre/app-info;1"].getService(require("chrome").Ci.nsIXULRuntime).widgetToolkit.toLowerCase() != "android");
But now I just don't know - where could I make this branching?