Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: polyfill.js

Issue 29589668: Issue 5938 - Use top-level var for global variables (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Oct. 26, 2017, 8:44 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« include.preload.js ('K') | « include.preload.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: polyfill.js
===================================================================
--- a/polyfill.js
+++ b/polyfill.js
@@ -12,16 +12,18 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
+var browser;
+
{
const asyncAPIs = [
"contextMenus.removeAll",
"devtools.panels.create",
"notifications.clear",
"notifications.create",
"runtime.openOptionsPage",
"runtime.sendMessage",
@@ -127,17 +129,17 @@
}
if (shouldWrapAPIs())
{
// Unlike Firefox and Microsoft Edge, Chrome doesn't have a "browser" object,
// but provides the extension API through the "chrome" namespace
// (non-standard).
if (typeof browser == "undefined")
- window.browser = chrome;
+ browser = chrome;
for (let api of asyncAPIs)
wrapAPI(api);
}
// Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList
// didn't have iterator support before Chrome 51.
// https://bugs.chromium.org/p/chromium/issues/detail?id=401699
« include.preload.js ('K') | « include.preload.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld