nsISHEntry.index is readonly, but if you pass `true` as getEntryAtIndex()'s
second argument, nsISHEntry.index will be modified. This is pretty gross.
This patch changes `index` so it's not readonly (because it's not!) and removes
getEntryAtIndex()'s second argument.
--HG--
extra : rebase_source : c519d77fcc1c3bda2f260b5888ce9cd0f6cfdab5
Because it's a wafer-thin wrapper around nsISHEntry that just complicates
things.
This patch leaves behind a combination of "entry" and "transaction"
terminology. I'll fix that in a subsequent patch.
--HG--
extra : rebase_source : ca15187447bf3d93c65ed3980ead5bca958471be
Specifically:
- Check the nsresult consistently, but don't check (unnecessarily) for null on
success.
- In AddEntry(), move GetTransactionAtIndex() before all state-changing
operations, so we don't end up with partial state updates upon failure.
- Use early returns to reduce indenting.
--HG--
extra : rebase_source : 17815f6813f024fae1cf4ec3cf1b7985ab7a2ff2
In practice it's always non-null, and only half the places that deal with it
have null handling code. So this simplifies things.
--HG--
extra : rebase_source : 250b286b6b2c10aeb0c4486ebe13b1e071bf6c8a
It was used to protect against changes in mIndex by history listeners, but the
new code structure doesn't need it, because we want to use mIndex afterwards.
--HG--
extra : rebase_source : 74f0cc7f696b101b8e9d699790f2f2c141c5f51b
nsSHistory currently implements nsIWebNavigation, but only three of the methods
are actually used, and the rest call MOZ_CRASH. This patch removes the
inheritance and changes the implementations of those three methods (Reload(),
GetCurrentURI(), and GotoIndex()) to pure C++.
There is one test, bug662200_window.xul, that calls Reload() from JS, which is
no longer possible. Fortunately, nsSHistory::ReloadCurrentEntry() -- which *is*
available from JS -- is similar enough to Reload(0) that it can be used
instead.
(The only difference between Reload(0) and ReloadCurrentEntry() is that the
former triggers the `OnHistoryReload` notification and the latter triggers
`OnHistoryGotoIndex`, which doesn't matter for this test.)
--HG--
extra : rebase_source : 69dba04f14b1438f50f597f3d16b77225795f8a7
The only ones that are reachable are GotoIndex(), GetCurrentURI(), and
Reload(). This patch makes all the others crash.
Note that the reason that Go{Back,Forward}() are unreachable is because of this
behaviour in ChildHistory::Go():
// XXX(nika): Should we turn Go(-1) and Go(1) to call GoForward and GoBack?
// They technically fire different change events but I couldn't find anyone
// who cares, so I'm inclined not to.
I.e. those functions are now subsumed by GotoIndex().
As for CanGo{Back,Forward}(), a try push plus code inspection confirm that they
are unused.
--HG--
extra : rebase_source : 6509e635478f257be1271b51d352e0a9d81899ec
(It's worth noting that I had to fix one of these instances in the previous
patch, by adding a -1.)
--HG--
extra : rebase_source : ea45cd7dc59b6649f1b46a2c917def79538fcbe8
- nsISHistoryInternal loses `rootTransaction`, and gains
GetTransactionAtIndex(). (The implementing class `nsSHistory` already
implemented a method by that method.)
- nsSHistory loses `mListRoot` in favour of `mTransactions`. It also loses
`mLength`, because `mTransactions` tracks the length itself.
- nsISHTransaction.{prev,next} are no longer needed.
- nsISHTransaction.create() is no longer needed, because all it does now is set
the SHEntry, and we can use SetSHEntry() for that.
Overall this deletes about 200 lines of code.
--HG--
extra : rebase_source : eac6334b653e04634baa86a0f4e3c8f07c06e560
In order to allow JS callers to use nsISimpleEnumerator instances with the JS
iteration protocol, we'll need to additional methods to every instance. Since
we currently have a large number of unrelated implementations, it would be
best if they could share the same implementation for the JS portion of the
protocol.
This patch adds a stub nsSimpleEnumerator base class, and updates all existing
implementations to inherit from it. A follow-up will add a new base interface
to this class, and implement the additional functionality required for JS
iteration.
Differential Revision: https://phabricator.services.mozilla.com/D3725
--HG--
extra : rebase_source : ad66d7b266856d5a750c772e4710679fab9434b1
extra : histedit_source : a83ebffbf2f0b191ba7de9007f73def6b9a955b8
nsSHEntry is the only class that instantiates those two interfaces, so the
separation is not useful. This lets us remove numerous pointless QIs.
--HG--
extra : rebase_source : 570b7ade669fb89a789184198bec9da186c5f1d3
nsSHEntry is the only class that instantiates those two interfaces, so the
separation is not useful. This lets us remove several pointless QIs.
The patch also removes RemoveFromBFCache{AS,S}ync, which are unused.
--HG--
extra : rebase_source : 84db7ec180c357ab8c762dc60efb5eed444ba514
We have 2 different LoadType enums with two different values, which
have to be converted between depending on whether we're going to/from
LoadInfo/nsISHEntry/etc. We should be able to just use the same enum
everywhere and not have to deal with conversion, especially since we
don't have any type safety around the enum.
MozReview-Commit-ID: 2t9vVGLpOte
The current limit of at most one bfcache entry on Android dates back to when
Fennec was built for the Nokia N810, which had a whopping 128 MB of memory.
Since a few years have passed since then and mobile device technology has
evolved considerably, it should be safe now to allow a little more than that.
Since web sites sizes might have grown somewhat as well compared to the figure
of 4MB mentioned in CalcMaxTotalViweres(), though and to be absolutely on the
safe side, we still tweak the formula when building for Android, though.
If in the worst case even those assumptions turn out too generous, we will still
be protected by the fact that
- we temporarily disable the bfcache when the OS signals memory pressure, and
- our contentViewerTimeout is set to a lower value than on Desktop, so bfcache
entries will expire sooner
MozReview-Commit-ID: 1A6d0Q6Mdx0
--HG--
extra : rebase_source : 9cc1f7abb1aef82ffc4d7987773ae7cf35440884
This change requires introducing nsID::Clone(). Because it's infallible, the
patch also removes some redundant failure-handling code. (nsMemory::Clone() is
also infallible, so this code was redundant even before this change.)
--HG--
extra : rebase_source : ef22757d3fa814320490bf7e19e822b8f0c4bdc3
(Path is actually r=froydnj.)
Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.
MozReview-Commit-ID: 91U22X2NydP
--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
XPCOM's string API doesn't have the notion of a "null string". But it does have
the notion of a "void string" (or "voided string"), and that's what these
functions are returning. So the names should reflect that.
--HG--
extra : rebase_source : 4e3f982e0873877174a08a25413595ff66f7d20e
nsXPIDLStrings are marked as VOIDED upon initialization. Most of these local
nsXPIDLString variables are immediately set via getter_Copies(), which will
either assign a string value (using Adopt()) or do SetIsVoid(). These can be
trivially converted to nsString, which will get the same treatment.
The patch suitably converts the remaining nsXPIDLString local variable as well.
--HG--
extra : rebase_source : 5fff9f2c6844559198f601853f8db08564add7d5
This flag is for when we've loaded a URI in a remote type that is not the default
for compatibility reasons (for example related http in the file content process).
So that we can load the history entry in that same process as well.
Convert the singleton HistoryTracker implementation to a per-nsSHistory based
implementation so that it can be bound to a TabGroup.
MozReview-Commit-ID: 7cMtArsO5lQ
--HG--
extra : rebase_source : 3711bc7f7afaa40772035e24270d4fde1d17924a
Re-order includes to meet gecko's coding style, and move bool data members
to the bottom for slightly better alignment (nsSHEntry down from 192->176,
nsSHEntryShared down from 208->200 on a Linux64 build).
MozReview-Commit-ID: CG1M6Hh39uI
--HG--
extra : rebase_source : 5762a8a3536805e2b15b71425a9376c191cf16cb
This will allow the session store to store and restore scroll positions (and pinch zoom on Android) for past session history entries as well, whereas today only the scroll position of the current page is saved.
As a LayoutHistoryState saves its PresStates in a hash table that doesn't allow direct access to its contents if you don't already know the entry's key, we provide a function to iterate over all stored PresStates and retrieve their keys, which can then be used to get access to each individual PresState in turn. Since nsPresState is little more than a fancy struct and we don't want to have to turn it into a full-blown XPCOM-compatible interface, we just pass the scroll/zoom-related values we're interested in as in/out parameters from/to JS via the LayoutHistoryState.
We also require a helper method for initialising an SHEntry's LayoutHistoryState, since normally this doesn't happen until the PresShell wants to capture the history state in it. We on the other hand require a LayoutHistoryState to be present immediately after creation of a fresh SHEntry object, so we can feed it the session store data during history restoration.
MozReview-Commit-ID: FfZf8KDsVWl
***
--HG--
extra : rebase_source : 0b3f729bff3ac24680d6fe8a0fb796979886170b