зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
26e6d7493a
Коммит
88538854d7
|
@ -23,12 +23,15 @@ const {
|
||||||
class Page extends ContentProcessDomain {
|
class Page extends ContentProcessDomain {
|
||||||
constructor(session) {
|
constructor(session) {
|
||||||
super(session);
|
super(session);
|
||||||
|
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
|
this.lifecycleEnabled = false;
|
||||||
|
|
||||||
this.onFrameNavigated = this.onFrameNavigated.bind(this);
|
this.onFrameNavigated = this.onFrameNavigated.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
destructor() {
|
destructor() {
|
||||||
|
this.setLifecycleEventsEnabled({ enabled: false });
|
||||||
this.disable();
|
this.disable();
|
||||||
|
|
||||||
super.destructor();
|
super.destructor();
|
||||||
|
@ -121,10 +124,22 @@ class Page extends ContentProcessDomain {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
setLifecycleEventsEnabled() {}
|
|
||||||
addScriptToEvaluateOnNewDocument() {}
|
addScriptToEvaluateOnNewDocument() {}
|
||||||
createIsolatedWorld() {}
|
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() {
|
url() {
|
||||||
return this.content.location.href;
|
return this.content.location.href;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +173,7 @@ class Page extends ContentProcessDomain {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "pagehide":
|
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 });
|
this.emit("Page.frameStartedLoading", { frameId });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче