author | Gene Lian <clian@mozilla.com> |
Tue, 03 Jul 2012 11:26:12 +0200 | |
changeset 98177 | 07425f0e921ec0f55739e5039a1b0abb1844f957 |
parent 98176 | 3175d72d8a40878ee9e030f31672a421649ad597 |
child 98178 | 1e90805d96aab9f2c29431908b722cfb51107847 |
push id | 23036 |
push user | ryanvm@gmail.com |
push date | Tue, 03 Jul 2012 23:04:46 +0000 |
treeherder | mozilla-central@477d807660d7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mounir, jonas |
bugs | 749551 |
milestone | 16.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -373,16 +373,19 @@ pref("dom.ipc.tabs.disabled", false); pref("dom.ipc.browser_frames.oop_by_default", false); // Temporary permission hack for WebSMS pref("dom.sms.enabled", true); // Temporary permission hack for WebContacts pref("dom.mozContacts.enabled", true); +// WebAlarms +pref("dom.mozAlarms.enabled", true); + // WebSettings pref("dom.mozSettings.enabled", true); // Ignore X-Frame-Options headers. pref("b2g.ignoreXFrameOptions", true); // controls if we want camera support pref("device.camera.enabled", true);
--- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -46,17 +46,17 @@ XPCOMUtils.defineLazyGetter(this, 'Debug // until we have a proper security model, add some rights to // the pre-installed web applications // XXX never grant 'content-camera' to non-gaia apps function addPermissions(urls) { let permissions = [ 'indexedDB', 'indexedDB-unlimited', 'webapps-manage', 'offline-app', 'pin-app', 'websettings-read', 'websettings-readwrite', 'content-camera', 'webcontacts-manage', 'wifi-manage', 'desktop-notification', - 'geolocation', 'device-storage' + 'geolocation', 'device-storage', 'alarms' ]; urls.forEach(function(url) { url = url.trim(); let uri = Services.io.newURI(url, null, null); let allow = Ci.nsIPermissionManager.ALLOW_ACTION; permissions.forEach(function(permission) { Services.perms.add(uri, permission, allow);
--- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -156,16 +156,17 @@ @BINPATH@/components/dom_system_gonk.xpt #endif @BINPATH@/components/dom_battery.xpt #ifdef MOZ_B2G_BT @BINPATH@/components/dom_bluetooth.xpt #endif @BINPATH@/components/dom_canvas.xpt @BINPATH@/components/dom_contacts.xpt +@BINPATH@/components/dom_alarm.xpt @BINPATH@/components/dom_core.xpt @BINPATH@/components/dom_css.xpt @BINPATH@/components/dom_devicestorage.xpt @BINPATH@/components/dom_events.xpt @BINPATH@/components/dom_file.xpt @BINPATH@/components/dom_geolocation.xpt @BINPATH@/components/dom_media.xpt @BINPATH@/components/dom_network.xpt @@ -312,16 +313,18 @@ ; JavaScript components @BINPATH@/components/ConsoleAPI.manifest @BINPATH@/components/ConsoleAPI.js @BINPATH@/components/BrowserElementParent.manifest @BINPATH@/components/BrowserElementParent.js @BINPATH@/components/ContactManager.js @BINPATH@/components/ContactManager.manifest +@BINPATH@/components/AlarmsManager.js +@BINPATH@/components/AlarmsManager.manifest @BINPATH@/components/FeedProcessor.manifest @BINPATH@/components/FeedProcessor.js @BINPATH@/components/BrowserFeeds.manifest @BINPATH@/components/FeedConverter.js @BINPATH@/components/FeedWriter.js @BINPATH@/components/fuelApplication.manifest @BINPATH@/components/fuelApplication.js @BINPATH@/components/WebContentConverter.js
--- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -167,16 +167,17 @@ @BINPATH@/components/dom_system_gonk.xpt #endif @BINPATH@/components/dom_battery.xpt #ifdef MOZ_B2G_BT @BINPATH@/components/dom_bluetooth.xpt #endif @BINPATH@/components/dom_canvas.xpt @BINPATH@/components/dom_contacts.xpt +@BINPATH@/components/dom_alarm.xpt @BINPATH@/components/dom_core.xpt @BINPATH@/components/dom_css.xpt @BINPATH@/components/dom_devicestorage.xpt @BINPATH@/components/dom_events.xpt @BINPATH@/components/dom_file.xpt @BINPATH@/components/dom_geolocation.xpt @BINPATH@/components/dom_media.xpt @BINPATH@/components/dom_network.xpt @@ -466,16 +467,18 @@ @BINPATH@/components/SettingsManager.manifest @BINPATH@/components/Webapps.js @BINPATH@/components/Webapps.manifest @BINPATH@/components/AppsService.js @BINPATH@/components/AppsService.manifest @BINPATH@/components/ContactManager.js @BINPATH@/components/ContactManager.manifest +@BINPATH@/components/AlarmsManager.js +@BINPATH@/components/AlarmsManager.manifest #ifdef ENABLE_MARIONETTE @BINPATH@/chrome/marionette@JAREXT@ @BINPATH@/chrome/marionette.manifest @BINPATH@/components/MarionetteComponents.manifest @BINPATH@/components/marionettecomponent.js #endif ; Modules
--- a/dom/Makefile.in +++ b/dom/Makefile.in @@ -45,16 +45,17 @@ DIRS += \ DIRS += \ apps \ base \ bindings \ battery \ browser-element \ contacts \ + alarm \ devicestorage \ file \ media \ messages \ power \ settings \ sms \ mms \
new file mode 100644 --- /dev/null +++ b/dom/alarm/AlarmsManager.js @@ -0,0 +1,75 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://gre/modules/DOMRequestHelper.jsm"); + +const ALARMSMANAGER_CONTRACTID = "@mozilla.org/alarmsManager;1"; +const ALARMSMANAGER_CID = Components.ID("{fea1e884-9b05-11e1-9b64-87a7016c3860}"); +const nsIDOMMozAlarmsManager = Ci.nsIDOMMozAlarmsManager; +const nsIClassInfo = Ci.nsIClassInfo; + +function AlarmsManager() +{ +} + +AlarmsManager.prototype = { + + __proto__: DOMRequestIpcHelper.prototype, + + classID : ALARMSMANAGER_CID, + + QueryInterface : XPCOMUtils.generateQI([nsIDOMMozAlarmsManager, Ci.nsIDOMGlobalPropertyInitializer]), + + classInfo : XPCOMUtils.generateCI({ classID: ALARMSMANAGER_CID, + contractID: ALARMSMANAGER_CONTRACTID, + classDescription: "AlarmsManager", + interfaces: [nsIDOMMozAlarmsManager], + flags: nsIClassInfo.DOM_OBJECT }), + + add: function add(aDate, aRespectTimezone, aData) { + return null; + }, + + remove: function remove(aId) { + return; + }, + + getAll: function getAll() { + return null; + }, + + // nsIDOMGlobalPropertyInitializer implementation + init: function init(aWindow) { + // Set navigator.mozAlarms to null. + if (!Services.prefs.getBoolPref("dom.mozAlarms.enabled")) + return null; + + let principal = aWindow.document.nodePrincipal; + let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager); + + let perm = principal == secMan.getSystemPrincipal() ? + Ci.nsIPermissionManager.ALLOW_ACTION : Services.perms.testExactPermission(principal.URI, "alarms"); + + // Only pages with perm set can use the alarms. + this.hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION; + + if (!this.hasPrivileges) + return null; + + // Add the valid messages to be listened. + this.initHelper(aWindow, []); + }, + + // Called from DOMRequestIpcHelper. + uninit: function uninit() { + }, +} + +const NSGetFactory = XPCOMUtils.generateNSGetFactory([AlarmsManager])
new file mode 100644 --- /dev/null +++ b/dom/alarm/AlarmsManager.manifest @@ -0,0 +1,3 @@ +component {fea1e884-9b05-11e1-9b64-87a7016c3860} AlarmsManager.js +contract @mozilla.org/alarmsManager;1 {fea1e884-9b05-11e1-9b64-87a7016c3860} +category JavaScript-navigator-property mozAlarms @mozilla.org/alarmsManager;1
new file mode 100644 --- /dev/null +++ b/dom/alarm/Makefile.in @@ -0,0 +1,33 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = dom +XPIDL_MODULE = dom_alarm +LIBRARY_NAME = domalarm_s +LIBXUL_LIBRARY = 1 + +include $(topsrcdir)/dom/dom-config.mk + +EXTRA_COMPONENTS = \ + AlarmsManager.js \ + AlarmsManager.manifest \ + $(NULL) + +XPIDLSRCS = \ + nsIDOMAlarmsManager.idl \ + $(NULL) + +ifdef ENABLE_TESTS +DIRS += test +endif + +include $(topsrcdir)/config/config.mk +include $(topsrcdir)/config/rules.mk
new file mode 100644 --- /dev/null +++ b/dom/alarm/nsIDOMAlarmsManager.idl @@ -0,0 +1,15 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "domstubs.idl" + +interface nsIDOMDOMRequest; + +[scriptable, uuid(fea1e884-9b05-11e1-9b64-87a7016c3860)] +interface nsIDOMMozAlarmsManager : nsISupports +{ + nsIDOMDOMRequest getAll(); + nsIDOMDOMRequest add(in jsval date, in DOMString respectTimezone, [optional] in jsval data); + void remove(in unsigned long id); +};
new file mode 100644 --- /dev/null +++ b/dom/alarm/test/Makefile.in @@ -0,0 +1,25 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +relativesrcdir = dom/alarm/test + +include $(DEPTH)/config/autoconf.mk + +DIRS = \ + $(NULL) + +include $(topsrcdir)/config/rules.mk + +_TEST_FILES = \ + test_alarm_permitted_app.html \ + test_alarm_non_permitted_app.html \ + $(NULL) + +libs:: $(_TEST_FILES) + $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644 --- /dev/null +++ b/dom/alarm/test/test_alarm_non_permitted_app.html @@ -0,0 +1,32 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test Non-Permitted Application for Alarm API</title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<p id="display"></p> +<div id="content" style="display: none"></div> +<pre id="test"> +<script type="application/javascript"> + +"use strict"; + +SimpleTest.waitForExplicitFinish(); + +SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() { + SpecialPowers.removePermission("alarms", document); + + var mozAlarms = navigator.mozAlarms; + + ok('mozAlarms' in navigator, "navigator.mozAlarms should exist"); + is(mozAlarms, null, "navigator.mozAlarms should return null"); + + SimpleTest.finish(); +}); + +</script> +</pre> +</body> +</html>
new file mode 100644 --- /dev/null +++ b/dom/alarm/test/test_alarm_permitted_app.html @@ -0,0 +1,35 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test Permitted Application for Alarm API</title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<p id="display"></p> +<div id="content" style="display: none"></div> +<pre id="test"> +<script type="application/javascript"> + +"use strict"; + +SimpleTest.waitForExplicitFinish(); + +SpecialPowers.pushPrefEnv({"set": [["dom.mozAlarms.enabled", true]]}, function() { + SpecialPowers.addPermission("alarms", true, document); + + var mozAlarms = navigator.mozAlarms; + + ok('mozAlarms' in navigator, "navigator.mozAlarms should exist"); + ok(mozAlarms, "navigator.mozAlarms should return an object"); + ok(mozAlarms instanceof Components.interfaces.nsIDOMMozAlarmsManager, + "navigator.mozAlarms should be an nsIDOMMozAlarmsManager object"); + + SpecialPowers.removePermission("alarms", document); + SimpleTest.finish(); +}); + +</script> +</pre> +</body> +</html>
--- a/dom/dom-config.mk +++ b/dom/dom-config.mk @@ -7,16 +7,17 @@ DOM_SRCDIRS = \ dom/battery \ dom/file \ dom/power \ dom/media \ dom/network/src \ dom/settings \ dom/sms/src \ dom/contacts \ + dom/alarm \ dom/src/events \ dom/src/storage \ dom/src/offline \ dom/src/geolocation \ dom/src/notification \ dom/workers \ content/xbl/src \ content/xul/document/src \
--- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -57,16 +57,17 @@ SHARED_LIBRARY_LIBS = \ $(DEPTH)/content/xslt/src/xpath/$(LIB_PREFIX)txxpath_s.$(LIB_SUFFIX) \ $(DEPTH)/content/xslt/src/xslt/$(LIB_PREFIX)txxslt_s.$(LIB_SUFFIX) \ $(DEPTH)/content/xbl/src/$(LIB_PREFIX)gkconxbl_s.$(LIB_SUFFIX) \ $(DEPTH)/content/xul/document/src/$(LIB_PREFIX)gkconxuldoc_s.$(LIB_SUFFIX) \ $(DEPTH)/view/src/$(LIB_PREFIX)gkview_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/base/$(LIB_PREFIX)jsdombase_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/battery/$(LIB_PREFIX)dom_battery_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/contacts/$(LIB_PREFIX)jsdomcontacts_s.$(LIB_SUFFIX) \ + $(DEPTH)/dom/alarm/$(LIB_PREFIX)domalarm_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/devicestorage/$(LIB_PREFIX)domdevicestorage_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/file/$(LIB_PREFIX)domfile_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/power/$(LIB_PREFIX)dom_power_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/settings/$(LIB_PREFIX)jsdomsettings_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/network/src/$(LIB_PREFIX)dom_network_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/media/$(LIB_PREFIX)dom_media_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/sms/src/$(LIB_PREFIX)dom_sms_s.$(LIB_SUFFIX) \ $(DEPTH)/dom/src/events/$(LIB_PREFIX)jsdomevents_s.$(LIB_SUFFIX) \
--- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -3572,16 +3572,19 @@ pref("dom.battery.enabled", true); // WebSMS pref("dom.sms.enabled", false); pref("dom.sms.whitelist", ""); // WebContacts pref("dom.mozContacts.enabled", false); pref("dom.mozContacts.whitelist", ""); +// WebAlarms +pref("dom.mozAlarms.enabled", false); + // WebSettings pref("dom.mozSettings.enabled", false); // enable JS dump() function. pref("browser.dom.window.dump.enabled", false); // SPS Profiler pref("profiler.enabled", false);
--- a/toolkit/toolkit-makefiles.sh +++ b/toolkit/toolkit-makefiles.sh @@ -30,16 +30,17 @@ MAKEFILES_dom=" dom/interfaces/sidebar/Makefile dom/interfaces/storage/Makefile dom/interfaces/stylesheets/Makefile dom/interfaces/svg/Makefile dom/interfaces/traversal/Makefile dom/interfaces/xbl/Makefile dom/interfaces/xpath/Makefile dom/interfaces/xul/Makefile + dom/alarm/Makefile dom/base/Makefile dom/battery/Makefile dom/file/Makefile dom/indexedDB/Makefile dom/ipc/Makefile dom/locales/Makefile dom/messages/Makefile dom/messages/interfaces/Makefile @@ -704,16 +705,17 @@ if [ "$ENABLE_TESTS" ]; then content/xml/document/test/Makefile content/xslt/tests/buster/Makefile content/xslt/tests/mochitest/Makefile content/xul/content/test/Makefile content/xul/document/test/Makefile docshell/test/Makefile docshell/test/chrome/Makefile docshell/test/navigation/Makefile + dom/alarm/test/Makefile dom/battery/test/Makefile dom/indexedDB/test/Makefile dom/indexedDB/test/unit/Makefile dom/network/tests/Makefile dom/plugins/test/Makefile dom/plugins/test/testplugin/Makefile dom/power/test/Makefile dom/sms/tests/Makefile