From d959c7aabe124459dd122b416c1657ebac4718b3 Mon Sep 17 00:00:00 2001 From: Manish Jethani Date: Mon, 23 Aug 2021 20:24:16 +0530 Subject: [PATCH] Remove globals.js (#3849) --- src/js/biditrie.js | 2 -- src/js/globals.js | 40 ----------------------------------- src/js/logger-ui-inspector.js | 6 +----- src/js/logger-ui.js | 3 +-- tools/make-browser.sh | 1 - tools/make-nodejs.sh | 1 - 6 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 src/js/globals.js diff --git a/src/js/biditrie.js b/src/js/biditrie.js index cddd0a6d0..9ac7a1d70 100644 --- a/src/js/biditrie.js +++ b/src/js/biditrie.js @@ -19,8 +19,6 @@ Home: https://github.com/gorhill/uBlock */ -/* globals WebAssembly vAPI */ - 'use strict'; /******************************************************************************* diff --git a/src/js/globals.js b/src/js/globals.js deleted file mode 100644 index de6d4675f..000000000 --- a/src/js/globals.js +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - - uBlock Origin - a browser extension to block requests. - Copyright (C) 2014-present Raymond Hill - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see {http://www.gnu.org/licenses/}. - - Home: https://github.com/gorhill/uBlock -*/ - -/* globals self */ - -'use strict'; - -/******************************************************************************/ - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis - -const globals = (( ) => { - // jshint ignore:start - if ( typeof globalThis !== 'undefined' ) { return globalThis; } - if ( typeof self !== 'undefined' ) { return self; } - if ( typeof global !== 'undefined' ) { return global; } - // jshint ignore:end -})(); - -/******************************************************************************/ - -export default globals; diff --git a/src/js/logger-ui-inspector.js b/src/js/logger-ui-inspector.js index 26b892198..f474e4926 100644 --- a/src/js/logger-ui-inspector.js +++ b/src/js/logger-ui-inspector.js @@ -25,10 +25,6 @@ /******************************************************************************/ -import globals from './globals.js'; - -/******************************************************************************/ - (( ) => { /******************************************************************************/ @@ -47,7 +43,7 @@ if ( /******************************************************************************/ -const logger = globals.logger; +const logger = self.logger; var inspectorConnectionId; var inspectedTabId = 0; var inspectedURL = ''; diff --git a/src/js/logger-ui.js b/src/js/logger-ui.js index 88175b931..eed219b62 100644 --- a/src/js/logger-ui.js +++ b/src/js/logger-ui.js @@ -25,7 +25,6 @@ /******************************************************************************/ -import globals from './globals.js'; import { hostnameFromURI } from './uri-utils.js'; /******************************************************************************/ @@ -34,7 +33,7 @@ import { hostnameFromURI } from './uri-utils.js'; // accumulated over time. const messaging = vAPI.messaging; -const logger = globals.logger = { ownerId: Date.now() }; +const logger = self.logger = { ownerId: Date.now() }; const logDate = new Date(); const logDateTimezoneOffset = logDate.getTimezoneOffset() * 60000; const loggerEntries = []; diff --git a/tools/make-browser.sh b/tools/make-browser.sh index 2b716a860..b37280d26 100755 --- a/tools/make-browser.sh +++ b/tools/make-browser.sh @@ -10,7 +10,6 @@ mkdir -p $DES/js cp src/js/base64-custom.js $DES/js cp src/js/biditrie.js $DES/js cp src/js/filtering-context.js $DES/js -cp src/js/globals.js $DES/js cp src/js/hntrie.js $DES/js cp src/js/static-filtering-parser.js $DES/js cp src/js/static-net-filtering.js $DES/js diff --git a/tools/make-nodejs.sh b/tools/make-nodejs.sh index 874b2b3a4..d0e96cee8 100755 --- a/tools/make-nodejs.sh +++ b/tools/make-nodejs.sh @@ -11,7 +11,6 @@ cp src/js/base64-custom.js $DES/js cp src/js/biditrie.js $DES/js cp src/js/dynamic-net-filtering.js $DES/js cp src/js/filtering-context.js $DES/js -cp src/js/globals.js $DES/js cp src/js/hnswitches.js $DES/js cp src/js/hntrie.js $DES/js cp src/js/static-filtering-parser.js $DES/js