author | Jeff Balogh <jbalogh@mozilla.com> |
Thu, 14 Jun 2012 14:58:19 -0700 | |
changeset 102957 | c53f474c502b0b4d9e8bb46b11da6961520ac829 |
parent 101957 | 9bbc55b71de8754e1c8c80dd493a03460ecf3578 |
child 102958 | 7d0a38909321dc529c585db0c60483a2373b8b4e |
push id | 191 |
push user | lsblakk@mozilla.com |
push date | Fri, 05 Oct 2012 17:12:53 +0000 |
treeherder | mozilla-release@ddb22ac6c03b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | gps |
bugs | 754062 |
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/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -448,16 +448,19 @@ @BINPATH@/components/nsPrompter.manifest @BINPATH@/components/nsPrompter.js #ifdef MOZ_SERVICES_SYNC @BINPATH@/components/SyncComponents.manifest @BINPATH@/components/AitcComponents.manifest @BINPATH@/components/Weave.js @BINPATH@/components/Aitc.js #endif +#ifdef MOZ_SERVICES_NOTIFICATIONS +@BINPATH@/components/NotificationsComponents.manifest +#endif @BINPATH@/components/TelemetryPing.js @BINPATH@/components/TelemetryPing.manifest @BINPATH@/components/messageWakeupService.js @BINPATH@/components/messageWakeupService.manifest @BINPATH@/components/SettingsManager.js @BINPATH@/components/SettingsManager.manifest @BINPATH@/components/Webapps.js @BINPATH@/components/Webapps.manifest
--- a/services/Makefile.in +++ b/services/Makefile.in @@ -6,12 +6,12 @@ DEPTH = .. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk ifdef MOZ_SERVICES_SYNC -PARALLEL_DIRS += aitc common crypto sync +PARALLEL_DIRS += aitc common crypto notifications sync endif include $(topsrcdir)/config/rules.mk
--- a/services/makefiles.sh +++ b/services/makefiles.sh @@ -3,19 +3,21 @@ # 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/. add_makefiles " services/Makefile services/common/Makefile services/crypto/Makefile services/crypto/component/Makefile + services/notifications/Makefile services/sync/Makefile services/sync/locales/Makefile " if [ "$ENABLE_TESTS" ]; then add_makefiles " services/common/tests/Makefile services/crypto/tests/Makefile + services/notifications/tests/Makefile services/sync/tests/Makefile " fi
new file mode 100644 --- /dev/null +++ b/services/notifications/Makefile.in @@ -0,0 +1,32 @@ +# 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 + +EXTRA_COMPONENTS = \ + NotificationsComponents.manifest \ + $(NULL) + +PREF_JS_EXPORTS = $(srcdir)/services-notifications.js + +modules := \ + service.js \ + $(NULL) + +source_modules = $(foreach module,$(modules),$(srcdir)/$(module)) +module_dir = $(FINAL_TARGET)/modules/services-notifications + +GENERATED_DIRS += $(module_dir) + +libs:: + $(NSINSTALL) $(source_modules) $(module_dir) + +TEST_DIRS += tests + +include $(topsrcdir)/config/rules.mk
new file mode 100644 --- /dev/null +++ b/services/notifications/NotificationsComponents.manifest @@ -0,0 +1,2 @@ +# Register resource aliases +resource services-notifications resource:///modules/services-notifications/
new file mode 100644 --- /dev/null +++ b/services/notifications/README @@ -0,0 +1,11 @@ +Here lies most of the moving parts for push notifcations in the browser. DOM +and UI bindings will live elsewhere; these files deal with talking to the API, +storing messages, and creating persistent connections to the notification +server. + +Structure: + +services.js::Service + This is a singleton that manages API calls and message storage. It's an + instance of the NotificationSvc class. Messages and state are persisted to a + JSON file on disk.
new file mode 100644 --- /dev/null +++ b/services/notifications/service.js @@ -0,0 +1,28 @@ +/* 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/. */ + +const EXPORTED_SYMBOLS = ["Service"]; + +const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components; + +Cu.import("resource://services-common/preferences.js"); + +const PREFS_BRANCH = "services.notifications."; + + +function NotificationSvc() { + this.ready = false; + this.prefs = new Preferences(PREFS_BRANCH); +} +NotificationSvc.prototype = { + + get serverURL() this.prefs.get("serverURL"), + + onStartup: function onStartup() { + this.ready = true; + } +}; + +let Service = new NotificationSvc(); +Service.onStartup();
new file mode 100644 --- /dev/null +++ b/services/notifications/services-notifications.js @@ -0,0 +1,1 @@ +pref("services.notifications.serverURL", "https://notifications.mozilla.org/");
new file mode 100644 --- /dev/null +++ b/services/notifications/tests/Makefile.in @@ -0,0 +1,16 @@ +# 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 = services/notifications/tests + +include $(DEPTH)/config/autoconf.mk + +MODULE = test_services_notifications +XPCSHELL_TESTS = unit + +include $(topsrcdir)/config/rules.mk
new file mode 100644 --- /dev/null +++ b/services/notifications/tests/unit/head_helpers.js @@ -0,0 +1,3 @@ +const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components; + +let _ = function() print(Array.slice(arguments).join(" "));
new file mode 100644 --- /dev/null +++ b/services/notifications/tests/unit/test_service_start.js @@ -0,0 +1,8 @@ +// Check that everything is getting hooked together properly. +function run_test() { + _("When imported, Service.onStartup is called."); + Cu.import("resource://services-notifications/service.js"); + + do_check_eq(Service.serverURL, "https://notifications.mozilla.org/"); + do_check_eq(Service.ready, true); +}
new file mode 100644 --- /dev/null +++ b/services/notifications/tests/unit/xpcshell.ini @@ -0,0 +1,5 @@ +[DEFAULT] +head = head_helpers.js +tail = + +[test_service_start.js]
--- a/testing/xpcshell/xpcshell.ini +++ b/testing/xpcshell/xpcshell.ini @@ -72,16 +72,17 @@ skip-if = os == "android" [include:widget/tests/unit/xpcshell.ini] [include:content/base/test/unit/xpcshell.ini] [include:content/test/unit/xpcshell.ini] [include:toolkit/components/url-classifier/tests/unit/xpcshell.ini] [include:services/aitc/tests/unit/xpcshell.ini] [include:services/common/tests/unit/xpcshell.ini] [include:services/crypto/tests/unit/xpcshell.ini] [include:services/crypto/components/tests/unit/xpcshell.ini] +[include:services/notifications/tests/unit/xpcshell.ini] [include:services/sync/tests/unit/xpcshell.ini] # Bug 676978: tests hang on Android skip-if = os == "android" [include:browser/components/dirprovider/tests/unit/xpcshell.ini] [include:browser/components/downloads/test/unit/xpcshell.ini] [include:browser/components/feeds/test/unit/xpcshell.ini] [include:browser/components/migration/tests/unit/xpcshell.ini] [include:browser/components/places/tests/unit/xpcshell.ini]