Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 629580 Details for
Bug 759782
[patch]
Part 3 - Make SessionStorage.jsm use SessionHistory.jsm
bug-759782-3.patch (text/plain), 3.50 KB, created by
Tim Taubert [:ttaubert] (inactive)
(
hide
)
Description:
Part 3 - Make SessionStorage.jsm use SessionHistory.jsm
Filename:
MIME Type:
Creator:
Tim Taubert [:ttaubert] (inactive)
Size:
3.50 KB
patch
obsolete
>diff --git a/browser/components/sessionstore/src/SessionStorage.jsm b/browser/components/sessionstore/src/SessionStorage.jsm >--- a/browser/components/sessionstore/src/SessionStorage.jsm >+++ b/browser/components/sessionstore/src/SessionStorage.jsm >@@ -6,16 +6,18 @@ let EXPORTED_SYMBOLS = ["SessionStorage" > > const Cu = Components.utils; > > Cu.import("resource://gre/modules/Services.jsm"); > Cu.import("resource://gre/modules/XPCOMUtils.jsm"); > > XPCOMUtils.defineLazyModuleGetter(this, "SessionStore", > "resource:///modules/sessionstore/SessionStore.jsm"); >+XPCOMUtils.defineLazyModuleGetter(this, "SessionHistory", >+ "resource:///modules/sessionstore/SessionHistory.jsm"); > > let SessionStorage = { > /** > * Updates all sessionStorage "super cookies" > * @param aDocShell > * That tab's docshell (containing the sessionStorage) > * @param aFullData > * always return privacy sensitive data (use with care) >@@ -42,28 +44,36 @@ let DomStorage = { > /** > * Reads all session storage data from the given docShell. > * @param aDocShell > * A tab's docshell (containing the sessionStorage) > * @param aFullData > * Always return privacy sensitive data (use with care) > */ > read: function DomStorage_read(aDocShell, aFullData) { >+ let shentries = []; >+ let shistory = aDocShell.sessionHistory; >+ >+ try { >+ shentries = SessionHistory.getEntries(shistory); >+ } catch (e if e.name == "BrokenSessionHistoryError") { >+ return {}; >+ } >+ > let data = {}; > let isPinned = aDocShell.isAppTab; >- let shistory = aDocShell.sessionHistory; > >- for (let i = 0; i < shistory.count; i++) { >- let uri = History.getUriForEntry(shistory, i); >+ for (let shentry of shentries) { >+ let uri = shentry.URI; > > if (uri) { > // Check if we're allowed to store sessionStorage data. > let isHTTPS = uri.schemeIs("https"); > if (aFullData || SessionStore.checkPrivacyLevel(isHTTPS, isPinned)) { >- let host = History.getHostForURI(uri); >+ let host = this._getHostForURI(uri); > > // Don't read a host twice. > if (!(host in data)) { > let hostData = this._readEntry(uri, aDocShell); > if (Object.keys(hostData).length) { > data[host] = hostData; > } > } >@@ -128,45 +138,24 @@ let DomStorage = { > hostData[key] = storage.getItem(key); > } catch (e) { > // This currently throws for secured items (cf. bug 442048). > } > } > } > > return hostData; >- } >-}; >- >-let History = { >- /** >- * Returns a given history entry's URI. >- * @param aHistory >- * That tab's session history >- * @param aIndex >- * The history entry's index >- */ >- getUriForEntry: function History_getUriForEntry(aHistory, aIndex) { >- try { >- return aHistory.getEntryAtIndex(aIndex, false).URI; >- } catch (e) { >- // This might throw for some reason. >- } > }, > >- /** >- * Returns the host of a given URI. >- * @param aURI >- * The URI for which to return the host >- */ >- getHostForURI: function History_getHostForURI(aURI) { >+ _getHostForURI: function DomStorage_getHostForURI(aURI) { > let host = aURI.spec; > > try { >- if (aURI.host) >+ // Throwing is expensive, we know that about: pages will throw. >+ if (host.indexOf("about:") != 0 && aURI.host) > host = aURI.prePath; > } catch (e) { > // This throws for host-less URIs (such as about: or jar:). > } > > return host; > } > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
|
Review
Attachments on
bug 759782
:
628353
|
628354
|
628355
|
629580
|
662071
|
662072
|
662073