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

Unified Diff: webrequest.js

Issue 5897276308324352: Issue 2505 - Check for notifications and dispatch filter.hitCount event asynchronously (Closed)
Patch Set: Created May 18, 2015, 11:19 a.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
« no previous file with comments | « no previous file | 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
@@ -46,6 +46,21 @@
}
});
+function onBeforeRequestAsync(url, type, page, filter)
+{
+ // We can't listen to onHeadersReceived in Safari so we need to
+ // check for notifications here
+ if (platform != "chromium" && type == "SUBDOCUMENT")
+ {
+ var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url));
+ if (notificationToShow)
+ showNotification(notificationToShow);
+ }
+
+ if (filter)
Sebastian Noack 2015/05/18 11:21:26 Note that I added this check here, as there is no
+ FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page);
+}
+
function onBeforeRequest(url, type, page, frame)
{
if (isFrameWhitelisted(page, frame))
@@ -60,16 +75,8 @@
key
);
- // We can't listen to onHeadersReceived in Safari so we need to
- // check for notifications here
- if (platform != "chromium" && type == "SUBDOCUMENT")
- {
- var notificationToShow = NotificationStorage.getNextToShow(stringifyURL(url));
- if (notificationToShow)
- showNotification(notificationToShow);
- }
+ setTimeout(onBeforeRequestAsync, 0, url, type, page, filter);
- FilterNotifier.triggerListeners("filter.hitCount", filter, 0, 0, page);
return !(filter instanceof BlockingFilter);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld