diff options
Diffstat (limited to 'chrome')
26 files changed, 1228 insertions, 31 deletions
diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc index c58ecd0..1eae3a6 100644 --- a/chrome/browser/extensions/extension_webnavigation_api.cc +++ b/chrome/browser/extensions/extension_webnavigation_api.cc @@ -40,6 +40,11 @@ int GetFrameId(ProvisionalLoadDetails* details) { return details->main_frame() ? 0 : static_cast<int>(details->frame_id()); } +// Returns |time| as milliseconds since the epoch. +double MilliSecondsFromTime(const base::Time& time) { + return 1000 * time.ToDoubleT(); +} + // Dispatches events to the extension message service. void DispatchEvent(Profile* profile, const char* event_name, @@ -62,6 +67,7 @@ void DispatchOnBeforeNavigate(NavigationController* controller, dict->SetInteger(keys::kFrameIdKey, GetFrameId(details)); dict->SetString(keys::kRequestIdKey, base::Uint64ToString(request_id)); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -89,6 +95,7 @@ void DispatchOnCommitted(NavigationController* controller, if (details->transition_type() & PageTransition::FORWARD_BACK) qualifiers->Append(Value::CreateStringValue("forward_back")); dict->Set(keys::kTransitionQualifiersKey, qualifiers); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -108,6 +115,7 @@ void DispatchOnDOMContentLoaded(NavigationController* controller, dict->SetString(keys::kUrlKey, url.spec()); dict->SetInteger(keys::kFrameIdKey, is_main_frame ? 0 : static_cast<int>(frame_id)); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -127,6 +135,7 @@ void DispatchOnCompleted(NavigationController* controller, dict->SetString(keys::kUrlKey, url.spec()); dict->SetInteger(keys::kFrameIdKey, is_main_frame ? 0 : static_cast<int>(frame_id)); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -353,6 +362,7 @@ void ExtensionWebNavigationEventRouter::FailProvisionalLoadWithError( dict->SetInteger(keys::kFrameIdKey, GetFrameId(details)); dict->SetString(keys::kErrorKey, std::string(net::ErrorToString(details->error_code()))); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -371,6 +381,7 @@ void ExtensionWebNavigationEventRouter::CreatingNewWindow( dict->SetString(keys::kSourceUrlKey, details->opener_url.spec()); dict->SetString(keys::kUrlKey, details->target_url.possibly_invalid_spec()); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; diff --git a/chrome/browser/extensions/extension_webnavigation_api_constants.cc b/chrome/browser/extensions/extension_webnavigation_api_constants.cc index 8566fef..88f68c1 100644 --- a/chrome/browser/extensions/extension_webnavigation_api_constants.cc +++ b/chrome/browser/extensions/extension_webnavigation_api_constants.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,6 +12,7 @@ const char kRequestIdKey[] = "requestId"; const char kSourceTabIdKey[] = "sourceTabId"; const char kSourceUrlKey[] = "sourceUrl"; const char kTabIdKey[] = "tabId"; +const char kTimeStampKey[] = "timeStamp"; const char kTransitionTypeKey[] = "transitionType"; const char kTransitionQualifiersKey[] = "transitionQualifiers"; const char kUrlKey[] = "url"; diff --git a/chrome/browser/extensions/extension_webnavigation_api_constants.h b/chrome/browser/extensions/extension_webnavigation_api_constants.h index 775cf0d..aadeebf 100644 --- a/chrome/browser/extensions/extension_webnavigation_api_constants.h +++ b/chrome/browser/extensions/extension_webnavigation_api_constants.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,6 +17,7 @@ extern const char kRequestIdKey[]; extern const char kSourceTabIdKey[]; extern const char kSourceUrlKey[]; extern const char kTabIdKey[]; +extern const char kTimeStampKey[]; extern const char kTransitionTypeKey[]; extern const char kTransitionQualifiersKey[]; extern const char kUrlKey[]; diff --git a/chrome/browser/extensions/extension_webrequest_api.cc b/chrome/browser/extensions/extension_webrequest_api.cc index fbc0402..6daf001 100644 --- a/chrome/browser/extensions/extension_webrequest_api.cc +++ b/chrome/browser/extensions/extension_webrequest_api.cc @@ -317,6 +317,8 @@ int ExtensionWebRequestEventRouter::OnBeforeRequest( dict->SetString(keys::kMethodKey, request->method()); dict->SetInteger(keys::kTabIdKey, tab_id); dict->SetString(keys::kTypeKey, ResourceTypeToString(resource_type)); + dict->SetDouble(keys::kTimeStampKey, + request->request_time().ToDoubleT() * 1000); args.Append(dict); if (DispatchEvent(profile_id, event_router, request, callback, listeners, @@ -352,6 +354,8 @@ int ExtensionWebRequestEventRouter::OnBeforeSendHeaders( dict->SetString(keys::kRequestIdKey, base::Uint64ToString(request->identifier())); dict->SetString(keys::kUrlKey, request->url().spec()); + dict->SetDouble(keys::kTimeStampKey, + request->request_time().ToDoubleT() * 1000); // TODO(mpcomplete): request headers. args.Append(dict); diff --git a/chrome/browser/extensions/extension_webrequest_api_constants.cc b/chrome/browser/extensions/extension_webrequest_api_constants.cc index 460e21f..32a6f4c 100644 --- a/chrome/browser/extensions/extension_webrequest_api_constants.cc +++ b/chrome/browser/extensions/extension_webrequest_api_constants.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,7 @@ const char kRedirectUrlKey[] = "redirectUrl"; const char kRequestIdKey[] = "requestId"; const char kStatusCodeKey[] = "statusCode"; const char kTabIdKey[] = "tabId"; +const char kTimeStampKey[] = "timeStamp"; const char kTypeKey[] = "type"; const char kUrlKey[] = "url"; diff --git a/chrome/browser/extensions/extension_webrequest_api_constants.h b/chrome/browser/extensions/extension_webrequest_api_constants.h index a026f68..21c654a 100644 --- a/chrome/browser/extensions/extension_webrequest_api_constants.h +++ b/chrome/browser/extensions/extension_webrequest_api_constants.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,6 +18,7 @@ extern const char kRedirectUrlKey[]; extern const char kRequestIdKey[]; extern const char kStatusCodeKey[]; extern const char kTabIdKey[]; +extern const char kTimeStampKey[]; extern const char kTypeKey[]; extern const char kUrlKey[]; diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index b504ff7..eabdda5 100644 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -3420,7 +3420,8 @@ "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."}, - "requestId": {"type": "string", "description": "The ID of the request to retrieve the document of this navigation. Note that this event is fired prior to the corresponding chrome.experimental.webRequest.onBeforeRequest."} + "requestId": {"type": "string", "description": "The ID of the request to retrieve the document of this navigation. Note that this event is fired prior to the corresponding chrome.experimental.webRequest.onBeforeRequest."}, + "timeStamp": {"type": "number", "description": "The time when the browser was about to start the navigation, in milliseconds since the epoch."} } } ] @@ -3438,7 +3439,8 @@ "url": {"type": "string"}, "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; positive value indicates navigation in a subframe."}, "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"]}} + "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."} } } ] @@ -3454,7 +3456,8 @@ "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; positive value indicates navigation in a subframe."}, + "timeStamp": {"type": "number", "description": "The time when the page's DOM was fully constructed, in milliseconds since the epoch."} } } ] @@ -3470,7 +3473,8 @@ "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; positive value indicates navigation in a subframe."}, + "timeStamp": {"type": "number", "description": "The time when the document finished loading, in milliseconds since the epoch."} } } ] @@ -3487,7 +3491,8 @@ "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."}, - "error": {"type": "string", "description": "The error description."} + "error": {"type": "string", "description": "The error description."}, + "timeStamp": {"type": "number", "description": "The time when the error occurred, in milliseconds since the epoch."} } } ] @@ -3503,7 +3508,8 @@ "properties": { "sourceTabId": {"type": "integer", "description": "The ID of the tab in which the navigation is triggered."}, "sourceUrl": {"type": "string", "description": "The URL of the document that is opening the new window."}, - "url": {"type": "string", "description": "The URL to be opened in the new window."} + "url": {"type": "string", "description": "The URL to be opened in the new window."}, + "timeStamp": {"type": "number", "description": "The time when the browser was about to create a new view, in milliseconds since the epoch."} } } ] @@ -3597,7 +3603,8 @@ "url": {"type": "string"}, "method": {"type": "string", "description": "Standard HTTP method."}, "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."} + "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."} } } ] @@ -3612,7 +3619,8 @@ "name": "details", "properties": { "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"} + "url": {"type": "string"}, + "timeStamp": {"type": "number", "description": "The time when the browser was about to send headers, in milliseconds since the epoch."} } } ] @@ -3628,7 +3636,8 @@ "properties": { "requestId": {"type": "string", "description": "The ID of the request."}, "url": {"type": "string"}, - "ip": {"type": "string", "description": "The server IP address that is actually connected to. Note that it may be a literal IPv6 address."} + "ip": {"type": "string", "description": "The server IP address that is actually connected to. Note that it may be a literal IPv6 address."}, + "timeStamp": {"type": "number", "description": "The time when the browser finished sending the request, in milliseconds since the epoch."} } } ] @@ -3644,7 +3653,8 @@ "properties": { "requestId": {"type": "string", "description": "The ID of the request."}, "url": {"type": "string"}, - "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."} + "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."}, + "timeStamp": {"type": "number", "description": "The time when the status line and response headers were received, in milliseconds since the epoch."} } } ] @@ -3661,7 +3671,8 @@ "requestId": {"type": "string", "description": "The ID of the request."}, "url": {"type": "string", "description": "The URL of the current request."}, "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."}, - "redirectUrl": {"type": "string", "description": "The new URL."} + "redirectUrl": {"type": "string", "description": "The new URL."}, + "timeStamp": {"type": "number", "description": "The time when the browser was about to make the redirect, in milliseconds since the epoch."} } } ] @@ -3677,7 +3688,8 @@ "properties": { "requestId": {"type": "string", "description": "The ID of the request."}, "url": {"type": "string", "description": "The URL of the current request."}, - "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."} + "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."}, + "timeStamp": {"type": "number", "description": "The time when the response was received completely, in milliseconds since the epoch."} } } ] @@ -3693,7 +3705,8 @@ "properties": { "requestId": {"type": "string", "description": "The ID of the request."}, "url": {"type": "string", "description": "The URL of the current request."}, - "error": {"type": "string", "description": "The error description."} + "error": {"type": "string", "description": "The error description."}, + "timeStamp": {"type": "number", "description": "The time when the error occurred, in milliseconds since the epoch."} } } ] diff --git a/chrome/common/extensions/docs/experimental.webNavigation.html b/chrome/common/extensions/docs/experimental.webNavigation.html index 31ed43d..c3041ff 100644 --- a/chrome/common/extensions/docs/experimental.webNavigation.html +++ b/chrome/common/extensions/docs/experimental.webNavigation.html @@ -16,7 +16,7 @@ <script type="text/javascript" src="js/api_page_generator.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> <script type="text/javascript" src="js/sidebar.js"></script> - <title>chrome.experimental.webNavigation - Google Chrome Extensions - Google Code</title></head> + <title>WebNavigation API - Google Chrome Extensions - Google Code</title></head> <body> <div id="gc-container" class="labs"> <div id="devModeWarning"> You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files. @@ -251,16 +251,16 @@ <div class="g-unit" id="gc-pagecontent"> <div id="pageTitle"> - <h1 class="page_title">chrome.experimental.webNavigation</h1> + <h1 class="page_title">WebNavigation API</h1> </div> <!-- TABLE OF CONTENTS --> <div id="toc"> <h2>Contents</h2> <ol> - <li style="display: none; "> - <a>h2Name</a> + <li> + <a href="#H2-0">A note about timestamps</a> <ol> - <li> + <li style="display: none; "> <a>h3Name</a> </li> </ol> @@ -317,12 +317,35 @@ <!-- /TABLE OF CONTENTS --> <!-- Standard content lead-in for experimental API pages --> - <p id="classSummary"> + <p id="classSummary" style="display: none; "> For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page. </p> <!-- STATIC CONTENT PLACEHOLDER --> - <div id="static"></div> + <div id="static"><div id="pageData-name" class="pageData">WebNavigation API</div> + +<!-- BEGIN AUTHORED CONTENT --> +<p id="classSummary"> +Use the <code>chrome.experimental.webNavigation</code> module to recieve +notifications about the status of navigations requests in-flight. This +module is still very much experimental. For information on how to use +experimental APIs, see the <a href="experimental.html">chrome.experimental.* +APIs</a> page. +</p> + +<a name="H2-0"></a><h2>A note about timestamps</h2> +<p> +It's important to note that some technical oddities in the OS's handling +of distinct Chrome processes can cause the clock to be skewed between the +browser itself and extension processes. That means that WebNavigation's events' +<code>timeStamp</code> property is only guaranteed to be <i>internally</i> +consistent. Comparing one event to another event will give you the correct +offset between them, but comparing them to the current time inside the +extension (via <code>(new Date()).getTime()</code>, for instance) might give +unexpected results. +</p> +<!-- END AUTHORED CONTENT --> +</div> <!-- API PAGE --> <div class="apiPage"> @@ -766,6 +789,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the browser was about to start the navigation, in milliseconds since the epoch.</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> </dl> </dd> @@ -1059,6 +1150,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the browser was about to create a new view, in milliseconds since the epoch.</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> </dl> </dd> @@ -1490,6 +1649,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the navigation was committed, in milliseconds since the epoch.</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> </dl> </dd> @@ -1785,6 +2012,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the document finished loading, in milliseconds since the epoch.</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> </dl> </dd> @@ -2080,6 +2375,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the page's DOM was fully constructed, in milliseconds since the epoch.</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> </dl> </dd> @@ -2443,6 +2806,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the error occurred, in milliseconds since the epoch.</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> </dl> </dd> diff --git a/chrome/common/extensions/docs/experimental.webRequest.html b/chrome/common/extensions/docs/experimental.webRequest.html index 233f35f..859d2ba 100644 --- a/chrome/common/extensions/docs/experimental.webRequest.html +++ b/chrome/common/extensions/docs/experimental.webRequest.html @@ -16,7 +16,7 @@ <script type="text/javascript" src="js/api_page_generator.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> <script type="text/javascript" src="js/sidebar.js"></script> - <title>chrome.experimental.webRequest - Google Chrome Extensions - Google Code</title></head> + <title>WebRequest API - Google Chrome Extensions - Google Code</title></head> <body> <div id="gc-container" class="labs"> <div id="devModeWarning"> You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files. @@ -251,16 +251,16 @@ <div class="g-unit" id="gc-pagecontent"> <div id="pageTitle"> - <h1 class="page_title">chrome.experimental.webRequest</h1> + <h1 class="page_title">WebRequest API</h1> </div> <!-- TABLE OF CONTENTS --> <div id="toc"> <h2>Contents</h2> <ol> - <li style="display: none; "> - <a>h2Name</a> + <li> + <a href="#H2-0">A note about timestamps</a> <ol> - <li> + <li style="display: none; "> <a>h3Name</a> </li> </ol> @@ -321,12 +321,34 @@ <!-- /TABLE OF CONTENTS --> <!-- Standard content lead-in for experimental API pages --> - <p id="classSummary"> + <p id="classSummary" style="display: none; "> For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page. </p> <!-- STATIC CONTENT PLACEHOLDER --> - <div id="static"></div> + <div id="static"><div id="pageData-name" class="pageData">WebRequest API</div> + +<!-- BEGIN AUTHORED CONTENT --> +<p id="classSummary"> +Use the <code>chrome.experimental.webRequest</code> module to intercept, block, +or modify requests in-flight. This module is still very much experimental. For +information on how to use experimental APIs, see the +<a href="experimental.html">chrome.experimental.* APIs</a> page. +</p> + +<a name="H2-0"></a><h2>A note about timestamps</h2> +<p> +It's important to note that some technical oddities in the OS's handling +of distinct Chrome processes can cause the clock to be skewed between the +browser itself and extension processes. That means that WebRequest's events' +<code>timeStamp</code> property is only guaranteed to be <i>internally</i> +consistent. Comparing one event to another event will give you the correct +offset between them, but comparing them to the current time inside the +extension (via <code>(new Date()).getTime()</code>, for instance) might give +unexpected results. +</p> +<!-- END AUTHORED CONTENT --> +</div> <!-- API PAGE --> <div class="apiPage"> @@ -834,6 +856,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the browser was about to make the redirect, in milliseconds since the epoch.</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> </dl> </dd> @@ -1265,6 +1355,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the browser was about to make the request, in milliseconds since the epoch.</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> </dl> </dd> @@ -1492,6 +1650,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the browser was about to send headers, in milliseconds since the epoch.</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> </dl> </dd> @@ -1785,6 +2011,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the response was received completely, in milliseconds since the epoch.</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> </dl> </dd> @@ -2078,6 +2372,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the error occurred, in milliseconds since the epoch.</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> </dl> </dd> @@ -2373,6 +2735,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the status line and response headers were received, in milliseconds since the epoch.</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> </dl> </dd> @@ -2668,6 +3098,74 @@ </dd> </div> + </div><div> + <div> + <dt> + <var>timeStamp</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>number</span> + <span style="display: none; "></span> + </span> + </span> + ) + </div> + + </em> + </dt> + <dd class="todo" style="display: none; "> + Undocumented. + </dd> + <dd>The time when the browser finished sending the request, in milliseconds since the epoch.</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> </dl> </dd> diff --git a/chrome/common/extensions/docs/static/experimental.webNavigation.html b/chrome/common/extensions/docs/static/experimental.webNavigation.html new file mode 100644 index 0000000..3f214ad --- /dev/null +++ b/chrome/common/extensions/docs/static/experimental.webNavigation.html @@ -0,0 +1,23 @@ +<div id="pageData-name" class="pageData">WebNavigation API</div> + +<!-- BEGIN AUTHORED CONTENT --> +<p id="classSummary"> +Use the <code>chrome.experimental.webNavigation</code> module to recieve +notifications about the status of navigations requests in-flight. This +module is still very much experimental. For information on how to use +experimental APIs, see the <a href="experimental.html">chrome.experimental.* +APIs</a> page. +</p> + +<h2>A note about timestamps</h2> +<p> +It's important to note that some technical oddities in the OS's handling +of distinct Chrome processes can cause the clock to be skewed between the +browser itself and extension processes. That means that WebNavigation's events' +<code>timeStamp</code> property is only guaranteed to be <i>internally</i> +consistent. Comparing one event to another event will give you the correct +offset between them, but comparing them to the current time inside the +extension (via <code>(new Date()).getTime()</code>, for instance) might give +unexpected results. +</p> +<!-- END AUTHORED CONTENT --> diff --git a/chrome/common/extensions/docs/static/experimental.webRequest.html b/chrome/common/extensions/docs/static/experimental.webRequest.html new file mode 100644 index 0000000..43cb6b1 --- /dev/null +++ b/chrome/common/extensions/docs/static/experimental.webRequest.html @@ -0,0 +1,22 @@ +<div id="pageData-name" class="pageData">WebRequest API</div> + +<!-- BEGIN AUTHORED CONTENT --> +<p id="classSummary"> +Use the <code>chrome.experimental.webRequest</code> module to intercept, block, +or modify requests in-flight. This module is still very much experimental. For +information on how to use experimental APIs, see the +<a href="experimental.html">chrome.experimental.* APIs</a> page. +</p> + +<h2>A note about timestamps</h2> +<p> +It's important to note that some technical oddities in the OS's handling +of distinct Chrome processes can cause the clock to be skewed between the +browser itself and extension processes. That means that WebRequest's events' +<code>timeStamp</code> property is only guaranteed to be <i>internally</i> +consistent. Comparing one event to another event will give you the correct +offset between them, but comparing them to the current time inside the +extension (via <code>(new Date()).getTime()</code>, for instance) might give +unexpected results. +</p> +<!-- END AUTHORED CONTENT --> diff --git a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/framework.js b/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/framework.js index ae5d768..974e459 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/framework.js +++ b/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/framework.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + var expectedEventData; var capturedEventData; var nextFrameId; @@ -25,6 +29,9 @@ function checkExpectations() { function captureEvent(name, details) { // normalize details. + if ('timeStamp' in details) { + details.timeStamp = 0; + } if (('frameId' in details) && (details.frameId != 0)) { if (frameIds[details.frameId] === undefined) { frameIds[details.frameId] = nextFrameId++; diff --git a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/tests.js b/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/tests.js index e2994e8..a54b718 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/tests.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + function runTests() { var getURL = chrome.extension.getURL; chrome.tabs.getSelected(null, function(tab) { @@ -12,39 +16,47 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: ["client_redirect"], transitionType: "link", url: getURL('b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('b.html') }]]); chrome.tabs.update(tabId, { url: getURL('a.html') }); }, diff --git a/chrome/test/data/extensions/api_test/webnavigation/failures/framework.js b/chrome/test/data/extensions/api_test/webnavigation/failures/framework.js index ae5d768..974e459 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/failures/framework.js +++ b/chrome/test/data/extensions/api_test/webnavigation/failures/framework.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + var expectedEventData; var capturedEventData; var nextFrameId; @@ -25,6 +29,9 @@ function checkExpectations() { function captureEvent(name, details) { // normalize details. + if ('timeStamp' in details) { + details.timeStamp = 0; + } if (('frameId' in details) && (details.frameId != 0)) { if (frameIds[details.frameId] === undefined) { frameIds[details.frameId] = nextFrameId++; diff --git a/chrome/test/data/extensions/api_test/webnavigation/failures/tests.js b/chrome/test/data/extensions/api_test/webnavigation/failures/tests.js index e4a9237..29adca8 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/failures/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/failures/tests.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + function runTests() { var getURL = chrome.extension.getURL; chrome.tabs.getSelected(null, function(tab) { @@ -11,11 +15,13 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('nonexistant.html') }], [ "onErrorOccurred", { error: "net::ERR_FILE_NOT_FOUND", frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('nonexistant.html') }]]); chrome.tabs.update(tabId, { url: getURL('nonexistant.html') }); }, @@ -27,10 +33,12 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('d.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('d.html') }], @@ -38,19 +46,23 @@ function runTests() { { frameId: 1, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('c.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('d.html') }], [ "onErrorOccurred", { error: "net::ERR_FILE_NOT_FOUND", frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('c.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('d.html') }]]); chrome.tabs.update(tabId, { url: getURL('d.html') }); }, @@ -62,10 +74,12 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('a.html') }], @@ -73,38 +87,46 @@ function runTests() { { frameId: 1, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 1, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", url: getURL('b.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onCompleted", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onBeforeNavigate", { frameId: 1, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('c.html') }], [ "onErrorOccurred", { error: "net::ERR_FILE_NOT_FOUND", frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('c.html') }]]); chrome.tabs.update(tabId, { url: getURL('a.html') }); }, diff --git a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/framework.js b/chrome/test/data/extensions/api_test/webnavigation/forwardBack/framework.js index ae5d768..974e459 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/framework.js +++ b/chrome/test/data/extensions/api_test/webnavigation/forwardBack/framework.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + var expectedEventData; var capturedEventData; var nextFrameId; @@ -25,6 +29,9 @@ function checkExpectations() { function captureEvent(name, details) { // normalize details. + if ('timeStamp' in details) { + details.timeStamp = 0; + } if (('frameId' in details) && (details.frameId != 0)) { if (frameIds[details.frameId] === undefined) { frameIds[details.frameId] = nextFrameId++; diff --git a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/tests.js b/chrome/test/data/extensions/api_test/webnavigation/forwardBack/tests.js index a8851e0..cb2ff20 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/forwardBack/tests.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + function runTests() { var getURL = chrome.extension.getURL; chrome.tabs.getSelected(null, function(tab) { @@ -12,58 +16,70 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: ["client_redirect"], transitionType: "link", url: getURL('b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: ["forward_back"], transitionType: "link", url: getURL('a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }]]); chrome.tabs.update(tabId, { url: getURL('a.html') }); }, diff --git a/chrome/test/data/extensions/api_test/webnavigation/iframe/framework.js b/chrome/test/data/extensions/api_test/webnavigation/iframe/framework.js index ae5d768..974e459 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/iframe/framework.js +++ b/chrome/test/data/extensions/api_test/webnavigation/iframe/framework.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + var expectedEventData; var capturedEventData; var nextFrameId; @@ -25,6 +29,9 @@ function checkExpectations() { function captureEvent(name, details) { // normalize details. + if ('timeStamp' in details) { + details.timeStamp = 0; + } if (('frameId' in details) && (details.frameId != 0)) { if (frameIds[details.frameId] === undefined) { frameIds[details.frameId] = nextFrameId++; diff --git a/chrome/test/data/extensions/api_test/webnavigation/iframe/tests.js b/chrome/test/data/extensions/api_test/webnavigation/iframe/tests.js index 563d02a..1a9e06b 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/iframe/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/iframe/tests.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + function runTests() { var getURL = chrome.extension.getURL; chrome.tabs.getSelected(null, function(tab) { @@ -12,10 +16,12 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('a.html') }], @@ -23,47 +29,57 @@ function runTests() { { frameId: 1, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 1, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", url: getURL('b.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onCompleted", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('b.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onBeforeNavigate", { frameId: 1, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('c.html') }], [ "onCommitted", { frameId: 1, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "manual_subframe", url: getURL('c.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('c.html') }], [ "onCompleted", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('c.html') }]]); chrome.tabs.update(tabId, { url: getURL('a.html') }); }, @@ -77,10 +93,12 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('d.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('d.html') }], @@ -88,66 +106,80 @@ function runTests() { { frameId: 1, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('e.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('d.html') }], [ "onCommitted", { frameId: 1, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", url: getURL('e.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('e.html') }], [ "onBeforeNavigate", { frameId: 2, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('f.html') }], [ "onCompleted", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('e.html') }], [ "onCommitted", { frameId: 2, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", url: getURL('f.html') }], [ "onDOMContentLoaded", { frameId: 2, tabId: 0, + timeStamp: 0, url: getURL('f.html') }], [ "onCompleted", { frameId: 2, tabId: 0, + timeStamp: 0, url: getURL('f.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('d.html') }], [ "onBeforeNavigate", { frameId: 2, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('g.html') }], [ "onCommitted", { frameId: 2, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "manual_subframe", url: getURL('g.html') }], [ "onDOMContentLoaded", { frameId: 2, tabId: 0, + timeStamp: 0, url: getURL('g.html') }], [ "onCompleted", { frameId: 2, tabId: 0, + timeStamp: 0, url: getURL('g.html') }]]); chrome.tabs.update(tabId, { url: getURL('d.html') }); }, diff --git a/chrome/test/data/extensions/api_test/webnavigation/openTab/framework.js b/chrome/test/data/extensions/api_test/webnavigation/openTab/framework.js index ae5d768..974e459 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/openTab/framework.js +++ b/chrome/test/data/extensions/api_test/webnavigation/openTab/framework.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + var expectedEventData; var capturedEventData; var nextFrameId; @@ -25,6 +29,9 @@ function checkExpectations() { function captureEvent(name, details) { // normalize details. + if ('timeStamp' in details) { + details.timeStamp = 0; + } if (('frameId' in details) && (details.frameId != 0)) { if (frameIds[details.frameId] === undefined) { frameIds[details.frameId] = nextFrameId++; diff --git a/chrome/test/data/extensions/api_test/webnavigation/openTab/tests.js b/chrome/test/data/extensions/api_test/webnavigation/openTab/tests.js index e7e4321..4b810b7 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/openTab/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/openTab/tests.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + function runTests() { var getURL = chrome.extension.getURL; chrome.tabs.getSelected(null, function(tab) { @@ -11,43 +15,52 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onBeforeRetarget", { sourceTabId: 0, sourceUrl: getURL('a.html'), + timeStamp: 0, url: getURL('b.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 1, + timeStamp: 0, url: getURL('b.html') }], [ "onCommitted", { frameId: 0, tabId: 1, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 1, + timeStamp: 0, url: getURL('b.html') }], [ "onCompleted", { frameId: 0, tabId: 1, + timeStamp: 0, url: getURL('b.html') }]]); chrome.tabs.update(tabId, { url: getURL('a.html') }); }, @@ -59,10 +72,12 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('c.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('c.html') }], @@ -70,51 +85,62 @@ function runTests() { { frameId: 1, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('c.html') }], [ "onCommitted", { frameId: 1, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "auto_subframe", url: getURL('a.html') }], [ "onDOMContentLoaded", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCompleted", { frameId: 1, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('c.html') }], [ "onBeforeRetarget", { sourceTabId: 0, sourceUrl: getURL('a.html'), + timeStamp: 0, url: getURL('b.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 1, + timeStamp: 0, url: getURL('b.html') }], [ "onCommitted", { frameId: 0, tabId: 1, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('b.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 1, + timeStamp: 0, url: getURL('b.html') }], [ "onCompleted", { frameId: 0, tabId: 1, + timeStamp: 0, url: getURL('b.html') }]]); chrome.tabs.update(tabId, { url: getURL('c.html') }); }, diff --git a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/framework.js b/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/framework.js index ae5d768..974e459 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/framework.js +++ b/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/framework.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + var expectedEventData; var capturedEventData; var nextFrameId; @@ -25,6 +29,9 @@ function checkExpectations() { function captureEvent(name, details) { // normalize details. + if ('timeStamp' in details) { + details.timeStamp = 0; + } if (('frameId' in details) && (details.frameId != 0)) { if (frameIds[details.frameId] === undefined) { frameIds[details.frameId] = nextFrameId++; diff --git a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/tests.js b/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/tests.js index 02ab4d7..9e6966ac 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/tests.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + function runTests() { var getURL = chrome.extension.getURL; chrome.tabs.getSelected(null, function(tab) { @@ -11,39 +15,47 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onBeforeNavigate", { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html#anchor') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: ["client_redirect"], transitionType: "link", url: getURL('a.html#anchor') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html#anchor') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html#anchor') }]]); chrome.tabs.update(tabId, { url: getURL('a.html') }); }, diff --git a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/framework.js b/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/framework.js index ae5d768..974e459 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/framework.js +++ b/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/framework.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + var expectedEventData; var capturedEventData; var nextFrameId; @@ -25,6 +29,9 @@ function checkExpectations() { function captureEvent(name, details) { // normalize details. + if ('timeStamp' in details) { + details.timeStamp = 0; + } if (('frameId' in details) && (details.frameId != 0)) { if (frameIds[details.frameId] === undefined) { frameIds[details.frameId] = nextFrameId++; diff --git a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/tests.js b/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/tests.js index a7eda72..e3d862b 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/tests.js +++ b/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/tests.js @@ -1,3 +1,7 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + function runTests() { var getURL = chrome.extension.getURL; chrome.tabs.getSelected(null, function(tab) { @@ -11,20 +15,24 @@ function runTests() { { frameId: 0, requestId: "0", tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCommitted", { frameId: 0, tabId: 0, + timeStamp: 0, transitionQualifiers: [], transitionType: "link", url: getURL('a.html') }], [ "onDOMContentLoaded", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }], [ "onCompleted", { frameId: 0, tabId: 0, + timeStamp: 0, url: getURL('a.html') }]]); chrome.tabs.update(tabId, { url: getURL('a.html') }); }, 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 72688d7..b0a7bd3 100644 --- a/chrome/test/data/extensions/api_test/webrequest/events/test.html +++ b/chrome/test/data/extensions/api_test/webrequest/events/test.html @@ -22,7 +22,10 @@ function runTests(tests) { }); } +var startTime; + function expect(data, filter, extraInfoSpec) { + startTime = new Date(); expectedEventData = data; capturedEventData = []; removeListeners(); @@ -46,7 +49,18 @@ function captureEvent(name, details) { details.url.match(/\/favicon.ico$/)) return; + // Basic sanity check for timeStamp. + var now = new Date(); + var requestTime = new Date(details.timeStamp); + chrome.test.assertTrue(startTime <= requestTime, + "requestTime: " + requestTime.getTime() + + " is before startTime: " + startTime.getTime()); + // TODO(mpcomplete): why is requestTime sometimes later than now? + // chrome.test.assertTrue(requestTime <= now, + // "requestTime: " + requestTime.getTime() + + // " is after now: " + now.getTime()); delete details.requestId; + delete details.timeStamp; capturedEventData.push([name, details]); checkExpectations(); } |