Backed out 3 changesets (bug 1653123, bug 1602115) for perma failures on test_history_length_during_pageload.html. CLOSED TREE
Backed out changeset 6b3c0f542ef3 (bug 1653123) Backed out changeset 951c0fd65a00 (bug 1602115) Backed out changeset 258d0ebd9e34 (bug 1602115)
This commit is contained in:
@@ -2502,35 +2502,6 @@ bool BrowsingContext::CanSet(FieldIndex<IDX_BrowserId>, const uint32_t& aValue,
|
|||||||
return GetBrowserId() == 0 && IsTop() && Children().IsEmpty();
|
return GetBrowserId() == 0 && IsTop() && Children().IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowsingContext::SessionHistoryChanged(int32_t aIndexDelta,
|
|
||||||
int32_t aLengthDelta) {
|
|
||||||
if (XRE_IsParentProcess() || StaticPrefs::fission_sessionHistoryInParent()) {
|
|
||||||
// This method is used to test index and length for the session history
|
|
||||||
// in child process only.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsTop()) {
|
|
||||||
// Some tests have unexpected setup while Fission shistory is being
|
|
||||||
// implemented.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<ChildSHistory> shistory = GetChildSessionHistory();
|
|
||||||
if (!shistory || !shistory->AsyncHistoryLength()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsID changeID = shistory->AddPendingHistoryChange(aIndexDelta, aLengthDelta);
|
|
||||||
uint32_t index = shistory->Index();
|
|
||||||
uint32_t length = shistory->Count();
|
|
||||||
|
|
||||||
// Do artificial history update through parent process to test asynchronous
|
|
||||||
// history.length handling.
|
|
||||||
ContentChild::GetSingleton()->SendSessionHistoryUpdate(this, index, length,
|
|
||||||
changeID);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
||||||
namespace ipc {
|
namespace ipc {
|
||||||
|
|||||||
@@ -657,8 +657,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||||||
|
|
||||||
bool CrossOriginIsolated();
|
bool CrossOriginIsolated();
|
||||||
|
|
||||||
void SessionHistoryChanged(int32_t aIndexDelta, int32_t aLengthDelta);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~BrowsingContext();
|
virtual ~BrowsingContext();
|
||||||
BrowsingContext(WindowContext* aParentWindow, BrowsingContextGroup* aGroup,
|
BrowsingContext(WindowContext* aParentWindow, BrowsingContextGroup* aGroup,
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ CanonicalBrowsingContext::CreateSessionHistoryEntryForLoad(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CanonicalBrowsingContext::SessionHistoryCommit(
|
void CanonicalBrowsingContext::SessionHistoryCommit(
|
||||||
uint64_t aSessionHistoryEntryId, const nsID& aChangeID) {
|
uint64_t aSessionHistoryEntryId) {
|
||||||
for (size_t i = 0; i < mLoadingEntries.Length(); ++i) {
|
for (size_t i = 0; i < mLoadingEntries.Length(); ++i) {
|
||||||
if (mLoadingEntries[i]->Info().Id() == aSessionHistoryEntryId) {
|
if (mLoadingEntries[i]->Info().Id() == aSessionHistoryEntryId) {
|
||||||
nsISHistory* shistory = GetSessionHistory();
|
nsISHistory* shistory = GetSessionHistory();
|
||||||
@@ -319,13 +319,9 @@ void CanonicalBrowsingContext::SessionHistoryCommit(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Group()->EachParent([&](ContentParent* aParent) {
|
Group()->EachParent([&](ContentParent* aParent) {
|
||||||
nsISHistory* shistory = GetSessionHistory();
|
// FIXME Should we return the length to the one process that committed
|
||||||
int32_t index = 0;
|
// as an async return value? Or should this use synced fields?
|
||||||
int32_t length = 0;
|
Unused << aParent->SendHistoryCommitLength(Top(), shistory->GetCount());
|
||||||
shistory->GetIndex(&index);
|
|
||||||
shistory->GetCount(&length);
|
|
||||||
Unused << aParent->SendHistoryCommitIndexAndLength(Top(), index, length,
|
|
||||||
aChangeID);
|
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,8 +96,7 @@ class CanonicalBrowsingContext final : public BrowsingContext {
|
|||||||
nsISHistory* GetSessionHistory();
|
nsISHistory* GetSessionHistory();
|
||||||
UniquePtr<SessionHistoryInfo> CreateSessionHistoryEntryForLoad(
|
UniquePtr<SessionHistoryInfo> CreateSessionHistoryEntryForLoad(
|
||||||
nsDocShellLoadState* aLoadState, nsIChannel* aChannel);
|
nsDocShellLoadState* aLoadState, nsIChannel* aChannel);
|
||||||
void SessionHistoryCommit(uint64_t aSessionHistoryEntryId,
|
void SessionHistoryCommit(uint64_t aSessionHistoryEntryId);
|
||||||
const nsID& aChangeID);
|
|
||||||
|
|
||||||
// Calls the session history listeners' OnHistoryReload, storing the result in
|
// Calls the session history listeners' OnHistoryReload, storing the result in
|
||||||
// aCanReload. If aCanReload is set to true and we have an active or a loading
|
// aCanReload. If aCanReload is set to true and we have an active or a loading
|
||||||
|
|||||||
@@ -5367,22 +5367,17 @@ nsresult nsDocShell::Embed(nsIContentViewer* aContentViewer,
|
|||||||
SetDocCurrentStateObj(mLSHE);
|
SetDocCurrentStateObj(mLSHE);
|
||||||
|
|
||||||
SetHistoryEntryAndUpdateBC(Nothing(), Some<nsISHEntry*>(mLSHE));
|
SetHistoryEntryAndUpdateBC(Nothing(), Some<nsISHEntry*>(mLSHE));
|
||||||
nsID changeID = {};
|
|
||||||
if (StaticPrefs::fission_sessionHistoryInParent()) {
|
if (StaticPrefs::fission_sessionHistoryInParent()) {
|
||||||
mActiveEntry = nullptr;
|
mActiveEntry = nullptr;
|
||||||
mLoadingEntry.swap(mActiveEntry);
|
mLoadingEntry.swap(mActiveEntry);
|
||||||
if (mActiveEntry) {
|
if (mActiveEntry) {
|
||||||
if (XRE_IsParentProcess()) {
|
if (XRE_IsParentProcess()) {
|
||||||
mBrowsingContext->Canonical()->SessionHistoryCommit(
|
mBrowsingContext->Canonical()->SessionHistoryCommit(
|
||||||
mActiveEntry->Id(), changeID);
|
mActiveEntry->Id());
|
||||||
} else {
|
} else {
|
||||||
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
|
||||||
if (rootSH) {
|
|
||||||
changeID = rootSH->AddPendingHistoryChange();
|
|
||||||
}
|
|
||||||
ContentChild* cc = ContentChild::GetSingleton();
|
ContentChild* cc = ContentChild::GetSingleton();
|
||||||
mozilla::Unused << cc->SendHistoryCommit(
|
mozilla::Unused << cc->SendHistoryCommit(mBrowsingContext,
|
||||||
mBrowsingContext, mActiveEntry->Id(), changeID);
|
mActiveEntry->Id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,70 +36,18 @@ void ChildSHistory::SetIsInProcess(bool aIsInProcess) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t ChildSHistory::Count() {
|
int32_t ChildSHistory::Count() {
|
||||||
if (StaticPrefs::fission_sessionHistoryInParent() || mAsyncHistoryLength) {
|
if (StaticPrefs::fission_sessionHistoryInParent()) {
|
||||||
uint32_t length = mLength;
|
return mLength;
|
||||||
for (uint32_t i = 0; i < mPendingSHistoryChanges.Length(); ++i) {
|
|
||||||
length += mPendingSHistoryChanges[i].mLengthDelta;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAsyncHistoryLength) {
|
|
||||||
MOZ_ASSERT(!StaticPrefs::fission_sessionHistoryInParent());
|
|
||||||
// XXX The assertion may be too strong here, but it fires only
|
|
||||||
// when the pref is enabled.
|
|
||||||
MOZ_ASSERT(mHistory->GetCount() == int32_t(length));
|
|
||||||
}
|
|
||||||
return length;
|
|
||||||
}
|
}
|
||||||
return mHistory->GetCount();
|
return mHistory->GetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ChildSHistory::Index() {
|
int32_t ChildSHistory::Index() {
|
||||||
if (StaticPrefs::fission_sessionHistoryInParent() || mAsyncHistoryLength) {
|
|
||||||
uint32_t index = mIndex;
|
|
||||||
for (uint32_t i = 0; i < mPendingSHistoryChanges.Length(); ++i) {
|
|
||||||
index += mPendingSHistoryChanges[i].mIndexDelta;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAsyncHistoryLength) {
|
|
||||||
MOZ_ASSERT(!StaticPrefs::fission_sessionHistoryInParent());
|
|
||||||
int32_t realIndex;
|
|
||||||
mHistory->GetIndex(&realIndex);
|
|
||||||
// XXX The assertion may be too strong here, but it fires only
|
|
||||||
// when the pref is enabled.
|
|
||||||
MOZ_ASSERT(realIndex == int32_t(index));
|
|
||||||
}
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
int32_t index;
|
int32_t index;
|
||||||
mHistory->GetIndex(&index);
|
mHistory->GetIndex(&index);
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsID ChildSHistory::AddPendingHistoryChange() {
|
|
||||||
int32_t indexDelta = 1;
|
|
||||||
int32_t lengthDelta = (Index() + indexDelta) - (Count() - 1);
|
|
||||||
return AddPendingHistoryChange(indexDelta, lengthDelta);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsID ChildSHistory::AddPendingHistoryChange(int32_t aIndexDelta,
|
|
||||||
int32_t aLengthDelta) {
|
|
||||||
nsID changeID = {};
|
|
||||||
nsContentUtils::GenerateUUIDInPlace(changeID);
|
|
||||||
PendingSHistoryChange change = {changeID, aIndexDelta, aLengthDelta};
|
|
||||||
mPendingSHistoryChanges.AppendElement(change);
|
|
||||||
return changeID;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChildSHistory::SetIndexAndLength(uint32_t aIndex, uint32_t aLength,
|
|
||||||
const nsID& aChangeID) {
|
|
||||||
mIndex = aIndex;
|
|
||||||
mLength = aLength;
|
|
||||||
mPendingSHistoryChanges.RemoveElementsBy(
|
|
||||||
[aChangeID](const PendingSHistoryChange& aChange) {
|
|
||||||
return aChange.mChangeID == aChangeID;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChildSHistory::Reload(uint32_t aReloadFlags, ErrorResult& aRv) {
|
void ChildSHistory::Reload(uint32_t aReloadFlags, ErrorResult& aRv) {
|
||||||
aRv = mHistory->Reload(aReloadFlags);
|
aRv = mHistory->Reload(aReloadFlags);
|
||||||
}
|
}
|
||||||
@@ -200,26 +148,5 @@ nsISupports* ChildSHistory::GetParentObject() const {
|
|||||||
return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
|
return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChildSHistory::SetAsyncHistoryLength(bool aEnable, ErrorResult& aRv) {
|
|
||||||
if (StaticPrefs::fission_sessionHistoryInParent() || !mHistory) {
|
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mAsyncHistoryLength == aEnable) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mAsyncHistoryLength = aEnable;
|
|
||||||
if (mAsyncHistoryLength) {
|
|
||||||
mHistory->GetIndex(&mIndex);
|
|
||||||
mLength = mHistory->GetCount();
|
|
||||||
} else {
|
|
||||||
mIndex = -1;
|
|
||||||
mLength = 0;
|
|
||||||
mPendingSHistoryChanges.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "mozilla/LinkedList.h"
|
#include "mozilla/LinkedList.h"
|
||||||
#include "nsID.h"
|
|
||||||
|
|
||||||
class nsISHEntry;
|
class nsISHEntry;
|
||||||
class nsISHistory;
|
class nsISHistory;
|
||||||
@@ -76,14 +75,7 @@ class ChildSHistory : public nsISupports, public nsWrapperCache {
|
|||||||
|
|
||||||
nsISHistory* LegacySHistory();
|
nsISHistory* LegacySHistory();
|
||||||
|
|
||||||
void SetIndexAndLength(uint32_t aIndex, uint32_t aLength,
|
void SetLength(uint32_t aLength) { mLength = aLength; }
|
||||||
const nsID& aChangeId);
|
|
||||||
nsID AddPendingHistoryChange();
|
|
||||||
nsID AddPendingHistoryChange(int32_t aIndexDelta, int32_t aLengthDelta);
|
|
||||||
|
|
||||||
// AsyncHistoryLength is for testing.
|
|
||||||
void SetAsyncHistoryLength(bool aEnable, ErrorResult& aRv);
|
|
||||||
bool AsyncHistoryLength() { return mAsyncHistoryLength; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~ChildSHistory() = default;
|
virtual ~ChildSHistory() = default;
|
||||||
@@ -116,17 +108,7 @@ class ChildSHistory : public nsISupports, public nsWrapperCache {
|
|||||||
RefPtr<BrowsingContext> mBrowsingContext;
|
RefPtr<BrowsingContext> mBrowsingContext;
|
||||||
nsCOMPtr<nsISHistory> mHistory;
|
nsCOMPtr<nsISHistory> mHistory;
|
||||||
mozilla::LinkedList<PendingAsyncHistoryNavigation> mPendingNavigations;
|
mozilla::LinkedList<PendingAsyncHistoryNavigation> mPendingNavigations;
|
||||||
int32_t mIndex = -1;
|
uint32_t mLength = 0;
|
||||||
int32_t mLength = 0;
|
|
||||||
|
|
||||||
struct PendingSHistoryChange {
|
|
||||||
nsID mChangeID;
|
|
||||||
int32_t mIndexDelta;
|
|
||||||
int32_t mLengthDelta;
|
|
||||||
};
|
|
||||||
AutoTArray<PendingSHistoryChange, 2> mPendingSHistoryChanges;
|
|
||||||
|
|
||||||
bool mAsyncHistoryLength = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|||||||
@@ -160,15 +160,14 @@ SessionHistoryEntry::SetIsSubFrame(bool aIsSubFrame) {
|
|||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
SessionHistoryEntry::GetHasUserInteraction(bool* aFlag) {
|
SessionHistoryEntry::GetHasUserInteraction(bool* aFlag) {
|
||||||
NS_WARNING("Not implemented in the parent process!");
|
MOZ_CRASH("Not needed in the parent process?");
|
||||||
*aFlag = true;
|
return NS_ERROR_FAILURE;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
SessionHistoryEntry::SetHasUserInteraction(bool aFlag) {
|
SessionHistoryEntry::SetHasUserInteraction(bool aFlag) {
|
||||||
NS_WARNING("Not implemented in the parent process!");
|
MOZ_CRASH("Not needed in the parent process?");
|
||||||
return NS_OK;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
@@ -135,36 +135,6 @@ extern mozilla::LazyLogModule gPageCacheLog;
|
|||||||
} \
|
} \
|
||||||
PR_END_MACRO
|
PR_END_MACRO
|
||||||
|
|
||||||
class SHistoryChangeNotifier {
|
|
||||||
public:
|
|
||||||
explicit SHistoryChangeNotifier(nsSHistory* aHistory) {
|
|
||||||
// If we're already in an update, the outermost change notifier will
|
|
||||||
// update browsing context in the destructor.
|
|
||||||
if (!aHistory->HasOngoingUpdate()) {
|
|
||||||
aHistory->SetHasOngoingUpdate(true);
|
|
||||||
mSHistory = aHistory;
|
|
||||||
mInitialIndex = aHistory->Index();
|
|
||||||
mInitialLength = aHistory->Length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~SHistoryChangeNotifier() {
|
|
||||||
if (mSHistory) {
|
|
||||||
MOZ_ASSERT(mSHistory->HasOngoingUpdate());
|
|
||||||
mSHistory->SetHasOngoingUpdate(false);
|
|
||||||
if (mSHistory->GetBrowsingContext()) {
|
|
||||||
mSHistory->GetBrowsingContext()->SessionHistoryChanged(
|
|
||||||
mSHistory->Index() - mInitialIndex,
|
|
||||||
mSHistory->Length() - mInitialLength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RefPtr<nsSHistory> mSHistory;
|
|
||||||
int32_t mInitialIndex;
|
|
||||||
int32_t mInitialLength;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum HistCmd { HIST_CMD_GOTOINDEX, HIST_CMD_RELOAD };
|
enum HistCmd { HIST_CMD_GOTOINDEX, HIST_CMD_RELOAD };
|
||||||
|
|
||||||
class nsSHistoryObserver final : public nsIObserver {
|
class nsSHistoryObserver final : public nsIObserver {
|
||||||
@@ -232,7 +202,6 @@ void nsSHistory::EvictContentViewerForEntry(nsISHEntry* aEntry) {
|
|||||||
|
|
||||||
nsSHistory::nsSHistory(BrowsingContext* aRootBC)
|
nsSHistory::nsSHistory(BrowsingContext* aRootBC)
|
||||||
: mRootBC(aRootBC),
|
: mRootBC(aRootBC),
|
||||||
mHasOngoingUpdate(false),
|
|
||||||
mIsRemote(false),
|
mIsRemote(false),
|
||||||
mIndex(-1),
|
mIndex(-1),
|
||||||
mRequestedIndex(-1),
|
mRequestedIndex(-1),
|
||||||
@@ -716,8 +685,6 @@ nsSHistory::AddEntry(nsISHEntry* aSHEntry, bool aPersist) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SHistoryChangeNotifier change(this);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> uri = aSHEntry->GetURI();
|
nsCOMPtr<nsIURI> uri = aSHEntry->GetURI();
|
||||||
NOTIFY_LISTENERS(OnHistoryNewEntry, (uri, mIndex));
|
NOTIFY_LISTENERS(OnHistoryNewEntry, (uri, mIndex));
|
||||||
|
|
||||||
@@ -840,8 +807,6 @@ nsSHistory::PurgeHistory(int32_t aNumEntries) {
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHistoryChangeNotifier change(this);
|
|
||||||
|
|
||||||
aNumEntries = std::min(aNumEntries, Length());
|
aNumEntries = std::min(aNumEntries, Length());
|
||||||
|
|
||||||
NOTIFY_LISTENERS(OnHistoryPurge, ());
|
NOTIFY_LISTENERS(OnHistoryPurge, ());
|
||||||
@@ -1407,8 +1372,6 @@ bool nsSHistory::RemoveDuplicate(int32_t aIndex, bool aKeepNext) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHistoryChangeNotifier change(this);
|
|
||||||
|
|
||||||
if (IsSameTree(root1, root2)) {
|
if (IsSameTree(root1, root2)) {
|
||||||
mEntries.RemoveElementAt(aIndex);
|
mEntries.RemoveElementAt(aIndex);
|
||||||
|
|
||||||
@@ -1454,8 +1417,6 @@ nsSHistory::RemoveEntries(nsTArray<nsID>& aIDs, int32_t aStartIndex) {
|
|||||||
|
|
||||||
void nsSHistory::RemoveEntries(nsTArray<nsID>& aIDs, int32_t aStartIndex,
|
void nsSHistory::RemoveEntries(nsTArray<nsID>& aIDs, int32_t aStartIndex,
|
||||||
bool* aDidRemove) {
|
bool* aDidRemove) {
|
||||||
SHistoryChangeNotifier change(this);
|
|
||||||
|
|
||||||
int32_t index = aStartIndex;
|
int32_t index = aStartIndex;
|
||||||
while (index >= 0 && RemoveChildEntries(this, --index, aIDs)) {
|
while (index >= 0 && RemoveChildEntries(this, --index, aIDs)) {
|
||||||
}
|
}
|
||||||
@@ -1514,8 +1475,6 @@ void nsSHistory::RemoveDynEntriesForBFCacheEntry(nsIBFCacheEntry* aBFEntry) {
|
|||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSHistory::UpdateIndex() {
|
nsSHistory::UpdateIndex() {
|
||||||
SHistoryChangeNotifier change(this);
|
|
||||||
|
|
||||||
// Update the actual index with the right value.
|
// Update the actual index with the right value.
|
||||||
if (mIndex != mRequestedIndex && mRequestedIndex != -1) {
|
if (mIndex != mRequestedIndex && mRequestedIndex != -1) {
|
||||||
mIndex = mRequestedIndex;
|
mIndex = mRequestedIndex;
|
||||||
|
|||||||
@@ -162,12 +162,6 @@ class nsSHistory : public mozilla::LinkedListElement<nsSHistory>,
|
|||||||
int32_t* aOutEndIndex);
|
int32_t* aOutEndIndex);
|
||||||
void NotifyListenersContentViewerEvicted(uint32_t aNumEvicted);
|
void NotifyListenersContentViewerEvicted(uint32_t aNumEvicted);
|
||||||
|
|
||||||
int32_t Length() { return int32_t(mEntries.Length()); }
|
|
||||||
int32_t Index() { return mIndex; }
|
|
||||||
mozilla::dom::BrowsingContext* GetBrowsingContext() { return mRootBC; }
|
|
||||||
bool HasOngoingUpdate() { return mHasOngoingUpdate; }
|
|
||||||
void SetHasOngoingUpdate(bool aVal) { mHasOngoingUpdate = aVal; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsSHistory();
|
virtual ~nsSHistory();
|
||||||
|
|
||||||
@@ -231,8 +225,9 @@ class nsSHistory : public mozilla::LinkedListElement<nsSHistory>,
|
|||||||
nsISHEntry* aNewEntry);
|
nsISHEntry* aNewEntry);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// Length of mEntries.
|
||||||
|
int32_t Length() { return int32_t(mEntries.Length()); }
|
||||||
|
|
||||||
bool mHasOngoingUpdate;
|
|
||||||
bool mIsRemote;
|
bool mIsRemote;
|
||||||
nsTArray<nsCOMPtr<nsISHEntry>> mEntries; // entries are never null
|
nsTArray<nsCOMPtr<nsISHEntry>> mEntries; // entries are never null
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<script>
|
|
||||||
function loadNextPage() {
|
|
||||||
if (location.search.includes("testAsyncLength=true")) {
|
|
||||||
var shell = SpecialPowers.wrap(window).docShell;
|
|
||||||
var shistory = SpecialPowers.do_QueryInterface(shell, "nsIWebNavigation").sessionHistory;
|
|
||||||
shistory.asyncHistoryLength = true;
|
|
||||||
}
|
|
||||||
opener.postMessage({ initialLength: history.length}, "*");
|
|
||||||
location.href = 'file_history_length_during_pageload_2.html';
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body onload="setTimeout(loadNextPage);">
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<script>
|
|
||||||
opener.postMessage({ length: history.length}, "*");
|
|
||||||
|
|
||||||
function done() {
|
|
||||||
// Ensure history.length doesn't change after load event has fired.
|
|
||||||
opener.postMessage({ length: history.length}, "*");
|
|
||||||
|
|
||||||
var shell = SpecialPowers.wrap(window).docShell;
|
|
||||||
var shistory = SpecialPowers.do_QueryInterface(shell, "nsIWebNavigation").sessionHistory;
|
|
||||||
if (shistory.asyncHistoryLength) {
|
|
||||||
shistory.asyncHistoryLength = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body onload="setTimeout(done);">
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -118,10 +118,6 @@ support-files = file_bug675587.html
|
|||||||
[test_forceinheritprincipal_overrule_owner.html]
|
[test_forceinheritprincipal_overrule_owner.html]
|
||||||
[test_framedhistoryframes.html]
|
[test_framedhistoryframes.html]
|
||||||
support-files = file_framedhistoryframes.html
|
support-files = file_framedhistoryframes.html
|
||||||
[test_history_length_during_pageload.html]
|
|
||||||
support-files =
|
|
||||||
file_history_length_during_pageload.html
|
|
||||||
file_history_length_during_pageload_2.html
|
|
||||||
[test_pushState_after_document_open.html]
|
[test_pushState_after_document_open.html]
|
||||||
[test_navigate_after_pagehide.html]
|
[test_navigate_after_pagehide.html]
|
||||||
skip-if = debug # Bug 1648887
|
skip-if = debug # Bug 1648887
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Test history.length during page load</title>
|
|
||||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
|
||||||
<script>
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
function runTest(testAsyncLength) {
|
|
||||||
return new Promise(function(resolve) {
|
|
||||||
var initialLength;
|
|
||||||
var messageCount = 0;
|
|
||||||
var win;
|
|
||||||
window.onmessage = function(event) {
|
|
||||||
if (event.data.initialLength) {
|
|
||||||
initialLength = event.data.initialLength;
|
|
||||||
} else {
|
|
||||||
is(event.data.length, initialLength + 1,
|
|
||||||
"history.length should increase by one when loading a new page");
|
|
||||||
}
|
|
||||||
if (++messageCount == 3) {
|
|
||||||
win.close();
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
win = window.open("file_history_length_during_pageload.html?testAsyncLength=" + testAsyncLength);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function runTests() {
|
|
||||||
await SpecialPowers.pushPrefEnv({set: [["fission.sessionHistoryInParent", false]]});
|
|
||||||
await runTest(true);
|
|
||||||
await SpecialPowers.pushPrefEnv({set: [["fission.sessionHistoryInParent", true]]});
|
|
||||||
await runTest(false);
|
|
||||||
SimpleTest.finish();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body onload="runTests();">
|
|
||||||
<p id="display"></p>
|
|
||||||
<div id="content" style="display: none"></div>
|
|
||||||
<pre id="test"></pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -4169,14 +4169,10 @@ mozilla::ipc::IPCResult ContentChild::RecvDisplayLoadError(
|
|||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult ContentChild::RecvHistoryCommitIndexAndLength(
|
mozilla::ipc::IPCResult ContentChild::RecvHistoryCommitLength(
|
||||||
const MaybeDiscarded<BrowsingContext>& aContext, const uint32_t& aIndex,
|
const MaybeDiscarded<BrowsingContext>& aContext, uint32_t aLength) {
|
||||||
const uint32_t& aLength, const nsID& aChangeID) {
|
|
||||||
if (!aContext.IsNullOrDiscarded()) {
|
if (!aContext.IsNullOrDiscarded()) {
|
||||||
ChildSHistory* shistory = aContext.get()->GetChildSessionHistory();
|
aContext.get()->GetChildSessionHistory()->SetLength(aLength);
|
||||||
if (shistory) {
|
|
||||||
shistory->SetIndexAndLength(aIndex, aLength, aChangeID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -808,9 +808,8 @@ class ContentChild final : public PContentChild,
|
|||||||
ErrorResult& aRv) override;
|
ErrorResult& aRv) override;
|
||||||
mozilla::ipc::IProtocol* AsNativeActor() override { return this; }
|
mozilla::ipc::IProtocol* AsNativeActor() override { return this; }
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvHistoryCommitIndexAndLength(
|
mozilla::ipc::IPCResult RecvHistoryCommitLength(
|
||||||
const MaybeDiscarded<BrowsingContext>& aContext, const uint32_t& aIndex,
|
const MaybeDiscarded<BrowsingContext>& aContext, uint32_t aLength);
|
||||||
const uint32_t& aLength, const nsID& aChangeID);
|
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvFlushFOGData(FlushFOGDataResolver&& aResolver);
|
mozilla::ipc::IPCResult RecvFlushFOGData(FlushFOGDataResolver&& aResolver);
|
||||||
|
|
||||||
|
|||||||
@@ -6804,10 +6804,9 @@ mozilla::ipc::IPCResult ContentParent::RecvNotifyOnHistoryReload(
|
|||||||
|
|
||||||
mozilla::ipc::IPCResult ContentParent::RecvHistoryCommit(
|
mozilla::ipc::IPCResult ContentParent::RecvHistoryCommit(
|
||||||
const MaybeDiscarded<BrowsingContext>& aContext,
|
const MaybeDiscarded<BrowsingContext>& aContext,
|
||||||
const uint64_t& aSessionHistoryEntryID, const nsID& aChangeID) {
|
uint64_t aSessionHistoryEntryID) {
|
||||||
if (!aContext.IsDiscarded()) {
|
if (!aContext.IsDiscarded()) {
|
||||||
aContext.get_canonical()->SessionHistoryCommit(aSessionHistoryEntryID,
|
aContext.get_canonical()->SessionHistoryCommit(aSessionHistoryEntryID);
|
||||||
aChangeID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
@@ -6830,24 +6829,6 @@ mozilla::ipc::IPCResult ContentParent::RecvHistoryGo(
|
|||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult ContentParent::RecvSessionHistoryUpdate(
|
|
||||||
const MaybeDiscarded<BrowsingContext>& aContext, const int32_t& aIndex,
|
|
||||||
const int32_t& aLength, const nsID& aChangeID) {
|
|
||||||
if (aContext.IsNullOrDiscarded()) {
|
|
||||||
MOZ_LOG(
|
|
||||||
BrowsingContext::GetLog(), LogLevel::Debug,
|
|
||||||
("ParentIPC: Trying to send a message to dead or detached context"));
|
|
||||||
return IPC_OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
CanonicalBrowsingContext* context = aContext.get_canonical();
|
|
||||||
context->Group()->EachParent([&](ContentParent* aParent) {
|
|
||||||
Unused << aParent->SendHistoryCommitIndexAndLength(aContext, aIndex,
|
|
||||||
aLength, aChangeID);
|
|
||||||
});
|
|
||||||
return IPC_OK();
|
|
||||||
}
|
|
||||||
|
|
||||||
mozilla::ipc::IPCResult ContentParent::RecvCommitWindowContextTransaction(
|
mozilla::ipc::IPCResult ContentParent::RecvCommitWindowContextTransaction(
|
||||||
const MaybeDiscarded<WindowContext>& aContext,
|
const MaybeDiscarded<WindowContext>& aContext,
|
||||||
WindowContext::BaseTransaction&& aTransaction, uint64_t aEpoch) {
|
WindowContext::BaseTransaction&& aTransaction, uint64_t aEpoch) {
|
||||||
|
|||||||
@@ -1309,16 +1309,12 @@ class ContentParent final
|
|||||||
|
|
||||||
mozilla::ipc::IPCResult RecvHistoryCommit(
|
mozilla::ipc::IPCResult RecvHistoryCommit(
|
||||||
const MaybeDiscarded<BrowsingContext>& aContext,
|
const MaybeDiscarded<BrowsingContext>& aContext,
|
||||||
const uint64_t& aSessionHistoryEntryID, const nsID& aChangeID);
|
uint64_t aSessionHistoryEntryID);
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvHistoryGo(
|
mozilla::ipc::IPCResult RecvHistoryGo(
|
||||||
const MaybeDiscarded<BrowsingContext>& aContext, int32_t aOffset,
|
const MaybeDiscarded<BrowsingContext>& aContext, int32_t aOffset,
|
||||||
HistoryGoResolver&& aResolveRequestedIndex);
|
HistoryGoResolver&& aResolveRequestedIndex);
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvSessionHistoryUpdate(
|
|
||||||
const MaybeDiscarded<BrowsingContext>& aContext, const int32_t& aIndex,
|
|
||||||
const int32_t& aLength, const nsID& aChangeID);
|
|
||||||
|
|
||||||
// Notify the ContentChild to enable the input event prioritization when
|
// Notify the ContentChild to enable the input event prioritization when
|
||||||
// initializing.
|
// initializing.
|
||||||
void MaybeEnableRemoteInputEventQueue();
|
void MaybeEnableRemoteInputEventQueue();
|
||||||
|
|||||||
@@ -909,17 +909,10 @@ child:
|
|||||||
*/
|
*/
|
||||||
async AbortOrientationPendingPromises(MaybeDiscardedBrowsingContext aContext);
|
async AbortOrientationPendingPromises(MaybeDiscardedBrowsingContext aContext);
|
||||||
|
|
||||||
async HistoryCommitIndexAndLength(MaybeDiscardedBrowsingContext aContext,
|
async HistoryCommitLength(MaybeDiscardedBrowsingContext aContext,
|
||||||
uint32_t aIndex, uint32_t aLength,
|
uint32_t aLength);
|
||||||
nsID aChangeID);
|
|
||||||
parent:
|
|
||||||
/**
|
|
||||||
* This is a temporary way to pass index and length through parent process.
|
|
||||||
* Used for testing.
|
|
||||||
*/
|
|
||||||
async SessionHistoryUpdate(MaybeDiscardedBrowsingContext aTopContext,
|
|
||||||
int32_t aIndex, int32_t aLength, nsID aChangeID);
|
|
||||||
|
|
||||||
|
parent:
|
||||||
async InitBackground(Endpoint<PBackgroundParent> aEndpoint);
|
async InitBackground(Endpoint<PBackgroundParent> aEndpoint);
|
||||||
|
|
||||||
async CreateGMPService();
|
async CreateGMPService();
|
||||||
@@ -1642,8 +1635,7 @@ parent:
|
|||||||
bool? reloadActiveEntry);
|
bool? reloadActiveEntry);
|
||||||
|
|
||||||
async HistoryCommit(MaybeDiscardedBrowsingContext aContext,
|
async HistoryCommit(MaybeDiscardedBrowsingContext aContext,
|
||||||
uint64_t aSessionHistoryEntryID,
|
uint64_t aSessionHistoryEntryID);
|
||||||
nsID aChangeID);
|
|
||||||
|
|
||||||
async HistoryGo(MaybeDiscardedBrowsingContext aContext,
|
async HistoryGo(MaybeDiscardedBrowsingContext aContext,
|
||||||
int32_t aOffset) returns(int32_t requestedIndex);
|
int32_t aOffset) returns(int32_t requestedIndex);
|
||||||
|
|||||||
@@ -36,12 +36,4 @@ interface ChildSHistory {
|
|||||||
* process on ChildSHistory.
|
* process on ChildSHistory.
|
||||||
*/
|
*/
|
||||||
readonly attribute nsISHistory legacySHistory;
|
readonly attribute nsISHistory legacySHistory;
|
||||||
|
|
||||||
/**
|
|
||||||
* asyncHistoryLength can be enabled to test Fission-like asynchronous
|
|
||||||
* history.length handling with non-Fission session history implementation.
|
|
||||||
* Throws if session history is running in the parent process.
|
|
||||||
*/
|
|
||||||
[SetterThrows]
|
|
||||||
attribute boolean asyncHistoryLength;
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user