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

Unified Diff: webrequest.js

Issue 6399658096066560: Issue 2538 - Register onHeadersReceived event listener only for main_frame and sub_frame requests (Closed)
Patch Set: Created May 18, 2015, 2:46 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
« 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
@@ -86,12 +86,6 @@
{
function onHeadersReceived(details)
{
- if (details.tabId == -1)
Sebastian Noack 2015/05/18 14:48:49 There should always be a tab for requests of type
- return;
-
- if (details.type != "main_frame" && details.type != "sub_frame")
- return;
-
var page = new ext.Page({id: details.tabId});
var frame = ext.getFrame(details.tabId, details.frameId);
@@ -110,5 +104,12 @@
showNotification(notificationToShow);
}
- chrome.webRequest.onHeadersReceived.addListener(onHeadersReceived, {urls: ["http://*/*", "https://*/*"]}, ["responseHeaders"]);
+ chrome.webRequest.onHeadersReceived.addListener(
+ onHeadersReceived,
+ {
+ urls: ["http://*/*", "https://*/*"],
+ types: ["main_frame", "sub_frame"]
+ },
+ ["responseHeaders"]
+ );
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld