nsITimedChannel.idl 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #include "nsISupports.idl"
  5. interface nsIPrincipal;
  6. %{C++
  7. namespace mozilla {
  8. class TimeStamp;
  9. }
  10. %}
  11. native TimeStamp(mozilla::TimeStamp);
  12. // All properties return zero if the value is not available
  13. [scriptable, uuid(ca63784d-959c-4c3a-9a59-234a2a520de0)]
  14. interface nsITimedChannel : nsISupports {
  15. // Set this attribute to true to enable collection of timing data.
  16. // channelCreationTime will be available even with this attribute set to
  17. // false.
  18. attribute boolean timingEnabled;
  19. // The number of redirects
  20. attribute uint8_t redirectCount;
  21. attribute uint8_t internalRedirectCount;
  22. [noscript] readonly attribute TimeStamp channelCreation;
  23. [noscript] readonly attribute TimeStamp asyncOpen;
  24. // The following are only set when the document is not (only) read from the
  25. // cache
  26. [noscript] readonly attribute TimeStamp domainLookupStart;
  27. [noscript] readonly attribute TimeStamp domainLookupEnd;
  28. [noscript] readonly attribute TimeStamp connectStart;
  29. [noscript] readonly attribute TimeStamp secureConnectionStart;
  30. [noscript] readonly attribute TimeStamp connectEnd;
  31. [noscript] readonly attribute TimeStamp requestStart;
  32. [noscript] readonly attribute TimeStamp responseStart;
  33. [noscript] readonly attribute TimeStamp responseEnd;
  34. // The following are only set when the request is intercepted by a service
  35. // worker no matter the response is synthesized.
  36. [noscript] attribute TimeStamp launchServiceWorkerStart;
  37. [noscript] attribute TimeStamp launchServiceWorkerEnd;
  38. [noscript] attribute TimeStamp dispatchFetchEventStart;
  39. [noscript] attribute TimeStamp dispatchFetchEventEnd;
  40. [noscript] attribute TimeStamp handleFetchEventStart;
  41. [noscript] attribute TimeStamp handleFetchEventEnd;
  42. // The redirect attributes timings must be writeble, se we can transfer
  43. // the data from one channel to the redirected channel.
  44. [noscript] attribute TimeStamp redirectStart;
  45. [noscript] attribute TimeStamp redirectEnd;
  46. // The initiator type
  47. [noscript] attribute AString initiatorType;
  48. // This flag should be set to false only if a cross-domain redirect occurred
  49. [noscript] attribute boolean allRedirectsSameOrigin;
  50. // This flag is set to false if the timing allow check fails
  51. [noscript] attribute boolean allRedirectsPassTimingAllowCheck;
  52. // Implements the timing-allow-check to determine if we should report
  53. // timing info for the resourceTiming object.
  54. [noscript] boolean timingAllowCheck(in nsIPrincipal origin);
  55. %{C++
  56. inline bool TimingAllowCheck(nsIPrincipal* aOrigin) {
  57. bool allowed = false;
  58. return NS_SUCCEEDED(TimingAllowCheck(aOrigin, &allowed)) && allowed;
  59. }
  60. %}
  61. // The following are only set if the document is (partially) read from the
  62. // cache
  63. [noscript] readonly attribute TimeStamp cacheReadStart;
  64. [noscript] readonly attribute TimeStamp cacheReadEnd;
  65. // All following are PRTime versions of the above.
  66. readonly attribute PRTime channelCreationTime;
  67. readonly attribute PRTime asyncOpenTime;
  68. readonly attribute PRTime launchServiceWorkerStartTime;
  69. readonly attribute PRTime launchServiceWorkerEndTime;
  70. readonly attribute PRTime dispatchFetchEventStartTime;
  71. readonly attribute PRTime dispatchFetchEventEndTime;
  72. readonly attribute PRTime handleFetchEventStartTime;
  73. readonly attribute PRTime handleFetchEventEndTime;
  74. readonly attribute PRTime domainLookupStartTime;
  75. readonly attribute PRTime domainLookupEndTime;
  76. readonly attribute PRTime connectStartTime;
  77. readonly attribute PRTime secureConnectionStartTime;
  78. readonly attribute PRTime connectEndTime;
  79. readonly attribute PRTime requestStartTime;
  80. readonly attribute PRTime responseStartTime;
  81. readonly attribute PRTime responseEndTime;
  82. readonly attribute PRTime cacheReadStartTime;
  83. readonly attribute PRTime cacheReadEndTime;
  84. readonly attribute PRTime redirectStartTime;
  85. readonly attribute PRTime redirectEndTime;
  86. };