+

Attachment #525386: pref-out 'performance' prop, unload collecting corrected for bug #570341

View | Details | Raw Unified | Return to bug 570341
Collapse All | Expand All

(-)a/content/base/public/nsIDocument.h (+6 lines)
Line     Link Here 
 Lines 104-119   class nsIDocumentObserver; Link Here 
104
class nsBindingManager;
104
class nsBindingManager;
105
class nsIDOMNodeList;
105
class nsIDOMNodeList;
106
class mozAutoSubtreeModified;
106
class mozAutoSubtreeModified;
107
struct JSObject;
107
struct JSObject;
108
class nsFrameLoader;
108
class nsFrameLoader;
109
class nsIBoxObject;
109
class nsIBoxObject;
110
class imgIRequest;
110
class imgIRequest;
111
class nsISHEntry;
111
class nsISHEntry;
112
class nsDOMNavigationTiming;
112
113
113
namespace mozilla {
114
namespace mozilla {
114
namespace css {
115
namespace css {
115
class Loader;
116
class Loader;
116
} // namespace css
117
} // namespace css
117
118
118
namespace dom {
119
namespace dom {
119
class Link;
120
class Link;
 Lines 1511-1526   public: Link Here 
1511
  virtual nsresult AddImage(imgIRequest* aImage) = 0;
1512
  virtual nsresult AddImage(imgIRequest* aImage) = 0;
1512
  virtual nsresult RemoveImage(imgIRequest* aImage) = 0;
1513
  virtual nsresult RemoveImage(imgIRequest* aImage) = 0;
1513
1514
1514
  // Makes the images on this document locked/unlocked. By default, the locking
1515
  // Makes the images on this document locked/unlocked. By default, the locking
1515
  // state is unlocked/false.
1516
  // state is unlocked/false.
1516
  virtual nsresult SetImageLockingState(PRBool aLocked) = 0;
1517
  virtual nsresult SetImageLockingState(PRBool aLocked) = 0;
1517
1518
1518
  virtual nsresult GetMozCurrentStateObject(nsIVariant** aResult) = 0;
1519
  virtual nsresult GetMozCurrentStateObject(nsIVariant** aResult) = 0;
1520
  
1521
  virtual nsDOMNavigationTiming* GetNavigationTiming() const = 0;
1522
1523
  virtual nsresult SetNavigationTiming(nsDOMNavigationTiming* aTiming) = 0;
1524
1519
1525
1520
protected:
1526
protected:
1521
  ~nsIDocument()
1527
  ~nsIDocument()
1522
  {
1528
  {
1523
    // XXX The cleanup of mNodeInfoManager (calling DropDocumentReference and
1529
    // XXX The cleanup of mNodeInfoManager (calling DropDocumentReference and
1524
    //     releasing it) happens in the nsDocument destructor. We'd prefer to
1530
    //     releasing it) happens in the nsDocument destructor. We'd prefer to
1525
    //     do it here but nsNodeInfoManager is a concrete class that we don't
1531
    //     do it here but nsNodeInfoManager is a concrete class that we don't
1526
    //     want to expose to users of the nsIDocument API outside of Gecko.
1532
    //     want to expose to users of the nsIDocument API outside of Gecko.
(-)a/content/base/src/nsDocument.cpp (+45 lines)
Line     Link Here 
 Lines 181-196   static NS_DEFINE_CID(kDOMEventGroupCID, Link Here 
181
#include "nsEscape.h"
181
#include "nsEscape.h"
182
#ifdef MOZ_MEDIA
182
#ifdef MOZ_MEDIA
183
#include "nsHTMLMediaElement.h"
183
#include "nsHTMLMediaElement.h"
184
#endif // MOZ_MEDIA
184
#endif // MOZ_MEDIA
185
185
186
#include "mozAutoDocUpdate.h"
186
#include "mozAutoDocUpdate.h"
187
#include "nsGlobalWindow.h"
187
#include "nsGlobalWindow.h"
188
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
188
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
189
#include "nsDOMNavigationTiming.h"
189
190
190
#ifdef MOZ_SMIL
191
#ifdef MOZ_SMIL
191
#include "nsSMILAnimationController.h"
192
#include "nsSMILAnimationController.h"
192
#include "imgIContainer.h"
193
#include "imgIContainer.h"
193
#include "nsSVGUtils.h"
194
#include "nsSVGUtils.h"
194
#endif // MOZ_SMIL
195
#endif // MOZ_SMIL
195
196
196
#include "nsRefreshDriver.h"
197
#include "nsRefreshDriver.h"
 Lines 4151-4174   void Link Here 
4151
nsDocument::DispatchContentLoadedEvents()
4152
nsDocument::DispatchContentLoadedEvents()
4152
{
4153
{
4153
  NS_TIME_FUNCTION;
4154
  NS_TIME_FUNCTION;
4154
  // If you add early returns from this method, make sure you're
4155
  // If you add early returns from this method, make sure you're
4155
  // calling UnblockOnload properly.
4156
  // calling UnblockOnload properly.
4156
  
4157
  
4157
  // Unpin references to preloaded images
4158
  // Unpin references to preloaded images
4158
  mPreloadingImages.Clear();
4159
  mPreloadingImages.Clear();
4160
4161
  if (mTiming) {
4162
    mTiming->NotifyDOMContentLoadedStart(nsIDocument::GetDocumentURI());
4163
  }
4159
    
4164
    
4160
  // Fire a DOM event notifying listeners that this document has been
4165
  // Fire a DOM event notifying listeners that this document has been
4161
  // loaded (excluding images and other loads initiated by this
4166
  // loaded (excluding images and other loads initiated by this
4162
  // document).
4167
  // document).
4163
  nsContentUtils::DispatchTrustedEvent(this, static_cast<nsIDocument*>(this),
4168
  nsContentUtils::DispatchTrustedEvent(this, static_cast<nsIDocument*>(this),
4164
                                       NS_LITERAL_STRING("DOMContentLoaded"),
4169
                                       NS_LITERAL_STRING("DOMContentLoaded"),
4165
                                       PR_TRUE, PR_TRUE);
4170
                                       PR_TRUE, PR_TRUE);
4166
4171
4172
  if (mTiming) {
4173
    mTiming->NotifyDOMContentLoadedEnd(nsIDocument::GetDocumentURI());
4174
  }
4175
 
4167
  // If this document is a [i]frame, fire a DOMFrameContentLoaded
4176
  // If this document is a [i]frame, fire a DOMFrameContentLoaded
4168
  // event on all parent documents notifying that the HTML (excluding
4177
  // event on all parent documents notifying that the HTML (excluding
4169
  // other external files such as images and stylesheets) in a frame
4178
  // other external files such as images and stylesheets) in a frame
4170
  // has finished loading.
4179
  // has finished loading.
4171
4180
4172
  // target_frame is the [i]frame element that will be used as the
4181
  // target_frame is the [i]frame element that will be used as the
4173
  // target for the event. It's the [i]frame whose content is done
4182
  // target for the event. It's the [i]frame whose content is done
4174
  // loading.
4183
  // loading.
 Lines 7746-7761   nsDocument::CloneDocHelper(nsDocument* c Link Here 
7746
  clone->mBaseTarget = mBaseTarget;
7755
  clone->mBaseTarget = mBaseTarget;
7747
  return NS_OK;
7756
  return NS_OK;
7748
}
7757
}
7749
7758
7750
void
7759
void
7751
nsDocument::SetReadyStateInternal(ReadyState rs)
7760
nsDocument::SetReadyStateInternal(ReadyState rs)
7752
{
7761
{
7753
  mReadyState = rs;
7762
  mReadyState = rs;
7763
  if (mTiming) {
7764
    switch (rs) {
7765
    case READYSTATE_LOADING:
7766
      mTiming->NotifyDOMLoading(nsIDocument::GetDocumentURI());
7767
      break; 
7768
    case READYSTATE_INTERACTIVE:
7769
      mTiming->NotifyDOMInteractive(nsIDocument::GetDocumentURI()); 
7770
      break; 
7771
    case READYSTATE_COMPLETE:
7772
      mTiming->NotifyDOMComplete(nsIDocument::GetDocumentURI());
7773
      break; 
7774
    default:
7775
      NS_WARNING("Unexpected ReadyState value");    
7776
      break; 
7777
    }
7778
  }
7779
  // At the time of loading start, we don't have timing object, record time.
7780
  if (READYSTATE_LOADING == rs) {
7781
    mLoadingTime = PR_Now() / PR_USEC_PER_MSEC;
7782
  }
7754
7783
7755
  nsRefPtr<nsPLDOMEvent> plevent =
7784
  nsRefPtr<nsPLDOMEvent> plevent =
7756
    new nsPLDOMEvent(this, NS_LITERAL_STRING("readystatechange"), PR_FALSE, PR_FALSE); 
7785
    new nsPLDOMEvent(this, NS_LITERAL_STRING("readystatechange"), PR_FALSE, PR_FALSE); 
7757
  if (plevent) {
7786
  if (plevent) {
7758
    plevent->RunDOMEventWhenSafe();
7787
    plevent->RunDOMEventWhenSafe();
7759
  }
7788
  }
7760
}
7789
}
7761
7790
 Lines 8239-8254   nsDocument::GetMozCurrentStateObject(nsI Link Here 
8239
    NS_ENSURE_SUCCESS(rv, rv);
8268
    NS_ENSURE_SUCCESS(rv, rv);
8240
  }
8269
  }
8241
8270
8242
  NS_IF_ADDREF(*aState = mCurrentStateObjectCached);
8271
  NS_IF_ADDREF(*aState = mCurrentStateObjectCached);
8243
  
8272
  
8244
  return NS_OK;
8273
  return NS_OK;
8245
}
8274
}
8246
8275
8276
nsDOMNavigationTiming*
8277
nsDocument::GetNavigationTiming() const
8278
{
8279
  return mTiming;
8280
}
8281
8282
nsresult
8283
nsDocument::SetNavigationTiming(nsDOMNavigationTiming* aTiming)
8284
{
8285
  mTiming = aTiming;
8286
  if (mLoadingTime && mTiming) {
8287
    mTiming->SetDOMLoading(nsIDocument::GetDocumentURI(), mLoadingTime);
8288
  }
8289
  return NS_OK;
8290
}
8291
8247
nsresult
8292
nsresult
8248
nsDocument::AddImage(imgIRequest* aImage)
8293
nsDocument::AddImage(imgIRequest* aImage)
8249
{
8294
{
8250
  NS_ENSURE_ARG_POINTER(aImage);
8295
  NS_ENSURE_ARG_POINTER(aImage);
8251
8296
8252
  // See if the image is already in the hashtable. If it is, get the old count.
8297
  // See if the image is already in the hashtable. If it is, get the old count.
8253
  PRUint32 oldCount = 0;
8298
  PRUint32 oldCount = 0;
8254
  mImageTracker.Get(aImage, &oldCount);
8299
  mImageTracker.Get(aImage, &oldCount);
(-)a/content/base/src/nsDocument.h (+9 lines)
Line     Link Here 
 Lines 126-141   class nsIRadioVisitor; Link Here 
126
class nsIFormControl;
126
class nsIFormControl;
127
struct nsRadioGroupStruct;
127
struct nsRadioGroupStruct;
128
class nsOnloadBlocker;
128
class nsOnloadBlocker;
129
class nsUnblockOnloadEvent;
129
class nsUnblockOnloadEvent;
130
class nsChildContentList;
130
class nsChildContentList;
131
class nsXMLEventsManager;
131
class nsXMLEventsManager;
132
class nsHTMLStyleSheet;
132
class nsHTMLStyleSheet;
133
class nsHTMLCSSStyleSheet;
133
class nsHTMLCSSStyleSheet;
134
class nsDOMNavigationTiming;
134
135
135
/**
136
/**
136
 * Right now our identifier map entries contain information for 'name'
137
 * Right now our identifier map entries contain information for 'name'
137
 * and 'id' mappings of a given string. This is so that
138
 * and 'id' mappings of a given string. This is so that
138
 * nsHTMLDocument::ResolveName only has to do one hash lookup instead
139
 * nsHTMLDocument::ResolveName only has to do one hash lookup instead
139
 * of two. It's not clear whether this still matters for performance.
140
 * of two. It's not clear whether this still matters for performance.
140
 * 
141
 * 
141
 * We also store the document.all result list here. This is mainly so that
142
 * We also store the document.all result list here. This is mainly so that
 Lines 982-997   public: Link Here 
982
  virtual Element *LookupImageElement(const nsAString& aElementId);
983
  virtual Element *LookupImageElement(const nsAString& aElementId);
983
984
984
  virtual NS_HIDDEN_(nsresult) AddImage(imgIRequest* aImage);
985
  virtual NS_HIDDEN_(nsresult) AddImage(imgIRequest* aImage);
985
  virtual NS_HIDDEN_(nsresult) RemoveImage(imgIRequest* aImage);
986
  virtual NS_HIDDEN_(nsresult) RemoveImage(imgIRequest* aImage);
986
  virtual NS_HIDDEN_(nsresult) SetImageLockingState(PRBool aLocked);
987
  virtual NS_HIDDEN_(nsresult) SetImageLockingState(PRBool aLocked);
987
988
988
  virtual nsresult GetMozCurrentStateObject(nsIVariant** aResult);
989
  virtual nsresult GetMozCurrentStateObject(nsIVariant** aResult);
989
990
991
  virtual nsDOMNavigationTiming* GetNavigationTiming() const;
992
993
  virtual nsresult SetNavigationTiming(nsDOMNavigationTiming* aTiming);
994
990
protected:
995
protected:
991
  friend class nsNodeUtils;
996
  friend class nsNodeUtils;
992
997
993
  /**
998
  /**
994
   * Check that aId is not empty and log a message to the console
999
   * Check that aId is not empty and log a message to the console
995
   * service if it is.
1000
   * service if it is.
996
   * @returns PR_TRUE if aId looks correct, PR_FALSE otherwise.
1001
   * @returns PR_TRUE if aId looks correct, PR_FALSE otherwise.
997
   */
1002
   */
 Lines 1116-1131   protected: Link Here 
1116
   * 2) Removals from the DOM affect the table immediately
1121
   * 2) Removals from the DOM affect the table immediately
1117
   * 3) Additions to the DOM always update existing entries for names, and add
1122
   * 3) Additions to the DOM always update existing entries for names, and add
1118
   *    new ones for IDs.
1123
   *    new ones for IDs.
1119
   */
1124
   */
1120
  nsTHashtable<nsIdentifierMapEntry> mIdentifierMap;
1125
  nsTHashtable<nsIdentifierMapEntry> mIdentifierMap;
1121
1126
1122
  nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
1127
  nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
1123
1128
1129
  // Recorded time of change to 'loading' state.
1130
  DOMTimeMilliSec mLoadingTime;
1131
1124
  // True if the document has been detached from its content viewer.
1132
  // True if the document has been detached from its content viewer.
1125
  PRPackedBool mIsGoingAway:1;
1133
  PRPackedBool mIsGoingAway:1;
1126
  // True if the document is being destroyed.
1134
  // True if the document is being destroyed.
1127
  PRPackedBool mInDestructor:1;
1135
  PRPackedBool mInDestructor:1;
1128
1136
1129
  // True if this document has ever had an HTML or SVG <title> element
1137
  // True if this document has ever had an HTML or SVG <title> element
1130
  // bound to it
1138
  // bound to it
1131
  PRPackedBool mMayHaveTitleElement:1;
1139
  PRPackedBool mMayHaveTitleElement:1;
 Lines 1174-1189   protected: Link Here 
1174
  // any.  This can change during the lifetime of the document.
1182
  // any.  This can change during the lifetime of the document.
1175
  nsCOMPtr<nsIApplicationCache> mApplicationCache;
1183
  nsCOMPtr<nsIApplicationCache> mApplicationCache;
1176
1184
1177
  nsCOMPtr<nsIContent> mFirstBaseNodeWithHref;
1185
  nsCOMPtr<nsIContent> mFirstBaseNodeWithHref;
1178
1186
1179
  nsEventStates mDocumentState;
1187
  nsEventStates mDocumentState;
1180
  nsEventStates mGotDocumentState;
1188
  nsEventStates mGotDocumentState;
1181
1189
1190
  nsRefPtr<nsDOMNavigationTiming> mTiming;
1182
private:
1191
private:
1183
  friend class nsUnblockOnloadEvent;
1192
  friend class nsUnblockOnloadEvent;
1184
1193
1185
  void PostUnblockOnloadEvent();
1194
  void PostUnblockOnloadEvent();
1186
  void DoUnblockOnload();
1195
  void DoUnblockOnload();
1187
1196
1188
  nsresult CheckFrameOptions();
1197
  nsresult CheckFrameOptions();
1189
  nsresult InitCSP();
1198
  nsresult InitCSP();
(-)a/docshell/base/Makefile.in (+1 lines)
Line     Link Here 
 Lines 113-122   CPPSRCS = \ Link Here 
113
# we don't want the shared lib, but we want to force the creation of a
113
# we don't want the shared lib, but we want to force the creation of a
114
# static lib.
114
# static lib.
115
FORCE_STATIC_LIB = 1
115
FORCE_STATIC_LIB = 1
116
116
117
include $(topsrcdir)/config/rules.mk
117
include $(topsrcdir)/config/rules.mk
118
118
119
LOCAL_INCLUDES += \
119
LOCAL_INCLUDES += \
120
  -I$(srcdir)/../shistory/src \
120
  -I$(srcdir)/../shistory/src \
121
  -I$(topsrcdir)/dom/base \
121
  -I$(topsrcdir)/layout/base \
122
  -I$(topsrcdir)/layout/base \
122
  $(NULL)
123
  $(NULL)
(-)a/docshell/base/nsDocShell.cpp (-9 / +115 lines)
Line     Link Here 
 Lines 226-241   static NS_DEFINE_CID(kAppShellCID, NS_AP Link Here 
226
#endif
226
#endif
227
227
228
#include "nsContentErrors.h"
228
#include "nsContentErrors.h"
229
#include "nsIChannelPolicy.h"
229
#include "nsIChannelPolicy.h"
230
#include "nsIContentSecurityPolicy.h"
230
#include "nsIContentSecurityPolicy.h"
231
231
232
#include "nsXULAppAPI.h"
232
#include "nsXULAppAPI.h"
233
233
234
#include "nsDOMNavigationTiming.h"
235
234
using namespace mozilla;
236
using namespace mozilla;
235
237
236
// Number of documents currently loading
238
// Number of documents currently loading
237
static PRInt32 gNumberOfDocumentsLoading = 0;
239
static PRInt32 gNumberOfDocumentsLoading = 0;
238
240
239
// Global count of existing docshells.
241
// Global count of existing docshells.
240
static PRInt32 gDocShellCount = 0;
242
static PRInt32 gDocShellCount = 0;
241
243
 Lines 667-682   DispatchPings(nsIContent *content, nsIUR Link Here 
667
    return;
669
    return;
668
670
669
  info.numPings = 0;
671
  info.numPings = 0;
670
  info.referrer = referrer;
672
  info.referrer = referrer;
671
673
672
  ForEachPing(content, SendPing, &info);
674
  ForEachPing(content, SendPing, &info);
673
}
675
}
674
676
677
static nsDOMPerformanceNavigationType
678
ConvertLoadTypeToNavigationType(PRUint32 aLoadType)
679
{
680
    nsDOMPerformanceNavigationType result = nsIDOMPerformanceNavigation::TYPE_RESERVED;
681
    switch (aLoadType) {
682
    case LOAD_NORMAL:
683
    case LOAD_NORMAL_EXTERNAL:
684
    case LOAD_NORMAL_BYPASS_CACHE:
685
    case LOAD_NORMAL_BYPASS_PROXY:
686
    case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE:
687
    case LOAD_LINK:
688
        result = nsIDOMPerformanceNavigation::TYPE_NAVIGATE;
689
        break;
690
    case LOAD_HISTORY:
691
        result = nsIDOMPerformanceNavigation::TYPE_BACK_FORWARD;
692
        break;
693
    case LOAD_RELOAD_NORMAL:
694
    case LOAD_RELOAD_CHARSET_CHANGE:
695
    case LOAD_RELOAD_BYPASS_CACHE:
696
    case LOAD_RELOAD_BYPASS_PROXY:
697
    case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
698
        result = nsIDOMPerformanceNavigation::TYPE_RELOAD;
699
        break;
700
    case LOAD_NORMAL_REPLACE:
701
    case LOAD_STOP_CONTENT:
702
    case LOAD_STOP_CONTENT_AND_REPLACE:
703
    case LOAD_REFRESH:
704
    case LOAD_BYPASS_HISTORY:
705
    case LOAD_ERROR_PAGE:
706
    case LOAD_PUSHSTATE:
707
        result = nsIDOMPerformanceNavigation::TYPE_RESERVED;
708
        break;
709
    default:
710
        NS_NOTREACHED("Unexpected load type value");
711
    }
712
713
    return result;
714
}
715
675
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry);
716
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry);
676
717
677
//*****************************************************************************
718
//*****************************************************************************
678
//***    nsDocShell: Object Management
719
//***    nsDocShell: Object Management
679
//*****************************************************************************
720
//*****************************************************************************
680
721
681
static PRUint64 gDocshellIDCounter = 0;
722
static PRUint64 gDocshellIDCounter = 0;
682
723
 Lines 1508-1525   NS_IMETHODIMP Link Here 
1508
nsDocShell::FirePageHideNotification(PRBool aIsUnload)
1549
nsDocShell::FirePageHideNotification(PRBool aIsUnload)
1509
{
1550
{
1510
    if (mContentViewer && !mFiredUnloadEvent) {
1551
    if (mContentViewer && !mFiredUnloadEvent) {
1511
        // Keep an explicit reference since calling PageHide could release
1552
        // Keep an explicit reference since calling PageHide could release
1512
        // mContentViewer
1553
        // mContentViewer
1513
        nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer);
1554
        nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer);
1514
        mFiredUnloadEvent = PR_TRUE;
1555
        mFiredUnloadEvent = PR_TRUE;
1515
1556
1557
        if (mTiming) {
1558
            mTiming->NotifyUnloadEventStart();
1559
        }
1560
1516
        mContentViewer->PageHide(aIsUnload);
1561
        mContentViewer->PageHide(aIsUnload);
1517
1562
1563
        if (mTiming) {
1564
            mTiming->NotifyUnloadEventEnd();
1565
        }
1566
1518
        nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids;
1567
        nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids;
1519
        PRInt32 i, n = mChildList.Count();
1568
        PRInt32 i, n = mChildList.Count();
1520
        kids.SetCapacity(n);
1569
        kids.SetCapacity(n);
1521
        for (i = 0; i < n; i++) {
1570
        for (i = 0; i < n; i++) {
1522
            kids.AppendElement(do_QueryInterface(ChildAt(i)));
1571
            kids.AppendElement(do_QueryInterface(ChildAt(i)));
1523
        }
1572
        }
1524
1573
1525
        n = kids.Length();
1574
        n = kids.Length();
 Lines 1531-1546   nsDocShell::FirePageHideNotification(PRB Link Here 
1531
        // Now make sure our editor, if any, is detached before we go
1580
        // Now make sure our editor, if any, is detached before we go
1532
        // any farther.
1581
        // any farther.
1533
        DetachEditorFromWindow();
1582
        DetachEditorFromWindow();
1534
    }
1583
    }
1535
1584
1536
    return NS_OK;
1585
    return NS_OK;
1537
}
1586
}
1538
1587
1588
nsresult 
1589
nsDocShell::InitTiming() 
1590
{
1591
    if (mTiming) {
1592
        return NS_OK;
1593
    }
1594
1595
    PRBool enabled;
1596
    nsresult rv = mPrefs->GetBoolPref("dom.enable_performance", &enabled);
1597
    if (NS_SUCCEEDED(rv) && enabled) {
1598
      mTiming = new nsDOMNavigationTiming();
1599
      NS_ENSURE_TRUE(mTiming, NS_ERROR_OUT_OF_MEMORY);
1600
      mTiming->NotifyNavigationStart();
1601
    }
1602
    return NS_OK;
1603
}
1604
1605
1539
//
1606
//
1540
// Bug 13871: Prevent frameset spoofing
1607
// Bug 13871: Prevent frameset spoofing
1541
//
1608
//
1542
// This routine answers: 'Is origin's document from same domain as
1609
// This routine answers: 'Is origin's document from same domain as
1543
// target's document?'
1610
// target's document?'
1544
//
1611
//
1545
// file: uris are considered the same domain for the purpose of
1612
// file: uris are considered the same domain for the purpose of
1546
// frame navigation regardless of script accessibility (bug 420425)
1613
// frame navigation regardless of script accessibility (bug 420425)
 Lines 5812-5836   nsDocShell::OnProgressChange(nsIWebProgr Link Here 
5812
5879
5813
NS_IMETHODIMP
5880
NS_IMETHODIMP
5814
nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
5881
nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
5815
                          PRUint32 aStateFlags, nsresult aStatus)
5882
                          PRUint32 aStateFlags, nsresult aStatus)
5816
{
5883
{
5817
    nsresult rv;
5884
    nsresult rv;
5818
5885
5819
    if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) {
5886
    if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) {
5887
        // Save timing statistics.
5888
        nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
5889
        // Make sure timing is created
5890
        rv = InitTiming();
5891
        NS_ENSURE_SUCCESS(rv, rv);
5892
        nsCOMPtr<nsIURI> uri;
5893
        channel->GetURI(getter_AddRefs(uri));
5894
        if (mTiming) {
5895
          mTiming->NotifyFetchStart(uri, ConvertLoadTypeToNavigationType(mLoadType));
5896
        }
5897
5820
        nsCOMPtr<nsIWyciwygChannel>  wcwgChannel(do_QueryInterface(aRequest));
5898
        nsCOMPtr<nsIWyciwygChannel>  wcwgChannel(do_QueryInterface(aRequest));
5821
        nsCOMPtr<nsIWebProgress> webProgress =
5899
        nsCOMPtr<nsIWebProgress> webProgress =
5822
            do_QueryInterface(GetAsSupports(this));
5900
            do_QueryInterface(GetAsSupports(this));
5823
5901
5824
        // Was the wyciwyg document loaded on this docshell?
5902
        // Was the wyciwyg document loaded on this docshell?
5825
        if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) {
5903
        if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) {
5826
            nsCOMPtr<nsIURI> uri;
5827
            wcwgChannel->GetURI(getter_AddRefs(uri));
5828
        
5829
            PRBool equalUri = PR_TRUE;
5904
            PRBool equalUri = PR_TRUE;
5830
            // Store the wyciwyg url in session history, only if it is
5905
            // Store the wyciwyg url in session history, only if it is
5831
            // being loaded fresh for the first time. We don't want 
5906
            // being loaded fresh for the first time. We don't want 
5832
            // multiple entries for successive loads
5907
            // multiple entries for successive loads
5833
            if (mCurrentURI &&
5908
            if (mCurrentURI &&
5834
                NS_SUCCEEDED(uri->Equals(mCurrentURI, &equalUri)) &&
5909
                NS_SUCCEEDED(uri->Equals(mCurrentURI, &equalUri)) &&
5835
                !equalUri) {
5910
                !equalUri) {
5836
5911
 Lines 5940-5958   nsDocShell::OnRedirectStateChange(nsICha Link Here 
5940
    NS_ASSERTION(aStateFlags & STATE_REDIRECTING,
6015
    NS_ASSERTION(aStateFlags & STATE_REDIRECTING,
5941
                 "Calling OnRedirectStateChange when there is no redirect");
6016
                 "Calling OnRedirectStateChange when there is no redirect");
5942
    if (!(aStateFlags & STATE_IS_DOCUMENT))
6017
    if (!(aStateFlags & STATE_IS_DOCUMENT))
5943
        return; // not a toplevel document
6018
        return; // not a toplevel document
5944
6019
5945
    nsCOMPtr<nsIURI> oldURI, newURI;
6020
    nsCOMPtr<nsIURI> oldURI, newURI;
5946
    aOldChannel->GetURI(getter_AddRefs(oldURI));
6021
    aOldChannel->GetURI(getter_AddRefs(oldURI));
5947
    aNewChannel->GetURI(getter_AddRefs(newURI));
6022
    aNewChannel->GetURI(getter_AddRefs(newURI));
6023
5948
    if (!oldURI || !newURI) {
6024
    if (!oldURI || !newURI) {
5949
        return;
6025
        return;
5950
    }
6026
    }
6027
    // On session restore we get a redirect from page to itself. Don't count it.
6028
    PRBool equals = PR_FALSE;
6029
    if (mTiming && 
6030
        !(mLoadType == LOAD_HISTORY && 
6031
          NS_SUCCEEDED(newURI->Equals(oldURI, &equals)) && equals)) {
6032
        mTiming->NotifyRedirect(oldURI, newURI);
6033
    }
5951
6034
5952
    // Below a URI visit is saved (see AddURIVisit method doc).
6035
    // Below a URI visit is saved (see AddURIVisit method doc).
5953
    // The visit chain looks something like:
6036
    // The visit chain looks something like:
5954
    //   ...
6037
    //   ...
5955
    //   Site N - 1
6038
    //   Site N - 1
5956
    //                =>  Site N
6039
    //                =>  Site N
5957
    //   (redirect to =>) Site N + 1 (we are here!)
6040
    //   (redirect to =>) Site N + 1 (we are here!)
5958
6041
 Lines 6026-6042   nsDocShell::EndPageLoad(nsIWebProgress * Link Here 
6026
                        nsIChannel * aChannel, nsresult aStatus)
6109
                        nsIChannel * aChannel, nsresult aStatus)
6027
{
6110
{
6028
    if(!aChannel)
6111
    if(!aChannel)
6029
        return NS_ERROR_NULL_POINTER;
6112
        return NS_ERROR_NULL_POINTER;
6030
    
6113
    
6031
    nsCOMPtr<nsIURI> url;
6114
    nsCOMPtr<nsIURI> url;
6032
    nsresult rv = aChannel->GetURI(getter_AddRefs(url));
6115
    nsresult rv = aChannel->GetURI(getter_AddRefs(url));
6033
    if (NS_FAILED(rv)) return rv;
6116
    if (NS_FAILED(rv)) return rv;
6034
  
6117
6118
    // Timing is picked up by the window, we don't need it anymore
6119
    mTiming = nsnull;
6120
6035
    // clean up reload state for meta charset
6121
    // clean up reload state for meta charset
6036
    if (eCharsetReloadRequested == mCharsetReloadState)
6122
    if (eCharsetReloadRequested == mCharsetReloadState)
6037
        mCharsetReloadState = eCharsetReloadStopOrigional;
6123
        mCharsetReloadState = eCharsetReloadStopOrigional;
6038
    else 
6124
    else 
6039
        mCharsetReloadState = eCharsetReloadInit;
6125
        mCharsetReloadState = eCharsetReloadInit;
6040
6126
6041
    // Save a pointer to the currently-loading history entry.
6127
    // Save a pointer to the currently-loading history entry.
6042
    // nsDocShell::EndPageLoad will clear mLSHE, but we may need this history
6128
    // nsDocShell::EndPageLoad will clear mLSHE, but we may need this history
 Lines 6455-6481   nsDocShell::CreateAboutBlankContentViewe Link Here 
6455
  nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
6541
  nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
6456
  
6542
  
6457
  if (mContentViewer) {
6543
  if (mContentViewer) {
6458
    // We've got a content viewer already. Make sure the user
6544
    // We've got a content viewer already. Make sure the user
6459
    // permits us to discard the current document and replace it
6545
    // permits us to discard the current document and replace it
6460
    // with about:blank. And also ensure we fire the unload events
6546
    // with about:blank. And also ensure we fire the unload events
6461
    // in the current document.
6547
    // in the current document.
6462
6548
6549
    // Make sure timing is created. Unload gets fired first for 
6550
    // document loaded from the session history.
6551
    rv = InitTiming();
6552
    if (mTiming) {
6553
      mTiming->NotifyBeforeUnload();
6554
    }
6555
6463
    PRBool okToUnload;
6556
    PRBool okToUnload;
6464
    rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
6557
    rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
6465
6558
6466
    if (NS_SUCCEEDED(rv) && !okToUnload) {
6559
    if (NS_SUCCEEDED(rv) && !okToUnload) {
6467
      // The user chose not to unload the page, interrupt the load.
6560
      // The user chose not to unload the page, interrupt the load.
6468
      return NS_ERROR_FAILURE;
6561
      return NS_ERROR_FAILURE;
6469
    }
6562
    }
6470
6563
6471
    mSavingOldViewer = aTryToSaveOldPresentation && 
6564
    mSavingOldViewer = aTryToSaveOldPresentation && 
6472
                       CanSavePresentation(LOAD_NORMAL, nsnull, nsnull);
6565
                       CanSavePresentation(LOAD_NORMAL, nsnull, nsnull);
6473
6566
6567
    if (mTiming) {
6568
      mTiming->NotifyUnloadAccepted(mCurrentURI);
6569
    }
6474
    // Make sure to blow away our mLoadingURI just in case.  No loads
6570
    // Make sure to blow away our mLoadingURI just in case.  No loads
6475
    // from inside this pagehide.
6571
    // from inside this pagehide.
6476
    mLoadingURI = nsnull;
6572
    mLoadingURI = nsnull;
6477
    
6573
    
6478
    // Notify the current document that it is about to be unloaded!!
6574
    // Notify the current document that it is about to be unloaded!!
6479
    //
6575
    //
6480
    // It is important to fire the unload() notification *before* any state
6576
    // It is important to fire the unload() notification *before* any state
6481
    // is changed within the DocShell - otherwise, javascript will get the
6577
    // is changed within the DocShell - otherwise, javascript will get the
 Lines 7688-7703   nsDocShell::SetupNewViewer(nsIContentVie Link Here 
7688
7784
7689
    mContentViewer = aNewViewer;
7785
    mContentViewer = aNewViewer;
7690
7786
7691
    nsCOMPtr<nsIWidget> widget;
7787
    nsCOMPtr<nsIWidget> widget;
7692
    NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE);
7788
    NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE);
7693
7789
7694
    nsIntRect bounds(x, y, cx, cy);
7790
    nsIntRect bounds(x, y, cx, cy);
7695
7791
7792
    nsCOMPtr<nsIDocumentViewer> docviewer =
7793
        do_QueryInterface(mContentViewer);
7794
    if (docviewer) {
7795
        docviewer->SetNavigationTiming(mTiming);
7796
    }
7797
7696
    if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
7798
    if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
7697
        mContentViewer = nsnull;
7799
        mContentViewer = nsnull;
7698
        NS_ERROR("ContentViewer Initialization failed");
7800
        NS_ERROR("ContentViewer Initialization failed");
7699
        return NS_ERROR_FAILURE;
7801
        return NS_ERROR_FAILURE;
7700
    }
7802
    }
7701
7803
7702
    // If we have old state to copy, set the old state onto the new content
7804
    // If we have old state to copy, set the old state onto the new content
7703
    // viewer
7805
    // viewer
 Lines 7720-7738   nsDocShell::SetupNewViewer(nsIContentVie Link Here 
7720
        NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom),
7822
        NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom),
7721
                          NS_ERROR_FAILURE);
7823
                          NS_ERROR_FAILURE);
7722
        NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled),
7824
        NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled),
7723
                          NS_ERROR_FAILURE);
7825
                          NS_ERROR_FAILURE);
7724
    }
7826
    }
7725
7827
7726
    // Stuff the bgcolor from the old pres shell into the new
7828
    // Stuff the bgcolor from the old pres shell into the new
7727
    // pres shell. This improves page load continuity.
7829
    // pres shell. This improves page load continuity.
7728
    nsCOMPtr<nsIDocumentViewer> docviewer =
7729
        do_QueryInterface(mContentViewer);
7730
7731
    if (docviewer) {
7830
    if (docviewer) {
7732
        nsCOMPtr<nsIPresShell> shell;
7831
        nsCOMPtr<nsIPresShell> shell;
7733
        docviewer->GetPresShell(getter_AddRefs(shell));
7832
        docviewer->GetPresShell(getter_AddRefs(shell));
7734
7833
7735
        if (shell) {
7834
        if (shell) {
7736
            shell->SetCanvasBackground(bgcolor);
7835
            shell->SetCanvasBackground(bgcolor);
7737
        }
7836
        }
7738
    }
7837
    }
 Lines 8433-8462   nsDocShell::InternalLoad(nsIURI * aURI, Link Here 
8433
        }
8532
        }
8434
    }
8533
    }
8435
    
8534
    
8436
    // mContentViewer->PermitUnload can destroy |this| docShell, which
8535
    // mContentViewer->PermitUnload can destroy |this| docShell, which
8437
    // causes the next call of CanSavePresentation to crash. 
8536
    // causes the next call of CanSavePresentation to crash. 
8438
    // Hold onto |this| until we return, to prevent a crash from happening. 
8537
    // Hold onto |this| until we return, to prevent a crash from happening. 
8439
    // (bug#331040)
8538
    // (bug#331040)
8440
    nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
8539
    nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
8441
8540
    
8541
    rv = InitTiming();
8542
    if (mTiming) {
8543
      mTiming->NotifyBeforeUnload();
8544
    }
8442
    // Check if the page doesn't want to be unloaded. The javascript:
8545
    // Check if the page doesn't want to be unloaded. The javascript:
8443
    // protocol handler deals with this for javascript: URLs.
8546
    // protocol handler deals with this for javascript: URLs.
8444
    if (!bIsJavascript && mContentViewer) {
8547
    if (!bIsJavascript && mContentViewer) {
8445
        PRBool okToUnload;
8548
        PRBool okToUnload;
8446
        rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
8549
        rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
8447
8550
8448
        if (NS_SUCCEEDED(rv) && !okToUnload) {
8551
        if (NS_SUCCEEDED(rv) && !okToUnload) {
8449
            // The user chose not to unload the page, interrupt the
8552
            // The user chose not to unload the page, interrupt the
8450
            // load.
8553
            // load.
8451
            return NS_OK;
8554
            return NS_OK;
8452
        }
8555
        }
8453
    }
8556
    }
8454
8557
8558
    if (mTiming) {
8559
      mTiming->NotifyUnloadAccepted(mCurrentURI);
8560
    }
8561
8455
    // Check for saving the presentation here, before calling Stop().
8562
    // Check for saving the presentation here, before calling Stop().
8456
    // This is necessary so that we can catch any pending requests.
8563
    // This is necessary so that we can catch any pending requests.
8457
    // Since the new request has not been created yet, we pass null for the
8564
    // Since the new request has not been created yet, we pass null for the
8458
    // new request parameter.
8565
    // new request parameter.
8459
    // Also pass nsnull for the document, since it doesn't affect the return
8566
    // Also pass nsnull for the document, since it doesn't affect the return
8460
    // value for our purposes here.
8567
    // value for our purposes here.
8461
    PRBool savePresentation = CanSavePresentation(aLoadType, nsnull, nsnull);
8568
    PRBool savePresentation = CanSavePresentation(aLoadType, nsnull, nsnull);
8462
8569
 Lines 11734-11750   nsDocShell::GetPrintPreview(nsIWebBrowse Link Here 
11734
  nsCOMPtr<nsIWebBrowserPrint> result = do_QueryInterface(print);
11841
  nsCOMPtr<nsIWebBrowserPrint> result = do_QueryInterface(print);
11735
  result.forget(aPrintPreview);
11842
  result.forget(aPrintPreview);
11736
  return NS_OK;
11843
  return NS_OK;
11737
#else
11844
#else
11738
  return NS_ERROR_NOT_IMPLEMENTED;
11845
  return NS_ERROR_NOT_IMPLEMENTED;
11739
#endif
11846
#endif
11740
}
11847
}
11741
11848
11742
11743
#ifdef DEBUG
11849
#ifdef DEBUG
11744
unsigned long nsDocShell::gNumberOfDocShells = 0;
11850
unsigned long nsDocShell::gNumberOfDocShells = 0;
11745
#endif
11851
#endif
11746
11852
11747
NS_IMETHODIMP
11853
NS_IMETHODIMP
11748
nsDocShell::GetCanExecuteScripts(PRBool *aResult)
11854
nsDocShell::GetCanExecuteScripts(PRBool *aResult)
11749
{
11855
{
11750
  NS_ENSURE_ARG_POINTER(aResult);
11856
  NS_ENSURE_ARG_POINTER(aResult);
(-)a/docshell/base/nsDocShell.h (+5 lines)
Line     Link Here 
 Lines 115-130    Link Here 
115
#include "nsIClipboardCommands.h"
115
#include "nsIClipboardCommands.h"
116
#include "nsICommandManager.h"
116
#include "nsICommandManager.h"
117
#include "nsCRT.h"
117
#include "nsCRT.h"
118
118
119
class nsDocShell;
119
class nsDocShell;
120
class nsIController;
120
class nsIController;
121
class OnLinkClickEvent;
121
class OnLinkClickEvent;
122
class nsIScrollableFrame;
122
class nsIScrollableFrame;
123
class nsDOMNavigationTiming;
123
124
124
/* load commands were moved to nsIDocShell.h */
125
/* load commands were moved to nsIDocShell.h */
125
/* load types were moved to nsDocShellLoadTypes.h */
126
/* load types were moved to nsDocShellLoadTypes.h */
126
127
127
/* internally used ViewMode types */
128
/* internally used ViewMode types */
128
enum ViewMode {
129
enum ViewMode {
129
    viewNormal = 0x0,
130
    viewNormal = 0x0,
130
    viewSource = 0x1
131
    viewSource = 0x1
 Lines 680-695   protected: Link Here 
680
681
681
    nsIChannel* GetCurrentDocChannel();
682
    nsIChannel* GetCurrentDocChannel();
682
protected:
683
protected:
683
    // Override the parent setter from nsDocLoader
684
    // Override the parent setter from nsDocLoader
684
    virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader);
685
    virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader);
685
686
686
    void ClearFrameHistory(nsISHEntry* aEntry);
687
    void ClearFrameHistory(nsISHEntry* aEntry);
687
688
689
    nsresult InitTiming();
690
688
    // Event type dispatched by RestorePresentation
691
    // Event type dispatched by RestorePresentation
689
    class RestorePresentationEvent : public nsRunnable {
692
    class RestorePresentationEvent : public nsRunnable {
690
    public:
693
    public:
691
        NS_DECL_NSIRUNNABLE
694
        NS_DECL_NSIRUNNABLE
692
        RestorePresentationEvent(nsDocShell *ds) : mDocShell(ds) {}
695
        RestorePresentationEvent(nsDocShell *ds) : mDocShell(ds) {}
693
        void Revoke() { mDocShell = nsnull; }
696
        void Revoke() { mDocShell = nsnull; }
694
    private:
697
    private:
695
        nsRefPtr<nsDocShell> mDocShell;
698
        nsRefPtr<nsDocShell> mDocShell;
 Lines 833-848   protected: Link Here 
833
    PRPackedBool               mDynamicallyCreated;
836
    PRPackedBool               mDynamicallyCreated;
834
#ifdef DEBUG
837
#ifdef DEBUG
835
    PRPackedBool               mInEnsureScriptEnv;
838
    PRPackedBool               mInEnsureScriptEnv;
836
#endif
839
#endif
837
    PRUint64                   mHistoryID;
840
    PRUint64                   mHistoryID;
838
841
839
    static nsIURIFixup *sURIFixup;
842
    static nsIURIFixup *sURIFixup;
840
843
844
    nsRefPtr<nsDOMNavigationTiming> mTiming;
845
841
#ifdef DEBUG
846
#ifdef DEBUG
842
private:
847
private:
843
    // We're counting the number of |nsDocShells| to help find leaks
848
    // We're counting the number of |nsDocShells| to help find leaks
844
    static unsigned long gNumberOfDocShells;
849
    static unsigned long gNumberOfDocShells;
845
#endif /* DEBUG */
850
#endif /* DEBUG */
846
851
847
public:
852
public:
848
    class InterfaceRequestorProxy : public nsIInterfaceRequestor {
853
    class InterfaceRequestorProxy : public nsIInterfaceRequestor {
(-)a/docshell/test/Makefile.in (+2 lines)
Line     Link Here 
 Lines 95-110   _TEST_FILES = \ Link Here 
95
		file_bug590573_2.html \
95
		file_bug590573_2.html \
96
		test_bug598895.html \
96
		test_bug598895.html \
97
		test_bug634834.html \
97
		test_bug634834.html \
98
		file_bug634834.html \
98
		file_bug634834.html \
99
		test_bug637644.html \
99
		test_bug637644.html \
100
		test_framedhistoryframes.html \
100
		test_framedhistoryframes.html \
101
		test_windowedhistoryframes.html \
101
		test_windowedhistoryframes.html \
102
		historyframes.html \
102
		historyframes.html \
103
		test_bug570341.html \
104
		bug570341_recordevents.html \
103
		$(NULL)
105
		$(NULL)
104
106
105
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
107
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
106
_TEST_FILES += \
108
_TEST_FILES += \
107
		test_bug511449.html \
109
		test_bug511449.html \
108
		file_bug511449.html \
110
		file_bug511449.html \
109
		$(NULL)
111
		$(NULL)
110
endif
112
endif
(-)5b8812d6950b (+25 lines)
Added Link Here 
Added Link Here 
1
<html>
2
<head>
3
<script>
4
    var start = Date.now();
5
    window._testing_js_start = Math.floor(start);
6
    window._testing_js_start_fine = start;
7
    window['_testing_js_after_' + document.readyState] = Math.floor(start);
8
    document.addEventListener('DOMContentLoaded', 
9
      function () {
10
        window._testing_evt_DOMContentLoaded = Math.floor(Date.now());
11
        window._testing_evt_DOMContentLoaded_fine = Date.now();
12
      }, true);
13
    document.addEventListener('readystatechange', function(){
14
      window['_testing_evt_DOM_' + document.readyState] = Math.floor(Date.now());
15
      window['_testing_evt_DOM_' + document.readyState + '_fine'] = Date.now();
16
    }, true);
17
    function recordLoad() {
18
      window._testing_evt_load = Math.floor(Date.now());
19
      window._testing_evt_load_fine = Date.now();
20
    }
21
</script>
22
</head>
23
<body onload="recordLoad()">This document collects time 
24
for events related to the page load progress.</body>
25
</html>
(-)5b8812d6950b (+149 lines)
Added Link Here 
Added Link Here 
1
<!DOCTYPE HTML>
2
<html>
3
<!--
4
https://bugzilla.mozilla.org/show_bug.cgi?id=570341
5
-->
6
<head>
7
  <title>Test for Bug 570341</title>
8
  <script type="application/javascript" src="/MochiKit/packed.js"></script>
9
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11
<script>
12
  var start = Date.now();
13
  var moments = {};
14
15
  var unload = 0;
16
  var wasEnabled = true;
17
18
  function collectMoments() {
19
    var win = frames[0];
20
    var timing = (win.performance && win.performance.timing) || {};
21
    for (var p in timing) {
22
      moments[p] = timing[p];
23
    }
24
    for (var p in win) {
25
      if (p.substring(0,9) == '_testing_') {
26
        moments[p.substring(9)] = win[p];
27
      }
28
    }
29
    moments['evt_unload'] = Math.floor(unload);
30
    moments['evt_unload_fine'] = unload;
31
    return moments;
32
  }
33
34
  function showSequence(node){
35
    while(node.firstChild) {
36
      node.removeChild(node.firstChild);
37
    }
38
    var sequence = [];
39
    for (var p in moments) {
40
      sequence.push(p);
41
    }
42
    sequence.sort(function(a, b){
43
      return moments[a] - moments[b];
44
    });
45
    table = document.createElement('table');
46
    node.appendChild(table);
47
    row = document.createElement('tr');
48
    table.appendChild(row);
49
    cell = document.createElement('td');
50
    row.appendChild(cell);
51
    cell.appendChild(document.createTextNode('start'));
52
    cell = document.createElement('td');
53
    row.appendChild(cell);
54
    cell.appendChild(document.createTextNode(start));
55
    for (var i = 0; i < sequence.length; ++i) {
56
      var prop = sequence[i];
57
      row = document.createElement('tr');
58
      table.appendChild(row);
59
      cell = document.createElement('td');
60
      row.appendChild(cell);
61
      cell.appendChild(document.createTextNode(prop));
62
      cell = document.createElement('td');
63
      row.appendChild(cell);
64
      cell.appendChild(document.createTextNode(moments[prop]));
65
    }
66
  }
67
68
  function checkValues(){
69
    collectMoments();
70
71
    var sequences = [
72
      ['navigationStart', 'unloadEventStart', 'evt_unload' , 'unloadEventEnd'],
73
      ['navigationStart', 'fetchStart', 'domainLookupStart', 'domainLookupEnd', 
74
       'connectStart', 'connectEnd', 'requestStart', 'responseStart', 'responseEnd'],
75
      ['responseStart', 'domLoading', 'domInteractive', 'domComplete'],
76
      ['domContentLoadedEventStart', 'evt_DOMContentLoaded', 'domContentLoadedEventEnd',
77
       'loadEventStart', 'evt_load', 'loadEventEnd']
78
    ]
79
    
80
    for (var i = 0; i < sequences.length; ++i) {
81
      var seq = sequences[i];
82
      for (var j = 0; j < seq.length; ++j) {
83
        var prop = seq[j];
84
        if (j > 0) {
85
          var prevProp = seq[j-1];
86
          ok(moments[prevProp] <= moments[prop], 
87
              ['Expected ', prevProp, ' to happen before ', prop, 
88
              ', got ', prevProp, ' = ', moments[prevProp], 
89
              ', ', prop, ' = ', moments[prop]].join(''));
90
        }
91
      }
92
    }
93
    try {
94
      SpecialPowers.setBoolPref('dom.enable_performance', wasEnabled);
95
    } catch (err) {
96
      todo(false, 'Exception in SpecialPowers: ' + err + ' at ' + err.stack);
97
    }
98
99
    SimpleTest.finish()
100
  }
101
102
window.onload = function() {
103
  try {
104
    wasEnabled = SpecialPowers.getBoolPref('dom.enable_performance');
105
  } catch (err) {
106
    todo(false, 'Exception in SpecialPowers: ' + err + ' at ' + err.stack);
107
  }
108
  SpecialPowers.setBoolPref('dom.enable_performance', true);
109
110
  var win = frames[0];
111
  win.addEventListener('unload', function(){
112
    unload = Date.now();
113
  }, true);
114
  frames[0].location = 'bug570341_recordevents.html'
115
  var seenLoad = 0;
116
  win.addEventListener('load', function (){
117
    seenLoad = Date.now();
118
  }, true);
119
  var interval = setInterval(function () {
120
    var stopPolling = (win.performance && win.performance.loadEventEnd) ||
121
                      (seenLoad && Date.now() >= seenLoad + 200);
122
    if (stopPolling) {
123
      clearInterval(interval);
124
      checkValues();
125
    } else if (win._testing_evt_load) {
126
      seenLoad = Date.now();
127
    }
128
  }, 100);
129
	}
130
</script>
131
</head>
132
<body>
133
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=570341">Mozilla Bug 570341</a>
134
<div id="frames">
135
<iframe name="child0" src="navigation/blank.html"></iframe>
136
</div>
137
<button type="button" onclick="showSequence(document.getElementById('display'))">
138
    Show Events</button>
139
<p id="display"></p>
140
<div id="content" style="display: none">
141
  
142
</div>
143
<pre id="test">
144
<script type="application/javascript">
145
SimpleTest.waitForExplicitFinish();
146
</script>
147
</pre>
148
</body>
149
</html>
(-)a/dom/base/Makefile.in (+2 lines)
Line     Link Here 
 Lines 103-118   CPPSRCS = \ Link Here 
103
	nsMimeTypeArray.cpp	\
103
	nsMimeTypeArray.cpp	\
104
	nsPluginArray.cpp	\
104
	nsPluginArray.cpp	\
105
	nsWindowRoot.cpp	\
105
	nsWindowRoot.cpp	\
106
	nsDOMClassInfo.cpp	\
106
	nsDOMClassInfo.cpp	\
107
	nsScriptNameSpaceManager.cpp \
107
	nsScriptNameSpaceManager.cpp \
108
	nsDOMScriptObjectFactory.cpp \
108
	nsDOMScriptObjectFactory.cpp \
109
	nsQueryContentEventResult.cpp \
109
	nsQueryContentEventResult.cpp \
110
	nsContentPermissionHelper.cpp \
110
	nsContentPermissionHelper.cpp \
111
	nsDOMNavigationTiming.cpp \
112
	nsPerformance.cpp	\
111
	$(NULL)
113
	$(NULL)
112
114
113
include $(topsrcdir)/dom/dom-config.mk
115
include $(topsrcdir)/dom/dom-config.mk
114
116
115
ifdef MOZ_JSDEBUGGER
117
ifdef MOZ_JSDEBUGGER
116
DEFINES += -DMOZ_JSDEBUGGER
118
DEFINES += -DMOZ_JSDEBUGGER
117
endif
119
endif
118
120
(-)a/dom/base/nsDOMClassInfo.cpp (-23 / +75 lines)
Line     Link Here 
 Lines 113-128    Link Here 
113
#include "nsIDOMWindowInternal.h"
113
#include "nsIDOMWindowInternal.h"
114
#include "nsPIDOMWindow.h"
114
#include "nsPIDOMWindow.h"
115
#include "nsIDOMJSWindow.h"
115
#include "nsIDOMJSWindow.h"
116
#include "nsIDOMWindowCollection.h"
116
#include "nsIDOMWindowCollection.h"
117
#include "nsIDOMHistory.h"
117
#include "nsIDOMHistory.h"
118
#include "nsIDOMMediaList.h"
118
#include "nsIDOMMediaList.h"
119
#include "nsIDOMChromeWindow.h"
119
#include "nsIDOMChromeWindow.h"
120
#include "nsIDOMConstructor.h"
120
#include "nsIDOMConstructor.h"
121
#include "nsIDOMPerformanceTiming.h"
122
#include "nsIDOMPerformanceNavigation.h"
123
#include "nsIDOMPerformance.h"
121
#include "nsClientRect.h"
124
#include "nsClientRect.h"
122
125
123
// DOM core includes
126
// DOM core includes
124
#include "nsDOMError.h"
127
#include "nsDOMError.h"
125
#include "nsIDOMDOMException.h"
128
#include "nsIDOMDOMException.h"
126
#include "nsIDOMNode.h"
129
#include "nsIDOMNode.h"
127
#include "nsIDOM3Node.h"
130
#include "nsIDOM3Node.h"
128
#include "nsIDOM3Attr.h"
131
#include "nsIDOM3Attr.h"
 Lines 673-688   static nsDOMClassInfoData sClassInfoData Link Here 
673
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
676
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
674
  NS_DEFINE_CLASSINFO_DATA(MimeTypeArray, nsMimeTypeArraySH,
677
  NS_DEFINE_CLASSINFO_DATA(MimeTypeArray, nsMimeTypeArraySH,
675
                           ARRAY_SCRIPTABLE_FLAGS)
678
                           ARRAY_SCRIPTABLE_FLAGS)
676
  NS_DEFINE_CLASSINFO_DATA(BarProp, nsDOMGenericSH,
679
  NS_DEFINE_CLASSINFO_DATA(BarProp, nsDOMGenericSH,
677
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
680
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
678
  NS_DEFINE_CLASSINFO_DATA(History, nsHistorySH,
681
  NS_DEFINE_CLASSINFO_DATA(History, nsHistorySH,
679
                           ARRAY_SCRIPTABLE_FLAGS |
682
                           ARRAY_SCRIPTABLE_FLAGS |
680
                           nsIXPCScriptable::WANT_PRECREATE)
683
                           nsIXPCScriptable::WANT_PRECREATE)
684
  NS_DEFINE_CLASSINFO_DATA(PerformanceTiming, nsDOMGenericSH,
685
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
686
  NS_DEFINE_CLASSINFO_DATA(PerformanceNavigation, nsDOMGenericSH,
687
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
688
  NS_DEFINE_CLASSINFO_DATA(Performance, nsDOMGenericSH,
689
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
681
  NS_DEFINE_CLASSINFO_DATA(Screen, nsDOMGenericSH,
690
  NS_DEFINE_CLASSINFO_DATA(Screen, nsDOMGenericSH,
682
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
691
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
683
  NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH,
692
  NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH,
684
                           DOM_BASE_SCRIPTABLE_FLAGS |
693
                           DOM_BASE_SCRIPTABLE_FLAGS |
685
                           nsIXPCScriptable::WANT_PRECREATE |
694
                           nsIXPCScriptable::WANT_PRECREATE |
686
                           nsIXPCScriptable::WANT_HASINSTANCE |
695
                           nsIXPCScriptable::WANT_HASINSTANCE |
687
                           nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)
696
                           nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)
688
  NS_DEFINE_CLASSINFO_DATA(DOMConstructor, nsDOMConstructorSH,
697
  NS_DEFINE_CLASSINFO_DATA(DOMConstructor, nsDOMConstructorSH,
 Lines 2331-2370   nsDOMClassInfo::Init() Link Here 
2331
  NS_ENSURE_SUCCESS(rv, rv);
2340
  NS_ENSURE_SUCCESS(rv, rv);
2332
2341
2333
  JSContext *cx = nsnull;
2342
  JSContext *cx = nsnull;
2334
2343
2335
  rv = stack->GetSafeJSContext(&cx);
2344
  rv = stack->GetSafeJSContext(&cx);
2336
  NS_ENSURE_SUCCESS(rv, rv);
2345
  NS_ENSURE_SUCCESS(rv, rv);
2337
2346
2338
  if (nsGlobalWindow::HasIndexedDBSupport()) {
2347
  if (nsGlobalWindow::HasIndexedDBSupport()) {
2339
    DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2348
    if (nsGlobalWindow::HasPerformanceSupport()) {
2340
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2349
      DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2341
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2350
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2342
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2351
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2343
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2352
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2344
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2353
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2345
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
2354
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2346
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
2355
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
2347
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2356
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
2348
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
2357
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2349
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2358
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
2350
    DOM_CLASSINFO_MAP_END
2359
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2360
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)
2361
      DOM_CLASSINFO_MAP_END
2362
    } else {
2363
      DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2364
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2365
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2366
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2367
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2368
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2369
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
2370
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
2371
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2372
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
2373
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2374
      DOM_CLASSINFO_MAP_END
2375
    }
2351
  } else {
2376
  } else {
2352
    DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2377
    if (nsGlobalWindow::HasPerformanceSupport()) {
2353
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2378
      DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2354
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2379
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2355
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2380
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2356
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2381
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2357
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2382
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2358
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
2383
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2359
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
2384
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
2360
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2385
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
2361
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2386
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2362
    DOM_CLASSINFO_MAP_END
2387
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2388
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)
2389
      DOM_CLASSINFO_MAP_END
2390
    } else {
2391
      DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2392
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2393
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2394
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2395
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2396
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2397
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMViewCSS)
2398
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMAbstractView)
2399
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2400
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2401
      DOM_CLASSINFO_MAP_END
2402
    }
2363
  }
2403
  }
2364
2404
2365
  DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils)
2405
  DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils)
2366
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils)
2406
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils)
2367
  DOM_CLASSINFO_MAP_END
2407
  DOM_CLASSINFO_MAP_END
2368
2408
2369
  DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation)
2409
  DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation)
2370
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMLocation)
2410
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMLocation)
 Lines 2404-2419   nsDOMClassInfo::Init() Link Here 
2404
  DOM_CLASSINFO_MAP_BEGIN(BarProp, nsIDOMBarProp)
2444
  DOM_CLASSINFO_MAP_BEGIN(BarProp, nsIDOMBarProp)
2405
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMBarProp)
2445
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMBarProp)
2406
  DOM_CLASSINFO_MAP_END
2446
  DOM_CLASSINFO_MAP_END
2407
2447
2408
  DOM_CLASSINFO_MAP_BEGIN(History, nsIDOMHistory)
2448
  DOM_CLASSINFO_MAP_BEGIN(History, nsIDOMHistory)
2409
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMHistory)
2449
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMHistory)
2410
  DOM_CLASSINFO_MAP_END
2450
  DOM_CLASSINFO_MAP_END
2411
2451
2452
  DOM_CLASSINFO_MAP_BEGIN(PerformanceTiming, nsIDOMPerformanceTiming)
2453
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformanceTiming)
2454
  DOM_CLASSINFO_MAP_END
2455
2456
  DOM_CLASSINFO_MAP_BEGIN(PerformanceNavigation, nsIDOMPerformanceNavigation)
2457
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformanceNavigation)
2458
  DOM_CLASSINFO_MAP_END
2459
2460
  DOM_CLASSINFO_MAP_BEGIN(Performance, nsIDOMPerformance)
2461
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformance)
2462
  DOM_CLASSINFO_MAP_END
2463
2412
  DOM_CLASSINFO_MAP_BEGIN(Screen, nsIDOMScreen)
2464
  DOM_CLASSINFO_MAP_BEGIN(Screen, nsIDOMScreen)
2413
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMScreen)
2465
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMScreen)
2414
  DOM_CLASSINFO_MAP_END
2466
  DOM_CLASSINFO_MAP_END
2415
2467
2416
  DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DOMPrototype, nsIDOMDOMConstructor)
2468
  DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DOMPrototype, nsIDOMDOMConstructor)
2417
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
2469
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
2418
  DOM_CLASSINFO_MAP_END
2470
  DOM_CLASSINFO_MAP_END
2419
2471
(-)a/dom/base/nsDOMClassInfoClasses.h (+3 lines)
Line     Link Here 
 Lines 40-55   DOMCI_CLASS(Window) Link Here 
40
DOMCI_CLASS(Location)
40
DOMCI_CLASS(Location)
41
DOMCI_CLASS(Navigator)
41
DOMCI_CLASS(Navigator)
42
DOMCI_CLASS(Plugin)
42
DOMCI_CLASS(Plugin)
43
DOMCI_CLASS(PluginArray)
43
DOMCI_CLASS(PluginArray)
44
DOMCI_CLASS(MimeType)
44
DOMCI_CLASS(MimeType)
45
DOMCI_CLASS(MimeTypeArray)
45
DOMCI_CLASS(MimeTypeArray)
46
DOMCI_CLASS(BarProp)
46
DOMCI_CLASS(BarProp)
47
DOMCI_CLASS(History)
47
DOMCI_CLASS(History)
48
DOMCI_CLASS(PerformanceTiming)
49
DOMCI_CLASS(PerformanceNavigation)
50
DOMCI_CLASS(Performance)
48
DOMCI_CLASS(Screen)
51
DOMCI_CLASS(Screen)
49
DOMCI_CLASS(DOMPrototype)
52
DOMCI_CLASS(DOMPrototype)
50
DOMCI_CLASS(DOMConstructor)
53
DOMCI_CLASS(DOMConstructor)
51
54
52
// Core classes
55
// Core classes
53
DOMCI_CLASS(XMLDocument)
56
DOMCI_CLASS(XMLDocument)
54
DOMCI_CLASS(DocumentType)
57
DOMCI_CLASS(DocumentType)
55
DOMCI_CLASS(DOMImplementation)
58
DOMCI_CLASS(DOMImplementation)
(-)5b8812d6950b (+414 lines)
Added Link Here 
Added Link Here 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is implementation of Web Timing draft specification
16
 * http://dev.w3.org/2006/webapi/WebTiming/
17
 *
18
 * The Initial Developer of the Original Code is Google Inc.
19
 * Portions created by the Initial Developer are Copyright (C) 2010
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Sergey Novikov <sergeyn@google.com> (original author)
24
 *   Igor Bazarny <igor.bazarny@gmail.com> (lots of improvements)
25
 *
26
 * Alternatively, the contents of this file may be used under the terms of
27
 * either of the GNU General Public License Version 2 or later (the "GPL"),
28
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
 * in which case the provisions of the GPL or the LGPL are applicable instead
30
 * of those above. If you wish to allow use of your version of this file only
31
 * under the terms of either the GPL or the LGPL, and not to allow others to
32
 * use your version of this file under the terms of the MPL, indicate your
33
 * decision by deleting the provisions above and replace them with the notice
34
 * and other provisions required by the GPL or the LGPL. If you do not delete
35
 * the provisions above, a recipient may use your version of this file under
36
 * the terms of any one of the MPL, the GPL or the LGPL.
37
 *
38
 * ***** END LICENSE BLOCK ***** */
39
40
#include "nsDOMNavigationTiming.h"
41
#include "nsCOMPtr.h"
42
#include "nscore.h"
43
#include "prinrval.h"
44
#include "nsContentUtils.h"
45
46
#include "nsIDOMEventTarget.h"
47
#include "nsIDocument.h"
48
#include "nsIScriptSecurityManager.h"
49
50
nsDOMNavigationTiming::nsDOMNavigationTiming()
51
{
52
  Clear();
53
}
54
55
nsDOMNavigationTiming::~nsDOMNavigationTiming()
56
{
57
}
58
59
void
60
nsDOMNavigationTiming::Clear()
61
{
62
  mNavigationType = nsIDOMPerformanceNavigation::TYPE_RESERVED;
63
  mNavigationStart = 0;
64
  mFetchStart = 0;
65
  mRedirectStart = 0;
66
  mRedirectEnd = 0;
67
  mBeforeUnloadStart = 0;
68
  mUnloadStart = 0;
69
  mUnloadEnd = 0;
70
  mLoadEventStart = 0;
71
  mLoadEventEnd = 0;
72
  mDOMLoading = 0;
73
  mDOMInteractive = 0;
74
  mDOMContentLoadedEventStart = 0;
75
  mDOMContentLoadedEventEnd = 0;
76
  mDOMComplete = 0;
77
  mRedirectCheck = NOT_CHECKED;
78
}
79
80
void
81
nsDOMNavigationTiming::NotifyNavigationStart()
82
{
83
  mNavigationStart = PR_Now() / PR_USEC_PER_MSEC;
84
}
85
86
void
87
nsDOMNavigationTiming::NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType)
88
{
89
  mFetchStart = PR_Now() / PR_USEC_PER_MSEC;
90
  mNavigationType = aNavigationType;
91
  // At the unload event time we don't really know the loading uri.
92
  // Need it for later check for unload timing access.
93
  mLoadedURI = aURI;
94
}
95
96
void
97
nsDOMNavigationTiming::NotifyRedirect(nsIURI* aOldURI, nsIURI* aNewURI)
98
{
99
  if (mRedirects.Count() == 0) {
100
    mRedirectStart = mFetchStart;
101
  }
102
  mFetchStart = PR_Now() / PR_USEC_PER_MSEC;
103
  mRedirectEnd = mFetchStart;
104
105
  // At the unload event time we don't really know the loading uri.
106
  // Need it for later check for unload timing access.
107
  mLoadedURI = aNewURI;
108
109
  mRedirects.AppendObject(aOldURI);
110
}
111
112
void
113
nsDOMNavigationTiming::NotifyBeforeUnload()
114
{
115
  mBeforeUnloadStart = PR_Now() / PR_USEC_PER_MSEC;
116
}
117
118
void
119
nsDOMNavigationTiming::NotifyUnloadAccepted(nsIURI* aOldURI)
120
{
121
  mUnloadStart = mBeforeUnloadStart;
122
  mUnloadedURI = aOldURI;
123
}
124
125
void
126
nsDOMNavigationTiming::NotifyUnloadEventStart()
127
{
128
  mUnloadStart = PR_Now() / PR_USEC_PER_MSEC;
129
}
130
131
void
132
nsDOMNavigationTiming::NotifyUnloadEventEnd()
133
{
134
  mUnloadEnd = PR_Now() / PR_USEC_PER_MSEC;
135
}
136
137
void
138
nsDOMNavigationTiming::NotifyLoadEventStart()
139
{
140
  mLoadEventStart = PR_Now() / PR_USEC_PER_MSEC;
141
}
142
143
void
144
nsDOMNavigationTiming::NotifyLoadEventEnd()
145
{
146
  mLoadEventEnd = PR_Now() / PR_USEC_PER_MSEC;
147
}
148
149
PRBool
150
nsDOMNavigationTiming::ReportRedirects()
151
{
152
  if (mRedirectCheck == NOT_CHECKED) {
153
    if (mRedirects.Count() == 0) {
154
      mRedirectCheck = NO_REDIRECTS;
155
    } else {
156
      mRedirectCheck = CHECK_PASSED;
157
      nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
158
      for (int i = mRedirects.Count() - 1; i >= 0; --i) {
159
        nsIURI * curr = mRedirects[i];
160
        nsresult rv = ssm->CheckSameOriginURI(curr, mLoadedURI, PR_FALSE);
161
        if (!NS_SUCCEEDED(rv)) {
162
          mRedirectCheck = CHECK_FAILED;
163
          break;
164
        }
165
      }
166
      // All we need to know is in mRedirectCheck now. Clear history.
167
      mRedirects.Clear();
168
    }
169
  }
170
  return mRedirectCheck == CHECK_PASSED;
171
}
172
173
void
174
nsDOMNavigationTiming::SetDOMLoading(nsIURI* aURI, DOMTimeMilliSec aValue)
175
{
176
  mLoadedURI = aURI;
177
  mDOMLoading = aValue;
178
}
179
180
void
181
nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI)
182
{
183
  mLoadedURI = aURI;
184
  mDOMLoading = PR_Now() / PR_USEC_PER_MSEC;
185
}
186
187
void
188
nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI)
189
{
190
  mLoadedURI = aURI;
191
  mDOMInteractive = PR_Now() / PR_USEC_PER_MSEC;
192
}
193
194
void
195
nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI)
196
{
197
  mLoadedURI = aURI;
198
  mDOMComplete = PR_Now() / PR_USEC_PER_MSEC;
199
}
200
201
void
202
nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI)
203
{
204
  mLoadedURI = aURI;
205
  mDOMContentLoadedEventStart = PR_Now() / PR_USEC_PER_MSEC;
206
}
207
208
void
209
nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI)
210
{
211
  mLoadedURI = aURI;
212
  mDOMContentLoadedEventEnd = PR_Now() / PR_USEC_PER_MSEC;
213
}
214
215
216
NS_IMPL_ADDREF(nsDOMNavigationTiming)
217
NS_IMPL_RELEASE(nsDOMNavigationTiming)
218
219
// QueryInterface implementation for nsDOMNavigationTiming
220
NS_INTERFACE_MAP_BEGIN(nsDOMNavigationTiming)
221
  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceTiming)
222
  NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceTiming)
223
  NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceNavigation)
224
NS_INTERFACE_MAP_END
225
226
NS_IMETHODIMP
227
nsDOMNavigationTiming::GetType(
228
    nsDOMPerformanceNavigationType* aNavigationType)
229
{
230
  *aNavigationType = mNavigationType;
231
  return NS_OK;
232
}
233
234
NS_IMETHODIMP
235
nsDOMNavigationTiming::GetRedirectCount(PRUint16* aRedirectCount)
236
{
237
  *aRedirectCount = 0;
238
  if (ReportRedirects()) {
239
    *aRedirectCount = mRedirects.Count();
240
  }
241
  return NS_OK;
242
}
243
244
NS_IMETHODIMP
245
nsDOMNavigationTiming::GetRedirectStart(DOMTimeMilliSec* aRedirectStart)
246
{
247
  *aRedirectStart = 0;
248
  if (ReportRedirects()) {
249
    *aRedirectStart = mRedirectStart;
250
  }
251
  return NS_OK;
252
}
253
254
NS_IMETHODIMP
255
nsDOMNavigationTiming::GetRedirectEnd(DOMTimeMilliSec* aEnd)
256
{
257
  *aEnd = 0;
258
  if (ReportRedirects()) {
259
    *aEnd = mRedirectEnd;
260
  }
261
  return NS_OK;
262
}
263
264
NS_IMETHODIMP
265
nsDOMNavigationTiming::GetNavigationStart(DOMTimeMilliSec* aNavigationStart)
266
{
267
  *aNavigationStart = mNavigationStart;
268
  return NS_OK;
269
}
270
271
NS_IMETHODIMP
272
nsDOMNavigationTiming::GetUnloadEventStart(DOMTimeMilliSec* aStart)
273
{
274
  *aStart = 0;
275
  nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
276
  nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, PR_FALSE);
277
  if (NS_SUCCEEDED(rv)) {
278
    *aStart = mUnloadStart;
279
  }
280
  return NS_OK;
281
}
282
283
NS_IMETHODIMP
284
nsDOMNavigationTiming::GetUnloadEventEnd(DOMTimeMilliSec* aEnd)
285
{
286
  *aEnd = 0;
287
  nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
288
  nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, PR_FALSE);
289
  if (NS_SUCCEEDED(rv)) {
290
    *aEnd = mUnloadEnd;
291
  }
292
  return NS_OK;
293
}
294
295
NS_IMETHODIMP
296
nsDOMNavigationTiming::GetFetchStart(DOMTimeMilliSec* aStart)
297
{
298
  *aStart = mFetchStart;
299
  return NS_OK;
300
}
301
302
NS_IMETHODIMP
303
nsDOMNavigationTiming::GetDomainLookupStart(DOMTimeMilliSec* aStart)
304
{
305
  // TODO: Implement me!
306
  *aStart = mFetchStart;
307
  return NS_OK;
308
}
309
310
NS_IMETHODIMP
311
nsDOMNavigationTiming::GetDomainLookupEnd(DOMTimeMilliSec* aEnd)
312
{
313
  // TODO: Implement me!
314
  *aEnd = mFetchStart;
315
  return NS_OK;
316
}
317
318
NS_IMETHODIMP
319
nsDOMNavigationTiming::GetConnectStart(DOMTimeMilliSec* aStart)
320
{
321
  // TODO: Implement me!
322
  *aStart = mFetchStart;
323
  return NS_OK;
324
}
325
326
NS_IMETHODIMP
327
nsDOMNavigationTiming::GetConnectEnd(DOMTimeMilliSec* aEnd)
328
{
329
  // TODO: Implement me!
330
  *aEnd = mFetchStart;
331
  return NS_OK;
332
}
333
334
NS_IMETHODIMP
335
nsDOMNavigationTiming::GetHandshakeStart(DOMTimeMilliSec* aStart)
336
{
337
  // TODO: Implement me!
338
  *aStart = mFetchStart;
339
  return NS_OK;
340
}
341
342
NS_IMETHODIMP
343
nsDOMNavigationTiming::GetRequestStart(DOMTimeMilliSec* aStart)
344
{
345
  // TODO: Implement me!
346
  *aStart = mFetchStart;
347
  return NS_OK;
348
}
349
350
NS_IMETHODIMP
351
nsDOMNavigationTiming::GetResponseStart(DOMTimeMilliSec* aStart)
352
{
353
  // TODO: Implement me!
354
  *aStart = mFetchStart;
355
  return NS_OK;
356
}
357
358
NS_IMETHODIMP
359
nsDOMNavigationTiming::GetResponseEnd(DOMTimeMilliSec* aEnd)
360
{
361
  // TODO: Implement me!
362
  *aEnd = mFetchStart;
363
  return NS_OK;
364
}
365
366
NS_IMETHODIMP
367
nsDOMNavigationTiming::GetDomLoading(DOMTimeMilliSec* aTime)
368
{
369
  *aTime = mDOMLoading;
370
  return NS_OK;
371
}
372
373
NS_IMETHODIMP
374
nsDOMNavigationTiming::GetDomInteractive(DOMTimeMilliSec* aTime)
375
{
376
  *aTime = mDOMInteractive;
377
  return NS_OK;
378
}
379
380
NS_IMETHODIMP
381
nsDOMNavigationTiming::GetDomContentLoadedEventStart(DOMTimeMilliSec* aStart)
382
{
383
  *aStart = mDOMContentLoadedEventStart;
384
  return NS_OK;
385
}
386
387
NS_IMETHODIMP
388
nsDOMNavigationTiming::GetDomContentLoadedEventEnd(DOMTimeMilliSec* aEnd)
389
{
390
  *aEnd = mDOMContentLoadedEventEnd;
391
  return NS_OK;
392
}
393
394
NS_IMETHODIMP
395
nsDOMNavigationTiming::GetDomComplete(DOMTimeMilliSec* aTime)
396
{
397
  *aTime = mDOMComplete;
398
  return NS_OK;
399
}
400
401
NS_IMETHODIMP
402
nsDOMNavigationTiming::GetLoadEventStart(DOMTimeMilliSec* aStart)
403
{
404
  *aStart = mLoadEventStart;
405
  return NS_OK;
406
}
407
408
NS_IMETHODIMP
409
nsDOMNavigationTiming::GetLoadEventEnd(DOMTimeMilliSec* aEnd)
410
{
411
  *aEnd = mLoadEventEnd;
412
  return NS_OK;
413
}
414
(-)5b8812d6950b (+118 lines)
Added Link Here 
Added Link Here 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is implementation of Web Timing draft specification
16
 * http://dev.w3.org/2006/webapi/WebTiming/
17
 *
18
 * The Initial Developer of the Original Code is Google Inc.
19
 * Portions created by the Initial Developer are Copyright (C) 2010
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Sergey Novikov <sergeyn@google.com> (original author)
24
 *   Igor Bazarny <igor.bazarny@gmail.com> (lots of improvements)
25
 *
26
 * Alternatively, the contents of this file may be used under the terms of
27
 * either of the GNU General Public License Version 2 or later (the "GPL"),
28
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
 * in which case the provisions of the GPL or the LGPL are applicable instead
30
 * of those above. If you wish to allow use of your version of this file only
31
 * under the terms of either the GPL or the LGPL, and not to allow others to
32
 * use your version of this file under the terms of the MPL, indicate your
33
 * decision by deleting the provisions above and replace them with the notice
34
 * and other provisions required by the GPL or the LGPL. If you do not delete
35
 * the provisions above, a recipient may use your version of this file under
36
 * the terms of any one of the MPL, the GPL or the LGPL.
37
 *
38
 * ***** END LICENSE BLOCK ***** */
39
40
#ifndef nsDOMNavigationTiming_h___
41
#define nsDOMNavigationTiming_h___
42
43
#include "nsIDOMPerformanceTiming.h"
44
#include "nsIDOMPerformanceNavigation.h"
45
#include "nscore.h"
46
#include "nsCOMPtr.h"
47
#include "nsCOMArray.h"
48
49
class nsDOMNavigationTimingClock;
50
class nsIURI;
51
class nsIDocument;
52
53
class nsDOMNavigationTiming : public nsIDOMPerformanceTiming,
54
                              public nsIDOMPerformanceNavigation
55
{
56
public:
57
  nsDOMNavigationTiming();
58
59
  NS_DECL_ISUPPORTS
60
  NS_DECL_NSIDOMPERFORMANCETIMING
61
  NS_DECL_NSIDOMPERFORMANCENAVIGATION
62
63
  void NotifyNavigationStart();
64
  void NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType);
65
  void NotifyRedirect(nsIURI* aOldURI, nsIURI* aNewURI);
66
  void NotifyBeforeUnload();
67
  void NotifyUnloadAccepted(nsIURI* aOldURI);
68
  void NotifyUnloadEventStart();
69
  void NotifyUnloadEventEnd();
70
  void NotifyLoadEventStart();
71
  void NotifyLoadEventEnd();
72
  
73
  // Document changes state to 'loading' before connecting to timing
74
  void SetDOMLoading(nsIURI* aURI, DOMTimeMilliSec aValue);
75
  void NotifyDOMLoading(nsIURI* aURI);
76
  void NotifyDOMInteractive(nsIURI* aURI);
77
  void NotifyDOMComplete(nsIURI* aURI);
78
  void NotifyDOMContentLoadedStart(nsIURI* aURI);
79
  void NotifyDOMContentLoadedEnd(nsIURI* aURI);
80
81
private:
82
  nsDOMNavigationTiming(const nsDOMNavigationTiming &){};
83
  ~nsDOMNavigationTiming();
84
85
  void Clear();
86
  PRBool ReportRedirects();
87
88
  nsCOMPtr<nsIURI> mUnloadedURI;
89
  nsCOMPtr<nsIURI> mLoadedURI;
90
  nsCOMArray<nsIURI> mRedirects;
91
92
  typedef enum { NOT_CHECKED,
93
                 CHECK_PASSED, 
94
                 NO_REDIRECTS, 
95
                 CHECK_FAILED} RedirectCheckState;
96
  RedirectCheckState mRedirectCheck;
97
98
  nsDOMPerformanceNavigationType mNavigationType;
99
  DOMTimeMilliSec mNavigationStart;
100
  DOMTimeMilliSec mFetchStart;
101
  DOMTimeMilliSec mRedirectStart;
102
  DOMTimeMilliSec mRedirectEnd;
103
  DOMTimeMilliSec mBeforeUnloadStart;
104
  DOMTimeMilliSec mUnloadStart;
105
  DOMTimeMilliSec mUnloadEnd;
106
  DOMTimeMilliSec mNavigationEnd;
107
  DOMTimeMilliSec mLoadEventStart;
108
  DOMTimeMilliSec mLoadEventEnd;
109
110
  DOMTimeMilliSec mDOMLoading;
111
  DOMTimeMilliSec mDOMInteractive;
112
  DOMTimeMilliSec mDOMContentLoadedEventStart;
113
  DOMTimeMilliSec mDOMContentLoadedEventEnd;
114
  DOMTimeMilliSec mDOMComplete;
115
};
116
117
#endif /* nsDOMNavigationTiming_h___ */
118
(-)a/dom/base/nsGlobalWindow.cpp (-1 / +23 lines)
Line     Link Here 
 Lines 47-62    Link Here 
47
 * ***** END LICENSE BLOCK ***** */
47
 * ***** END LICENSE BLOCK ***** */
48
48
49
#include "base/basictypes.h"
49
#include "base/basictypes.h"
50
50
51
// Local Includes
51
// Local Includes
52
#include "nsGlobalWindow.h"
52
#include "nsGlobalWindow.h"
53
#include "nsScreen.h"
53
#include "nsScreen.h"
54
#include "nsHistory.h"
54
#include "nsHistory.h"
55
#include "nsPerformance.h"
56
#include "nsDOMNavigationTiming.h"
55
#include "nsBarProps.h"
57
#include "nsBarProps.h"
56
#include "nsDOMStorage.h"
58
#include "nsDOMStorage.h"
57
#include "nsDOMOfflineResourceList.h"
59
#include "nsDOMOfflineResourceList.h"
58
#include "nsDOMError.h"
60
#include "nsDOMError.h"
59
61
60
// Helper Classes
62
// Helper Classes
61
#include "nsXPIDLString.h"
63
#include "nsXPIDLString.h"
62
#include "nsJSUtils.h"
64
#include "nsJSUtils.h"
 Lines 1108-1123   nsGlobalWindow::CleanUp(PRBool aIgnoreMo Link Here 
1108
  mScrollbars = nsnull;
1110
  mScrollbars = nsnull;
1109
  mLocation = nsnull;
1111
  mLocation = nsnull;
1110
  mHistory = nsnull;
1112
  mHistory = nsnull;
1111
  mFrames = nsnull;
1113
  mFrames = nsnull;
1112
  mApplicationCache = nsnull;
1114
  mApplicationCache = nsnull;
1113
  mIndexedDB = nsnull;
1115
  mIndexedDB = nsnull;
1114
  mPendingStorageEventsObsolete = nsnull;
1116
  mPendingStorageEventsObsolete = nsnull;
1115
1117
1118
  mPerformance = nsnull;
1116
1119
1117
  ClearControllers();
1120
  ClearControllers();
1118
1121
1119
  mOpener = nsnull;             // Forces Release
1122
  mOpener = nsnull;             // Forces Release
1120
  if (mContext) {
1123
  if (mContext) {
1121
#ifdef DEBUG
1124
#ifdef DEBUG
1122
    nsCycleCollector_DEBUG_shouldBeFreed(mContext);
1125
    nsCycleCollector_DEBUG_shouldBeFreed(mContext);
1123
#endif
1126
#endif
 Lines 1334-1349   NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION( Link Here 
1334
  NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow)
1337
  NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow)
1335
  NS_INTERFACE_MAP_ENTRY(nsIDOMViewCSS)
1338
  NS_INTERFACE_MAP_ENTRY(nsIDOMViewCSS)
1336
  NS_INTERFACE_MAP_ENTRY(nsIDOMAbstractView)
1339
  NS_INTERFACE_MAP_ENTRY(nsIDOMAbstractView)
1337
  NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow)
1340
  NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow)
1338
  NS_INTERFACE_MAP_ENTRY(nsIDOMStorageIndexedDB)
1341
  NS_INTERFACE_MAP_ENTRY(nsIDOMStorageIndexedDB)
1339
  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
1342
  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
1340
  NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
1343
  NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
1341
  NS_INTERFACE_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
1344
  NS_INTERFACE_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
1345
  NS_INTERFACE_MAP_ENTRY(nsIDOMWindowPerformance)
1342
  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window)
1346
  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window)
1343
  OUTER_WINDOW_ONLY
1347
  OUTER_WINDOW_ONLY
1344
    NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
1348
    NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
1345
  END_OUTER_WINDOW_ONLY
1349
  END_OUTER_WINDOW_ONLY
1346
NS_INTERFACE_MAP_END
1350
NS_INTERFACE_MAP_END
1347
1351
1348
1352
1349
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGlobalWindow)
1353
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGlobalWindow)
 Lines 2734-2750   nsGlobalWindow::PostHandleEvent(nsEventC Link Here 
2734
      nsEvent event(NS_IS_TRUSTED_EVENT(aVisitor.mEvent), NS_LOAD);
2738
      nsEvent event(NS_IS_TRUSTED_EVENT(aVisitor.mEvent), NS_LOAD);
2735
      event.flags |= NS_EVENT_FLAG_CANT_BUBBLE;
2739
      event.flags |= NS_EVENT_FLAG_CANT_BUBBLE;
2736
2740
2737
      // Most of the time we could get a pres context to pass in here,
2741
      // Most of the time we could get a pres context to pass in here,
2738
      // but not always (i.e. if this window is not shown there won't
2742
      // but not always (i.e. if this window is not shown there won't
2739
      // be a pres context available). Since we're not firing a GUI
2743
      // be a pres context available). Since we're not firing a GUI
2740
      // event we don't need a pres context anyway so we just pass
2744
      // event we don't need a pres context anyway so we just pass
2741
      // null as the pres context all the time here.
2745
      // null as the pres context all the time here.
2742
2743
      nsEventDispatcher::Dispatch(content, nsnull, &event, nsnull, &status);
2746
      nsEventDispatcher::Dispatch(content, nsnull, &event, nsnull, &status);
2744
    }
2747
    }
2745
  }
2748
  }
2746
2749
2747
  return NS_OK;
2750
  return NS_OK;
2748
}
2751
}
2749
2752
2750
nsresult
2753
nsresult
 Lines 2968-2983   nsGlobalWindow::GetHistory(nsIDOMHistory Link Here 
2968
    }
2971
    }
2969
  }
2972
  }
2970
2973
2971
  NS_IF_ADDREF(*aHistory = mHistory);
2974
  NS_IF_ADDREF(*aHistory = mHistory);
2972
  return NS_OK;
2975
  return NS_OK;
2973
}
2976
}
2974
2977
2975
NS_IMETHODIMP
2978
NS_IMETHODIMP
2979
nsGlobalWindow::GetPerformance(nsIDOMPerformance** aPerformance)
2980
{
2981
  FORWARD_TO_INNER(GetPerformance, (aPerformance), NS_ERROR_NOT_INITIALIZED);
2982
2983
  *aPerformance = nsnull;
2984
  
2985
  if (nsGlobalWindow::HasPerformanceSupport()) {
2986
    if (!mPerformance) {
2987
      nsRefPtr<nsDOMNavigationTiming> timing = mDoc->GetNavigationTiming();
2988
      if (timing) {
2989
        mPerformance = new nsPerformance(timing);
2990
      }
2991
    }
2992
    NS_IF_ADDREF(*aPerformance = mPerformance);
2993
  }
2994
  return NS_OK;
2995
}
2996
2997
NS_IMETHODIMP
2976
nsGlobalWindow::GetParent(nsIDOMWindow** aParent)
2998
nsGlobalWindow::GetParent(nsIDOMWindow** aParent)
2977
{
2999
{
2978
  FORWARD_TO_OUTER(GetParent, (aParent), NS_ERROR_NOT_INITIALIZED);
3000
  FORWARD_TO_OUTER(GetParent, (aParent), NS_ERROR_NOT_INITIALIZED);
2979
3001
2980
  *aParent = nsnull;
3002
  *aParent = nsnull;
2981
  if (!mDocShell)
3003
  if (!mDocShell)
2982
    return NS_OK;
3004
    return NS_OK;
2983
3005
(-)a/dom/base/nsGlobalWindow.h (-1 / +15 lines)
Line     Link Here 
 Lines 134-149   class nsIDOMEvent; Link Here 
134
class nsIScrollableFrame;
134
class nsIScrollableFrame;
135
class nsIControllers;
135
class nsIControllers;
136
136
137
class nsBarProp;
137
class nsBarProp;
138
class nsLocation;
138
class nsLocation;
139
class nsNavigator;
139
class nsNavigator;
140
class nsScreen;
140
class nsScreen;
141
class nsHistory;
141
class nsHistory;
142
class nsPerformance;
142
class nsIDocShellLoadInfo;
143
class nsIDocShellLoadInfo;
143
class WindowStateHolder;
144
class WindowStateHolder;
144
class nsGlobalWindowObserver;
145
class nsGlobalWindowObserver;
145
class nsGlobalWindow;
146
class nsGlobalWindow;
146
class nsDummyJavaPluginOwner;
147
class nsDummyJavaPluginOwner;
147
class PostMessageEvent;
148
class PostMessageEvent;
148
class nsRunnable;
149
class nsRunnable;
149
150
 Lines 282-298   class nsGlobalWindow : public nsPIDOMWin Link Here 
282
                       public nsIDOMNSEventTarget,
283
                       public nsIDOMNSEventTarget,
283
                       public nsIDOMViewCSS,
284
                       public nsIDOMViewCSS,
284
                       public nsIDOMStorageWindow,
285
                       public nsIDOMStorageWindow,
285
                       public nsIDOMStorageIndexedDB,
286
                       public nsIDOMStorageIndexedDB,
286
                       public nsSupportsWeakReference,
287
                       public nsSupportsWeakReference,
287
                       public nsIInterfaceRequestor,
288
                       public nsIInterfaceRequestor,
288
                       public nsIDOMWindow_2_0_BRANCH,
289
                       public nsIDOMWindow_2_0_BRANCH,
289
                       public nsWrapperCache,
290
                       public nsWrapperCache,
290
                       public PRCListStr
291
                       public PRCListStr,
292
                       public nsIDOMWindowPerformance
291
{
293
{
292
public:
294
public:
293
  friend class nsDOMMozURLProperty;
295
  friend class nsDOMMozURLProperty;
294
296
295
  typedef mozilla::TimeStamp TimeStamp;
297
  typedef mozilla::TimeStamp TimeStamp;
296
  typedef mozilla::TimeDuration TimeDuration;
298
  typedef mozilla::TimeDuration TimeDuration;
297
299
298
  // public methods
300
  // public methods
 Lines 330-345   public: Link Here 
330
  NS_DECL_NSIDOMWINDOW
332
  NS_DECL_NSIDOMWINDOW
331
333
332
  // nsIDOMWindow2
334
  // nsIDOMWindow2
333
  NS_DECL_NSIDOMWINDOW2
335
  NS_DECL_NSIDOMWINDOW2
334
336
335
  // nsIDOMWindowInternal
337
  // nsIDOMWindowInternal
336
  NS_DECL_NSIDOMWINDOWINTERNAL
338
  NS_DECL_NSIDOMWINDOWINTERNAL
337
339
340
  // nsIDOMWindowPerformance
341
  NS_DECL_NSIDOMWINDOWPERFORMANCE
342
338
  // nsIDOMJSWindow
343
  // nsIDOMJSWindow
339
  NS_DECL_NSIDOMJSWINDOW
344
  NS_DECL_NSIDOMJSWINDOW
340
345
341
  // nsIDOMEventTarget
346
  // nsIDOMEventTarget
342
  NS_DECL_NSIDOMEVENTTARGET
347
  NS_DECL_NSIDOMEVENTTARGET
343
348
344
  // nsIDOM3EventTarget
349
  // nsIDOM3EventTarget
345
  NS_DECL_NSIDOM3EVENTTARGET
350
  NS_DECL_NSIDOM3EVENTTARGET
 Lines 575-590   public: Link Here 
575
  static nsGlobalWindow* GetOuterWindowWithId(PRUint64 aWindowID) {
580
  static nsGlobalWindow* GetOuterWindowWithId(PRUint64 aWindowID) {
576
    return sOuterWindowsById ? sOuterWindowsById->Get(aWindowID) : nsnull;
581
    return sOuterWindowsById ? sOuterWindowsById->Get(aWindowID) : nsnull;
577
  }
582
  }
578
583
579
  static bool HasIndexedDBSupport() {
584
  static bool HasIndexedDBSupport() {
580
    return nsContentUtils::GetBoolPref("indexedDB.feature.enabled", PR_TRUE);
585
    return nsContentUtils::GetBoolPref("indexedDB.feature.enabled", PR_TRUE);
581
  }
586
  }
582
587
588
  static bool HasPerformanceSupport() {
589
#ifdef DEBUG
590
    return nsContentUtils::GetBoolPref("dom.enable_performance", PR_TRUE);
591
#else
592
    return nsContentUtils::GetBoolPref("dom.enable_performance", PR_FALSE);
593
#endif
594
  }
595
583
private:
596
private:
584
  // Enable updates for the accelerometer.
597
  // Enable updates for the accelerometer.
585
  void EnableAccelerationUpdates();
598
  void EnableAccelerationUpdates();
586
599
587
  // Disables updates for the accelerometer.
600
  // Disables updates for the accelerometer.
588
  void DisableAccelerationUpdates();
601
  void DisableAccelerationUpdates();
589
602
590
protected:
603
protected:
 Lines 901-916   protected: Link Here 
901
  nsCOMPtr<nsIScriptContext>    mContext;
914
  nsCOMPtr<nsIScriptContext>    mContext;
902
  nsWeakPtr                     mOpener;
915
  nsWeakPtr                     mOpener;
903
  nsCOMPtr<nsIControllers>      mControllers;
916
  nsCOMPtr<nsIControllers>      mControllers;
904
  nsCOMPtr<nsIArray>            mArguments;
917
  nsCOMPtr<nsIArray>            mArguments;
905
  nsCOMPtr<nsIArray>            mArgumentsLast;
918
  nsCOMPtr<nsIArray>            mArgumentsLast;
906
  nsCOMPtr<nsIPrincipal>        mArgumentsOrigin;
919
  nsCOMPtr<nsIPrincipal>        mArgumentsOrigin;
907
  nsRefPtr<nsNavigator>         mNavigator;
920
  nsRefPtr<nsNavigator>         mNavigator;
908
  nsRefPtr<nsScreen>            mScreen;
921
  nsRefPtr<nsScreen>            mScreen;
922
  nsRefPtr<nsPerformance>       mPerformance;
909
  nsRefPtr<nsDOMWindowList>     mFrames;
923
  nsRefPtr<nsDOMWindowList>     mFrames;
910
  nsRefPtr<nsBarProp>           mMenubar;
924
  nsRefPtr<nsBarProp>           mMenubar;
911
  nsRefPtr<nsBarProp>           mToolbar;
925
  nsRefPtr<nsBarProp>           mToolbar;
912
  nsRefPtr<nsBarProp>           mLocationbar;
926
  nsRefPtr<nsBarProp>           mLocationbar;
913
  nsRefPtr<nsBarProp>           mPersonalbar;
927
  nsRefPtr<nsBarProp>           mPersonalbar;
914
  nsRefPtr<nsBarProp>           mStatusbar;
928
  nsRefPtr<nsBarProp>           mStatusbar;
915
  nsRefPtr<nsBarProp>           mScrollbars;
929
  nsRefPtr<nsBarProp>           mScrollbars;
916
  nsCOMPtr<nsIWeakReference>    mWindowUtils;
930
  nsCOMPtr<nsIWeakReference>    mWindowUtils;
(-)5b8812d6950b (+277 lines)
Added Link Here 
Added Link Here 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is implementation of Web Timing draft specification
16
 * http://dev.w3.org/2006/webapi/WebTiming/
17
 *
18
 * The Initial Developer of the Original Code is Google Inc.
19
 * Portions created by the Initial Developer are Copyright (C) 2010
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Sergey Novikov <sergeyn@google.com> (original author)
24
 *   Igor Bazarny <igor.bazarny@gmail.com> (update to match bearly-final spec)
25
 *
26
 * Alternatively, the contents of this file may be used under the terms of
27
 * either of the GNU General Public License Version 2 or later (the "GPL"),
28
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
 * in which case the provisions of the GPL or the LGPL are applicable instead
30
 * of those above. If you wish to allow use of your version of this file only
31
 * under the terms of either the GPL or the LGPL, and not to allow others to
32
 * use your version of this file under the terms of the MPL, indicate your
33
 * decision by deleting the provisions above and replace them with the notice
34
 * and other provisions required by the GPL or the LGPL. If you do not delete
35
 * the provisions above, a recipient may use your version of this file under
36
 * the terms of any one of the MPL, the GPL or the LGPL.
37
 *
38
 * ***** END LICENSE BLOCK ***** */
39
40
#include "nsPerformance.h"
41
#include "nsCOMPtr.h"
42
#include "nscore.h"
43
#include "nsIDocShell.h"
44
#include "nsDOMClassInfo.h"
45
#include "nsDOMNavigationTiming.h"
46
47
DOMCI_DATA(PerformanceTiming, nsPerformanceTiming)
48
49
NS_IMPL_ADDREF(nsPerformanceTiming)
50
NS_IMPL_RELEASE(nsPerformanceTiming)
51
52
// QueryInterface implementation for nsPerformanceTiming
53
NS_INTERFACE_MAP_BEGIN(nsPerformanceTiming)
54
  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceTiming)
55
  NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceTiming)
56
  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(PerformanceTiming)
57
NS_INTERFACE_MAP_END
58
59
nsPerformanceTiming::nsPerformanceTiming(nsDOMNavigationTiming* aData)
60
{
61
  NS_ASSERTION(aData, "Timing data should be provided");
62
  mData = aData;
63
}
64
65
nsPerformanceTiming::~nsPerformanceTiming()
66
{
67
}
68
69
NS_IMETHODIMP
70
nsPerformanceTiming::GetNavigationStart(DOMTimeMilliSec* aTime)
71
{
72
  return mData->GetNavigationStart(aTime);
73
}
74
75
NS_IMETHODIMP
76
nsPerformanceTiming::GetUnloadEventStart(DOMTimeMilliSec* aTime)
77
{
78
  return mData->GetUnloadEventStart(aTime);
79
}
80
81
NS_IMETHODIMP
82
nsPerformanceTiming::GetUnloadEventEnd(DOMTimeMilliSec* aTime)
83
{
84
  return mData->GetUnloadEventEnd(aTime);
85
}
86
87
NS_IMETHODIMP
88
nsPerformanceTiming::GetRedirectStart(DOMTimeMilliSec* aTime)
89
{
90
  return mData->GetRedirectStart(aTime);
91
}
92
93
NS_IMETHODIMP
94
nsPerformanceTiming::GetRedirectEnd(DOMTimeMilliSec* aTime)
95
{
96
  return mData->GetRedirectEnd(aTime);
97
}
98
99
NS_IMETHODIMP
100
nsPerformanceTiming::GetFetchStart(DOMTimeMilliSec* aTime)
101
{
102
  return mData->GetFetchStart(aTime);
103
}
104
105
NS_IMETHODIMP
106
nsPerformanceTiming::GetDomainLookupStart(DOMTimeMilliSec* aTime)
107
{
108
  return mData->GetDomainLookupStart(aTime);
109
}
110
111
NS_IMETHODIMP
112
nsPerformanceTiming::GetDomainLookupEnd(DOMTimeMilliSec* aTime)
113
{
114
  return mData->GetDomainLookupEnd(aTime);
115
}
116
117
NS_IMETHODIMP
118
nsPerformanceTiming::GetConnectStart(DOMTimeMilliSec* aTime)
119
{
120
  return mData->GetConnectStart(aTime);
121
}
122
123
NS_IMETHODIMP
124
nsPerformanceTiming::GetConnectEnd(DOMTimeMilliSec* aTime)
125
{
126
  return mData->GetConnectEnd(aTime);
127
}
128
129
NS_IMETHODIMP
130
nsPerformanceTiming::GetHandshakeStart(DOMTimeMilliSec* aTime)
131
{
132
  return mData->GetHandshakeStart(aTime);
133
}
134
135
NS_IMETHODIMP
136
nsPerformanceTiming::GetRequestStart(DOMTimeMilliSec* aTime)
137
{
138
  return mData->GetRequestStart(aTime);
139
}
140
141
NS_IMETHODIMP
142
nsPerformanceTiming::GetResponseStart(DOMTimeMilliSec* aTime)
143
{
144
  return mData->GetResponseStart(aTime);
145
}
146
147
NS_IMETHODIMP
148
nsPerformanceTiming::GetResponseEnd(DOMTimeMilliSec* aTime)
149
{
150
  return mData->GetResponseEnd(aTime);
151
}
152
153
NS_IMETHODIMP
154
nsPerformanceTiming::GetDomLoading(DOMTimeMilliSec* aTime)
155
{
156
  return mData->GetDomLoading(aTime);
157
}
158
159
NS_IMETHODIMP
160
nsPerformanceTiming::GetDomInteractive(DOMTimeMilliSec* aTime)
161
{
162
  return mData->GetDomInteractive(aTime);
163
}
164
165
NS_IMETHODIMP
166
nsPerformanceTiming::GetDomContentLoadedEventStart(DOMTimeMilliSec* aTime)
167
{
168
  return mData->GetDomContentLoadedEventStart(aTime);
169
}
170
171
NS_IMETHODIMP
172
nsPerformanceTiming::GetDomContentLoadedEventEnd(DOMTimeMilliSec* aTime)
173
{
174
  return mData->GetDomContentLoadedEventEnd(aTime);
175
}
176
177
NS_IMETHODIMP
178
nsPerformanceTiming::GetDomComplete(DOMTimeMilliSec* aTime)
179
{
180
  return mData->GetDomComplete(aTime);
181
}
182
183
NS_IMETHODIMP
184
nsPerformanceTiming::GetLoadEventStart(DOMTimeMilliSec* aTime)
185
{
186
  return mData->GetLoadEventStart(aTime);
187
}
188
189
NS_IMETHODIMP
190
nsPerformanceTiming::GetLoadEventEnd(DOMTimeMilliSec* aTime)
191
{
192
  return mData->GetLoadEventEnd(aTime);
193
}
194
195
196
197
DOMCI_DATA(PerformanceNavigation, nsPerformanceNavigation)
198
199
NS_IMPL_ADDREF(nsPerformanceNavigation)
200
NS_IMPL_RELEASE(nsPerformanceNavigation)
201
202
// QueryInterface implementation for nsPerformanceNavigation
203
NS_INTERFACE_MAP_BEGIN(nsPerformanceNavigation)
204
  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceNavigation)
205
  NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceNavigation)
206
  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(PerformanceNavigation)
207
NS_INTERFACE_MAP_END
208
209
nsPerformanceNavigation::nsPerformanceNavigation(nsDOMNavigationTiming* aData)
210
{
211
  NS_ASSERTION(aData, "Timing data should be provided");
212
  mData = aData;
213
}
214
215
nsPerformanceNavigation::~nsPerformanceNavigation()
216
{
217
}
218
219
NS_IMETHODIMP
220
nsPerformanceNavigation::GetType(
221
    nsDOMPerformanceNavigationType* aNavigationType)
222
{
223
  return mData->GetType(aNavigationType);
224
}
225
226
NS_IMETHODIMP
227
nsPerformanceNavigation::GetRedirectCount(PRUint16* aRedirectCount)
228
{
229
  return mData->GetRedirectCount(aRedirectCount);
230
}
231
232
233
DOMCI_DATA(Performance, nsPerformance)
234
235
NS_IMPL_ADDREF(nsPerformance)
236
NS_IMPL_RELEASE(nsPerformance)
237
238
nsPerformance::nsPerformance(nsDOMNavigationTiming* aTiming)
239
{
240
  NS_ASSERTION(aTiming, "Timing data should be provided");
241
  mData = aTiming;
242
}
243
244
nsPerformance::~nsPerformance()
245
{
246
}
247
248
// QueryInterface implementation for nsPerformance
249
NS_INTERFACE_MAP_BEGIN(nsPerformance)
250
  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformance)
251
  NS_INTERFACE_MAP_ENTRY(nsIDOMPerformance)
252
  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Performance)
253
NS_INTERFACE_MAP_END
254
255
//
256
// nsIDOMPerformance methods
257
//
258
NS_IMETHODIMP
259
nsPerformance::GetTiming(nsIDOMPerformanceTiming** aTiming)
260
{
261
  if (!mTiming) {
262
    mTiming = new nsPerformanceTiming(mData);
263
  }
264
  NS_IF_ADDREF(*aTiming = mTiming);
265
  return NS_OK; 
266
}
267
268
NS_IMETHODIMP
269
nsPerformance::GetNavigation(nsIDOMPerformanceNavigation** aNavigation)
270
{
271
  if (!mNavigation) {
272
    mNavigation = new nsPerformanceNavigation(mData);
273
  }
274
  NS_IF_ADDREF(*aNavigation = mNavigation);
275
  return NS_OK; 
276
}
277
(-)5b8812d6950b (+95 lines)
Added Link Here 
Added Link Here 
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is implementation of Web Timing draft specification
16
 * http://dev.w3.org/2006/webapi/WebTiming/
17
 *
18
 * The Initial Developer of the Original Code is Google Inc.
19
 * Portions created by the Initial Developer are Copyright (C) 2010
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Sergey Novikov <sergeyn@google.com> (original author)
24
 *   Igor Bazarny <igor.bazarny@gmail.com> (update to match bearly-final spec)
25
 *
26
 * Alternatively, the contents of this file may be used under the terms of
27
 * either of the GNU General Public License Version 2 or later (the "GPL"),
28
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
 * in which case the provisions of the GPL or the LGPL are applicable instead
30
 * of those above. If you wish to allow use of your version of this file only
31
 * under the terms of either the GPL or the LGPL, and not to allow others to
32
 * use your version of this file under the terms of the MPL, indicate your
33
 * decision by deleting the provisions above and replace them with the notice
34
 * and other provisions required by the GPL or the LGPL. If you do not delete
35
 * the provisions above, a recipient may use your version of this file under
36
 * the terms of any one of the MPL, the GPL or the LGPL.
37
 *
38
 * ***** END LICENSE BLOCK ***** */
39
#ifndef nsPerformance_h___
40
#define nsPerformance_h___
41
42
#include "nsIDOMPerformance.h"
43
#include "nsIDOMPerformanceTiming.h"
44
#include "nsIDOMPerformanceNavigation.h"
45
#include "nscore.h"
46
#include "nsCOMPtr.h"
47
#include "nsAutoPtr.h"
48
49
class nsIDocument;
50
class nsIURI;
51
class nsDOMNavigationTiming;
52
53
// Script "performance.timing" object
54
class nsPerformanceTiming : public nsIDOMPerformanceTiming
55
{
56
public:
57
  nsPerformanceTiming(nsDOMNavigationTiming* data);
58
  NS_DECL_ISUPPORTS
59
  NS_DECL_NSIDOMPERFORMANCETIMING
60
private:
61
  ~nsPerformanceTiming();
62
  nsRefPtr<nsDOMNavigationTiming> mData;
63
};
64
65
// Script "performance.navigation" object
66
class nsPerformanceNavigation : public nsIDOMPerformanceNavigation
67
{
68
public:
69
  nsPerformanceNavigation(nsDOMNavigationTiming* data);
70
  NS_DECL_ISUPPORTS
71
  NS_DECL_NSIDOMPERFORMANCENAVIGATION
72
private:
73
  ~nsPerformanceNavigation();
74
  nsRefPtr<nsDOMNavigationTiming> mData;
75
};
76
77
// Script "performance" object
78
class nsPerformance : public nsIDOMPerformance
79
{
80
public:
81
  nsPerformance(nsDOMNavigationTiming* timing);
82
83
  NS_DECL_ISUPPORTS
84
  NS_DECL_NSIDOMPERFORMANCE
85
86
private:
87
  ~nsPerformance();
88
89
  nsRefPtr<nsDOMNavigationTiming> mData;
90
  nsCOMPtr<nsIDOMPerformanceTiming> mTiming;
91
  nsCOMPtr<nsIDOMPerformanceNavigation> mNavigation;
92
};
93
94
#endif /* nsPerformance_h___ */
95
(-)a/dom/interfaces/base/Makefile.in (+3 lines)
Line     Link Here 
 Lines 81-91   XPIDLSRCS = \ Link Here 
81
	nsIDOMNSFeatureFactory.idl		\
81
	nsIDOMNSFeatureFactory.idl		\
82
        nsIDOMClientRect.idl			\
82
        nsIDOMClientRect.idl			\
83
        nsIDOMClientRectList.idl		\
83
        nsIDOMClientRectList.idl		\
84
	nsIFocusManager.idl			\
84
	nsIFocusManager.idl			\
85
	nsIQueryContentEventResult.idl		\
85
	nsIQueryContentEventResult.idl		\
86
	nsITabChild.idl				\
86
	nsITabChild.idl				\
87
	nsITabParent.idl			\
87
	nsITabParent.idl			\
88
	nsIDOMGlobalPropertyInitializer.idl	\
88
	nsIDOMGlobalPropertyInitializer.idl	\
89
	nsIDOMPerformance.idl			\
90
	nsIDOMPerformanceTiming.idl		\
91
	nsIDOMPerformanceNavigation.idl		\
89
	$(NULL)
92
	$(NULL)
90
93
91
include $(topsrcdir)/config/rules.mk
94
include $(topsrcdir)/config/rules.mk
(-)a/dom/interfaces/base/domstubs.idl (+1 lines)
Line     Link Here 
 Lines 35-50    Link Here 
35
 * the provisions above, a recipient may use your version of this file under
35
 * the provisions above, a recipient may use your version of this file under
36
 * the terms of any one of the MPL, the GPL or the LGPL.
36
 * the terms of any one of the MPL, the GPL or the LGPL.
37
 *
37
 *
38
 * ***** END LICENSE BLOCK ***** */
38
 * ***** END LICENSE BLOCK ***** */
39
39
40
#include "nsISupports.idl"
40
#include "nsISupports.idl"
41
41
42
typedef unsigned long long DOMTimeStamp;
42
typedef unsigned long long DOMTimeStamp;
43
typedef unsigned long long DOMTimeMilliSec;
43
44
44
// Core
45
// Core
45
interface nsIDOMAttr;
46
interface nsIDOMAttr;
46
interface nsIDOMCDATASection;
47
interface nsIDOMCDATASection;
47
interface nsIDOMCharacterData;
48
interface nsIDOMCharacterData;
48
interface nsIDOMComment;
49
interface nsIDOMComment;
49
interface nsIDOMDOMImplementation;
50
interface nsIDOMDOMImplementation;
50
interface nsIDOMDocument;
51
interface nsIDOMDocument;
(-)5b8812d6950b (+50 lines)
Added Link Here 
Added Link Here 
1
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is implementation of Web Timing draft specification
16
 * http://dev.w3.org/2006/webapi/WebTiming/
17
 *
18
 * The Initial Developer of the Original Code is Google Inc.
19
 * Portions created by the Initial Developer are Copyright (C) 2010
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Sergey Novikov <sergeyn@google.com> (original author)
24
 *   Igor Bazarny <igor.bazarny@gmail.com> (update to match nearly-final spec)
25
 *
26
 * Alternatively, the contents of this file may be used under the terms of
27
 * either of the GNU General Public License Version 2 or later (the "GPL"),
28
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
 * in which case the provisions of the GPL or the LGPL are applicable instead
30
 * of those above. If you wish to allow use of your version of this file only
31
 * under the terms of either the GPL or the LGPL, and not to allow others to
32
 * use your version of this file under the terms of the MPL, indicate your
33
 * decision by deleting the provisions above and replace them with the notice
34
 * and other provisions required by the GPL or the LGPL. If you do not delete
35
 * the provisions above, a recipient may use your version of this file under
36
 * the terms of any one of the MPL, the GPL or the LGPL.
37
 *
38
 * ***** END LICENSE BLOCK ***** */
39
40
#include "nsISupports.idl"
41
interface nsIDOMPerformanceTiming;
42
interface nsIDOMPerformanceNavigation;
43
44
[scriptable, uuid(446faf26-000b-4e66-a5fd-ae37c5ed6beb)]
45
interface nsIDOMPerformance : nsISupports
46
{
47
  readonly attribute nsIDOMPerformanceTiming timing;
48
  readonly attribute nsIDOMPerformanceNavigation navigation;
49
};
50
(-)5b8812d6950b (+55 lines)
Added Link Here 
Added Link Here 
1
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is implementation of Web Timing draft specification
16
 * http://dev.w3.org/2006/webapi/WebTiming/
17
 *
18
 * The Initial Developer of the Original Code is Google Inc.
19
 * Portions created by the Initial Developer are Copyright (C) 2010
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Sergey Novikov <sergeyn@google.com> (original author)
24
 *   Igor Bazarny <igor.bazarny@gmail.com> (update to match nearly-final spec)
25
 *
26
 * Alternatively, the contents of this file may be used under the terms of
27
 * either of the GNU General Public License Version 2 or later (the "GPL"),
28
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
 * in which case the provisions of the GPL or the LGPL are applicable instead
30
 * of those above. If you wish to allow use of your version of this file only
31
 * under the terms of either the GPL or the LGPL, and not to allow others to
32
 * use your version of this file under the terms of the MPL, indicate your
33
 * decision by deleting the provisions above and replace them with the notice
34
 * and other provisions required by the GPL or the LGPL. If you do not delete
35
 * the provisions above, a recipient may use your version of this file under
36
 * the terms of any one of the MPL, the GPL or the LGPL.
37
 *
38
 * ***** END LICENSE BLOCK ***** */
39
40
#include "domstubs.idl"
41
42
typedef unsigned short nsDOMPerformanceNavigationType;
43
44
[scriptable, uuid(a2132ad8-a841-4285-a140-338e8de6c2e0)]
45
interface nsIDOMPerformanceNavigation : nsISupports
46
{
47
  const nsDOMPerformanceNavigationType TYPE_NAVIGATE = 0;
48
  const nsDOMPerformanceNavigationType TYPE_RELOAD = 1;
49
  const nsDOMPerformanceNavigationType TYPE_BACK_FORWARD = 2;
50
  const nsDOMPerformanceNavigationType TYPE_RESERVED = 255;
51
52
  readonly attribute nsDOMPerformanceNavigationType type;
53
  readonly attribute unsigned short redirectCount;
54
};
55
(-)5b8812d6950b (+67 lines)
Added Link Here 
Added Link Here 
1
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 *
5
 * The contents of this file are subject to the Mozilla Public License Version
6
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 * the License. You may obtain a copy of the License at
8
 * http://www.mozilla.org/MPL/
9
 *
10
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 * for the specific language governing rights and limitations under the
13
 * License.
14
 *
15
 * The Original Code is implementation of Web Timing draft specification
16
 * http://dev.w3.org/2006/webapi/WebTiming/
17
 *
18
 * The Initial Developer of the Original Code is Google Inc.
19
 * Portions created by the Initial Developer are Copyright (C) 2010
20
 * the Initial Developer. All Rights Reserved.
21
 *
22
 * Contributor(s):
23
 *   Sergey Novikov <sergeyn@google.com> (original author)
24
 *   Igor Bazarny <igor.bazarny@gmail.com> (update to match nearly-final spec)
25
 *
26
 * Alternatively, the contents of this file may be used under the terms of
27
 * either of the GNU General Public License Version 2 or later (the "GPL"),
28
 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
 * in which case the provisions of the GPL or the LGPL are applicable instead
30
 * of those above. If you wish to allow use of your version of this file only
31
 * under the terms of either the GPL or the LGPL, and not to allow others to
32
 * use your version of this file under the terms of the MPL, indicate your
33
 * decision by deleting the provisions above and replace them with the notice
34
 * and other provisions required by the GPL or the LGPL. If you do not delete
35
 * the provisions above, a recipient may use your version of this file under
36
 * the terms of any one of the MPL, the GPL or the LGPL.
37
 *
38
 * ***** END LICENSE BLOCK ***** */
39
40
#include "domstubs.idl"
41
42
[scriptable, uuid(2a630b50-61b6-41b3-996d-70be67fbbcb0)]
43
interface nsIDOMPerformanceTiming : nsISupports
44
{
45
  readonly attribute DOMTimeMilliSec navigationStart;
46
  readonly attribute DOMTimeMilliSec unloadEventStart;
47
  readonly attribute DOMTimeMilliSec unloadEventEnd;
48
  readonly attribute DOMTimeMilliSec redirectStart;
49
  readonly attribute DOMTimeMilliSec redirectEnd;
50
  readonly attribute DOMTimeMilliSec fetchStart;
51
  readonly attribute DOMTimeMilliSec domainLookupStart;
52
  readonly attribute DOMTimeMilliSec domainLookupEnd;
53
  readonly attribute DOMTimeMilliSec connectStart;
54
  readonly attribute DOMTimeMilliSec connectEnd;
55
  readonly attribute DOMTimeMilliSec handshakeStart;
56
  readonly attribute DOMTimeMilliSec requestStart;
57
  readonly attribute DOMTimeMilliSec responseStart;
58
  readonly attribute DOMTimeMilliSec responseEnd;
59
  readonly attribute DOMTimeMilliSec domLoading;
60
  readonly attribute DOMTimeMilliSec domInteractive;
61
  readonly attribute DOMTimeMilliSec domContentLoadedEventStart;
62
  readonly attribute DOMTimeMilliSec domContentLoadedEventEnd;
63
  readonly attribute DOMTimeMilliSec domComplete;
64
  readonly attribute DOMTimeMilliSec loadEventStart;
65
  readonly attribute DOMTimeMilliSec loadEventEnd;
66
};
67
(-)a/dom/interfaces/base/nsIDOMWindowInternal.idl (-1 / +12 lines)
Line     Link Here 
 Lines 37-56    Link Here 
37
 *
37
 *
38
 * ***** END LICENSE BLOCK ***** */
38
 * ***** END LICENSE BLOCK ***** */
39
39
40
#include "nsIDOMWindow2.idl"
40
#include "nsIDOMWindow2.idl"
41
41
42
interface nsIPrompt;
42
interface nsIPrompt;
43
interface nsIControllers;
43
interface nsIControllers;
44
interface nsIDOMLocation;
44
interface nsIDOMLocation;
45
interface nsIDOMPerformance;
45
interface nsIVariant;
46
interface nsIVariant;
46
interface nsIAnimationFrameListener;
47
interface nsIAnimationFrameListener;
47
48
48
[scriptable, uuid(9d6a1157-0719-46a7-b49f-7ffeaa0b5c86)]
49
[scriptable, uuid(5930f197-259e-4f6b-aeca-c96a74518cc6)]
49
interface nsIDOMWindowInternal : nsIDOMWindow2
50
interface nsIDOMWindowInternal : nsIDOMWindow2
50
{
51
{
51
  readonly attribute nsIDOMWindowInternal        window;
52
  readonly attribute nsIDOMWindowInternal        window;
52
53
53
  /* [replaceable] self */
54
  /* [replaceable] self */
54
  readonly attribute nsIDOMWindowInternal        self;
55
  readonly attribute nsIDOMWindowInternal        self;
55
56
56
  readonly attribute nsIDOMNavigator             navigator;
57
  readonly attribute nsIDOMNavigator             navigator;
 Lines 241-248   interface nsIDOMMozURLProperty : nsISupp Link Here 
241
  void revokeObjectURL(in DOMString URL);
242
  void revokeObjectURL(in DOMString URL);
242
};
243
};
243
244
244
[scriptable, uuid(05563c0c-b74c-41ad-91d1-bc22d580a581)]
245
[scriptable, uuid(05563c0c-b74c-41ad-91d1-bc22d580a581)]
245
interface nsIDOMWindow_2_0_BRANCH : nsISupports
246
interface nsIDOMWindow_2_0_BRANCH : nsISupports
246
{
247
{
247
  readonly attribute nsIDOMMozURLProperty URL;
248
  readonly attribute nsIDOMMozURLProperty URL;
248
};
249
};
250
251
[scriptable, uuid(2146c906-57f7-486c-a1b4-8cdb57ef577f)]
252
interface nsIDOMWindowPerformance : nsISupports
253
{
254
  /**
255
   * A namespace to hold performance related data and statistics.
256
   */
257
  readonly attribute nsIDOMPerformance performance;
258
};
259
(-)a/layout/base/nsDocumentViewer.cpp (+21 lines)
Line     Link Here 
 Lines 113-128    Link Here 
113
#include "nsIXULDocument.h"
113
#include "nsIXULDocument.h"
114
#include "nsXULPopupManager.h"
114
#include "nsXULPopupManager.h"
115
#endif
115
#endif
116
#include "nsPrintfCString.h"
116
#include "nsPrintfCString.h"
117
117
118
#include "nsIClipboardHelper.h"
118
#include "nsIClipboardHelper.h"
119
119
120
#include "nsPIDOMWindow.h"
120
#include "nsPIDOMWindow.h"
121
#include "nsDOMNavigationTiming.h"
121
#include "nsPIWindowRoot.h"
122
#include "nsPIWindowRoot.h"
122
#include "nsJSEnvironment.h"
123
#include "nsJSEnvironment.h"
123
#include "nsFocusManager.h"
124
#include "nsFocusManager.h"
124
125
125
#include "nsIScrollableFrame.h"
126
#include "nsIScrollableFrame.h"
126
#include "nsIHTMLDocument.h"
127
#include "nsIHTMLDocument.h"
127
#include "nsITimelineService.h"
128
#include "nsITimelineService.h"
128
#include "nsGfxCIID.h"
129
#include "nsGfxCIID.h"
 Lines 330-345   public: Link Here 
330
  /**
331
  /**
331
   * Find the view to use as the container view for MakeWindow. Returns
332
   * Find the view to use as the container view for MakeWindow. Returns
332
   * null if this will be the root of a view manager hierarchy. In that
333
   * null if this will be the root of a view manager hierarchy. In that
333
   * case, if mParentWidget is null then this document should not even
334
   * case, if mParentWidget is null then this document should not even
334
   * be displayed.
335
   * be displayed.
335
   */
336
   */
336
  virtual nsIView* FindContainerView();
337
  virtual nsIView* FindContainerView();
337
338
339
  /**
340
   * Set collector for navigation timing data (load, unload events).
341
   */
342
  virtual void SetNavigationTiming(nsDOMNavigationTiming* timing);
343
338
  // nsIContentViewerEdit
344
  // nsIContentViewerEdit
339
  NS_DECL_NSICONTENTVIEWEREDIT
345
  NS_DECL_NSICONTENTVIEWEREDIT
340
346
341
  // nsIContentViewerFile
347
  // nsIContentViewerFile
342
  NS_DECL_NSICONTENTVIEWERFILE
348
  NS_DECL_NSICONTENTVIEWERFILE
343
349
344
  // nsIMarkupDocumentViewer
350
  // nsIMarkupDocumentViewer
345
  NS_DECL_NSIMARKUPDOCUMENTVIEWER
351
  NS_DECL_NSIMARKUPDOCUMENTVIEWER
 Lines 988-1003   DocumentViewerImpl::InitInternal(nsIWidg Link Here 
988
    // MakeWindow())...
994
    // MakeWindow())...
989
995
990
    rv = InitPresentationStuff(!makeCX);
996
    rv = InitPresentationStuff(!makeCX);
991
  }
997
  }
992
998
993
  return rv;
999
  return rv;
994
}
1000
}
995
1001
1002
void DocumentViewerImpl::SetNavigationTiming(nsDOMNavigationTiming* timing)
1003
{
1004
  NS_ASSERTION(mDocument, "Must have a document to set navigation timing.");
1005
  if (mDocument) {
1006
    mDocument->SetNavigationTiming(timing);
1007
  }
1008
}
1009
996
//
1010
//
997
// LoadComplete(aStatus)
1011
// LoadComplete(aStatus)
998
//
1012
//
999
//   aStatus - The status returned from loading the document.
1013
//   aStatus - The status returned from loading the document.
1000
//
1014
//
1001
// This method is called by the container when the document has been
1015
// This method is called by the container when the document has been
1002
// completely loaded.
1016
// completely loaded.
1003
//
1017
//
 Lines 1049-1066   DocumentViewerImpl::LoadComplete(nsresul Link Here 
1049
    // onload to the document content since that would likely confuse scripts
1063
    // onload to the document content since that would likely confuse scripts
1050
    // on the page.
1064
    // on the page.
1051
1065
1052
    nsIDocShell *docShell = window->GetDocShell();
1066
    nsIDocShell *docShell = window->GetDocShell();
1053
    NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED);
1067
    NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED);
1054
1068
1055
    docShell->GetRestoringDocument(&restoring);
1069
    docShell->GetRestoringDocument(&restoring);
1056
    if (!restoring) {
1070
    if (!restoring) {
1071
      nsDOMNavigationTiming* timing = mDocument->GetNavigationTiming();
1072
      if (timing) {
1073
        timing->NotifyLoadEventStart();
1074
      }
1057
      nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull,
1075
      nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull,
1058
                                  &status);
1076
                                  &status);
1077
      if (timing) {
1078
        timing->NotifyLoadEventEnd();
1079
      }
1059
#ifdef MOZ_TIMELINE
1080
#ifdef MOZ_TIMELINE
1060
      // if navigator.xul's load is complete, the main nav window is visible
1081
      // if navigator.xul's load is complete, the main nav window is visible
1061
      // mark that point.
1082
      // mark that point.
1062
1083
1063
      nsIURI *uri = mDocument ? mDocument->GetDocumentURI() : nsnull;
1084
      nsIURI *uri = mDocument ? mDocument->GetDocumentURI() : nsnull;
1064
1085
1065
      if (uri) {
1086
      if (uri) {
1066
        //printf("DEBUG: getting spec for uri (%p)\n", uri.get());
1087
        //printf("DEBUG: getting spec for uri (%p)\n", uri.get());
(-)a/layout/base/nsIDocumentViewer.h (+4 lines)
Line     Link Here 
 Lines 43-58    Link Here 
43
#include "nsIContentViewer.h"
43
#include "nsIContentViewer.h"
44
44
45
class nsIDocument;
45
class nsIDocument;
46
class nsPresContext;
46
class nsPresContext;
47
class nsIPresShell;
47
class nsIPresShell;
48
class nsIStyleSheet;
48
class nsIStyleSheet;
49
class nsIView;
49
class nsIView;
50
50
51
class nsDOMNavigationTiming;
52
51
#define NS_IDOCUMENT_VIEWER_IID \
53
#define NS_IDOCUMENT_VIEWER_IID \
52
  { 0x5a5c9a1d, 0x49c4, 0x4f3f, \
54
  { 0x5a5c9a1d, 0x49c4, 0x4f3f, \
53
    { 0x80, 0xcd, 0x12, 0x09, 0x5b, 0x1e, 0x1f, 0x61 } }
55
    { 0x80, 0xcd, 0x12, 0x09, 0x5b, 0x1e, 0x1f, 0x61 } }
54
56
55
/**
57
/**
56
 * A document viewer is a kind of content viewer that uses NGLayout
58
 * A document viewer is a kind of content viewer that uses NGLayout
57
 * to manage the presentation of the content.
59
 * to manage the presentation of the content.
58
 */
60
 */
 Lines 64-76   public: Link Here 
64
  NS_IMETHOD GetPresShell(nsIPresShell** aResult) = 0;
66
  NS_IMETHOD GetPresShell(nsIPresShell** aResult) = 0;
65
  
67
  
66
  NS_IMETHOD GetPresContext(nsPresContext** aResult) = 0;
68
  NS_IMETHOD GetPresContext(nsPresContext** aResult) = 0;
67
69
68
  NS_IMETHOD SetDocumentInternal(nsIDocument* aDocument,
70
  NS_IMETHOD SetDocumentInternal(nsIDocument* aDocument,
69
                                 PRBool aForceReuseInnerWindow) = 0;
71
                                 PRBool aForceReuseInnerWindow) = 0;
70
72
71
  virtual nsIView* FindContainerView() = 0;
73
  virtual nsIView* FindContainerView() = 0;
74
75
  virtual void SetNavigationTiming(nsDOMNavigationTiming* timing) = 0;
72
};
76
};
73
77
74
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewer, NS_IDOCUMENT_VIEWER_IID)
78
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewer, NS_IDOCUMENT_VIEWER_IID)
75
79
76
#endif /* nsIDocumentViewer_h___ */
80
#endif /* nsIDocumentViewer_h___ */

Return to bug 570341
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载