2011-06-23 10:39:48 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2011-06-23 10:39:48 +00:00
|
|
|
|
|
|
|
#ifndef nsDOMNavigationTiming_h___
|
|
|
|
#define nsDOMNavigationTiming_h___
|
|
|
|
|
|
|
|
#include "nsIDOMPerformanceTiming.h"
|
|
|
|
#include "nsIDOMPerformanceNavigation.h"
|
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsCOMArray.h"
|
2011-09-15 23:47:29 +00:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2011-07-20 19:18:54 +00:00
|
|
|
#include "nsIURI.h"
|
2011-06-23 10:39:48 +00:00
|
|
|
|
|
|
|
class nsDOMNavigationTimingClock;
|
|
|
|
class nsIDocument;
|
|
|
|
|
2011-07-04 16:44:00 +00:00
|
|
|
class nsDOMNavigationTiming
|
2011-06-23 10:39:48 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsDOMNavigationTiming();
|
|
|
|
|
2011-07-04 16:44:00 +00:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(nsDOMNavigationTiming)
|
|
|
|
nsresult GetType(nsDOMPerformanceNavigationType* aNavigationType);
|
|
|
|
nsresult GetRedirectCount(PRUint16* aCount);
|
|
|
|
|
|
|
|
nsresult GetRedirectStart(DOMTimeMilliSec* aRedirectStart);
|
|
|
|
nsresult GetRedirectEnd(DOMTimeMilliSec* aEnd);
|
|
|
|
nsresult GetNavigationStart(DOMTimeMilliSec* aNavigationStart);
|
|
|
|
nsresult GetUnloadEventStart(DOMTimeMilliSec* aStart);
|
|
|
|
nsresult GetUnloadEventEnd(DOMTimeMilliSec* aEnd);
|
|
|
|
nsresult GetFetchStart(DOMTimeMilliSec* aStart);
|
|
|
|
nsresult GetDomLoading(DOMTimeMilliSec* aTime);
|
|
|
|
nsresult GetDomInteractive(DOMTimeMilliSec* aTime);
|
|
|
|
nsresult GetDomContentLoadedEventStart(DOMTimeMilliSec* aStart);
|
|
|
|
nsresult GetDomContentLoadedEventEnd(DOMTimeMilliSec* aEnd);
|
|
|
|
nsresult GetDomComplete(DOMTimeMilliSec* aTime);
|
|
|
|
nsresult GetLoadEventStart(DOMTimeMilliSec* aStart);
|
|
|
|
nsresult GetLoadEventEnd(DOMTimeMilliSec* aEnd);
|
2011-06-23 10:39:48 +00:00
|
|
|
|
|
|
|
void NotifyNavigationStart();
|
|
|
|
void NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType);
|
|
|
|
void NotifyRedirect(nsIURI* aOldURI, nsIURI* aNewURI);
|
|
|
|
void NotifyBeforeUnload();
|
|
|
|
void NotifyUnloadAccepted(nsIURI* aOldURI);
|
|
|
|
void NotifyUnloadEventStart();
|
|
|
|
void NotifyUnloadEventEnd();
|
|
|
|
void NotifyLoadEventStart();
|
|
|
|
void NotifyLoadEventEnd();
|
|
|
|
|
|
|
|
// Document changes state to 'loading' before connecting to timing
|
|
|
|
void SetDOMLoadingTimeStamp(nsIURI* aURI, mozilla::TimeStamp aValue);
|
|
|
|
void NotifyDOMLoading(nsIURI* aURI);
|
|
|
|
void NotifyDOMInteractive(nsIURI* aURI);
|
|
|
|
void NotifyDOMComplete(nsIURI* aURI);
|
|
|
|
void NotifyDOMContentLoadedStart(nsIURI* aURI);
|
|
|
|
void NotifyDOMContentLoadedEnd(nsIURI* aURI);
|
2011-07-04 16:44:00 +00:00
|
|
|
nsresult TimeStampToDOM(mozilla::TimeStamp aStamp, DOMTimeMilliSec* aResult);
|
2011-08-08 12:20:03 +00:00
|
|
|
nsresult TimeStampToDOMOrFetchStart(mozilla::TimeStamp aStamp,
|
|
|
|
DOMTimeMilliSec* aResult);
|
2011-06-23 10:39:48 +00:00
|
|
|
|
2012-04-27 07:22:06 +00:00
|
|
|
inline DOMHighResTimeStamp TimeStampToDOMHighRes(mozilla::TimeStamp aStamp)
|
|
|
|
{
|
|
|
|
mozilla::TimeDuration duration = aStamp - mNavigationStartTimeStamp;
|
|
|
|
return duration.ToMilliseconds();
|
|
|
|
}
|
|
|
|
|
2011-06-23 10:39:48 +00:00
|
|
|
private:
|
|
|
|
nsDOMNavigationTiming(const nsDOMNavigationTiming &){};
|
|
|
|
~nsDOMNavigationTiming();
|
|
|
|
|
|
|
|
void Clear();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool ReportRedirects();
|
2011-06-23 10:39:48 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> mUnloadedURI;
|
|
|
|
nsCOMPtr<nsIURI> mLoadedURI;
|
|
|
|
nsCOMArray<nsIURI> mRedirects;
|
|
|
|
|
|
|
|
typedef enum { NOT_CHECKED,
|
|
|
|
CHECK_PASSED,
|
|
|
|
NO_REDIRECTS,
|
|
|
|
CHECK_FAILED} RedirectCheckState;
|
|
|
|
RedirectCheckState mRedirectCheck;
|
2011-07-04 09:30:43 +00:00
|
|
|
PRInt16 mRedirectCount;
|
2011-06-23 10:39:48 +00:00
|
|
|
|
|
|
|
nsDOMPerformanceNavigationType mNavigationType;
|
|
|
|
DOMTimeMilliSec mNavigationStart;
|
|
|
|
mozilla::TimeStamp mNavigationStartTimeStamp;
|
|
|
|
DOMTimeMilliSec DurationFromStart();
|
|
|
|
|
|
|
|
DOMTimeMilliSec mFetchStart;
|
|
|
|
DOMTimeMilliSec mRedirectStart;
|
|
|
|
DOMTimeMilliSec mRedirectEnd;
|
|
|
|
DOMTimeMilliSec mBeforeUnloadStart;
|
|
|
|
DOMTimeMilliSec mUnloadStart;
|
|
|
|
DOMTimeMilliSec mUnloadEnd;
|
|
|
|
DOMTimeMilliSec mNavigationEnd;
|
|
|
|
DOMTimeMilliSec mLoadEventStart;
|
|
|
|
DOMTimeMilliSec mLoadEventEnd;
|
|
|
|
|
|
|
|
DOMTimeMilliSec mDOMLoading;
|
|
|
|
DOMTimeMilliSec mDOMInteractive;
|
|
|
|
DOMTimeMilliSec mDOMContentLoadedEventStart;
|
|
|
|
DOMTimeMilliSec mDOMContentLoadedEventEnd;
|
|
|
|
DOMTimeMilliSec mDOMComplete;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsDOMNavigationTiming_h___ */
|