From 1f8e42b432f1cbc8f8004ba7c6538f72a7311c6c Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Thu, 25 Aug 2016 22:52:54 +0900 Subject: [PATCH] Update tab's contextual style more certainly --- modules/browser.js | 4 +--- modules/contentBridge.js | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/modules/browser.js b/modules/browser.js index 16d7e4a1..db9e1264 100644 --- a/modules/browser.js +++ b/modules/browser.js @@ -891,7 +891,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, { this.tabsAttributeObserver = new TabAttributesObserver({ container : b.mTabContainer, - attributes : 'usercontextid,style', + attributes : 'usercontextid', callback : (function(aTab) { this.onTabContextIdChanged(aTab); }).bind(this) @@ -4210,8 +4210,6 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, { } } - this.onTabContextIdChanged(tab); - return restored; }, diff --git a/modules/contentBridge.js b/modules/contentBridge.js index 51e589bf..8cf39850 100644 --- a/modules/contentBridge.js +++ b/modules/contentBridge.js @@ -84,11 +84,13 @@ ContentBridge.prototype = inherit(TreeStyleTabConstants, { var manager = this.mTab.ownerDocument.defaultView.messageManager; manager.addMessageListener(this.MESSAGE_TYPE, this.handleMessage); + manager.addMessageListener('Browser:WindowCreated', this.handleMessage); }, destroy : function CB_destroy() { var manager = this.mTab.ownerDocument.defaultView.messageManager; manager.removeMessageListener(this.MESSAGE_TYPE, this.handleMessage); + manager.removeMessageListener('Browser:WindowCreated', this.handleMessage); delete this.mTab; delete this.mTabBrowser; @@ -113,14 +115,27 @@ ContentBridge.prototype = inherit(TreeStyleTabConstants, { }).bind(this)); }, handleMessage : function CB_handleMessage(aMessage) + { + if (aMessage.target != this.mTab.linkedBrowser) + return; + + switch (aMessage.name) + { + case this.MESSAGE_TYPE: + this.handleCommandMessage(aMessage); + return; + + case 'Browser:WindowCreated': + this.mTabBrowser.treeStyleTab.onTabContextIdChanged(this.mTab); + return; + } + }, + handleCommandMessage : function CB_handleCommandMessage(aMessage) { log('*********************handleMessage*******************'); log('TARGET IS: '+aMessage.target.localName); log(JSON.stringify(aMessage.json)); - if (aMessage.target != this.mTab.linkedBrowser) - return; - switch (aMessage.json.command) { case this.COMMAND_REPORT_SELECTION_CHANGE: