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

Delta Between Two Patch Sets: lib/csp.js

Issue 29998582: Issue [TBD] - Update adblockpluscore dependency to [TBD] Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Created Feb. 5, 2019, 4:07 a.m.
Right Patch Set: Reformat Created Feb. 5, 2019, 5:45 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | lib/devtools.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 if (specificOnly && !(cspMatch instanceof WhitelistFilter)) 52 if (specificOnly && !(cspMatch instanceof WhitelistFilter))
53 { 53 {
54 cspMatch = defaultMatcher.matchesAny(url, typeMap.CSP, hostname, 54 cspMatch = defaultMatcher.matchesAny(url, typeMap.CSP, hostname,
55 null, specificOnly); 55 null, specificOnly);
56 if (!cspMatch) 56 if (!cspMatch)
57 return; 57 return;
58 } 58 }
59 59
60 if (cspMatch instanceof WhitelistFilter) 60 if (cspMatch instanceof WhitelistFilter)
61 { 61 {
62 logRequest([details.tabId], { 62 logRequest(
63 url: details.url, type: "CSP", docDomain: hostname, 63 [details.tabId],
64 specificOnly 64 {url: details.url, type: "CSP", docDomain: hostname, specificOnly},
65 }, cspMatch); 65 cspMatch
66 );
66 filterNotifier.emit("filter.hitCount", cspMatch, 0, 0, [details.tabId]); 67 filterNotifier.emit("filter.hitCount", cspMatch, 0, 0, [details.tabId]);
67 return; 68 return;
68 } 69 }
69 70
70 let {blocking} = defaultMatcher.search(url, typeMap.CSP, hostname, 71 let {blocking} = defaultMatcher.search(url, typeMap.CSP, hostname, null,
71 null, specificOnly, 72 specificOnly, "blocking");
72 "blocking");
73 for (cspMatch of blocking) 73 for (cspMatch of blocking)
74 { 74 {
75 logRequest([details.tabId], { 75 logRequest(
76 url: details.url, type: "CSP", docDomain: hostname, 76 [details.tabId],
77 specificOnly 77 {url: details.url, type: "CSP", docDomain: hostname, specificOnly},
78 }, cspMatch); 78 cspMatch
79 );
79 filterNotifier.emit("filter.hitCount", cspMatch, 0, 0, [details.tabId]); 80 filterNotifier.emit("filter.hitCount", cspMatch, 0, 0, [details.tabId]);
80 81
81 details.responseHeaders.push({ 82 details.responseHeaders.push({
82 name: "Content-Security-Policy", 83 name: "Content-Security-Policy",
83 value: cspMatch.csp 84 value: cspMatch.csp
84 }); 85 });
85 } 86 }
86 87
87 return {responseHeaders: details.responseHeaders}; 88 return {responseHeaders: details.responseHeaders};
88 } 89 }
89 }, { 90 }, {
90 urls: ["http://*/*", "https://*/*"], 91 urls: ["http://*/*", "https://*/*"],
91 types: ["main_frame", "sub_frame"] 92 types: ["main_frame", "sub_frame"]
92 }, ["blocking", "responseHeaders"]); 93 }, ["blocking", "responseHeaders"]);
LEFTRIGHT
« no previous file | lib/devtools.js » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld