Add communication in order to rememdy bug where window names were overwritten
This commit is contained in:
parent
b66398a4b0
commit
3520b84d83
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
popup.js
1
popup.js
|
@ -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."
|
||||
|
|
Loading…
Reference in a new issue