Mounir Lamouri (:mounir) <
mou...@lamouri.fr> has canceled Gene Lian [:gene]
<
cl...@mozilla.com>'s request for superreview:
------- Additional Comments from Mounir Lamouri (:mounir) <
mou...@lamouri.fr>
Review of attachment 634835:
-----------------------------------------------------------------
I'm not really convinced that it is a good idea to never allow alarms for the
app if the first request failed. It's no big deal for the moment because it
seems that we are going to have an implicit authorization model for alarms.
BTW, what about not showing 'mozAlarms' on non-B2G targets? Jonas, what do you
think of that?
::: dom/alarm/AlarmsManager.js
@@ +34,5 @@
> + flags: nsIClassInfo.DOM_OBJECT }),
> +
> + add: function add(aDate, aRespectTimezone, aData) {
> + if (!this.hasPrivileges)
> + throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
You don't want to return this error here because the method is actually
implemented.
Usually, we assume that if the app was able to get the object, it should just
be able to use it so you should not even check what you are checking.
@@ +36,5 @@
> + add: function add(aDate, aRespectTimezone, aData) {
> + if (!this.hasPrivileges)
> + throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
> +
> + return this.createRequest();
Please, do |return null;| instead. No need to return a request we would leak.
@@ +41,5 @@
> + },
> +
> + remove: function remove(aId) {
> + if (!this.hasPrivileges)
> + throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
ditto
@@ +48,5 @@
> + },
> +
> + getAll: function getAll() {
> + if (!this.hasPrivileges)
> + throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
ditto
@@ +50,5 @@
> + getAll: function getAll() {
> + if (!this.hasPrivileges)
> + throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
> +
> + return this.createRequest();
Please, do |return null;| instead. No need to return a request we would leak.
@@ +65,5 @@
> +
> + let perm = principal == secMan.getSystemPrincipal() ?
> + Ci.nsIPermissionManager.ALLOW_ACTION :
Services.perms.testExactPermission(principal.URI, "alarms");
> +
> + //only pages with perm set can use the alarms
nit: // Only pages [...] alarms.
::: dom/alarm/Makefile.in
@@ +29,5 @@
> +endif
> +
> +# Add VPATH to LOCAL_INCLUDES so we are going to include the correct backend
> +# subdirectory (and the ipc one).
> +LOCAL_INCLUDES += $(VPATH:%=-I%)
You don't need that.
@@ +32,5 @@
> +# subdirectory (and the ipc one).
> +LOCAL_INCLUDES += $(VPATH:%=-I%)
> +
> +include $(topsrcdir)/config/
config.mk
> +include $(topsrcdir)/ipc/chromium/
chromium-config.mk
I doubt you need that line too.
@@ +35,5 @@
> +include $(topsrcdir)/config/
config.mk
> +include $(topsrcdir)/ipc/chromium/
chromium-config.mk
> +include $(topsrcdir)/config/
rules.mk
> +
> +DEFINES += -D_IMPL_NS_LAYOUT
... and also that one.
::: dom/alarm/test/test_alarm_non_permitted_app.html
@@ +12,5 @@
> +<script type="application/javascript">
> +
> +"use strict";
> +
> +SpecialPowers.setBoolPref("dom.mozAlarms.enabled", true);
Please use pushPrefEnv instead. So, we are sure the pref is pushed back to its
previous value.
::: dom/alarm/test/test_alarm_permitted_app.html
@@ +12,5 @@
> +<script type="application/javascript">
> +
> +"use strict";
> +
> +SpecialPowers.setBoolPref("dom.mozAlarms.enabled", true);
Please use pushPrefEnv instead. So, we are sure the pref is pushed back to its
previous value.
@@ +13,5 @@
> +
> +"use strict";
> +
> +SpecialPowers.setBoolPref("dom.mozAlarms.enabled", true);
> +SpecialPowers.addPermission("alarms", true, document);
Make sure to remove the permission at the end of the test.