[Pkg-mozext-commits] [firetray] 20/84: * fix (Chat) imports for Thunderbird * fix Window.attachWndProc
David Prévot
taffit at moszumanska.debian.org
Sun Jul 20 01:42:42 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository firetray.
commit 20d137bd28d29d48667997cd5290ef0df52d0544
Author: foudfou <foudil.newbie+git at gmail.com>
Date: Fri Feb 7 00:17:17 2014 +0100
* fix (Chat) imports for Thunderbird
* fix Window.attachWndProc
NOTE: WndProc crashes fixed in TB27+
---
src/install.rdf | 6 +++---
src/modules/FiretrayChat.jsm | 19 +++++++++++++++----
src/modules/FiretrayHandler.jsm | 2 +-
src/modules/winnt/FiretrayWindow.jsm | 23 ++++++++++++++---------
4 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/src/install.rdf b/src/install.rdf
index 46118a8..f308294 100644
--- a/src/install.rdf
+++ b/src/install.rdf
@@ -21,15 +21,15 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
<em:minVersion>7.0</em:minVersion>
- <em:maxVersion>27.0</em:maxVersion>
+ <em:maxVersion>30.0</em:maxVersion>
</Description>
</em:targetApplication>
<em:targetApplication> <!-- Thunderbird -->
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
- <em:minVersion>7.0</em:minVersion>
- <em:maxVersion>27.0</em:maxVersion>
+ <em:minVersion>27.0</em:minVersion>
+ <em:maxVersion>30.0</em:maxVersion>
</Description>
</em:targetApplication>
diff --git a/src/modules/FiretrayChat.jsm b/src/modules/FiretrayChat.jsm
index b5e7d01..f62afbf 100644
--- a/src/modules/FiretrayChat.jsm
+++ b/src/modules/FiretrayChat.jsm
@@ -8,8 +8,6 @@ const Cu = Components.utils;
Cu.import("resource:///modules/imServices.jsm");
Cu.import("resource://firetray/commons.js");
-Cu.import("resource://firetray/linux/FiretrayChatStatusIcon.jsm");
-Cu.import("resource://firetray/linux/FiretrayWindow.jsm");
let log = firetray.Logging.getLogger("firetray.Chat");
@@ -24,10 +22,21 @@ firetray.Chat = {
init: function() {
if (this.initialized) {
log.warn("Chat already initialized");
- return;
+ return true;
}
log.debug("Enabling Chat");
+ switch (firetray.Handler.runtimeOS) {
+ case "Linux":
+ Cu.import("resource://firetray/linux/FiretrayChatStatusIcon.jsm");
+ Cu.import("resource://firetray/linux/FiretrayWindow.jsm");
+ break;
+ default:
+ log.error("Only Linux platforms supported at this time. " +
+ "Chat not loaded");
+ return false;
+ }
+
firetray.Utils.addObservers(firetray.Chat, [
// "*", // debugging
"account-connected", "account-disconnected", "idle-time-changed",
@@ -42,10 +51,11 @@ firetray.Chat = {
this.updateIcon();
this.initialized = true;
+ return true;
},
shutdown: function() {
- if (!this.initialized) return;
+ if (!this.initialized) return false;
log.debug("Disabling Chat");
if (firetray.Chat.convsToAcknowledge.length())
@@ -55,6 +65,7 @@ firetray.Chat = {
firetray.Utils.removeAllObservers(firetray.Chat);
this.initialized = false;
+ return true;
},
// FIXME: the listener should probably attached on the conv entry in the
diff --git a/src/modules/FiretrayHandler.jsm b/src/modules/FiretrayHandler.jsm
index 15fc88d..c11a1ca 100644
--- a/src/modules/FiretrayHandler.jsm
+++ b/src/modules/FiretrayHandler.jsm
@@ -85,7 +85,7 @@ firetray.Handler = {
log.debug('FiretrayWindow WINNT imported');
break;
default:
- log.error("FIRETRAY: only Linux and WINNT platforms supported at this"
+ log.error("Only Linux and WINNT platforms supported at this"
+ "time. Firetray not loaded");
return false;
}
diff --git a/src/modules/winnt/FiretrayWindow.jsm b/src/modules/winnt/FiretrayWindow.jsm
index 5d62a6b..3e6a6ed 100644
--- a/src/modules/winnt/FiretrayWindow.jsm
+++ b/src/modules/winnt/FiretrayWindow.jsm
@@ -71,11 +71,11 @@ firetray.Window.wndProc = function(hWnd, uMsg, wParam, lParam) { // filterWindow
return user32.CallWindowProcW(procPrev, hWnd, uMsg, wParam, lParam);
};
-firetray.Window.attachWndProc = function(wid) {
+firetray.Window.attachWndProc = function(wid, hwnd) {
try {
let wndProc = user32.WNDPROC(firetray.Window.wndProc);
log.debug("proc="+wndProc);
- this.wndProcs.insert(wid, wndProc);
+ firetray.Handler.wndProcs.insert(wid, wndProc);
let procPrev = user32.WNDPROC(
user32.SetWindowLongW(hwnd, user32.GWLP_WNDPROC,
ctypes.cast(wndProc, win32.LONG_PTR))
@@ -83,14 +83,19 @@ firetray.Window.attachWndProc = function(wid) {
log.debug("procPrev="+procPrev+" winLastError="+ctypes.winLastError);
// we can't store WNDPROC callbacks (JS ctypes objects) with SetPropW(), as
// we need long-living refs.
- this.wndProcsOrig.insert(wid, procPrev);
+ firetray.Handler.wndProcsOrig.insert(wid, procPrev);
} catch (x) {
- if (x.name === "RangeError") // instanceof not working :-(
- win.alert(x+"\n\nYou seem to have more than "+FIRETRAY_WINDOW_COUNT_MAX
+ if (x.name === "RangeError") { // instanceof not working :-(
+ let msg = x+"\n\nYou seem to have more than "+FIRETRAY_WINDOW_COUNT_MAX
+" windows open. This breaks FireTray and most probably "
- +firetray.Handler.appName+".");
- else win.alert(x);
+ +firetray.Handler.appName+".";
+ log.error(msg);
+ Cu.reportError(msg);
+ }else {
+ log.error(x);
+ Cu.reportError(x);
+ }
}
}
@@ -146,7 +151,7 @@ firetray.Handler.registerWindow = function(win) {
log.debug("window "+wid+" registered");
- this.attachWndProc(wid);
+ firetray.Window.attachWndProc(wid, hwnd);
firetray.Win32.acceptAllMessages(hwnd);
@@ -163,7 +168,7 @@ firetray.Handler.unregisterWindow = function(win) {
return false;
}
- this.detachWndProc(wid);
+ firetray.Window.detachWndProc(wid);
if (!delete firetray.Handler.windows[wid])
throw new DeleteError();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firetray.git
More information about the Pkg-mozext-commits
mailing list