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

Side by Side Diff: webrequest.js

Issue 29321504: Issue 2738 - Pass bit masks to matching functions (Closed)
Patch Set: Updated to match adblockplus changes and addressed feedback Created July 12, 2015, 2:25 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
« lib/whitelisting.js ('K') | « popupBlocker.js ('k') | no next file » | 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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 function onBeforeRequest(url, type, page, frame) 61 function onBeforeRequest(url, type, page, frame)
62 { 62 {
63 if (isFrameWhitelisted(page, frame)) 63 if (isFrameWhitelisted(page, frame))
64 return true; 64 return true;
65 65
66 var docDomain = extractHostFromFrame(frame); 66 var docDomain = extractHostFromFrame(frame);
67 var key = getKey(page, frame); 67 var key = getKey(page, frame);
68 var filter = defaultMatcher.matchesAny( 68 var filter = defaultMatcher.matchesAny(
69 stringifyURL(url), 69 stringifyURL(url),
70 type, docDomain, 70 RegExpFilter.typeMap[type], docDomain,
71 isThirdParty(url, docDomain), 71 isThirdParty(url, docDomain),
72 key 72 key
73 ); 73 );
74 74
75 setTimeout(onBeforeRequestAsync, 0, url, type, page, filter); 75 setTimeout(onBeforeRequestAsync, 0, url, type, page, filter);
76 76
77 return !(filter instanceof BlockingFilter); 77 return !(filter instanceof BlockingFilter);
78 } 78 }
79 79
80 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest); 80 ext.webRequest.onBeforeRequest.addListener(onBeforeRequest);
(...skipping 20 matching lines...) Expand all
101 101
102 chrome.webRequest.onHeadersReceived.addListener( 102 chrome.webRequest.onHeadersReceived.addListener(
103 onHeadersReceived, 103 onHeadersReceived,
104 { 104 {
105 urls: ["http://*/*", "https://*/*"], 105 urls: ["http://*/*", "https://*/*"],
106 types: ["main_frame", "sub_frame"] 106 types: ["main_frame", "sub_frame"]
107 }, 107 },
108 ["responseHeaders"] 108 ["responseHeaders"]
109 ); 109 );
110 } 110 }
OLDNEW
« lib/whitelisting.js ('K') | « popupBlocker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld