зеркало из https://github.com/mozilla/gecko-dev.git
Bug 400764 - "Don't depend on Firefox specifics for notifications for popups and missing plugins" [p=twanno@lycos.nl (Teune van Steeg) r=gavin a1.9=schrep]
This commit is contained in:
Родитель
6a5609241f
Коммит
9c442c7554
|
@ -320,8 +320,11 @@ const gPopupBlockerObserver = {
|
||||||
_reportButton: null,
|
_reportButton: null,
|
||||||
_kIPM: Components.interfaces.nsIPermissionManager,
|
_kIPM: Components.interfaces.nsIPermissionManager,
|
||||||
|
|
||||||
onUpdatePageReport: function ()
|
onUpdatePageReport: function (aEvent)
|
||||||
{
|
{
|
||||||
|
if (aEvent.originalTarget != gBrowser.selectedBrowser)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!this._reportButton)
|
if (!this._reportButton)
|
||||||
this._reportButton = document.getElementById("page-report-button");
|
this._reportButton = document.getElementById("page-report-button");
|
||||||
|
|
||||||
|
@ -804,6 +807,7 @@ function prepareForStartup()
|
||||||
// Note: we need to listen to untrusted events, because the pluginfinder XBL
|
// Note: we need to listen to untrusted events, because the pluginfinder XBL
|
||||||
// binding can't fire trusted ones (runs with page privileges).
|
// binding can't fire trusted ones (runs with page privileges).
|
||||||
gBrowser.addEventListener("PluginNotFound", gMissingPluginInstaller.newMissingPlugin, true, true);
|
gBrowser.addEventListener("PluginNotFound", gMissingPluginInstaller.newMissingPlugin, true, true);
|
||||||
|
gBrowser.addEventListener("NewPluginInstalled", gMissingPluginInstaller.refreshBrowser, false);
|
||||||
gBrowser.addEventListener("NewTab", BrowserOpenTab, false);
|
gBrowser.addEventListener("NewTab", BrowserOpenTab, false);
|
||||||
window.addEventListener("AppCommand", HandleAppCommandEvent, true);
|
window.addEventListener("AppCommand", HandleAppCommandEvent, true);
|
||||||
|
|
||||||
|
@ -4970,7 +4974,7 @@ function getPluginInfo(pluginElement)
|
||||||
|
|
||||||
missingPluginInstaller.prototype.installSinglePlugin = function(aEvent){
|
missingPluginInstaller.prototype.installSinglePlugin = function(aEvent){
|
||||||
var tabbrowser = getBrowser();
|
var tabbrowser = getBrowser();
|
||||||
var missingPluginsArray = new Object;
|
var missingPluginsArray = {};
|
||||||
|
|
||||||
var pluginInfo = getPluginInfo(aEvent.target);
|
var pluginInfo = getPluginInfo(aEvent.target);
|
||||||
missingPluginsArray[pluginInfo.mimetype] = pluginInfo;
|
missingPluginsArray[pluginInfo.mimetype] = pluginInfo;
|
||||||
|
@ -4978,7 +4982,7 @@ missingPluginInstaller.prototype.installSinglePlugin = function(aEvent){
|
||||||
if (missingPluginsArray) {
|
if (missingPluginsArray) {
|
||||||
window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
|
window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
|
||||||
"PFSWindow", "modal,chrome,resizable=yes",
|
"PFSWindow", "modal,chrome,resizable=yes",
|
||||||
{plugins: missingPluginsArray, tab: tabbrowser.mCurrentTab});
|
{plugins: missingPluginsArray, browser: tabbrowser.selectedBrowser});
|
||||||
}
|
}
|
||||||
|
|
||||||
aEvent.preventDefault();
|
aEvent.preventDefault();
|
||||||
|
@ -5017,15 +5021,14 @@ missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tab = tabbrowser.mTabContainer.childNodes[i];
|
var browser = tabbrowser.getBrowserAtIndex(i);
|
||||||
if (!tab.missingPlugins)
|
if (!browser.missingPlugins)
|
||||||
tab.missingPlugins = {};
|
browser.missingPlugins = {};
|
||||||
|
|
||||||
var pluginInfo = getPluginInfo(aEvent.target);
|
var pluginInfo = getPluginInfo(aEvent.target);
|
||||||
|
|
||||||
tab.missingPlugins[pluginInfo.mimetype] = pluginInfo;
|
browser.missingPlugins[pluginInfo.mimetype] = pluginInfo;
|
||||||
|
|
||||||
var browser = tabbrowser.getBrowserAtIndex(i);
|
|
||||||
var notificationBox = gBrowser.getNotificationBox(browser);
|
var notificationBox = gBrowser.getNotificationBox(browser);
|
||||||
if (!notificationBox.getNotificationWithValue("missing-plugins")) {
|
if (!notificationBox.getNotificationWithValue("missing-plugins")) {
|
||||||
var bundle_browser = document.getElementById("bundle_browser");
|
var bundle_browser = document.getElementById("bundle_browser");
|
||||||
|
@ -5044,23 +5047,30 @@ missingPluginInstaller.prototype.newMissingPlugin = function(aEvent){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
missingPluginInstaller.prototype.closeNotification = function() {
|
missingPluginInstaller.prototype.refreshBrowser = function(aEvent) {
|
||||||
var notificationBox = gBrowser.getNotificationBox();
|
var browser = aEvent.target;
|
||||||
|
var notificationBox = gBrowser.getNotificationBox(browser);
|
||||||
var notification = notificationBox.getNotificationWithValue("missing-plugins");
|
var notification = notificationBox.getNotificationWithValue("missing-plugins");
|
||||||
|
|
||||||
|
// clear the plugin list, now that at least one plugin has been installed
|
||||||
|
browser.missingPlugins = null;
|
||||||
if (notification) {
|
if (notification) {
|
||||||
|
// reset UI
|
||||||
notificationBox.removeNotification(notification);
|
notificationBox.removeNotification(notification);
|
||||||
}
|
}
|
||||||
|
// reload the browser to make the new plugin show.
|
||||||
|
browser.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
function pluginsMissing()
|
function pluginsMissing()
|
||||||
{
|
{
|
||||||
// get the urls of missing plugins
|
// get the urls of missing plugins
|
||||||
var tabbrowser = getBrowser();
|
var tabbrowser = getBrowser();
|
||||||
var missingPluginsArray = tabbrowser.mCurrentTab.missingPlugins;
|
var missingPluginsArray = tabbrowser.selectedBrowser.missingPlugins;
|
||||||
if (missingPluginsArray) {
|
if (missingPluginsArray) {
|
||||||
window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
|
window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
|
||||||
"PFSWindow", "modal,chrome,resizable=yes", {plugins: missingPluginsArray, tab: tabbrowser.mCurrentTab});
|
"PFSWindow", "modal,chrome,resizable=yes",
|
||||||
|
{plugins: missingPluginsArray, browser: tabbrowser.selectedBrowser});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@
|
||||||
this.mTabBrowser.setIcon(this.mTab, null);
|
this.mTabBrowser.setIcon(this.mTab, null);
|
||||||
|
|
||||||
// changing location, clear out the missing plugins list
|
// changing location, clear out the missing plugins list
|
||||||
this.mTab.missingPlugins = null;
|
this.mBrowser.missingPlugins = null;
|
||||||
|
|
||||||
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
||||||
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
||||||
|
|
|
@ -474,13 +474,9 @@
|
||||||
<method name="updatePageReport">
|
<method name="updatePageReport">
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var tabBrowser = this.getTabBrowser();
|
|
||||||
if (!tabBrowser || tabBrowser.mCurrentBrowser != this)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var event = document.createEvent("Events");
|
var event = document.createEvent("Events");
|
||||||
event.initEvent("DOMUpdatePageReport", true, true);
|
event.initEvent("DOMUpdatePageReport", true, true);
|
||||||
tabBrowser.dispatchEvent(event);
|
this.dispatchEvent(event);
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
|
@ -58,12 +58,13 @@ function nsPluginInstallerWizard(){
|
||||||
// how many plugins are to be installed
|
// how many plugins are to be installed
|
||||||
this.pluginsToInstallNum = 0;
|
this.pluginsToInstallNum = 0;
|
||||||
|
|
||||||
this.mTab = null;
|
this.mBrowser = null;
|
||||||
this.mSuccessfullPluginInstallation = 0;
|
this.mSuccessfullPluginInstallation = 0;
|
||||||
|
|
||||||
// arguments[0] is an array that contains two items:
|
// arguments[0] is an array that contains two items:
|
||||||
// an array of mimetypes that are missing
|
// an array of mimetypes that are missing
|
||||||
// a reference to the tab that needs them, so we can reload it
|
// a reference to the browser that needs them,
|
||||||
|
// so we can notify which browser can be reloaded.
|
||||||
|
|
||||||
if ("arguments" in window) {
|
if ("arguments" in window) {
|
||||||
for (var item in window.arguments[0].plugins){
|
for (var item in window.arguments[0].plugins){
|
||||||
|
@ -73,7 +74,7 @@ function nsPluginInstallerWizard(){
|
||||||
this.mPluginRequestArrayLength++;
|
this.mPluginRequestArrayLength++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mTab = window.arguments[0].tab;
|
this.mBrowser = window.arguments[0].browser;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.WSPluginCounter = 0;
|
this.WSPluginCounter = 0;
|
||||||
|
@ -644,13 +645,12 @@ function wizardFinish(){
|
||||||
// don't refresh if no plugins were found or installed
|
// don't refresh if no plugins were found or installed
|
||||||
if ((gPluginInstaller.mSuccessfullPluginInstallation > 0) &&
|
if ((gPluginInstaller.mSuccessfullPluginInstallation > 0) &&
|
||||||
(gPluginInstaller.mPluginInfoArray.length != 0) &&
|
(gPluginInstaller.mPluginInfoArray.length != 0) &&
|
||||||
gPluginInstaller.mTab) {
|
gPluginInstaller.mBrowser) {
|
||||||
// clear the tab's plugin list only if we installed at least one plugin
|
// notify listeners that a plugin is installed,
|
||||||
gPluginInstaller.mTab.missingPlugins = null;
|
// so that they can reset the UI and update the browser.
|
||||||
// reset UI
|
var event = document.createEvent("Events");
|
||||||
window.opener.gMissingPluginInstaller.closeNotification();
|
event.initEvent("NewPluginInstalled", true, true);
|
||||||
// reload the browser to make the new plugin show
|
gPluginInstaller.mBrowser.dispatchEvent(event);
|
||||||
window.opener.getBrowser().reloadTab(gPluginInstaller.mTab);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче