1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-29 14:17:11 +02:00

Add support for Chrome 22; fixes #1174

This commit is contained in:
Chris 2015-04-07 03:22:10 -06:00
parent 1f3ff792f3
commit 5d06019b19
4 changed files with 44 additions and 4 deletions

View File

@ -12,10 +12,7 @@
}, },
"browser_action": { "browser_action": {
"default_icon": { "default_icon": "img/browsericons/icon19-off.png",
"19": "img/browsericons/icon19-off.png",
"38": "img/browsericons/icon38-off.png"
},
"default_title": "uBlock", "default_title": "uBlock",
"default_popup": "popup.html" "default_popup": "popup.html"
}, },

View File

@ -49,6 +49,20 @@ vAPI.app = {
/******************************************************************************/ /******************************************************************************/
if (!chrome.runtime) {
// Chrome 20-21
chrome.runtime = chrome.extension;
}
else if(!chrome.runtime.onMessage) {
// Chrome 22-25
chrome.runtime.onMessage = chrome.extension.onMessage;
chrome.runtime.sendMessage = chrome.extension.sendMessage;
chrome.runtime.onConnect = chrome.extension.onConnect;
chrome.runtime.connect = chrome.extension.connect;
}
/******************************************************************************/
vAPI.app.restart = function() { vAPI.app.restart = function() {
chrome.runtime.reload(); chrome.runtime.reload();
}; };
@ -711,6 +725,18 @@ vAPI.onLoadAllCompleted = function() {
} }
}; };
var iconPaths = { '19': 'img/browsericons/icon19-off.png',
'38': 'img/browsericons/icon38-off.png' };
try {
chrome.browserAction.setIcon({ path: iconPaths }); // Hello? Is this a recent version of Chrome?
}
catch(e) {
chrome.browserAction._setIcon = chrome.browserAction.setIcon; // Nope; looks like older than v23
chrome.browserAction.setIcon = function(x, clbk){ // Shim
this._setIcon({path: x.path[19]}, clbk);
};
chrome.browserAction.setIcon({ path: iconPaths }); /* maybe this time... I'll win! */
};
chrome.tabs.query({ url: 'http://*/*' }, bindToTabs); chrome.tabs.query({ url: 'http://*/*' }, bindToTabs);
chrome.tabs.query({ url: 'https://*/*' }, bindToTabs); chrome.tabs.query({ url: 'https://*/*' }, bindToTabs);
}; };

View File

@ -48,6 +48,20 @@ vAPI.chrome = true;
/******************************************************************************/ /******************************************************************************/
if (!chrome.runtime) {
// Chrome 20-21
chrome.runtime = chrome.extension;
}
else if(!chrome.runtime.onMessage) {
// Chrome 22-25
chrome.runtime.onMessage = chrome.extension.onMessage;
chrome.runtime.sendMessage = chrome.extension.sendMessage;
chrome.runtime.onConnect = chrome.extension.onConnect;
chrome.runtime.connect = chrome.extension.connect;
}
/******************************************************************************/
var messagingConnector = function(response) { var messagingConnector = function(response) {
if ( !response ) { if ( !response ) {
return; return;

View File

@ -27,6 +27,9 @@ var quickProfiler = (function() {
'use strict'; 'use strict';
var timer = window.performance || Date; var timer = window.performance || Date;
if(typeof timer.now === "undefined") {
timer.now = timer.webkitNow;
}
var time = 0; var time = 0;
var count = 0; var count = 0;
var tstart = 0; var tstart = 0;