Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /** |
michael@0 | 7 | * The interface to nsISHentry. Each document or subframe in |
michael@0 | 8 | * Session History will have a nsISHEntry associated with it which will |
michael@0 | 9 | * hold all information required to recreate the document from history |
michael@0 | 10 | * |
michael@0 | 11 | */ |
michael@0 | 12 | |
michael@0 | 13 | #include "nsISupports.idl" |
michael@0 | 14 | |
michael@0 | 15 | interface nsILayoutHistoryState; |
michael@0 | 16 | interface nsIContentViewer; |
michael@0 | 17 | interface nsIURI; |
michael@0 | 18 | interface nsIInputStream; |
michael@0 | 19 | interface nsIDocShellTreeItem; |
michael@0 | 20 | interface nsISupportsArray; |
michael@0 | 21 | interface nsIStructuredCloneContainer; |
michael@0 | 22 | interface nsIBFCacheEntry; |
michael@0 | 23 | |
michael@0 | 24 | %{C++ |
michael@0 | 25 | struct nsIntRect; |
michael@0 | 26 | class nsDocShellEditorData; |
michael@0 | 27 | class nsSHEntryShared; |
michael@0 | 28 | %} |
michael@0 | 29 | [ref] native nsIntRect(nsIntRect); |
michael@0 | 30 | [ptr] native nsDocShellEditorDataPtr(nsDocShellEditorData); |
michael@0 | 31 | [ptr] native nsSHEntryShared(nsSHEntryShared); |
michael@0 | 32 | |
michael@0 | 33 | [scriptable, uuid(9eed7e92-1121-46f2-95e5-2f5c0dca46f0)] |
michael@0 | 34 | interface nsISHEntry : nsISupports |
michael@0 | 35 | { |
michael@0 | 36 | /** |
michael@0 | 37 | * A readonly property that returns the URI |
michael@0 | 38 | * of the current entry. The object returned is |
michael@0 | 39 | * of type nsIURI |
michael@0 | 40 | */ |
michael@0 | 41 | readonly attribute nsIURI URI; |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * A readonly property that returns the title |
michael@0 | 45 | * of the current entry. The object returned |
michael@0 | 46 | * is a encoded string |
michael@0 | 47 | */ |
michael@0 | 48 | readonly attribute wstring title; |
michael@0 | 49 | |
michael@0 | 50 | /** |
michael@0 | 51 | * A readonly property that returns a boolean |
michael@0 | 52 | * flag which indicates if the entry was created as a |
michael@0 | 53 | * result of a subframe navigation. This flag will be |
michael@0 | 54 | * 'false' when a frameset page is visited for |
michael@0 | 55 | * the first time. This flag will be 'true' for all |
michael@0 | 56 | * history entries created as a result of a subframe |
michael@0 | 57 | * navigation. |
michael@0 | 58 | */ |
michael@0 | 59 | readonly attribute boolean isSubFrame; |
michael@0 | 60 | |
michael@0 | 61 | /** URI for the document */ |
michael@0 | 62 | void setURI(in nsIURI aURI); |
michael@0 | 63 | |
michael@0 | 64 | /** Referrer URI */ |
michael@0 | 65 | attribute nsIURI referrerURI; |
michael@0 | 66 | |
michael@0 | 67 | /** Content viewer, for fast restoration of presentation */ |
michael@0 | 68 | attribute nsIContentViewer contentViewer; |
michael@0 | 69 | |
michael@0 | 70 | /** Whether the content viewer is marked "sticky" */ |
michael@0 | 71 | attribute boolean sticky; |
michael@0 | 72 | |
michael@0 | 73 | /** Saved state of the global window object */ |
michael@0 | 74 | attribute nsISupports windowState; |
michael@0 | 75 | |
michael@0 | 76 | /** |
michael@0 | 77 | * Saved position and dimensions of the content viewer; we must adjust the |
michael@0 | 78 | * root view's widget accordingly if this has changed when the presentation |
michael@0 | 79 | * is restored. |
michael@0 | 80 | */ |
michael@0 | 81 | [noscript] void getViewerBounds(in nsIntRect bounds); |
michael@0 | 82 | [noscript] void setViewerBounds([const] in nsIntRect bounds); |
michael@0 | 83 | |
michael@0 | 84 | /** |
michael@0 | 85 | * Saved child docshells corresponding to contentViewer. The child shells |
michael@0 | 86 | * are restored as children of the parent docshell, in this order, when the |
michael@0 | 87 | * parent docshell restores a saved presentation. |
michael@0 | 88 | */ |
michael@0 | 89 | |
michael@0 | 90 | /** Append a child shell to the end of our list. */ |
michael@0 | 91 | void addChildShell(in nsIDocShellTreeItem shell); |
michael@0 | 92 | |
michael@0 | 93 | /** |
michael@0 | 94 | * Get the child shell at |index|; returns null if |index| is out of bounds. |
michael@0 | 95 | */ |
michael@0 | 96 | nsIDocShellTreeItem childShellAt(in long index); |
michael@0 | 97 | |
michael@0 | 98 | /** |
michael@0 | 99 | * Clear the child shell list. |
michael@0 | 100 | */ |
michael@0 | 101 | void clearChildShells(); |
michael@0 | 102 | |
michael@0 | 103 | /** Saved refresh URI list for the content viewer */ |
michael@0 | 104 | attribute nsISupportsArray refreshURIList; |
michael@0 | 105 | |
michael@0 | 106 | /** |
michael@0 | 107 | * Ensure that the cached presentation members are self-consistent. |
michael@0 | 108 | * If either |contentViewer| or |windowState| are null, then all of the |
michael@0 | 109 | * following members are cleared/reset: |
michael@0 | 110 | * contentViewer, sticky, windowState, viewerBounds, childShells, |
michael@0 | 111 | * refreshURIList. |
michael@0 | 112 | */ |
michael@0 | 113 | void syncPresentationState(); |
michael@0 | 114 | |
michael@0 | 115 | /** Title for the document */ |
michael@0 | 116 | void setTitle(in AString aTitle); |
michael@0 | 117 | |
michael@0 | 118 | /** Post Data for the document */ |
michael@0 | 119 | attribute nsIInputStream postData; |
michael@0 | 120 | |
michael@0 | 121 | /** LayoutHistoryState for scroll position and form values */ |
michael@0 | 122 | attribute nsILayoutHistoryState layoutHistoryState; |
michael@0 | 123 | |
michael@0 | 124 | /** parent of this entry */ |
michael@0 | 125 | attribute nsISHEntry parent; |
michael@0 | 126 | |
michael@0 | 127 | /** |
michael@0 | 128 | * The loadType for this entry. This is typically loadHistory except |
michael@0 | 129 | * when reload is pressed, it has the appropriate reload flag |
michael@0 | 130 | */ |
michael@0 | 131 | attribute unsigned long loadType; |
michael@0 | 132 | |
michael@0 | 133 | /** |
michael@0 | 134 | * An ID to help identify this entry from others during |
michael@0 | 135 | * subframe navigation |
michael@0 | 136 | */ |
michael@0 | 137 | attribute unsigned long ID; |
michael@0 | 138 | |
michael@0 | 139 | /** attribute to set and get the cache key for the entry */ |
michael@0 | 140 | attribute nsISupports cacheKey; |
michael@0 | 141 | |
michael@0 | 142 | /** attribute to indicate whether layoutHistoryState should be saved */ |
michael@0 | 143 | attribute boolean saveLayoutStateFlag; |
michael@0 | 144 | |
michael@0 | 145 | /** attribute to indicate whether the page is already expired in cache */ |
michael@0 | 146 | attribute boolean expirationStatus; |
michael@0 | 147 | |
michael@0 | 148 | /** |
michael@0 | 149 | * attribute to indicate the content-type of the document that this |
michael@0 | 150 | * is a session history entry for |
michael@0 | 151 | */ |
michael@0 | 152 | attribute ACString contentType; |
michael@0 | 153 | |
michael@0 | 154 | /** |
michael@0 | 155 | * If we created this SHEntry via history.pushState or modified it via |
michael@0 | 156 | * history.replaceState, and if we changed the SHEntry's URI via the |
michael@0 | 157 | * push/replaceState call, and if the SHEntry's new URI differs from its |
michael@0 | 158 | * old URI by more than just the hash, then we set this field to true. |
michael@0 | 159 | * |
michael@0 | 160 | * Additionally, if this SHEntry was created by calling pushState from a |
michael@0 | 161 | * SHEntry whose URI was modified, this SHEntry's URIWasModified field is |
michael@0 | 162 | * true. |
michael@0 | 163 | * |
michael@0 | 164 | */ |
michael@0 | 165 | attribute boolean URIWasModified; |
michael@0 | 166 | |
michael@0 | 167 | /** Set/Get scrollers' positon in anchored pages */ |
michael@0 | 168 | void setScrollPosition(in long x, in long y); |
michael@0 | 169 | void getScrollPosition(out long x, out long y); |
michael@0 | 170 | |
michael@0 | 171 | /** Additional ways to create an entry */ |
michael@0 | 172 | [noscript] void create(in nsIURI URI, in AString title, |
michael@0 | 173 | in nsIInputStream inputStream, |
michael@0 | 174 | in nsILayoutHistoryState layoutHistoryState, |
michael@0 | 175 | in nsISupports cacheKey, in ACString contentType, |
michael@0 | 176 | in nsISupports owner, |
michael@0 | 177 | in unsigned long long docshellID, |
michael@0 | 178 | in boolean dynamicCreation); |
michael@0 | 179 | |
michael@0 | 180 | nsISHEntry clone(); |
michael@0 | 181 | |
michael@0 | 182 | /** Attribute that indicates if this entry is for a subframe navigation */ |
michael@0 | 183 | void setIsSubFrame(in boolean aFlag); |
michael@0 | 184 | |
michael@0 | 185 | /** Return any content viewer present in or below this node in the |
michael@0 | 186 | nsSHEntry tree. This will differ from contentViewer in the case |
michael@0 | 187 | where a child nsSHEntry has the content viewer for this tree. */ |
michael@0 | 188 | nsIContentViewer getAnyContentViewer(out nsISHEntry ownerEntry); |
michael@0 | 189 | |
michael@0 | 190 | /** |
michael@0 | 191 | * Get the owner, if any, that was associated with the channel |
michael@0 | 192 | * that the document that was loaded to create this history entry |
michael@0 | 193 | * came from. |
michael@0 | 194 | */ |
michael@0 | 195 | attribute nsISupports owner; |
michael@0 | 196 | |
michael@0 | 197 | /** |
michael@0 | 198 | * Get/set data associated with this history state via a pushState() call, |
michael@0 | 199 | * serialized using structured clone. |
michael@0 | 200 | **/ |
michael@0 | 201 | attribute nsIStructuredCloneContainer stateData; |
michael@0 | 202 | |
michael@0 | 203 | /** |
michael@0 | 204 | * Gets the owning pointer to the editor data assosicated with |
michael@0 | 205 | * this shistory entry. This forgets its pointer, so free it when |
michael@0 | 206 | * you're done. |
michael@0 | 207 | */ |
michael@0 | 208 | [noscript, notxpcom] nsDocShellEditorDataPtr forgetEditorData(); |
michael@0 | 209 | |
michael@0 | 210 | /** |
michael@0 | 211 | * Sets the owning pointer to the editor data assosicated with |
michael@0 | 212 | * this shistory entry. Unless forgetEditorData() is called, this |
michael@0 | 213 | * shentry will destroy the editor data when it's destroyed. |
michael@0 | 214 | */ |
michael@0 | 215 | [noscript, notxpcom] void setEditorData(in nsDocShellEditorDataPtr aData); |
michael@0 | 216 | |
michael@0 | 217 | /** Returns true if this shistory entry is storing a detached editor. */ |
michael@0 | 218 | [noscript, notxpcom] boolean hasDetachedEditor(); |
michael@0 | 219 | |
michael@0 | 220 | /** |
michael@0 | 221 | * Returns true if the related docshell was added because of |
michael@0 | 222 | * dynamic addition of an iframe/frame. |
michael@0 | 223 | */ |
michael@0 | 224 | boolean isDynamicallyAdded(); |
michael@0 | 225 | |
michael@0 | 226 | /** |
michael@0 | 227 | * Returns true if any of the child entries returns true |
michael@0 | 228 | * when isDynamicallyAdded is called on it. |
michael@0 | 229 | */ |
michael@0 | 230 | boolean hasDynamicallyAddedChild(); |
michael@0 | 231 | |
michael@0 | 232 | /** |
michael@0 | 233 | * The history ID of the docshell. |
michael@0 | 234 | */ |
michael@0 | 235 | attribute unsigned long long docshellID; |
michael@0 | 236 | |
michael@0 | 237 | readonly attribute nsIBFCacheEntry BFCacheEntry; |
michael@0 | 238 | |
michael@0 | 239 | /** |
michael@0 | 240 | * Does this SHEntry point to the given BFCache entry? If so, evicting |
michael@0 | 241 | * the BFCache entry will evict the SHEntry, since the two entries |
michael@0 | 242 | * correspond to the same document. |
michael@0 | 243 | */ |
michael@0 | 244 | [notxpcom, noscript] |
michael@0 | 245 | boolean hasBFCacheEntry(in nsIBFCacheEntry aEntry); |
michael@0 | 246 | |
michael@0 | 247 | /** |
michael@0 | 248 | * Adopt aEntry's BFCacheEntry, so now both this and aEntry point to |
michael@0 | 249 | * aEntry's BFCacheEntry. |
michael@0 | 250 | */ |
michael@0 | 251 | void adoptBFCacheEntry(in nsISHEntry aEntry); |
michael@0 | 252 | |
michael@0 | 253 | /** |
michael@0 | 254 | * Create a new BFCache entry and drop our reference to our old one. This |
michael@0 | 255 | * call unlinks this SHEntry from any other SHEntries for its document. |
michael@0 | 256 | */ |
michael@0 | 257 | void abandonBFCacheEntry(); |
michael@0 | 258 | |
michael@0 | 259 | /** |
michael@0 | 260 | * Does this SHEntry correspond to the same document as aEntry? This is |
michael@0 | 261 | * true iff the two SHEntries have the same BFCacheEntry. So in |
michael@0 | 262 | * particular, sharesDocumentWith(aEntry) is guaranteed to return true if |
michael@0 | 263 | * it's preceeded by a call to adoptBFCacheEntry(aEntry). |
michael@0 | 264 | */ |
michael@0 | 265 | boolean sharesDocumentWith(in nsISHEntry aEntry); |
michael@0 | 266 | |
michael@0 | 267 | /** |
michael@0 | 268 | * True if this SHEntry corresponds to a document created by a srcdoc iframe. |
michael@0 | 269 | * Set when a value is assigned to srcdocData. |
michael@0 | 270 | */ |
michael@0 | 271 | readonly attribute boolean isSrcdocEntry; |
michael@0 | 272 | |
michael@0 | 273 | /** |
michael@0 | 274 | * Contents of the srcdoc attribute in a srcdoc iframe to be loaded instead |
michael@0 | 275 | * of the URI. Similar to a Data URI, this information is needed to |
michael@0 | 276 | * recreate the document at a later stage. |
michael@0 | 277 | * Setting this sets isSrcdocEntry to true |
michael@0 | 278 | */ |
michael@0 | 279 | attribute AString srcdocData; |
michael@0 | 280 | |
michael@0 | 281 | /** |
michael@0 | 282 | * When isSrcdocEntry is true, this contains the baseURI of the srcdoc |
michael@0 | 283 | * document for use in situations where it cannot otherwise be determined, |
michael@0 | 284 | * for example with view-source. |
michael@0 | 285 | */ |
michael@0 | 286 | attribute nsIURI baseURI; |
michael@0 | 287 | }; |
michael@0 | 288 | |
michael@0 | 289 | [scriptable, uuid(bb66ac35-253b-471f-a317-3ece940f04c5)] |
michael@0 | 290 | interface nsISHEntryInternal : nsISupports |
michael@0 | 291 | { |
michael@0 | 292 | [notxpcom] void RemoveFromBFCacheAsync(); |
michael@0 | 293 | [notxpcom] void RemoveFromBFCacheSync(); |
michael@0 | 294 | |
michael@0 | 295 | /** |
michael@0 | 296 | * A number that is assigned by the sHistory when the entry is activated |
michael@0 | 297 | */ |
michael@0 | 298 | attribute unsigned long lastTouched; |
michael@0 | 299 | |
michael@0 | 300 | /** |
michael@0 | 301 | * Some state, particularly that related to the back/forward cache, is |
michael@0 | 302 | * shared between SHEntries which correspond to the same document. This |
michael@0 | 303 | * method gets a pointer to that shared state. |
michael@0 | 304 | * |
michael@0 | 305 | * This shared state is the SHEntry's BFCacheEntry. So |
michael@0 | 306 | * hasBFCacheEntry(getSharedState()) is guaranteed to return true. |
michael@0 | 307 | */ |
michael@0 | 308 | [noscript, notxpcom] |
michael@0 | 309 | nsSHEntryShared getSharedState(); |
michael@0 | 310 | }; |
michael@0 | 311 | |
michael@0 | 312 | %{ C++ |
michael@0 | 313 | // {BFD1A791-AD9F-11d3-BDC7-0050040A9B44} |
michael@0 | 314 | #define NS_SHENTRY_CID \ |
michael@0 | 315 | {0xbfd1a791, 0xad9f, 0x11d3, {0xbd, 0xc7, 0x0, 0x50, 0x4, 0xa, 0x9b, 0x44}} |
michael@0 | 316 | |
michael@0 | 317 | #define NS_SHENTRY_CONTRACTID \ |
michael@0 | 318 | "@mozilla.org/browser/session-history-entry;1" |
michael@0 | 319 | |
michael@0 | 320 | %} |
michael@0 | 321 |