Bug 545070 - plugin-problem UI shouldn't say "click here". r=gavin

This commit is contained in:
Justin Dolske 2011-05-22 18:46:33 -07:00
Родитель 38b67dd3e3
Коммит 8fb36a6db4
11 изменённых файлов: 85 добавлений и 49 удалений

Просмотреть файл

@ -1385,7 +1385,7 @@ function prepareForStartup() {
gBrowser.addEventListener("NewPluginInstalled", gPluginHandler.newPluginInstalled, true);
#ifdef XP_MACOSX
gBrowser.addEventListener("npapi-carbon-event-model-failure", gPluginHandler, true);
#endif
#endif
Services.obs.addObserver(gPluginHandler.pluginCrashed, "plugin-crashed", false);
@ -6698,12 +6698,15 @@ var gPluginHandler = {
handleEvent : function(event) {
let self = gPluginHandler;
let plugin = event.target;
let hideBarPrefName;
let doc = plugin.ownerDocument;
// We're expecting the target to be a plugin.
if (!(plugin instanceof Ci.nsIObjectLoadingContent))
return;
// Force a style flush, so that we ensure our binding is attached.
plugin.clientTop;
switch (event.type) {
case "PluginCrashed":
self.pluginInstanceCrashed(plugin, event);
@ -6713,32 +6716,38 @@ var gPluginHandler = {
// For non-object plugin tags, register a click handler to install the
// plugin. Object tags can, and often do, deal with that themselves,
// so don't stomp on the page developers toes.
if (!(plugin instanceof HTMLObjectElement))
self.addLinkClickCallback(plugin, "installSinglePlugin");
if (!(plugin instanceof HTMLObjectElement)) {
// We don't yet check to see if there's actually an installer available.
let installStatus = doc.getAnonymousElementByAttribute(plugin, "class", "installStatus");
installStatus.setAttribute("status", "ready");
let iconStatus = doc.getAnonymousElementByAttribute(plugin, "class", "icon");
iconStatus.setAttribute("status", "ready");
let installLink = doc.getAnonymousElementByAttribute(plugin, "class", "installPluginLink");
self.addLinkClickCallback(installLink, "installSinglePlugin", plugin);
}
/* FALLTHRU */
case "PluginBlocklisted":
case "PluginOutdated":
hideBarPrefName = event.type == "PluginOutdated" ?
"plugins.hide_infobar_for_outdated_plugin" :
"plugins.hide_infobar_for_missing_plugin";
if (gPrefService.getBoolPref(hideBarPrefName))
return;
self.pluginUnavailable(plugin, event.type);
break;
#ifdef XP_MACOSX
case "npapi-carbon-event-model-failure":
hideBarPrefName = "plugins.hide_infobar_for_carbon_failure_plugin";
if (gPrefService.getBoolPref(hideBarPrefName))
return;
#endif
self.pluginUnavailable(plugin, event.type);
break;
#endif
case "PluginDisabled":
self.addLinkClickCallback(plugin, "managePlugins");
let manageLink = doc.getAnonymousElementByAttribute(plugin, "class", "managePluginsLink");
self.addLinkClickCallback(manageLink, "managePlugins");
break;
}
// Hide the in-content UI if it's too big. The crashed plugin handler already did this.
if (event.type != "PluginCrashed") {
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
if (self.isTooSmall(plugin, overlay))
overlay.style.visibility = "hidden";
}
},
newPluginInstalled : function(event) {
@ -6757,10 +6766,10 @@ var gPluginHandler = {
},
// Callback for user clicking on a missing (unsupported) plugin.
installSinglePlugin: function (aEvent) {
installSinglePlugin: function (plugin) {
var missingPluginsArray = {};
var pluginInfo = getPluginInfo(aEvent.target);
var pluginInfo = getPluginInfo(plugin);
missingPluginsArray[pluginInfo.mimetype] = pluginInfo;
openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
@ -6810,9 +6819,6 @@ var gPluginHandler = {
let blockedNotification = notificationBox.getNotificationWithValue("blocked-plugins");
let missingNotification = notificationBox.getNotificationWithValue("missing-plugins");
// If there is already an outdated plugin notification then do nothing
if (outdatedNotification)
return;
function showBlocklistInfo() {
var url = formatURL("extensions.blocklist.detailsURL", true);
@ -6844,7 +6850,7 @@ var gPluginHandler = {
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", null);
// Something aborted the quit process.
if (cancelQuit.data)
return;
@ -6908,10 +6914,17 @@ var gPluginHandler = {
}
#endif
};
// If there is already an outdated plugin notification then do nothing
if (outdatedNotification)
return;
#ifdef XP_MACOSX
if (eventType == "npapi-carbon-event-model-failure") {
if (gPrefService.getBoolPref("plugins.hide_infobar_for_carbon_failure_plugin"))
return;
let carbonFailureNotification =
let carbonFailureNotification =
notificationBox.getNotificationWithValue("carbon-failure-plugins");
if (carbonFailureNotification)
@ -6923,11 +6936,18 @@ var gPluginHandler = {
eventType = "PluginNotFound";
}
#endif
if (eventType == "PluginBlocklisted") {
if (gPrefService.getBoolPref("plugins.hide_infobar_for_missing_plugin")) // XXX add a new pref?
return;
if (blockedNotification || missingNotification)
return;
}
else if (eventType == "PluginOutdated") {
if (gPrefService.getBoolPref("plugins.hide_infobar_for_outdated_plugin"))
return;
// Cancel any notification about blocklisting/missing plugins
if (blockedNotification)
blockedNotification.close();
@ -6935,6 +6955,9 @@ var gPluginHandler = {
missingNotification.close();
}
else if (eventType == "PluginNotFound") {
if (gPrefService.getBoolPref("plugins.hide_infobar_for_missing_plugin"))
return;
if (missingNotification)
return;
@ -6990,9 +7013,6 @@ var gPluginHandler = {
// Remap the plugin name to a more user-presentable form.
pluginName = this.makeNicePluginName(pluginName, pluginFilename);
// Force a style flush, so that we ensure our binding is attached.
plugin.clientTop;
let messageString = gNavigatorBundle.getFormattedString("crashedpluginsMessage.title", [pluginName]);
//
@ -7000,12 +7020,6 @@ var gPluginHandler = {
//
let doc = plugin.ownerDocument;
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
// The binding has role="link" here, since missing/disabled/blocked
// plugin UI has a onclick handler on the whole thing. This isn't needed
// for the plugin-crashed UI, because we use actual HTML links in the text.
overlay.removeAttribute("role");
let statusDiv = doc.getAnonymousElementByAttribute(plugin, "class", "submitStatus");
#ifdef MOZ_CRASHREPORTER
let status;

Просмотреть файл

@ -127,7 +127,12 @@ function test3() {
new TabOpenListener("about:addons", test4, prepareTest5);
EventUtils.synthesizeMouse(gTestBrowser.contentDocument.getElementById("test"),
var pluginNode = gTestBrowser.contentDocument.getElementById("test");
ok(pluginNode, "Test 3, Found plugin in page");
var manageLink = gTestBrowser.contentDocument.getAnonymousElementByAttribute(pluginNode, "class", "managePluginsLink");
ok(manageLink, "Test 3, found 'manage' link in plugin-problem binding");
EventUtils.synthesizeMouse(manageLink,
5, 5, {}, gTestBrowser.contentWindow);
}

Просмотреть файл

@ -1,5 +1,5 @@
<html>
<body>
<embed id="test" style="width: 100px; height: 100px" type="application/x-test">
<embed id="test" style="width: 200px; height: 200px" type="application/x-test">
</body>
</html>

Просмотреть файл

@ -19,10 +19,14 @@
<!ENTITY pluginWizard.finalPage.moreInfo.label "Find out more about Plugins or manually find missing plugins.">
<!ENTITY pluginWizard.finalPage.restart.label "&brandShortName; needs to be restarted for the plugin(s) to work.">
<!ENTITY missingPlugin.label "Click here to download plugin.">
<!ENTITY disabledPlugin.label "The plugin for this content has been disabled. Click here to manage your plugins.">
<!ENTITY missingPlugin "A plugin is needed to display this content.">
<!ENTITY disabledPlugin "This plugin is disabled.">
<!ENTITY blockedPlugin.label "This plugin has been blocked for your protection.">
<!ENTITY installPlugin "Install plugin…">
<!ENTITY managePlugins "Manage plugins…">
<!-- LOCALIZATION NOTE (reloadPlugin.pre): include a trailing space as needed -->
<!-- LOCALIZATION NOTE (reloadPlugin.middle): avoid leading/trailing spaces, this text is a link -->
<!-- LOCALIZATION NOTE (reloadPlugin.post): include a starting space as needed -->

Просмотреть файл

@ -24,5 +24,3 @@ pluginInstallation.restart.label=Restart %S
pluginInstallation.restart.accesskey=R
pluginInstallation.close.label=Close
pluginInstallation.close.accesskey=C
missingPlugin.label=Click here to download plugin.

Просмотреть файл

@ -54,15 +54,20 @@
</resources>
<content>
<xul:vbox class="mainBox" role="link" flex="1" chromedir="&locale.dir;">
<xul:vbox class="mainBox" flex="1" chromedir="&locale.dir;">
<xul:spacer flex="1"/>
<xul:box class="icon"/>
<html:div class="msg msgUnsupported">&missingPlugin.label;</html:div>
<html:div class="msg msgDisabled">&disabledPlugin.label;</html:div>
<html:div class="msg msgUnsupported">&missingPlugin;</html:div>
<html:div class="msg msgDisabled">&disabledPlugin;</html:div>
<html:div class="msg msgBlocked">&blockedPlugin.label;</html:div>
<html:div class="msg msgCrashed"><!-- set at runtime --></html:div>
<html:div class="installStatus">
<html:div class="msg msgInstallPlugin"><html:a class="installPluginLink" href="">&installPlugin;</html:a></html:div>
</html:div>
<html:div class="msg msgManagePlugins"><html:a class="managePluginsLink" href="">&managePlugins;</html:a></html:div>
<html:div class="submitStatus">
<!-- link href set at runtime -->
<!-- links set at runtime -->
<html:div class="msg msgPleaseSubmit"><html:a class="pleaseSubmitLink" href="">&report.please;</html:a></html:div>
<html:div class="msg msgSubmitting">&report.submitting;<html:span class="throbber"> </html:span></html:div>
<html:div class="msg msgSubmitted">&report.submitted;</html:div>

Просмотреть файл

@ -12,10 +12,6 @@ html|applet:not([height]), html|applet[height=""] {
height: 200px;
}
:-moz-type-unsupported .mainBox {
cursor: pointer;
}
:-moz-type-unsupported .mainBox,
:-moz-handler-disabled .mainBox,
:-moz-handler-blocked .mainBox {
@ -45,11 +41,16 @@ html|applet:not([height]), html|applet[height=""] {
:-moz-type-unsupported .msgUnsupported,
:-moz-handler-disabled .msgDisabled,
:-moz-handler-disabled .msgManagePlugins,
:-moz-handler-blocked .msgBlocked,
:-moz-handler-crashed .msgCrashed {
display: block;
}
.installStatus[status="ready"] .msgInstallPlugin {
display: block;
}
.submitStatus[status="noReport"] .msgNoCrashReport,
.submitStatus[status="please"] .msgPleaseSubmit,
.submitStatus[status="noSubmit"] .msgNotSubmitted,

Просмотреть файл

@ -50,6 +50,7 @@ toolkit.jar:
skin/classic/mozapps/plugins/contentPluginCrashed.png (plugins/contentPluginCrashed.png)
skin/classic/mozapps/plugins/contentPluginDisabled.png (plugins/contentPluginDisabled.png)
skin/classic/mozapps/plugins/contentPluginDownload.png (plugins/contentPluginDownload.png)
skin/classic/mozapps/plugins/contentPluginMissing.png (plugins/contentPluginMissing.png)
skin/classic/mozapps/plugins/notifyPluginBlocked.png (plugins/notifyPluginGeneric.png)
skin/classic/mozapps/plugins/notifyPluginCrashed.png (plugins/notifyPluginGeneric.png)
skin/classic/mozapps/plugins/notifyPluginGeneric.png (plugins/notifyPluginGeneric.png)

Просмотреть файл

@ -29,6 +29,9 @@ html|a {
background-repeat: no-repeat;
}
:-moz-type-unsupported .icon {
background-image: url(chrome://mozapps/skin/plugins/contentPluginMissing.png);
}
:-moz-type-unsupported .icon[status="ready"] {
background-image: url(chrome://mozapps/skin/plugins/contentPluginDownload.png);
}
:-moz-handler-disabled .icon {

Просмотреть файл

@ -55,6 +55,7 @@ toolkit.jar:
skin/classic/mozapps/plugins/contentPluginCrashed.png (plugins/contentPluginCrashed.png)
skin/classic/mozapps/plugins/contentPluginDisabled.png (plugins/contentPluginDisabled.png)
skin/classic/mozapps/plugins/contentPluginDownload.png (plugins/contentPluginDownload.png)
skin/classic/mozapps/plugins/contentPluginMissing.png (plugins/contentPluginMissing.png)
skin/classic/mozapps/plugins/notifyPluginBlocked.png (plugins/pluginBlocked-16.png)
skin/classic/mozapps/plugins/notifyPluginCrashed.png (plugins/pluginGeneric-16.png)
skin/classic/mozapps/plugins/notifyPluginGeneric.png (plugins/pluginGeneric-16.png)
@ -130,6 +131,7 @@ toolkit.jar:
skin/classic/aero/mozapps/plugins/contentPluginCrashed.png (plugins/contentPluginCrashed.png)
skin/classic/aero/mozapps/plugins/contentPluginDisabled.png (plugins/contentPluginDisabled.png)
skin/classic/aero/mozapps/plugins/contentPluginDownload.png (plugins/contentPluginDownload.png)
skin/classic/aero/mozapps/plugins/contentPluginMissing.png (plugins/contentPluginMissing.png)
skin/classic/aero/mozapps/plugins/notifyPluginBlocked.png (plugins/pluginBlocked-16-aero.png)
skin/classic/aero/mozapps/plugins/notifyPluginCrashed.png (plugins/pluginGeneric-16-aero.png)
skin/classic/aero/mozapps/plugins/notifyPluginGeneric.png (plugins/pluginGeneric-16-aero.png)

Просмотреть файл

@ -29,6 +29,9 @@ html|a {
background-repeat: no-repeat;
}
:-moz-type-unsupported .icon {
background-image: url(chrome://mozapps/skin/plugins/contentPluginMissing.png);
}
:-moz-type-unsupported .icon[status="ready"] {
background-image: url(chrome://mozapps/skin/plugins/contentPluginDownload.png);
}
:-moz-handler-disabled .icon {