Update tab's contextual style more certainly

This commit is contained in:
Piro / YUKI Hiroshi 2016-08-25 22:52:54 +09:00
parent 60d5eeec8f
commit 1f8e42b432
2 changed files with 19 additions and 6 deletions

View File

@ -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;
},

View File

@ -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: