Accessing the mozAlarms WebAPI after initial flash in a web app with the alarms permission - app is having problems error is seen

RESOLVED WORKSFORME

Status

RESOLVED WORKSFORME
6 years ago
6 years ago

People

(Reporter: jsmith, Assigned: airpingu)

Tracking

({testcase})

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
Steps:

1. Install a web app that calls out support for the alarms permission
2. Launch the web app
3. Access web content that accesses mozAlarms.add

Expected:

I should receive an InvalidStateError.

Actual:

I get an error indicating that my app is having problems.

Note - This only happens after an initial flash on immediate access to the site in the app (and is reproducible). if I access the content again after restarting the app process, then I will not get the error.

Nothing really in the logcat, although I did see:

11-26 22:41:46.809: E/GeckoConsole(110): [JavaScript Warning: "XUL box for p element contained an inline span child, forcing all its children to be wrapped in a block." {file: "app://system.gaiamobile.org/js/statusbar.js" line: 60}]

But I don't think that's relevant.

References:

App Install -  http://www.se.rit.edu/~jds2501/appinstall.html
Manifest - http://www.se.rit.edu/~jds2501/manifest.webapp
Alarm - http://www.se.rit.edu/~jds2501/alarmtest.html
(Reporter)

Comment 1

6 years ago
Noming cause this is a basic use case with the alarms web api that appears to be failing out on first access within a web app that requested the alarms permission.
blocking-basecamp: --- → ?
Keywords: testcase
(Assignee)

Updated

6 years ago
Assignee: nobody → clian
(Assignee)

Updated

6 years ago
Blocks: 749551
(In reply to Jason Smith [:jsmith] from comment #0)

Hi Jason,

Thanks for addressing this issue but I had difficulties understanding your bug descriptions.

> Steps:
> 
> 1. Install a web app that calls out support for the alarms permission

Let me confirm this first. So you mean you have already installed the "alarms" permission...

> 2. Launch the web app
> 3. Access web content that accesses mozAlarms.add
> 
> Expected:
> 
> I should receive an InvalidStateError.

But you expect an error returned? why?

> 
> Actual:
> 
> I get an error indicating that my app is having problems.

What kind of error?

> 
> Note - This only happens after an initial flash on immediate access to the
> site in the app (and is reproducible). if I access the content again after
> restarting the app process, then I will not get the error.

I think it should have nothing to do with whether it's first use or second use. Basically, if you don't specify "alarms" permission in the manifest then the navigator.mozAlarms will return *null* to you, which means when you call mozAlarms.XXX(), it's invalid to do that.
Ok, I suppose you did get an error which is exactly the "InvalidStateError", then I'd say that is expected. Because in your sample codes:

var request = navigator.mozAlarms.add(new Date("May 15, 2012 16:20:00"), "ignoreTimezone", { mydata: "bar" });

You were trying to add a Date object that has a passing time (compared to the current time), then the mozAlarms.add() will return you an "InvalidStateError" to tell you it's illegal to add such an alarm which is impossible to fire in the future.
(Reporter)

Comment 4

6 years ago
(In reply to Gene Lian [:gene] from comment #2)
> (In reply to Jason Smith [:jsmith] from comment #0)
> 
> Hi Jason,
> 
> Thanks for addressing this issue but I had difficulties understanding your
> bug descriptions.
> 
> > Steps:
> > 
> > 1. Install a web app that calls out support for the alarms permission
> 
> Let me confirm this first. So you mean you have already installed the
> "alarms" permission...

I installed an app that called out support for the alarms permission. Exact manifest here - http://www.se.rit.edu/~jds2501/manifest.webapp.

> 
> > 2. Launch the web app
> > 3. Access web content that accesses mozAlarms.add
> > 
> > Expected:
> > 
> > I should receive an InvalidStateError.
> 
> But you expect an error returned? why?

Looks like this is answered in comment 3.

> 
> > 
> > Actual:
> > 
> > I get an error indicating that my app is having problems.
> 
> What kind of error?

It's general error page you get in FF OS for some unknown error. 

> 
> > 
> > Note - This only happens after an initial flash on immediate access to the
> > site in the app (and is reproducible). if I access the content again after
> > restarting the app process, then I will not get the error.
> 
> I think it should have nothing to do with whether it's first use or second
> use. Basically, if you don't specify "alarms" permission in the manifest
> then the navigator.mozAlarms will return *null* to you, which means when you
> call mozAlarms.XXX(), it's invalid to do that.

Right...I did that. See the manifest file.
So is this expected behaviour?
Flags: needinfo?
Hi Jason,

I'm trying to reproduce your bug by the following steps:

  1. Build and flash the latest B2G into the device.
  2. Use the browser to open http://www.se.rit.edu/~jds2501/appinstall.html.
  3. Tap the "Install App" button and install the "MozQA Runtime Test Cases".
  4. Tap the new icon "MozQA Runtime Test Cases" to launch that app.
  5. I got an "Index of /~jds2501" page and chose the "alarmtest.html".
  7. I can successfully got an InvalidStateError alert page, which is expected.

Later, I kill the "MozQA Runtime Test Cases" app by the task manager and relaunch it. Do the above-mentioned steps 4~7. Again, I can still get the InvalidStateError alert page.

I had difficulties reproducing your bug. Could you please let me know if I wrongly did any steps or misunderstood your bug descriptions? Thanks!
Flags: needinfo? → needinfo?(jsmith)
(Reporter)

Comment 7

6 years ago
Weird...I can't reproduce it anymore. Don't know why. Oh well.
blocking-basecamp: ? → ---
Flags: needinfo?(jsmith)
(Reporter)

Updated

6 years ago
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.