Bug 1539210 - Do not destroy the content process session on page unload. r=ato

A session is bound to a browsing context, not just one document.
`unload` is fired when navigating to another document. The document goes
away, but not the browsing context. So, we should keep the session up and running
when the current document is destroyed and we navigate to another URL.

Depends on D25577

Differential Revision: https://phabricator.services.mozilla.com/D25578

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-04-04 11:29:29 +00:00
Родитель a9c172506d
Коммит d26882a9f4
1 изменённых файлов: 0 добавлений и 4 удалений

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

@ -19,13 +19,9 @@ class ContentProcessSession {
this.domains = new Domains(this, ContentProcessDomains); this.domains = new Domains(this, ContentProcessDomains);
this.messageManager.addMessageListener("remote:request", this); this.messageManager.addMessageListener("remote:request", this);
this.messageManager.addMessageListener("remote:destroy", this); this.messageManager.addMessageListener("remote:destroy", this);
this.destroy = this.destroy.bind(this);
this.content.addEventListener("unload", this.destroy);
} }
destroy() { destroy() {
this.content.addEventListener("unload", this.destroy);
this.messageManager.removeMessageListener("remote:request", this); this.messageManager.removeMessageListener("remote:request", this);
this.messageManager.removeMessageListener("remote:destroy", this); this.messageManager.removeMessageListener("remote:destroy", this);
} }