/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"
%{C++
namespace mozilla {
class TimeStamp;
}
%}

native TimeStamp(mozilla::TimeStamp);

// All properties return zero if the value is not available
[scriptable, uuid(c259b593-a9bf-4d08-8149-ef89e1977dc4)]
interface nsITimedChannel : nsISupports {
  // Set this attribute to true to enable collection of timing data.
  // channelCreationTime will be available even with this attribute set to
  // false.
  attribute boolean timingEnabled;

  [notxpcom] readonly attribute TimeStamp channelCreation;
  [notxpcom] readonly attribute TimeStamp asyncOpen;

  // The following are only set when the document is not (only) read from the
  // cache
  [notxpcom] readonly attribute TimeStamp domainLookupStart;
  [notxpcom] readonly attribute TimeStamp domainLookupEnd;
  [notxpcom] readonly attribute TimeStamp connectStart;
  [notxpcom] readonly attribute TimeStamp connectEnd;
  [notxpcom] readonly attribute TimeStamp requestStart;
  [notxpcom] readonly attribute TimeStamp responseStart;
  [notxpcom] readonly attribute TimeStamp responseEnd;

  // The following are only set if the document is (partially) read from the
  // cache
  [notxpcom] readonly attribute TimeStamp cacheReadStart;
  [notxpcom] readonly attribute TimeStamp cacheReadEnd;

  // All following are PRTime versions of the above.
  readonly attribute PRTime channelCreationTime;
  readonly attribute PRTime asyncOpenTime;
  readonly attribute PRTime domainLookupStartTime;
  readonly attribute PRTime domainLookupEndTime;
  readonly attribute PRTime connectStartTime;
  readonly attribute PRTime connectEndTime;
  readonly attribute PRTime requestStartTime;
  readonly attribute PRTime responseStartTime;
  readonly attribute PRTime responseEndTime;
  readonly attribute PRTime cacheReadStartTime;
  readonly attribute PRTime cacheReadEndTime;
};
