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

Unified Diff: webrequest.js

Issue 5630329503088640: Fixed miscellaneous issues with anti-adblock notification port (Closed)
Patch Set: Created March 28, 2014, 3:29 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« background.js ('K') | « background.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrequest.js
===================================================================
--- a/webrequest.js
+++ b/webrequest.js
@@ -16,6 +16,7 @@
*/
var FilterNotifier = require("filterNotifier").FilterNotifier;
+var platform = require("info").platform;
var onFilterChangeTimeout = null;
function onFilterChange()
@@ -59,13 +60,22 @@
isThirdParty(extractHostFromURL(url), docDomain)
);
+ // We can't listen to onHeadersReceived in Safari so we need to
+ // check for notifications here
+ if (platform != "chromium" && type == "sub_frame")
+ {
+ var notificationToShow = Notification.getNextToShow(url);
+ if (notificationToShow)
+ showNotification(notificationToShow);
+ }
+
FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, tab);
return !(filter instanceof BlockingFilter);
}
ext.webRequest.onBeforeRequest.addListener(onBeforeRequest);
-if (require("info").platform == "chromium")
+if (platform == "chromium")
{
function onHeadersReceived(details)
{
« background.js ('K') | « background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld