зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1675820 - Part 7: Fix marionette BrowsingContext replace detection logic, r=whimboo,marionette-reviewers,farre
Differential Revision: https://phabricator.services.mozilla.com/D108866
This commit is contained in:
Родитель
c733984c4b
Коммит
d14469fe31
|
@ -833,8 +833,14 @@ void BrowsingContext::Detach(bool aFromIPC) {
|
|||
}
|
||||
|
||||
if (nsCOMPtr<nsIObserverService> obs = services::GetObserverService()) {
|
||||
obs->NotifyObservers(ToSupports(this), "browsing-context-discarded",
|
||||
nullptr);
|
||||
// Why the context is being discarded. This will always be "discard" in the
|
||||
// content process, but may be "replace" if it's known the context being
|
||||
// replaced in the parent process.
|
||||
const char16_t* why = u"discard";
|
||||
if (XRE_IsParentProcess() && IsTop() && !Canonical()->GetWebProgress()) {
|
||||
why = u"replace";
|
||||
}
|
||||
obs->NotifyObservers(ToSupports(this), "browsing-context-discarded", why);
|
||||
}
|
||||
|
||||
// NOTE: Doesn't use SetClosed, as it will be set in all processes
|
||||
|
|
|
@ -313,10 +313,11 @@ navigate.waitForNavigationCompleted = async function waitForNavigationCompleted(
|
|||
|
||||
// In the case when the currently selected frame is closed,
|
||||
// there will be no further load events. Stop listening immediately.
|
||||
const onBrowsingContextDiscarded = (subject, topic) => {
|
||||
// With the currentWindowGlobal gone the browsing context hasn't been
|
||||
// replaced due to a remoteness change but closed.
|
||||
if (subject == browsingContextFn() && !subject.currentWindowGlobal) {
|
||||
const onBrowsingContextDiscarded = (subject, topic, why) => {
|
||||
// If the BrowsingContext is being discarded to be replaced by another
|
||||
// context, we don't want to stop waiting for the pageload to complete, as
|
||||
// we will continue listening to the newly created context.
|
||||
if (subject == browsingContextFn() && why != "replace") {
|
||||
logger.trace(
|
||||
"Canceled page load listener " +
|
||||
`because browsing context with id ${subject.id} has been removed`
|
||||
|
|
Загрузка…
Ссылка в новой задаче