Created attachment 8513405 [details] Test application to show the NS_ERROR_UNEXPECTED error when `data` parameter is not provided According to documentation , 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.  https://developer.mozilla.org/en-US/docs/Web/API/MozAlarmsManager.add
Component: DOM → DOM: Device Interfaces
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.
Created attachment 8514042 [details] [diff] [review] Patch v1 Fixing the issue and adding correspondent tests.
Assignee: nobody → selin
Attachment #8514042 - Flags: review?(bzbarsky)
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+
Created attachment 8516405 [details] [diff] [review] Patch v2 Updating based on r+ comments.
The latest try-run. FYI. https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=ba3071481b06
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.