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

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: Add activity log enabled check, and create constants for fields in the activity log 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
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 d7d290d2e5971b3c2e20fac9d323a4b695412a65..70f370faa81b62d30b5979836683fdb13e6d09e9 100644
--- a/chrome/test/data/extensions/activity_log/options.js
+++ b/chrome/test/data/extensions/activity_log/options.js
@@ -145,18 +145,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.

Powered by Google App Engine
This is Rietveld 408576698