This commit is contained in:
Jim Mathies 2011-05-23 19:55:44 -05:00
Родитель 0dd4e9c664 1e5a5219f8
Коммит f54a4198c8
36 изменённых файлов: 33 добавлений и 1608 удалений

Просмотреть файл

@ -110,7 +110,6 @@ class nsFrameLoader;
class nsIBoxObject; class nsIBoxObject;
class imgIRequest; class imgIRequest;
class nsISHEntry; class nsISHEntry;
class nsDOMNavigationTiming;
namespace mozilla { namespace mozilla {
namespace css { namespace css {
@ -125,8 +124,8 @@ class Element;
#define NS_IDOCUMENT_IID \ #define NS_IDOCUMENT_IID \
{ 0x2c6ad63f, 0xb7b9, 0x42f8, \ { 0x26ef6218, 0xcd5e, 0x4953, \
{ 0xbd, 0xde, 0x76, 0x0a, 0x83, 0xe3, 0xb0, 0x49 } } { 0xbb, 0x57, 0xb8, 0x50, 0x29, 0xa1, 0xae, 0x40 } }
// Flag for AddStyleSheet(). // Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0) #define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -1520,11 +1519,6 @@ public:
virtual nsresult GetStateObject(nsIVariant** aResult) = 0; virtual nsresult GetStateObject(nsIVariant** aResult) = 0;
virtual nsDOMNavigationTiming* GetNavigationTiming() const = 0;
virtual nsresult SetNavigationTiming(nsDOMNavigationTiming* aTiming) = 0;
protected: protected:
~nsIDocument() ~nsIDocument()
{ {

Просмотреть файл

@ -211,7 +211,6 @@ INCLUDES += \
-I$(topsrcdir)/js/src/xpconnect/src \ -I$(topsrcdir)/js/src/xpconnect/src \
-I$(topsrcdir)/caps/include \ -I$(topsrcdir)/caps/include \
-I$(topsrcdir)/netwerk/base/src \ -I$(topsrcdir)/netwerk/base/src \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
DEFINES += -D_IMPL_NS_LAYOUT DEFINES += -D_IMPL_NS_LAYOUT

Просмотреть файл

@ -183,7 +183,6 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
#include "mozAutoDocUpdate.h" #include "mozAutoDocUpdate.h"
#include "nsGlobalWindow.h" #include "nsGlobalWindow.h"
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h" #include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
#include "nsDOMNavigationTiming.h"
#ifdef MOZ_SMIL #ifdef MOZ_SMIL
#include "nsSMILAnimationController.h" #include "nsSMILAnimationController.h"
@ -4104,10 +4103,6 @@ nsDocument::DispatchContentLoadedEvents()
// Unpin references to preloaded images // Unpin references to preloaded images
mPreloadingImages.Clear(); mPreloadingImages.Clear();
if (mTiming) {
mTiming->NotifyDOMContentLoadedStart(nsIDocument::GetDocumentURI());
}
// Fire a DOM event notifying listeners that this document has been // Fire a DOM event notifying listeners that this document has been
// loaded (excluding images and other loads initiated by this // loaded (excluding images and other loads initiated by this
@ -4116,10 +4111,6 @@ nsDocument::DispatchContentLoadedEvents()
NS_LITERAL_STRING("DOMContentLoaded"), NS_LITERAL_STRING("DOMContentLoaded"),
PR_TRUE, PR_TRUE); PR_TRUE, PR_TRUE);
if (mTiming) {
mTiming->NotifyDOMContentLoadedEnd(nsIDocument::GetDocumentURI());
}
// If this document is a [i]frame, fire a DOMFrameContentLoaded // If this document is a [i]frame, fire a DOMFrameContentLoaded
// event on all parent documents notifying that the HTML (excluding // event on all parent documents notifying that the HTML (excluding
// other external files such as images and stylesheets) in a frame // other external files such as images and stylesheets) in a frame
@ -7704,26 +7695,6 @@ void
nsDocument::SetReadyStateInternal(ReadyState rs) nsDocument::SetReadyStateInternal(ReadyState rs)
{ {
mReadyState = rs; mReadyState = rs;
if (mTiming) {
switch (rs) {
case READYSTATE_LOADING:
mTiming->NotifyDOMLoading(nsIDocument::GetDocumentURI());
break;
case READYSTATE_INTERACTIVE:
mTiming->NotifyDOMInteractive(nsIDocument::GetDocumentURI());
break;
case READYSTATE_COMPLETE:
mTiming->NotifyDOMComplete(nsIDocument::GetDocumentURI());
break;
default:
NS_WARNING("Unexpected ReadyState value");
break;
}
}
// At the time of loading start, we don't have timing object, record time.
if (READYSTATE_LOADING == rs) {
mLoadingTimeStamp = mozilla::TimeStamp::Now();
}
nsRefPtr<nsPLDOMEvent> plevent = nsRefPtr<nsPLDOMEvent> plevent =
new nsPLDOMEvent(this, NS_LITERAL_STRING("readystatechange"), PR_FALSE, PR_FALSE); new nsPLDOMEvent(this, NS_LITERAL_STRING("readystatechange"), PR_FALSE, PR_FALSE);
@ -8192,22 +8163,6 @@ nsDocument::GetStateObject(nsIVariant** aState)
return NS_OK; return NS_OK;
} }
nsDOMNavigationTiming*
nsDocument::GetNavigationTiming() const
{
return mTiming;
}
nsresult
nsDocument::SetNavigationTiming(nsDOMNavigationTiming* aTiming)
{
mTiming = aTiming;
if (!mLoadingTimeStamp.IsNull() && mTiming) {
mTiming->SetDOMLoadingTimeStamp(nsIDocument::GetDocumentURI(), mLoadingTimeStamp);
}
return NS_OK;
}
nsresult nsresult
nsDocument::AddImage(imgIRequest* aImage) nsDocument::AddImage(imgIRequest* aImage)
{ {
@ -8428,3 +8383,4 @@ nsDocument::CreateTouchList(nsIVariant* aPoints,
*aRetVal = retval.forget().get(); *aRetVal = retval.forget().get();
return NS_OK; return NS_OK;
} }

Просмотреть файл

@ -106,8 +106,6 @@
#include "nsIDOMDOMImplementation.h" #include "nsIDOMDOMImplementation.h"
#include "nsIDOMTouchEvent.h" #include "nsIDOMTouchEvent.h"
#include "TimeStamp.h"
#define XML_DECLARATION_BITS_DECLARATION_EXISTS (1 << 0) #define XML_DECLARATION_BITS_DECLARATION_EXISTS (1 << 0)
#define XML_DECLARATION_BITS_ENCODING_EXISTS (1 << 1) #define XML_DECLARATION_BITS_ENCODING_EXISTS (1 << 1)
#define XML_DECLARATION_BITS_STANDALONE_EXISTS (1 << 2) #define XML_DECLARATION_BITS_STANDALONE_EXISTS (1 << 2)
@ -129,7 +127,6 @@ class nsChildContentList;
class nsXMLEventsManager; class nsXMLEventsManager;
class nsHTMLStyleSheet; class nsHTMLStyleSheet;
class nsHTMLCSSStyleSheet; class nsHTMLCSSStyleSheet;
class nsDOMNavigationTiming;
/** /**
* Right now our identifier map entries contain information for 'name' * Right now our identifier map entries contain information for 'name'
@ -964,10 +961,6 @@ public:
virtual nsresult GetStateObject(nsIVariant** aResult); virtual nsresult GetStateObject(nsIVariant** aResult);
virtual nsDOMNavigationTiming* GetNavigationTiming() const;
virtual nsresult SetNavigationTiming(nsDOMNavigationTiming* aTiming);
protected: protected:
friend class nsNodeUtils; friend class nsNodeUtils;
@ -1102,9 +1095,6 @@ protected:
nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups; nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
// Recorded time of change to 'loading' state.
mozilla::TimeStamp mLoadingTimeStamp;
// True if the document has been detached from its content viewer. // True if the document has been detached from its content viewer.
PRPackedBool mIsGoingAway:1; PRPackedBool mIsGoingAway:1;
// True if the document is being destroyed. // True if the document is being destroyed.
@ -1163,7 +1153,6 @@ protected:
nsEventStates mDocumentState; nsEventStates mDocumentState;
nsEventStates mGotDocumentState; nsEventStates mGotDocumentState;
nsRefPtr<nsDOMNavigationTiming> mTiming;
private: private:
friend class nsUnblockOnloadEvent; friend class nsUnblockOnloadEvent;

Просмотреть файл

@ -145,7 +145,6 @@ INCLUDES += \
-I$(srcdir)/../../../../editor/libeditor/base \ -I$(srcdir)/../../../../editor/libeditor/base \
-I$(srcdir)/../../../../editor/libeditor/text \ -I$(srcdir)/../../../../editor/libeditor/text \
-I$(srcdir) \ -I$(srcdir) \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
DEFINES += -D_IMPL_NS_LAYOUT DEFINES += -D_IMPL_NS_LAYOUT

Просмотреть файл

@ -77,7 +77,6 @@ INCLUDES += \
-I$(srcdir)/../../../../dom/base \ -I$(srcdir)/../../../../dom/base \
-I$(srcdir)/../../../../xpcom/io \ -I$(srcdir)/../../../../xpcom/io \
-I$(srcdir)/../../../../caps/include \ -I$(srcdir)/../../../../caps/include \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
DEFINES += -D_IMPL_NS_LAYOUT DEFINES += -D_IMPL_NS_LAYOUT

Просмотреть файл

@ -63,7 +63,6 @@ INCLUDES += \
-I$(srcdir)/../../../../layout/style \ -I$(srcdir)/../../../../layout/style \
-I$(srcdir)/../../../base/src \ -I$(srcdir)/../../../base/src \
-I$(srcdir)/../../../events/src \ -I$(srcdir)/../../../events/src \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
DEFINES += -D_IMPL_NS_LAYOUT DEFINES += -D_IMPL_NS_LAYOUT

Просмотреть файл

@ -88,7 +88,6 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../events/src \ -I$(srcdir)/../../events/src \
-I$(srcdir)/../../../layout/style \ -I$(srcdir)/../../../layout/style \
-I$(srcdir)/../../../dom/base \ -I$(srcdir)/../../../dom/base \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
DEFINES += -D_IMPL_NS_LAYOUT DEFINES += -D_IMPL_NS_LAYOUT

Просмотреть файл

@ -69,7 +69,6 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../../events/src \ -I$(srcdir)/../../../events/src \
-I$(srcdir)/../../../../dom/base \ -I$(srcdir)/../../../../dom/base \
-I$(srcdir)/../../../../caps/include \ -I$(srcdir)/../../../../caps/include \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
DEFINES += -D_IMPL_NS_LAYOUT DEFINES += -D_IMPL_NS_LAYOUT

Просмотреть файл

@ -73,7 +73,6 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../../../html/content/src \ -I$(srcdir)/../../../html/content/src \
-I$(srcdir)/../../../events/src \ -I$(srcdir)/../../../events/src \
-I$(srcdir)/../../../xbl/src \ -I$(srcdir)/../../../xbl/src \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
DEFINES += -D_IMPL_NS_LAYOUT DEFINES += -D_IMPL_NS_LAYOUT

Просмотреть файл

@ -75,7 +75,6 @@ LOCAL_INCLUDES = -I$(srcdir)/../../../base/src \
-I$(srcdir)/../../../xml/document/src \ -I$(srcdir)/../../../xml/document/src \
-I$(srcdir)/../../../xbl/src \ -I$(srcdir)/../../../xbl/src \
-I$(srcdir)/../../../events/src \ -I$(srcdir)/../../../events/src \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
DEFINES += -D_IMPL_NS_LAYOUT DEFINES += -D_IMPL_NS_LAYOUT

Просмотреть файл

@ -118,8 +118,6 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \ LOCAL_INCLUDES += \
-I$(srcdir)/../shistory/src \ -I$(srcdir)/../shistory/src \
-I$(topsrcdir)/dom/base \
-I$(topsrcdir)/layout/base \ -I$(topsrcdir)/layout/base \
-I$(topsrcdir)/js/src/xpconnect/src \ -I$(topsrcdir)/js/src/xpconnect/src \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)

Просмотреть файл

@ -235,8 +235,6 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
#include "nsXULAppAPI.h" #include "nsXULAppAPI.h"
#include "nsDOMNavigationTiming.h"
using namespace mozilla; using namespace mozilla;
// Number of documents currently loading // Number of documents currently loading
@ -676,45 +674,6 @@ DispatchPings(nsIContent *content, nsIURI *referrer)
ForEachPing(content, SendPing, &info); ForEachPing(content, SendPing, &info);
} }
static nsDOMPerformanceNavigationType
ConvertLoadTypeToNavigationType(PRUint32 aLoadType)
{
nsDOMPerformanceNavigationType result = nsIDOMPerformanceNavigation::TYPE_RESERVED;
switch (aLoadType) {
case LOAD_NORMAL:
case LOAD_NORMAL_EXTERNAL:
case LOAD_NORMAL_BYPASS_CACHE:
case LOAD_NORMAL_BYPASS_PROXY:
case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE:
case LOAD_LINK:
result = nsIDOMPerformanceNavigation::TYPE_NAVIGATE;
break;
case LOAD_HISTORY:
result = nsIDOMPerformanceNavigation::TYPE_BACK_FORWARD;
break;
case LOAD_RELOAD_NORMAL:
case LOAD_RELOAD_CHARSET_CHANGE:
case LOAD_RELOAD_BYPASS_CACHE:
case LOAD_RELOAD_BYPASS_PROXY:
case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
result = nsIDOMPerformanceNavigation::TYPE_RELOAD;
break;
case LOAD_NORMAL_REPLACE:
case LOAD_STOP_CONTENT:
case LOAD_STOP_CONTENT_AND_REPLACE:
case LOAD_REFRESH:
case LOAD_BYPASS_HISTORY:
case LOAD_ERROR_PAGE:
case LOAD_PUSHSTATE:
result = nsIDOMPerformanceNavigation::TYPE_RESERVED;
break;
default:
NS_NOTREACHED("Unexpected load type value");
}
return result;
}
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry); static nsISHEntry* GetRootSHEntry(nsISHEntry *entry);
//***************************************************************************** //*****************************************************************************
@ -1561,16 +1520,8 @@ nsDocShell::FirePageHideNotification(PRBool aIsUnload)
nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer); nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer);
mFiredUnloadEvent = PR_TRUE; mFiredUnloadEvent = PR_TRUE;
if (mTiming) {
mTiming->NotifyUnloadEventStart();
}
mContentViewer->PageHide(aIsUnload); mContentViewer->PageHide(aIsUnload);
if (mTiming) {
mTiming->NotifyUnloadEventEnd();
}
nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids; nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids;
PRInt32 i, n = mChildList.Count(); PRInt32 i, n = mChildList.Count();
kids.SetCapacity(n); kids.SetCapacity(n);
@ -1592,23 +1543,6 @@ nsDocShell::FirePageHideNotification(PRBool aIsUnload)
return NS_OK; return NS_OK;
} }
nsresult
nsDocShell::MaybeInitTiming()
{
if (mTiming) {
return NS_OK;
}
PRBool enabled;
nsresult rv = mPrefs->GetBoolPref("dom.enable_performance", &enabled);
if (NS_SUCCEEDED(rv) && enabled) {
mTiming = new nsDOMNavigationTiming();
mTiming->NotifyNavigationStart();
}
return NS_OK;
}
// //
// Bug 13871: Prevent frameset spoofing // Bug 13871: Prevent frameset spoofing
// //
@ -5890,22 +5824,15 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
nsresult rv; nsresult rv;
if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) { if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) {
// Save timing statistics.
nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
// Make sure timing is created
rv = MaybeInitTiming();
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
if (mTiming) {
mTiming->NotifyFetchStart(uri, ConvertLoadTypeToNavigationType(mLoadType));
}
nsCOMPtr<nsIWyciwygChannel> wcwgChannel(do_QueryInterface(aRequest)); nsCOMPtr<nsIWyciwygChannel> wcwgChannel(do_QueryInterface(aRequest));
nsCOMPtr<nsIWebProgress> webProgress = nsCOMPtr<nsIWebProgress> webProgress =
do_QueryInterface(GetAsSupports(this)); do_QueryInterface(GetAsSupports(this));
// Was the wyciwyg document loaded on this docshell? // Was the wyciwyg document loaded on this docshell?
if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) { if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) {
nsCOMPtr<nsIURI> uri;
wcwgChannel->GetURI(getter_AddRefs(uri));
PRBool equalUri = PR_TRUE; PRBool equalUri = PR_TRUE;
// Store the wyciwyg url in session history, only if it is // Store the wyciwyg url in session history, only if it is
// being loaded fresh for the first time. We don't want // being loaded fresh for the first time. We don't want
@ -6028,13 +5955,6 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel,
if (!oldURI || !newURI) { if (!oldURI || !newURI) {
return; return;
} }
// On session restore we get a redirect from page to itself. Don't count it.
PRBool equals = PR_FALSE;
if (mTiming &&
!(mLoadType == LOAD_HISTORY &&
NS_SUCCEEDED(newURI->Equals(oldURI, &equals)) && equals)) {
mTiming->NotifyRedirect(oldURI, newURI);
}
// Below a URI visit is saved (see AddURIVisit method doc). // Below a URI visit is saved (see AddURIVisit method doc).
// The visit chain looks something like: // The visit chain looks something like:
@ -6118,10 +6038,7 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress,
nsCOMPtr<nsIURI> url; nsCOMPtr<nsIURI> url;
nsresult rv = aChannel->GetURI(getter_AddRefs(url)); nsresult rv = aChannel->GetURI(getter_AddRefs(url));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
// Timing is picked up by the window, we don't need it anymore
mTiming = nsnull;
// clean up reload state for meta charset // clean up reload state for meta charset
if (eCharsetReloadRequested == mCharsetReloadState) if (eCharsetReloadRequested == mCharsetReloadState)
mCharsetReloadState = eCharsetReloadStopOrigional; mCharsetReloadState = eCharsetReloadStopOrigional;
@ -6550,13 +6467,6 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
// with about:blank. And also ensure we fire the unload events // with about:blank. And also ensure we fire the unload events
// in the current document. // in the current document.
// Make sure timing is created. Unload gets fired first for
// document loaded from the session history.
rv = MaybeInitTiming();
if (mTiming) {
mTiming->NotifyBeforeUnload();
}
PRBool okToUnload; PRBool okToUnload;
rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload); rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
@ -6568,10 +6478,6 @@ nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
mSavingOldViewer = aTryToSaveOldPresentation && mSavingOldViewer = aTryToSaveOldPresentation &&
CanSavePresentation(LOAD_NORMAL, nsnull, nsnull); CanSavePresentation(LOAD_NORMAL, nsnull, nsnull);
if (mTiming) {
mTiming->NotifyUnloadAccepted(mCurrentURI);
}
// Make sure to blow away our mLoadingURI just in case. No loads // Make sure to blow away our mLoadingURI just in case. No loads
// from inside this pagehide. // from inside this pagehide.
mLoadingURI = nsnull; mLoadingURI = nsnull;
@ -7791,12 +7697,6 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
nsIntRect bounds(x, y, cx, cy); nsIntRect bounds(x, y, cx, cy);
nsCOMPtr<nsIDocumentViewer> docviewer =
do_QueryInterface(mContentViewer);
if (docviewer) {
docviewer->SetNavigationTiming(mTiming);
}
if (NS_FAILED(mContentViewer->Init(widget, bounds))) { if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
mContentViewer = nsnull; mContentViewer = nsnull;
NS_ERROR("ContentViewer Initialization failed"); NS_ERROR("ContentViewer Initialization failed");
@ -7829,6 +7729,9 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
// Stuff the bgcolor from the old pres shell into the new // Stuff the bgcolor from the old pres shell into the new
// pres shell. This improves page load continuity. // pres shell. This improves page load continuity.
nsCOMPtr<nsIDocumentViewer> docviewer =
do_QueryInterface(mContentViewer);
if (docviewer) { if (docviewer) {
nsCOMPtr<nsIPresShell> shell; nsCOMPtr<nsIPresShell> shell;
docviewer->GetPresShell(getter_AddRefs(shell)); docviewer->GetPresShell(getter_AddRefs(shell));
@ -8555,10 +8458,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
// (bug#331040) // (bug#331040)
nsCOMPtr<nsIDocShell> kungFuDeathGrip(this); nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
rv = MaybeInitTiming();
if (mTiming) {
mTiming->NotifyBeforeUnload();
}
// Check if the page doesn't want to be unloaded. The javascript: // Check if the page doesn't want to be unloaded. The javascript:
// protocol handler deals with this for javascript: URLs. // protocol handler deals with this for javascript: URLs.
if (!bIsJavascript && mContentViewer) { if (!bIsJavascript && mContentViewer) {
@ -8572,10 +8471,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
} }
} }
if (mTiming) {
mTiming->NotifyUnloadAccepted(mCurrentURI);
}
// Check for saving the presentation here, before calling Stop(). // Check for saving the presentation here, before calling Stop().
// This is necessary so that we can catch any pending requests. // This is necessary so that we can catch any pending requests.
// Since the new request has not been created yet, we pass null for the // Since the new request has not been created yet, we pass null for the
@ -11786,6 +11681,7 @@ nsDocShell::GetPrintPreview(nsIWebBrowserPrint** aPrintPreview)
#endif #endif
} }
#ifdef DEBUG #ifdef DEBUG
unsigned long nsDocShell::gNumberOfDocShells = 0; unsigned long nsDocShell::gNumberOfDocShells = 0;
#endif #endif

Просмотреть файл

@ -119,7 +119,6 @@ class nsDocShell;
class nsIController; class nsIController;
class OnLinkClickEvent; class OnLinkClickEvent;
class nsIScrollableFrame; class nsIScrollableFrame;
class nsDOMNavigationTiming;
/* load commands were moved to nsIDocShell.h */ /* load commands were moved to nsIDocShell.h */
/* load types were moved to nsDocShellLoadTypes.h */ /* load types were moved to nsDocShellLoadTypes.h */
@ -685,8 +684,6 @@ protected:
void ClearFrameHistory(nsISHEntry* aEntry); void ClearFrameHistory(nsISHEntry* aEntry);
nsresult MaybeInitTiming();
// Event type dispatched by RestorePresentation // Event type dispatched by RestorePresentation
class RestorePresentationEvent : public nsRunnable { class RestorePresentationEvent : public nsRunnable {
public: public:
@ -840,8 +837,6 @@ protected:
static nsIURIFixup *sURIFixup; static nsIURIFixup *sURIFixup;
nsRefPtr<nsDOMNavigationTiming> mTiming;
#ifdef DEBUG #ifdef DEBUG
private: private:
// We're counting the number of |nsDocShells| to help find leaks // We're counting the number of |nsDocShells| to help find leaks

Просмотреть файл

@ -104,8 +104,6 @@ _TEST_FILES = \
test_framedhistoryframes.html \ test_framedhistoryframes.html \
test_windowedhistoryframes.html \ test_windowedhistoryframes.html \
historyframes.html \ historyframes.html \
test_bug570341.html \
bug570341_recordevents.html \
$(NULL) $(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)

Просмотреть файл

@ -1,25 +0,0 @@
<html>
<head>
<script>
var start = Date.now();
window._testing_js_start = Math.floor(start);
window._testing_js_start_fine = start;
window['_testing_js_after_' + document.readyState] = Math.floor(start);
document.addEventListener('DOMContentLoaded',
function () {
window._testing_evt_DOMContentLoaded = Math.floor(Date.now());
window._testing_evt_DOMContentLoaded_fine = Date.now();
}, true);
document.addEventListener('readystatechange', function(){
window['_testing_evt_DOM_' + document.readyState] = Math.floor(Date.now());
window['_testing_evt_DOM_' + document.readyState + '_fine'] = Date.now();
}, true);
function recordLoad() {
window._testing_evt_load = Math.floor(Date.now());
window._testing_evt_load_fine = Date.now();
}
</script>
</head>
<body onload="recordLoad()">This document collects time
for events related to the page load progress.</body>
</html>

Просмотреть файл

@ -1,149 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=570341
-->
<head>
<title>Test for Bug 570341</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script>
var start = Date.now();
var moments = {};
var unload = 0;
var wasEnabled = true;
function collectMoments() {
var win = frames[0];
var timing = (win.performance && win.performance.timing) || {};
for (var p in timing) {
moments[p] = timing[p];
}
for (var p in win) {
if (p.substring(0,9) == '_testing_') {
moments[p.substring(9)] = win[p];
}
}
moments['evt_unload'] = Math.floor(unload);
moments['evt_unload_fine'] = unload;
return moments;
}
function showSequence(node){
while(node.firstChild) {
node.removeChild(node.firstChild);
}
var sequence = [];
for (var p in moments) {
sequence.push(p);
}
sequence.sort(function(a, b){
return moments[a] - moments[b];
});
table = document.createElement('table');
node.appendChild(table);
row = document.createElement('tr');
table.appendChild(row);
cell = document.createElement('td');
row.appendChild(cell);
cell.appendChild(document.createTextNode('start'));
cell = document.createElement('td');
row.appendChild(cell);
cell.appendChild(document.createTextNode(start));
for (var i = 0; i < sequence.length; ++i) {
var prop = sequence[i];
row = document.createElement('tr');
table.appendChild(row);
cell = document.createElement('td');
row.appendChild(cell);
cell.appendChild(document.createTextNode(prop));
cell = document.createElement('td');
row.appendChild(cell);
cell.appendChild(document.createTextNode(moments[prop]));
}
}
function checkValues(){
collectMoments();
var sequences = [
['navigationStart', 'unloadEventStart', 'evt_unload' , 'unloadEventEnd'],
['navigationStart', 'fetchStart', 'domainLookupStart', 'domainLookupEnd',
'connectStart', 'connectEnd', 'requestStart', 'responseStart', 'responseEnd'],
['responseStart', 'domLoading', 'domInteractive', 'domComplete'],
['domContentLoadedEventStart', 'evt_DOMContentLoaded', 'domContentLoadedEventEnd',
'loadEventStart', 'evt_load', 'loadEventEnd']
]
for (var i = 0; i < sequences.length; ++i) {
var seq = sequences[i];
for (var j = 0; j < seq.length; ++j) {
var prop = seq[j];
if (j > 0) {
var prevProp = seq[j-1];
ok(moments[prevProp] <= moments[prop],
['Expected ', prevProp, ' to happen before ', prop,
', got ', prevProp, ' = ', moments[prevProp],
', ', prop, ' = ', moments[prop]].join(''));
}
}
}
try {
SpecialPowers.setBoolPref('dom.enable_performance', wasEnabled);
} catch (err) {
todo(false, 'Exception in SpecialPowers: ' + err + ' at ' + err.stack);
}
SimpleTest.finish()
}
window.onload = function() {
try {
wasEnabled = SpecialPowers.getBoolPref('dom.enable_performance');
} catch (err) {
todo(false, 'Exception in SpecialPowers: ' + err + ' at ' + err.stack);
}
SpecialPowers.setBoolPref('dom.enable_performance', true);
var win = frames[0];
win.addEventListener('unload', function(){
unload = Date.now();
}, true);
frames[0].location = 'bug570341_recordevents.html'
var seenLoad = 0;
win.addEventListener('load', function (){
seenLoad = Date.now();
}, true);
var interval = setInterval(function () {
var stopPolling = (win.performance && win.performance.loadEventEnd) ||
(seenLoad && Date.now() >= seenLoad + 200);
if (stopPolling) {
clearInterval(interval);
checkValues();
} else if (win._testing_evt_load) {
seenLoad = Date.now();
}
}, 100);
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=570341">Mozilla Bug 570341</a>
<div id="frames">
<iframe name="child0" src="navigation/blank.html"></iframe>
</div>
<button type="button" onclick="showSequence(document.getElementById('display'))">
Show Events</button>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -110,8 +110,6 @@ CPPSRCS = \
nsQueryContentEventResult.cpp \ nsQueryContentEventResult.cpp \
nsContentPermissionHelper.cpp \ nsContentPermissionHelper.cpp \
nsStructuredCloneContainer.cpp \ nsStructuredCloneContainer.cpp \
nsDOMNavigationTiming.cpp \
nsPerformance.cpp \
$(NULL) $(NULL)
include $(topsrcdir)/dom/dom-config.mk include $(topsrcdir)/dom/dom-config.mk
@ -128,7 +126,6 @@ include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \ LOCAL_INCLUDES += \
-I$(srcdir)/../../js/src/xpconnect/src \ -I$(srcdir)/../../js/src/xpconnect/src \
-I$(srcdir)/../../js/src/xpconnect/wrappers \ -I$(srcdir)/../../js/src/xpconnect/wrappers \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
ifdef MOZ_X11 ifdef MOZ_X11

Просмотреть файл

@ -121,9 +121,6 @@
#include "nsIDOMMediaList.h" #include "nsIDOMMediaList.h"
#include "nsIDOMChromeWindow.h" #include "nsIDOMChromeWindow.h"
#include "nsIDOMConstructor.h" #include "nsIDOMConstructor.h"
#include "nsIDOMPerformanceTiming.h"
#include "nsIDOMPerformanceNavigation.h"
#include "nsIDOMPerformance.h"
#include "nsClientRect.h" #include "nsClientRect.h"
// DOM core includes // DOM core includes
@ -698,12 +695,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(History, nsHistorySH, NS_DEFINE_CLASSINFO_DATA(History, nsHistorySH,
ARRAY_SCRIPTABLE_FLAGS | ARRAY_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_PRECREATE) nsIXPCScriptable::WANT_PRECREATE)
NS_DEFINE_CLASSINFO_DATA(PerformanceTiming, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(PerformanceNavigation, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(Performance, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(Screen, nsDOMGenericSH, NS_DEFINE_CLASSINFO_DATA(Screen, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS) DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH, NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH,
@ -2406,53 +2397,26 @@ nsDOMClassInfo::Init()
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (nsGlobalWindow::HasIndexedDBSupport()) { if (nsGlobalWindow::HasIndexedDBSupport()) {
if (nsGlobalWindow::HasPerformanceSupport()) { DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)
DOM_CLASSINFO_MAP_END
} else {
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
DOM_CLASSINFO_MAP_END
}
} else { } else {
if (nsGlobalWindow::HasPerformanceSupport()) { DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal) DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)
DOM_CLASSINFO_MAP_END
} else {
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
DOM_CLASSINFO_MAP_END
}
} }
DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils) DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils)
@ -2502,21 +2466,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHistory) DOM_CLASSINFO_MAP_ENTRY(nsIDOMHistory)
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(PerformanceTiming, nsIDOMPerformanceTiming,
!nsGlobalWindow::HasPerformanceSupport())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformanceTiming)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(PerformanceNavigation, nsIDOMPerformanceNavigation,
!nsGlobalWindow::HasPerformanceSupport())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformanceNavigation)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(Performance, nsIDOMPerformance,
!nsGlobalWindow::HasPerformanceSupport())
DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformance)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(Screen, nsIDOMScreen) DOM_CLASSINFO_MAP_BEGIN(Screen, nsIDOMScreen)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMScreen) DOM_CLASSINFO_MAP_ENTRY(nsIDOMScreen)
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END

Просмотреть файл

@ -45,9 +45,6 @@ DOMCI_CLASS(MimeType)
DOMCI_CLASS(MimeTypeArray) DOMCI_CLASS(MimeTypeArray)
DOMCI_CLASS(BarProp) DOMCI_CLASS(BarProp)
DOMCI_CLASS(History) DOMCI_CLASS(History)
DOMCI_CLASS(PerformanceTiming)
DOMCI_CLASS(PerformanceNavigation)
DOMCI_CLASS(Performance)
DOMCI_CLASS(Screen) DOMCI_CLASS(Screen)
DOMCI_CLASS(DOMPrototype) DOMCI_CLASS(DOMPrototype)
DOMCI_CLASS(DOMConstructor) DOMCI_CLASS(DOMConstructor)

Просмотреть файл

@ -1,420 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is implementation of Web Timing draft specification
* http://dev.w3.org/2006/webapi/WebTiming/
*
* The Initial Developer of the Original Code is Google Inc.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sergey Novikov <sergeyn@google.com> (original author)
* Igor Bazarny <igor.bazarny@gmail.com> (lots of improvements)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsDOMNavigationTiming.h"
#include "nsCOMPtr.h"
#include "nscore.h"
#include "TimeStamp.h"
#include "nsContentUtils.h"
#include "nsIDOMEventTarget.h"
#include "nsIDocument.h"
#include "nsIScriptSecurityManager.h"
nsDOMNavigationTiming::nsDOMNavigationTiming()
{
Clear();
}
nsDOMNavigationTiming::~nsDOMNavigationTiming()
{
}
void
nsDOMNavigationTiming::Clear()
{
mNavigationType = nsIDOMPerformanceNavigation::TYPE_RESERVED;
mNavigationStart = 0;
mFetchStart = 0;
mRedirectStart = 0;
mRedirectEnd = 0;
mBeforeUnloadStart = 0;
mUnloadStart = 0;
mUnloadEnd = 0;
mLoadEventStart = 0;
mLoadEventEnd = 0;
mDOMLoading = 0;
mDOMInteractive = 0;
mDOMContentLoadedEventStart = 0;
mDOMContentLoadedEventEnd = 0;
mDOMComplete = 0;
mRedirectCheck = NOT_CHECKED;
}
DOMTimeMilliSec nsDOMNavigationTiming::DurationFromStart(){
mozilla::TimeDuration duration = mozilla::TimeStamp::Now() - mNavigationStartTimeStamp;
return mNavigationStart + (int)(duration.ToMilliseconds() + 0.5);
}
void
nsDOMNavigationTiming::NotifyNavigationStart()
{
mNavigationStart = PR_Now() / PR_USEC_PER_MSEC;
mNavigationStartTimeStamp = mozilla::TimeStamp::Now();
}
void
nsDOMNavigationTiming::NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType)
{
mFetchStart = DurationFromStart();
mNavigationType = aNavigationType;
// At the unload event time we don't really know the loading uri.
// Need it for later check for unload timing access.
mLoadedURI = aURI;
}
void
nsDOMNavigationTiming::NotifyRedirect(nsIURI* aOldURI, nsIURI* aNewURI)
{
if (mRedirects.Count() == 0) {
mRedirectStart = mFetchStart;
}
mFetchStart = DurationFromStart();
mRedirectEnd = mFetchStart;
// At the unload event time we don't really know the loading uri.
// Need it for later check for unload timing access.
mLoadedURI = aNewURI;
mRedirects.AppendObject(aOldURI);
}
void
nsDOMNavigationTiming::NotifyBeforeUnload()
{
mBeforeUnloadStart = DurationFromStart();
}
void
nsDOMNavigationTiming::NotifyUnloadAccepted(nsIURI* aOldURI)
{
mUnloadStart = mBeforeUnloadStart;
mUnloadedURI = aOldURI;
}
void
nsDOMNavigationTiming::NotifyUnloadEventStart()
{
mUnloadStart = DurationFromStart();
}
void
nsDOMNavigationTiming::NotifyUnloadEventEnd()
{
mUnloadEnd = DurationFromStart();
}
void
nsDOMNavigationTiming::NotifyLoadEventStart()
{
mLoadEventStart = DurationFromStart();
}
void
nsDOMNavigationTiming::NotifyLoadEventEnd()
{
mLoadEventEnd = DurationFromStart();
}
PRBool
nsDOMNavigationTiming::ReportRedirects()
{
if (mRedirectCheck == NOT_CHECKED) {
if (mRedirects.Count() == 0) {
mRedirectCheck = NO_REDIRECTS;
} else {
mRedirectCheck = CHECK_PASSED;
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
for (int i = mRedirects.Count() - 1; i >= 0; --i) {
nsIURI * curr = mRedirects[i];
nsresult rv = ssm->CheckSameOriginURI(curr, mLoadedURI, PR_FALSE);
if (!NS_SUCCEEDED(rv)) {
mRedirectCheck = CHECK_FAILED;
break;
}
}
// All we need to know is in mRedirectCheck now. Clear history.
mRedirects.Clear();
}
}
return mRedirectCheck == CHECK_PASSED;
}
void
nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI, mozilla::TimeStamp aValue)
{
mLoadedURI = aURI;
mozilla::TimeDuration duration = aValue - mNavigationStartTimeStamp;
mDOMLoading = mNavigationStart + (int)(duration.ToMilliseconds() + 0.5);
}
void
nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI)
{
mLoadedURI = aURI;
mDOMLoading = DurationFromStart();
}
void
nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI)
{
mLoadedURI = aURI;
mDOMInteractive = DurationFromStart();
}
void
nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI)
{
mLoadedURI = aURI;
mDOMComplete = DurationFromStart();
}
void
nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI)
{
mLoadedURI = aURI;
mDOMContentLoadedEventStart = DurationFromStart();
}
void
nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI)
{
mLoadedURI = aURI;
mDOMContentLoadedEventEnd = DurationFromStart();
}
NS_IMPL_ADDREF(nsDOMNavigationTiming)
NS_IMPL_RELEASE(nsDOMNavigationTiming)
// QueryInterface implementation for nsDOMNavigationTiming
NS_INTERFACE_MAP_BEGIN(nsDOMNavigationTiming)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceTiming)
NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceTiming)
NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceNavigation)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
nsDOMNavigationTiming::GetType(
nsDOMPerformanceNavigationType* aNavigationType)
{
*aNavigationType = mNavigationType;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetRedirectCount(PRUint16* aRedirectCount)
{
*aRedirectCount = 0;
if (ReportRedirects()) {
*aRedirectCount = mRedirects.Count();
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetRedirectStart(DOMTimeMilliSec* aRedirectStart)
{
*aRedirectStart = 0;
if (ReportRedirects()) {
*aRedirectStart = mRedirectStart;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetRedirectEnd(DOMTimeMilliSec* aEnd)
{
*aEnd = 0;
if (ReportRedirects()) {
*aEnd = mRedirectEnd;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetNavigationStart(DOMTimeMilliSec* aNavigationStart)
{
*aNavigationStart = mNavigationStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetUnloadEventStart(DOMTimeMilliSec* aStart)
{
*aStart = 0;
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
*aStart = mUnloadStart;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetUnloadEventEnd(DOMTimeMilliSec* aEnd)
{
*aEnd = 0;
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
*aEnd = mUnloadEnd;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetFetchStart(DOMTimeMilliSec* aStart)
{
*aStart = mFetchStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetDomainLookupStart(DOMTimeMilliSec* aStart)
{
// TODO: Implement me! (bug 659126)
*aStart = mFetchStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetDomainLookupEnd(DOMTimeMilliSec* aEnd)
{
// TODO: Implement me! (bug 659126)
*aEnd = mFetchStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetConnectStart(DOMTimeMilliSec* aStart)
{
// TODO: Implement me! (bug 659126)
*aStart = mFetchStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetConnectEnd(DOMTimeMilliSec* aEnd)
{
// TODO: Implement me! (bug 659126)
*aEnd = mFetchStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetHandshakeStart(DOMTimeMilliSec* aStart)
{
// TODO: Implement me! (bug 659126)
*aStart = mFetchStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetRequestStart(DOMTimeMilliSec* aStart)
{
// TODO: Implement me! (bug 659126)
*aStart = mFetchStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetResponseStart(DOMTimeMilliSec* aStart)
{
// TODO: Implement me! (bug 659126)
*aStart = mFetchStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetResponseEnd(DOMTimeMilliSec* aEnd)
{
// TODO: Implement me! (bug 659126)
*aEnd = mFetchStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetDomLoading(DOMTimeMilliSec* aTime)
{
*aTime = mDOMLoading;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetDomInteractive(DOMTimeMilliSec* aTime)
{
*aTime = mDOMInteractive;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetDomContentLoadedEventStart(DOMTimeMilliSec* aStart)
{
*aStart = mDOMContentLoadedEventStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetDomContentLoadedEventEnd(DOMTimeMilliSec* aEnd)
{
*aEnd = mDOMContentLoadedEventEnd;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetDomComplete(DOMTimeMilliSec* aTime)
{
*aTime = mDOMComplete;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetLoadEventStart(DOMTimeMilliSec* aStart)
{
*aStart = mLoadEventStart;
return NS_OK;
}
NS_IMETHODIMP
nsDOMNavigationTiming::GetLoadEventEnd(DOMTimeMilliSec* aEnd)
{
*aEnd = mLoadEventEnd;
return NS_OK;
}

Просмотреть файл

@ -1,121 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is implementation of Web Timing draft specification
* http://dev.w3.org/2006/webapi/WebTiming/
*
* The Initial Developer of the Original Code is Google Inc.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sergey Novikov <sergeyn@google.com> (original author)
* Igor Bazarny <igor.bazarny@gmail.com> (lots of improvements)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsDOMNavigationTiming_h___
#define nsDOMNavigationTiming_h___
#include "nsIDOMPerformanceTiming.h"
#include "nsIDOMPerformanceNavigation.h"
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "TimeStamp.h"
class nsDOMNavigationTimingClock;
class nsIURI;
class nsIDocument;
class nsDOMNavigationTiming : public nsIDOMPerformanceTiming,
public nsIDOMPerformanceNavigation
{
public:
nsDOMNavigationTiming();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMPERFORMANCETIMING
NS_DECL_NSIDOMPERFORMANCENAVIGATION
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);
private:
nsDOMNavigationTiming(const nsDOMNavigationTiming &){};
~nsDOMNavigationTiming();
void Clear();
PRBool ReportRedirects();
nsCOMPtr<nsIURI> mUnloadedURI;
nsCOMPtr<nsIURI> mLoadedURI;
nsCOMArray<nsIURI> mRedirects;
typedef enum { NOT_CHECKED,
CHECK_PASSED,
NO_REDIRECTS,
CHECK_FAILED} RedirectCheckState;
RedirectCheckState mRedirectCheck;
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___ */

Просмотреть файл

@ -52,8 +52,6 @@
#include "nsGlobalWindow.h" #include "nsGlobalWindow.h"
#include "nsScreen.h" #include "nsScreen.h"
#include "nsHistory.h" #include "nsHistory.h"
#include "nsPerformance.h"
#include "nsDOMNavigationTiming.h"
#include "nsBarProps.h" #include "nsBarProps.h"
#include "nsDOMStorage.h" #include "nsDOMStorage.h"
#include "nsDOMOfflineResourceList.h" #include "nsDOMOfflineResourceList.h"
@ -1119,7 +1117,6 @@ nsGlobalWindow::CleanUp(PRBool aIgnoreModalDialog)
mIndexedDB = nsnull; mIndexedDB = nsnull;
mPendingStorageEventsObsolete = nsnull; mPendingStorageEventsObsolete = nsnull;
mPerformance = nsnull;
ClearControllers(); ClearControllers();
@ -1344,7 +1341,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH) NS_INTERFACE_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowPerformance)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window)
OUTER_WINDOW_ONLY OUTER_WINDOW_ONLY
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
@ -2724,6 +2720,7 @@ nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
// be a pres context available). Since we're not firing a GUI // be a pres context available). Since we're not firing a GUI
// event we don't need a pres context anyway so we just pass // event we don't need a pres context anyway so we just pass
// null as the pres context all the time here. // null as the pres context all the time here.
nsEventDispatcher::Dispatch(content, nsnull, &event, nsnull, &status); nsEventDispatcher::Dispatch(content, nsnull, &event, nsnull, &status);
} }
} }
@ -2953,25 +2950,6 @@ nsGlobalWindow::GetHistory(nsIDOMHistory** aHistory)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsGlobalWindow::GetPerformance(nsIDOMPerformance** aPerformance)
{
FORWARD_TO_INNER(GetPerformance, (aPerformance), NS_ERROR_NOT_INITIALIZED);
*aPerformance = nsnull;
if (nsGlobalWindow::HasPerformanceSupport()) {
if (!mPerformance) {
nsRefPtr<nsDOMNavigationTiming> timing = mDoc->GetNavigationTiming();
if (timing) {
mPerformance = new nsPerformance(timing);
}
}
NS_IF_ADDREF(*aPerformance = mPerformance);
}
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsGlobalWindow::GetParent(nsIDOMWindow** aParent) nsGlobalWindow::GetParent(nsIDOMWindow** aParent)
{ {

Просмотреть файл

@ -138,7 +138,6 @@ class nsLocation;
class nsNavigator; class nsNavigator;
class nsScreen; class nsScreen;
class nsHistory; class nsHistory;
class nsPerformance;
class nsIDocShellLoadInfo; class nsIDocShellLoadInfo;
class WindowStateHolder; class WindowStateHolder;
class nsGlobalWindowObserver; class nsGlobalWindowObserver;
@ -286,8 +285,7 @@ class nsGlobalWindow : public nsPIDOMWindow,
public nsIInterfaceRequestor, public nsIInterfaceRequestor,
public nsIDOMWindow_2_0_BRANCH, public nsIDOMWindow_2_0_BRANCH,
public nsWrapperCache, public nsWrapperCache,
public PRCListStr, public PRCListStr
public nsIDOMWindowPerformance
{ {
public: public:
friend class nsDOMMozURLProperty; friend class nsDOMMozURLProperty;
@ -335,9 +333,6 @@ public:
// nsIDOMWindowInternal // nsIDOMWindowInternal
NS_DECL_NSIDOMWINDOWINTERNAL NS_DECL_NSIDOMWINDOWINTERNAL
// nsIDOMWindowPerformance
NS_DECL_NSIDOMWINDOWPERFORMANCE
// nsIDOMJSWindow // nsIDOMJSWindow
NS_DECL_NSIDOMJSWINDOW NS_DECL_NSIDOMJSWINDOW
@ -577,14 +572,6 @@ public:
return nsContentUtils::GetBoolPref("indexedDB.feature.enabled", PR_TRUE); return nsContentUtils::GetBoolPref("indexedDB.feature.enabled", PR_TRUE);
} }
static bool HasPerformanceSupport() {
#ifdef DEBUG
return nsContentUtils::GetBoolPref("dom.enable_performance", PR_TRUE);
#else
return nsContentUtils::GetBoolPref("dom.enable_performance", PR_FALSE);
#endif
}
private: private:
// Enable updates for the accelerometer. // Enable updates for the accelerometer.
void EnableAccelerationUpdates(); void EnableAccelerationUpdates();
@ -919,7 +906,6 @@ protected:
nsCOMPtr<nsIPrincipal> mArgumentsOrigin; nsCOMPtr<nsIPrincipal> mArgumentsOrigin;
nsRefPtr<nsNavigator> mNavigator; nsRefPtr<nsNavigator> mNavigator;
nsRefPtr<nsScreen> mScreen; nsRefPtr<nsScreen> mScreen;
nsRefPtr<nsPerformance> mPerformance;
nsRefPtr<nsDOMWindowList> mFrames; nsRefPtr<nsDOMWindowList> mFrames;
nsRefPtr<nsBarProp> mMenubar; nsRefPtr<nsBarProp> mMenubar;
nsRefPtr<nsBarProp> mToolbar; nsRefPtr<nsBarProp> mToolbar;

Просмотреть файл

@ -1,276 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is implementation of Web Timing draft specification
* http://dev.w3.org/2006/webapi/WebTiming/
*
* The Initial Developer of the Original Code is Google Inc.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sergey Novikov <sergeyn@google.com> (original author)
* Igor Bazarny <igor.bazarny@gmail.com> (update to match bearly-final spec)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsPerformance.h"
#include "nsCOMPtr.h"
#include "nscore.h"
#include "nsIDocShell.h"
#include "nsDOMClassInfo.h"
#include "nsDOMNavigationTiming.h"
DOMCI_DATA(PerformanceTiming, nsPerformanceTiming)
NS_IMPL_ADDREF(nsPerformanceTiming)
NS_IMPL_RELEASE(nsPerformanceTiming)
// QueryInterface implementation for nsPerformanceTiming
NS_INTERFACE_MAP_BEGIN(nsPerformanceTiming)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceTiming)
NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceTiming)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(PerformanceTiming)
NS_INTERFACE_MAP_END
nsPerformanceTiming::nsPerformanceTiming(nsDOMNavigationTiming* aData)
{
NS_ASSERTION(aData, "Timing data should be provided");
mData = aData;
}
nsPerformanceTiming::~nsPerformanceTiming()
{
}
NS_IMETHODIMP
nsPerformanceTiming::GetNavigationStart(DOMTimeMilliSec* aTime)
{
return mData->GetNavigationStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetUnloadEventStart(DOMTimeMilliSec* aTime)
{
return mData->GetUnloadEventStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetUnloadEventEnd(DOMTimeMilliSec* aTime)
{
return mData->GetUnloadEventEnd(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetRedirectStart(DOMTimeMilliSec* aTime)
{
return mData->GetRedirectStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetRedirectEnd(DOMTimeMilliSec* aTime)
{
return mData->GetRedirectEnd(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetFetchStart(DOMTimeMilliSec* aTime)
{
return mData->GetFetchStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetDomainLookupStart(DOMTimeMilliSec* aTime)
{
return mData->GetDomainLookupStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetDomainLookupEnd(DOMTimeMilliSec* aTime)
{
return mData->GetDomainLookupEnd(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetConnectStart(DOMTimeMilliSec* aTime)
{
return mData->GetConnectStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetConnectEnd(DOMTimeMilliSec* aTime)
{
return mData->GetConnectEnd(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetHandshakeStart(DOMTimeMilliSec* aTime)
{
return mData->GetHandshakeStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetRequestStart(DOMTimeMilliSec* aTime)
{
return mData->GetRequestStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetResponseStart(DOMTimeMilliSec* aTime)
{
return mData->GetResponseStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetResponseEnd(DOMTimeMilliSec* aTime)
{
return mData->GetResponseEnd(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetDomLoading(DOMTimeMilliSec* aTime)
{
return mData->GetDomLoading(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetDomInteractive(DOMTimeMilliSec* aTime)
{
return mData->GetDomInteractive(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetDomContentLoadedEventStart(DOMTimeMilliSec* aTime)
{
return mData->GetDomContentLoadedEventStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetDomContentLoadedEventEnd(DOMTimeMilliSec* aTime)
{
return mData->GetDomContentLoadedEventEnd(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetDomComplete(DOMTimeMilliSec* aTime)
{
return mData->GetDomComplete(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetLoadEventStart(DOMTimeMilliSec* aTime)
{
return mData->GetLoadEventStart(aTime);
}
NS_IMETHODIMP
nsPerformanceTiming::GetLoadEventEnd(DOMTimeMilliSec* aTime)
{
return mData->GetLoadEventEnd(aTime);
}
DOMCI_DATA(PerformanceNavigation, nsPerformanceNavigation)
NS_IMPL_ADDREF(nsPerformanceNavigation)
NS_IMPL_RELEASE(nsPerformanceNavigation)
// QueryInterface implementation for nsPerformanceNavigation
NS_INTERFACE_MAP_BEGIN(nsPerformanceNavigation)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceNavigation)
NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceNavigation)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(PerformanceNavigation)
NS_INTERFACE_MAP_END
nsPerformanceNavigation::nsPerformanceNavigation(nsDOMNavigationTiming* aData)
{
NS_ASSERTION(aData, "Timing data should be provided");
mData = aData;
}
nsPerformanceNavigation::~nsPerformanceNavigation()
{
}
NS_IMETHODIMP
nsPerformanceNavigation::GetType(
nsDOMPerformanceNavigationType* aNavigationType)
{
return mData->GetType(aNavigationType);
}
NS_IMETHODIMP
nsPerformanceNavigation::GetRedirectCount(PRUint16* aRedirectCount)
{
return mData->GetRedirectCount(aRedirectCount);
}
DOMCI_DATA(Performance, nsPerformance)
NS_IMPL_ADDREF(nsPerformance)
NS_IMPL_RELEASE(nsPerformance)
nsPerformance::nsPerformance(nsDOMNavigationTiming* aTiming)
{
NS_ASSERTION(aTiming, "Timing data should be provided");
mData = aTiming;
}
nsPerformance::~nsPerformance()
{
}
// QueryInterface implementation for nsPerformance
NS_INTERFACE_MAP_BEGIN(nsPerformance)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformance)
NS_INTERFACE_MAP_ENTRY(nsIDOMPerformance)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Performance)
NS_INTERFACE_MAP_END
//
// nsIDOMPerformance methods
//
NS_IMETHODIMP
nsPerformance::GetTiming(nsIDOMPerformanceTiming** aTiming)
{
if (!mTiming) {
mTiming = new nsPerformanceTiming(mData);
}
NS_IF_ADDREF(*aTiming = mTiming);
return NS_OK;
}
NS_IMETHODIMP
nsPerformance::GetNavigation(nsIDOMPerformanceNavigation** aNavigation)
{
if (!mNavigation) {
mNavigation = new nsPerformanceNavigation(mData);
}
NS_IF_ADDREF(*aNavigation = mNavigation);
return NS_OK;
}

Просмотреть файл

@ -1,95 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is implementation of Web Timing draft specification
* http://dev.w3.org/2006/webapi/WebTiming/
*
* The Initial Developer of the Original Code is Google Inc.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sergey Novikov <sergeyn@google.com> (original author)
* Igor Bazarny <igor.bazarny@gmail.com> (update to match bearly-final spec)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsPerformance_h___
#define nsPerformance_h___
#include "nsIDOMPerformance.h"
#include "nsIDOMPerformanceTiming.h"
#include "nsIDOMPerformanceNavigation.h"
#include "nscore.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
class nsIDocument;
class nsIURI;
class nsDOMNavigationTiming;
// Script "performance.timing" object
class nsPerformanceTiming : public nsIDOMPerformanceTiming
{
public:
nsPerformanceTiming(nsDOMNavigationTiming* data);
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMPERFORMANCETIMING
private:
~nsPerformanceTiming();
nsRefPtr<nsDOMNavigationTiming> mData;
};
// Script "performance.navigation" object
class nsPerformanceNavigation : public nsIDOMPerformanceNavigation
{
public:
nsPerformanceNavigation(nsDOMNavigationTiming* data);
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMPERFORMANCENAVIGATION
private:
~nsPerformanceNavigation();
nsRefPtr<nsDOMNavigationTiming> mData;
};
// Script "performance" object
class nsPerformance : public nsIDOMPerformance
{
public:
nsPerformance(nsDOMNavigationTiming* timing);
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMPERFORMANCE
private:
~nsPerformance();
nsRefPtr<nsDOMNavigationTiming> mData;
nsCOMPtr<nsIDOMPerformanceTiming> mTiming;
nsCOMPtr<nsIDOMPerformanceNavigation> mNavigation;
};
#endif /* nsPerformance_h___ */

Просмотреть файл

@ -88,9 +88,6 @@ XPIDLSRCS = \
nsITabParent.idl \ nsITabParent.idl \
nsIDOMGlobalPropertyInitializer.idl \ nsIDOMGlobalPropertyInitializer.idl \
nsIStructuredCloneContainer.idl \ nsIStructuredCloneContainer.idl \
nsIDOMPerformance.idl \
nsIDOMPerformanceTiming.idl \
nsIDOMPerformanceNavigation.idl \
$(NULL) $(NULL)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -40,7 +40,6 @@
#include "nsISupports.idl" #include "nsISupports.idl"
typedef unsigned long long DOMTimeStamp; typedef unsigned long long DOMTimeStamp;
typedef unsigned long long DOMTimeMilliSec;
// Core // Core
interface nsIDOMAttr; interface nsIDOMAttr;

Просмотреть файл

@ -1,50 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is implementation of Web Timing draft specification
* http://dev.w3.org/2006/webapi/WebTiming/
*
* The Initial Developer of the Original Code is Google Inc.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sergey Novikov <sergeyn@google.com> (original author)
* Igor Bazarny <igor.bazarny@gmail.com> (update to match nearly-final spec)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMPerformanceTiming;
interface nsIDOMPerformanceNavigation;
[scriptable, uuid(446faf26-000b-4e66-a5fd-ae37c5ed6beb)]
interface nsIDOMPerformance : nsISupports
{
readonly attribute nsIDOMPerformanceTiming timing;
readonly attribute nsIDOMPerformanceNavigation navigation;
};

Просмотреть файл

@ -1,55 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is implementation of Web Timing draft specification
* http://dev.w3.org/2006/webapi/WebTiming/
*
* The Initial Developer of the Original Code is Google Inc.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sergey Novikov <sergeyn@google.com> (original author)
* Igor Bazarny <igor.bazarny@gmail.com> (update to match nearly-final spec)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
typedef unsigned short nsDOMPerformanceNavigationType;
[scriptable, uuid(a2132ad8-a841-4285-a140-338e8de6c2e0)]
interface nsIDOMPerformanceNavigation : nsISupports
{
const nsDOMPerformanceNavigationType TYPE_NAVIGATE = 0;
const nsDOMPerformanceNavigationType TYPE_RELOAD = 1;
const nsDOMPerformanceNavigationType TYPE_BACK_FORWARD = 2;
const nsDOMPerformanceNavigationType TYPE_RESERVED = 255;
readonly attribute nsDOMPerformanceNavigationType type;
readonly attribute unsigned short redirectCount;
};

Просмотреть файл

@ -1,67 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is implementation of Web Timing draft specification
* http://dev.w3.org/2006/webapi/WebTiming/
*
* The Initial Developer of the Original Code is Google Inc.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sergey Novikov <sergeyn@google.com> (original author)
* Igor Bazarny <igor.bazarny@gmail.com> (update to match nearly-final spec)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
[scriptable, uuid(2a630b50-61b6-41b3-996d-70be67fbbcb0)]
interface nsIDOMPerformanceTiming : nsISupports
{
readonly attribute DOMTimeMilliSec navigationStart;
readonly attribute DOMTimeMilliSec unloadEventStart;
readonly attribute DOMTimeMilliSec unloadEventEnd;
readonly attribute DOMTimeMilliSec redirectStart;
readonly attribute DOMTimeMilliSec redirectEnd;
readonly attribute DOMTimeMilliSec fetchStart;
readonly attribute DOMTimeMilliSec domainLookupStart;
readonly attribute DOMTimeMilliSec domainLookupEnd;
readonly attribute DOMTimeMilliSec connectStart;
readonly attribute DOMTimeMilliSec connectEnd;
readonly attribute DOMTimeMilliSec handshakeStart;
readonly attribute DOMTimeMilliSec requestStart;
readonly attribute DOMTimeMilliSec responseStart;
readonly attribute DOMTimeMilliSec responseEnd;
readonly attribute DOMTimeMilliSec domLoading;
readonly attribute DOMTimeMilliSec domInteractive;
readonly attribute DOMTimeMilliSec domContentLoadedEventStart;
readonly attribute DOMTimeMilliSec domContentLoadedEventEnd;
readonly attribute DOMTimeMilliSec domComplete;
readonly attribute DOMTimeMilliSec loadEventStart;
readonly attribute DOMTimeMilliSec loadEventEnd;
};

Просмотреть файл

@ -46,12 +46,11 @@
interface nsIPrompt; interface nsIPrompt;
interface nsIControllers; interface nsIControllers;
interface nsIDOMLocation; interface nsIDOMLocation;
interface nsIDOMPerformance;
interface nsIVariant; interface nsIVariant;
interface nsIAnimationFrameListener; interface nsIAnimationFrameListener;
interface nsIDOMMediaQueryList; interface nsIDOMMediaQueryList;
[scriptable, uuid(5930f197-259e-4f6b-aeca-c96a74518cc6)] [scriptable, uuid(3a7b0839-b9d6-42ff-8ba6-910aba60a966)]
interface nsIDOMWindowInternal : nsIDOMWindow2 interface nsIDOMWindowInternal : nsIDOMWindow2
{ {
readonly attribute nsIDOMWindowInternal window; readonly attribute nsIDOMWindowInternal window;
@ -257,13 +256,3 @@ interface nsIDOMWindow_2_0_BRANCH : nsISupports
{ {
readonly attribute nsIDOMMozURLProperty URL; readonly attribute nsIDOMMozURLProperty URL;
}; };
[scriptable, uuid(2146c906-57f7-486c-a1b4-8cdb57ef577f)]
interface nsIDOMWindowPerformance : nsISupports
{
/**
* A namespace to hold performance related data and statistics.
*/
readonly attribute nsIDOMPerformance performance;
};

Просмотреть файл

@ -121,7 +121,6 @@ LOCAL_INCLUDES = \
-I$(topsrcdir)/layout/style \ -I$(topsrcdir)/layout/style \
-I$(topsrcdir)/layout/base \ -I$(topsrcdir)/layout/base \
-I$(topsrcdir)/dom/base \ -I$(topsrcdir)/dom/base \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
EXTRA_DSO_LDOPTS += \ EXTRA_DSO_LDOPTS += \

Просмотреть файл

@ -165,7 +165,6 @@ LOCAL_INCLUDES += \
-I$(srcdir)/../../dom/base \ -I$(srcdir)/../../dom/base \
-I$(srcdir)/../../content/html/content/src \ -I$(srcdir)/../../content/html/content/src \
-I$(srcdir)/../../content/svg/content/src \ -I$(srcdir)/../../content/svg/content/src \
-I$(topsrcdir)/xpcom/ds \
$(NULL) $(NULL)
ifdef MOZ_MATHML ifdef MOZ_MATHML

Просмотреть файл

@ -115,7 +115,6 @@
#include "nsIClipboardHelper.h" #include "nsIClipboardHelper.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsDOMNavigationTiming.h"
#include "nsPIWindowRoot.h" #include "nsPIWindowRoot.h"
#include "nsJSEnvironment.h" #include "nsJSEnvironment.h"
#include "nsFocusManager.h" #include "nsFocusManager.h"
@ -325,11 +324,6 @@ public:
*/ */
virtual nsIView* FindContainerView(); virtual nsIView* FindContainerView();
/**
* Set collector for navigation timing data (load, unload events).
*/
virtual void SetNavigationTiming(nsDOMNavigationTiming* timing);
// nsIContentViewerEdit // nsIContentViewerEdit
NS_DECL_NSICONTENTVIEWEREDIT NS_DECL_NSICONTENTVIEWEREDIT
@ -998,14 +992,6 @@ DocumentViewerImpl::InitInternal(nsIWidget* aParentWidget,
return rv; return rv;
} }
void DocumentViewerImpl::SetNavigationTiming(nsDOMNavigationTiming* timing)
{
NS_ASSERTION(mDocument, "Must have a document to set navigation timing.");
if (mDocument) {
mDocument->SetNavigationTiming(timing);
}
}
// //
// LoadComplete(aStatus) // LoadComplete(aStatus)
// //
@ -1067,15 +1053,8 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus)
docShell->GetRestoringDocument(&restoring); docShell->GetRestoringDocument(&restoring);
if (!restoring) { if (!restoring) {
nsRefPtr<nsDOMNavigationTiming> timing(mDocument->GetNavigationTiming());
if (timing) {
timing->NotifyLoadEventStart();
}
nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull, nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull,
&status); &status);
if (timing) {
timing->NotifyLoadEventEnd();
}
#ifdef MOZ_TIMELINE #ifdef MOZ_TIMELINE
// if navigator.xul's load is complete, the main nav window is visible // if navigator.xul's load is complete, the main nav window is visible
// mark that point. // mark that point.

Просмотреть файл

@ -48,8 +48,6 @@ class nsIPresShell;
class nsIStyleSheet; class nsIStyleSheet;
class nsIView; class nsIView;
class nsDOMNavigationTiming;
#define NS_IDOCUMENT_VIEWER_IID \ #define NS_IDOCUMENT_VIEWER_IID \
{ 0x5a5c9a1d, 0x49c4, 0x4f3f, \ { 0x5a5c9a1d, 0x49c4, 0x4f3f, \
{ 0x80, 0xcd, 0x12, 0x09, 0x5b, 0x1e, 0x1f, 0x61 } } { 0x80, 0xcd, 0x12, 0x09, 0x5b, 0x1e, 0x1f, 0x61 } }
@ -71,8 +69,6 @@ public:
PRBool aForceReuseInnerWindow) = 0; PRBool aForceReuseInnerWindow) = 0;
virtual nsIView* FindContainerView() = 0; virtual nsIView* FindContainerView() = 0;
virtual void SetNavigationTiming(nsDOMNavigationTiming* timing) = 0;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewer, NS_IDOCUMENT_VIEWER_IID) NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewer, NS_IDOCUMENT_VIEWER_IID)