☠☠ backed out by 531f100d2bd8 ☠ ☠ | |
author | Nikhil Marathe <nsm.nikhil@gmail.com> |
Tue, 10 Mar 2015 18:57:09 -0700 | |
changeset 250275 | 0d860fd125343f67d71dafddd4e435cd624884f4 |
parent 250274 | 7dc2448065a98863e8df27b21d9708921edf0057 |
child 250276 | ce8a768782f234b8d70c30164c687024c7905dfb |
push id | 28951 |
push user | cbook@mozilla.com |
push date | Fri, 26 Jun 2015 11:19:38 +0000 |
treeherder | mozilla-central@56e207dbb3bd [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | wchen, baku |
bugs | 1114554 |
milestone | 41.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/dom/base/nsGkAtomList.h +++ b/dom/base/nsGkAtomList.h @@ -817,16 +817,17 @@ GK_ATOM(onmozfullscreenerror, "onmozfull GK_ATOM(onmozpointerlockchange, "onmozpointerlockchange") GK_ATOM(onmozpointerlockerror, "onmozpointerlockerror") GK_ATOM(onmoztimechange, "onmoztimechange") GK_ATOM(onMozMousePixelScroll, "onMozMousePixelScroll") GK_ATOM(onMozScrolledAreaChanged, "onMozScrolledAreaChanged") GK_ATOM(onmoznetworkupload, "onmoznetworkupload") GK_ATOM(onmoznetworkdownload, "onmoznetworkdownload") GK_ATOM(onnewrdsgroup, "onnewrdsgroup") +GK_ATOM(onnotificationclick, "onnotificationclick") GK_ATOM(onnoupdate, "onnoupdate") GK_ATOM(onobsolete, "onobsolete") GK_ATOM(ononline, "ononline") GK_ATOM(onoffline, "onoffline") GK_ATOM(onopen, "onopen") GK_ATOM(onotastatuschange, "onotastatuschange") GK_ATOM(onoverflow, "onoverflow") GK_ATOM(onoverflowchanged, "onoverflowchanged")
--- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -860,16 +860,24 @@ DOMInterfaces = { 'NodeIterator': { 'wrapperCache': False, }, 'NodeList': { 'nativeType': 'nsINodeList', }, +'NotificationEvent': { + 'headerFile': 'mozilla/dom/NotificationEvent.h', + 'nativeType': 'mozilla::dom::workers::NotificationEvent', + 'binaryNames': { + 'notification': 'notification_' + } +}, + 'OfflineAudioContext': { 'nativeType': 'mozilla::dom::AudioContext', }, 'OfflineResourceList': { 'nativeType': 'nsDOMOfflineResourceList', },
--- a/dom/notification/Notification.cpp +++ b/dom/notification/Notification.cpp @@ -1409,20 +1409,17 @@ Notification::Get(const GlobalObject& aG } nsRefPtr<Promise> promise = Promise::Create(global, aRv); if (aRv.Failed()) { return nullptr; } nsCOMPtr<nsINotificationStorageCallback> callback = new NotificationStorageCallback(aGlobal, window, promise); - nsString tag = aFilter.mTag.WasPassed() ? - aFilter.mTag.Value() : - EmptyString(); - aRv = notificationStorage->Get(origin, tag, callback); + aRv = notificationStorage->Get(origin, aFilter.mTag, callback); if (aRv.Failed()) { return nullptr; } return promise.forget(); } JSObject*
--- a/dom/webidl/Notification.webidl +++ b/dom/webidl/Notification.webidl @@ -63,17 +63,17 @@ dictionary NotificationOptions { DOMString body = ""; DOMString tag = ""; DOMString icon = ""; any data = null; NotificationBehavior mozbehavior = null; }; dictionary GetNotificationOptions { - DOMString tag; + DOMString tag = ""; }; dictionary NotificationBehavior { boolean noscreen = false; boolean noclear = false; boolean showOnlyOnce = false; DOMString soundFile = ""; sequence<unsigned long> vibrationPattern; @@ -88,8 +88,12 @@ enum NotificationPermission { callback NotificationPermissionCallback = void (NotificationPermission permission); enum NotificationDirection { "auto", "ltr", "rtl" }; +partial interface ServiceWorkerRegistration { + Promise<void> showNotification(DOMString title, optional NotificationOptions options); + Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter); +};
--- a/dom/webidl/ServiceWorker.webidl +++ b/dom/webidl/ServiceWorker.webidl @@ -7,17 +7,17 @@ * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#service-worker-obj * */ // Still unclear what should be subclassed. // https://github.com/slightlyoff/ServiceWorker/issues/189 [Func="mozilla::dom::workers::ServiceWorkerVisible", // FIXME(nsm): Bug 1113522. This is exposed to satisfy webidl constraints, but it won't actually work. - Exposed=(Worker,Window)] + Exposed=(Window,Worker)] interface ServiceWorker : EventTarget { readonly attribute USVString scriptURL; readonly attribute ServiceWorkerState state; attribute EventHandler onstatechange; // FIXME(catalinb): Should inherit this from Worker. [Throws]
--- a/dom/workers/ServiceWorkerRegistration.cpp +++ b/dom/workers/ServiceWorkerRegistration.cpp @@ -583,16 +583,33 @@ ServiceWorkerRegistrationMainThread::Unr aRv = swm->Unregister(documentPrincipal, cb, scope); if (aRv.Failed()) { return nullptr; } return promise.forget(); } +// Notification API extension. +already_AddRefed<Promise> +ServiceWorkerRegistrationMainThread::ShowNotification(JSContext* aCx, + const nsAString& aTitle, + const NotificationOptions& aOptions) +{ + MOZ_ASSERT(false); + return nullptr; +} + +already_AddRefed<Promise> +ServiceWorkerRegistrationMainThread::GetNotifications(const GetNotificationOptions& aOptions) +{ + MOZ_ASSERT(false); + return nullptr; +} + already_AddRefed<PushManager> ServiceWorkerRegistrationMainThread::GetPushManager(ErrorResult& aRv) { AssertIsOnMainThread(); #ifdef MOZ_SIMPLEPUSH return nullptr; #else @@ -986,10 +1003,28 @@ WorkerListener::UpdateFound() nsRefPtr<FireUpdateFoundRunnable> r = new FireUpdateFoundRunnable(mWorkerPrivate, this); AutoJSAPI jsapi; jsapi.Init(); if (NS_WARN_IF(!r->Dispatch(jsapi.cx()))) { } } } + +// Notification API extension. +already_AddRefed<Promise> +ServiceWorkerRegistrationWorkerThread::ShowNotification(JSContext* aCx, + const nsAString& aTitle, + const NotificationOptions& aOptions) +{ + MOZ_ASSERT(false); + return nullptr; +} + +already_AddRefed<Promise> +ServiceWorkerRegistrationWorkerThread::GetNotifications(const GetNotificationOptions& aOptions) +{ + MOZ_ASSERT(false); + return nullptr; +} + } // dom namespace } // mozilla namespace
--- a/dom/workers/ServiceWorkerRegistration.h +++ b/dom/workers/ServiceWorkerRegistration.h @@ -7,16 +7,19 @@ #ifndef mozilla_dom_ServiceWorkerRegistration_h #define mozilla_dom_ServiceWorkerRegistration_h #include "mozilla/DOMEventTargetHelper.h" #include "mozilla/dom/ServiceWorkerBinding.h" #include "mozilla/dom/ServiceWorkerCommon.h" #include "mozilla/dom/workers/bindings/WorkerFeature.h" +// Support for Notification API extension. +#include "mozilla/dom/NotificationBinding.h" + class nsPIDOMWindow; namespace mozilla { namespace dom { class Promise; class PushManager; class WorkerListener; @@ -106,16 +109,25 @@ public: Update(); already_AddRefed<Promise> Unregister(ErrorResult& aRv); JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; + // Partial interface from Notification API. + already_AddRefed<Promise> + ShowNotification(JSContext* aCx, + const nsAString& aTitle, + const NotificationOptions& aOptions); + + already_AddRefed<Promise> + GetNotifications(const GetNotificationOptions& aOptions); + already_AddRefed<workers::ServiceWorker> GetInstalling() override; already_AddRefed<workers::ServiceWorker> GetWaiting() override; already_AddRefed<workers::ServiceWorker> GetActive() override; @@ -185,16 +197,25 @@ public: Update(); already_AddRefed<Promise> Unregister(ErrorResult& aRv); JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; + // Partial interface from Notification API. + already_AddRefed<Promise> + ShowNotification(JSContext* aCx, + const nsAString& aTitle, + const NotificationOptions& aOptions); + + already_AddRefed<Promise> + GetNotifications(const GetNotificationOptions& aOptions); + already_AddRefed<workers::ServiceWorker> GetInstalling() override; already_AddRefed<workers::ServiceWorker> GetWaiting() override; already_AddRefed<workers::ServiceWorker> GetActive() override;
--- a/dom/workers/WorkerScope.h +++ b/dom/workers/WorkerScope.h @@ -203,16 +203,17 @@ class ServiceWorkerGlobalScope final : p nsRefPtr<ServiceWorkerRegistrationWorkerThread> mRegistration; ~ServiceWorkerGlobalScope(); public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope) + IMPL_EVENT_HANDLER(notificationclick) ServiceWorkerGlobalScope(WorkerPrivate* aWorkerPrivate, const nsACString& aScope); virtual bool WrapGlobalObject(JSContext* aCx, JS::MutableHandle<JSObject*> aReflector) override; static bool