Bug 1659991 - Generate an id if we create a new session history entry in the child process. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D87742
This commit is contained in:
Peter Van der Beken 2020-08-23 17:41:06 +00:00
Родитель a4a8b3da89
Коммит 6e49bf5815
3 изменённых файлов: 16 добавлений и 9 удалений

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

@ -129,10 +129,9 @@ SessionHistoryInfo::SharedState SessionHistoryInfo::SharedState::Create(
aPartitionedPrincipalToInherit, aCsp, aContentType));
}
// FIXME Pass the correct ID!!!
return SharedState(MakeUnique<SHEntrySharedState>(
0, aTriggeringPrincipal, aPrincipalToInherit,
aPartitionedPrincipalToInherit, aCsp, aContentType));
aTriggeringPrincipal, aPrincipalToInherit, aPartitionedPrincipalToInherit,
aCsp, aContentType));
}
SessionHistoryInfo::SharedState::SharedState() {

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

@ -7,6 +7,7 @@
#include "nsSHEntryShared.h"
#include "nsArray.h"
#include "nsContentUtils.h"
#include "nsDocShellEditorData.h"
#include "nsIContentViewer.h"
#include "nsISHistory.h"
@ -28,13 +29,17 @@ uint64_t gSHEntrySharedID = 0;
namespace mozilla {
namespace dom {
/* static */
uint64_t SHEntrySharedState::GenerateId() {
return nsContentUtils::GenerateProcessSpecificId(++gSHEntrySharedID);
}
SHEntrySharedParentState::SHEntrySharedParentState(
nsIPrincipal* aTriggeringPrincipal, nsIPrincipal* aPrincipalToInherit,
nsIPrincipal* aPartitionedPrincipalToInherit,
nsIContentSecurityPolicy* aCsp, const nsACString& aContentType)
: SHEntrySharedState(++gSHEntrySharedID, aTriggeringPrincipal,
aPrincipalToInherit, aPartitionedPrincipalToInherit,
aCsp, aContentType) {}
: SHEntrySharedState(aTriggeringPrincipal, aPrincipalToInherit,
aPartitionedPrincipalToInherit, aCsp, aContentType) {}
SHEntrySharedParentState::~SHEntrySharedParentState() {}

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

@ -48,14 +48,14 @@ class Document;
* parent process.
*/
struct SHEntrySharedState {
SHEntrySharedState() = default;
SHEntrySharedState() : mId(GenerateId()) {}
SHEntrySharedState(const SHEntrySharedState& aState) = default;
SHEntrySharedState(uint64_t aId, nsIPrincipal* aTriggeringPrincipal,
SHEntrySharedState(nsIPrincipal* aTriggeringPrincipal,
nsIPrincipal* aPrincipalToInherit,
nsIPrincipal* aPartitionedPrincipalToInherit,
nsIContentSecurityPolicy* aCsp,
const nsACString& aContentType)
: mId(aId),
: mId(GenerateId()),
mTriggeringPrincipal(aTriggeringPrincipal),
mPrincipalToInherit(aPrincipalToInherit),
mPartitionedPrincipalToInherit(aPartitionedPrincipalToInherit),
@ -77,6 +77,9 @@ struct SHEntrySharedState {
// moved to bfcache.
nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState;
uint32_t mCacheKey = 0;
protected:
static uint64_t GenerateId();
};
/**