summaryrefslogtreecommitdiff
path: root/chrome
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2014-02-23 18:48:57 +0100
committerJavier <dev.git@javispedro.com>2014-02-23 18:48:57 +0100
commit37fb58b7f9116680c9b63fcf3f40dc27109c398d (patch)
tree5d7923ced28209b4a46179ff66452bf0bfcf7094 /chrome
parent1fbcb3f7bf7ddf955193d798837ab88cf2815112 (diff)
downloadtopmenu-mozilla-37fb58b7f9116680c9b63fcf3f40dc27109c398d.tar.gz
topmenu-mozilla-37fb58b7f9116680c9b63fcf3f40dc27109c398d.zip
heuristic to avoid exporting Firefox Places menubar
Diffstat (limited to 'chrome')
-rw-r--r--chrome/content/topmenuservice.js26
1 files changed, 20 insertions, 6 deletions
diff --git a/chrome/content/topmenuservice.js b/chrome/content/topmenuservice.js
index 96d0e6c..30b66eb 100644
--- a/chrome/content/topmenuservice.js
+++ b/chrome/content/topmenuservice.js
@@ -62,11 +62,20 @@ function WindowProxy(window) {
}
this.srcWindow = window;
- this.srcMenuBar = null;
- this.observer = null;
- this.appMenuBar = null;
+ this.srcMenuBar = menubars[0];
+
+ // A hack to heuristically detect if we must export this menubar.
+ var srcMenuBarParent = this.srcMenuBar.parentNode;
+ if (srcMenuBarParent.firstChild !== this.srcMenuBar) {
+ // This menu is not the first child on the parent item.
+ // Do not export this menubar.
+ this.srcWindow = null;
+ this.srcMenuBar = null;
+ return;
+ }
+
+
this.gdkWindow = getTopLevelGdkWindow(window);
- this.accelGroup = null;
this.flags = {};
this.updateFlags();
@@ -780,11 +789,15 @@ WindowProxy.prototype.fakeCommandEvent = function(item) {
WindowProxy.prototype.unload = function() {
this.setMenuBarVisibility(true);
- topmenu_client.topmenu_client_disconnect_window(this.gdkWindow);
+ if (this.gdkWindow) {
+ topmenu_client.topmenu_client_disconnect_window(this.gdkWindow);
+ }
}
WindowProxy.prototype.dispose = function() {
- window.document.removeEventListener("keypress", this.callbacks.keypress);
+ if (this.srcWindow) {
+ this.srcWindow.document.removeEventListener("keypress", this.callbacks.keypress);
+ }
if (this.monitor) {
if (this.monitorConnectionId) {
gobject.g_signal_handler_disconnect(this.monitor, this.monitorConnectionId);
@@ -810,6 +823,7 @@ WindowProxy.prototype.dispose = function() {
}
this.gdkWindow = null;
+ this.srcMenuBar = null;
this.srcWindow = null;
this.menus = null;
this.items = null;