зеркало из https://github.com/mozilla/gecko-dev.git
Bug 628651 - [OSX] show notification bar offering to restart in 32-bit mode when content tries to use a 32-bit plugin using carbon based NPAPI a=hardblocker r=gavin, mossop
This commit is contained in:
Родитель
6400b22ee4
Коммит
828327df24
|
@ -587,6 +587,10 @@ pref("pfs.datasource.url", "https://pfs.mozilla.org/plugins/PluginFinderService.
|
|||
pref("plugins.hide_infobar_for_missing_plugin", false);
|
||||
pref("plugins.hide_infobar_for_outdated_plugin", false);
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
pref("plugins.hide_infobar_for_carbon_failure_plugin", false);
|
||||
#endif
|
||||
|
||||
pref("plugins.update.url", "https://www.mozilla.com/%LOCALE%/plugincheck/");
|
||||
pref("plugins.update.notifyUser", false);
|
||||
|
||||
|
|
|
@ -1370,6 +1370,9 @@ function prepareForStartup() {
|
|||
gBrowser.addEventListener("PluginOutdated", gPluginHandler, true);
|
||||
gBrowser.addEventListener("PluginDisabled", gPluginHandler, true);
|
||||
gBrowser.addEventListener("NewPluginInstalled", gPluginHandler.newPluginInstalled, true);
|
||||
#ifdef XP_MACOSX
|
||||
gBrowser.addEventListener("npapi-carbon-event-model-failure", gPluginHandler, true);
|
||||
#endif
|
||||
|
||||
Services.obs.addObserver(gPluginHandler.pluginCrashed, "plugin-crashed", false);
|
||||
|
||||
|
@ -6620,6 +6623,7 @@ var gPluginHandler = {
|
|||
handleEvent : function(event) {
|
||||
let self = gPluginHandler;
|
||||
let plugin = event.target;
|
||||
let hideBarPrefName;
|
||||
|
||||
// We're expecting the target to be a plugin.
|
||||
if (!(plugin instanceof Ci.nsIObjectLoadingContent))
|
||||
|
@ -6639,7 +6643,7 @@ var gPluginHandler = {
|
|||
/* FALLTHRU */
|
||||
case "PluginBlocklisted":
|
||||
case "PluginOutdated":
|
||||
let hideBarPrefName = event.type == "PluginOutdated" ?
|
||||
hideBarPrefName = event.type == "PluginOutdated" ?
|
||||
"plugins.hide_infobar_for_outdated_plugin" :
|
||||
"plugins.hide_infobar_for_missing_plugin";
|
||||
if (gPrefService.getBoolPref(hideBarPrefName))
|
||||
|
@ -6647,7 +6651,15 @@ var gPluginHandler = {
|
|||
|
||||
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;
|
||||
|
||||
self.pluginUnavailable(plugin, event.type);
|
||||
break;
|
||||
#endif
|
||||
case "PluginDisabled":
|
||||
self.addLinkClickCallback(plugin, "managePlugins");
|
||||
break;
|
||||
|
@ -6705,8 +6717,7 @@ var gPluginHandler = {
|
|||
openHelpLink("plugin-crashed", false);
|
||||
},
|
||||
|
||||
|
||||
// event listener for missing/blocklisted/outdated plugins.
|
||||
// event listener for missing/blocklisted/outdated/carbonFailure plugins.
|
||||
pluginUnavailable: function (plugin, eventType) {
|
||||
let browser = gBrowser.getBrowserForDocument(plugin.ownerDocument
|
||||
.defaultView.top.document);
|
||||
|
@ -6751,6 +6762,23 @@ var gPluginHandler = {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
function carbonFailurePluginsRestartBrowser()
|
||||
{
|
||||
// Notify all windows that an application quit has been requested.
|
||||
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;
|
||||
|
||||
let as = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
|
||||
as.quit(Ci.nsIAppStartup.eRestarti386 | Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
|
||||
}
|
||||
#endif
|
||||
|
||||
let notifications = {
|
||||
PluginBlocklisted : {
|
||||
barID : "blocked-plugins",
|
||||
|
@ -6790,9 +6818,36 @@ var gPluginHandler = {
|
|||
popup : null,
|
||||
callback : showPluginsMissing
|
||||
}],
|
||||
}
|
||||
},
|
||||
#ifdef XP_MACOSX
|
||||
"npapi-carbon-event-model-failure" : {
|
||||
barID : "carbon-failure-plugins",
|
||||
iconURL : "chrome://mozapps/skin/plugins/notifyPluginGeneric.png",
|
||||
message : gNavigatorBundle.getString("carbonFailurePluginsMessage.title"),
|
||||
buttons: [{
|
||||
label : gNavigatorBundle.getString("carbonFailurePluginsMessage.restartButton.label"),
|
||||
accessKey : gNavigatorBundle.getString("carbonFailurePluginsMessage.restartButton.accesskey"),
|
||||
popup : null,
|
||||
callback : carbonFailurePluginsRestartBrowser
|
||||
}],
|
||||
}
|
||||
#endif
|
||||
};
|
||||
#ifdef XP_MACOSX
|
||||
if (eventType == "npapi-carbon-event-model-failure") {
|
||||
|
||||
let carbonFailureNotification =
|
||||
notificationBox.getNotificationWithValue("carbon-failure-plugins");
|
||||
|
||||
if (carbonFailureNotification)
|
||||
carbonFailureNotification.close();
|
||||
|
||||
let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].getService(Ci.nsIMacUtils);
|
||||
// if this is not a Universal build, just follow PluginNotFound path
|
||||
if (!macutils.isUniversalBinary)
|
||||
eventType = "PluginNotFound";
|
||||
}
|
||||
#endif
|
||||
if (eventType == "PluginBlocklisted") {
|
||||
if (blockedNotification || missingNotification)
|
||||
return;
|
||||
|
|
|
@ -251,6 +251,10 @@ else
|
|||
_BROWSER_FILES += \
|
||||
browser_customize.js \
|
||||
$(NULL)
|
||||
|
||||
# TODO: Activate after carbon test plugin lands, bug 628651
|
||||
# browser_maconly_carbon_mismatch_plugin.js \
|
||||
|
||||
endif
|
||||
|
||||
ifneq (gtk2,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
let tab, browser;
|
||||
|
||||
function tearDown()
|
||||
{
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
}
|
||||
|
||||
registerCleanupFunction(tearDown);
|
||||
|
||||
function addTab(aURL)
|
||||
{
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
content.location = aURL;
|
||||
tab = gBrowser.selectedTab;
|
||||
browser = gBrowser.getBrowserForTab(tab);
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
executeSoon(function (){
|
||||
browser.removeEventListener("npapi-carbon-event-model-failure",
|
||||
arguments.callee, false);
|
||||
let notificationBox = gBrowser.getNotificationBox();
|
||||
let notificationBar = notificationBox.getNotificationWithValue("carbon-failure-plugins");
|
||||
ok(notificationBar, "Carbon Error plugin notification bar was found");
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
function test() {
|
||||
try {
|
||||
let abi = Services.appinfo.XPCOMABI;
|
||||
if (!abi.match(/64/)) {
|
||||
todo(false, "canceling test, wrong platform");
|
||||
return;
|
||||
}
|
||||
let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].getService(Ci.nsIMacUtils);
|
||||
if (!macutils.isUniversalBinary) {
|
||||
todo(false, "canceling test, not a universal build")
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
return;
|
||||
}
|
||||
waitForExplicitFinish();
|
||||
addTab('data:text/html,<h1>Plugin carbon mismatch test</h1><embed id="test" style="width: 100px; height: 100px" type="application/x-test-carbon">');
|
||||
gBrowser.addEventListener("npapi-carbon-event-model-failure", onLoad, false);
|
||||
}
|
||||
|
|
@ -114,6 +114,9 @@ crashedpluginsMessage.reloadButton.accesskey=R
|
|||
crashedpluginsMessage.submitButton.label=Submit a crash report
|
||||
crashedpluginsMessage.submitButton.accesskey=S
|
||||
crashedpluginsMessage.learnMore=Learn More…
|
||||
carbonFailurePluginsMessage.title=This page requires a plugin that can only run in 32-bit mode
|
||||
carbonFailurePluginsMessage.restartButton.label=Restart in 32-bit mode
|
||||
carbonFailurePluginsMessage.restartButton.accesskey=R
|
||||
|
||||
# Sanitize
|
||||
# LOCALIZATION NOTE (sanitizeDialog2.everything.title): When "Time range to
|
||||
|
|
Загрузка…
Ссылка в новой задаче