Closed Bug 786303 Opened 12 years ago Closed 11 years ago

Use the manifestURL in WebApps notifications instead of the origin

Categories

(Core Graveyard :: DOM: Apps, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla25

People

(Reporter: mounir, Assigned: fabrice)

References

Details

Attachments

(1 file, 4 obsolete files)

We should use manifestURL instead of origin and update getAppFromObserverMessage in nsIAppsService. If needed, we could even remove that method and have callers call getAppByManifestURL.
Blocks: 775847
Attached patch Patch (obsolete) — Splinter Review
Attachment #778174 - Flags: review?(fabrice)
Attached file Alternative patch (obsolete) —
No longer blocks: 775847
Blocks: 778277
Comment on attachment 778174 [details] [diff] [review] Patch Review of attachment 778174 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/push/src/PushService.jsm @@ +344,5 @@ > } > break; > case "webapps-uninstall": > debug("webapps-uninstall"); > + let manifestURL = aData.manifestURL; aData is a string, so this will not work. You need to parse it as JSON first. @@ +349,3 @@ > let appsService = Cc["@mozilla.org/AppsService;1"] > .getService(Ci.nsIAppsService); > + var app = appsService.getAppByManifestURL(manifestURL); I know this is not your fault, but s/var/let.
Attachment #778174 - Flags: review?(fabrice) → review-
Attached patch Patch v2 (obsolete) — Splinter Review
(In reply to Fabrice Desré [:fabrice] from comment #3) > aData is a string, so this will not work. You need to parse it as JSON first. Oh, I didn't notice that because two lines after there was "aData.origin".
Attachment #778174 - Attachment is obsolete: true
Attachment #778989 - Flags: review?(fabrice)
Attachment #778989 - Attachment is patch: true
Comment on attachment 778989 [details] [diff] [review] Patch v2 Review of attachment 778989 [details] [diff] [review]: ----------------------------------------------------------------- We're almost there! ::: dom/push/src/PushService.jsm @@ +344,5 @@ > } > break; > case "webapps-uninstall": > debug("webapps-uninstall"); > + let data = JSON.parse(aData); that can throw. @@ +350,3 @@ > let appsService = Cc["@mozilla.org/AppsService;1"] > .getService(Ci.nsIAppsService); > + if (!appsService.getAppByManifestURL(manifestURL)) { Since you don't use the app afterward, use getAppLocalIdByManifestURL to not create a useless app object.
Attachment #778989 - Flags: review?(fabrice) → review-
Attached patch Patch v3 (obsolete) — Splinter Review
Attachment #778989 - Attachment is obsolete: true
Attachment #779277 - Flags: review?(fabrice)
Attachment #778175 - Attachment is obsolete: true
Comment on attachment 779277 [details] [diff] [review] Patch v3 Review of attachment 779277 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/push/src/PushService.jsm @@ +350,5 @@ > + data = JSON.parse(aData); > + } catch (ex) { > + debug("webapps-uninstall: JSON parsing error: " + aData); > + return; > + } Nit: blank line after } @@ +356,3 @@ > let appsService = Cc["@mozilla.org/AppsService;1"] > .getService(Ci.nsIAppsService); > + if (!appsService.getAppLocalIdByManifestURL(manifestURL)) { getAppLocalIdByManifestURL will return Ci.nsIScriptSecurityManager.NO_APP_ID when failing, not null (see https://mxr.mozilla.org/mozilla-central/source/dom/apps/src/AppsUtils.jsm#121)
Attachment #779277 - Flags: review?(fabrice) → review-
Attached patch Patch v4Splinter Review
Attachment #779277 - Attachment is obsolete: true
Attachment #779490 - Flags: review?(fabrice)
Attachment #779490 - Flags: review?(fabrice) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: