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

Side by Side Diff: webrequest.js

Issue 5192819564085248: Issue 2063 - Make ext.webRequest use ABP instead Chrome request types (Closed)
Patch Set: Created Feb. 28, 2015, 9:55 a.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 | « safari/ext/content.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 filter = defaultMatcher.matchesAny( 57 var filter = defaultMatcher.matchesAny(
58 stringifyURL(url), 58 stringifyURL(url),
59 type == "sub_frame" ? "SUBDOCUMENT" : type.toUpperCase(), 59 type, docDomain,
60 docDomain,
61 isThirdParty(url, docDomain), 60 isThirdParty(url, docDomain),
62 key 61 key
63 ); 62 );
64 63
65 // We can't listen to onHeadersReceived in Safari so we need to 64 // We can't listen to onHeadersReceived in Safari so we need to
66 // check for notifications here 65 // check for notifications here
67 if (platform != "chromium" && type == "sub_frame") 66 if (platform != "chromium" && type == "SUBDOCUMENT")
68 { 67 {
69 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url) ); 68 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url) );
70 if (notificationToShow) 69 if (notificationToShow)
71 showNotification(notificationToShow); 70 showNotification(notificationToShow);
72 } 71 }
73 72
74 FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page); 73 FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page);
75 return !(filter instanceof BlockingFilter); 74 return !(filter instanceof BlockingFilter);
76 } 75 }
77 76
(...skipping 22 matching lines...) Expand all
100 processKey(header.value, page, frame); 99 processKey(header.value, page, frame);
101 } 100 }
102 101
103 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new URL(details.url))); 102 var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(new URL(details.url)));
104 if (notificationToShow) 103 if (notificationToShow)
105 showNotification(notificationToShow); 104 showNotification(notificationToShow);
106 } 105 }
107 106
108 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]); 107 chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["ht tp://*/*", "https://*/*"]}, ["responseHeaders"]);
109 } 108 }
OLDNEW
« no previous file with comments | « safari/ext/content.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld