summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_webnavigation_api.cc5
-rw-r--r--chrome/browser/extensions/extension_webrequest_api.cc39
-rw-r--r--chrome/browser/extensions/extension_webrequest_api_constants.cc1
-rw-r--r--chrome/browser/extensions/extension_webrequest_api_constants.h1
-rw-r--r--chrome/browser/extensions/user_script_listener_unittest.cc2
-rw-r--r--chrome/common/extensions/api/extension_api.json14
-rw-r--r--chrome/common/extensions/docs/experimental.webRequest.html272
-rw-r--r--chrome/test/data/extensions/api_test/webrequest/events/test.html60
8 files changed, 372 insertions, 22 deletions
diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc
index 28ee146..16894407 100644
--- a/chrome/browser/extensions/extension_webnavigation_api.cc
+++ b/chrome/browser/extensions/extension_webnavigation_api.cc
@@ -32,8 +32,11 @@ const char* kValidSchemes[] = {
chrome::kFtpScheme,
};
-// Returns 0 if the navigation happens in the main frame, or the frame ID
+// Returns the frame ID as it will be passed to the extension:
+// 0 if the navigation happens in the main frame, or the frame ID
// modulo 32 bits otherwise.
+// Keep this in sync with the GetFrameId() function in
+// extension_webrequest_api.cc.
int GetFrameId(bool is_main_frame, int64 frame_id) {
return is_main_frame ? 0 : static_cast<int>(frame_id);
}
diff --git a/chrome/browser/extensions/extension_webrequest_api.cc b/chrome/browser/extensions/extension_webrequest_api.cc
index 1cae4f8..01a9d1f 100644
--- a/chrome/browser/extensions/extension_webrequest_api.cc
+++ b/chrome/browser/extensions/extension_webrequest_api.cc
@@ -72,6 +72,15 @@ COMPILE_ASSERT(
#define ARRAYEND(array) (array + arraysize(array))
+// Returns the frame ID as it will be passed to the extension:
+// 0 if the navigation happens in the main frame, or the frame ID
+// modulo 32 bits otherwise.
+// Keep this in sync with the GetFrameId() function in
+// extension_webnavigation_api.cc.
+int GetFrameId(bool is_main_frame, int64 frame_id) {
+ return is_main_frame ? 0 : static_cast<int>(frame_id);
+}
+
bool IsWebRequestEvent(const std::string& event_name) {
return std::find(kWebRequestEvents, ARRAYEND(kWebRequestEvents),
event_name) != ARRAYEND(kWebRequestEvents);
@@ -108,6 +117,8 @@ bool ParseResourceType(const std::string& type_str,
}
void ExtractRequestInfo(net::URLRequest* request,
+ bool* is_main_frame,
+ int64* frame_id,
int* tab_id,
int* window_id,
ResourceType::Type* resource_type) {
@@ -118,6 +129,8 @@ void ExtractRequestInfo(net::URLRequest* request,
ResourceDispatcherHost::InfoForRequest(request);
ExtensionTabIdMap::GetInstance()->GetTabAndWindowId(
info->child_id(), info->route_id(), tab_id, window_id);
+ *frame_id = info->frame_id();
+ *is_main_frame = info->is_main_frame();
// Restrict the resource type to the values we care about.
ResourceType::Type* iter =
@@ -346,10 +359,15 @@ int ExtensionWebRequestEventRouter::OnBeforeRequest(
if (!HasWebRequestScheme(request->url()))
return net::OK;
+ bool is_main_frame = false;
+ int64 frame_id = -1;
+ int frame_id_for_extension = -1;
int tab_id = -1;
int window_id = -1;
ResourceType::Type resource_type = ResourceType::LAST_TYPE;
- ExtractRequestInfo(request, &tab_id, &window_id, &resource_type);
+ ExtractRequestInfo(request, &is_main_frame, &frame_id, &tab_id, &window_id,
+ &resource_type);
+ frame_id_for_extension = GetFrameId(is_main_frame, frame_id);
int extra_info_spec = 0;
std::vector<const EventListener*> listeners =
@@ -368,6 +386,7 @@ int ExtensionWebRequestEventRouter::OnBeforeRequest(
base::Uint64ToString(request->identifier()));
dict->SetString(keys::kUrlKey, request->url().spec());
dict->SetString(keys::kMethodKey, request->method());
+ dict->SetInteger(keys::kFrameIdKey, frame_id_for_extension);
dict->SetInteger(keys::kTabIdKey, tab_id);
dict->SetString(keys::kTypeKey, ResourceTypeToString(resource_type));
dict->SetDouble(keys::kTimeStampKey, base::Time::Now().ToDoubleT() * 1000);
@@ -494,6 +513,16 @@ void ExtensionWebRequestEventRouter::OnBeforeRedirect(
if (listeners.empty())
return;
+ bool is_main_frame = false;
+ int64 frame_id = -1;
+ int frame_id_for_extension = -1;
+ int tab_id = -1;
+ int window_id = -1;
+ ResourceType::Type resource_type = ResourceType::LAST_TYPE;
+ ExtractRequestInfo(request, &is_main_frame, &frame_id, &tab_id,
+ &window_id, &resource_type);
+ frame_id_for_extension = GetFrameId(is_main_frame, frame_id);
+
int http_status_code = request->GetResponseCode();
std::string response_ip = request->GetSocketAddress().host();
@@ -505,6 +534,9 @@ void ExtensionWebRequestEventRouter::OnBeforeRedirect(
dict->SetString(keys::kUrlKey, request->url().spec());
dict->SetString(keys::kRedirectUrlKey, new_location.spec());
dict->SetInteger(keys::kStatusCodeKey, http_status_code);
+ dict->SetInteger(keys::kFrameIdKey, frame_id_for_extension);
+ dict->SetInteger(keys::kTabIdKey, tab_id);
+ dict->SetString(keys::kTypeKey, ResourceTypeToString(resource_type));
if (!response_ip.empty())
dict->SetString(keys::kIpKey, response_ip);
dict->SetBoolean(keys::kFromCache, request->was_cached());
@@ -892,10 +924,13 @@ ExtensionWebRequestEventRouter::GetMatchingListeners(
const std::string& event_name,
net::URLRequest* request,
int* extra_info_spec) {
+ bool is_main_frame = false;
+ int64 frame_id = -1;
int tab_id = -1;
int window_id = -1;
ResourceType::Type resource_type = ResourceType::LAST_TYPE;
- ExtractRequestInfo(request, &tab_id, &window_id, &resource_type);
+ ExtractRequestInfo(request, &is_main_frame, &frame_id, &tab_id, &window_id,
+ &resource_type);
return GetMatchingListeners(
profile, extension_info_map, event_name, request->url(),
diff --git a/chrome/browser/extensions/extension_webrequest_api_constants.cc b/chrome/browser/extensions/extension_webrequest_api_constants.cc
index 2f49d37..efa5b2f 100644
--- a/chrome/browser/extensions/extension_webrequest_api_constants.cc
+++ b/chrome/browser/extensions/extension_webrequest_api_constants.cc
@@ -7,6 +7,7 @@
namespace extension_webrequest_api_constants {
const char kErrorKey[] = "error";
+const char kFrameIdKey[] = "frameId";
const char kFromCache[] = "fromCache";
const char kIpKey[] = "ip";
const char kMethodKey[] = "method";
diff --git a/chrome/browser/extensions/extension_webrequest_api_constants.h b/chrome/browser/extensions/extension_webrequest_api_constants.h
index 6715cd7..964c9bf 100644
--- a/chrome/browser/extensions/extension_webrequest_api_constants.h
+++ b/chrome/browser/extensions/extension_webrequest_api_constants.h
@@ -12,6 +12,7 @@ namespace extension_webrequest_api_constants {
// Keys.
extern const char kErrorKey[];
+extern const char kFrameIdKey[];
extern const char kFromCache[];
extern const char kIpKey[];
extern const char kMethodKey[];
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index 99b39cd..9d8064d 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -90,7 +90,7 @@ class DummyResourceHandler : public ResourceHandler {
ResourceDispatcherHostRequestInfo* CreateRequestInfo(int request_id) {
return new ResourceDispatcherHostRequestInfo(
new DummyResourceHandler(), ChildProcessInfo::RENDER_PROCESS, 0, 0, 0,
- request_id, ResourceType::MAIN_FRAME, 0, false, false, false,
+ request_id, false, -1, ResourceType::MAIN_FRAME, 0, false, false, false,
content::MockResourceContext::GetInstance());
}
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 6db418e..d341192 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -3852,7 +3852,7 @@
"properties": {
"tabId": {"type": "integer", "description": "The ID of the tab in which the navigation is about to occur."},
"url": {"type": "string"},
- "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; positive value indicates navigation in a subframe. Frame IDs are unique within a tab."},
+ "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."},
"timeStamp": {"type": "number", "description": "The time when the browser was about to start the navigation, in milliseconds since the epoch."}
}
}
@@ -3869,7 +3869,7 @@
"properties": {
"tabId": {"type": "integer", "description": "The ID of the tab in which the navigation occurs."},
"url": {"type": "string"},
- "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; positive value indicates navigation in a subframe."},
+ "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."},
"transitionType": {"type": "string", "enum": ["link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", "keyword_generated"], "description": "Cause of the navigation. The same transition types as defined in the history API are used."},
"transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items:": {"type": "string", "enum": ["client_redirect", "server_redirect", "forward_back"]}},
"timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."}
@@ -3888,7 +3888,7 @@
"properties": {
"tabId": {"type": "integer", "description": "The ID of the tab in which the navigation occurs."},
"url": {"type": "string"},
- "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; positive value indicates navigation in a subframe."},
+ "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."},
"timeStamp": {"type": "number", "description": "The time when the page's DOM was fully constructed, in milliseconds since the epoch."}
}
}
@@ -3905,7 +3905,7 @@
"properties": {
"tabId": {"type": "integer", "description": "The ID of the tab in which the navigation occurs."},
"url": {"type": "string"},
- "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; positive value indicates navigation in a subframe."},
+ "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."},
"timeStamp": {"type": "number", "description": "The time when the document finished loading, in milliseconds since the epoch."}
}
}
@@ -3922,7 +3922,7 @@
"properties": {
"tabId": {"type": "integer", "description": "The ID of the tab in which the navigation occurs."},
"url": {"type": "string"},
- "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; positive value indicates navigation in a subframe."},
+ "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."},
"error": {"type": "string", "description": "The error description."},
"timeStamp": {"type": "number", "description": "The time when the error occurred, in milliseconds since the epoch."}
}
@@ -4065,6 +4065,7 @@
"requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
"url": {"type": "string"},
"method": {"type": "string", "description": "Standard HTTP method."},
+ "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. Frame IDs are unique within a tab."},
"tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to null if the request isn't related to a tab."},
"type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "other"], "description": "How the requested resource will be used."},
"timeStamp": {"type": "number", "description": "The time when the browser was about to make the request, in milliseconds since the epoch."}
@@ -4221,6 +4222,9 @@
"requestId": {"type": "string", "description": "The ID of the request."},
"url": {"type": "string", "description": "The URL of the current request."},
"ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."},
+ "frameId": {"type": "integer", "description": "0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. Frame IDs are unique within a tab."},
+ "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to null if the request isn't related to a tab."},
+ "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "other"], "description": "How the requested resource will be used."},
"fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."},
"statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."},
"redirectUrl": {"type": "string", "description": "The new URL."},
diff --git a/chrome/common/extensions/docs/experimental.webRequest.html b/chrome/common/extensions/docs/experimental.webRequest.html
index 7b8b063..f0db1be 100644
--- a/chrome/common/extensions/docs/experimental.webRequest.html
+++ b/chrome/common/extensions/docs/experimental.webRequest.html
@@ -795,6 +795,210 @@ unexpected results.
</div><div>
<div>
<dt>
+ <var>frameId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span class="enum" style="display: none; ">enumerated</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>integer</span>
+ <span style="display: none; "></span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. Frame IDs are unique within a tab.</dd>
+ <dd style="display: none; ">
+ This parameter was added in version
+ <b><span></span></b>.
+ You must omit this parameter in earlier versions,
+ and you may omit it in any version. If you require this
+ parameter, the manifest key
+ <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
+ can ensure that your extension won't be run in an earlier browser version.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+
+ <!-- OBJECT METHODS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- OBJECT EVENT FIELDS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- FUNCTION PARAMETERS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>tabId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span class="enum" style="display: none; ">enumerated</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>integer</span>
+ <span style="display: none; "></span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>The ID of the tab in which the request takes place. Set to null if the request isn't related to a tab.</dd>
+ <dd style="display: none; ">
+ This parameter was added in version
+ <b><span></span></b>.
+ You must omit this parameter in earlier versions,
+ and you may omit it in any version. If you require this
+ parameter, the manifest key
+ <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
+ can ensure that your extension won't be run in an earlier browser version.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+
+ <!-- OBJECT METHODS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- OBJECT EVENT FIELDS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- FUNCTION PARAMETERS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ </div>
+ </div><div>
+ <div>
+ <dt>
+ <var>type</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span class="enum">enumerated</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>string</span>
+ <span>["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "other"]</span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>How the requested resource will be used.</dd>
+ <dd style="display: none; ">
+ This parameter was added in version
+ <b><span></span></b>.
+ You must omit this parameter in earlier versions,
+ and you may omit it in any version. If you require this
+ parameter, the manifest key
+ <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
+ can ensure that your extension won't be run in an earlier browser version.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+
+ <!-- OBJECT METHODS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- OBJECT EVENT FIELDS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- FUNCTION PARAMETERS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ </div>
+ </div><div>
+ <div>
+ <dt>
<var>fromCache</var>
<em>
@@ -1662,6 +1866,74 @@ unexpected results.
</div><div>
<div>
<dt>
+ <var>frameId</var>
+ <em>
+
+ <!-- TYPE -->
+ <div style="display:inline">
+ (
+ <span class="optional" style="display: none; ">optional</span>
+ <span class="enum" style="display: none; ">enumerated</span>
+ <span id="typeTemplate">
+ <span style="display: none; ">
+ <a> Type</a>
+ </span>
+ <span>
+ <span style="display: none; ">
+ array of <span><span></span></span>
+ </span>
+ <span>integer</span>
+ <span style="display: none; "></span>
+ </span>
+ </span>
+ )
+ </div>
+
+ </em>
+ </dt>
+ <dd class="todo" style="display: none; ">
+ Undocumented.
+ </dd>
+ <dd>0 indicates the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. Frame IDs are unique within a tab.</dd>
+ <dd style="display: none; ">
+ This parameter was added in version
+ <b><span></span></b>.
+ You must omit this parameter in earlier versions,
+ and you may omit it in any version. If you require this
+ parameter, the manifest key
+ <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
+ can ensure that your extension won't be run in an earlier browser version.
+ </dd>
+
+ <!-- OBJECT PROPERTIES -->
+ <dd style="display: none; ">
+ <dl>
+ <div>
+ <div>
+ </div>
+ </div>
+ </dl>
+ </dd>
+
+ <!-- OBJECT METHODS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- OBJECT EVENT FIELDS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ <!-- FUNCTION PARAMETERS -->
+ <dd style="display: none; ">
+ <div></div>
+ </dd>
+
+ </div>
+ </div><div>
+ <div>
+ <dt>
<var>tabId</var>
<em>
diff --git a/chrome/test/data/extensions/api_test/webrequest/events/test.html b/chrome/test/data/extensions/api_test/webrequest/events/test.html
index 3548fd8..b391938 100644
--- a/chrome/test/data/extensions/api_test/webrequest/events/test.html
+++ b/chrome/test/data/extensions/api_test/webrequest/events/test.html
@@ -62,6 +62,7 @@ function expect(data, order, filter, extraInfoSpec) {
capturedEventData = [];
expectedEventOrder = order;
eventsCaptured = chrome.test.callbackAdded();
+ tabAndFrameUrls = {}; // Maps "{tabId}-{frameId}" to the URL of the frame.
removeListeners();
initListeners(filter || {}, extraInfoSpec || []);
}
@@ -130,6 +131,22 @@ function captureEvent(name, details) {
retval = expectedEventData[currentIndex].retval;
}
+ // Check that the frameId can be used to reliably determine the URL of the
+ // frame that caused requests.
+ if (name == "onBeforeRequest" || name == "onBeforeRedirect") {
+ chrome.test.assertTrue('frameId' in details &&
+ typeof details.frameId === 'number');
+ chrome.test.assertTrue('tabId' in details &&
+ typeof details.tabId === 'number');
+ var key = details.tabId + "-" + details.frameId;
+ if (details.type == "main_frame" || details.type == "sub_frame") {
+ tabAndFrameUrls[key] =
+ name == "onBeforeRedirect" ? details.redirectUrl : details.url;
+ }
+ details.frameUrl = tabAndFrameUrls[key] || "unknown frame URL";
+ }
+ delete details.frameId;
+
delete details.requestId;
delete details.timeStamp;
if (details.requestHeaders) {
@@ -232,7 +249,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: getURL("simpleLoad/a.html")
+ url: getURL("simpleLoad/a.html"),
+ frameUrl: getURL("simpleLoad/a.html")
}
},
{ label: "a-onResponseStarted",
@@ -270,7 +288,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: URL_HTTP_SIMPLE_LOAD_REDIRECT
+ url: URL_HTTP_SIMPLE_LOAD_REDIRECT,
+ frameUrl: URL_HTTP_SIMPLE_LOAD_REDIRECT
}
},
{ label: "onBeforeSendHeaders-1",
@@ -294,6 +313,9 @@ runTests([
redirectUrl: URL_HTTP_SIMPLE_LOAD,
statusCode: 301,
responseHeadersExist: true,
+ tabId: tabId,
+ type: "main_frame",
+ frameUrl: URL_HTTP_SIMPLE_LOAD,
ip: "127.0.0.1",
fromCache: false,
statusLine: "HTTP/1.0 301 Moved Permanently"
@@ -305,7 +327,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: URL_HTTP_SIMPLE_LOAD
+ url: URL_HTTP_SIMPLE_LOAD,
+ frameUrl: URL_HTTP_SIMPLE_LOAD
}
},
{ label: "onBeforeSendHeaders-2",
@@ -367,7 +390,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: getURL("complexLoad/a.html")
+ url: getURL("complexLoad/a.html"),
+ frameUrl: getURL("complexLoad/a.html")
}
},
{ label: "b.html-onBeforeRequest",
@@ -376,7 +400,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "sub_frame",
- url: getURL("complexLoad/b.html")
+ url: getURL("complexLoad/b.html"),
+ frameUrl: getURL("complexLoad/b.html")
}
},
{ label: "b.jpg-onBeforeRequest",
@@ -385,7 +410,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "image",
- url: getURL("complexLoad/b.jpg")
+ url: getURL("complexLoad/b.jpg"),
+ frameUrl: getURL("complexLoad/b.html")
}
},
{ label: "a.html-onResponseStarted",
@@ -466,7 +492,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: getURL("complexLoad/a.html")
+ url: getURL("complexLoad/a.html"),
+ frameUrl: getURL("complexLoad/a.html")
},
retval: {cancel: true}
},
@@ -503,7 +530,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: getURL("complexLoad/a.html")
+ url: getURL("complexLoad/a.html"),
+ frameUrl: getURL("complexLoad/a.html")
},
retval: {redirectUrl: getURL("simpleLoad/a.html")}
},
@@ -522,7 +550,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: getURL("simpleLoad/a.html")
+ url: getURL("simpleLoad/a.html"),
+ frameUrl: getURL("simpleLoad/a.html"),
},
},
{ label: "onResponseStarted",
@@ -564,7 +593,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: getURL("complexLoad/a.html")
+ url: getURL("complexLoad/a.html"),
+ frameUrl: getURL("complexLoad/a.html")
}
},
{ label: "b-onBeforeRequest",
@@ -573,7 +603,9 @@ runTests([
method: "GET",
tabId: tabId,
type: "image",
- url: getURL("complexLoad/b.jpg")
+ url: getURL("complexLoad/b.jpg"),
+ // As we do not listed to sub-frames we do not know the frameUrl.
+ frameUrl: "unknown frame URL"
}
},
{ label: "a-onResponseStarted",
@@ -640,7 +672,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: getURL("does_not_exist.html")
+ url: getURL("does_not_exist.html"),
+ frameUrl: getURL("does_not_exist.html")
}
},
{ label: "onErrorOccurred",
@@ -670,7 +703,8 @@ runTests([
method: "GET",
tabId: tabId,
type: "main_frame",
- url: URL_ECHO_USER_AGENT
+ url: URL_ECHO_USER_AGENT,
+ frameUrl: URL_ECHO_USER_AGENT
}
},
{ label: "onBeforeSendHeaders",