Closed Bug 1122979 Opened 9 years ago Closed 9 years ago

Can't register privileged addon apps after install from WebIDE

Categories

(Firefox OS Graveyard :: General, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1118544

People

(Reporter: anaran, Unassigned)

References

Details

+++ This bug was initially created as a clone of Bug #923897 +++

'filter' is no longer treated as a prefix match, it is used as first argument to RegExp constructor: new RegExp(filter, "g").

When I install my add-on via webide it hits https://dxr.mozilla.org/mozilla-central/source/dom/apps/AppsUtils.jsm#73 twice where `this` is my addon. First time this.role == "", second time "addon".

aIID gives this in the console:

XPCWrappedNative_NoHelper { number: "{986c11d0-f340-11d4-9075-0010a4e73d9a}", name: "", valid: true }

adb logcat:

Uninstall via Settings App-Permissions on flame device:

I/GeckoDump(  212): XXX FIXME : Got a mozContentEvent: webapps-uninstall-granted
I/Gecko   (  212): -- InterAppCommService: 1421437734685: Finish updating registered/allowed connections for an uninstalled app.
I/Gecko   ( 3362): -*-*- UserCustomizations (child): _removeItem: 02ccb1c631f89a7f2331e24da209d9bf
I/Gecko   ( 3362): -*-*- UserCustomizations (child): _unloadForManifestURL app://b1bba6b4-1790-4054-9608-064dd5220203/manifest.webapp

But function register is never called for the add-on.

How would I proceed debugging that part?
Depends on: 1122981
No longer blocks: spark
Summary: Cannot register privileged app ("role": "addon") for Extensibility support for b2g → Can't install privileged addon apps from WebIDE
The APP shows up under settings APP permissions, it just never registers.
Summary: Can't install privileged addon apps from WebIDE → Can't register privileged addon apps from WebIDE
Summary: Can't register privileged addon apps from WebIDE → Can't register privileged addon apps after install from WebIDE
(In reply to adrian.aichner from comment #0)
> How would I proceed debugging that part?

The sideloading code goes through:
https://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/webapps.js#277

and that should lead to the registration at http://mxr.mozilla.org/mozilla-central/source/dom/apps/Webapps.jsm#2103

Can you check that on your side?
I stripped down my app manifest along the lines of
https://bugzilla.mozilla.org/attachment.cgi?id=8536350&action=diff#a/dom/apps/tests/addons/manifest.webapp_sec2

When I debug the Main Process I see this:

Error sandboxing app://b1bba6b4-1790-4054-9608-064dd5220203/app.js : Error opening input stream (invalid filename?): app://b1bba6b4-1790-4054-9608-064dd5220203/app.js
So your addon registered correctly? 

The sandboxing error looks like an incorrect url. hard to debug without having your zip.
You need patch from bug 1118544 to get addons to work in WebIDE.
It is on cypress branch, but I'll try to also land it shortly on master.
(In reply to Fabrice Desré [:fabrice] from comment #4)
> So your addon registered correctly? 
> 
> The sandboxing error looks like an incorrect url. hard to debug without
> having your zip.

Looks like register and unregiser work!

I was also able to fix some JS warnings in my add-on code pointed out by logcat.

But the add-on still does not seem to get executed in the flame browser for qualifying urls.

I/Gecko   (  209): -*- Webapps.jsm : updateAppHandlers: old=null new=({version:"0.2.0", name:"JSON.parse", description:"Demonstrates how to use permissions to load remote content", launch_path:"/index.html", role:"addon", customizations:[{filter:".+", scripts:["report-json-parse-error.js", "app.js"]}]})
I/Gecko   (  209): -*- Webapps.jsm : Saving /data/local/webapps/webapps.json
I/Gecko   (  209): -*-*- Langpacks: register app app://b1bba6b4-1790-4054-9608-064dd5220203/manifest.webapp role=addon
I/Gecko   (  209): -*-*- Langpacks: Not a langpack.
I/Gecko   (  209): -*- Webapps.jsm : Saving /data/local/webapps/webapps.json
I/Gecko   (  209): -*- Webapps.jsm : Success saving /data/local/webapps/webapps.json
I/Gecko   (  209): -*- Webapps.jsm : Success saving /data/local/webapps/webapps.json
I/Gecko   (  209): -*-*- Langpacks: getAdditionalLanguages app://music.gaiamobile.org/manifest.webapp
I/Gecko   (  209): -*-*- Langpacks: Languages found: ({langs:{}})
I/Gecko   (  209): -*-*- Langpacks: getAdditionalLanguages app://video.gaiamobile.org/manifest.webapp
I/Gecko   (  209): -*-*- Langpacks: Languages found: ({langs:{}})
78 similar lines deleted
I/Gecko   (  209): -*-*- Langpacks: getAdditionalLanguages app://b1bba6b4-1790-4054-9608-064dd5220203/manifest.webapp
I/Gecko   (  209): -*-*- Langpacks: Languages found: ({langs:{}})
I/Gecko   (  209): -*- Webapps.jsm : close
I/Gecko   (  209): -*- Webapps.jsm : cancelDownload app://b1bba6b4-1790-4054-9608-064dd5220203/manifest.webapp
I/Gecko   (  209): -*- Webapps.jsm : Could not find a download for app://b1bba6b4-1790-4054-9608-064dd5220203/manifest.webapp
I/Gecko   (  209): -- InterAppCommService: 1421852008346: Finish updating registered/allowed connections for an uninstalled app.
I/Gecko   (  209): -*-*- Langpacks: unregister app app://b1bba6b4-1790-4054-9608-064dd5220203/manifest.webapp role=addon
I/Gecko   (  209): -*-*- Langpacks: Not a langpack.
I/Gecko   (  209): -*- Webapps.jsm : Saving /data/local/webapps/webapps.json
I/Gecko   (  209): -*- Webapps.jsm : Success saving /data/local/webapps/webapps.json
I/Gecko   (  209): -*- Webapps.jsm : cancelDownload https://marketplace.firefox.com/app/fed52d38-090b-4172-9ab9-75965cb4df11/manifest.webapp
I/Gecko   (  209): -*- Webapps.jsm : Could not find a download for https://marketplace.firefox.com/app/fed52d38-090b-4172-9ab9-75965cb4df11/manifest.webapp
I/Gecko   (  209): -- InterAppCommService: 1421852026375: Finish updating registered/allowed connections for an uninstalled app.

JSON.parse lists many times in settings app permissions.
When I try to uninstall one of the duplicates I get this:

I/Gecko   (  209): -*-*- Langpacks: unregister app https://marketplace.firefox.com/app/fed52d38-090b-4172-9ab9-75965cb4df11/manifest.webapp role=
I/Gecko   (  209): -*-*- Langpacks: Not a langpack.
I/Gecko   (  209): -*- Webapps.jsm : Saving /data/local/webapps/webapps.json
I/Gecko   (  209): -*- Webapps.jsm : Success saving /data/local/webapps/webapps.json
I/Gecko   (  209): -*- Webapps.jsm : Error: cannot uninstall a non-removable app.
I/Gecko   (  209): -*- Webapps.jsm : Error: cannot uninstall a non-removable app.
So these seem to be the remaining issues in this latest v2.2 nightly on a flame device:

pea is a privileged app of mine.

I/Browser (24102): Error sandboxing app://b1bba6b4-1790-4054-9608-064dd5220203/report-json-parse-error.js : Error opening input stream (invalid filename?): app://b1bba6b4-1790-4054-9608-064dd5220203/report-json-parse-error.js
I/Browser (24102): Error sandboxing app://b1bba6b4-1790-4054-9608-064dd5220203/app.js : Error opening input stream (invalid filename?): app://b1bba6b4-1790-4054-9608-064dd5220203/app.js
I/pea     (24661): Error sandboxing app://b1bba6b4-1790-4054-9608-064dd5220203/report-json-parse-error.js : Error opening input stream (invalid filename?): app://b1bba6b4-1790-4054-9608-064dd5220203/report-json-parse-error.js
I/pea     (24661): Error sandboxing app://b1bba6b4-1790-4054-9608-064dd5220203/app.js : Error opening input stream (invalid filename?): app://b1bba6b4-1790-4054-9608-064dd5220203/app.js

This is probably the issue pointed out in Comment 5.

I've played with the filter string and don't think it is to blame.
Oh, comment links seem to be off by +1 in bugzilla. The comment 5 link actually takes me to comment #6.
(In reply to adrian.aichner from comment #8)
> Oh, comment links seem to be off by +1 in bugzilla. The comment 5 link
> actually takes me to comment #6.

Works fine here... but probably best to file a separate Bugzilla bug for this. :)
(Description is comment 0, they start counting from there.)
I am guilty of starting this off-topic discussion, so let me end it as well:

My use of Stylish with
https://userstyles.org/styles/97794/bugzilla-fixed-header-hiding-footer
causes the header to obscure the beginning of the content navigated to.

Today's update to that style makes the header hide when moving mouse to (or tapping screen on) the left margin in addition to showing the footer.

:freddyb Comment 0 links to Description. Comments start at Comment 1.
I imagine this is a duplicate of bug 1118544.
Please reopen with more details if bug 1118544 didn't fixed the issues you had with addons.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
I am noticing the following as well. I will also check bug 1118544.

Was not able to stop at breakpoint I set in
UserCustomizations.jsm:214
in WebIDE.

I/Browser ( 1813): Error loading stylesheet app://b1bba6b4-1790-4054-9608-064dd5220203/css/app.css : [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMWindowUtils.loadSheet]"  nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)"  location: "JS frame :: resource://gre/modules/UserCustomizations.jsm :: this.UserCustomizations._injectItem/< :: line 214"  data: no]

Using
  document.lastModified
      01/22/2015 18:01:28
  navigator.userAgent
      Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Firefox/38.0
  navigator.buildID
      20150122030202
to debug
  name	B2G
  version	3.0.0.0-prerelease
  appbuildid	20150122010203
  platformbuildid	20150122010203
  platformversion	38.0a1
  geckobuildid	20150122010203
  geckoversion	38.0a1
  changeset	34e2d2bd7ec4
  locale	en-US
  os	B2G
  hardware	qcom
  processor	arm
  compiler	eabi
  brandName	
  channel	nightly
  profile	default
You need to log in before you can comment on or make changes to this bug.