Bug 930269 - Rename SessionHistory.read (r=smacleod)

This commit is contained in:
Bill McCloskey 2013-11-12 15:02:46 -08:00
Родитель 3c5277ccf4
Коммит ea2f9b773e
2 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -93,7 +93,7 @@ let MessageListener = {
receiveMessage: function ({name, data: {id}}) { receiveMessage: function ({name, data: {id}}) {
switch (name) { switch (name) {
case "SessionStore:collectSessionHistory": case "SessionStore:collectSessionHistory":
let history = SessionHistory.read(docShell); let history = SessionHistory.collect(docShell);
if ("index" in history) { if ("index" in history) {
let tabIndex = history.index - 1; let tabIndex = history.index - 1;
// Don't include private data. It's only needed when duplicating // Don't include private data. It's only needed when duplicating
@ -141,7 +141,7 @@ let SyncHandler = {
}, },
collectSessionHistory: function (includePrivateData) { collectSessionHistory: function (includePrivateData) {
let history = SessionHistory.read(docShell); let history = SessionHistory.collect(docShell);
if ("index" in history) { if ("index" in history) {
let tabIndex = history.index - 1; let tabIndex = history.index - 1;
TextAndScrollData.updateFrame(history.entries[tabIndex], TextAndScrollData.updateFrame(history.entries[tabIndex],

Просмотреть файл

@ -36,8 +36,8 @@ XPCOMUtils.defineLazyGetter(this, "gPostData", function () {
* The external API exported by this module. * The external API exported by this module.
*/ */
this.SessionHistory = Object.freeze({ this.SessionHistory = Object.freeze({
read: function (docShell, includePrivateData) { collect: function (docShell, includePrivateData) {
return SessionHistoryInternal.read(docShell, includePrivateData); return SessionHistoryInternal.collect(docShell, includePrivateData);
} }
}); });
@ -53,7 +53,7 @@ let SessionHistoryInternal = {
* @param includePrivateData (optional) * @param includePrivateData (optional)
* True to always include private data and skip any privacy checks. * 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 data = {entries: []};
let isPinned = docShell.isAppTab; let isPinned = docShell.isAppTab;
let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation); let webNavigation = docShell.QueryInterface(Ci.nsIWebNavigation);
@ -63,7 +63,7 @@ let SessionHistoryInternal = {
try { try {
for (let i = 0; i < history.count; i++) { for (let i = 0; i < history.count; i++) {
let shEntry = history.getEntryAtIndex(i, false); let shEntry = history.getEntryAtIndex(i, false);
let entry = this._serializeEntry(shEntry, includePrivateData, isPinned); let entry = this.serializeEntry(shEntry, includePrivateData, isPinned);
data.entries.push(entry); data.entries.push(entry);
} }
} catch (ex) { } catch (ex) {
@ -109,7 +109,7 @@ let SessionHistoryInternal = {
* The tab is pinned and should be treated differently for privacy. * The tab is pinned and should be treated differently for privacy.
* @return object * @return object
*/ */
_serializeEntry: function (shEntry, includePrivateData, isPinned) { serializeEntry: function (shEntry, includePrivateData, isPinned) {
let entry = { url: shEntry.URI.spec }; let entry = { url: shEntry.URI.spec };
// Save some bytes and don't include the title property // Save some bytes and don't include the title property
@ -152,7 +152,7 @@ let SessionHistoryInternal = {
// Collect post data for the current history entry. // Collect post data for the current history entry.
try { try {
let postdata = this._serializePostData(shEntry, isPinned); let postdata = this.serializePostData(shEntry, isPinned);
if (postdata) { if (postdata) {
entry.postdata_b64 = postdata; entry.postdata_b64 = postdata;
} }
@ -163,7 +163,7 @@ let SessionHistoryInternal = {
// Collect owner data for the current history entry. // Collect owner data for the current history entry.
try { try {
let owner = this._serializeOwner(shEntry); let owner = this.serializeOwner(shEntry);
if (owner) { if (owner) {
entry.owner_b64 = owner; entry.owner_b64 = owner;
} }
@ -197,7 +197,7 @@ let SessionHistoryInternal = {
break; 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. * Whether the docShell is owned by a pinned tab.
* @return The base64 encoded post data. * @return The base64 encoded post data.
*/ */
_serializePostData: function (shEntry, isPinned) { serializePostData: function (shEntry, isPinned) {
let isHttps = shEntry.URI.schemeIs("https"); let isHttps = shEntry.URI.schemeIs("https");
if (!shEntry.postData || !gPostData || if (!shEntry.postData || !gPostData ||
!PrivacyLevel.canSave({isHttps: isHttps, isPinned: isPinned})) { !PrivacyLevel.canSave({isHttps: isHttps, isPinned: isPinned})) {
@ -250,7 +250,7 @@ let SessionHistoryInternal = {
* The session history entry. * The session history entry.
* @return The base64 encoded owner data. * @return The base64 encoded owner data.
*/ */
_serializeOwner: function (shEntry) { serializeOwner: function (shEntry) {
if (!shEntry.owner) { if (!shEntry.owner) {
return null; return null;
} }