Skip to content

Commit

Permalink
Muting try-catch for Chrome<45 + Background script import order
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonjet committed Feb 6, 2016
1 parent a7d9f3a commit 6c66bcf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/library/modules/Service.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ See Manifest File [manifest.json] under "background" > "scripts"
------------------------------------------*/
"isMuted" :function(request, sender, response){
chrome.tabs.get(request.tabId, function(tabInfo){
response(tabInfo.mutedInfo.muted);
try {
response(tabInfo.mutedInfo.muted);
}catch(e){
response(false);
}
});
return true;
},
Expand All @@ -138,10 +142,14 @@ See Manifest File [manifest.json] under "background" > "scripts"
------------------------------------------*/
"toggleSounds" :function(request, sender, response){
chrome.tabs.get(request.tabId, function(tabInfo){
chrome.tabs.update(request.tabId, {
muted: tabInfo.mutedInfo.muted?false:true,
});
response(!tabInfo.mutedInfo.muted);
try {
chrome.tabs.update(request.tabId, {
muted: tabInfo.mutedInfo.muted?false:true,
});
response(!tabInfo.mutedInfo.muted);
}catch(e){
response(false);
}
return true;
});
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"background": {
"scripts": [
"assets/js/jquery-2.1.3.min.js",
"library/managers/ConfigManager.js",
"library/objects/Messengers.js",
"library/managers/ConfigManager.js",
"library/modules/Service.js"
]
},
Expand Down

0 comments on commit 6c66bcf

Please sign in to comment.