Add communication in order to rememdy bug where window names were overwritten

This commit is contained in:
Nick Krichevsky 2015-02-21 21:39:21 -05:00
parent b66398a4b0
commit 3520b84d83
2 changed files with 10 additions and 1 deletions

View file

@ -166,6 +166,14 @@ chrome.tabs.onAttached.addListener(function(tabId,objects){
}
});
chrome.runtime.onMessage.addListener(function(response){
if (response.hasOwnProperty('nameChange')){
var currentWindow = findWindowById(response.nameChange.windowId);
currentWindow.window.name = response.nameChange.name;
saveWindows();
}
});
//init
chrome.storage.local.get('windows',function(result){
console.log(result);
@ -176,4 +184,4 @@ clearStorage(function(){
createWindowStorage(function(){
populateWindowStorage();
});
});
});

View file

@ -15,6 +15,7 @@ function changeWindowName(windowId,newName,callback){
if (changedWindow.length===1){
changedWindow[0].name = newName;
chrome.storage.local.set({"windows":windows},callback);
chrome.runtime.sendMessage({'nameChange':{'windowId':windowId,'name':newName}});
}
else{
throw "More than one window has the id "+windowId+". This should never happen."