Closed Bug 1005093 Opened 10 years ago Closed 10 years ago

Notification System message not sent as expected

Categories

(Firefox OS Graveyard :: Runtime, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.0 S1 (9may)

People

(Reporter: gerard-majax, Assigned: gerard-majax)

References

Details

(Keywords: regression, Whiteboard: [systemsfe])

Attachments

(1 file, 1 obsolete file)

While rebasing bug 967475 after bug 963234 landed, I noticed that the function  getNotificationURLFor() in b2g/components/AlertsHelper.jsm sometimes returns undefined value.

The code is the following:
>         let getNotificationURLFor = function(messages) {
>           if (!messages) {
>             return null;
>           }
>       
>           for (let i = 0; i < messages.length; i++) {
>             let message = messages[i];
>             if (message === kNotificationSystemMessageName) {
>               return helper.fullLaunchPath();
>             } else if (typeof message === "object" &&
>                        kNotificationSystemMessageName in message) {
>               return
>                 helper.resolveFromOrigin(message[kNotificationSystemMessageName]);
>             }
>           }
>   
>           // No message found...
>           return null;
>         }   

However, adding an intermediate variable when doing the helper.resolveFromOrigin() call makes the problem go totally away:

>         let getNotificationURLFor = function(messages) {
>           if (!messages) {
>             return null;
>           }
>       
>           for (let i = 0; i < messages.length; i++) {
>             let message = messages[i];
>             if (message === kNotificationSystemMessageName) {
>               return helper.fullLaunchPath();
>             } else if (typeof message === "object" &&
>                        kNotificationSystemMessageName in message) {
>               let retval =   helper.resolveFromOrigin(message[kNotificationSystemMessageName]);
>               return retval;
>             }
>           }
>   
>           // No message found...
>           return null;
>         }
Jason, Nicolas checked this and it seems to be a legitimate JS bug: we lack the setrval/retrval when looking at the disassembly of the first code.
Flags: needinfo?(jorendorff)
Attached file JS shell test case. (obsolete) —
No bug, I'm afraid. It's automatic semicolon insertion. An semicolon is being automatically inserted at the end of the line that says
>               return

According to the standard, you can't have a line break between the 'return' keyword and the value in a return statement. See <http://people.mozilla.org/~jorendorff/es6-draft.html#sec-rules-of-automatic-semicolon-insertion> for all the gruesome details...
(In reply to Jason Orendorff [:jorendorff] from comment #3)
> No bug, I'm afraid. It's automatic semicolon insertion. An semicolon is
> being automatically inserted at the end of the line that says
> >               return
> 
> According to the standard, you can't have a line break between the 'return'
> keyword and the value in a return statement. See
> <http://people.mozilla.org/~jorendorff/es6-draft.html#sec-rules-of-automatic-
> semicolon-insertion> for all the gruesome details...

Ooops, sorry :).

Well, there's still a bug I should fix.
Assignee: nobody → lissyx+mozillians
Component: JavaScript Engine: JIT → General
Product: Core → Firefox OS
Version: Trunk → unspecified
As far as I could check the code, I have not been able to find a proper way to test this on Gecko side.
Flags: needinfo?(jorendorff) → needinfo?(mhenretty)
However, one of the integration tests added as part of bug 967475 exposes the issue.
Fabrice, sorry for missing this one in the previous patch.
Attachment #8416544 - Attachment is obsolete: true
Attachment #8416646 - Flags: review?(fabrice)
Component: General → Runtime
Whiteboard: [systemsfe]
Target Milestone: --- → 2.0 S1 (9may)
Comment on attachment 8416646 [details] [diff] [review]
0001-Bug-1005093-Fix-return-code-path-of-getNotificationU.patch

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

oh my. stoopid js.
Attachment #8416646 - Flags: review?(fabrice) → review+
(In reply to Alexandre LISSY :gerard-majax from comment #5)
> As far as I could check the code, I have not been able to find a proper way
> to test this on Gecko side.

Honestly, since this is b2g specific code I think Gaia integration tests are what we ultimately want for this. I'd say we add the Gi test from bug 967475 that exposes this issue to this bug. These tests now run on all main branches in TBPL, so this should prevent the regressions we are looking to expose.
Flags: needinfo?(mhenretty)
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/056cbea8ea3a
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: