Skip to content

Commit

Permalink
Backed out changeset 21d743a319c6 (bug 967475) for apparently introdu…
Browse files Browse the repository at this point in the history
…cing two hazards to the build
  • Loading branch information
KWierso committed May 8, 2014
1 parent f94ee39 commit 54f2dad
Show file tree
Hide file tree
Showing 23 changed files with 62 additions and 614 deletions.
13 changes: 5 additions & 8 deletions b2g/components/AlertsHelper.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ let AlertsHelper = {
lang: listener.lang,
dir: listener.dir,
id: listener.id,
tag: listener.tag,
timestamp: listener.timestamp
tag: listener.tag
},
Services.io.newURI(listener.target, null, null),
Services.io.newURI(listener.manifestURL, null, null)
Expand Down Expand Up @@ -195,7 +194,7 @@ let AlertsHelper = {
},

showNotification: function(imageURL, title, text, textClickable, cookie,
uid, bidi, lang, manifestURL, timestamp) {
uid, bidi, lang, manifestURL) {
function send(appName, appIcon) {
SystemAppProxy._sendCustomEvent(kMozChromeNotificationEvent, {
type: kDesktopNotification,
Expand All @@ -207,8 +206,7 @@ let AlertsHelper = {
lang: lang,
appName: appName,
appIcon: appIcon,
manifestURL: manifestURL,
timestamp: timestamp
manifestURL: manifestURL
});
}

Expand Down Expand Up @@ -250,13 +248,12 @@ let AlertsHelper = {
lang: details.lang || undefined,
id: details.id || undefined,
dir: details.dir || undefined,
tag: details.tag || undefined,
timestamp: details.timestamp || undefined
tag: details.tag || undefined
};
this.registerAppListener(data.uid, listener);
this.showNotification(data.imageURL, data.title, data.text,
details.textClickable, null, data.uid, details.dir,
details.lang, details.manifestURL, details.timestamp);
details.lang, details.manifestURL);
},

closeAlert: function(name) {
Expand Down
8 changes: 2 additions & 6 deletions b2g/components/AlertsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const kMessageAlertNotificationSend = "alert-notification-send";
const kMessageAlertNotificationClose = "alert-notification-close";

const kTopicAlertFinished = "alertfinished";
const kTopicAlertClickCallback = "alertclickcallback";

function AlertsService() {
Services.obs.addObserver(this, "xpcom-shutdown", false);
Expand Down Expand Up @@ -104,8 +103,7 @@ AlertsService.prototype = {
id: aDetails.id || undefined,
dbId: aDetails.dbId || undefined,
dir: aDetails.dir || undefined,
tag: aDetails.tag || undefined,
timestamp: aDetails.timestamp || undefined
tag: aDetails.tag || undefined
};

cpmm.sendAsyncMessage(kMessageAppNotificationSend, {
Expand Down Expand Up @@ -137,16 +135,14 @@ AlertsService.prototype = {
// the notification so the app get a change to react.
if (data.target) {
gSystemMessenger.sendMessage(kNotificationSystemMessageName, {
clicked: (topic === kTopicAlertClickCallback),
title: listener.title,
body: listener.text,
imageURL: listener.imageURL,
lang: listener.lang,
dir: listener.dir,
id: listener.id,
tag: listener.tag,
dbId: listener.dbId,
timestamp: listener.timestamp
dbId: listener.dbId
},
Services.io.newURI(data.target, null, null),
Services.io.newURI(listener.manifestURL, null, null)
Expand Down
2 changes: 0 additions & 2 deletions b2g/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@
@BINPATH@/components/zipwriter.xpt

; JavaScript components
@BINPATH@/components/ChromeNotifications.js
@BINPATH@/components/ChromeNotifications.manifest
@BINPATH@/components/ConsoleAPI.manifest
@BINPATH@/components/ConsoleAPIStorage.js
@BINPATH@/components/BrowserElementParent.manifest
Expand Down
2 changes: 0 additions & 2 deletions browser/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,6 @@
@BINPATH@/components/telemetry.xpt

; JavaScript components
@BINPATH@/components/ChromeNotifications.js
@BINPATH@/components/ChromeNotifications.manifest
@BINPATH@/components/ConsoleAPI.manifest
@BINPATH@/components/ConsoleAPIStorage.js
@BINPATH@/components/BrowserElementParent.manifest
Expand Down
9 changes: 0 additions & 9 deletions dom/bindings/BindingUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Assertions.h"
#include "mozilla/Preferences.h"

#include "AccessCheck.h"
#include "jsfriendapi.h"
Expand Down Expand Up @@ -2156,10 +2155,6 @@ ConvertJSValueToByteString(JSContext* cx, JS::Handle<JS::Value> v,
bool
IsInPrivilegedApp(JSContext* aCx, JSObject* aObj)
{
if (Preferences::GetBool("dom.ignore_webidl_scope_checks", false)) {
return true;
}

using mozilla::dom::workers::GetWorkerPrivateFromContext;
if (!NS_IsMainThread()) {
return GetWorkerPrivateFromContext(aCx)->IsInPrivilegedApp();
Expand All @@ -2174,10 +2169,6 @@ IsInPrivilegedApp(JSContext* aCx, JSObject* aObj)
bool
IsInCertifiedApp(JSContext* aCx, JSObject* aObj)
{
if (Preferences::GetBool("dom.ignore_webidl_scope_checks", false)) {
return true;
}

using mozilla::dom::workers::GetWorkerPrivateFromContext;
if (!NS_IsMainThread()) {
return GetWorkerPrivateFromContext(aCx)->IsInCertifiedApp();
Expand Down
9 changes: 2 additions & 7 deletions dom/interfaces/notification/nsINotificationStorage.idl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface nsINotificationStorageCallback : nsISupports
/**
* Interface for notification persistence layer.
*/
[scriptable, uuid(cc4656d7-2a2a-47f1-8016-55891e833d64)]
[scriptable, uuid(b177b080-2a23-11e3-8224-0800200c9a66)]
interface nsINotificationStorage : nsISupports
{

Expand All @@ -55,10 +55,6 @@ interface nsINotificationStorage : nsISupports
* @param body: the notification body
* @param tag: notification tag, will replace any existing
* notifications with same origin/tag pair
* @param alertName: the alert identifier as used by system app.
* Stored in the database to avoid re-computing
* it. Built from origin and tag or id depending
* whether there is a tag defined.
*/
void put(in DOMString origin,
in DOMString id,
Expand All @@ -67,8 +63,7 @@ interface nsINotificationStorage : nsISupports
in DOMString lang,
in DOMString body,
in DOMString tag,
in DOMString icon,
in DOMString alertName);
in DOMString icon);

/**
* Retrieve a list of notifications.
Expand Down
113 changes: 0 additions & 113 deletions dom/src/notification/ChromeNotifications.js

This file was deleted.

3 changes: 0 additions & 3 deletions dom/src/notification/ChromeNotifications.manifest

This file was deleted.

53 changes: 28 additions & 25 deletions dom/src/notification/Notification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,22 +423,6 @@ Notification::Notification(const nsAString& aID, const nsAString& aTitle, const
mID(aID), mTitle(aTitle), mBody(aBody), mDir(aDir), mLang(aLang),
mTag(aTag), mIconUrl(aIconUrl), mIsClosed(false)
{
nsAutoString alertName;
DebugOnly<nsresult> rv = GetOrigin(GetOwner(), alertName);
MOZ_ASSERT(NS_SUCCEEDED(rv), "GetOrigin should not have failed");

// Get the notification name that is unique per origin + tag/ID.
// The name of the alert is of the form origin#tag/ID.
alertName.AppendLiteral("#");
if (!mTag.IsEmpty()) {
alertName.Append(NS_LITERAL_STRING("tag:"));
alertName.Append(mTag);
} else {
alertName.Append(NS_LITERAL_STRING("notag:"));
alertName.Append(mID);
}

mAlertName = alertName;
}

// static
Expand Down Expand Up @@ -478,19 +462,14 @@ Notification::Constructor(const GlobalObject& aGlobal,

nsString id;
notification->GetID(id);

nsString alertName;
notification->GetAlertName(alertName);

aRv = notificationStorage->Put(origin,
id,
aTitle,
DirectionToString(aOptions.mDir),
aOptions.mLang,
aOptions.mBody,
aOptions.mTag,
aOptions.mIcon,
alertName);
aOptions.mIcon);
if (aRv.Failed()) {
return nullptr;
}
Expand Down Expand Up @@ -578,6 +557,10 @@ Notification::ShowInternal()

nsCOMPtr<nsIObserver> observer = new NotificationObserver(this);

nsString alertName;
rv = GetAlertName(alertName);
NS_ENSURE_SUCCESS_VOID(rv);

#ifdef MOZ_B2G
nsCOMPtr<nsIAppNotificationService> appNotifier =
do_GetService("@mozilla.org/system-alerts-service;1");
Expand All @@ -595,7 +578,7 @@ Notification::ShowInternal()
AppNotificationServiceOptions ops;
ops.mTextClickable = true;
ops.mManifestURL = manifestUrl;
ops.mId = mAlertName;
ops.mId = alertName;
ops.mDbId = mID;
ops.mDir = DirectionToString(mDir);
ops.mLang = mLang;
Expand All @@ -619,7 +602,7 @@ Notification::ShowInternal()
nsString uniqueCookie = NS_LITERAL_STRING("notification:");
uniqueCookie.AppendInt(sCount++);
alertService->ShowAlertNotification(absoluteUrl, mTitle, mBody, true,
uniqueCookie, observer, mAlertName,
uniqueCookie, observer, alertName,
DirectionToString(mDir), mLang,
GetPrincipal());
}
Expand Down Expand Up @@ -788,8 +771,10 @@ Notification::CloseInternal()
nsCOMPtr<nsIAlertsService> alertService =
do_GetService(NS_ALERTSERVICE_CONTRACTID);
if (alertService) {
nsString alertName;
rv = GetAlertName(alertName);
if (NS_SUCCEEDED(rv)) {
alertService->CloseAlert(mAlertName, GetPrincipal());
alertService->CloseAlert(alertName, GetPrincipal());
}
}
}
Expand Down Expand Up @@ -827,6 +812,24 @@ Notification::GetOrigin(nsPIDOMWindow* aWindow, nsString& aOrigin)
return NS_OK;
}

nsresult
Notification::GetAlertName(nsString& aAlertName)
{
// Get the notification name that is unique per origin + tag/ID.
// The name of the alert is of the form origin#tag/ID.
nsresult rv = GetOrigin(GetOwner(), aAlertName);
NS_ENSURE_SUCCESS(rv, rv);
aAlertName.AppendLiteral("#");
if (!mTag.IsEmpty()) {
aAlertName.Append(NS_LITERAL_STRING("tag:"));
aAlertName.Append(mTag);
} else {
aAlertName.Append(NS_LITERAL_STRING("notag:"));
aAlertName.Append(mID);
}
return NS_OK;
}

} // namespace dom
} // namespace mozilla

Loading

0 comments on commit 54f2dad

Please sign in to comment.