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

Unified Diff: lib/filterComposer.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: Define and destructure backgroundPage more consistently, fix minor whitespace errors Created Jan. 18, 2017, 7:34 a.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/filterComposer.js
diff --git a/lib/filterComposer.js b/lib/filterComposer.js
index 10390f9f3be7462ec52da3639872fa1df757b2a8..454204a2989159ed3d3e8c58e726a7795594bc5c 100644
--- a/lib/filterComposer.js
+++ b/lib/filterComposer.js
@@ -19,13 +19,13 @@
"use strict";
-let {defaultMatcher} = require("matcher");
-let {RegExpFilter} = require("filterClasses");
-let {FilterNotifier} = require("filterNotifier");
-let {Prefs} = require("prefs");
-let {extractHostFromFrame, stringifyURL, isThirdParty} = require("url");
-let {getKey, checkWhitelisted} = require("whitelisting");
-let {port} = require("messaging");
+const {defaultMatcher} = require("matcher");
+const {RegExpFilter} = require("filterClasses");
+const {FilterNotifier} = require("filterNotifier");
+const {Prefs} = require("prefs");
+const {extractHostFromFrame, stringifyURL, isThirdParty} = require("url");
+const {getKey, checkWhitelisted} = require("whitelisting");
+const {port} = require("messaging");
let readyPages = new ext.PageMap();
@@ -35,7 +35,7 @@ let readyPages = new ext.PageMap();
* @param {Page} page
* @return {boolean}
*/
-exports.isPageReady = function(page)
+exports.isPageReady = page =>
{
return readyPages.has(page);
};
@@ -66,7 +66,7 @@ let escapeCSS =
* @return {string}
* @static
*/
-exports.escapeCSS = function(s)
+exports.escapeCSS = s =>
{
return s.replace(/^[\d\-]|[^\w\-\u0080-\uFFFF]/g, escapeChar);
};
@@ -79,7 +79,7 @@ let quoteCSS =
* @return {string}
* @static
*/
-exports.quoteCSS = function(value)
+exports.quoteCSS = value =>
{
return '"' + value.replace(/["\\\{\}\x00-\x1F\x7F]/g, escapeChar) + '"';
};
@@ -156,7 +156,7 @@ function composeFilters(details)
let contextMenuItem = {
title: ext.i18n.getMessage("block_element"),
contexts: ["image", "video", "audio"],
- onclick: page =>
+ onclick(page)
{
page.sendMessage({type: "composer.content.contextMenuClicked"});
}

Powered by Google App Engine
This is Rietveld