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

Unified Diff: lib/whitelisting.js

Issue 29715577: Issue 6449 - Switch to Harmony modules (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Add lib/.eslintrc.json Created March 6, 2018, 10:30 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
« lib/.eslintrc.json ('K') | « lib/utils.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/whitelisting.js
===================================================================
--- a/lib/whitelisting.js
+++ b/lib/whitelisting.js
@@ -12,27 +12,25 @@
* 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/>.
*/
/** @module whitelisting */
-"use strict";
-
-const {defaultMatcher} = require("matcher");
-const {Filter, RegExpFilter} = require("filterClasses");
-const {FilterNotifier} = require("filterNotifier");
-const {FilterStorage} = require("filterStorage");
-const {stringifyURL, getDecodedHostname,
- extractHostFromFrame, isThirdParty} = require("url");
-const {port} = require("messaging");
-const devtools = require("devtools");
-const {verifySignature} = require("rsa");
+import {defaultMatcher} from "matcher";
+import {Filter, RegExpFilter} from "filterClasses";
+import {FilterNotifier} from "filterNotifier";
+import {FilterStorage} from "filterStorage";
+import {stringifyURL, getDecodedHostname,
+ extractHostFromFrame, isThirdParty} from "url";
+import {port} from "messaging";
+import devtools from "devtools";
+import {verifySignature} from "rsa";
let sitekeys = new ext.PageMap();
function match(page, url, typeMask, docDomain, sitekey)
{
let thirdParty = !!docDomain && isThirdParty(url, docDomain);
let urlString = stringifyURL(url);
@@ -48,27 +46,26 @@
devtools.logWhitelistedDocument(
page, urlString, typeMask, docDomain, filter
);
}
return filter;
}
-let checkWhitelisted =
/**
* Gets the active whitelisting filter for the document associated
* with the given page/frame, or null if it's not whitelisted.
*
* @param {Page} page
* @param {Frame} [frame]
* @param {number} [typeMask=RegExpFilter.typeMap.DOCUMENT]
* @return {?WhitelistFilter}
*/
-exports.checkWhitelisted = (page, frame, typeMask) =>
+export const checkWhitelisted = (page, frame, typeMask) =>
{
if (typeof typeMask == "undefined")
typeMask = RegExpFilter.typeMap.DOCUMENT;
if (frame)
{
let filter = null;
@@ -137,26 +134,25 @@
{
for (let tab of tabs)
revalidateWhitelistingState(new ext.Page(tab));
});
});
ext.pages.onLoading.addListener(revalidateWhitelistingState);
-let getKey =
/**
* Gets the public key, previously recorded for the given page
* and frame, to be considered for the $sitekey filter option.
*
* @param {Page} page
* @param {Frame} frame
* @return {string}
*/
-exports.getKey = (page, frame) =>
+export const getKey = (page, frame) =>
{
let keys = sitekeys.get(page);
if (!keys)
return null;
for (; frame != null; frame = frame.parent)
{
let key = keys.get(stringifyURL(frame.url));
« lib/.eslintrc.json ('K') | « lib/utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld