Closed
Bug 899260
Opened 11 years ago
Closed 10 years ago
System notifications are fired even if the message handler is not set in the manifest file of the app.
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
2.0 S3 (6june)
People
(Reporter: svantipalli, Assigned: selin)
References
Details
Attachments
(2 files, 2 obsolete files)
(deleted),
application/zip
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
Gecko http://hg.mozilla.org/releases/mozilla-b2g18/rev/d6e518d3ef28
Gaia 9c868050bcc6f522f54f4afc0f0e4aa9a6149771
BuildID 20130726070208
Version 18.0
STR:
1. Create a single page app which can register for an endpoint and for which the handler page is not given in manifest file. Ex:
"messages": [
{ "push": "" }
],
2. Let the app register for the end point URL(For the attached app Click on "Register" button. The URL is logged in the app UI as well as ddms console. Can be retrieved by filtering the logcat with the term "Registration:")
3. Do a CURL put at the endpoint URL retrieved from step 2. ( Open terminal and do
curl -X PUT --data 'version=5' $endpointurl)
Expected Behavior:
As the handler page is not specified, system notification should not be fired on the device
Actual Behavior:
The system notification is fired even without the handler page being specified in the manifest file.
Flags: needinfo?(gene.lian)
I think Swaroopa confirmed this occurs for alarm too and so is a system messages issue.
Comment 2•11 years ago
|
||
I didn't actually run the test codes but I think the root cause might be at [1], where:
uri = manifest.resolveFromOrigin(aMessage[messageName]);
will directly return the app's default origin which can also be valid to register. Later, when broadcasting the 'push' system message, it will open up the /index.html since it's the default launch path.
It sounds easy to fix. Just skip the empty handler path and don't register for it.
[1] https://hg.mozilla.org/mozilla-central/file/3d40d270c031/dom/apps/src/Webapps.jsm#l546
Blocks: system-message-api
Flags: needinfo?(gene.lian)
Comment 3•10 years ago
|
||
This one might be what you can support. Could you take a look?
Assignee | ||
Comment 4•10 years ago
|
||
Assignee: nobody → selin
Attachment #8431489 -
Flags: review?(gene.lian)
Comment 5•10 years ago
|
||
Comment on attachment 8431489 [details] [diff] [review]
Patch v1
Review of attachment 8431489 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/apps/src/Webapps.jsm
@@ +661,2 @@
> let manifest = new ManifestHelper(aManifest, aApp.origin);
> let launchPath = Services.io.newURI(manifest.fullLaunchPath(aEntryPoint), null, null);
s/launchPath/launchPathURI/
@@ +661,3 @@
> let manifest = new ManifestHelper(aManifest, aApp.origin);
> let launchPath = Services.io.newURI(manifest.fullLaunchPath(aEntryPoint), null, null);
> let manifestURL = Services.io.newURI(aApp.manifestURL, null, null);
s/manifestURL/manifestURI/
@@ +661,5 @@
> let manifest = new ManifestHelper(aManifest, aApp.origin);
> let launchPath = Services.io.newURI(manifest.fullLaunchPath(aEntryPoint), null, null);
> let manifestURL = Services.io.newURI(aApp.manifestURL, null, null);
> root.messages.forEach(function registerPages(aMessage) {
> let href = launchPath;
s/href/handlerPageURI/
s/launchPath/launchPathURI/ (also another place within this file)
I prefer this because it explicitly specifies the var is for a URI object.
@@ +670,1 @@
> let uri;
Since you're here, could you s/uri/fullHandlerPath/?
@@ +672,5 @@
> + if (handlerPath && handlerPath.trim()) {
> + uri = manifest.resolveFromOrigin(handlerPath);
> + } else {
> + debug("system message url (" + handlerPath + ") is invalid, " +
> + "skipping. Error is: " + e);
We print the same debug message and return in separate places. Can we refatorize them by using a flag or something?
@@ +679,2 @@
> } catch(e) {
> + debug("system message url (" + handlerPath + ") is invalid, " +
s/url/handler path/
@@ +682,3 @@
> return;
> }
> href = Services.io.newURI(uri, null, null);
s/href/handlerPageURI/
s/uri/fullHandlerPath/
Attachment #8431489 -
Flags: review?(gene.lian)
Assignee | ||
Comment 6•10 years ago
|
||
Updating based on Gene's comments.
Attachment #8431489 -
Attachment is obsolete: true
Attachment #8433237 -
Flags: review?(gene.lian)
Comment 7•10 years ago
|
||
Comment on attachment 8433237 [details] [diff] [review]
Patch v2
Review of attachment 8433237 [details] [diff] [review]:
-----------------------------------------------------------------
Since you're here, could you make the similar change for _createActivitiesToRegister:
let launchPath*URI* = Services.io.newURI(href, null, null);
let manifest*URI* = Services.io.newURI(aApp.manifestURL, null, null);
...
msgmgr.registerPage("activity", launchPath*URI*, manifest*URI*);
Thank you! r=gene
Attachment #8433237 -
Flags: review?(gene.lian) → review+
Assignee | ||
Comment 8•10 years ago
|
||
Minor changes based on Gene's r+ comments.
Attachment #8433237 -
Attachment is obsolete: true
Assignee | ||
Comment 9•10 years ago
|
||
The correspondent try run for this patch.
https://tbpl.mozilla.org/?tree=Try&rev=cbd6b5537df3
Keywords: checkin-needed
Comment 10•10 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/d8da0c9c6733
In the future, try to use commit messages that summarize what the patch is actually doing rather than just restating the bug being fixed. Thanks :)
https://developer.mozilla.org/en-US/docs/Developer_Guide/Committing_Rules_and_Responsibilities#Checkin_comment
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.0 S3 (6june)
You need to log in
before you can comment on or make changes to this bug.
Description
•