Closed
Bug 1090896
Opened 10 years ago
Closed 10 years ago
Omitting data parameter in mozAlarms.add() method results in NS_ERROR_UNEXPECTED error
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
RESOLVED
FIXED
mozilla36
People
(Reporter: salva, Assigned: selin)
References
Details
(Keywords: regression)
Attachments
(2 files, 1 obsolete file)
1.18 KB,
application/x-zip-compressed
|
Details | |
5.59 KB,
patch
|
selin
:
review+
|
Details | Diff | Splinter Review |
According to documentation [1], parameter `data` of `navigator.mozAlarms.add()` method is optional but omitting it results in NS_ERROR_UNEXPECTED error.
Please, find an attached demo app which demonstrates this issue. Observe the console output when tapping on the first button.
[1] https://developer.mozilla.org/en-US/docs/Web/API/MozAlarmsManager.add
Component: DOM → DOM: Device Interfaces
![]() |
||
Comment 1•10 years ago
|
||
This is a regression from bug 1015540 and bug 1037079.
The problem is that JSON.stringify(undefined) returns undefined, so JSON.parse(JSON.stringify(undefined)) throws.
We should skip the sandbox stuff if aData is undefined.... And clearly we need better tests here.
Flags: needinfo?(selin)
![]() |
||
Updated•10 years ago
|
Blocks: 1037079, CVE-2014-1583
Keywords: regression
Assignee | ||
Comment 2•10 years ago
|
||
Fixing the issue and adding correspondent tests.
![]() |
||
Comment 3•10 years ago
|
||
Comment on attachment 8514042 [details] [diff] [review]
Patch v1
Thank you for writing the test.
>+ secondsLater.setSeconds(secondsLater.getSeconds() + 10);
Why 10, not 1 or 0.01? There's no reason to wait for 10s here during a test run.
>+ SimpleTest.expectAssertions(0, 9);
Why are there assertions? Because you reload the window?
I suggest avoiding the reloading business (which is liable to confuse the test harness badly) by running the parts of the test that depend on the permission bit in an iframe. Add the permission, then load the iframe, which should then be able to do stuff with the alarms API. That should work, no?
r=me with the tests fixed up
Attachment #8514042 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 4•10 years ago
|
||
Updating based on r+ comments.
Attachment #8514042 -
Attachment is obsolete: true
Attachment #8516405 -
Flags: review+
Assignee | ||
Comment 5•10 years ago
|
||
The latest try-run. FYI.
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=ba3071481b06
Keywords: checkin-needed
Comment 6•10 years ago
|
||
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in
before you can comment on or make changes to this bug.
Description
•