summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_webrequest_api.cc24
-rw-r--r--chrome/browser/extensions/extension_webrequest_api.h8
-rw-r--r--chrome/common/extensions/api/extension_api.json14
-rw-r--r--chrome/common/extensions/docs/experimental.webRequest.html12
-rw-r--r--chrome/test/data/extensions/api_test/webrequest/framework.js8
-rw-r--r--chrome/test/data/extensions/api_test/webrequest/test_blocking.html12
-rw-r--r--chrome/test/data/extensions/api_test/webrequest/test_complex.html43
-rw-r--r--chrome/test/data/extensions/api_test/webrequest/test_simple.html8
8 files changed, 68 insertions, 61 deletions
diff --git a/chrome/browser/extensions/extension_webrequest_api.cc b/chrome/browser/extensions/extension_webrequest_api.cc
index 4f66d89..a6add39 100644
--- a/chrome/browser/extensions/extension_webrequest_api.cc
+++ b/chrome/browser/extensions/extension_webrequest_api.cc
@@ -398,12 +398,8 @@ bool ExtensionWebRequestEventRouter::ExtraInfoSpec::InitFromValue(
if (!value.GetString(i, &str))
return false;
- if (str == "requestLine")
- *extra_info_spec |= REQUEST_LINE;
- else if (str == "requestHeaders")
+ if (str == "requestHeaders")
*extra_info_spec |= REQUEST_HEADERS;
- else if (str == "statusLine")
- *extra_info_spec |= STATUS_LINE;
else if (str == "responseHeaders")
*extra_info_spec |= RESPONSE_HEADERS;
else if (str == "blocking")
@@ -533,11 +529,8 @@ int ExtensionWebRequestEventRouter::OnBeforeSendHeaders(
ListValue args;
DictionaryValue* dict = new DictionaryValue();
ExtractRequestInfo(request, dict);
-
if (extra_info_spec & ExtraInfoSpec::REQUEST_HEADERS)
dict->Set(keys::kRequestHeadersKey, GetRequestHeadersList(*headers));
- // TODO(battre): implement request line.
-
args.Append(dict);
if (DispatchEvent(profile, request, listeners, args)) {
@@ -578,7 +571,6 @@ void ExtensionWebRequestEventRouter::OnSendHeaders(
ExtractRequestInfo(request, dict);
if (extra_info_spec & ExtraInfoSpec::REQUEST_HEADERS)
dict->Set(keys::kRequestHeadersKey, GetRequestHeadersList(headers));
- // TODO(battre): support "request line".
args.Append(dict);
DispatchEvent(profile, request, listeners, args);
@@ -614,12 +606,11 @@ void ExtensionWebRequestEventRouter::OnAuthRequired(
challenger->SetString(keys::kHostKey, auth_info.challenger.host());
challenger->SetInteger(keys::kPortKey, auth_info.challenger.port());
dict->Set(keys::kChallengerKey, challenger);
+ dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers()));
if (extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS) {
dict->Set(keys::kResponseHeadersKey,
GetResponseHeadersList(request->response_headers()));
}
- if (extra_info_spec & ExtraInfoSpec::STATUS_LINE)
- dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers()));
args.Append(dict);
DispatchEvent(profile, request, listeners, args);
@@ -662,12 +653,11 @@ void ExtensionWebRequestEventRouter::OnBeforeRedirect(
if (!response_ip.empty())
dict->SetString(keys::kIpKey, response_ip);
dict->SetBoolean(keys::kFromCache, request->was_cached());
+ dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers()));
if (extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS) {
dict->Set(keys::kResponseHeadersKey,
GetResponseHeadersList(request->response_headers()));
}
- if (extra_info_spec & ExtraInfoSpec::STATUS_LINE)
- dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers()));
args.Append(dict);
DispatchEvent(profile, request, listeners, args);
@@ -708,12 +698,11 @@ void ExtensionWebRequestEventRouter::OnResponseStarted(
dict->SetString(keys::kIpKey, response_ip);
dict->SetBoolean(keys::kFromCache, request->was_cached());
dict->SetInteger(keys::kStatusCodeKey, response_code);
+ dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers()));
if (extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS) {
dict->Set(keys::kResponseHeadersKey,
GetResponseHeadersList(request->response_headers()));
}
- if (extra_info_spec & ExtraInfoSpec::STATUS_LINE)
- dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers()));
args.Append(dict);
DispatchEvent(profile, request, listeners, args);
@@ -757,12 +746,11 @@ void ExtensionWebRequestEventRouter::OnCompleted(
if (!response_ip.empty())
dict->SetString(keys::kIpKey, response_ip);
dict->SetBoolean(keys::kFromCache, request->was_cached());
+ dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers()));
if (extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS) {
dict->Set(keys::kResponseHeadersKey,
GetResponseHeadersList(request->response_headers()));
}
- if (extra_info_spec & ExtraInfoSpec::STATUS_LINE)
- dict->Set(keys::kStatusLineKey, GetStatusLine(request->response_headers()));
args.Append(dict);
DispatchEvent(profile, request, listeners, args);
@@ -837,8 +825,6 @@ bool ExtensionWebRequestEventRouter::DispatchEvent(
dict->Remove(keys::kRequestHeadersKey, NULL);
if (!((*it)->extra_info_spec & ExtraInfoSpec::RESPONSE_HEADERS))
dict->Remove(keys::kResponseHeadersKey, NULL);
- if (!((*it)->extra_info_spec & ExtraInfoSpec::STATUS_LINE))
- dict->Remove(keys::kStatusLineKey, NULL);
base::JSONWriter::Write(args_filtered.get(), false, &json_args);
diff --git a/chrome/browser/extensions/extension_webrequest_api.h b/chrome/browser/extensions/extension_webrequest_api.h
index d2ea52b..8bc3429 100644
--- a/chrome/browser/extensions/extension_webrequest_api.h
+++ b/chrome/browser/extensions/extension_webrequest_api.h
@@ -78,11 +78,9 @@ class ExtensionWebRequestEventRouter {
// events.
struct ExtraInfoSpec {
enum Flags {
- REQUEST_LINE = 1<<0,
- REQUEST_HEADERS = 1<<1,
- STATUS_LINE = 1<<2,
- RESPONSE_HEADERS = 1<<3,
- BLOCKING = 1<<4,
+ REQUEST_HEADERS = 1<<0,
+ RESPONSE_HEADERS = 1<<1,
+ BLOCKING = 1<<2,
};
static bool InitFromValue(const base::ListValue& value,
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index df05506..76dc15e 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -5842,7 +5842,7 @@
"description": "Array of extra information that should be passed to the listener function.",
"items": {
"type": "string",
- "enum": ["requestLine", "requestHeaders", "statusLine", "responseHeaders", "blocking"]
+ "enum": ["requestHeaders", "responseHeaders", "blocking"]
}
},
{"type": "string", "name": "eventName"},
@@ -5952,7 +5952,7 @@
"description": "Array of extra information that should be passed to the listener function.",
"items": {
"type": "string",
- "enum": ["requestLine", "requestHeaders", "blocking"]
+ "enum": ["requestHeaders", "blocking"]
}
}
],
@@ -5996,7 +5996,7 @@
"description": "Array of extra information that should be passed to the listener function.",
"items": {
"type": "string",
- "enum": ["requestLine", "requestHeaders"]
+ "enum": ["requestHeaders"]
}
}
]
@@ -6040,7 +6040,7 @@
"description": "Array of extra information that should be passed to the listener function.",
"items": {
"type": "string",
- "enum": ["statusLine", "responseHeaders"]
+ "enum": ["responseHeaders"]
}
}
]
@@ -6083,7 +6083,7 @@
"description": "Array of extra information that should be passed to the listener function.",
"items": {
"type": "string",
- "enum": ["statusLine", "responseHeaders"]
+ "enum": ["responseHeaders"]
}
}
]
@@ -6127,7 +6127,7 @@
"description": "Array of extra information that should be passed to the listener function.",
"items": {
"type": "string",
- "enum": ["statusLine", "responseHeaders"]
+ "enum": ["responseHeaders"]
}
}
]
@@ -6170,7 +6170,7 @@
"description": "Array of extra information that should be passed to the listener function.",
"items": {
"type": "string",
- "enum": ["statusLine", "responseHeaders"]
+ "enum": ["responseHeaders"]
}
}
]
diff --git a/chrome/common/extensions/docs/experimental.webRequest.html b/chrome/common/extensions/docs/experimental.webRequest.html
index 4d65283..c6ae907 100644
--- a/chrome/common/extensions/docs/experimental.webRequest.html
+++ b/chrome/common/extensions/docs/experimental.webRequest.html
@@ -2157,7 +2157,7 @@ chrome.windows.onRemoved.addListener(
array of <span><span></span></span>
</span>
<span>string</span>
- <span>["statusLine", "responseHeaders"]</span>
+ <span>["responseHeaders"]</span>
</span>
</span></span>
</span>
@@ -3296,7 +3296,7 @@ chrome.windows.onRemoved.addListener(
array of <span><span></span></span>
</span>
<span>string</span>
- <span>["statusLine", "responseHeaders"]</span>
+ <span>["responseHeaders"]</span>
</span>
</span></span>
</span>
@@ -4891,7 +4891,7 @@ chrome.windows.onRemoved.addListener(
array of <span><span></span></span>
</span>
<span>string</span>
- <span>["requestLine", "requestHeaders", "blocking"]</span>
+ <span>["requestHeaders", "blocking"]</span>
</span>
</span></span>
</span>
@@ -6027,7 +6027,7 @@ chrome.windows.onRemoved.addListener(
array of <span><span></span></span>
</span>
<span>string</span>
- <span>["statusLine", "responseHeaders"]</span>
+ <span>["responseHeaders"]</span>
</span>
</span></span>
</span>
@@ -7954,7 +7954,7 @@ chrome.windows.onRemoved.addListener(
array of <span><span></span></span>
</span>
<span>string</span>
- <span>["statusLine", "responseHeaders"]</span>
+ <span>["responseHeaders"]</span>
</span>
</span></span>
</span>
@@ -8753,7 +8753,7 @@ chrome.windows.onRemoved.addListener(
array of <span><span></span></span>
</span>
<span>string</span>
- <span>["requestLine", "requestHeaders"]</span>
+ <span>["requestHeaders"]</span>
</span>
</span></span>
</span>
diff --git a/chrome/test/data/extensions/api_test/webrequest/framework.js b/chrome/test/data/extensions/api_test/webrequest/framework.js
index caeaaee..b8b23d4 100644
--- a/chrome/test/data/extensions/api_test/webrequest/framework.js
+++ b/chrome/test/data/extensions/api_test/webrequest/framework.js
@@ -214,19 +214,19 @@ function initListeners(filter, extraInfoSpec) {
chrome.experimental.webRequest.onAuthRequired.addListener(
function(details) {
return captureEvent("onAuthRequired", details);
- }, filter, intersect(extraInfoSpec, ["responseHeaders", "statusLine"]));
+ }, filter, intersect(extraInfoSpec, ["responseHeaders"]));
chrome.experimental.webRequest.onResponseStarted.addListener(
function(details) {
return captureEvent("onResponseStarted", details);
- }, filter, intersect(extraInfoSpec, ["responseHeaders", "statusLine"]));
+ }, filter, intersect(extraInfoSpec, ["responseHeaders"]));
chrome.experimental.webRequest.onBeforeRedirect.addListener(
function(details) {
return captureEvent("onBeforeRedirect", details);
- }, filter, intersect(extraInfoSpec, ["responseHeaders", "statusLine"]));
+ }, filter, intersect(extraInfoSpec, ["responseHeaders"]));
chrome.experimental.webRequest.onCompleted.addListener(
function(details) {
return captureEvent("onCompleted", details);
- }, filter, intersect(extraInfoSpec, ["responseHeaders", "statusLine"]));
+ }, filter, intersect(extraInfoSpec, ["responseHeaders"]));
chrome.experimental.webRequest.onErrorOccurred.addListener(
function(details) {
return captureEvent("onErrorOccurred", details);
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_blocking.html b/chrome/test/data/extensions/api_test/webrequest/test_blocking.html
index 03a83c3..b23fef3 100644
--- a/chrome/test/data/extensions/api_test/webrequest/test_blocking.html
+++ b/chrome/test/data/extensions/api_test/webrequest/test_blocking.html
@@ -87,7 +87,8 @@ runTests([
details: {
url: getURL("simpleLoad/a.html"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -96,7 +97,8 @@ runTests([
details: {
url: getURL("simpleLoad/a.html"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -143,7 +145,8 @@ runTests([
url: getURLEchoUserAgent(),
fromCache: false,
statusCode: 200,
- ip: "127.0.0.1"
+ ip: "127.0.0.1",
+ statusLine: "HTTP/1.0 200 OK",
}
},
{ label: "onCompleted",
@@ -152,7 +155,8 @@ runTests([
url: getURLEchoUserAgent(),
fromCache: false,
statusCode: 200,
- ip: "127.0.0.1"
+ ip: "127.0.0.1",
+ statusLine: "HTTP/1.0 200 OK",
}
},
],
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_complex.html b/chrome/test/data/extensions/api_test/webrequest/test_complex.html
index e15b45d..9a80fad 100644
--- a/chrome/test/data/extensions/api_test/webrequest/test_complex.html
+++ b/chrome/test/data/extensions/api_test/webrequest/test_complex.html
@@ -47,7 +47,8 @@ runTests([
type: "main_frame",
url: getURL("complexLoad/a.html"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -57,7 +58,8 @@ runTests([
type: "sub_frame",
url: getURL("complexLoad/b.html"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -67,7 +69,8 @@ runTests([
type: "image",
url: getURL("complexLoad/b.jpg"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -77,7 +80,8 @@ runTests([
type: "main_frame",
url: getURL("complexLoad/a.html"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -87,7 +91,8 @@ runTests([
type: "sub_frame",
url: getURL("complexLoad/b.html"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -97,7 +102,8 @@ runTests([
type: "image",
url: getURL("complexLoad/b.jpg"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -141,7 +147,8 @@ runTests([
type: "main_frame",
url: getURL("complexLoad/a.html"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -151,7 +158,8 @@ runTests([
type: "image",
url: getURL("complexLoad/b.jpg"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -161,7 +169,8 @@ runTests([
type: "main_frame",
url: getURL("complexLoad/a.html"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -171,7 +180,8 @@ runTests([
type: "image",
url: getURL("complexLoad/b.jpg"),
fromCache: false,
- statusCode: 200
+ statusCode: 200,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -225,7 +235,8 @@ runTests([
scheme: "basic",
realm: "testrealm",
challenger: {host: testServer, port: testServerPort},
- responseHeadersExist: true
+ responseHeadersExist: true,
+ statusLine: "HTTP/1.0 401 Unauthorized",
}
},
{ label: "onResponseStarted",
@@ -235,7 +246,8 @@ runTests([
fromCache: false,
statusCode: 401,
ip: "127.0.0.1",
- responseHeadersExist: true
+ responseHeadersExist: true,
+ statusLine: "HTTP/1.0 401 Unauthorized",
}
},
{ label: "onCompleted",
@@ -245,7 +257,8 @@ runTests([
fromCache: false,
statusCode: 401,
ip: "127.0.0.1",
- responseHeadersExist: true
+ responseHeadersExist: true,
+ statusLine: "HTTP/1.0 401 Unauthorized",
}
},
],
@@ -291,6 +304,7 @@ runTests([
statusCode: 200,
ip: "127.0.0.1",
fromCache: false,
+ statusLine: "HTTP/1.0 200 OK",
}
},
{ label: "onCompleted-1",
@@ -301,6 +315,7 @@ runTests([
statusCode: 200,
ip: "127.0.0.1",
fromCache: false,
+ statusLine: "HTTP/1.0 200 OK",
}
},
{ label: "onBeforeRequest-2",
@@ -333,6 +348,7 @@ runTests([
statusCode: 200,
ip: "127.0.0.1",
fromCache: false,
+ statusLine: "HTTP/1.0 200 OK",
}
},
{ label: "onCompleted-2",
@@ -343,6 +359,7 @@ runTests([
statusCode: 200,
ip: "127.0.0.1",
fromCache: false,
+ statusLine: "HTTP/1.0 200 OK",
}
}
],
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_simple.html b/chrome/test/data/extensions/api_test/webrequest/test_simple.html
index e7c0e15..1bd788e 100644
--- a/chrome/test/data/extensions/api_test/webrequest/test_simple.html
+++ b/chrome/test/data/extensions/api_test/webrequest/test_simple.html
@@ -27,7 +27,8 @@ runTests([
details: {
url: getURL("simpleLoad/a.html"),
statusCode: 200,
- fromCache: false
+ fromCache: false,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -36,7 +37,8 @@ runTests([
details: {
url: getURL("simpleLoad/a.html"),
statusCode: 200,
- fromCache: false
+ fromCache: false,
+ statusLine: "HTTP/1.1 200 OK",
// Request to chrome-extension:// url has no IP.
}
},
@@ -134,7 +136,7 @@ runTests([
"onBeforeRequest-2", "onBeforeSendHeaders-2", "onSendHeaders-2",
"onResponseStarted", "onCompleted"] ],
{}, // filter
- ["requestHeaders", "responseHeaders", "statusLine"]);
+ ["requestHeaders", "responseHeaders"]);
navigateAndWait(getURLHttpSimpleLoadRedirect());
},