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: Addressed feedback. Created March 12, 2015, 8:38 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 | « 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 }); 55 });
56 56
57 function onBeforeRequest(url, type, page, frame) 57 function onBeforeRequest(url, type, page, frame)
58 { 58 {
59 if (isFrameWhitelisted(page, frame)) 59 if (isFrameWhitelisted(page, frame))
60 return true; 60 return true;
61 61
62 var docDomain = extractHostFromFrame(frame); 62 var docDomain = extractHostFromFrame(frame);
63 var key = getKey(page, frame); 63 var key = getKey(page, frame);
64 var specificOnly = isFrameWhitelisted(page, frame, "GENERICBLOCK");
64 var filter = defaultMatcher.matchesAny( 65 var filter = defaultMatcher.matchesAny(
65 stringifyURL(url), 66 stringifyURL(url),
66 type, docDomain, 67 type, docDomain,
67 isThirdParty(url, docDomain), 68 isThirdParty(url, docDomain),
68 key 69 key,
70 specificOnly
69 ); 71 );
70 72
71 // We can't listen to onHeadersReceived in Safari so we need to 73 // We can't listen to onHeadersReceived in Safari so we need to
72 // check for notifications here 74 // check for notifications here
73 if (platform != "chromium" && type == "SUBDOCUMENT") 75 if (platform != "chromium" && type == "SUBDOCUMENT")
74 { 76 {
75 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url) ); 77 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url) );
76 if (notificationToShow) 78 if (notificationToShow)
77 showNotification(notificationToShow); 79 showNotification(notificationToShow);
78 } 80 }
(...skipping 27 matching lines...) Expand all
106 processKey(header.value, page, frame); 108 processKey(header.value, page, frame);
107 } 109 }
108 110
109 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new URL(details.url))); 111 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new URL(details.url)));
110 if (notificationToShow) 112 if (notificationToShow)
111 showNotification(notificationToShow); 113 showNotification(notificationToShow);
112 } 114 }
113 115
114 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]); 116 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]);
115 } 117 }
OLDNEW
« no previous file with comments | « popupBlocker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld