mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
fix spurious warning in console
This commit is contained in:
parent
62acea8263
commit
51b756d5b7
1 changed files with 11 additions and 6 deletions
|
|
@ -180,14 +180,19 @@ vAPI.tabs.remove = function(tabId) {
|
|||
/******************************************************************************/
|
||||
|
||||
vAPI.tabs.injectScript = function(tabId, details, callback) {
|
||||
if ( typeof callback !== 'function' ) {
|
||||
callback = function(){};
|
||||
}
|
||||
|
||||
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.
|
||||
if ( chrome.runtime.lastError ) {
|
||||
}
|
||||
if ( typeof callback === 'function' ) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
if ( tabId ) {
|
||||
chrome.tabs.executeScript(tabId, details, callback);
|
||||
chrome.tabs.executeScript(tabId, details, onScriptExecuteds);
|
||||
} else {
|
||||
chrome.tabs.executeScript(details, callback);
|
||||
chrome.tabs.executeScript(details, onScriptExecuted);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue