Bug 896418 - Improve naming for CtP popupNotification centerActions. r=jaws

This commit is contained in:
Georg Fritzsche 2014-02-17 14:41:10 +01:00
parent 69010e7545
commit 9efded2c0a
7 changed files with 23 additions and 23 deletions

View File

@ -684,7 +684,7 @@ var gPluginHandler = {
Services.telemetry.getHistogramById("PLUGINS_NOTIFICATION_SHOWN")
.add(!this.options.primaryPlugin);
// Histograms always start at 0, even though our data starts at 1
let histogramCount = this.options.centerActions.size - 1;
let histogramCount = this.options.pluginData.size - 1;
if (histogramCount > 4) {
histogramCount = 4;
}
@ -844,12 +844,12 @@ var gPluginHandler = {
plugins = [aPlugin];
}
// If this is a new notification, create a centerActions map, otherwise append
let centerActions;
// If this is a new notification, create a pluginData map, otherwise append
let pluginData;
if (notification) {
centerActions = notification.options.centerActions;
pluginData = notification.options.pluginData;
} else {
centerActions = new Map();
pluginData = new Map();
}
let principal = aBrowser.contentDocument.nodePrincipal;
@ -861,7 +861,7 @@ var gPluginHandler = {
Cu.reportError("No permission string for active plugin.");
continue;
}
if (centerActions.has(pluginInfo.permissionString)) {
if (pluginData.has(pluginInfo.permissionString)) {
continue;
}
@ -888,8 +888,8 @@ var gPluginHandler = {
url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "clicktoplay";
}
pluginInfo.detailsLink = url;
centerActions.set(pluginInfo.permissionString, pluginInfo);
pluginData.set(pluginInfo.permissionString, pluginInfo);
}
let primaryPluginPermission = null;
@ -912,7 +912,7 @@ var gPluginHandler = {
dismissed: !aShowNow,
eventCallback: this._clickToPlayNotificationEventCallback,
primaryPlugin: primaryPluginPermission,
centerActions: centerActions
pluginData: pluginData
};
PopupNotifications.show(aBrowser, "click-to-play-plugins",
"", "plugins-notification-icon",
@ -934,7 +934,7 @@ var gPluginHandler = {
// outdated plugins.
let haveInsecure = false;
let actions = new Map();
for (let action of notification.options.centerActions.values()) {
for (let action of notification.options.pluginData.values()) {
switch (action.fallbackType) {
// haveInsecure will trigger the red flashing icon and the infobar
// styling below

View File

@ -115,10 +115,10 @@ function test2b() {
// Simulate choosing "Allow now" for the test plugin
notification.reshow();
is(notification.options.centerActions.size, 2, "Test 2b, Should have two types of plugin in the notification");
is(notification.options.pluginData.size, 2, "Test 2b, Should have two types of plugin in the notification");
var centerAction = null;
for (var action of notification.options.centerActions.values()) {
for (var action of notification.options.pluginData.values()) {
if (action.pluginName == "Test") {
centerAction = action;
break;

View File

@ -76,7 +76,7 @@ function test1a() {
ok(notification, "Test 1a, Should have a click-to-play notification");
notification.reshow();
is(notification.options.centerActions.size, 2,
is(notification.options.pluginData.size, 2,
"Test 1a, Should have two types of plugin in the notification");
let pluginItem = null;

View File

@ -40,7 +40,7 @@ function pluginBindingAttached() {
ok(notification, "should have popup notification");
// We don't set up the action list until the notification is shown
notification.reshow();
is(notification.options.centerActions.size, 1, "should be 1 type of plugin in the popup notification");
is(notification.options.pluginData.size, 1, "should be 1 type of plugin in the popup notification");
XPCNativeWrapper.unwrap(gTestBrowser.contentWindow).addSecondPlugin();
} else if (gNumPluginBindingsAttached == 2) {
var doc = gTestBrowser.contentDocument;
@ -51,7 +51,7 @@ function pluginBindingAttached() {
var notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(notification, "should have popup notification");
notification.reshow();
is(notification.options.centerActions.size, 2, "should be 2 types of plugin in the popup notification");
is(notification.options.pluginData.size, 2, "should be 2 types of plugin in the popup notification");
finish();
} else {
ok(false, "if we've gotten here, something is quite wrong");

View File

@ -179,7 +179,7 @@ function test5() {
ok(notification.dismissed, "Test 5: The plugin notification should be dismissed by default");
notification.reshow();
is(notification.options.centerActions.size, 1, "Test 5: Only the blocked plugin should be present in the notification");
is(notification.options.pluginData.size, 1, "Test 5: Only the blocked plugin should be present in the notification");
ok(PopupNotifications.panel.firstChild._buttonContainer.hidden, "Part 5: The blocked plugins notification should not have any buttons visible.");
ok(!gTestBrowser.missingPlugins, "Test 5, Should not be a missing plugin list");
@ -604,10 +604,10 @@ function test21a() {
// we have to actually show the panel to get the bindings to instantiate
notification.reshow();
is(notification.options.centerActions.size, 2, "Test 21a, Should have two types of plugin in the notification");
is(notification.options.pluginData.size, 2, "Test 21a, Should have two types of plugin in the notification");
var centerAction = null;
for (var action of notification.options.centerActions.values()) {
for (var action of notification.options.pluginData.values()) {
if (action.pluginName == "Test") {
centerAction = action;
break;
@ -641,7 +641,7 @@ function test21c() {
ok(notification, "Test 21c, Should have a click-to-play notification");
notification.reshow();
ok(notification.options.centerActions.size == 2, "Test 21c, Should have one type of plugin in the notification");
ok(notification.options.pluginData.size == 2, "Test 21c, Should have one type of plugin in the notification");
var doc = gTestBrowser.contentDocument;
var plugin = doc.getElementById("test");
@ -662,7 +662,7 @@ function test21c() {
}
var centerAction = null;
for (var action of notification.options.centerActions.values()) {
for (var action of notification.options.pluginData.values()) {
if (action.pluginName == "Second Test") {
centerAction = action;
break;

View File

@ -68,7 +68,7 @@ function testActivateAddSameTypePart2() {
function testActivateAddSameTypePart3() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
let centerAction = null;
for (let action of popupNotification.options.centerActions.values()) {
for (let action of popupNotification.options.pluginData.values()) {
if (action.pluginName == "Test") {
centerAction = action;
break;
@ -142,7 +142,7 @@ function testActivateAddDifferentTypePart2() {
function testActivateAddDifferentTypePart3() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
is(popupNotification.options.centerActions.size, 1, "Should be one plugin action");
is(popupNotification.options.pluginData.size, 1, "Should be one plugin action");
let plugin = gTestBrowser.contentDocument.getElementsByTagName("embed")[0];
ok(!plugin.activated, "testActivateAddDifferentTypePart3: plugin should not be activated");

View File

@ -1564,7 +1564,7 @@
<constructor><![CDATA[
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let sortedActions = [];
for (let action of this.notification.options.centerActions.values()) {
for (let action of this.notification.options.pluginData.values()) {
sortedActions.push(action);
}
sortedActions.sort((a, b) => a.pluginName.localeCompare(b.pluginName));