code review re #118

pull/2/head
gorhill 10 years ago
parent 390733affe
commit df27e666a7

@ -200,19 +200,12 @@ vAPI.tabs.open = function(details) {
return; return;
} }
chrome.tabs.query({}, function(tabs) { chrome.tabs.query({ url: targetURL }, function(tabs) {
var rgxHash = /#.*/; var tab = tabs[0];
// this is questionable if ( tab ) {
var url = targetURL.replace(rgxHash, ''); chrome.windows.update(tab.windowId, { focused: true });
var selected = tabs.some(function(tab) { chrome.tabs.update(tab.id, { active: true });
if ( tab.url.replace(rgxHash, '') === url ) { } else {
chrome.tabs.update(tab.id, { active: true });
chrome.windows.update(tab.windowId, { focused: true });
return true;
}
});
if ( !selected ) {
wrapper(); wrapper();
} }
}); });

Loading…
Cancel
Save