Remove previous Safari overhead; cleanup workarounds from rest of code

This commit is contained in:
Chris 2015-02-10 14:24:04 -07:00
parent 029a673a58
commit a17882a8cc
6 changed files with 19 additions and 46 deletions

View File

@ -150,12 +150,6 @@ vAPI.messaging = {
/******************************************************************************/
vAPI.canExecuteContentScript = function() {
return true;
};
/******************************************************************************/
})();
/******************************************************************************/

View File

@ -166,12 +166,6 @@ window.addEventListener('pageshow', vAPI.messaging.toggleListener, true);
/******************************************************************************/
vAPI.canExecuteContentScript = function() {
return true;
};
/******************************************************************************/
})(this);
/******************************************************************************/

View File

@ -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'
};

View File

@ -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;

View File

@ -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 ) {

View File

@ -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 ) {