Closed Bug 919981 Opened 11 years ago Closed 11 years ago

Dispatch app (un)install events via the webapps actor

Categories

(DevTools Graveyard :: WebIDE, defect, P1)

defect

Tracking

(firefox26 verified, firefox27 verified, b2g-v1.2 fixed)

VERIFIED FIXED
Firefox 27
Tracking Status
firefox26 --- verified
firefox27 --- verified
b2g-v1.2 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(1 file, 3 obsolete files)

So far, we can listen for app being opened/closed, and we can list installed apps, but it would also be usefull to receive events when an app is installed or uninstalled. That would help managing the list of installed apps in the device panel.
Blocks: 919496
Priority: -- → P1
Whiteboard: [needed-in-aurora-26]
Attachment #809235 - Flags: review?(fabrice)
Assignee: nobody → poirot.alex
Comment on attachment 809235 [details] [diff] [review]
Proper tests and also fire such even when installing an app via the actor

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

It's a bit sad to add new observer notifications, but we'll fix that later.

::: dom/apps/src/Webapps.jsm
@@ +2077,5 @@
>          this._saveApps((function() {
>            this.updateAppHandlers(null, aManifest, appObject);
>            this.broadcastMessage("Webapps:AddApp", { id: aId, app: appObject });
> +          let appClone = AppsUtils.cloneAppObject(app);
> +          Services.obs.notifyObservers(null, "webapps-installed", JSON.stringify(appClone));

Since you only need the manifest url in webapps.js, don't use cloneAppObject which is expensive, but just create an object with the manifest url.

::: toolkit/devtools/server/actors/webapps.js
@@ +189,5 @@
>                                 oid: "foo",
>                                 requestID: "bar"
>                               });
>  
> +        Services.obs.notifyObservers(null, "webapps-installed", JSON.stringify({manifestURL: aApp.manifestURL}));

nit: is that < 80 chars?
Attachment #809235 - Flags: review?(fabrice) → feedback+
Whiteboard: [needed-in-aurora-26]
Any reason to send an app JSON object? If we only need the manifestURL, why not just send it?
Attached patch Patch v2 (obsolete) — Splinter Review
Attachment #809235 - Attachment is obsolete: true
Attachment #812708 - Flags: review?(fabrice)
Comment on attachment 812708 [details] [diff] [review]
Patch v2

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

r=me with nits addressed

::: dom/apps/src/Webapps.jsm
@@ +2077,5 @@
>          this._saveApps((function() {
>            this.updateAppHandlers(null, aManifest, appObject);
>            this.broadcastMessage("Webapps:AddApp", { id: aId, app: appObject });
> +          Services.obs.notifyObservers(null, "webapps-installed",
> +            JSON.stringify({manifestURL: appObject.manifestURL}));

nit: { manifestURL: appObject.manifestURL }

@@ +2210,5 @@
>      this._saveApps((function() {
>        this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject });
>        this.broadcastMessage("Webapps:Install:Return:OK", aData);
> +      Services.obs.notifyObservers(null, "webapps-installed",
> +        JSON.stringify({manifestURL: app.manifestURL}));

idem

::: toolkit/devtools/server/actors/webapps.js
@@ +190,5 @@
>                                 requestID: "bar"
>                               });
>  
> +        Services.obs.notifyObservers(null, "webapps-installed",
> +          JSON.stringify({manifestURL: aApp.manifestURL}));

nit: { manifestURL: aApp.manifestURL }
Comment on attachment 812708 [details] [diff] [review]
Patch v2

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

r=me with nits addressed

::: dom/apps/src/Webapps.jsm
@@ +2077,5 @@
>          this._saveApps((function() {
>            this.updateAppHandlers(null, aManifest, appObject);
>            this.broadcastMessage("Webapps:AddApp", { id: aId, app: appObject });
> +          Services.obs.notifyObservers(null, "webapps-installed",
> +            JSON.stringify({manifestURL: appObject.manifestURL}));

nit: { manifestURL: appObject.manifestURL }

@@ +2210,5 @@
>      this._saveApps((function() {
>        this.broadcastMessage("Webapps:AddApp", { id: id, app: appObject });
>        this.broadcastMessage("Webapps:Install:Return:OK", aData);
> +      Services.obs.notifyObservers(null, "webapps-installed",
> +        JSON.stringify({manifestURL: app.manifestURL}));

idem

::: toolkit/devtools/server/actors/webapps.js
@@ +190,5 @@
>                                 requestID: "bar"
>                               });
>  
> +        Services.obs.notifyObservers(null, "webapps-installed",
> +          JSON.stringify({manifestURL: aApp.manifestURL}));

nit: { manifestURL: aApp.manifestURL }
Attachment #812708 - Flags: review?(fabrice) → review+
Keywords: checkin-needed
Whiteboard: [land-in-fx-team]
Attachment #812708 - Attachment is obsolete: true
https://hg.mozilla.org/integration/fx-team/rev/858e4ce84c04
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]
Whiteboard: [fixed-in-fx-team] → [needed-in-aurora-26]
Comment on attachment 813591 [details] [diff] [review]
patch v2.1 - patch to land

[Approval Request Comment]
Bug caused by (feature/regressing bug #): new feature (app manager)
User impact if declined: installed apps won't show up
Testing completed (on m-c, etc.): fx-team
Risk to taking this patch (and alternatives if risky): low
String or IDL/UUID changes made by this patch: none
Attachment #813591 - Flags: approval-mozilla-aurora?
Whiteboard: [needed-in-aurora-26] → [waiting-for-aurora-approval]
https://hg.mozilla.org/mozilla-central/rev/858e4ce84c04
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 27
Attachment #813591 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Keywords: verifyme
Verified as fixed on latest Aurora 27.0a2 (20131112004004) and Firefox 26 beta 4 (20131111154639) using Win 7 64-bit, Ubuntu 13.04 32-bit and Mac OS X 10.6.8.
QA Contact: petruta.rasa
Status: RESOLVED → VERIFIED
Keywords: verifyme
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: