зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1655670 - Set default title of session history entry to the URL for session history in the parent. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D85124
This commit is contained in:
Родитель
643ec22ebc
Коммит
d00cd16240
|
@ -35,6 +35,7 @@ SessionHistoryInfo::SessionHistoryInfo(nsDocShellLoadState* aLoadState,
|
|||
/* FIXME Should this be aLoadState->IsSrcdocLoad()? */
|
||||
mIsSrcdocEntry(!aLoadState->SrcdocData().IsEmpty()),
|
||||
mScrollRestorationIsManual(false) {
|
||||
MaybeUpdateTitleFromURI();
|
||||
bool isNoStore = false;
|
||||
if (nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel)) {
|
||||
Unused << httpChannel->IsNoStoreResponse(&isNoStore);
|
||||
|
@ -42,6 +43,16 @@ SessionHistoryInfo::SessionHistoryInfo(nsDocShellLoadState* aLoadState,
|
|||
}
|
||||
}
|
||||
|
||||
void SessionHistoryInfo::MaybeUpdateTitleFromURI() {
|
||||
if (mTitle.IsEmpty() && mURI) {
|
||||
// Default title is the URL.
|
||||
nsAutoCString spec;
|
||||
if (NS_SUCCEEDED(mURI->GetSpec(spec))) {
|
||||
AppendUTF8toUTF16(spec, mTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t gEntryID;
|
||||
nsDataHashtable<nsUint64HashKey, SessionHistoryEntry*>*
|
||||
SessionHistoryEntry::sInfoIdToEntry = nullptr;
|
||||
|
|
|
@ -61,6 +61,8 @@ class SessionHistoryInfo {
|
|||
friend class SessionHistoryEntry;
|
||||
friend struct mozilla::ipc::IPDLParamTraits<SessionHistoryInfo>;
|
||||
|
||||
void MaybeUpdateTitleFromURI();
|
||||
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCOMPtr<nsIURI> mResultPrincipalURI;
|
||||
|
|
Загрузка…
Ссылка в новой задаче