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

Side by Side Diff: lib/csp.js

Issue 29713631: Issue 5760 - Use relative require paths (Closed)
Patch Set: Address PS4 comments, rebase Created April 5, 2018, 11:09 p.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 | « include.preload.js ('k') | lib/cssInjection.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-present eyeo GmbH 3 * Copyright (C) 2006-present 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 "use strict"; 18 "use strict";
19 19
20 const {defaultMatcher} = require("matcher"); 20 const {defaultMatcher} = require("../adblockpluscore/lib/matcher");
21 const {RegExpFilter, WhitelistFilter} = require("filterClasses"); 21 const {RegExpFilter, WhitelistFilter} =
22 require("../adblockpluscore/lib/filterClasses");
22 const {extractHostFromFrame, getDecodedHostname, 23 const {extractHostFromFrame, getDecodedHostname,
23 isThirdParty, stringifyURL} = require("url"); 24 isThirdParty, stringifyURL} = require("./url");
24 const {checkWhitelisted} = require("whitelisting"); 25 const {checkWhitelisted} = require("./whitelisting");
25 const {FilterNotifier} = require("filterNotifier"); 26 const {FilterNotifier} = require("filterNotifier");
26 const devtools = require("devtools"); 27 const devtools = require("./devtools");
27 28
28 const {typeMap} = RegExpFilter; 29 const {typeMap} = RegExpFilter;
29 30
30 browser.webRequest.onHeadersReceived.addListener(details => 31 browser.webRequest.onHeadersReceived.addListener(details =>
31 { 32 {
32 let url = new URL(details.url); 33 let url = new URL(details.url);
33 let urlString = stringifyURL(url); 34 let urlString = stringifyURL(url);
34 let parentFrame = ext.getFrame(details.tabId, details.parentFrameId); 35 let parentFrame = ext.getFrame(details.tabId, details.parentFrameId);
35 let hostname = extractHostFromFrame(parentFrame) || getDecodedHostname(url); 36 let hostname = extractHostFromFrame(parentFrame) || getDecodedHostname(url);
36 let thirdParty = isThirdParty(url, hostname); 37 let thirdParty = isThirdParty(url, hostname);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 name: "Content-Security-Policy", 71 name: "Content-Security-Policy",
71 value: cspMatch.csp 72 value: cspMatch.csp
72 }); 73 });
73 74
74 return {responseHeaders: details.responseHeaders}; 75 return {responseHeaders: details.responseHeaders};
75 } 76 }
76 }, { 77 }, {
77 urls: ["http://*/*", "https://*/*"], 78 urls: ["http://*/*", "https://*/*"],
78 types: ["main_frame", "sub_frame"] 79 types: ["main_frame", "sub_frame"]
79 }, ["blocking", "responseHeaders"]); 80 }, ["blocking", "responseHeaders"]);
OLDNEW
« no previous file with comments | « include.preload.js ('k') | lib/cssInjection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld