+

Attachment #541145: updated per review comment for bug #570341

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

(-)a/content/base/public/nsIDocument.h (+5 lines)
Line     Link Here 
 Lines 105-120   class nsIDocumentObserver; Link Here 
105
class nsBindingManager;
105
class nsBindingManager;
106
class nsIDOMNodeList;
106
class nsIDOMNodeList;
107
class mozAutoSubtreeModified;
107
class mozAutoSubtreeModified;
108
struct JSObject;
108
struct JSObject;
109
class nsFrameLoader;
109
class nsFrameLoader;
110
class nsIBoxObject;
110
class nsIBoxObject;
111
class imgIRequest;
111
class imgIRequest;
112
class nsISHEntry;
112
class nsISHEntry;
113
class nsDOMNavigationTiming;
113
114
114
namespace mozilla {
115
namespace mozilla {
115
namespace css {
116
namespace css {
116
class Loader;
117
class Loader;
117
} // namespace css
118
} // namespace css
118
119
119
namespace dom {
120
namespace dom {
120
class Link;
121
class Link;
 Lines 1513-1528   public: Link Here 
1513
  virtual nsresult RemoveImage(imgIRequest* aImage) = 0;
1514
  virtual nsresult RemoveImage(imgIRequest* aImage) = 0;
1514
1515
1515
  // Makes the images on this document locked/unlocked. By default, the locking
1516
  // Makes the images on this document locked/unlocked. By default, the locking
1516
  // state is unlocked/false.
1517
  // state is unlocked/false.
1517
  virtual nsresult SetImageLockingState(PRBool aLocked) = 0;
1518
  virtual nsresult SetImageLockingState(PRBool aLocked) = 0;
1518
1519
1519
  virtual nsresult GetStateObject(nsIVariant** aResult) = 0;
1520
  virtual nsresult GetStateObject(nsIVariant** aResult) = 0;
1520
1521
1522
  virtual nsDOMNavigationTiming* GetNavigationTiming() const = 0;
1523
1524
  virtual nsresult SetNavigationTiming(nsDOMNavigationTiming* aTiming) = 0;
1525
1521
  virtual Element* FindImageMap(const nsAString& aNormalizedMapName) = 0;
1526
  virtual Element* FindImageMap(const nsAString& aNormalizedMapName) = 0;
1522
1527
1523
protected:
1528
protected:
1524
  ~nsIDocument()
1529
  ~nsIDocument()
1525
  {
1530
  {
1526
    // XXX The cleanup of mNodeInfoManager (calling DropDocumentReference and
1531
    // XXX The cleanup of mNodeInfoManager (calling DropDocumentReference and
1527
    //     releasing it) happens in the nsDocument destructor. We'd prefer to
1532
    //     releasing it) happens in the nsDocument destructor. We'd prefer to
1528
    //     do it here but nsNodeInfoManager is a concrete class that we don't
1533
    //     do it here but nsNodeInfoManager is a concrete class that we don't
(-)a/content/base/src/Makefile.in (+1 lines)
Line     Link Here 
 Lines 206-216   INCLUDES += \ Link Here 
206
		-I$(srcdir)/../../../layout/style \
206
		-I$(srcdir)/../../../layout/style \
207
		-I$(srcdir)/../../../dom/base \
207
		-I$(srcdir)/../../../dom/base \
208
		-I$(srcdir)/../../xml/document/src \
208
		-I$(srcdir)/../../xml/document/src \
209
		-I$(topsrcdir)/xpcom/io \
209
		-I$(topsrcdir)/xpcom/io \
210
		-I$(topsrcdir)/dom/ipc \
210
		-I$(topsrcdir)/dom/ipc \
211
		-I$(topsrcdir)/js/src/xpconnect/src \
211
		-I$(topsrcdir)/js/src/xpconnect/src \
212
		-I$(topsrcdir)/caps/include \
212
		-I$(topsrcdir)/caps/include \
213
		-I$(topsrcdir)/netwerk/base/src \
213
		-I$(topsrcdir)/netwerk/base/src \
214
		-I$(topsrcdir)/xpcom/ds \
214
		$(NULL)
215
		$(NULL)
215
216
216
DEFINES += -D_IMPL_NS_LAYOUT
217
DEFINES += -D_IMPL_NS_LAYOUT
(-)a/content/base/src/nsDocument.cpp (+45 lines)
Line     Link Here 
 Lines 178-193   static NS_DEFINE_CID(kDOMEventGroupCID, Link Here 
178
#include "nsEscape.h"
178
#include "nsEscape.h"
179
#ifdef MOZ_MEDIA
179
#ifdef MOZ_MEDIA
180
#include "nsHTMLMediaElement.h"
180
#include "nsHTMLMediaElement.h"
181
#endif // MOZ_MEDIA
181
#endif // MOZ_MEDIA
182
182
183
#include "mozAutoDocUpdate.h"
183
#include "mozAutoDocUpdate.h"
184
#include "nsGlobalWindow.h"
184
#include "nsGlobalWindow.h"
185
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
185
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
186
#include "nsDOMNavigationTiming.h"
186
187
187
#ifdef MOZ_SMIL
188
#ifdef MOZ_SMIL
188
#include "nsSMILAnimationController.h"
189
#include "nsSMILAnimationController.h"
189
#include "imgIContainer.h"
190
#include "imgIContainer.h"
190
#include "nsSVGUtils.h"
191
#include "nsSVGUtils.h"
191
#endif // MOZ_SMIL
192
#endif // MOZ_SMIL
192
193
193
#include "nsRefreshDriver.h"
194
#include "nsRefreshDriver.h"
 Lines 4104-4127   void Link Here 
4104
nsDocument::DispatchContentLoadedEvents()
4105
nsDocument::DispatchContentLoadedEvents()
4105
{
4106
{
4106
  NS_TIME_FUNCTION;
4107
  NS_TIME_FUNCTION;
4107
  // If you add early returns from this method, make sure you're
4108
  // If you add early returns from this method, make sure you're
4108
  // calling UnblockOnload properly.
4109
  // calling UnblockOnload properly.
4109
  
4110
  
4110
  // Unpin references to preloaded images
4111
  // Unpin references to preloaded images
4111
  mPreloadingImages.Clear();
4112
  mPreloadingImages.Clear();
4113
4114
  if (mTiming) {
4115
    mTiming->NotifyDOMContentLoadedStart(nsIDocument::GetDocumentURI());
4116
  }
4112
    
4117
    
4113
  // Fire a DOM event notifying listeners that this document has been
4118
  // Fire a DOM event notifying listeners that this document has been
4114
  // loaded (excluding images and other loads initiated by this
4119
  // loaded (excluding images and other loads initiated by this
4115
  // document).
4120
  // document).
4116
  nsContentUtils::DispatchTrustedEvent(this, static_cast<nsIDocument*>(this),
4121
  nsContentUtils::DispatchTrustedEvent(this, static_cast<nsIDocument*>(this),
4117
                                       NS_LITERAL_STRING("DOMContentLoaded"),
4122
                                       NS_LITERAL_STRING("DOMContentLoaded"),
4118
                                       PR_TRUE, PR_TRUE);
4123
                                       PR_TRUE, PR_TRUE);
4119
4124
4125
  if (mTiming) {
4126
    mTiming->NotifyDOMContentLoadedEnd(nsIDocument::GetDocumentURI());
4127
  }
4128
4120
  // If this document is a [i]frame, fire a DOMFrameContentLoaded
4129
  // If this document is a [i]frame, fire a DOMFrameContentLoaded
4121
  // event on all parent documents notifying that the HTML (excluding
4130
  // event on all parent documents notifying that the HTML (excluding
4122
  // other external files such as images and stylesheets) in a frame
4131
  // other external files such as images and stylesheets) in a frame
4123
  // has finished loading.
4132
  // has finished loading.
4124
4133
4125
  // target_frame is the [i]frame element that will be used as the
4134
  // target_frame is the [i]frame element that will be used as the
4126
  // target for the event. It's the [i]frame whose content is done
4135
  // target for the event. It's the [i]frame whose content is done
4127
  // loading.
4136
  // loading.
 Lines 7734-7749   nsDocument::CloneDocHelper(nsDocument* c Link Here 
7734
  clone->mBaseTarget = mBaseTarget;
7743
  clone->mBaseTarget = mBaseTarget;
7735
  return NS_OK;
7744
  return NS_OK;
7736
}
7745
}
7737
7746
7738
void
7747
void
7739
nsDocument::SetReadyStateInternal(ReadyState rs)
7748
nsDocument::SetReadyStateInternal(ReadyState rs)
7740
{
7749
{
7741
  mReadyState = rs;
7750
  mReadyState = rs;
7751
  if (mTiming) {
7752
    switch (rs) {
7753
      case READYSTATE_LOADING:
7754
        mTiming->NotifyDOMLoading(nsIDocument::GetDocumentURI());
7755
        break;
7756
      case READYSTATE_INTERACTIVE:
7757
        mTiming->NotifyDOMInteractive(nsIDocument::GetDocumentURI());
7758
        break;
7759
      case READYSTATE_COMPLETE:
7760
        mTiming->NotifyDOMComplete(nsIDocument::GetDocumentURI());
7761
        break;
7762
      default:
7763
        NS_WARNING("Unexpected ReadyState value");
7764
        break;
7765
    }
7766
  }
7767
  // At the time of loading start, we don't have timing object, record time.
7768
  if (READYSTATE_LOADING == rs) {
7769
    mLoadingTimeStamp = mozilla::TimeStamp::Now();
7770
  }
7742
7771
7743
  nsRefPtr<nsPLDOMEvent> plevent =
7772
  nsRefPtr<nsPLDOMEvent> plevent =
7744
    new nsPLDOMEvent(this, NS_LITERAL_STRING("readystatechange"), PR_FALSE, PR_FALSE); 
7773
    new nsPLDOMEvent(this, NS_LITERAL_STRING("readystatechange"), PR_FALSE, PR_FALSE); 
7745
  if (plevent) {
7774
  if (plevent) {
7746
    plevent->RunDOMEventWhenSafe();
7775
    plevent->RunDOMEventWhenSafe();
7747
  }
7776
  }
7748
}
7777
}
7749
7778
 Lines 8202-8217   nsDocument::GetStateObject(nsIVariant** Link Here 
8202
      DeserializeToVariant(cx, getter_AddRefs(mStateObjectCached));
8231
      DeserializeToVariant(cx, getter_AddRefs(mStateObjectCached));
8203
  }
8232
  }
8204
8233
8205
  NS_IF_ADDREF(*aState = mStateObjectCached);
8234
  NS_IF_ADDREF(*aState = mStateObjectCached);
8206
  
8235
  
8207
  return NS_OK;
8236
  return NS_OK;
8208
}
8237
}
8209
8238
8239
nsDOMNavigationTiming*
8240
nsDocument::GetNavigationTiming() const
8241
{
8242
  return mTiming;
8243
}
8244
8245
nsresult
8246
nsDocument::SetNavigationTiming(nsDOMNavigationTiming* aTiming)
8247
{
8248
  mTiming = aTiming;
8249
  if (!mLoadingTimeStamp.IsNull() && mTiming) {
8250
    mTiming->SetDOMLoadingTimeStamp(nsIDocument::GetDocumentURI(), mLoadingTimeStamp);
8251
  }
8252
  return NS_OK;
8253
}
8254
8210
Element*
8255
Element*
8211
nsDocument::FindImageMap(const nsAString& aUseMapValue)
8256
nsDocument::FindImageMap(const nsAString& aUseMapValue)
8212
{
8257
{
8213
  if (aUseMapValue.IsEmpty()) {
8258
  if (aUseMapValue.IsEmpty()) {
8214
    return nsnull;
8259
    return nsnull;
8215
  }
8260
  }
8216
8261
8217
  nsAString::const_iterator start, end;
8262
  nsAString::const_iterator start, end;
(-)a/content/base/src/nsDocument.h (+10 lines)
Line     Link Here 
 Lines 98-113    Link Here 
98
#include "nsILoadContext.h"
98
#include "nsILoadContext.h"
99
#include "nsIProgressEventSink.h"
99
#include "nsIProgressEventSink.h"
100
#include "nsISecurityEventSink.h"
100
#include "nsISecurityEventSink.h"
101
#include "nsIChannelEventSink.h"
101
#include "nsIChannelEventSink.h"
102
#include "imgIRequest.h"
102
#include "imgIRequest.h"
103
#include "nsIDOMDOMImplementation.h"
103
#include "nsIDOMDOMImplementation.h"
104
#include "nsIDOMTouchEvent.h"
104
#include "nsIDOMTouchEvent.h"
105
105
106
#include "TimeStamp.h"
107
106
#define XML_DECLARATION_BITS_DECLARATION_EXISTS   (1 << 0)
108
#define XML_DECLARATION_BITS_DECLARATION_EXISTS   (1 << 0)
107
#define XML_DECLARATION_BITS_ENCODING_EXISTS      (1 << 1)
109
#define XML_DECLARATION_BITS_ENCODING_EXISTS      (1 << 1)
108
#define XML_DECLARATION_BITS_STANDALONE_EXISTS    (1 << 2)
110
#define XML_DECLARATION_BITS_STANDALONE_EXISTS    (1 << 2)
109
#define XML_DECLARATION_BITS_STANDALONE_YES       (1 << 3)
111
#define XML_DECLARATION_BITS_STANDALONE_YES       (1 << 3)
110
112
111
113
112
class nsIEventListenerManager;
114
class nsIEventListenerManager;
113
class nsDOMStyleSheetList;
115
class nsDOMStyleSheetList;
 Lines 119-134   class nsIRadioVisitor; Link Here 
119
class nsIFormControl;
121
class nsIFormControl;
120
struct nsRadioGroupStruct;
122
struct nsRadioGroupStruct;
121
class nsOnloadBlocker;
123
class nsOnloadBlocker;
122
class nsUnblockOnloadEvent;
124
class nsUnblockOnloadEvent;
123
class nsChildContentList;
125
class nsChildContentList;
124
class nsXMLEventsManager;
126
class nsXMLEventsManager;
125
class nsHTMLStyleSheet;
127
class nsHTMLStyleSheet;
126
class nsHTMLCSSStyleSheet;
128
class nsHTMLCSSStyleSheet;
129
class nsDOMNavigationTiming;
127
130
128
/**
131
/**
129
 * Right now our identifier map entries contain information for 'name'
132
 * Right now our identifier map entries contain information for 'name'
130
 * and 'id' mappings of a given string. This is so that
133
 * and 'id' mappings of a given string. This is so that
131
 * nsHTMLDocument::ResolveName only has to do one hash lookup instead
134
 * nsHTMLDocument::ResolveName only has to do one hash lookup instead
132
 * of two. It's not clear whether this still matters for performance.
135
 * of two. It's not clear whether this still matters for performance.
133
 * 
136
 * 
134
 * We also store the document.all result list here. This is mainly so that
137
 * We also store the document.all result list here. This is mainly so that
 Lines 942-957   public: Link Here 
942
  virtual Element *LookupImageElement(const nsAString& aElementId);
945
  virtual Element *LookupImageElement(const nsAString& aElementId);
943
946
944
  virtual NS_HIDDEN_(nsresult) AddImage(imgIRequest* aImage);
947
  virtual NS_HIDDEN_(nsresult) AddImage(imgIRequest* aImage);
945
  virtual NS_HIDDEN_(nsresult) RemoveImage(imgIRequest* aImage);
948
  virtual NS_HIDDEN_(nsresult) RemoveImage(imgIRequest* aImage);
946
  virtual NS_HIDDEN_(nsresult) SetImageLockingState(PRBool aLocked);
949
  virtual NS_HIDDEN_(nsresult) SetImageLockingState(PRBool aLocked);
947
950
948
  virtual nsresult GetStateObject(nsIVariant** aResult);
951
  virtual nsresult GetStateObject(nsIVariant** aResult);
949
952
953
  virtual nsDOMNavigationTiming* GetNavigationTiming() const;
954
  virtual nsresult SetNavigationTiming(nsDOMNavigationTiming* aTiming);
955
950
  virtual Element* FindImageMap(const nsAString& aNormalizedMapName);
956
  virtual Element* FindImageMap(const nsAString& aNormalizedMapName);
951
957
952
protected:
958
protected:
953
  friend class nsNodeUtils;
959
  friend class nsNodeUtils;
954
960
955
  /**
961
  /**
956
   * Check that aId is not empty and log a message to the console
962
   * Check that aId is not empty and log a message to the console
957
   * service if it is.
963
   * service if it is.
 Lines 1078-1093   protected: Link Here 
1078
   * 2) Removals from the DOM affect the table immediately
1084
   * 2) Removals from the DOM affect the table immediately
1079
   * 3) Additions to the DOM always update existing entries for names, and add
1085
   * 3) Additions to the DOM always update existing entries for names, and add
1080
   *    new ones for IDs.
1086
   *    new ones for IDs.
1081
   */
1087
   */
1082
  nsTHashtable<nsIdentifierMapEntry> mIdentifierMap;
1088
  nsTHashtable<nsIdentifierMapEntry> mIdentifierMap;
1083
1089
1084
  nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
1090
  nsClassHashtable<nsStringHashKey, nsRadioGroupStruct> mRadioGroups;
1085
1091
1092
  // Recorded time of change to 'loading' state.
1093
  mozilla::TimeStamp mLoadingTimeStamp;
1094
1086
  // True if the document has been detached from its content viewer.
1095
  // True if the document has been detached from its content viewer.
1087
  PRPackedBool mIsGoingAway:1;
1096
  PRPackedBool mIsGoingAway:1;
1088
  // True if the document is being destroyed.
1097
  // True if the document is being destroyed.
1089
  PRPackedBool mInDestructor:1;
1098
  PRPackedBool mInDestructor:1;
1090
1099
1091
  // True if this document has ever had an HTML or SVG <title> element
1100
  // True if this document has ever had an HTML or SVG <title> element
1092
  // bound to it
1101
  // bound to it
1093
  PRPackedBool mMayHaveTitleElement:1;
1102
  PRPackedBool mMayHaveTitleElement:1;
 Lines 1136-1151   protected: Link Here 
1136
  // any.  This can change during the lifetime of the document.
1145
  // any.  This can change during the lifetime of the document.
1137
  nsCOMPtr<nsIApplicationCache> mApplicationCache;
1146
  nsCOMPtr<nsIApplicationCache> mApplicationCache;
1138
1147
1139
  nsCOMPtr<nsIContent> mFirstBaseNodeWithHref;
1148
  nsCOMPtr<nsIContent> mFirstBaseNodeWithHref;
1140
1149
1141
  nsEventStates mDocumentState;
1150
  nsEventStates mDocumentState;
1142
  nsEventStates mGotDocumentState;
1151
  nsEventStates mGotDocumentState;
1143
1152
1153
  nsRefPtr<nsDOMNavigationTiming> mTiming;
1144
private:
1154
private:
1145
  friend class nsUnblockOnloadEvent;
1155
  friend class nsUnblockOnloadEvent;
1146
1156
1147
  void PostUnblockOnloadEvent();
1157
  void PostUnblockOnloadEvent();
1148
  void DoUnblockOnload();
1158
  void DoUnblockOnload();
1149
1159
1150
  nsresult CheckFrameOptions();
1160
  nsresult CheckFrameOptions();
1151
  nsresult InitCSP();
1161
  nsresult InitCSP();
(-)a/content/html/content/src/Makefile.in (+1 lines)
Line     Link Here 
 Lines 138-148   INCLUDES += \ Link Here 
138
		-I$(srcdir)/../../../../layout/style \
138
		-I$(srcdir)/../../../../layout/style \
139
		-I$(srcdir)/../../../../layout/tables \
139
		-I$(srcdir)/../../../../layout/tables \
140
		-I$(srcdir)/../../../../layout/xul/base/src \
140
		-I$(srcdir)/../../../../layout/xul/base/src \
141
		-I$(srcdir)/../../../../layout/generic \
141
		-I$(srcdir)/../../../../layout/generic \
142
		-I$(srcdir)/../../../../dom/base \
142
		-I$(srcdir)/../../../../dom/base \
143
		-I$(srcdir)/../../../../editor/libeditor/base \
143
		-I$(srcdir)/../../../../editor/libeditor/base \
144
		-I$(srcdir)/../../../../editor/libeditor/text \
144
		-I$(srcdir)/../../../../editor/libeditor/text \
145
		-I$(srcdir) \
145
		-I$(srcdir) \
146
		-I$(topsrcdir)/xpcom/ds \
146
		$(NULL)
147
		$(NULL)
147
148
148
DEFINES += -D_IMPL_NS_LAYOUT
149
DEFINES += -D_IMPL_NS_LAYOUT
(-)a/content/html/document/src/Makefile.in (+1 lines)
Line     Link Here 
 Lines 72-82   include $(topsrcdir)/config/rules.mk Link Here 
72
INCLUDES	+= \
72
INCLUDES	+= \
73
		-I$(srcdir)/../../../base/src \
73
		-I$(srcdir)/../../../base/src \
74
		-I$(srcdir)/../../../events/src \
74
		-I$(srcdir)/../../../events/src \
75
		-I$(srcdir)/../../content/src \
75
		-I$(srcdir)/../../content/src \
76
		-I$(topsrcdir)/layout/style \
76
		-I$(topsrcdir)/layout/style \
77
		-I$(topsrcdir)/dom/base \
77
		-I$(topsrcdir)/dom/base \
78
		-I$(topsrcdir)/xpcom/io \
78
		-I$(topsrcdir)/xpcom/io \
79
		-I$(topsrcdir)/caps/include \
79
		-I$(topsrcdir)/caps/include \
80
		-I$(topsrcdir)/xpcom/ds \
80
		$(NULL)
81
		$(NULL)
81
82
82
DEFINES += -D_IMPL_NS_LAYOUT
83
DEFINES += -D_IMPL_NS_LAYOUT
(-)a/content/svg/document/src/Makefile.in (+1 lines)
Line     Link Here 
 Lines 58-68   include $(topsrcdir)/config/rules.mk Link Here 
58
INCLUDES	+= \
58
INCLUDES	+= \
59
		-I$(srcdir) \
59
		-I$(srcdir) \
60
		-I$(srcdir)/../../../xml/document/src \
60
		-I$(srcdir)/../../../xml/document/src \
61
		-I$(srcdir)/../../../html/base/src \
61
		-I$(srcdir)/../../../html/base/src \
62
		-I$(srcdir)/../../../html/document/src \
62
		-I$(srcdir)/../../../html/document/src \
63
		-I$(srcdir)/../../../../layout/style \
63
		-I$(srcdir)/../../../../layout/style \
64
		-I$(srcdir)/../../../base/src \
64
		-I$(srcdir)/../../../base/src \
65
		-I$(srcdir)/../../../events/src \
65
		-I$(srcdir)/../../../events/src \
66
		-I$(topsrcdir)/xpcom/ds \
66
		$(NULL)
67
		$(NULL)
67
68
68
DEFINES += -D_IMPL_NS_LAYOUT
69
DEFINES += -D_IMPL_NS_LAYOUT
(-)a/content/xbl/src/Makefile.in (+1 lines)
Line     Link Here 
 Lines 83-93   LOCAL_INCLUDES = \ Link Here 
83
		-I$(srcdir)/../../html/base/src \
83
		-I$(srcdir)/../../html/base/src \
84
		-I$(srcdir)/../../html/document/src \
84
		-I$(srcdir)/../../html/document/src \
85
		-I$(srcdir)/../../xml/document/src \
85
		-I$(srcdir)/../../xml/document/src \
86
		-I$(srcdir)/../../xul/content/src \
86
		-I$(srcdir)/../../xul/content/src \
87
		-I$(srcdir)/../../xul/document/src \
87
		-I$(srcdir)/../../xul/document/src \
88
		-I$(srcdir)/../../events/src \
88
		-I$(srcdir)/../../events/src \
89
		-I$(srcdir)/../../../layout/style \
89
		-I$(srcdir)/../../../layout/style \
90
		-I$(srcdir)/../../../dom/base \
90
		-I$(srcdir)/../../../dom/base \
91
		-I$(topsrcdir)/xpcom/ds \
91
		$(NULL)
92
		$(NULL)
92
93
93
DEFINES += -D_IMPL_NS_LAYOUT
94
DEFINES += -D_IMPL_NS_LAYOUT
(-)a/content/xml/document/src/Makefile.in (+1 lines)
Line     Link Here 
 Lines 64-74   LOCAL_INCLUDES = \ Link Here 
64
		-I$(srcdir)/../../../xsl/document/src \
64
		-I$(srcdir)/../../../xsl/document/src \
65
		-I$(srcdir)/../../../html/document/src \
65
		-I$(srcdir)/../../../html/document/src \
66
		-I$(srcdir)/../../../../layout/style \
66
		-I$(srcdir)/../../../../layout/style \
67
		-I$(srcdir)/../../../base/src \
67
		-I$(srcdir)/../../../base/src \
68
		-I$(srcdir)/../../../xul/content/src \
68
		-I$(srcdir)/../../../xul/content/src \
69
		-I$(srcdir)/../../../events/src \
69
		-I$(srcdir)/../../../events/src \
70
		-I$(srcdir)/../../../../dom/base \
70
		-I$(srcdir)/../../../../dom/base \
71
		-I$(srcdir)/../../../../caps/include \
71
		-I$(srcdir)/../../../../caps/include \
72
		-I$(topsrcdir)/xpcom/ds \
72
		$(NULL)
73
		$(NULL)
73
74
74
DEFINES += -D_IMPL_NS_LAYOUT
75
DEFINES += -D_IMPL_NS_LAYOUT
(-)a/content/xul/content/src/Makefile.in (+1 lines)
Line     Link Here 
 Lines 68-78   LOCAL_INCLUDES = \ Link Here 
68
	-I$(srcdir)/../../templates/src \
68
	-I$(srcdir)/../../templates/src \
69
	-I$(srcdir)/../../../xml/content/src \
69
	-I$(srcdir)/../../../xml/content/src \
70
	-I$(srcdir)/../../../base/src \
70
	-I$(srcdir)/../../../base/src \
71
	-I$(srcdir)/../../../xml/document/src \
71
	-I$(srcdir)/../../../xml/document/src \
72
	-I$(srcdir)/../../../../layout/style \
72
	-I$(srcdir)/../../../../layout/style \
73
	-I$(srcdir)/../../../html/content/src \
73
	-I$(srcdir)/../../../html/content/src \
74
	-I$(srcdir)/../../../events/src \
74
	-I$(srcdir)/../../../events/src \
75
	-I$(srcdir)/../../../xbl/src \
75
	-I$(srcdir)/../../../xbl/src \
76
	-I$(topsrcdir)/xpcom/ds \
76
	$(NULL)
77
	$(NULL)
77
78
78
DEFINES += -D_IMPL_NS_LAYOUT
79
DEFINES += -D_IMPL_NS_LAYOUT
(-)a/content/xul/document/src/Makefile.in (+1 lines)
Line     Link Here 
 Lines 70-80   LOCAL_INCLUDES = -I$(srcdir)/../../../ba Link Here 
70
		  -I$(srcdir)/../../templates/src \
70
		  -I$(srcdir)/../../templates/src \
71
		  -I$(srcdir)/../../../../layout/base \
71
		  -I$(srcdir)/../../../../layout/base \
72
		  -I$(srcdir)/../../../../layout/generic \
72
		  -I$(srcdir)/../../../../layout/generic \
73
		  -I$(srcdir)/../../../../layout/style \
73
		  -I$(srcdir)/../../../../layout/style \
74
		  -I$(srcdir)/../../../../layout/xul/base/src \
74
		  -I$(srcdir)/../../../../layout/xul/base/src \
75
		  -I$(srcdir)/../../../xml/document/src \
75
		  -I$(srcdir)/../../../xml/document/src \
76
		  -I$(srcdir)/../../../xbl/src \
76
		  -I$(srcdir)/../../../xbl/src \
77
		  -I$(srcdir)/../../../events/src \
77
		  -I$(srcdir)/../../../events/src \
78
		  -I$(topsrcdir)/xpcom/ds \
78
		  $(NULL)
79
		  $(NULL)
79
80
80
DEFINES += -D_IMPL_NS_LAYOUT
81
DEFINES += -D_IMPL_NS_LAYOUT
(-)a/docshell/base/Makefile.in (+2 lines)
Line     Link Here 
 Lines 113-123   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
  -I$(topsrcdir)/js/src/xpconnect/src \
123
  -I$(topsrcdir)/js/src/xpconnect/src \
124
  -I$(topsrcdir)/xpcom/ds \
123
  $(NULL)
125
  $(NULL)
(-)a/docshell/base/nsDocShell.cpp (-7 / +123 lines)
Line     Link Here 
 Lines 229-244   static NS_DEFINE_CID(kAppShellCID, NS_AP Link Here 
229
#endif
229
#endif
230
230
231
#include "nsContentErrors.h"
231
#include "nsContentErrors.h"
232
#include "nsIChannelPolicy.h"
232
#include "nsIChannelPolicy.h"
233
#include "nsIContentSecurityPolicy.h"
233
#include "nsIContentSecurityPolicy.h"
234
234
235
#include "nsXULAppAPI.h"
235
#include "nsXULAppAPI.h"
236
236
237
#include "nsDOMNavigationTiming.h"
238
237
using namespace mozilla;
239
using namespace mozilla;
238
240
239
// Number of documents currently loading
241
// Number of documents currently loading
240
static PRInt32 gNumberOfDocumentsLoading = 0;
242
static PRInt32 gNumberOfDocumentsLoading = 0;
241
243
242
// Global count of existing docshells.
244
// Global count of existing docshells.
243
static PRInt32 gDocShellCount = 0;
245
static PRInt32 gDocShellCount = 0;
244
246
 Lines 668-683   DispatchPings(nsIContent *content, nsIUR Link Here 
668
    return;
670
    return;
669
671
670
  info.numPings = 0;
672
  info.numPings = 0;
671
  info.referrer = referrer;
673
  info.referrer = referrer;
672
674
673
  ForEachPing(content, SendPing, &info);
675
  ForEachPing(content, SendPing, &info);
674
}
676
}
675
677
678
static nsDOMPerformanceNavigationType
679
ConvertLoadTypeToNavigationType(PRUint32 aLoadType)
680
{
681
  nsDOMPerformanceNavigationType result = nsIDOMPerformanceNavigation::TYPE_RESERVED;
682
  switch (aLoadType) {
683
    case LOAD_NORMAL:
684
    case LOAD_NORMAL_EXTERNAL:
685
    case LOAD_NORMAL_BYPASS_CACHE:
686
    case LOAD_NORMAL_BYPASS_PROXY:
687
    case LOAD_NORMAL_BYPASS_PROXY_AND_CACHE:
688
    case LOAD_LINK:
689
        result = nsIDOMPerformanceNavigation::TYPE_NAVIGATE;
690
        break;
691
    case LOAD_HISTORY:
692
        result = nsIDOMPerformanceNavigation::TYPE_BACK_FORWARD;
693
        break;
694
    case LOAD_RELOAD_NORMAL:
695
    case LOAD_RELOAD_CHARSET_CHANGE:
696
    case LOAD_RELOAD_BYPASS_CACHE:
697
    case LOAD_RELOAD_BYPASS_PROXY:
698
    case LOAD_RELOAD_BYPASS_PROXY_AND_CACHE:
699
        result = nsIDOMPerformanceNavigation::TYPE_RELOAD;
700
        break;
701
    case LOAD_NORMAL_REPLACE:
702
    case LOAD_STOP_CONTENT:
703
    case LOAD_STOP_CONTENT_AND_REPLACE:
704
    case LOAD_REFRESH:
705
    case LOAD_BYPASS_HISTORY:
706
    case LOAD_ERROR_PAGE:
707
    case LOAD_PUSHSTATE:
708
        result = nsIDOMPerformanceNavigation::TYPE_RESERVED;
709
        break;
710
    default:
711
        // NS_NOTREACHED("Unexpected load type value");
712
        result = nsIDOMPerformanceNavigation::TYPE_RESERVED;
713
        break;
714
  }
715
716
  return result;
717
}
718
676
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry);
719
static nsISHEntry* GetRootSHEntry(nsISHEntry *entry);
677
720
678
//*****************************************************************************
721
//*****************************************************************************
679
//***    nsDocShell: Object Management
722
//***    nsDocShell: Object Management
680
//*****************************************************************************
723
//*****************************************************************************
681
724
682
static PRUint64 gDocshellIDCounter = 0;
725
static PRUint64 gDocshellIDCounter = 0;
683
726
 Lines 690-705   nsDocShell::nsDocShell(): Link Here 
690
    mCharsetReloadState(eCharsetReloadInit),
733
    mCharsetReloadState(eCharsetReloadInit),
691
    mChildOffset(0),
734
    mChildOffset(0),
692
    mBusyFlags(BUSY_FLAGS_NONE),
735
    mBusyFlags(BUSY_FLAGS_NONE),
693
    mAppType(nsIDocShell::APP_TYPE_UNKNOWN),
736
    mAppType(nsIDocShell::APP_TYPE_UNKNOWN),
694
    mMarginWidth(-1),
737
    mMarginWidth(-1),
695
    mMarginHeight(-1),
738
    mMarginHeight(-1),
696
    mItemType(typeContent),
739
    mItemType(typeContent),
697
    mPreviousTransIndex(-1),
740
    mPreviousTransIndex(-1),
741
    mLoadType(0),
698
    mLoadedTransIndex(-1),
742
    mLoadedTransIndex(-1),
699
    mAllowSubframes(PR_TRUE),
743
    mAllowSubframes(PR_TRUE),
700
    mAllowPlugins(PR_TRUE),
744
    mAllowPlugins(PR_TRUE),
701
    mAllowJavascript(PR_TRUE),
745
    mAllowJavascript(PR_TRUE),
702
    mAllowMetaRedirects(PR_TRUE),
746
    mAllowMetaRedirects(PR_TRUE),
703
    mAllowImages(PR_TRUE),
747
    mAllowImages(PR_TRUE),
704
    mAllowDNSPrefetch(PR_TRUE),
748
    mAllowDNSPrefetch(PR_TRUE),
705
    mCreatingDocument(PR_FALSE),
749
    mCreatingDocument(PR_FALSE),
 Lines 1514-1531   NS_IMETHODIMP Link Here 
1514
nsDocShell::FirePageHideNotification(PRBool aIsUnload)
1558
nsDocShell::FirePageHideNotification(PRBool aIsUnload)
1515
{
1559
{
1516
    if (mContentViewer && !mFiredUnloadEvent) {
1560
    if (mContentViewer && !mFiredUnloadEvent) {
1517
        // Keep an explicit reference since calling PageHide could release
1561
        // Keep an explicit reference since calling PageHide could release
1518
        // mContentViewer
1562
        // mContentViewer
1519
        nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer);
1563
        nsCOMPtr<nsIContentViewer> kungFuDeathGrip(mContentViewer);
1520
        mFiredUnloadEvent = PR_TRUE;
1564
        mFiredUnloadEvent = PR_TRUE;
1521
1565
1566
        if (mTiming) {
1567
            mTiming->NotifyUnloadEventStart();
1568
        }
1569
1522
        mContentViewer->PageHide(aIsUnload);
1570
        mContentViewer->PageHide(aIsUnload);
1523
1571
1572
        if (mTiming) {
1573
            mTiming->NotifyUnloadEventEnd();
1574
        }
1575
1524
        nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids;
1576
        nsAutoTArray<nsCOMPtr<nsIDocShell>, 8> kids;
1525
        PRInt32 i, n = mChildList.Count();
1577
        PRInt32 i, n = mChildList.Count();
1526
        kids.SetCapacity(n);
1578
        kids.SetCapacity(n);
1527
        for (i = 0; i < n; i++) {
1579
        for (i = 0; i < n; i++) {
1528
            kids.AppendElement(do_QueryInterface(ChildAt(i)));
1580
            kids.AppendElement(do_QueryInterface(ChildAt(i)));
1529
        }
1581
        }
1530
1582
1531
        n = kids.Length();
1583
        n = kids.Length();
 Lines 1537-1552   nsDocShell::FirePageHideNotification(PRB Link Here 
1537
        // Now make sure our editor, if any, is detached before we go
1589
        // Now make sure our editor, if any, is detached before we go
1538
        // any farther.
1590
        // any farther.
1539
        DetachEditorFromWindow();
1591
        DetachEditorFromWindow();
1540
    }
1592
    }
1541
1593
1542
    return NS_OK;
1594
    return NS_OK;
1543
}
1595
}
1544
1596
1597
nsresult
1598
nsDocShell::MaybeInitTiming()
1599
{
1600
    if (mTiming) {
1601
        return NS_OK;
1602
    }
1603
1604
    PRBool enabled;
1605
    nsresult rv = mPrefs->GetBoolPref("dom.enable_performance", &enabled);
1606
    if (NS_SUCCEEDED(rv) && enabled) {
1607
        mTiming = new nsDOMNavigationTiming();
1608
        mTiming->NotifyNavigationStart();
1609
    }
1610
    return NS_OK;
1611
}
1612
1613
1545
//
1614
//
1546
// Bug 13871: Prevent frameset spoofing
1615
// Bug 13871: Prevent frameset spoofing
1547
//
1616
//
1548
// This routine answers: 'Is origin's document from same domain as
1617
// This routine answers: 'Is origin's document from same domain as
1549
// target's document?'
1618
// target's document?'
1550
//
1619
//
1551
// file: uris are considered the same domain for the purpose of
1620
// file: uris are considered the same domain for the purpose of
1552
// frame navigation regardless of script accessibility (bug 420425)
1621
// frame navigation regardless of script accessibility (bug 420425)
 Lines 5824-5848   nsDocShell::OnProgressChange(nsIWebProgr Link Here 
5824
5893
5825
NS_IMETHODIMP
5894
NS_IMETHODIMP
5826
nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
5895
nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
5827
                          PRUint32 aStateFlags, nsresult aStatus)
5896
                          PRUint32 aStateFlags, nsresult aStatus)
5828
{
5897
{
5829
    nsresult rv;
5898
    nsresult rv;
5830
5899
5831
    if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) {
5900
    if ((~aStateFlags & (STATE_START | STATE_IS_NETWORK)) == 0) {
5901
        // Save timing statistics.
5902
        nsCOMPtr<nsIChannel> channel(do_QueryInterface(aRequest));
5903
        nsCOMPtr<nsIURI> uri;
5904
        channel->GetURI(getter_AddRefs(uri));
5905
        nsCAutoString aURI;
5906
        uri->GetAsciiSpec(aURI);
5907
        // If load type is not set, this is not a 'normal' load.
5908
        // No need to collect timing.
5909
        if (mLoadType == 0) {
5910
          mTiming = nsnull;
5911
        }
5912
        else {
5913
          rv = MaybeInitTiming();
5914
        }
5915
        if (mTiming) {
5916
          mTiming->NotifyFetchStart(uri, ConvertLoadTypeToNavigationType(mLoadType));
5917
        }
5918
5832
        nsCOMPtr<nsIWyciwygChannel>  wcwgChannel(do_QueryInterface(aRequest));
5919
        nsCOMPtr<nsIWyciwygChannel>  wcwgChannel(do_QueryInterface(aRequest));
5833
        nsCOMPtr<nsIWebProgress> webProgress =
5920
        nsCOMPtr<nsIWebProgress> webProgress =
5834
            do_QueryInterface(GetAsSupports(this));
5921
            do_QueryInterface(GetAsSupports(this));
5835
5922
5836
        // Was the wyciwyg document loaded on this docshell?
5923
        // Was the wyciwyg document loaded on this docshell?
5837
        if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) {
5924
        if (wcwgChannel && !mLSHE && (mItemType == typeContent) && aProgress == webProgress.get()) {
5838
            nsCOMPtr<nsIURI> uri;
5839
            wcwgChannel->GetURI(getter_AddRefs(uri));
5840
        
5841
            PRBool equalUri = PR_TRUE;
5925
            PRBool equalUri = PR_TRUE;
5842
            // Store the wyciwyg url in session history, only if it is
5926
            // Store the wyciwyg url in session history, only if it is
5843
            // being loaded fresh for the first time. We don't want 
5927
            // being loaded fresh for the first time. We don't want 
5844
            // multiple entries for successive loads
5928
            // multiple entries for successive loads
5845
            if (mCurrentURI &&
5929
            if (mCurrentURI &&
5846
                NS_SUCCEEDED(uri->Equals(mCurrentURI, &equalUri)) &&
5930
                NS_SUCCEEDED(uri->Equals(mCurrentURI, &equalUri)) &&
5847
                !equalUri) {
5931
                !equalUri) {
5848
5932
 Lines 5955-5970   nsDocShell::OnRedirectStateChange(nsICha Link Here 
5955
        return; // not a toplevel document
6039
        return; // not a toplevel document
5956
6040
5957
    nsCOMPtr<nsIURI> oldURI, newURI;
6041
    nsCOMPtr<nsIURI> oldURI, newURI;
5958
    aOldChannel->GetURI(getter_AddRefs(oldURI));
6042
    aOldChannel->GetURI(getter_AddRefs(oldURI));
5959
    aNewChannel->GetURI(getter_AddRefs(newURI));
6043
    aNewChannel->GetURI(getter_AddRefs(newURI));
5960
    if (!oldURI || !newURI) {
6044
    if (!oldURI || !newURI) {
5961
        return;
6045
        return;
5962
    }
6046
    }
6047
    // On session restore we get a redirect from page to itself. Don't count it.
6048
    PRBool equals = PR_FALSE;
6049
    if (mTiming &&
6050
        !(mLoadType == LOAD_HISTORY &&
6051
          NS_SUCCEEDED(newURI->Equals(oldURI, &equals)) && equals)) {
6052
        mTiming->NotifyRedirect(oldURI, newURI);
6053
    }
5963
6054
5964
    // Below a URI visit is saved (see AddURIVisit method doc).
6055
    // Below a URI visit is saved (see AddURIVisit method doc).
5965
    // The visit chain looks something like:
6056
    // The visit chain looks something like:
5966
    //   ...
6057
    //   ...
5967
    //   Site N - 1
6058
    //   Site N - 1
5968
    //                =>  Site N
6059
    //                =>  Site N
5969
    //   (redirect to =>) Site N + 1 (we are here!)
6060
    //   (redirect to =>) Site N + 1 (we are here!)
5970
6061
 Lines 6038-6054   nsDocShell::EndPageLoad(nsIWebProgress * Link Here 
6038
                        nsIChannel * aChannel, nsresult aStatus)
6129
                        nsIChannel * aChannel, nsresult aStatus)
6039
{
6130
{
6040
    if(!aChannel)
6131
    if(!aChannel)
6041
        return NS_ERROR_NULL_POINTER;
6132
        return NS_ERROR_NULL_POINTER;
6042
    
6133
    
6043
    nsCOMPtr<nsIURI> url;
6134
    nsCOMPtr<nsIURI> url;
6044
    nsresult rv = aChannel->GetURI(getter_AddRefs(url));
6135
    nsresult rv = aChannel->GetURI(getter_AddRefs(url));
6045
    if (NS_FAILED(rv)) return rv;
6136
    if (NS_FAILED(rv)) return rv;
6046
  
6137
6138
    // Timing is picked up by the window, we don't need it anymore
6139
    mTiming = nsnull;
6140
6047
    // clean up reload state for meta charset
6141
    // clean up reload state for meta charset
6048
    if (eCharsetReloadRequested == mCharsetReloadState)
6142
    if (eCharsetReloadRequested == mCharsetReloadState)
6049
        mCharsetReloadState = eCharsetReloadStopOrigional;
6143
        mCharsetReloadState = eCharsetReloadStopOrigional;
6050
    else 
6144
    else 
6051
        mCharsetReloadState = eCharsetReloadInit;
6145
        mCharsetReloadState = eCharsetReloadInit;
6052
6146
6053
    // Save a pointer to the currently-loading history entry.
6147
    // Save a pointer to the currently-loading history entry.
6054
    // nsDocShell::EndPageLoad will clear mLSHE, but we may need this history
6148
    // nsDocShell::EndPageLoad will clear mLSHE, but we may need this history
 Lines 6469-6495   nsDocShell::CreateAboutBlankContentViewe Link Here 
6469
  nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
6563
  nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
6470
  
6564
  
6471
  if (mContentViewer) {
6565
  if (mContentViewer) {
6472
    // We've got a content viewer already. Make sure the user
6566
    // We've got a content viewer already. Make sure the user
6473
    // permits us to discard the current document and replace it
6567
    // permits us to discard the current document and replace it
6474
    // with about:blank. And also ensure we fire the unload events
6568
    // with about:blank. And also ensure we fire the unload events
6475
    // in the current document.
6569
    // in the current document.
6476
6570
6571
    // Make sure timing is created. Unload gets fired first for
6572
    // document loaded from the session history.
6573
    rv = MaybeInitTiming();
6574
    if (mTiming) {
6575
      mTiming->NotifyBeforeUnload();
6576
    }
6577
6477
    PRBool okToUnload;
6578
    PRBool okToUnload;
6478
    rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
6579
    rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
6479
6580
6480
    if (NS_SUCCEEDED(rv) && !okToUnload) {
6581
    if (NS_SUCCEEDED(rv) && !okToUnload) {
6481
      // The user chose not to unload the page, interrupt the load.
6582
      // The user chose not to unload the page, interrupt the load.
6482
      return NS_ERROR_FAILURE;
6583
      return NS_ERROR_FAILURE;
6483
    }
6584
    }
6484
6585
6485
    mSavingOldViewer = aTryToSaveOldPresentation && 
6586
    mSavingOldViewer = aTryToSaveOldPresentation && 
6486
                       CanSavePresentation(LOAD_NORMAL, nsnull, nsnull);
6587
                       CanSavePresentation(LOAD_NORMAL, nsnull, nsnull);
6487
6588
6589
    if (mTiming) {
6590
      mTiming->NotifyUnloadAccepted(mCurrentURI);
6591
    }
6592
6488
    // Make sure to blow away our mLoadingURI just in case.  No loads
6593
    // Make sure to blow away our mLoadingURI just in case.  No loads
6489
    // from inside this pagehide.
6594
    // from inside this pagehide.
6490
    mLoadingURI = nsnull;
6595
    mLoadingURI = nsnull;
6491
    
6596
    
6492
    // Stop any in-progress loading, so that we don't accidentally trigger any
6597
    // Stop any in-progress loading, so that we don't accidentally trigger any
6493
    // PageShow notifications from Embed() interrupting our loading below.
6598
    // PageShow notifications from Embed() interrupting our loading below.
6494
    Stop();
6599
    Stop();
6495
6600
 Lines 7699-7714   nsDocShell::SetupNewViewer(nsIContentVie Link Here 
7699
7804
7700
    mContentViewer = aNewViewer;
7805
    mContentViewer = aNewViewer;
7701
7806
7702
    nsCOMPtr<nsIWidget> widget;
7807
    nsCOMPtr<nsIWidget> widget;
7703
    NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE);
7808
    NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE);
7704
7809
7705
    nsIntRect bounds(x, y, cx, cy);
7810
    nsIntRect bounds(x, y, cx, cy);
7706
7811
7812
    nsCOMPtr<nsIDocumentViewer> docviewer =
7813
        do_QueryInterface(mContentViewer);
7814
    if (docviewer) {
7815
        docviewer->SetNavigationTiming(mTiming);
7816
    }
7817
7707
    if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
7818
    if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
7708
        mContentViewer = nsnull;
7819
        mContentViewer = nsnull;
7709
        NS_ERROR("ContentViewer Initialization failed");
7820
        NS_ERROR("ContentViewer Initialization failed");
7710
        return NS_ERROR_FAILURE;
7821
        return NS_ERROR_FAILURE;
7711
    }
7822
    }
7712
7823
7713
    // If we have old state to copy, set the old state onto the new content
7824
    // If we have old state to copy, set the old state onto the new content
7714
    // viewer
7825
    // viewer
 Lines 7731-7749   nsDocShell::SetupNewViewer(nsIContentVie Link Here 
7731
        NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom),
7842
        NS_ENSURE_SUCCESS(newMUDV->SetFullZoom(pageZoom),
7732
                          NS_ERROR_FAILURE);
7843
                          NS_ERROR_FAILURE);
7733
        NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled),
7844
        NS_ENSURE_SUCCESS(newMUDV->SetAuthorStyleDisabled(styleDisabled),
7734
                          NS_ERROR_FAILURE);
7845
                          NS_ERROR_FAILURE);
7735
    }
7846
    }
7736
7847
7737
    // Stuff the bgcolor from the old pres shell into the new
7848
    // Stuff the bgcolor from the old pres shell into the new
7738
    // pres shell. This improves page load continuity.
7849
    // pres shell. This improves page load continuity.
7739
    nsCOMPtr<nsIDocumentViewer> docviewer =
7740
        do_QueryInterface(mContentViewer);
7741
7742
    if (docviewer) {
7850
    if (docviewer) {
7743
        nsCOMPtr<nsIPresShell> shell;
7851
        nsCOMPtr<nsIPresShell> shell;
7744
        docviewer->GetPresShell(getter_AddRefs(shell));
7852
        docviewer->GetPresShell(getter_AddRefs(shell));
7745
7853
7746
        if (shell) {
7854
        if (shell) {
7747
            shell->SetCanvasBackground(bgcolor);
7855
            shell->SetCanvasBackground(bgcolor);
7748
        }
7856
        }
7749
    }
7857
    }
 Lines 8514-8542   nsDocShell::InternalLoad(nsIURI * aURI, Link Here 
8514
    }
8622
    }
8515
    
8623
    
8516
    // mContentViewer->PermitUnload can destroy |this| docShell, which
8624
    // mContentViewer->PermitUnload can destroy |this| docShell, which
8517
    // causes the next call of CanSavePresentation to crash. 
8625
    // causes the next call of CanSavePresentation to crash. 
8518
    // Hold onto |this| until we return, to prevent a crash from happening. 
8626
    // Hold onto |this| until we return, to prevent a crash from happening. 
8519
    // (bug#331040)
8627
    // (bug#331040)
8520
    nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
8628
    nsCOMPtr<nsIDocShell> kungFuDeathGrip(this);
8521
8629
8630
    rv = MaybeInitTiming();
8631
    if (mTiming) {
8632
      mTiming->NotifyBeforeUnload();
8633
    }
8522
    // Check if the page doesn't want to be unloaded. The javascript:
8634
    // Check if the page doesn't want to be unloaded. The javascript:
8523
    // protocol handler deals with this for javascript: URLs.
8635
    // protocol handler deals with this for javascript: URLs.
8524
    if (!bIsJavascript && mContentViewer) {
8636
    if (!bIsJavascript && mContentViewer) {
8525
        PRBool okToUnload;
8637
        PRBool okToUnload;
8526
        rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
8638
        rv = mContentViewer->PermitUnload(PR_FALSE, &okToUnload);
8527
8639
8528
        if (NS_SUCCEEDED(rv) && !okToUnload) {
8640
        if (NS_SUCCEEDED(rv) && !okToUnload) {
8529
            // The user chose not to unload the page, interrupt the
8641
            // The user chose not to unload the page, interrupt the
8530
            // load.
8642
            // load.
8531
            return NS_OK;
8643
            return NS_OK;
8532
        }
8644
        }
8533
    }
8645
    }
8534
8646
8647
    if (mTiming) {
8648
      mTiming->NotifyUnloadAccepted(mCurrentURI);
8649
    }
8650
8535
    // Check for saving the presentation here, before calling Stop().
8651
    // Check for saving the presentation here, before calling Stop().
8536
    // This is necessary so that we can catch any pending requests.
8652
    // This is necessary so that we can catch any pending requests.
8537
    // Since the new request has not been created yet, we pass null for the
8653
    // Since the new request has not been created yet, we pass null for the
8538
    // new request parameter.
8654
    // new request parameter.
8539
    // Also pass nsnull for the document, since it doesn't affect the return
8655
    // Also pass nsnull for the document, since it doesn't affect the return
8540
    // value for our purposes here.
8656
    // value for our purposes here.
8541
    PRBool savePresentation = CanSavePresentation(aLoadType, nsnull, nsnull);
8657
    PRBool savePresentation = CanSavePresentation(aLoadType, nsnull, nsnull);
8542
8658
(-)a/docshell/base/nsDocShell.h (+5 lines)
Line     Link Here 
 Lines 114-129    Link Here 
114
#include "nsIClipboardCommands.h"
114
#include "nsIClipboardCommands.h"
115
#include "nsICommandManager.h"
115
#include "nsICommandManager.h"
116
#include "nsCRT.h"
116
#include "nsCRT.h"
117
117
118
class nsDocShell;
118
class nsDocShell;
119
class nsIController;
119
class nsIController;
120
class OnLinkClickEvent;
120
class OnLinkClickEvent;
121
class nsIScrollableFrame;
121
class nsIScrollableFrame;
122
class nsDOMNavigationTiming;
122
123
123
/* load commands were moved to nsIDocShell.h */
124
/* load commands were moved to nsIDocShell.h */
124
/* load types were moved to nsDocShellLoadTypes.h */
125
/* load types were moved to nsDocShellLoadTypes.h */
125
126
126
/* internally used ViewMode types */
127
/* internally used ViewMode types */
127
enum ViewMode {
128
enum ViewMode {
128
    viewNormal = 0x0,
129
    viewNormal = 0x0,
129
    viewSource = 0x1
130
    viewSource = 0x1
 Lines 679-694   protected: Link Here 
679
680
680
    nsIChannel* GetCurrentDocChannel();
681
    nsIChannel* GetCurrentDocChannel();
681
protected:
682
protected:
682
    // Override the parent setter from nsDocLoader
683
    // Override the parent setter from nsDocLoader
683
    virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader);
684
    virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader);
684
685
685
    void ClearFrameHistory(nsISHEntry* aEntry);
686
    void ClearFrameHistory(nsISHEntry* aEntry);
686
687
688
    nsresult MaybeInitTiming();
689
687
    // Event type dispatched by RestorePresentation
690
    // Event type dispatched by RestorePresentation
688
    class RestorePresentationEvent : public nsRunnable {
691
    class RestorePresentationEvent : public nsRunnable {
689
    public:
692
    public:
690
        NS_DECL_NSIRUNNABLE
693
        NS_DECL_NSIRUNNABLE
691
        RestorePresentationEvent(nsDocShell *ds) : mDocShell(ds) {}
694
        RestorePresentationEvent(nsDocShell *ds) : mDocShell(ds) {}
692
        void Revoke() { mDocShell = nsnull; }
695
        void Revoke() { mDocShell = nsnull; }
693
    private:
696
    private:
694
        nsRefPtr<nsDocShell> mDocShell;
697
        nsRefPtr<nsDocShell> mDocShell;
 Lines 832-847   protected: Link Here 
832
    PRPackedBool               mDynamicallyCreated;
835
    PRPackedBool               mDynamicallyCreated;
833
#ifdef DEBUG
836
#ifdef DEBUG
834
    PRPackedBool               mInEnsureScriptEnv;
837
    PRPackedBool               mInEnsureScriptEnv;
835
#endif
838
#endif
836
    PRUint64                   mHistoryID;
839
    PRUint64                   mHistoryID;
837
840
838
    static nsIURIFixup *sURIFixup;
841
    static nsIURIFixup *sURIFixup;
839
842
843
    nsRefPtr<nsDOMNavigationTiming> mTiming;
844
840
#ifdef DEBUG
845
#ifdef DEBUG
841
private:
846
private:
842
    // We're counting the number of |nsDocShells| to help find leaks
847
    // We're counting the number of |nsDocShells| to help find leaks
843
    static unsigned long gNumberOfDocShells;
848
    static unsigned long gNumberOfDocShells;
844
#endif /* DEBUG */
849
#endif /* DEBUG */
845
850
846
public:
851
public:
847
    class InterfaceRequestorProxy : public nsIInterfaceRequestor {
852
    class InterfaceRequestorProxy : public nsIInterfaceRequestor {
(-)a/docshell/test/Makefile.in (+2 lines)
Line     Link Here 
 Lines 106-121   _TEST_FILES = \ Link Here 
106
		test_framedhistoryframes.html \
106
		test_framedhistoryframes.html \
107
		test_windowedhistoryframes.html \
107
		test_windowedhistoryframes.html \
108
		historyframes.html \
108
		historyframes.html \
109
		test_bug660404.html \
109
		test_bug660404.html \
110
		file_bug660404 \
110
		file_bug660404 \
111
		file_bug660404^headers^ \
111
		file_bug660404^headers^ \
112
		test_bug662170.html \
112
		test_bug662170.html \
113
		file_bug662170.html \
113
		file_bug662170.html \
114
		test_bug570341.html \
115
		bug570341_recordevents.html \
114
		$(NULL)
116
		$(NULL)
115
117
116
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
118
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
117
_TEST_FILES += \
119
_TEST_FILES += \
118
		test_bug511449.html \
120
		test_bug511449.html \
119
		file_bug511449.html \
121
		file_bug511449.html \
120
		$(NULL)
122
		$(NULL)
121
endif
123
endif
(-)a/docshell/test/bug570341_recordevents.html (+21 lines)
Line     Link Here 
Line 0    Link Here 
1
<html>
2
<head>
3
<script>
4
    var start = Date.now();
5
    window._testing_js_start = Date.now();
6
    window['_testing_js_after_' + document.readyState] = start;
7
    document.addEventListener('DOMContentLoaded',
8
      function () {
9
        window._testing_evt_DOMContentLoaded = Date.now();
10
      }, true);
11
    document.addEventListener('readystatechange', function(){
12
      window['_testing_evt_DOM_' + document.readyState] = Date.now();
13
    }, true);
14
    function recordLoad() {
15
      window._testing_evt_load = Date.now();
16
    }
17
</script>
18
</head>
19
<body onload="recordLoad()">This document collects time
20
for events related to the page load progress.</body>
21
</html>
(-)a/docshell/test/test_bug570341.html (+154 lines)
Line     Link Here 
Line 0    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'] = unload;
30
    return moments;
31
  }
32
33
  function showSequence(node){
34
    while(node.firstChild) {
35
      node.removeChild(node.firstChild);
36
    }
37
    var sequence = [];
38
    for (var p in moments) {
39
      sequence.push(p);
40
    }
41
    sequence.sort(function(a, b){
42
      return moments[a] - moments[b];
43
    });
44
    table = document.createElement('table');
45
    node.appendChild(table);
46
    row = document.createElement('tr');
47
    table.appendChild(row);
48
    cell = document.createElement('td');
49
    row.appendChild(cell);
50
    cell.appendChild(document.createTextNode('start'));
51
    cell = document.createElement('td');
52
    row.appendChild(cell);
53
    cell.appendChild(document.createTextNode(start));
54
    for (var i = 0; i < sequence.length; ++i) {
55
      var prop = sequence[i];
56
      row = document.createElement('tr');
57
      table.appendChild(row);
58
      cell = document.createElement('td');
59
      row.appendChild(cell);
60
      cell.appendChild(document.createTextNode(prop));
61
      cell = document.createElement('td');
62
      row.appendChild(cell);
63
      cell.appendChild(document.createTextNode(moments[prop]));
64
    }
65
  }
66
67
  function checkValues(){
68
    var win = frames[0];
69
    ok(win.performance, 
70
        'window.performance is missing or not accessible for frame');
71
    ok(!win.performance || win.performance.timing, 
72
        'window.performance.timing is missing or not accessible for frame');
73
    collectMoments();
74
75
    var sequences = [
76
      ['navigationStart', 'unloadEventStart', 'unloadEventEnd'],
77
      ['navigationStart', 'fetchStart', 'domainLookupStart', 'domainLookupEnd',
78
       'connectStart', 'connectEnd', 'requestStart', 'responseStart', 'responseEnd'],
79
      ['responseStart', 'domLoading', 'domInteractive', 'domComplete'],
80
      ['domContentLoadedEventStart', 'domContentLoadedEventEnd',
81
       'loadEventStart', 'loadEventEnd']
82
    ]
83
84
    for (var i = 0; i < sequences.length; ++i) {
85
      var seq = sequences[i];
86
      for (var j = 0; j < seq.length; ++j) {
87
        var prop = seq[j];
88
        if (j > 0) {
89
          var prevProp = seq[j-1];
90
          ok(moments[prevProp] <= moments[prop],
91
              ['Expected ', prevProp, ' to happen before ', prop,
92
              ', got ', prevProp, ' = ', moments[prevProp],
93
              ', ', prop, ' = ', moments[prop]].join(''));
94
        }
95
      }
96
    }
97
    try {
98
      SpecialPowers.setBoolPref('dom.enable_performance', wasEnabled);
99
    } catch (err) {
100
      todo(false, 'Exception in SpecialPowers: ' + err + ' at ' + err.stack);
101
    }
102
103
    SimpleTest.finish()
104
  }
105
106
window.onload = function() {
107
  try {
108
    wasEnabled = SpecialPowers.getBoolPref('dom.enable_performance');
109
  } catch (err) {
110
    todo(false, 'Exception in SpecialPowers: ' + err + ' at ' + err.stack);
111
  }
112
  SpecialPowers.setBoolPref('dom.enable_performance', true);
113
114
  var win = frames[0];
115
  win.addEventListener('unload', function(){
116
    unload = Date.now();
117
  }, true);
118
  var seenLoad = 0;
119
  win.addEventListener('load', function (){
120
    seenLoad = Date.now();
121
  }, true);
122
  frames[0].location = 'bug570341_recordevents.html'
123
  var interval = setInterval(function () {
124
    var stopPolling = (win.performance && win.performance.loadEventEnd) ||
125
                      (seenLoad && Date.now() >= seenLoad + 200)
126
                      || Date.now() >= start + 5000;
127
    if (stopPolling) {
128
      clearInterval(interval);
129
      checkValues();
130
    } else if (win._testing_evt_load) {
131
      seenLoad = Date.now();
132
    }
133
  }, 100);
134
}
135
</script>
136
</head>
137
<body>
138
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=570341">Mozilla Bug 570341</a>
139
<div id="frames">
140
<iframe name="child0" src="navigation/blank.html"></iframe>
141
</div>
142
<button type="button" onclick="showSequence(document.getElementById('display'))">
143
    Show Events</button>
144
<p id="display"></p>
145
<div id="content" style="display: none">
146
147
</div>
148
<pre id="test">
149
<script type="application/javascript">
150
SimpleTest.waitForExplicitFinish();
151
</script>
152
</pre>
153
</body>
154
</html>
(-)a/dom/base/Makefile.in (+3 lines)
Line     Link Here 
 Lines 105-134   CPPSRCS = \ Link Here 
105
	nsPluginArray.cpp	\
105
	nsPluginArray.cpp	\
106
	nsWindowRoot.cpp	\
106
	nsWindowRoot.cpp	\
107
	nsDOMClassInfo.cpp	\
107
	nsDOMClassInfo.cpp	\
108
	nsScriptNameSpaceManager.cpp \
108
	nsScriptNameSpaceManager.cpp \
109
	nsDOMScriptObjectFactory.cpp \
109
	nsDOMScriptObjectFactory.cpp \
110
	nsQueryContentEventResult.cpp \
110
	nsQueryContentEventResult.cpp \
111
	nsContentPermissionHelper.cpp \
111
	nsContentPermissionHelper.cpp \
112
	nsStructuredCloneContainer.cpp \
112
	nsStructuredCloneContainer.cpp \
113
	nsDOMNavigationTiming.cpp \
114
	nsPerformance.cpp	\
113
	$(NULL)
115
	$(NULL)
114
116
115
include $(topsrcdir)/dom/dom-config.mk
117
include $(topsrcdir)/dom/dom-config.mk
116
118
117
ifdef MOZ_JSDEBUGGER
119
ifdef MOZ_JSDEBUGGER
118
DEFINES += -DMOZ_JSDEBUGGER
120
DEFINES += -DMOZ_JSDEBUGGER
119
endif
121
endif
120
122
121
include $(topsrcdir)/config/config.mk
123
include $(topsrcdir)/config/config.mk
122
include $(topsrcdir)/ipc/chromium/chromium-config.mk
124
include $(topsrcdir)/ipc/chromium/chromium-config.mk
123
125
124
include $(topsrcdir)/config/rules.mk
126
include $(topsrcdir)/config/rules.mk
125
127
126
LOCAL_INCLUDES += \
128
LOCAL_INCLUDES += \
127
		-I$(srcdir)/../../js/src/xpconnect/src \
129
		-I$(srcdir)/../../js/src/xpconnect/src \
128
		-I$(srcdir)/../../js/src/xpconnect/wrappers \
130
		-I$(srcdir)/../../js/src/xpconnect/wrappers \
131
		-I$(topsrcdir)/xpcom/ds \
129
		$(NULL)
132
		$(NULL)
130
133
131
ifdef MOZ_X11
134
ifdef MOZ_X11
132
CXXFLAGS += $(TK_CFLAGS)
135
CXXFLAGS += $(TK_CFLAGS)
133
LDFLAGS += $(TK_LIBS)
136
LDFLAGS += $(TK_LIBS)
134
endif
137
endif
(-)a/dom/base/nsDOMClassInfo.cpp (-19 / +70 lines)
Line     Link Here 
 Lines 117-132    Link Here 
117
#include "nsIDOMWindowInternal.h"
117
#include "nsIDOMWindowInternal.h"
118
#include "nsPIDOMWindow.h"
118
#include "nsPIDOMWindow.h"
119
#include "nsIDOMJSWindow.h"
119
#include "nsIDOMJSWindow.h"
120
#include "nsIDOMWindowCollection.h"
120
#include "nsIDOMWindowCollection.h"
121
#include "nsIDOMHistory.h"
121
#include "nsIDOMHistory.h"
122
#include "nsIDOMMediaList.h"
122
#include "nsIDOMMediaList.h"
123
#include "nsIDOMChromeWindow.h"
123
#include "nsIDOMChromeWindow.h"
124
#include "nsIDOMConstructor.h"
124
#include "nsIDOMConstructor.h"
125
#include "nsIDOMPerformanceTiming.h"
126
#include "nsIDOMPerformanceNavigation.h"
127
#include "nsIDOMPerformance.h"
125
#include "nsClientRect.h"
128
#include "nsClientRect.h"
126
129
127
// DOM core includes
130
// DOM core includes
128
#include "nsDOMError.h"
131
#include "nsDOMError.h"
129
#include "nsIDOMDOMException.h"
132
#include "nsIDOMDOMException.h"
130
#include "nsIDOMNode.h"
133
#include "nsIDOMNode.h"
131
#include "nsIDOM3Attr.h"
134
#include "nsIDOM3Attr.h"
132
#include "nsIDOMNodeList.h"
135
#include "nsIDOMNodeList.h"
 Lines 679-694   static nsDOMClassInfoData sClassInfoData Link Here 
679
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
682
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
680
  NS_DEFINE_CLASSINFO_DATA(MimeTypeArray, nsMimeTypeArraySH,
683
  NS_DEFINE_CLASSINFO_DATA(MimeTypeArray, nsMimeTypeArraySH,
681
                           ARRAY_SCRIPTABLE_FLAGS)
684
                           ARRAY_SCRIPTABLE_FLAGS)
682
  NS_DEFINE_CLASSINFO_DATA(BarProp, nsDOMGenericSH,
685
  NS_DEFINE_CLASSINFO_DATA(BarProp, nsDOMGenericSH,
683
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
686
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
684
  NS_DEFINE_CLASSINFO_DATA(History, nsHistorySH,
687
  NS_DEFINE_CLASSINFO_DATA(History, nsHistorySH,
685
                           ARRAY_SCRIPTABLE_FLAGS |
688
                           ARRAY_SCRIPTABLE_FLAGS |
686
                           nsIXPCScriptable::WANT_PRECREATE)
689
                           nsIXPCScriptable::WANT_PRECREATE)
690
  NS_DEFINE_CLASSINFO_DATA(PerformanceTiming, nsDOMGenericSH,
691
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
692
  NS_DEFINE_CLASSINFO_DATA(PerformanceNavigation, nsDOMGenericSH,
693
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
694
  NS_DEFINE_CLASSINFO_DATA(Performance, nsDOMGenericSH,
695
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
687
  NS_DEFINE_CLASSINFO_DATA(Screen, nsDOMGenericSH,
696
  NS_DEFINE_CLASSINFO_DATA(Screen, nsDOMGenericSH,
688
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
697
                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
689
  NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH,
698
  NS_DEFINE_CLASSINFO_DATA(DOMPrototype, nsDOMConstructorSH,
690
                           DOM_BASE_SCRIPTABLE_FLAGS |
699
                           DOM_BASE_SCRIPTABLE_FLAGS |
691
                           nsIXPCScriptable::WANT_PRECREATE |
700
                           nsIXPCScriptable::WANT_PRECREATE |
692
                           nsIXPCScriptable::WANT_HASINSTANCE |
701
                           nsIXPCScriptable::WANT_HASINSTANCE |
693
                           nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)
702
                           nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)
694
  NS_DEFINE_CLASSINFO_DATA(DOMConstructor, nsDOMConstructorSH,
703
  NS_DEFINE_CLASSINFO_DATA(DOMConstructor, nsDOMConstructorSH,
 Lines 2372-2407   nsDOMClassInfo::Init() Link Here 
2372
  NS_ENSURE_SUCCESS(rv, rv);
2381
  NS_ENSURE_SUCCESS(rv, rv);
2373
2382
2374
  JSContext *cx = nsnull;
2383
  JSContext *cx = nsnull;
2375
2384
2376
  rv = stack->GetSafeJSContext(&cx);
2385
  rv = stack->GetSafeJSContext(&cx);
2377
  NS_ENSURE_SUCCESS(rv, rv);
2386
  NS_ENSURE_SUCCESS(rv, rv);
2378
2387
2379
  if (nsGlobalWindow::HasIndexedDBSupport()) {
2388
  if (nsGlobalWindow::HasIndexedDBSupport()) {
2380
    DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2389
    if (nsGlobalWindow::HasPerformanceSupport()) {
2381
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2390
      DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2382
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2391
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2383
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2392
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2384
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2393
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2385
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2394
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2386
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2395
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2387
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
2396
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2388
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2397
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
2389
    DOM_CLASSINFO_MAP_END
2398
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2399
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)
2400
      DOM_CLASSINFO_MAP_END
2401
    } else {
2402
      DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2403
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2404
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2405
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2406
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2407
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2408
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2409
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageIndexedDB)
2410
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2411
      DOM_CLASSINFO_MAP_END
2412
    }
2390
  } else {
2413
  } else {
2391
    DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2414
    if (nsGlobalWindow::HasPerformanceSupport()) {
2392
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2415
      DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2393
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2416
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2394
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2417
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2395
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2418
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2396
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2419
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2397
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2420
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2398
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2421
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2399
    DOM_CLASSINFO_MAP_END
2422
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2423
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowPerformance)
2424
      DOM_CLASSINFO_MAP_END
2425
    } else {
2426
      DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
2427
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow)
2428
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMJSWindow)
2429
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowInternal)
2430
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
2431
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
2432
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorageWindow)
2433
        DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
2434
      DOM_CLASSINFO_MAP_END
2435
    }
2400
  }
2436
  }
2401
2437
2402
  DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils)
2438
  DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils)
2403
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils)
2439
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils)
2404
  DOM_CLASSINFO_MAP_END
2440
  DOM_CLASSINFO_MAP_END
2405
2441
2406
  DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation)
2442
  DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation)
2407
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMLocation)
2443
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMLocation)
 Lines 2441-2456   nsDOMClassInfo::Init() Link Here 
2441
  DOM_CLASSINFO_MAP_BEGIN(BarProp, nsIDOMBarProp)
2477
  DOM_CLASSINFO_MAP_BEGIN(BarProp, nsIDOMBarProp)
2442
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMBarProp)
2478
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMBarProp)
2443
  DOM_CLASSINFO_MAP_END
2479
  DOM_CLASSINFO_MAP_END
2444
2480
2445
  DOM_CLASSINFO_MAP_BEGIN(History, nsIDOMHistory)
2481
  DOM_CLASSINFO_MAP_BEGIN(History, nsIDOMHistory)
2446
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMHistory)
2482
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMHistory)
2447
  DOM_CLASSINFO_MAP_END
2483
  DOM_CLASSINFO_MAP_END
2448
2484
2485
  DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(PerformanceTiming, nsIDOMPerformanceTiming,
2486
                                        !nsGlobalWindow::HasPerformanceSupport())
2487
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformanceTiming)
2488
  DOM_CLASSINFO_MAP_END
2489
2490
  DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(PerformanceNavigation, nsIDOMPerformanceNavigation,
2491
                                        !nsGlobalWindow::HasPerformanceSupport())
2492
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformanceNavigation)
2493
  DOM_CLASSINFO_MAP_END
2494
2495
  DOM_CLASSINFO_MAP_BEGIN_MAYBE_DISABLE(Performance, nsIDOMPerformance,
2496
                                        !nsGlobalWindow::HasPerformanceSupport())
2497
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMPerformance)
2498
  DOM_CLASSINFO_MAP_END
2499
2449
  DOM_CLASSINFO_MAP_BEGIN(Screen, nsIDOMScreen)
2500
  DOM_CLASSINFO_MAP_BEGIN(Screen, nsIDOMScreen)
2450
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMScreen)
2501
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMScreen)
2451
  DOM_CLASSINFO_MAP_END
2502
  DOM_CLASSINFO_MAP_END
2452
2503
2453
  DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DOMPrototype, nsIDOMDOMConstructor)
2504
  DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(DOMPrototype, nsIDOMDOMConstructor)
2454
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
2505
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMConstructor)
2455
  DOM_CLASSINFO_MAP_END
2506
  DOM_CLASSINFO_MAP_END
2456
2507
(-)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)
(-)a/dom/base/nsDOMNavigationTiming.cpp (+420 lines)
Line     Link Here 
Line 0    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 "TimeStamp.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
DOMTimeMilliSec nsDOMNavigationTiming::DurationFromStart(){
81
  mozilla::TimeDuration duration = mozilla::TimeStamp::Now() - mNavigationStartTimeStamp;
82
  return mNavigationStart + static_cast<PRInt32>(duration.ToMilliseconds());
83
}
84
85
void
86
nsDOMNavigationTiming::NotifyNavigationStart()
87
{
88
  mNavigationStart = PR_Now() / PR_USEC_PER_MSEC;
89
  mNavigationStartTimeStamp = mozilla::TimeStamp::Now();
90
}
91
92
void
93
nsDOMNavigationTiming::NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType)
94
{
95
  mFetchStart = DurationFromStart();
96
  mNavigationType = aNavigationType;
97
  // At the unload event time we don't really know the loading uri.
98
  // Need it for later check for unload timing access.
99
  mLoadedURI = aURI;
100
}
101
102
void
103
nsDOMNavigationTiming::NotifyRedirect(nsIURI* aOldURI, nsIURI* aNewURI)
104
{
105
  if (mRedirects.Count() == 0) {
106
    mRedirectStart = mFetchStart;
107
  }
108
  mFetchStart = DurationFromStart();
109
  mRedirectEnd = mFetchStart;
110
111
  // At the unload event time we don't really know the loading uri.
112
  // Need it for later check for unload timing access.
113
  mLoadedURI = aNewURI;
114
115
  mRedirects.AppendObject(aOldURI);
116
}
117
118
void
119
nsDOMNavigationTiming::NotifyBeforeUnload()
120
{
121
  mBeforeUnloadStart = DurationFromStart();
122
}
123
124
void
125
nsDOMNavigationTiming::NotifyUnloadAccepted(nsIURI* aOldURI)
126
{
127
  mUnloadStart = mBeforeUnloadStart;
128
  mUnloadedURI = aOldURI;
129
}
130
131
void
132
nsDOMNavigationTiming::NotifyUnloadEventStart()
133
{
134
  mUnloadStart = DurationFromStart();
135
}
136
137
void
138
nsDOMNavigationTiming::NotifyUnloadEventEnd()
139
{
140
  mUnloadEnd = DurationFromStart();
141
}
142
143
void
144
nsDOMNavigationTiming::NotifyLoadEventStart()
145
{
146
  mLoadEventStart = DurationFromStart();
147
}
148
149
void
150
nsDOMNavigationTiming::NotifyLoadEventEnd()
151
{
152
  mLoadEventEnd = DurationFromStart();
153
}
154
155
PRBool
156
nsDOMNavigationTiming::ReportRedirects()
157
{
158
  if (mRedirectCheck == NOT_CHECKED) {
159
    if (mRedirects.Count() == 0) {
160
      mRedirectCheck = NO_REDIRECTS;
161
    } else {
162
      mRedirectCheck = CHECK_PASSED;
163
      nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
164
      for (int i = mRedirects.Count() - 1; i >= 0; --i) {
165
        nsIURI * curr = mRedirects[i];
166
        nsresult rv = ssm->CheckSameOriginURI(curr, mLoadedURI, PR_FALSE);
167
        if (!NS_SUCCEEDED(rv)) {
168
          mRedirectCheck = CHECK_FAILED;
169
          break;
170
        }
171
      }
172
      // All we need to know is in mRedirectCheck now. Clear history.
173
      mRedirects.Clear();
174
    }
175
  }
176
  return mRedirectCheck == CHECK_PASSED;
177
}
178
179
void
180
nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI, mozilla::TimeStamp aValue)
181
{
182
  mLoadedURI = aURI;
183
  mozilla::TimeDuration duration = aValue - mNavigationStartTimeStamp;
184
  mDOMLoading = mNavigationStart + (int)(duration.ToMilliseconds());
185
}
186
187
void
188
nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI)
189
{
190
  mLoadedURI = aURI;
191
  mDOMLoading = DurationFromStart();
192
}
193
194
void
195
nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI)
196
{
197
  mLoadedURI = aURI;
198
  mDOMInteractive = DurationFromStart();
199
}
200
201
void
202
nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI)
203
{
204
  mLoadedURI = aURI;
205
  mDOMComplete = DurationFromStart();
206
}
207
208
void
209
nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI)
210
{
211
  mLoadedURI = aURI;
212
  mDOMContentLoadedEventStart = DurationFromStart();
213
}
214
215
void
216
nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI)
217
{
218
  mLoadedURI = aURI;
219
  mDOMContentLoadedEventEnd = DurationFromStart();
220
}
221
222
223
NS_IMPL_ADDREF(nsDOMNavigationTiming)
224
NS_IMPL_RELEASE(nsDOMNavigationTiming)
225
226
// QueryInterface implementation for nsDOMNavigationTiming
227
NS_INTERFACE_MAP_BEGIN(nsDOMNavigationTiming)
228
  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMPerformanceTiming)
229
  NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceTiming)
230
  NS_INTERFACE_MAP_ENTRY(nsIDOMPerformanceNavigation)
231
NS_INTERFACE_MAP_END
232
233
NS_IMETHODIMP
234
nsDOMNavigationTiming::GetType(
235
    nsDOMPerformanceNavigationType* aNavigationType)
236
{
237
  *aNavigationType = mNavigationType;
238
  return NS_OK;
239
}
240
241
NS_IMETHODIMP
242
nsDOMNavigationTiming::GetRedirectCount(PRUint16* aRedirectCount)
243
{
244
  *aRedirectCount = 0;
245
  if (ReportRedirects()) {
246
    *aRedirectCount = mRedirects.Count();
247
  }
248
  return NS_OK;
249
}
250
251
NS_IMETHODIMP
252
nsDOMNavigationTiming::GetRedirectStart(DOMTimeMilliSec* aRedirectStart)
253
{
254
  *aRedirectStart = 0;
255
  if (ReportRedirects()) {
256
    *aRedirectStart = mRedirectStart;
257
  }
258
  return NS_OK;
259
}
260
261
NS_IMETHODIMP
262
nsDOMNavigationTiming::GetRedirectEnd(DOMTimeMilliSec* aEnd)
263
{
264
  *aEnd = 0;
265
  if (ReportRedirects()) {
266
    *aEnd = mRedirectEnd;
267
  }
268
  return NS_OK;
269
}
270
271
NS_IMETHODIMP
272
nsDOMNavigationTiming::GetNavigationStart(DOMTimeMilliSec* aNavigationStart)
273
{
274
  *aNavigationStart = mNavigationStart;
275
  return NS_OK;
276
}
277
278
NS_IMETHODIMP
279
nsDOMNavigationTiming::GetUnloadEventStart(DOMTimeMilliSec* aStart)
280
{
281
  *aStart = 0;
282
  nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
283
  nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, PR_FALSE);
284
  if (NS_SUCCEEDED(rv)) {
285
    *aStart = mUnloadStart;
286
  }
287
  return NS_OK;
288
}
289
290
NS_IMETHODIMP
291
nsDOMNavigationTiming::GetUnloadEventEnd(DOMTimeMilliSec* aEnd)
292
{
293
  *aEnd = 0;
294
  nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
295
  nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, PR_FALSE);
296
  if (NS_SUCCEEDED(rv)) {
297
    *aEnd = mUnloadEnd;
298
  }
299
  return NS_OK;
300
}
301
302
NS_IMETHODIMP
303
nsDOMNavigationTiming::GetFetchStart(DOMTimeMilliSec* aStart)
304
{
305
  *aStart = mFetchStart;
306
  return NS_OK;
307
}
308
309
NS_IMETHODIMP
310
nsDOMNavigationTiming::GetDomainLookupStart(DOMTimeMilliSec* aStart)
311
{
312
  // TODO: Implement me! (bug 659126)
313
  *aStart = mFetchStart;
314
  return NS_OK;
315
}
316
317
NS_IMETHODIMP
318
nsDOMNavigationTiming::GetDomainLookupEnd(DOMTimeMilliSec* aEnd)
319
{
320
  // TODO: Implement me! (bug 659126)
321
  *aEnd = mFetchStart;
322
  return NS_OK;
323
}
324
325
NS_IMETHODIMP
326
nsDOMNavigationTiming::GetConnectStart(DOMTimeMilliSec* aStart)
327
{
328
  // TODO: Implement me! (bug 659126)
329
  *aStart = mFetchStart;
330
  return NS_OK;
331
}
332
333
NS_IMETHODIMP
334
nsDOMNavigationTiming::GetConnectEnd(DOMTimeMilliSec* aEnd)
335
{
336
  // TODO: Implement me! (bug 659126)
337
  *aEnd = mFetchStart;
338
  return NS_OK;
339
}
340
341
NS_IMETHODIMP
342
nsDOMNavigationTiming::GetHandshakeStart(DOMTimeMilliSec* aStart)
343
{
344
  // TODO: Implement me! (bug 659126)
345
  *aStart = mFetchStart;
346
  return NS_OK;
347
}
348
349
NS_IMETHODIMP
350
nsDOMNavigationTiming::GetRequestStart(DOMTimeMilliSec* aStart)
351
{
352
  // TODO: Implement me! (bug 659126)
353
  *aStart = mFetchStart;
354
  return NS_OK;
355
}
356
357
NS_IMETHODIMP
358
nsDOMNavigationTiming::GetResponseStart(DOMTimeMilliSec* aStart)
359
{
360
  // TODO: Implement me! (bug 659126)
361
  *aStart = mFetchStart;
362
  return NS_OK;
363
}
364
365
NS_IMETHODIMP
366
nsDOMNavigationTiming::GetResponseEnd(DOMTimeMilliSec* aEnd)
367
{
368
  // TODO: Implement me! (bug 659126)
369
  *aEnd = mFetchStart;
370
  return NS_OK;
371
}
372
373
NS_IMETHODIMP
374
nsDOMNavigationTiming::GetDomLoading(DOMTimeMilliSec* aTime)
375
{
376
  *aTime = mDOMLoading;
377
  return NS_OK;
378
}
379
380
NS_IMETHODIMP
381
nsDOMNavigationTiming::GetDomInteractive(DOMTimeMilliSec* aTime)
382
{
383
  *aTime = mDOMInteractive;
384
  return NS_OK;
385
}
386
387
NS_IMETHODIMP
388
nsDOMNavigationTiming::GetDomContentLoadedEventStart(DOMTimeMilliSec* aStart)
389
{
390
  *aStart = mDOMContentLoadedEventStart;
391
  return NS_OK;
392
}
393
394
NS_IMETHODIMP
395
nsDOMNavigationTiming::GetDomContentLoadedEventEnd(DOMTimeMilliSec* aEnd)
396
{
397
  *aEnd = mDOMContentLoadedEventEnd;
398
  return NS_OK;
399
}
400
401
NS_IMETHODIMP
402
nsDOMNavigationTiming::GetDomComplete(DOMTimeMilliSec* aTime)
403
{
404
  *aTime = mDOMComplete;
405
  return NS_OK;
406
}
407
408
NS_IMETHODIMP
409
nsDOMNavigationTiming::GetLoadEventStart(DOMTimeMilliSec* aStart)
410
{
411
  *aStart = mLoadEventStart;
412
  return NS_OK;
413
}
414
415
NS_IMETHODIMP
416
nsDOMNavigationTiming::GetLoadEventEnd(DOMTimeMilliSec* aEnd)
417
{
418
  *aEnd = mLoadEventEnd;
419
  return NS_OK;
420
}
(-)a/dom/base/nsDOMNavigationTiming.h (+121 lines)
Line     Link Here 
Line 0    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
#include "TimeStamp.h"
49
50
class nsDOMNavigationTimingClock;
51
class nsIURI;
52
class nsIDocument;
53
54
class nsDOMNavigationTiming : public nsIDOMPerformanceTiming,
55
                              public nsIDOMPerformanceNavigation
56
{
57
public:
58
  nsDOMNavigationTiming();
59
60
  NS_DECL_ISUPPORTS
61
  NS_DECL_NSIDOMPERFORMANCETIMING
62
  NS_DECL_NSIDOMPERFORMANCENAVIGATION
63
64
  void NotifyNavigationStart();
65
  void NotifyFetchStart(nsIURI* aURI, nsDOMPerformanceNavigationType aNavigationType);
66
  void NotifyRedirect(nsIURI* aOldURI, nsIURI* aNewURI);
67
  void NotifyBeforeUnload();
68
  void NotifyUnloadAccepted(nsIURI* aOldURI);
69
  void NotifyUnloadEventStart();
70
  void NotifyUnloadEventEnd();
71
  void NotifyLoadEventStart();
72
  void NotifyLoadEventEnd();
73
74
  // Document changes state to 'loading' before connecting to timing
75
  void SetDOMLoadingTimeStamp(nsIURI* aURI, mozilla::TimeStamp aValue);
76
  void NotifyDOMLoading(nsIURI* aURI);
77
  void NotifyDOMInteractive(nsIURI* aURI);
78
  void NotifyDOMComplete(nsIURI* aURI);
79
  void NotifyDOMContentLoadedStart(nsIURI* aURI);
80
  void NotifyDOMContentLoadedEnd(nsIURI* aURI);
81
82
private:
83
  nsDOMNavigationTiming(const nsDOMNavigationTiming &){};
84
  ~nsDOMNavigationTiming();
85
86
  void Clear();
87
  PRBool ReportRedirects();
88
89
  nsCOMPtr<nsIURI> mUnloadedURI;
90
  nsCOMPtr<nsIURI> mLoadedURI;
91
  nsCOMArray<nsIURI> mRedirects;
92
93
  typedef enum { NOT_CHECKED,
94
                 CHECK_PASSED,
95
                 NO_REDIRECTS,
96
                 CHECK_FAILED} RedirectCheckState;
97
  RedirectCheckState mRedirectCheck;
98
99
  nsDOMPerformanceNavigationType mNavigationType;
100
  DOMTimeMilliSec mNavigationStart;
101
  mozilla::TimeStamp mNavigationStartTimeStamp;
102
  DOMTimeMilliSec DurationFromStart();
103
104
  DOMTimeMilliSec mFetchStart;
105
  DOMTimeMilliSec mRedirectStart;
106
  DOMTimeMilliSec mRedirectEnd;
107
  DOMTimeMilliSec mBeforeUnloadStart;
108
  DOMTimeMilliSec mUnloadStart;
109
  DOMTimeMilliSec mUnloadEnd;
110
  DOMTimeMilliSec mNavigationEnd;
111
  DOMTimeMilliSec mLoadEventStart;
112
  DOMTimeMilliSec mLoadEventEnd;
113
114
  DOMTimeMilliSec mDOMLoading;
115
  DOMTimeMilliSec mDOMInteractive;
116
  DOMTimeMilliSec mDOMContentLoadedEventStart;
117
  DOMTimeMilliSec mDOMContentLoadedEventEnd;
118
  DOMTimeMilliSec mDOMComplete;
119
};
120
121
#endif /* nsDOMNavigationTiming_h___ */
(-)a/dom/base/nsGlobalWindow.cpp (-1 / +31 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 1113-1128   nsGlobalWindow::CleanUp(PRBool aIgnoreMo Link Here 
1113
  mScrollbars = nsnull;
1115
  mScrollbars = nsnull;
1114
  mLocation = nsnull;
1116
  mLocation = nsnull;
1115
  mHistory = nsnull;
1117
  mHistory = nsnull;
1116
  mFrames = nsnull;
1118
  mFrames = nsnull;
1117
  mApplicationCache = nsnull;
1119
  mApplicationCache = nsnull;
1118
  mIndexedDB = nsnull;
1120
  mIndexedDB = nsnull;
1119
  mPendingStorageEventsObsolete = nsnull;
1121
  mPendingStorageEventsObsolete = nsnull;
1120
1122
1123
  mPerformance = nsnull;
1121
1124
1122
  ClearControllers();
1125
  ClearControllers();
1123
1126
1124
  mOpener = nsnull;             // Forces Release
1127
  mOpener = nsnull;             // Forces Release
1125
  if (mContext) {
1128
  if (mContext) {
1126
#ifdef DEBUG
1129
#ifdef DEBUG
1127
    nsCycleCollector_DEBUG_shouldBeFreed(mContext);
1130
    nsCycleCollector_DEBUG_shouldBeFreed(mContext);
1128
#endif
1131
#endif
 Lines 1337-1352   NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION( Link Here 
1337
  NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
1340
  NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
1338
  NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
1341
  NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
1339
  NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow)
1342
  NS_INTERFACE_MAP_ENTRY(nsPIDOMWindow)
1340
  NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow)
1343
  NS_INTERFACE_MAP_ENTRY(nsIDOMStorageWindow)
1341
  NS_INTERFACE_MAP_ENTRY(nsIDOMStorageIndexedDB)
1344
  NS_INTERFACE_MAP_ENTRY(nsIDOMStorageIndexedDB)
1342
  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
1345
  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
1343
  NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
1346
  NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
1344
  NS_INTERFACE_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
1347
  NS_INTERFACE_MAP_ENTRY(nsIDOMWindow_2_0_BRANCH)
1348
  NS_INTERFACE_MAP_ENTRY(nsIDOMWindowPerformance)
1345
  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window)
1349
  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Window)
1346
  OUTER_WINDOW_ONLY
1350
  OUTER_WINDOW_ONLY
1347
    NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
1351
    NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
1348
  END_OUTER_WINDOW_ONLY
1352
  END_OUTER_WINDOW_ONLY
1349
NS_INTERFACE_MAP_END
1353
NS_INTERFACE_MAP_END
1350
1354
1351
1355
1352
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGlobalWindow)
1356
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGlobalWindow)
 Lines 2716-2732   nsGlobalWindow::PostHandleEvent(nsEventC Link Here 
2716
      nsEvent event(NS_IS_TRUSTED_EVENT(aVisitor.mEvent), NS_LOAD);
2720
      nsEvent event(NS_IS_TRUSTED_EVENT(aVisitor.mEvent), NS_LOAD);
2717
      event.flags |= NS_EVENT_FLAG_CANT_BUBBLE;
2721
      event.flags |= NS_EVENT_FLAG_CANT_BUBBLE;
2718
2722
2719
      // Most of the time we could get a pres context to pass in here,
2723
      // Most of the time we could get a pres context to pass in here,
2720
      // but not always (i.e. if this window is not shown there won't
2724
      // but not always (i.e. if this window is not shown there won't
2721
      // be a pres context available). Since we're not firing a GUI
2725
      // be a pres context available). Since we're not firing a GUI
2722
      // event we don't need a pres context anyway so we just pass
2726
      // event we don't need a pres context anyway so we just pass
2723
      // null as the pres context all the time here.
2727
      // null as the pres context all the time here.
2724
2725
      nsEventDispatcher::Dispatch(content, nsnull, &event, nsnull, &status);
2728
      nsEventDispatcher::Dispatch(content, nsnull, &event, nsnull, &status);
2726
    }
2729
    }
2727
  }
2730
  }
2728
2731
2729
  return NS_OK;
2732
  return NS_OK;
2730
}
2733
}
2731
2734
2732
nsresult
2735
nsresult
 Lines 2947-2962   nsGlobalWindow::GetHistory(nsIDOMHistory Link Here 
2947
    }
2950
    }
2948
  }
2951
  }
2949
2952
2950
  NS_IF_ADDREF(*aHistory = mHistory);
2953
  NS_IF_ADDREF(*aHistory = mHistory);
2951
  return NS_OK;
2954
  return NS_OK;
2952
}
2955
}
2953
2956
2954
NS_IMETHODIMP
2957
NS_IMETHODIMP
2958
nsGlobalWindow::GetPerformance(nsIDOMPerformance** aPerformance)
2959
{
2960
  FORWARD_TO_INNER(GetPerformance, (aPerformance), NS_ERROR_NOT_INITIALIZED);
2961
2962
  *aPerformance = nsnull;
2963
2964
  if (nsGlobalWindow::HasPerformanceSupport()) {
2965
    if (!mPerformance) {
2966
      nsRefPtr<nsDOMNavigationTiming> timing = mDoc->GetNavigationTiming();
2967
      if (timing) {
2968
        mPerformance = new nsPerformance(timing);
2969
      }
2970
    }
2971
    NS_IF_ADDREF(*aPerformance = mPerformance);
2972
  }
2973
  return NS_OK;
2974
}
2975
2976
NS_IMETHODIMP
2955
nsGlobalWindow::GetParent(nsIDOMWindow** aParent)
2977
nsGlobalWindow::GetParent(nsIDOMWindow** aParent)
2956
{
2978
{
2957
  FORWARD_TO_OUTER(GetParent, (aParent), NS_ERROR_NOT_INITIALIZED);
2979
  FORWARD_TO_OUTER(GetParent, (aParent), NS_ERROR_NOT_INITIALIZED);
2958
2980
2959
  *aParent = nsnull;
2981
  *aParent = nsnull;
2960
  if (!mDocShell)
2982
  if (!mDocShell)
2961
    return NS_OK;
2983
    return NS_OK;
2962
2984
 Lines 10072-10087   nsGlobalWindow::GetURL(nsIDOMMozURLPrope Link Here 
10072
10094
10073
// static
10095
// static
10074
bool
10096
bool
10075
nsGlobalWindow::HasIndexedDBSupport()
10097
nsGlobalWindow::HasIndexedDBSupport()
10076
{
10098
{
10077
  return Preferences::GetBool("indexedDB.feature.enabled", PR_TRUE);
10099
  return Preferences::GetBool("indexedDB.feature.enabled", PR_TRUE);
10078
}
10100
}
10079
10101
10102
// static
10103
bool
10104
nsGlobalWindow::HasPerformanceSupport() 
10105
{
10106
  return Preferences::GetBool("dom.enable_performance", PR_FALSE);
10107
}
10108
10109
10080
// nsGlobalChromeWindow implementation
10110
// nsGlobalChromeWindow implementation
10081
10111
10082
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalChromeWindow)
10112
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalChromeWindow)
10083
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGlobalChromeWindow,
10113
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGlobalChromeWindow,
10084
                                                  nsGlobalWindow)
10114
                                                  nsGlobalWindow)
10085
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBrowserDOMWindow)
10115
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBrowserDOMWindow)
10086
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMessageManager)
10116
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMessageManager)
10087
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
10117
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
(-)a/dom/base/nsGlobalWindow.h (-1 / +9 lines)
Line     Link Here 
 Lines 132-147   class nsIDOMEvent; Link Here 
132
class nsIScrollableFrame;
132
class nsIScrollableFrame;
133
class nsIControllers;
133
class nsIControllers;
134
134
135
class nsBarProp;
135
class nsBarProp;
136
class nsLocation;
136
class nsLocation;
137
class nsNavigator;
137
class nsNavigator;
138
class nsScreen;
138
class nsScreen;
139
class nsHistory;
139
class nsHistory;
140
class nsPerformance;
140
class nsIDocShellLoadInfo;
141
class nsIDocShellLoadInfo;
141
class WindowStateHolder;
142
class WindowStateHolder;
142
class nsGlobalWindowObserver;
143
class nsGlobalWindowObserver;
143
class nsGlobalWindow;
144
class nsGlobalWindow;
144
class nsDummyJavaPluginOwner;
145
class nsDummyJavaPluginOwner;
145
class PostMessageEvent;
146
class PostMessageEvent;
146
class nsRunnable;
147
class nsRunnable;
147
148
 Lines 279-295   class nsGlobalWindow : public nsPIDOMWin Link Here 
279
                       public nsIDOM3EventTarget,
280
                       public nsIDOM3EventTarget,
280
                       public nsIDOMNSEventTarget,
281
                       public nsIDOMNSEventTarget,
281
                       public nsIDOMStorageWindow,
282
                       public nsIDOMStorageWindow,
282
                       public nsIDOMStorageIndexedDB,
283
                       public nsIDOMStorageIndexedDB,
283
                       public nsSupportsWeakReference,
284
                       public nsSupportsWeakReference,
284
                       public nsIInterfaceRequestor,
285
                       public nsIInterfaceRequestor,
285
                       public nsIDOMWindow_2_0_BRANCH,
286
                       public nsIDOMWindow_2_0_BRANCH,
286
                       public nsWrapperCache,
287
                       public nsWrapperCache,
287
                       public PRCListStr
288
                       public PRCListStr,
289
                       public nsIDOMWindowPerformance
288
{
290
{
289
public:
291
public:
290
  friend class nsDOMMozURLProperty;
292
  friend class nsDOMMozURLProperty;
291
293
292
  typedef mozilla::TimeStamp TimeStamp;
294
  typedef mozilla::TimeStamp TimeStamp;
293
  typedef mozilla::TimeDuration TimeDuration;
295
  typedef mozilla::TimeDuration TimeDuration;
294
296
295
  // public methods
297
  // public methods
 Lines 327-342   public: Link Here 
327
  NS_DECL_NSIDOMWINDOW
329
  NS_DECL_NSIDOMWINDOW
328
330
329
  // nsIDOMWindow2
331
  // nsIDOMWindow2
330
  NS_DECL_NSIDOMWINDOW2
332
  NS_DECL_NSIDOMWINDOW2
331
333
332
  // nsIDOMWindowInternal
334
  // nsIDOMWindowInternal
333
  NS_DECL_NSIDOMWINDOWINTERNAL
335
  NS_DECL_NSIDOMWINDOWINTERNAL
334
336
337
  // nsIDOMWindowPerformance
338
  NS_DECL_NSIDOMWINDOWPERFORMANCE
339
335
  // nsIDOMJSWindow
340
  // nsIDOMJSWindow
336
  NS_DECL_NSIDOMJSWINDOW
341
  NS_DECL_NSIDOMJSWINDOW
337
342
338
  // nsIDOMEventTarget
343
  // nsIDOMEventTarget
339
  NS_DECL_NSIDOMEVENTTARGET
344
  NS_DECL_NSIDOMEVENTTARGET
340
345
341
  // nsIDOM3EventTarget
346
  // nsIDOM3EventTarget
342
  NS_DECL_NSIDOM3EVENTTARGET
347
  NS_DECL_NSIDOM3EVENTTARGET
 Lines 564-579   public: Link Here 
564
  }
569
  }
565
570
566
  static nsGlobalWindow* GetOuterWindowWithId(PRUint64 aWindowID) {
571
  static nsGlobalWindow* GetOuterWindowWithId(PRUint64 aWindowID) {
567
    return sOuterWindowsById ? sOuterWindowsById->Get(aWindowID) : nsnull;
572
    return sOuterWindowsById ? sOuterWindowsById->Get(aWindowID) : nsnull;
568
  }
573
  }
569
574
570
  static bool HasIndexedDBSupport();
575
  static bool HasIndexedDBSupport();
571
576
577
  static bool HasPerformanceSupport();
578
572
private:
579
private:
573
  // Enable updates for the accelerometer.
580
  // Enable updates for the accelerometer.
574
  void EnableDeviceMotionUpdates();
581
  void EnableDeviceMotionUpdates();
575
582
576
  // Disables updates for the accelerometer.
583
  // Disables updates for the accelerometer.
577
  void DisableDeviceMotionUpdates();
584
  void DisableDeviceMotionUpdates();
578
585
579
protected:
586
protected:
 Lines 898-913   protected: Link Here 
898
  nsCOMPtr<nsIScriptContext>    mContext;
905
  nsCOMPtr<nsIScriptContext>    mContext;
899
  nsWeakPtr                     mOpener;
906
  nsWeakPtr                     mOpener;
900
  nsCOMPtr<nsIControllers>      mControllers;
907
  nsCOMPtr<nsIControllers>      mControllers;
901
  nsCOMPtr<nsIArray>            mArguments;
908
  nsCOMPtr<nsIArray>            mArguments;
902
  nsCOMPtr<nsIArray>            mArgumentsLast;
909
  nsCOMPtr<nsIArray>            mArgumentsLast;
903
  nsCOMPtr<nsIPrincipal>        mArgumentsOrigin;
910
  nsCOMPtr<nsIPrincipal>        mArgumentsOrigin;
904
  nsRefPtr<nsNavigator>         mNavigator;
911
  nsRefPtr<nsNavigator>         mNavigator;
905
  nsRefPtr<nsScreen>            mScreen;
912
  nsRefPtr<nsScreen>            mScreen;
913
  nsRefPtr<nsPerformance>       mPerformance;
906
  nsRefPtr<nsDOMWindowList>     mFrames;
914
  nsRefPtr<nsDOMWindowList>     mFrames;
907
  nsRefPtr<nsBarProp>           mMenubar;
915
  nsRefPtr<nsBarProp>           mMenubar;
908
  nsRefPtr<nsBarProp>           mToolbar;
916
  nsRefPtr<nsBarProp>           mToolbar;
909
  nsRefPtr<nsBarProp>           mLocationbar;
917
  nsRefPtr<nsBarProp>           mLocationbar;
910
  nsRefPtr<nsBarProp>           mPersonalbar;
918
  nsRefPtr<nsBarProp>           mPersonalbar;
911
  nsRefPtr<nsBarProp>           mStatusbar;
919
  nsRefPtr<nsBarProp>           mStatusbar;
912
  nsRefPtr<nsBarProp>           mScrollbars;
920
  nsRefPtr<nsBarProp>           mScrollbars;
913
  nsCOMPtr<nsIWeakReference>    mWindowUtils;
921
  nsCOMPtr<nsIWeakReference>    mWindowUtils;
(-)a/dom/base/nsPerformance.cpp (+276 lines)
Line     Link Here 
Line 0    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
}
(-)a/dom/base/nsPerformance.h (+95 lines)
Line     Link Here 
Line 0    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 82-92   XPIDLSRCS = \ Link Here 
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
	nsIStructuredCloneContainer.idl		\
89
	nsIStructuredCloneContainer.idl		\
90
	nsIDOMPerformance.idl			\
91
	nsIDOMPerformanceTiming.idl		\
92
	nsIDOMPerformanceNavigation.idl		\
90
	$(NULL)
93
	$(NULL)
91
94
92
include $(topsrcdir)/config/rules.mk
95
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;
(-)a/dom/interfaces/base/nsIDOMPerformance.idl (+50 lines)
Line     Link Here 
Line 0    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
(-)a/dom/interfaces/base/nsIDOMPerformanceNavigation.idl (+55 lines)
Line     Link Here 
Line 0    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
(-)a/dom/interfaces/base/nsIDOMPerformanceTiming.idl (+67 lines)
Line     Link Here 
Line 0    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 (+11 lines)
Line     Link Here 
 Lines 41-56    Link Here 
41
41
42
%{ C++
42
%{ C++
43
#include "jspubtd.h"
43
#include "jspubtd.h"
44
%}
44
%}
45
45
46
interface nsIPrompt;
46
interface nsIPrompt;
47
interface nsIControllers;
47
interface nsIControllers;
48
interface nsIDOMLocation;
48
interface nsIDOMLocation;
49
interface nsIDOMPerformance;
49
interface nsIVariant;
50
interface nsIVariant;
50
interface nsIAnimationFrameListener;
51
interface nsIAnimationFrameListener;
51
interface nsIDOMMediaQueryList;
52
interface nsIDOMMediaQueryList;
52
53
53
[scriptable, uuid(3a7b0839-b9d6-42ff-8ba6-910aba60a966)]
54
[scriptable, uuid(3a7b0839-b9d6-42ff-8ba6-910aba60a966)]
54
interface nsIDOMWindowInternal : nsIDOMWindow2
55
interface nsIDOMWindowInternal : nsIDOMWindow2
55
{
56
{
56
  readonly attribute nsIDOMWindowInternal        window;
57
  readonly attribute nsIDOMWindowInternal        window;
 Lines 251-258   interface nsIDOMMozURLProperty : nsISupp Link Here 
251
  void revokeObjectURL(in DOMString URL);
252
  void revokeObjectURL(in DOMString URL);
252
};
253
};
253
254
254
[scriptable, uuid(05563c0c-b74c-41ad-91d1-bc22d580a581)]
255
[scriptable, uuid(05563c0c-b74c-41ad-91d1-bc22d580a581)]
255
interface nsIDOMWindow_2_0_BRANCH : nsISupports
256
interface nsIDOMWindow_2_0_BRANCH : nsISupports
256
{
257
{
257
  readonly attribute nsIDOMMozURLProperty URL;
258
  readonly attribute nsIDOMMozURLProperty URL;
258
};
259
};
260
261
[scriptable, uuid(2146c906-57f7-486c-a1b4-8cdb57ef577f)]
262
interface nsIDOMWindowPerformance : nsISupports
263
{
264
  /**
265
   * A namespace to hold performance related data and statistics.
266
   */
267
  readonly attribute nsIDOMPerformance performance;
268
};
269
(-)a/js/src/xpconnect/src/Makefile.in (+1 lines)
Line     Link Here 
 Lines 116-131   LOCAL_INCLUDES = \ Link Here 
116
		-I$(topsrcdir)/caps/include \
116
		-I$(topsrcdir)/caps/include \
117
		-I$(topsrcdir)/content/base/src \
117
		-I$(topsrcdir)/content/base/src \
118
		-I$(topsrcdir)/content/html/content/src \
118
		-I$(topsrcdir)/content/html/content/src \
119
		-I$(topsrcdir)/content/html/document/src \
119
		-I$(topsrcdir)/content/html/document/src \
120
		-I$(topsrcdir)/content/svg/content/src \
120
		-I$(topsrcdir)/content/svg/content/src \
121
		-I$(topsrcdir)/layout/style \
121
		-I$(topsrcdir)/layout/style \
122
		-I$(topsrcdir)/layout/base \
122
		-I$(topsrcdir)/layout/base \
123
		-I$(topsrcdir)/dom/base \
123
		-I$(topsrcdir)/dom/base \
124
		-I$(topsrcdir)/xpcom/ds \
124
		$(NULL)
125
		$(NULL)
125
126
126
SHARED_LIBRARY_LIBS = \
127
SHARED_LIBRARY_LIBS = \
127
  ../loader/$(LIB_PREFIX)jsloader_s.$(LIB_SUFFIX) \
128
  ../loader/$(LIB_PREFIX)jsloader_s.$(LIB_SUFFIX) \
128
  ../wrappers/$(LIB_PREFIX)xpcwrappers_s.$(LIB_SUFFIX) \
129
  ../wrappers/$(LIB_PREFIX)xpcwrappers_s.$(LIB_SUFFIX) \
129
  $(NULL)
130
  $(NULL)
130
131
131
include $(topsrcdir)/config/rules.mk
132
include $(topsrcdir)/config/rules.mk
(-)a/layout/base/Makefile.in (+1 lines)
Line     Link Here 
 Lines 160-175   LOCAL_INCLUDES += \ Link Here 
160
		-I$(srcdir)/../xul/base/src/tree/src \
160
		-I$(srcdir)/../xul/base/src/tree/src \
161
		-I$(srcdir)/../../content/base/src \
161
		-I$(srcdir)/../../content/base/src \
162
		-I$(srcdir)/../../content/events/src \
162
		-I$(srcdir)/../../content/events/src \
163
		-I$(srcdir)/../../content/xbl/src \
163
		-I$(srcdir)/../../content/xbl/src \
164
		-I$(srcdir)/../../view/src \
164
		-I$(srcdir)/../../view/src \
165
		-I$(srcdir)/../../dom/base \
165
		-I$(srcdir)/../../dom/base \
166
		-I$(srcdir)/../../content/html/content/src \
166
		-I$(srcdir)/../../content/html/content/src \
167
		-I$(srcdir)/../../content/svg/content/src \
167
		-I$(srcdir)/../../content/svg/content/src \
168
		-I$(topsrcdir)/xpcom/ds \
168
		-I$(srcdir)/../svg/base/src \
169
		-I$(srcdir)/../svg/base/src \
169
		-I$(srcdir)/../mathml \
170
		-I$(srcdir)/../mathml \
170
		$(NULL)
171
		$(NULL)
171
172
172
CXXFLAGS += $(MOZ_CAIRO_CFLAGS)
173
CXXFLAGS += $(MOZ_CAIRO_CFLAGS)
173
174
174
DEFINES += -D_IMPL_NS_LAYOUT
175
DEFINES += -D_IMPL_NS_LAYOUT
175
176
(-)a/layout/base/nsDocumentViewer.cpp (+21 lines)
Line     Link Here 
 Lines 110-125    Link Here 
110
#include "nsIXULDocument.h"
110
#include "nsIXULDocument.h"
111
#include "nsXULPopupManager.h"
111
#include "nsXULPopupManager.h"
112
#endif
112
#endif
113
#include "nsPrintfCString.h"
113
#include "nsPrintfCString.h"
114
114
115
#include "nsIClipboardHelper.h"
115
#include "nsIClipboardHelper.h"
116
116
117
#include "nsPIDOMWindow.h"
117
#include "nsPIDOMWindow.h"
118
#include "nsDOMNavigationTiming.h"
118
#include "nsPIWindowRoot.h"
119
#include "nsPIWindowRoot.h"
119
#include "nsJSEnvironment.h"
120
#include "nsJSEnvironment.h"
120
#include "nsFocusManager.h"
121
#include "nsFocusManager.h"
121
122
122
#include "nsIScrollableFrame.h"
123
#include "nsIScrollableFrame.h"
123
#include "nsIHTMLDocument.h"
124
#include "nsIHTMLDocument.h"
124
#include "nsITimelineService.h"
125
#include "nsITimelineService.h"
125
#include "nsGfxCIID.h"
126
#include "nsGfxCIID.h"
 Lines 321-336   public: Link Here 
321
  /**
322
  /**
322
   * Find the view to use as the container view for MakeWindow. Returns
323
   * Find the view to use as the container view for MakeWindow. Returns
323
   * null if this will be the root of a view manager hierarchy. In that
324
   * null if this will be the root of a view manager hierarchy. In that
324
   * case, if mParentWidget is null then this document should not even
325
   * case, if mParentWidget is null then this document should not even
325
   * be displayed.
326
   * be displayed.
326
   */
327
   */
327
  virtual nsIView* FindContainerView();
328
  virtual nsIView* FindContainerView();
328
329
330
  /**
331
   * Set collector for navigation timing data (load, unload events).
332
   */
333
  virtual void SetNavigationTiming(nsDOMNavigationTiming* timing);
334
329
  // nsIContentViewerEdit
335
  // nsIContentViewerEdit
330
  NS_DECL_NSICONTENTVIEWEREDIT
336
  NS_DECL_NSICONTENTVIEWEREDIT
331
337
332
  // nsIContentViewerFile
338
  // nsIContentViewerFile
333
  NS_DECL_NSICONTENTVIEWERFILE
339
  NS_DECL_NSICONTENTVIEWERFILE
334
340
335
  // nsIMarkupDocumentViewer
341
  // nsIMarkupDocumentViewer
336
  NS_DECL_NSIMARKUPDOCUMENTVIEWER
342
  NS_DECL_NSIMARKUPDOCUMENTVIEWER
 Lines 985-1000   DocumentViewerImpl::InitInternal(nsIWidg Link Here 
985
    // MakeWindow())...
991
    // MakeWindow())...
986
992
987
    rv = InitPresentationStuff(!makeCX);
993
    rv = InitPresentationStuff(!makeCX);
988
  }
994
  }
989
995
990
  return rv;
996
  return rv;
991
}
997
}
992
998
999
void DocumentViewerImpl::SetNavigationTiming(nsDOMNavigationTiming* timing)
1000
{
1001
  NS_ASSERTION(mDocument, "Must have a document to set navigation timing.");
1002
  if (mDocument) {
1003
    mDocument->SetNavigationTiming(timing);
1004
  }
1005
}
1006
993
//
1007
//
994
// LoadComplete(aStatus)
1008
// LoadComplete(aStatus)
995
//
1009
//
996
//   aStatus - The status returned from loading the document.
1010
//   aStatus - The status returned from loading the document.
997
//
1011
//
998
// This method is called by the container when the document has been
1012
// This method is called by the container when the document has been
999
// completely loaded.
1013
// completely loaded.
1000
//
1014
//
 Lines 1046-1063   DocumentViewerImpl::LoadComplete(nsresul Link Here 
1046
    // onload to the document content since that would likely confuse scripts
1060
    // onload to the document content since that would likely confuse scripts
1047
    // on the page.
1061
    // on the page.
1048
1062
1049
    nsIDocShell *docShell = window->GetDocShell();
1063
    nsIDocShell *docShell = window->GetDocShell();
1050
    NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED);
1064
    NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED);
1051
1065
1052
    docShell->GetRestoringDocument(&restoring);
1066
    docShell->GetRestoringDocument(&restoring);
1053
    if (!restoring) {
1067
    if (!restoring) {
1068
      nsRefPtr<nsDOMNavigationTiming> timing(mDocument->GetNavigationTiming());
1069
      if (timing) {
1070
        timing->NotifyLoadEventStart();
1071
      }
1054
      nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull,
1072
      nsEventDispatcher::Dispatch(window, mPresContext, &event, nsnull,
1055
                                  &status);
1073
                                  &status);
1074
      if (timing) {
1075
        timing->NotifyLoadEventEnd();
1076
      }
1056
#ifdef MOZ_TIMELINE
1077
#ifdef MOZ_TIMELINE
1057
      // if navigator.xul's load is complete, the main nav window is visible
1078
      // if navigator.xul's load is complete, the main nav window is visible
1058
      // mark that point.
1079
      // mark that point.
1059
1080
1060
      nsIURI *uri = mDocument ? mDocument->GetDocumentURI() : nsnull;
1081
      nsIURI *uri = mDocument ? mDocument->GetDocumentURI() : nsnull;
1061
1082
1062
      if (uri) {
1083
      if (uri) {
1063
        //printf("DEBUG: getting spec for uri (%p)\n", uri.get());
1084
        //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___ */
(-)a/modules/libpref/src/init/all.js (+3 lines)
Line     Link Here 
 Lines 86-101   pref("offline-apps.quota.max", 20 Link Here 
86
// (in kilobytes)
86
// (in kilobytes)
87
pref("offline-apps.quota.warn",        51200);
87
pref("offline-apps.quota.warn",        51200);
88
88
89
// Whether or not indexedDB is enabled.
89
// Whether or not indexedDB is enabled.
90
pref("dom.indexedDB.enabled", true);
90
pref("dom.indexedDB.enabled", true);
91
// Space to allow indexedDB databases before prompting (in MB).
91
// Space to allow indexedDB databases before prompting (in MB).
92
pref("dom.indexedDB.warningQuota", 50);
92
pref("dom.indexedDB.warningQuota", 50);
93
93
94
// Whether window.performance is enabled
95
pref("dom.enable_performance", true);
96
94
// Fastback caching - if this pref is negative, then we calculate the number
97
// Fastback caching - if this pref is negative, then we calculate the number
95
// of content viewers to cache based on the amount of available memory.
98
// of content viewers to cache based on the amount of available memory.
96
pref("browser.sessionhistory.max_total_viewers", -1);
99
pref("browser.sessionhistory.max_total_viewers", -1);
97
100
98
pref("browser.sessionhistory.optimize_eviction", true);
101
pref("browser.sessionhistory.optimize_eviction", true);
99
102
100
pref("ui.use_native_colors", true);
103
pref("ui.use_native_colors", true);
101
pref("ui.use_native_popup_windows", false);
104
pref("ui.use_native_popup_windows", false);

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