summaryrefslogtreecommitdiff
path: root/browser
diff options
context:
space:
mode:
authorMoonchild <wolfbeast@users.noreply.github.com>2017-10-06 00:52:41 +0200
committerGitHub <noreply@github.com>2017-10-06 00:52:41 +0200
commitd5c0601fa008046534e1c3cc69babfd58b3dfc8e (patch)
tree6bd018ee48991afdf797a4387bd9fd5615f6e50e /browser
parent92d3c87b542918269b3986d3b777557f59f2a522 (diff)
parent39bf9d4ee380ea9a11a8e6e71c024f4d66f160c8 (diff)
downloadpalemoon-gre-d5c0601fa008046534e1c3cc69babfd58b3dfc8e.tar.gz
Merge pull request #1388 from JustOff/PR_statusbar_cleanup
Status bar (s4e) code cleanup
Diffstat (limited to 'browser')
-rw-r--r--browser/components/statusbar/Downloads.jsm145
-rw-r--r--browser/components/statusbar/Status4Evar.jsm21
-rw-r--r--browser/components/statusbar/status4evar.js5
3 files changed, 6 insertions, 165 deletions
diff --git a/browser/components/statusbar/Downloads.jsm b/browser/components/statusbar/Downloads.jsm
index 8467bfda5..74bc42144 100644
--- a/browser/components/statusbar/Downloads.jsm
+++ b/browser/components/statusbar/Downloads.jsm
@@ -23,16 +23,7 @@ function S4EDownloadService(window, gBrowser, service, getters)
this._service = service;
this._getters = getters;
- if(Services.vc.compare("26.0", Services.appinfo.version) <= 0)
- {
- this._handler = new JSTransferHandler(this._window, this);
- Services.console.logStringMessage("S4EDownloadService using JSTransferHandler backend");
- }
- else
- {
- this._handler = new DownloadManagerHandler(this._window, this);
- Services.console.logStringMessage("S4EDownloadService using DownloadManagerHandler backend");
- }
+ this._handler = new JSTransferHandler(this._window, this);
}
S4EDownloadService.prototype =
@@ -477,140 +468,6 @@ S4EDownloadService.prototype =
}
};
-function DownloadManagerHandler(window, downloadService)
-{
- this._window = window;
- this._downloadService = downloadService;
- this._api = CC["@mozilla.org/download-manager;1"].getService(CI.nsIDownloadManager);
- this._classicUI = Components.classesByID["{7dfdf0d1-aff6-4a34-bad1-d0fe74601642}"].getService(CI.nsIDownloadManagerUI);
-}
-
-DownloadManagerHandler.prototype =
-{
- _window: null,
- _downloadService: null,
- _api: null,
-
- destroy: function()
- {
- ["_window", "_downloadService", "_api", "_classicUI"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- start: function()
- {
- if(this.hasPBAPI)
- {
- this._api.addPrivacyAwareListener(this);
- }
- else
- {
- this._api.addListener(this);
- Services.obs.addObserver(this, "private-browsing", true);
- }
- },
-
- stop: function()
- {
- this._api.removeListener(this);
- if(!this.hasPBAPI)
- {
- Services.obs.removeObserver(this, "private-browsing");
- }
- },
-
- get hasPBAPI()
- {
- return ('addPrivacyAwareListener' in this._api);
- },
-
- openUINative: function()
- {
- if(this._window.DownloadsCommon.useToolkitUI)
- {
- this._classicUI.show(this._window);
- }
- else
- {
- this._window.DownloadsPanel.showPanel();
- }
- },
-
- get isUIShowingNative()
- {
- if(this._window.DownloadsCommon.useToolkitUI)
- {
- return this._classicUI.visible;
- }
- else
- {
- return this._window.DownloadsPanel.isPanelShowing;
- }
- },
-
- activeEntries: function()
- {
- return this.generate(this._api.activeDownloads);
- },
-
- activePrivateEntries: function()
- {
- return this.generate(this._api.activePrivateDownloads);
- },
-
- generate: function(dls)
- {
- while(dls.hasMoreElements())
- {
- let dl = dls.getNext();
- yield { state: dl.state, size: dl.size, speed: dl.speed, transferred: dl.amountTransferred };
- }
- },
-
- onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress, aDownload)
- {
- if(this.hasPBAPI && (aDownload.isPrivate != this._downloadService.isPrivateWindow))
- {
- return;
- }
-
- this._downloadService.updateStatus(aDownload.state == CI.nsIDownloadManager.DOWNLOAD_FINISHED);
- },
-
- onDownloadStateChange: function(aState, aDownload)
- {
- if(this.hasPBAPI && (aDownload.isPrivate != this._downloadService.isPrivateWindow))
- {
- return;
- }
-
- this._downloadService.updateStatus(aDownload.state == CI.nsIDownloadManager.DOWNLOAD_FINISHED);
-
- if(aDownload.state == CI.nsIDownloadManager.DOWNLOAD_FINISHED && this.hasPBAPI)
- {
- this._downloadService.notify()
- }
- },
-
- onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus, aDownload) {},
- onSecurityChange: function(aWebProgress, aRequest, aState, aDownload) {},
-
- observe: function(subject, topic, data)
- {
- if(topic == "private-browsing" && (data == "enter" || data == "exit"))
- {
- self._downloadService._window.setTimeout(function(self)
- {
- self.updateStatus();
- }, 0, this._downloadService);
- }
- },
-
- QueryInterface: XPCOMUtils.generateQI([ CI.nsIDownloadProgressListener, CI.nsISupportsWeakReference, CI.nsIObserver ])
-};
-
function JSTransferHandler(window, downloadService)
{
this._window = window;
diff --git a/browser/components/statusbar/Status4Evar.jsm b/browser/components/statusbar/Status4Evar.jsm
index 31c598aea..03e899afc 100644
--- a/browser/components/statusbar/Status4Evar.jsm
+++ b/browser/components/statusbar/Status4Evar.jsm
@@ -11,7 +11,6 @@ const CI = Components.interfaces;
const CU = Components.utils;
const s4e_service = CC["@caligonstudios.com/status4evar;1"].getService(CI.nsIStatus4Evar);
-const uuidService = CC["@mozilla.org/uuid-generator;1"].getService(CI.nsIUUIDGenerator);
CU.import("resource://gre/modules/Services.jsm");
CU.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -24,7 +23,6 @@ CU.import("resource:///modules/statusbar/Toolbars.jsm");
function Status4Evar(window, gBrowser, toolbox)
{
- this._id = uuidService.generateUUID();
this._window = window;
this._toolbox = toolbox;
@@ -40,7 +38,6 @@ function Status4Evar(window, gBrowser, toolbox)
Status4Evar.prototype =
{
- _id: null,
_window: null,
_toolbox: null,
@@ -53,9 +50,9 @@ Status4Evar.prototype =
setup: function()
{
- this._toolbox.addEventListener("beforecustomization", this, false);
- this._toolbox.addEventListener("aftercustomization", this, false);
-
+ this._toolbox.addEventListener("beforecustomization", this, false);
+ this._toolbox.addEventListener("aftercustomization", this, false);
+
this.toolbars.setup();
this.updateWindow();
@@ -70,11 +67,8 @@ Status4Evar.prototype =
destroy: function()
{
this._window.removeEventListener("unload", this, false);
- if(Services.vc.compare("28.*", Services.appinfo.version) >= 0)
- {
- this._toolbox.removeEventListener("aftercustomization", this, false);
- this._toolbox.removeEventListener("beforecustomization", this, false);
- }
+ this._toolbox.removeEventListener("aftercustomization", this, false);
+ this._toolbox.removeEventListener("beforecustomization", this, false);
this.getters.destroy();
this.statusService.destroy();
@@ -108,8 +102,6 @@ Status4Evar.prototype =
beforeCustomization: function()
{
- Services.console.logStringMessage("S4E Calling beforeCustomization: " + this._id);
-
this.toolbars.updateSplitters(false);
this.toolbars.updateWindowGripper(false);
@@ -125,8 +117,6 @@ Status4Evar.prototype =
updateWindow: function()
{
- Services.console.logStringMessage("S4E Calling updateWindow: " + this._id);
-
this.statusService.setNoUpdate(false);
this.getters.resetGetters();
this.statusService.buildTextOrder();
@@ -287,4 +277,3 @@ SizeModeService.prototype =
QueryInterface: XPCOMUtils.generateQI([ CI.nsIDOMEventListener ])
};
-
diff --git a/browser/components/statusbar/status4evar.js b/browser/components/statusbar/status4evar.js
index 60ec72345..abc6c9175 100644
--- a/browser/components/statusbar/status4evar.js
+++ b/browser/components/statusbar/status4evar.js
@@ -539,11 +539,6 @@ Status_4_Evar.prototype =
break;
}
this.prefs.setIntPref("download.button.action", newDownloadAction);
-
- if(oldDownloadAction == 4 && Services.vc.compare("26.0", Services.appinfo.version) > 0)
- {
- this.prefs.setBoolPref("browser.download.useToolkitUI", true);
- }
case 7:
let progressLocation = this.prefs.getIntPref("status");
if (progressLocation == 2)