1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +02:00

code review for #456

This commit is contained in:
gorhill 2015-01-01 21:14:53 -05:00
parent 2a7e9f8d98
commit 2d05d51664
3 changed files with 21 additions and 14 deletions

View File

@ -33,16 +33,16 @@
self.vAPI = self.vAPI || {}; self.vAPI = self.vAPI || {};
// https://github.com/gorhill/uBlock/issues/456
// Already injected?
if ( vAPI.vapiClient ) {
return;
}
vAPI.vapiClient = true;
var chrome = self.chrome; var chrome = self.chrome;
var vAPI = self.vAPI; var vAPI = self.vAPI;
// https://github.com/gorhill/uBlock/issues/456
// Already injected?
if ( vAPI.vapiClientInjected ) {
return;
}
vAPI.vapiClientInjected = true;
vAPI.chrome = true; vAPI.chrome = true;
/******************************************************************************/ /******************************************************************************/

View File

@ -21,12 +21,14 @@
/* global vAPI */ /* global vAPI */
'use strict';
/******************************************************************************/ /******************************************************************************/
// Injected into content pages // Injected into content pages
(function() {
'use strict';
/******************************************************************************/ /******************************************************************************/
if ( vAPI.canExecuteContentScript() !== true ) { if ( vAPI.canExecuteContentScript() !== true ) {
@ -35,10 +37,10 @@ if ( vAPI.canExecuteContentScript() !== true ) {
// https://github.com/gorhill/uBlock/issues/456 // https://github.com/gorhill/uBlock/issues/456
// Already injected? // Already injected?
if ( vAPI.contentscriptEnd ) { if ( vAPI.contentscriptEndInjected ) {
return; return;
} }
vAPI.contentscriptEnd = true; vAPI.contentscriptEndInjected = true;
/******************************************************************************/ /******************************************************************************/
@ -684,3 +686,8 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
})(); })();
/******************************************************************************/ /******************************************************************************/
/******************************************************************************/
})();
/******************************************************************************/

View File

@ -46,10 +46,10 @@ if ( vAPI.canExecuteContentScript() !== true ) {
// https://github.com/gorhill/uBlock/issues/456 // https://github.com/gorhill/uBlock/issues/456
// Already injected? // Already injected?
if ( vAPI.contentscriptStart ) { if ( vAPI.contentscriptStartInjected ) {
return; return;
} }
vAPI.contentscriptStart = true; vAPI.contentscriptStartInjected = true;
/******************************************************************************/ /******************************************************************************/
@ -64,7 +64,7 @@ var localMessager = vAPI.messaging.channel('contentscript-start.js');
var cosmeticFilters = function(details) { var cosmeticFilters = function(details) {
var donthideCosmeticFilters = {}; var donthideCosmeticFilters = {};
var hideCosmeticFilters = {}; var hideCosmeticFilters = {};
style = document.createElement('style'); var style = document.createElement('style');
style.setAttribute('id', 'ublock-preload-1ae7a5f130fc79b4fdb8a4272d9426b5'); style.setAttribute('id', 'ublock-preload-1ae7a5f130fc79b4fdb8a4272d9426b5');
var donthide = details.cosmeticDonthide; var donthide = details.cosmeticDonthide;
var hide = details.cosmeticHide; var hide = details.cosmeticHide;