Bug 1490858 - Streamline nsISHEntry a little more. r=nika

By marking some C++-only nsISHistory methods as [noscript] or [noscript,
notxpcom].

--HG--
extra : rebase_source : 1216e755a227fd13f01057afd71ea082a2a79ad7
This commit is contained in:
Nicholas Nethercote 2018-09-12 11:59:06 +10:00
Родитель f9b2172b05
Коммит f659c0df65
5 изменённых файлов: 27 добавлений и 44 удалений

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

@ -112,17 +112,17 @@ interface nsISHEntry : nsISupports
*/
/** Append a child shell to the end of our list. */
void addChildShell(in nsIDocShellTreeItem shell);
[noscript, notxpcom] void addChildShell(in nsIDocShellTreeItem shell);
/**
* Get the child shell at |index|; returns null if |index| is out of bounds.
*/
nsIDocShellTreeItem childShellAt(in long index);
[noscript] nsIDocShellTreeItem childShellAt(in long index);
/**
* Clear the child shell list.
*/
void clearChildShells();
[noscript, notxpcom] void clearChildShells();
/** Saved refresh URI list for the content viewer */
[infallible] attribute nsIMutableArray refreshURIList;
@ -134,7 +134,7 @@ interface nsISHEntry : nsISupports
* contentViewer, sticky, windowState, viewerBounds, childShells,
* refreshURIList.
*/
void syncPresentationState();
[noscript, notxpcom] void syncPresentationState();
/** Post Data for the document */
[infallible] attribute nsIInputStream postData;
@ -213,7 +213,7 @@ interface nsISHEntry : nsISupports
/** Return any content viewer present in or below this node in the
nsSHEntry tree. This will differ from contentViewer in the case
where a child nsSHEntry has the content viewer for this tree. */
nsIContentViewer getAnyContentViewer(out nsISHEntry ownerEntry);
[noscript] nsIContentViewer getAnyContentViewer(out nsISHEntry ownerEntry);
/**
* Get the principal, if any, that was associated with the channel
@ -255,7 +255,7 @@ interface nsISHEntry : nsISupports
* Returns true if the related docshell was added because of
* dynamic addition of an iframe/frame.
*/
boolean isDynamicallyAdded();
[noscript, notxpcom] boolean isDynamicallyAdded();
/**
* Returns true if any of the child entries returns true
@ -281,8 +281,7 @@ interface nsISHEntry : nsISupports
* the BFCache entry will evict the SHEntry, since the two entries
* correspond to the same document.
*/
[notxpcom, noscript]
boolean hasBFCacheEntry(in nsIBFCacheEntry aEntry);
[noscript, notxpcom] boolean hasBFCacheEntry(in nsIBFCacheEntry aEntry);
/**
* Adopt aEntry's BFCacheEntry, so now both this and aEntry point to
@ -369,8 +368,7 @@ interface nsISHEntry : nsISupports
* This shared state is the SHEntry's BFCacheEntry. So
* hasBFCacheEntry(getSharedState()) is guaranteed to return true.
*/
[noscript, notxpcom]
nsSHEntryShared getSharedState();
[noscript, notxpcom] nsSHEntryShared getSharedState();
/**
* The current number of nsISHEntries which are immediate children of this
@ -386,7 +384,7 @@ interface nsISHEntry : nsISupports
/**
* Remove a child SHEntry.
*/
void RemoveChild(in nsISHEntry aChild);
[noscript] void RemoveChild(in nsISHEntry aChild);
/**
* Get child at an index.
@ -398,7 +396,7 @@ interface nsISHEntry : nsISupports
* with aNewChild.
* @throw if nothing was replaced.
*/
void ReplaceChild(in nsISHEntry aNewChild);
[noscript] void ReplaceChild(in nsISHEntry aNewChild);
/**
* When an entry is serving is within nsISHistory's array of entries, this

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

@ -695,10 +695,7 @@ nsSHEntry::AddChild(nsISHEntry* aChild, int32_t aOffset)
//
NS_ASSERTION(aOffset < (mChildren.Count() + 1023), "Large frames array!\n");
bool newChildIsDyn = false;
if (aChild) {
aChild->IsDynamicallyAdded(&newChildIsDyn);
}
bool newChildIsDyn = aChild ? aChild->IsDynamicallyAdded() : false;
// If the new child is dynamically added, try to add it to aOffset, but if
// there are non-dynamically added children, the child must be after those.
@ -707,9 +704,7 @@ nsSHEntry::AddChild(nsISHEntry* aChild, int32_t aOffset)
for (int32_t i = aOffset; i < mChildren.Count(); ++i) {
nsISHEntry* entry = mChildren[i];
if (entry) {
bool dyn = false;
entry->IsDynamicallyAdded(&dyn);
if (dyn) {
if (entry->IsDynamicallyAdded()) {
break;
} else {
lastNonDyn = i;
@ -738,9 +733,7 @@ nsSHEntry::AddChild(nsISHEntry* aChild, int32_t aOffset)
for (int32_t i = start; i >= 0; --i) {
nsISHEntry* entry = mChildren[i];
if (entry) {
bool dyn = false;
entry->IsDynamicallyAdded(&dyn);
if (dyn) {
if (entry->IsDynamicallyAdded()) {
dynEntryIndex = i;
dynEntry = entry;
} else {
@ -777,9 +770,7 @@ nsSHEntry::RemoveChild(nsISHEntry* aChild)
{
NS_ENSURE_TRUE(aChild, NS_ERROR_FAILURE);
bool childRemoved = false;
bool dynamic = false;
aChild->IsDynamicallyAdded(&dynamic);
if (dynamic) {
if (aChild->IsDynamicallyAdded()) {
childRemoved = mChildren.RemoveObject(aChild);
} else {
int32_t index = mChildren.IndexOfObject(aChild);
@ -834,12 +825,11 @@ nsSHEntry::ReplaceChild(nsISHEntry* aNewEntry)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
NS_IMETHODIMP_(void)
nsSHEntry::AddChildShell(nsIDocShellTreeItem* aShell)
{
NS_ASSERTION(aShell, "Null child shell added to history entry");
MOZ_ASSERT(aShell, "Null child shell added to history entry");
mShared->mChildShells.AppendObject(aShell);
return NS_OK;
}
NS_IMETHODIMP
@ -849,11 +839,10 @@ nsSHEntry::ChildShellAt(int32_t aIndex, nsIDocShellTreeItem** aShell)
return NS_OK;
}
NS_IMETHODIMP
NS_IMETHODIMP_(void)
nsSHEntry::ClearChildShells()
{
mShared->mChildShells.Clear();
return NS_OK;
}
NS_IMETHODIMP
@ -870,10 +859,10 @@ nsSHEntry::SetRefreshURIList(nsIMutableArray* aList)
return NS_OK;
}
NS_IMETHODIMP
NS_IMETHODIMP_(void)
nsSHEntry::SyncPresentationState()
{
return mShared->SyncPresentationState();
mShared->SyncPresentationState();
}
nsDocShellEditorData*
@ -913,11 +902,10 @@ nsSHEntry::SetStateData(nsIStructuredCloneContainer* aContainer)
return NS_OK;
}
NS_IMETHODIMP
nsSHEntry::IsDynamicallyAdded(bool* aAdded)
NS_IMETHODIMP_(bool)
nsSHEntry::IsDynamicallyAdded()
{
*aAdded = mShared->mDynamicallyCreated;
return NS_OK;
return mShared->mDynamicallyCreated;
}
NS_IMETHODIMP
@ -927,7 +915,7 @@ nsSHEntry::HasDynamicallyAddedChild(bool* aAdded)
for (int32_t i = 0; i < mChildren.Count(); ++i) {
nsISHEntry* entry = mChildren[i];
if (entry) {
entry->IsDynamicallyAdded(aAdded);
*aAdded = entry->IsDynamicallyAdded();
if (*aAdded) {
break;
}

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

@ -97,17 +97,15 @@ nsSHEntryShared::RemoveFromExpirationTracker()
}
}
nsresult
void
nsSHEntryShared::SyncPresentationState()
{
if (mContentViewer && mWindowState) {
// If we have a content viewer and a window state, we should be ok.
return NS_OK;
return;
}
DropPresentationState();
return NS_OK;
}
void

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

@ -64,7 +64,7 @@ private:
static already_AddRefed<nsSHEntryShared> Duplicate(nsSHEntryShared* aEntry);
void RemoveFromExpirationTracker();
nsresult SyncPresentationState();
void SyncPresentationState();
void DropPresentationState();
nsresult SetContentViewer(nsIContentViewer* aViewer);

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

@ -1199,8 +1199,7 @@ GetDynamicChildren(nsISHEntry* aEntry,
nsCOMPtr<nsISHEntry> child;
aEntry->GetChildAt(i, getter_AddRefs(child));
if (child) {
bool dynAdded = false;
child->IsDynamicallyAdded(&dynAdded);
bool dynAdded = child->IsDynamicallyAdded();
if (dynAdded) {
nsID docshellID = child->DocshellID();
aDocshellIDs.AppendElement(docshellID);