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

Unified Diff: lib/main.js

Issue 6520005931827200: Issue 2259 - Removed non-standard JavaScript code from Element Hiding Helper (Closed)
Patch Set: Turned knownClasses into a Set as well Created April 4, 2015, 3:28 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
Index: lib/main.js
===================================================================
--- a/lib/main.js
+++ b/lib/main.js
@@ -15,13 +15,7 @@
Prefs.migrate("extensions.adblockplus.ehh.showhelp", "showhelp");
// Window types to attach to
-let knownWindowTypes =
-{
- "navigator:browser": true,
- "mail:3pane": true,
- "mail:messageWindow": true,
- __proto__: null
-};
+let knownWindowTypes = new Set(["navigator:browser", "mail:3pane", "mail:messageWindow"]);
// Use random marker class
let elementMarkerClass = null;
@@ -48,7 +42,7 @@
let styleService = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
let styleURI = Services.io.newURI("data:text/css," + encodeURIComponent(data), null, null);
styleService.loadAndRegisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET);
- onShutdown.add(function() styleService.unregisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET));
+ onShutdown.add(() => styleService.unregisterSheet(styleURI, Ci.nsIStyleSheetService.USER_SHEET));
}, false);
request.send(null);
@@ -68,7 +62,7 @@
applyToWindow: function(window)
{
let type = window.document.documentElement.getAttribute("windowtype");
- if (!(type in knownWindowTypes) || window._ehhWrapper)
+ if (!knownWindowTypes.has(type) || window._ehhWrapper)
return;
window.document.documentElement.appendChild(overlay.cloneNode(true));
« chrome/content/composer.js ('K') | « lib/inspectorObserver.js ('k') | lib/windowWrapper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld