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

Side by Side Diff: webrequest.js

Issue 5138680696012800: Issue 616 - Enforce $generichide and $genericblock in Chrome (Closed)
Patch Set: Created March 11, 2015, 5: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
« background.js ('K') | « background.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 }); 48 });
49 49
50 function onBeforeRequest(url, type, page, frame) 50 function onBeforeRequest(url, type, page, frame)
51 { 51 {
52 if (isFrameWhitelisted(page, frame)) 52 if (isFrameWhitelisted(page, frame))
53 return true; 53 return true;
54 54
55 var docDomain = extractHostFromFrame(frame); 55 var docDomain = extractHostFromFrame(frame);
56 var key = getKey(page, frame); 56 var key = getKey(page, frame);
57 var specificOnly = isFrameWhitelisted(page, frame, "GENERICBLOCK");
57 var filter = defaultMatcher.matchesAny( 58 var filter = defaultMatcher.matchesAny(
58 stringifyURL(url), 59 stringifyURL(url),
59 type == "sub_frame" ? "SUBDOCUMENT" : type.toUpperCase(), 60 type == "sub_frame" ? "SUBDOCUMENT" : type.toUpperCase(),
60 docDomain, 61 docDomain,
61 isThirdParty(url, docDomain), 62 isThirdParty(url, docDomain),
62 key 63 key,
64 specificOnly
Sebastian Noack 2015/03/12 12:36:12 I suppose this isn't the only call that needs to b
kzar 2015/03/12 19:22:45 Good point, I didn't consider popups! I updated my
63 ); 65 );
64 66
65 // We can't listen to onHeadersReceived in Safari so we need to 67 // We can't listen to onHeadersReceived in Safari so we need to
66 // check for notifications here 68 // check for notifications here
67 if (platform != "chromium" && type == "sub_frame") 69 if (platform != "chromium" && type == "sub_frame")
68 { 70 {
69 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url) ); 71 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url) );
70 if (notificationToShow) 72 if (notificationToShow)
71 showNotification(notificationToShow); 73 showNotification(notificationToShow);
72 } 74 }
(...skipping 27 matching lines...) Expand all
100 processKey(header.value, page, frame); 102 processKey(header.value, page, frame);
101 } 103 }
102 104
103 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new URL(details.url))); 105 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new URL(details.url)));
104 if (notificationToShow) 106 if (notificationToShow)
105 showNotification(notificationToShow); 107 showNotification(notificationToShow);
106 } 108 }
107 109
108 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]); 110 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]);
109 } 111 }
OLDNEW
« background.js ('K') | « background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld