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

Side by Side Diff: lib/whitelisting.js

Issue 29371763: Issue 4795 - Use modern JavaScript syntax (Closed)
Patch Set: "use strict"; Created Jan. 16, 2017, 3:30 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/utils.js ('k') | notification.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 let checkWhitelisted = 53 let checkWhitelisted =
54 /** 54 /**
55 * Gets the active whitelisting filter for the document associated 55 * Gets the active whitelisting filter for the document associated
56 * with the given page/frame, or null if it's not whitelisted. 56 * with the given page/frame, or null if it's not whitelisted.
57 * 57 *
58 * @param {Page} page 58 * @param {Page} page
59 * @param {Frame} [frame] 59 * @param {Frame} [frame]
60 * @param {number} [typeMask=RegExpFilter.typeMap.DOCUMENT] 60 * @param {number} [typeMask=RegExpFilter.typeMap.DOCUMENT]
61 * @return {?WhitelistFilter} 61 * @return {?WhitelistFilter}
62 */ 62 */
63 exports.checkWhitelisted = function(page, frame, typeMask) 63 exports.checkWhitelisted = (page, frame, typeMask) =>
64 { 64 {
65 if (typeof typeMask == "undefined") 65 if (typeof typeMask == "undefined")
66 typeMask = RegExpFilter.typeMap.DOCUMENT; 66 typeMask = RegExpFilter.typeMap.DOCUMENT;
67 67
68 if (frame) 68 if (frame)
69 { 69 {
70 let filter = null; 70 let filter = null;
71 71
72 while (frame && !filter) 72 while (frame && !filter)
73 { 73 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 let getKey = 112 let getKey =
113 /** 113 /**
114 * Gets the public key, previously recorded for the given page 114 * Gets the public key, previously recorded for the given page
115 * and frame, to be considered for the $sitekey filter option. 115 * and frame, to be considered for the $sitekey filter option.
116 * 116 *
117 * @param {Page} page 117 * @param {Page} page
118 * @param {Frame} frame 118 * @param {Frame} frame
119 * @return {string} 119 * @return {string}
120 */ 120 */
121 exports.getKey = function(page, frame) 121 exports.getKey = (page, frame) =>
122 { 122 {
123 let keys = sitekeys.get(page); 123 let keys = sitekeys.get(page);
124 if (!keys) 124 if (!keys)
125 return null; 125 return null;
126 126
127 for (; frame != null; frame = frame.parent) 127 for (; frame != null; frame = frame.parent)
128 { 128 {
129 let key = keys[stringifyURL(frame.url)]; 129 let key = keys[stringifyURL(frame.url)];
130 if (key) 130 if (key)
131 return key; 131 return key;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 if (typeof chrome == "object") 196 if (typeof chrome == "object")
197 chrome.webRequest.onHeadersReceived.addListener( 197 chrome.webRequest.onHeadersReceived.addListener(
198 onHeadersReceived, 198 onHeadersReceived,
199 { 199 {
200 urls: ["http://*/*", "https://*/*"], 200 urls: ["http://*/*", "https://*/*"],
201 types: ["main_frame", "sub_frame"] 201 types: ["main_frame", "sub_frame"]
202 }, 202 },
203 ["responseHeaders"] 203 ["responseHeaders"]
204 ); 204 );
OLDNEW
« no previous file with comments | « lib/utils.js ('k') | notification.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld