mirror of https://github.com/gorhill/uBlock.git
Remove previous Safari overhead; cleanup workarounds from rest of code
This commit is contained in:
parent
029a673a58
commit
a17882a8cc
|
@ -150,12 +150,6 @@ vAPI.messaging = {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
vAPI.canExecuteContentScript = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
})();
|
||||
|
||||
/******************************************************************************/
|
|
@ -166,12 +166,6 @@ window.addEventListener('pageshow', vAPI.messaging.toggleListener, true);
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
vAPI.canExecuteContentScript = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
})(this);
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
var vAPI = self.vAPI = self.vAPI || {};
|
||||
|
||||
vAPI.safari = true;
|
||||
var noopFunc = function(){};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
@ -349,12 +348,10 @@
|
|||
|
||||
if(details.file) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.overrideMimeType('application/x-javascript;charset=utf-8');
|
||||
xhr.open('GET', details.file, false);
|
||||
xhr.send();
|
||||
xhr.open('GET', details.file, true);
|
||||
xhr.addEventListener("readystatechange", function() {
|
||||
if(this.readyState === 4) {
|
||||
details.code = xhr.responseText;
|
||||
}
|
||||
|
||||
tab.page.dispatchMessage('broadcast', {
|
||||
channelName: 'vAPI',
|
||||
msg: {
|
||||
|
@ -362,10 +359,13 @@
|
|||
details: details
|
||||
}
|
||||
});
|
||||
|
||||
if(typeof callback === 'function') {
|
||||
setTimeout(callback, 13);
|
||||
}
|
||||
}
|
||||
});
|
||||
xhr.send();
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -488,7 +488,7 @@
|
|||
vAPI.messaging = {
|
||||
listeners: {},
|
||||
defaultHandler: null,
|
||||
NOOPFUNC: noopFunc,
|
||||
NOOPFUNC: function() {},
|
||||
UNHANDLED: 'vAPI.messaging.notHandled'
|
||||
};
|
||||
|
||||
|
|
|
@ -146,10 +146,6 @@
|
|||
}
|
||||
};
|
||||
|
||||
vAPI.canExecuteContentScript = function() {
|
||||
return (/^https?:/.test(location.protocol) && typeof safari === "object");
|
||||
};
|
||||
|
||||
// The following code should run only in content pages
|
||||
if(location.protocol === "safari-extension:" || typeof safari !== "object") {
|
||||
return;
|
||||
|
|
|
@ -42,11 +42,6 @@ if ( !vAPI ) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( vAPI.canExecuteContentScript() !== true ) {
|
||||
//console.debug('contentscript-end.js > can\'t execute');
|
||||
return;
|
||||
}
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/587
|
||||
// Pointless to execute without the start script having done its job.
|
||||
if ( !vAPI.contentscriptStartInjected ) {
|
||||
|
|
|
@ -46,12 +46,6 @@ if ( !vAPI ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Because Safari
|
||||
if ( vAPI.canExecuteContentScript() !== true ) {
|
||||
//console.debug('contentscript-start.js > can\'t execute');
|
||||
return;
|
||||
}
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/456
|
||||
// Already injected?
|
||||
if ( vAPI.contentscriptStartInjected ) {
|
||||
|
|
Loading…
Reference in New Issue