On Wednesday, October 22, 2014 12:48:44 PM UTC+2, Jan Jongboom wrote:
> I have the following code and paste it in Console and then turn screen off 
> (no CPU locks active) and plug out the USB.
> 
> 
> 
> navigator.mozSetMessageHandler('alarm', function gotAlarm(message) {
> 
>   console.log(new Date(), 'alarm setmessagehandler', message.data);
> 
>   nextAlarm();
> 
> });
> 
> function nextAlarm() {
> 
>   var next = new Date(Date.now() + 3000);
> 
>   navigator.mozAlarms.add(next, 'ignoreTimezone', { data: 'yolo' });
> 
> }
> 
> nextAlarm();
> 
> 
> 
> After a while I turn the screen back on. When I run this in Clock app 
> everything is fine. I see a log message for every 3 seconds in the log.
> 
> 
> 
> When I do the same in the system app it stops logging anything when the 
> screen is off and USB is plugged out.
> 
> 
> 
> Is mozAlarms behavior different in System than in content apps or do I miss a 
> permission?

I created a new application with alarm permission that does the above thing (as 
normal Gaia application), and logged the following from Gecko layer. These are 
two instances where the alarm fires, the first one is fine, the second one is 
wrong.

1413989021646 AlarmService: _onAlarmFired() 
{"date":"2014-10-22T14:43:41.183Z","ignoreTimezone":true,"data":"yolo12","pageURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/index.html","manifestURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/manifest.webapp","timezoneOffset":240,"id":837,"alarmFiredCb":null}
1413989021646 AlarmService: _removeAlarmFromDb()
1413989021648 AlarmService: _notifyAlarmObserver() _onAlarmFired
1413989021648 AlarmService: Fire system message: 
{"date":"2014-10-22T14:43:41.183Z","ignoreTimezone":true,"data":"yolo12","pageURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/index.html","manifestURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/manifest.webapp","timezoneOffset":240,"id":837,"alarmFiredCb":null}
1413989021675 AlarmService: Current alarm: 
{"date":"2014-10-22T14:53:36.855Z","ignoreTimezone":true,"data":"wifi-off","pageURL":"app://system.gaiamobile.org/index.html","manifestURL":"app://system.gaiamobile.org/manifest.webapp","timezoneOffset":240,"id":838,"alarmFiredCb":null}
1413989021675 AlarmService: Alarm queue: []
1413989021823 AlarmService: Remove alarm from DB successfully.
1413989021922 AlarmService: receiveMessage(): AlarmsManager:Add
1413989021927 AlarmService: add(Wed Oct 22 2014 10:43:46 GMT-0400 
(EDT)){"date":"2014-10-22T14:43:46.912Z","ignoreTimezone":true,"data":"yolo12","pageURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/index.html","manifestURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/manifest.webapp"}
1413989021970 AlarmService: Callback after adding alarm in database.
1413989021973 AlarmService: Current alarm: 
{"date":"2014-10-22T14:43:46.912Z","ignoreTimezone":true,"data":"yolo12","pageURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/index.html","manifestURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/manifest.webapp","timezoneOffset":240,"id":839,"alarmFiredCb":null}
1413989021974 AlarmService: Alarm queue: 
[{"date":"2014-10-22T14:53:36.855Z","ignoreTimezone":true,"data":"wifi-off","pageURL":"app://system.gaiamobile.org/index.html","manifestURL":"app://system.gaiamobile.org/manifest.webapp","timezoneOffset":240,"id":838,"alarmFiredCb":null}]
1413989021974 AlarmService: _sendAsyncMessage()

1413989026920 AlarmService: _onAlarmFired() 
{"date":"2014-10-22T14:43:46.912Z","ignoreTimezone":true,"data":"yolo12","pageURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/index.html","manifestURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/manifest.webapp","timezoneOffset":240,"id":839,"alarmFiredCb":null}
1413989026967 AlarmService: _removeAlarmFromDb()
1413989026973 AlarmService: _notifyAlarmObserver() _onAlarmFired
1413989026974 AlarmService: Fire system message: 
{"date":"2014-10-22T14:43:46.912Z","ignoreTimezone":true,"data":"yolo12","pageURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/index.html","manifestURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/manifest.webapp","timezoneOffset":240,"id":839,"alarmFiredCb":null}
1413989026995 AlarmService: Current alarm: 
{"date":"2014-10-22T14:53:36.855Z","ignoreTimezone":true,"data":"wifi-off","pageURL":"app://system.gaiamobile.org/index.html","manifestURL":"app://system.gaiamobile.org/manifest.webapp","timezoneOffset":240,"id":838,"alarmFiredCb":null}
1413989026996 AlarmService: Alarm queue: []
1413989051007 AlarmService: Remove alarm from DB successfully.
1413989051024 AlarmService: receiveMessage(): AlarmsManager:Add
1413989051027 AlarmService: add(Wed Oct 22 2014 10:44:16 GMT-0400 
(EDT)){"date":"2014-10-22T14:44:16.012Z","ignoreTimezone":true,"data":"yolo12","pageURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/index.html","manifestURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/manifest.webapp"}
1413989084328 AlarmService: Callback after adding alarm in database.
1413989084330 AlarmService: Current alarm: 
{"date":"2014-10-22T14:44:16.012Z","ignoreTimezone":true,"data":"yolo12","pageURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/index.html","manifestURL":"app://387541ce-f1a6-1d4d-82df-a788cc9432bd/manifest.webapp","timezoneOffset":240,"id":840,"alarmFiredCb":null}
1413989084330 AlarmService: Alarm queue: 
[{"date":"2014-10-22T14:53:36.855Z","ignoreTimezone":true,"data":"wifi-off","pageURL":"app://system.gaiamobile.org/index.html","manifestURL":"app://system.gaiamobile.org/manifest.webapp","timezoneOffset":240,"id":838,"alarmFiredCb":null}]
1413989084331 AlarmService: _sendAsyncMessage()

As you can see in the trace there is a gap of 24s. where nothing is executed, 
the _removeAlarmFromDb function also just hangs there for that long. Looks like 
our processes is paused or something. I have no clue what's going on here.
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to