Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4044)

Unified Diff: chrome/test/data/extensions/activity_log/options.js

Issue 12491012: Improved extension activity logging for the chrome.webRequest API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_browser_extensions.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/activity_log/options.js
diff --git a/chrome/test/data/extensions/activity_log/options.js b/chrome/test/data/extensions/activity_log/options.js
index 1298b303ffc8955c9def15dab8f904dbcc1ee5d3..8498e711ac951ba56cbcd48ea0aaf018c9ef767a 100644
--- a/chrome/test/data/extensions/activity_log/options.js
+++ b/chrome/test/data/extensions/activity_log/options.js
@@ -156,18 +156,38 @@ function doWebRequestModifications() {
// Install a webRequest handler that will add an HTTP header to the outgoing
// request for the main page.
function doModifyHeaders(details) {
+ var response = {};
+
var headers = details.requestHeaders;
if (headers === undefined) {
headers = [];
}
headers.push({'name': 'X-Test-Activity-Log-Send',
'value': 'Present'});
- return {'requestHeaders': headers};
+ response['requestHeaders'] = headers;
+
+ headers = details.responseHeaders;
+ if (headers === undefined) {
+ headers = [];
+ }
+ headers = headers.filter(
+ function(x) {return x["name"] != "Cache-Control"});
+ headers.push({'name': 'X-Test-Response-Header',
+ 'value': 'Inserted'});
+ headers.push({'name': 'Set-Cookie',
+ 'value': 'ActivityLog=InsertedCookie'});
+ response['responseHeaders'] = headers;
+
+ return response;
}
chrome.webRequest.onBeforeSendHeaders.addListener(
doModifyHeaders,
{'urls': ['http://*/*'], 'types': ['main_frame']},
['blocking', 'requestHeaders']);
+ chrome.webRequest.onHeadersReceived.addListener(
+ doModifyHeaders,
+ {'urls': ['http://*/*'], 'types': ['main_frame']},
+ ['blocking', 'responseHeaders']);
// Open a tab, then close it when it has finished loading--this should give
// the webRequest handler a chance to run.
« no previous file with comments | « chrome/chrome_browser_extensions.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698