Closed Bug 821138 Opened 12 years ago Closed 12 years ago

Alarm API - getAll() returning me an empty object

Categories

(Core :: DOM: Device Interfaces, defect)

18 Branch
ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: aaronmt, Unassigned)

References

Details

When I call `getAll()` through `window.navigator.mozAlarms`, I get back an empty object. I have setup a variety of Gaia (Clock) alarms to test this out.

var req = window.navigator.mozAlarms.getAll();
req.onsuccess = function() {
  console.log(Object.keys(req.result).length === 0) //true
}

What are the conditions in which `getAll()` will work?
Based on you description, I think it's highly possible due to the FAQ #3 at [1]. You can only use .getAll() to get the alarms that have been added by the same app because of the security issue. Please let me know if this solves your problem or not. Thanks!

[1] https://wiki.mozilla.org/WebAPI/AlarmAPI
Blocks: alarm-api
Flags: needinfo?(aaron.train)
Btw, if all the added alarms have been fired, then .getAll() will also return nothing.
#3 is my issue; thanks!
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: needinfo?(aaron.train)
Resolution: --- → WORKSFORME
I guess my next issue is that the result attribute from the DOMRequest object I'm getting back from .getAll() is still empty: [{},{},{}] (3 alarms set-up). Any idea?
It's likely a real object, just one that doesn't JSON-ify for your logging.
(In reply to Aaron Train [:aaronmt] from comment #4)
> I guess my next issue is that the result attribute from the DOMRequest
> object I'm getting back from .getAll() is still empty: [{},{},{}] (3 alarms
> set-up). Any idea?

I think it's a potential bug. Thanks for pointing out. We need to wrap the objects respecting to the content window. Fire Bug 821633.
You need to log in before you can comment on or make changes to this bug.