1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-24 19:33:01 +01:00

more spurious warnings in console foiled

This commit is contained in:
Raymond Hill 2014-11-20 23:18:33 -02:00
parent 94e5635053
commit 33969e8b2e

View File

@ -69,11 +69,22 @@ vAPI.tabs.registerListeners = function() {
/******************************************************************************/
vAPI.tabs.get = function(tabId, callback) {
var onTabReady = function(tab) {
// https://code.google.com/p/chromium/issues/detail?id=410868#c8
if ( chrome.runtime.lastError ) {
return;
}
callback(tab);
}
if ( tabId !== null ) {
chrome.tabs.get(tabId, callback);
chrome.tabs.get(tabId, onTabReady);
return;
}
var onTabReceived = function(tabs) {
// https://code.google.com/p/chromium/issues/detail?id=410868#c8
if ( chrome.runtime.lastError ) {
return;
}
callback(tabs[0]);
};
chrome.tabs.query({ active: true, currentWindow: true }, onTabReceived);
@ -181,8 +192,7 @@ vAPI.tabs.remove = function(tabId) {
vAPI.tabs.injectScript = function(tabId, details, callback) {
var onScriptExecuted = function() {
// Must check `lastError` or else this may happen in the console:
// Unchecked runtime.lastError while running tabs.executeScript: The tab was closed.
// https://code.google.com/p/chromium/issues/detail?id=410868#c8
if ( chrome.runtime.lastError ) {
}
if ( typeof callback === 'function' ) {