The bug introduces itself in edge cases where we open a new tab that has
about:blank. In those cases `StartDocumentLoad` doesn't get called for
the document and initialization of policy container does not happen.
Which is why we make sure to initialize it properly here.
Differential Revision: https://phabricator.services.mozilla.com/D274472
After the previous patches, nsViewManager is basically a backpointer to
its pres shell.
Remove it and just make PresShell manage the root view directly. After
this is done, we can decide what to do about nsView (which is itself
little more than a widget listener that forwards to pres shell right
now).
This technically starts listening to mParentWidget slightly later (on
pres shell creation), but I think that's ok.
Differential Revision: https://phabricator.services.mozilla.com/D272890
When performing a same-document navigation, we update the active entry
in the docshell and browsing context, then we call ScrollToAnchor,
and only after scrolling we call UpdateEntriesForSameDocumentNavigation.
However, ScrollToAnchor can trigger script to run, and if this script
performs a same-document replace navigation via replaceState we end up
in state where the docshell's mActiveEntry and the navigation API's
current entry are out of sync, resulting in us triggering the assertion
that guarantees replaced entries have the same navigation key as the
entry replacing them.
This patch fixes this by updating the navigation API entries before
scrolling, which more closely follows the #scroll-to-fragid steps
in the spec.
Differential Revision: https://phabricator.services.mozilla.com/D274048
The conceptual change is small but it requires several test changes.
In principle, tests cannot open a new empty window, modify the global, then
load their target document and expect their modifications to stick. Only if the
target URI is opened directly, the synchronously available window is reused. So
either tests need to do that, or rely on messages.
Differential Revision: https://phabricator.services.mozilla.com/D265268
This patch updates the scroll position data of the "local" (i.e. not
SHIP/in parent process) navigation API entries at the right time and
removes restoring scroll position from mActiveEntry of nsDocShell and
instead uses the target history entry, i.e. the one we're navigating
towards and use that scroll that. This is technically spec compliant
since the active entry is supposed to be the target entry at that
moment.
SHIP still works as intended and is left unchanged by this patch.
Differential Revision: https://phabricator.services.mozilla.com/D272446
This allows to clean up even more view code, since views now are just a
link between layout and widget at the root and little else (so the whole
view children and so on can go), but that will be done in separate
patches since these patches are not risk-free.
Notable changes:
* PresShell::WillPaint() now recurses into subdocuments. That was done
previously via CallWillPaintOnObservers().
* Embedder frame is tracked directly by nsSubDocumentFrame an
PresShell. It might be possible to simplify this further,
if bug 1997773 sticks.
Differential Revision: https://phabricator.services.mozilla.com/D232057
This patch adds a isCaptivePortalTab field to the browsingContext.
We still keep setting the LOAD_FLAGS_DISABLE_TRR loadFlags,
though we could probably move that to BrowsingContext eventually.
nsHttpChannel now automatically allows captive portal browsing contexts
to do public -> private loads without prompting.
Differential Revision: https://phabricator.services.mozilla.com/D267943
Having this tracker as part of the navigation state led to
broken state when reentering a navigation by triggering
a new navigation from a `navigateerror` handler.
This patch removes the upcoming non-traverse API method tracker
from `Navigation` and passes it as argument, hereby following the spec.
Differential Revision: https://phabricator.services.mozilla.com/D269448
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
According to the doc of mfbt/Try.h, MOZ_TRY_VAR is obsolete. Yet it was
used a lot across the code base.
Solely relying on MOZ_TRY is both nicer to the eye and more generic, as
it allows setting variable that don't have a default constructor, and
event sometimes more efficient, if the default constructor is
non-trivial.
Differential Revision: https://phabricator.services.mozilla.com/D268466
Make sure that navigations from Location and Window.open perform correct
conversion of history handling when passed "auto".
Differential Revision: https://phabricator.services.mozilla.com/D266519
Make sure that navigations from Location and Window.open perform correct
conversion of history handling when passed "auto".
Differential Revision: https://phabricator.services.mozilla.com/D266519
This implements the basics of RestoreScrollPositionData.
It introduces the new method nsDocShell::RestoreScrollPosFromActiveSHE
which will set the scroll position to the position stored by the active
session history entry.
One could say this deviates slightly from the stated spec because the
spec suggests "HasBeenScrolledByUser" should be true/false if the "user"
has scrolled the document. This however, is a little ambiguous and
doesn't seem to correlate with behaviour from other browsers. Instead we
simply check if the scroll generation has changed since the navigation
event was fired.
It does not pass all scroll-behavior tests, as some rely on an unspecced
behaviour whereby the scroll restoration is deferred until the active
navigation interception promise has settled. We can resolve this in
another bug because this behaviour is not detailed in the spec.
Differential Revision: https://phabricator.services.mozilla.com/D266431