зеркало из https://github.com/mozilla/gecko-dev.git
Bug 930269 - Rename SessionHistory.read (r=smacleod)
This commit is contained in:
Родитель
3c5277ccf4
Коммит
ea2f9b773e
|
@ -93,7 +93,7 @@ let MessageListener = {
|
|||
receiveMessage: function ({name, data: {id}}) {
|
||||
switch (name) {
|
||||
case "SessionStore:collectSessionHistory":
|
||||
let history = SessionHistory.read(docShell);
|
||||
let history = SessionHistory.collect(docShell);
|
||||
if ("index" in history) {
|
||||
let tabIndex = history.index - 1;
|
||||
// Don't include private data. It's only needed when duplicating
|
||||
|
@ -141,7 +141,7 @@ let SyncHandler = {
|
|||
},
|
||||
|
||||
collectSessionHistory: function (includePrivateData) {
|
||||
let history = SessionHistory.read(docShell);
|
||||
let history = SessionHistory.collect(docShell);
|
||||
if ("index" in history) {
|
||||
let tabIndex = history.index - 1;
|
||||
TextAndScrollData.updateFrame(history.entries[tabIndex],
|
||||
|
|
|
@ -36,8 +36,8 @@ XPCOMUtils.defineLazyGetter(this, "gPostData", function () {
|
|||
* The external API exported by this module.
|
||||
*/
|
||||
this.SessionHistory = Object.freeze({
|
||||
read: function (docShell, includePrivateData) {
|
||||
return SessionHistoryInternal.read(docShell, includePrivateData);
|
||||
collect: function (docShell, includePrivateData) {
|
||||
return SessionHistoryInternal.collect(docShell, includePrivateData);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -53,7 +53,7 @@ let SessionHistoryInternal = {
|
|||
* @param includePrivateData (optional)
|
||||
* True to always include private data and skip any privacy checks.
|
||||
*/
|
||||
read: function (docShell, includePrivateData = false) {
|
||||
collect: function (docShell, includePrivateData = false) {
|
||||
let data = {entries: []};
|
||||
let isPinned = docShell.isAppTab;
|
||||
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
|
@ -63,7 +63,7 @@ let SessionHistoryInternal = {
|
|||
try {
|
||||
for (let i = 0; i < history.count; i++) {
|
||||
let shEntry = history.getEntryAtIndex(i, false);
|
||||
let entry = this._serializeEntry(shEntry, includePrivateData, isPinned);
|
||||
let entry = this.serializeEntry(shEntry, includePrivateData, isPinned);
|
||||
data.entries.push(entry);
|
||||
}
|
||||
} catch (ex) {
|
||||
|
@ -109,7 +109,7 @@ let SessionHistoryInternal = {
|
|||
* The tab is pinned and should be treated differently for privacy.
|
||||
* @return object
|
||||
*/
|
||||
_serializeEntry: function (shEntry, includePrivateData, isPinned) {
|
||||
serializeEntry: function (shEntry, includePrivateData, isPinned) {
|
||||
let entry = { url: shEntry.URI.spec };
|
||||
|
||||
// Save some bytes and don't include the title property
|
||||
|
@ -152,7 +152,7 @@ let SessionHistoryInternal = {
|
|||
|
||||
// Collect post data for the current history entry.
|
||||
try {
|
||||
let postdata = this._serializePostData(shEntry, isPinned);
|
||||
let postdata = this.serializePostData(shEntry, isPinned);
|
||||
if (postdata) {
|
||||
entry.postdata_b64 = postdata;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ let SessionHistoryInternal = {
|
|||
|
||||
// Collect owner data for the current history entry.
|
||||
try {
|
||||
let owner = this._serializeOwner(shEntry);
|
||||
let owner = this.serializeOwner(shEntry);
|
||||
if (owner) {
|
||||
entry.owner_b64 = owner;
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ let SessionHistoryInternal = {
|
|||
break;
|
||||
}
|
||||
|
||||
children.push(this._serializeEntry(child, includePrivateData, isPinned));
|
||||
children.push(this.serializeEntry(child, includePrivateData, isPinned));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ let SessionHistoryInternal = {
|
|||
* Whether the docShell is owned by a pinned tab.
|
||||
* @return The base64 encoded post data.
|
||||
*/
|
||||
_serializePostData: function (shEntry, isPinned) {
|
||||
serializePostData: function (shEntry, isPinned) {
|
||||
let isHttps = shEntry.URI.schemeIs("https");
|
||||
if (!shEntry.postData || !gPostData ||
|
||||
!PrivacyLevel.canSave({isHttps: isHttps, isPinned: isPinned})) {
|
||||
|
@ -250,7 +250,7 @@ let SessionHistoryInternal = {
|
|||
* The session history entry.
|
||||
* @return The base64 encoded owner data.
|
||||
*/
|
||||
_serializeOwner: function (shEntry) {
|
||||
serializeOwner: function (shEntry) {
|
||||
if (!shEntry.owner) {
|
||||
return null;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче