Backed out 3 changesets (bug 1208295) for build bustage CLOSED TREE

Backed out changeset ba930740225e (bug 1208295)
Backed out changeset 54f38580e0b8 (bug 1208295)
Backed out changeset a5907e5982a8 (bug 1208295)

--HG--
rename : browser/base/content/test/alerts/browser_notification_tab_switching.js => browser/base/content/test/general/browser_notification_tab_switching.js
rename : browser/base/content/test/alerts/file_dom_notifications.html => browser/base/content/test/general/file_dom_notifications.html
This commit is contained in:
Wes Kocher 2015-10-05 12:20:47 -07:00
parent 222595da1d
commit 11e1d57e15
10 changed files with 18 additions and 60 deletions

View File

@ -1,18 +0,0 @@
"use strict";
add_task(function* test_settingsOpen() {
info("Opening a dummy tab so openPreferences=>switchToTabHavingURI doesn't use the blank tab.");
yield BrowserTestUtils.withNewTab({
gBrowser,
url: "about:robots"
}, function* dummyTabTask(aBrowser) {
let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "about:preferences#content");
info("simulate a notifications-open-settings notification");
let uri = NetUtil.newURI("https://example.com");
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
Services.obs.notifyObservers(principal, "notifications-open-settings", null);
let tab = yield tabPromise;
ok(tab, "The notification settings tab opened");
BrowserTestUtils.removeTab(tab);
});
});

View File

@ -62,6 +62,7 @@ support-files =
file_bug970276_favicon1.ico
file_bug970276_favicon2.ico
file_documentnavigation_frameset.html
file_dom_notifications.html
file_double_close_tab.html
file_favicon_change.html
file_favicon_change_not_in_document.html
@ -337,6 +338,8 @@ skip-if = os != "win" # The Fitts Law menu button is only supported on Windows (
skip-if = e10s # Bug 1100664 - test directly access content docShells (TypeError: gBrowser.docShell is null)
[browser_mixedcontent_securityflags.js]
tags = mcb
[browser_notification_tab_switching.js]
skip-if = buildapp == 'mulet' || e10s # Bug 1100662 - content access causing uncaught exception - Error: cannot ipc non-cpow object at chrome://mochitests/content/browser/browser/base/content/test/general/browser_notification_tab_switching.js:32 (or in RemoteAddonsChild.jsm)
[browser_offlineQuotaNotification.js]
skip-if = buildapp == 'mulet' || e10s # Bug 1093603 - test breaks with PopupNotifications.panel.firstElementChild is null
[browser_overflowScroll.js]

View File

@ -6,7 +6,7 @@
var tab;
var notification;
var notificationURL = "http://example.org/browser/browser/base/content/test/alerts/file_dom_notifications.html";
var notificationURL = "http://example.org/browser/browser/base/content/test/general/file_dom_notifications.html";
var newWindowOpenedFromTab;
function test () {
@ -58,7 +58,7 @@ function onAlertShowing() {
info("Notification alert showing");
notification.removeEventListener("show", onAlertShowing);
let alertWindow = Services.wm.getMostRecentWindow("alert:alert");
let alertWindow = findChromeWindowByURI("chrome://global/content/alerts/alert.xul");
if (!alertWindow) {
todo(false, "Notifications don't use XUL windows on all platforms.");
notification.close();

View File

@ -1,6 +1,5 @@
<html>
<head>
<meta charset="utf-8">
<script>
"use strict";

View File

@ -59,6 +59,16 @@ function whenDelayedStartupFinished(aWindow, aCallback) {
}, "browser-delayed-startup-finished", false);
}
function findChromeWindowByURI(aURI) {
let windows = Services.wm.getEnumerator(null);
while (windows.hasMoreElements()) {
let win = windows.getNext();
if (win.location.href == aURI)
return win;
}
return null;
}
function updateTabContextMenu(tab) {
let menu = document.getElementById("tabContextMenu");
if (!tab)

View File

@ -15,7 +15,6 @@ MOCHITEST_CHROME_MANIFESTS += [
]
BROWSER_CHROME_MANIFESTS += [
'content/test/alerts/browser.ini',
'content/test/chat/browser.ini',
'content/test/general/browser.ini',
'content/test/newtab/browser.ini',

View File

@ -276,9 +276,6 @@ BrowserGlue.prototype = {
// nsIObserver implementation
observe: function BG_observe(subject, topic, data) {
switch (topic) {
case "notifications-open-settings":
this._openPreferences("content");
break;
case "prefservice:after-app-defaults":
this._onAppDefaults();
break;
@ -594,7 +591,6 @@ BrowserGlue.prototype = {
// initialization (called on application startup)
_init: function BG__init() {
let os = Services.obs;
os.addObserver(this, "notifications-open-settings", false);
os.addObserver(this, "prefservice:after-app-defaults", false);
os.addObserver(this, "final-ui-startup", false);
os.addObserver(this, "browser-delayed-startup-finished", false);
@ -643,7 +639,6 @@ BrowserGlue.prototype = {
// cleanup (called on application shutdown)
_dispose: function BG__dispose() {
let os = Services.obs;
os.removeObserver(this, "notifications-open-settings");
os.removeObserver(this, "prefservice:after-app-defaults");
os.removeObserver(this, "final-ui-startup");
os.removeObserver(this, "sessionstore-windows-restored");
@ -2366,19 +2361,6 @@ BrowserGlue.prototype = {
}
}),
/**
* Open preferences even if there are no open windows.
*/
_openPreferences(...args) {
if (Services.appShell.hiddenDOMWindow.openPreferences) {
Services.appShell.hiddenDOMWindow.openPreferences(...args);
return;
}
let chromeWindow = RecentWindow.getMostRecentBrowserWindow();
chromeWindow.openPreferences(...args);
},
#ifdef MOZ_SERVICES_SYNC
/**
* Called as an observer when Sync's "display URI" notification is fired.

View File

@ -1161,15 +1161,6 @@ NotificationObserver::Observe(nsISupports* aSubject, const char* aTopic,
}
permissionManager->RemoveFromPrincipal(mPrincipal, "desktop-notification");
return NS_OK;
} else if (!strcmp("alertsettingscallback", aTopic)) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (!obs) {
return NS_ERROR_FAILURE;
}
// Notify other observers so they can show settings UI.
obs->NotifyObservers(mPrincipal, "notifications-open-settings", nullptr);
return NS_OK;
}
return mObserver->Observe(aSubject, aTopic, aData);

View File

@ -9,4 +9,3 @@ closeButton.title = Close
# LOCALIZATION NOTE(actionButton.label): Used as the button label to provide more actions on OS X notifications. OS X will truncate this if it's too long.
actionButton.label =
webActions.disable.label = Disable notifications from this site
webActions.settings.label = Notification settings

View File

@ -139,8 +139,7 @@ enum {
namespace mozilla {
enum {
OSXNotificationActionDisable = 0,
OSXNotificationActionSettings = 1,
OSXNotificationActionDisable = 0
};
class OSXNotificationInfo {
@ -254,15 +253,13 @@ OSXNotificationCenter::ShowAlertNotification(const nsAString & aImageUrl, const
nsCOMPtr<nsIStringBundle> bundle;
nsresult rv = sbs->CreateBundle("chrome://alerts/locale/alert.properties", getter_AddRefs(bundle));
if (NS_SUCCEEDED(rv)) {
nsXPIDLString closeButtonTitle, actionButtonTitle, disableButtonTitle, settingsButtonTitle;
nsXPIDLString closeButtonTitle, actionButtonTitle, disableButtonTitle;
bundle->GetStringFromName(NS_LITERAL_STRING("closeButton.title").get(),
getter_Copies(closeButtonTitle));
bundle->GetStringFromName(NS_LITERAL_STRING("actionButton.label").get(),
getter_Copies(actionButtonTitle));
bundle->GetStringFromName(NS_LITERAL_STRING("webActions.disable.label").get(),
getter_Copies(disableButtonTitle));
bundle->GetStringFromName(NS_LITERAL_STRING("webActions.settings.label").get(),
getter_Copies(settingsButtonTitle));
notification.hasActionButton = YES;
notification.otherButtonTitle = nsCocoaUtils::ToNSString(closeButtonTitle);
@ -270,8 +267,7 @@ OSXNotificationCenter::ShowAlertNotification(const nsAString & aImageUrl, const
[(NSObject*)notification setValue:@(YES) forKey:@"_showsButtons"];
[(NSObject*)notification setValue:@(YES) forKey:@"_alwaysShowAlternateActionMenu"];
[(NSObject*)notification setValue:@[
nsCocoaUtils::ToNSString(disableButtonTitle),
nsCocoaUtils::ToNSString(settingsButtonTitle)
nsCocoaUtils::ToNSString(disableButtonTitle)
]
forKey:@"_alternateActionButtonTitles"];
}
@ -398,9 +394,6 @@ OSXNotificationCenter::OnActivate(NSString *aAlertName,
case OSXNotificationActionDisable:
osxni->mObserver->Observe(nullptr, "alertdisablecallback", osxni->mCookie.get());
break;
case OSXNotificationActionSettings:
osxni->mObserver->Observe(nullptr, "alertsettingscallback", osxni->mCookie.get());
break;
default:
NS_WARNING("Unknown NSUserNotification additional action clicked");
break;