Bug 1597259 - [remote] Implement Page.setLifecycleEventsEnabled. r=remote-protocol-reviewers,maja_zf

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Henrik Skupin 2019-11-19 19:42:18 +00:00
Родитель 26e6d7493a
Коммит 88538854d7
1 изменённых файлов: 17 добавлений и 2 удалений

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

@ -23,12 +23,15 @@ const {
class Page extends ContentProcessDomain {
constructor(session) {
super(session);
this.enabled = false;
this.lifecycleEnabled = false;
this.onFrameNavigated = this.onFrameNavigated.bind(this);
}
destructor() {
this.setLifecycleEventsEnabled({ enabled: false });
this.disable();
super.destructor();
@ -121,10 +124,22 @@ class Page extends ContentProcessDomain {
};
}
setLifecycleEventsEnabled() {}
addScriptToEvaluateOnNewDocument() {}
createIsolatedWorld() {}
/**
* Controls whether page will emit lifecycle events.
*
* @param {Object} options
* @param {boolean} options.enabled
* If true, starts emitting lifecycle events.
*/
setLifecycleEventsEnabled(options) {
const { enabled } = options;
this.lifecycleEnabled = enabled;
}
url() {
return this.content.location.href;
}
@ -158,7 +173,7 @@ class Page extends ContentProcessDomain {
break;
case "pagehide":
// Maybe better to bound to "Network.responseReceived" once implemented
// Maybe better to bound to "unload" once we can register for this event
this.emit("Page.frameStartedLoading", { frameId });
break;