Closed Bug 802876 Opened 12 years ago Closed 11 years ago

navigator.mozHasPendingMessage('alarm') has stopped working

Categories

(Core :: DOM: Core & HTML, defect)

Other
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME
blocking-kilimanjaro ?
blocking-basecamp -

People

(Reporter: jmcf, Assigned: airpingu)

References

Details

Attachments

(1 file)

Attached file Test case
Using Gecko build 1ec4bde 

navigator.mozHasPendingMessageAlarm is returning false when an alarm is delivered. See the attached test case
can you provide a regression window?
Assignee: nobody → clian
Hi Jose,

At my first glance, I think you probably misunderstand the usage of .mozHasPendingMessage(). We only have pending alarm messages when the alarm message is fired but the app is not yet opened to handle that.

In your example, you can directly call .mozSetMessageHandler() without checking the pending messages first. You won't get any pending messages at this point because the alarm is going to fire after 1 min.
(In reply to Gene Lian [:gene] from comment #2)
> Hi Jose,
> 
> At my first glance, I think you probably misunderstand the usage of
> .mozHasPendingMessage(). We only have pending alarm messages when the alarm
> message is fired but the app is not yet opened to handle that.
> 

If the app is not yet opened the app cannot do anything. mozHasPendingMessage should return true if an alarm has been raised and it has not been acknowledged yet by the app. Furthermore, the point is that it was working three or four builds ago and now is not working. 

> In your example, you can directly call .mozSetMessageHandler() without
> checking the pending messages first. You won't get any pending messages at
> this point because the alarm is going to fire after 1 min.

You have misunderstood my example. There are some use cases on which you need to know if a page has been invoked because an alarm has been gone off or for other reason. The one minute timeout is only an example. What it is actually failing is that when the alarm has been raised navigator.mozHasPendingMessage('alarm') is returning false.
I think some STR would be great.
I assume you open the app, create the alarm by clicking on the button, kill the app and wait for the alarm to open the app again. But I'm only assuming...
Component: General → DOM: Mozilla Extensions
Product: Boot2Gecko → Core
Target Milestone: DeveloperPhone → ---
I just used the Clock app to try to reproduce this bug by calling .mozHasPendingMessage() as below:

    var temp = navigator.mozHasPendingMessage('alarm');
    console.log("gene test: " + temp);
    navigator.mozSetMessageHandler('alarm', function gotMessage(message) {
      self.onAlarmFiredHandler(message);
    });

Obviously, the first print must be "false" when opening the Clock app at the first time. Later, I set an alarm and kill the app. When the alarm goes off, the second print shows "true" which is expected. It seems .mozHasPendingMessage() works well for me.
Flags: needinfo?(jmcf)
(In reply to Naoki Hirata :nhirata from comment #6)
> Is this related to bug 796255?

Thanks for pointing this out, but I don't think they would have relations. The Clock app didn't use .mozHasPendingMessage() at all.
thanks for all your comments. 

Today I have tried with Gecko build 43b9264 and initially started working. After some executions it stopped working and then after a make reset-gaia and a phone reboot it resumed working.Thus, it seems there is something wrong that makes it to work randomly. I checked over the Gaia code and realized that the only apps that make use of mozHasPendingMessage('alarm') are e-mail and the Facebook deep integration, thus there might be a bug as maybe that functionality has not been intensively tested till now.
Flags: needinfo?(jmcf)
(In reply to Jose M. Cantera from comment #8)
> I checked over the Gaia code and
> realized that the only apps that make use of mozHasPendingMessage('alarm')
> are e-mail and the Facebook deep integration, thus there might be a bug as
> maybe that functionality has not been intensively tested till now.

The clock app doesn't use it?
(In reply to Mounir Lamouri (:mounir) from comment #9)
> The clock app doesn't use it?

No, it doesn't. Maybe Ian can elaborate more on why it is.
(In reply to Jose M. Cantera from comment #8)
> Today I have tried with Gecko build 43b9264 and initially started working.
> After some executions it stopped working and then after a make reset-gaia
> and a phone reboot it resumed working.Thus, it seems there is something
> wrong that makes it to work randomly. I checked over the Gaia code and
> realized that the only apps that make use of mozHasPendingMessage('alarm')
> are e-mail and the Facebook deep integration, thus there might be a bug as
> maybe that functionality has not been intensively tested till now.

Thanks Jose for the testings. Well, I have no idea how to further investigate this issue if we couldn't reproduce that. At least, it works for me so far. ;)

Fabrice, any quick thoughts about the random effect at comment 8?
Based on comment #8 which seems to indicate things are now working (perhaps randomly?), not blocking.
blocking-basecamp: ? → -
Temporally remove the tags for blocking and keep track of this issue.
Severity: blocker → normal
Priority: P1 → --
Let's close this one where the bug cannot be reproduced and the .mozHasPendingMessage("alarm") is actually working. Please let me know if we need to reopen this issue.
Blocks: alarm-api
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Component: DOM: Mozilla Extensions → DOM
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: