Closed Bug 1015100 Opened 10 years ago Closed 10 years ago

Polish the Alarm API Mochitest

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: airpingu, Assigned: airpingu)

References

Details

Attachments

(3 files, 2 obsolete files)

      No description provided.
Since we already did this for add(), there is no reason for not doing so for remove() and getAll(). The Alarm API logic is relying on the valid manifest URL to manage alarms, so |manifestURL| has to be valid.
Just polished the logic of failed cases to avoid accessing the null domRequest:

TypeError: domRequest is undefined at http://mochi.test:8888/tests/dom/alarm/test/test_alarm_add_date.html:62
In bug 876980 and bug 867868, we already supported Alarm API for installed apps on Firefox desktop, so the check for b2g only here doesn't make sense. Polish the tests by introducing a more reasonable checking condition.
Attachment #8427666 - Attachment is obsolete: true
Comment on attachment 8427663 [details] [diff] [review]
Part 1, check manifestURL for getAll/remove (won't land)

Please see comment #1 for the summary.
Attachment #8427663 - Flags: review?(nsm.nikhil)
Comment on attachment 8427664 [details] [diff] [review]
Part 2, polish tests to avoid accessing null request

Please see comment #2 for the summary.
Attachment #8427664 - Flags: review?(me+bugzilla)
Comment on attachment 8427821 [details] [diff] [review]
Part 3, polish tests to not run on invalid builds, V2

Please see comment #3 for the summary.
Attachment #8427821 - Flags: review?(me+bugzilla)
Please comment #3 for the summary.
Attachment #8427821 - Attachment is obsolete: true
Attachment #8427821 - Flags: review?(me+bugzilla)
Attachment #8427824 - Flags: review?(me+bugzilla)
Comment on attachment 8427663 [details] [diff] [review]
Part 1, check manifestURL for getAll/remove (won't land)

Review of attachment 8427663 [details] [diff] [review]:
-----------------------------------------------------------------

r+ for the code, but while this does make the API uniform, it breaks the API contract. remove() and getAll() initially promised not to throw. :)
Do we have a policy in b2g for when we break APIs? Which release will this land in?

Please ask a b2g/webapi owner/peer about this.
Attachment #8427663 - Flags: review?(nsm.nikhil)
Attachment #8427664 - Flags: review?(me+bugzilla) → review+
Attachment #8427824 - Flags: review?(me+bugzilla) → review+
(In reply to Nikhil Marathe [:nsm] (needinfo? please) from comment #11)
> Comment on attachment 8427663 [details] [diff] [review]
> Part 1, check manifestURL for getAll/remove
> 
> Review of attachment 8427663 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> r+ for the code, but while this does make the API uniform, it breaks the API
> contract. remove() and getAll() initially promised not to throw. :)
> Do we have a policy in b2g for when we break APIs? Which release will this
> land in?
> 
> Please ask a b2g/webapi owner/peer about this.

Yeap, after some thoughts, I decide to not to land the part-1 patch, because:

1. If users already failed to call add() to add an alarm, they wouldn't attempt to call getAll() or remove() to manage an alarm that has been added.

2. If users want to call getAll()/remove() without calling add() first, in the original codes it would just do nothing. Adding a throw might break the apps in the field.

To avoid breaking the compatibility in the field, we'd better not to do this change.
Attachment #8427663 - Attachment description: Part 1, check manifestURL for getAll/remove → Part 1, check manifestURL for getAll/remove (won't land)
Btw, if we still hope to throw for getAll()/remove(), I tend to fire another bug for it. Let this bug just polish the tests only.
Flags: in-testsuite+
https://hg.mozilla.org/mozilla-central/rev/c1cc2ffe8bfd
https://hg.mozilla.org/mozilla-central/rev/9aa3042c0023
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: