Backing out aa94c4753dcc (Bug 915002) due to WinXP breakage

This commit is contained in:
Kyle Machulis 2013-10-09 19:18:23 -07:00
parent 3933d43a93
commit b176ccb46b
9 changed files with 29 additions and 66 deletions

View File

@ -887,20 +887,18 @@ var AlertsHelper = {
}
let data = aMessage.data;
let details = data.details;
let listener = {
mm: aMessage.target,
title: data.title,
text: data.text,
manifestURL: details.manifestURL,
manifestURL: data.manifestURL,
imageURL: data.imageURL
};
}
this.registerAppListener(data.uid, listener);
this.showNotification(data.imageURL, data.title, data.text,
details.textClickable, null,
data.uid, details.dir,
details.lang, details.manifestURL);
data.textClickable, null,
data.uid, null, null, data.manifestURL);
},
}

View File

@ -65,16 +65,17 @@ AlertsService.prototype = {
showAppNotification: function showAppNotification(aImageURL,
aTitle,
aText,
aTextClickable,
aManifestURL,
aAlertListener,
aDetails) {
let uid = (aDetails.id == "") ?
"app-notif-" + uuidGenerator.generateUUID() : aDetails.id;
aId) {
let uid = (aId == "") ? "app-notif-" + uuidGenerator.generateUUID() : aId;
this._listeners[uid] = {
observer: aAlertListener,
title: aTitle,
text: aText,
manifestURL: aDetails.manifestURL,
manifestURL: aManifestURL,
imageURL: aImageURL
};
@ -82,8 +83,9 @@ AlertsService.prototype = {
imageURL: aImageURL,
title: aTitle,
text: aText,
uid: uid,
details: aDetails
textClickable: aTextClickable,
manifestURL: aManifestURL,
uid: uid
});
},

View File

@ -7,14 +7,14 @@
interface nsIObserver;
// Notification service that also provides the manifest URL
[scriptable, uuid(50cb17d2-dc8a-4aa6-bcd3-94d76af14e20)]
[scriptable, uuid(61c4adf4-187d-4d18-937c-4df17bc01073)]
interface nsIAppNotificationService : nsISupports
{
void showAppNotification(in AString imageUrl,
in AString title,
in AString text,
in nsIObserver alertListener,
// details should be a WebIDL
// AppNotificationServiceOptions Dictionary object
in jsval details);
[optional] in boolean textClickable,
[optional] in AString manifestURL,
[optional] in nsIObserver alertListener,
[optional] in AString id);
};

View File

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/DesktopNotification.h"
#include "mozilla/dom/DesktopNotificationBinding.h"
#include "mozilla/dom/AppNotificationServiceOptionsBinding.h"
#include "nsContentPermissionHelper.h"
#include "nsXULAppAPI.h"
#include "mozilla/dom/PBrowserChild.h"
@ -92,18 +91,11 @@ DesktopNotification::PostDesktopNotification()
nsCOMPtr<nsIAppsService> appsService = do_GetService("@mozilla.org/AppsService;1");
nsString manifestUrl = EmptyString();
appsService->GetManifestURLByLocalId(appId, manifestUrl);
mozilla::AutoSafeJSContext cx;
JS::RootedValue val(cx);
AppNotificationServiceOptionsInitializer ops;
ops.mTextClickable = true;
ops.mManifestURL = manifestUrl;
if (!ops.ToObject(cx, JS::NullPtr(), &val)) {
return NS_ERROR_FAILURE;
}
return appNotifier->ShowAppNotification(mIconURL, mTitle, mDescription,
mObserver, val);
true,
manifestUrl,
mObserver,
EmptyString());
}
}
#endif

View File

@ -4,7 +4,6 @@
#include "PCOMContentPermissionRequestChild.h"
#include "mozilla/dom/Notification.h"
#include "mozilla/dom/AppNotificationServiceOptionsBinding.h"
#include "mozilla/dom/OwningNonNull.h"
#include "mozilla/Preferences.h"
#include "TabChild.h"
@ -376,22 +375,11 @@ Notification::ShowInternal()
nsCOMPtr<nsIAppsService> appsService = do_GetService("@mozilla.org/AppsService;1");
nsString manifestUrl = EmptyString();
appsService->GetManifestURLByLocalId(appId, manifestUrl);
mozilla::AutoSafeJSContext cx;
JS::RootedValue val(cx);
AppNotificationServiceOptionsInitializer ops;
ops.mTextClickable = true;
ops.mManifestURL = manifestUrl;
ops.mId = alertName;
ops.mDir = DirectionToString(mDir);
ops.mLang = mLang;
if (!ops.ToObject(cx, JS::NullPtr(), &val)) {
NS_WARNING("Converting dict to object failed!");
return NS_ERROR_FAILURE;
}
return appNotifier->ShowAppNotification(mIconUrl, mTitle, mBody,
observer, val);
true,
manifestUrl,
observer,
alertName);
}
}
#endif

View File

@ -9,7 +9,7 @@ var registrar = SpecialPowers.wrap(SpecialPowers.Components).manager.
var mockAlertsService = {
showAlertNotification: function(imageUrl, title, text, textClickable,
cookie, alertListener, name, bidi, lang) {
cookie, alertListener, name) {
// probably should do this async....
SpecialPowers.wrap(alertListener).observe(null, "alertshow", cookie);
@ -20,9 +20,9 @@ var mockAlertsService = {
SpecialPowers.wrap(alertListener).observe(null, "alertfinished", cookie);
},
showAppNotification: function(imageUrl, title, text, alertListener, details) {
this.showAlertNotification(imageUrl, title, text, details.textClickable, "",
alertListener, details.name, details.dir, details.lang);
showAppNotification: function(imageUrl, title, text, textClickable,
manifestURL, alertListener) {
this.showAlertNotification(imageUrl, title, text, textClickable, "", alertListener, "");
},
QueryInterface: function(aIID) {

View File

@ -1,15 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
*/
interface MozObserver;
dictionary AppNotificationServiceOptions {
boolean textClickable = false;
DOMString manifestURL = "";
DOMString id = "";
DOMString dir = "";
DOMString lang = "";
};

View File

@ -27,7 +27,6 @@ interface DummyInterface : EventTarget {
void DOMWindowResizeEventDetail(optional DOMWindowResizeEventDetail arg);
void WifiOptions(optional WifiCommandOptions arg1,
optional WifiResultOptions arg2);
void AppNotificationServiceOptions(optional AppNotificationServiceOptions arg);
};
interface DummyInterfaceWorkers {

View File

@ -19,7 +19,6 @@ WEBIDL_FILES = [
'AbstractWorker.webidl',
'AnalyserNode.webidl',
'AnimationEvent.webidl',
'AppNotificationServiceOptions.webidl',
'ArchiveReader.webidl',
'ArchiveRequest.webidl',
'Attr.webidl',