Last Comment Bug 770832 - Add 'localeId' to WebApps registry
: Add 'localeId' to WebApps registry
Status: RESOLVED FIXED
[qa-]
:
Product: Core
Classification: Components
Component: DOM: Apps (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla16
Assigned To: Mounir Lamouri (:mounir)
:
Mentors:
Depends on:
Blocks: 770831
  Show dependency treegraph
 
Reported: 2012-07-04 03:30 PDT by Mounir Lamouri (:mounir)
Modified: 2012-07-28 09:30 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
+


Attachments
Patch (4.74 KB, patch)
2012-07-04 03:30 PDT, Mounir Lamouri (:mounir)
fabrice: review+
Details | Diff | Review
Create localId if not present (1.05 KB, patch)
2012-07-06 10:20 PDT, Mounir Lamouri (:mounir)
fabrice: review+
Details | Diff | Review

Description Mounir Lamouri (:mounir) 2012-07-04 03:30:37 PDT
Created attachment 639033 [details] [diff] [review]
Patch

This is needed so we have a simple and short ID for apps. UUID should only be used to identify app for sync purpose.
Comment 1 Mounir Lamouri (:mounir) 2012-07-04 03:31:35 PDT
Comment on attachment 639033 [details] [diff] [review]
Patch

Renaming - autocomplete has been quite smart...
Comment 2 [:fabrice] Fabrice Desré 2012-07-05 11:27:26 PDT
Comment on attachment 639033 [details] [diff] [review]
Patch

Review of attachment 639033 [details] [diff] [review]:
-----------------------------------------------------------------

What you have there is fine, except that if we already have webapps installed without a localId they won't get one.
Can you check at http://mxr.mozilla.org/mozilla-central/source/dom/apps/src/Webapps.jsm#62 that apps have localIds and add them if they are missing?

r=me with that.

::: dom/apps/src/AppsService.js
@@ +39,5 @@
>    classInfo : XPCOMUtils.generateCI({classID: APPS_SERVICE_CID,
>                                       contractID: APPS_SERVICE_CONTRACTID,
>                                       classDescription: "AppsService",
>                                       interfaces: [Ci.nsIAppsService],
>                                       flags: Ci.nsIClassInfo.DOM_OBJECT})

You don't need all this classInfo stuff.
Comment 3 Mounir Lamouri (:mounir) 2012-07-06 10:20:04 PDT
Created attachment 639714 [details] [diff] [review]
Create localId if not present

Fabrice, is that what you were expecting?

Also, I didn't get your comment about the classinfo stuff. I haven't touched that.
Comment 4 Mounir Lamouri (:mounir) 2012-07-06 10:20:28 PDT
Also, the Gaia pull request is ready:
https://github.com/mozilla-b2g/gaia/pull/2233
Comment 5 [:fabrice] Fabrice Desré 2012-07-06 10:57:32 PDT
(In reply to Mounir Lamouri (:mounir) from comment #3)

> Also, I didn't get your comment about the classinfo stuff. I haven't touched
> that.

This is because you ignored https://bugzilla.mozilla.org/show_bug.cgi?id=754141#c5 in the first place ;)
Comment 6 Mounir Lamouri (:mounir) 2012-07-09 06:14:13 PDT
(In reply to Fabrice Desré [:fabrice] from comment #5)
> (In reply to Mounir Lamouri (:mounir) from comment #3)
> 
> > Also, I didn't get your comment about the classinfo stuff. I haven't touched
> > that.
> 
> This is because you ignored
> https://bugzilla.mozilla.org/show_bug.cgi?id=754141#c5 in the first place ;)

Bug 772050.
Comment 7 Ryan VanderMeulen [:RyanVM] 2012-07-09 18:04:53 PDT
https://hg.mozilla.org/mozilla-central/rev/104a6456639e
Comment 8 Jason Smith [:jsmith] 2012-07-15 08:41:24 PDT
Is this possible to verify at the JS API level?
Comment 9 Mounir Lamouri (:mounir) 2012-07-15 19:32:36 PDT
You can use AppsService to get the localId of an installed app. However, you need to be a privileged content to access this service.

Note that we should be able to simple automatic tests for this when bug 770894 will be done.
Comment 10 Jason Smith [:jsmith] 2012-07-15 22:19:59 PDT
(In reply to Mounir Lamouri (:mounir) from comment #9)
> You can use AppsService to get the localId of an installed app. However, you
> need to be a privileged content to access this service.
> 
> Note that we should be able to simple automatic tests for this when bug
> 770894 will be done.

See my comment in bug 770894. There's already a capability to write automated tests for the mozapps API on m-c.
Comment 11 Jason Smith [:jsmith] 2012-07-15 22:58:28 PDT
(In reply to Mounir Lamouri (:mounir) from comment #9)
> You can use AppsService to get the localId of an installed app. However, you
> need to be a privileged content to access this service.

What do you mean by privileged content?

On my localhost, I just installed an app and did the following below, but I got "undefined" when I accessed localId:

var request = window.navigator.mozApps.getSelf();  
request.onsuccess = function() {  
        // Pull the name of the app out of the App object  
	alert("App Result Test: " + request.result.localId);  
};  
request.onerror = function() {  
	// Display error name from the DOMError object  
	alert("Error: " + request.error.name);  
};
Comment 12 Jason Smith [:jsmith] 2012-07-15 22:59:39 PDT
(In reply to Jason Smith [:jsmith] from comment #11)
> (In reply to Mounir Lamouri (:mounir) from comment #9)
> > You can use AppsService to get the localId of an installed app. However, you
> > need to be a privileged content to access this service.
> 
> What do you mean by privileged content?
> 
> On my localhost, I just installed an app and did the following below, but I
> got "undefined" when I accessed localId:
> 
> var request = window.navigator.mozApps.getSelf();  
> request.onsuccess = function() {   
> 	alert("App Result Test: " + request.result.localId);  
> };  
> request.onerror = function() {  
> 	// Display error name from the DOMError object  
> 	alert("Error: " + request.error.name);  
> };

Slight fix on the above code: Ignore the comment above the first alert (bad copy and paste on my part).
Comment 13 [:fabrice] Fabrice Desré 2012-07-16 01:22:27 PDT
(In reply to Jason Smith [:jsmith] from comment #11)
> (In reply to Mounir Lamouri (:mounir) from comment #9)
> > You can use AppsService to get the localId of an installed app. However, you
> > need to be a privileged content to access this service.
> 
> What do you mean by privileged content?

This is "chrome" privileged code. This property is not exposed to web content, so there's no way to test anything from an html page.

Note You need to log in before you can comment on or make changes to this bug.