diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/content/topmenuservice.js | 26 |
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; |