Closed Bug 1344857 Opened 8 years ago Closed 8 years ago

SessionStore does not return titles for tabs which have a url that is identical to the title

Categories

(Firefox :: Session Restore, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 55
Tracking Status
firefox55 --- fixed

People

(Reporter: bsilverberg, Assigned: bsilverberg)

References

Details

Attachments

(1 file)

This was uncovered via a test for the WebExtensions sessions API, which makes use of both SessionStore.getClosedWindowData and SessionStore.getClosedTabData. The API code expects to find a title property in the `entries` for a tab, but when a tab is opened to a url for which the title is the same as the url (e.g., about:buildconfig), the entries stored internally by SessionStore do not contain the title of the tab. The code that is causing the entry to be created without a title is in the serializeEntry function of SessionHistory.jsm [1], which contains an optimization which excludes the title from the entry if it is the same as the url. SessionStore itself doesn't really care that the title is missing because it simply passes all the data it has back to a caller when requested. For example, neither getClosedWindowData nor getClosedTabData do any processing of the stored data before returning them - they simply pass the data back to the caller. The "knowledge" of these entries really exists in SessionHistory.jsm, not SessionStore.jsm, and for this reason it is my belief that this should be fixed in SessionHistory.jsm by removing this optimization. To fix it in SessionStore.jsm would require the addition of quite a bit of code and processing which are currently not needed. This could also be dealt with in the consumers (e.g., the code for the sessions WebExtensions API), but that seems less than ideal. [1] http://searchfox.org/mozilla-central/source/browser/components/sessionstore/SessionHistory.jsm#144
Mike, please let me know what you think of the above observations and how you recommend I proceed with this fix.
Flags: needinfo?(mdeboer)
Well, the thing we'd like to prevent is adding another loop iterating over all entries to get that data back. But that never happens in sessionstore, except in serializeEntry. The only way to fix this efficiently is not omitting the title entry. I think the space saving in sessionstore.js is marginal, especially after we've enabled lz4 compression in bug 1304389.
Depends on: 1304389
Flags: needinfo?(mdeboer)
Assignee: nobody → bob.silverberg
Sorry for the delay on this patch. Many things were a higher priority, but I finally grabbed a bit of time to do it. Does it really need to be blocked by bug 1304389, or can we land just this change? It seems like it would be a pretty minor amount of additional data, considering that it only affects cases where the url and title are identical, which is seldom true in the real world.
Comment on attachment 8857081 [details] Bug 1344857 - SessionStore does not return titles for tabs which have a url that is identical to the title, https://reviewboard.mozilla.org/r/128984/#review131578 No, absolutely no need to wait for lz4 compression to land this one. Thanks, Bob!
Attachment #8857081 - Flags: review?(mdeboer) → review+
Pushed by bsilverberg@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4906cc8b148c SessionStore does not return titles for tabs which have a url that is identical to the title, r=mikedeboer
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
See Also: → 1460423
No longer depends on: 1304389
See Also: → 1304389
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: