Bug 1543098 - Implement Runtime.executionContextDestroyed. r=ato

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-04-29 14:58:59 +00:00
Родитель d19d0f5a17
Коммит 518602fb41
1 изменённых файлов: 10 добавлений и 0 удалений

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

@ -27,6 +27,8 @@ class Runtime extends ContentProcessDomain {
this.chromeEventHandler.addEventListener("DOMWindowCreated", this,
{mozSystemGroup: true});
Services.obs.addObserver(this, "inner-window-destroyed");
// Spin the event loop in order to send the `executionContextCreated` event right
// after we replied to `enable` request.
Services.tm.dispatchToMainThread(() => {
@ -50,6 +52,7 @@ class Runtime extends ContentProcessDomain {
this.enabled = false;
this.chromeEventHandler.removeEventListener("DOMWindowCreated", this,
{mozSystemGroup: true});
Services.obs.removeObserver(this, "inner-window-destroyed");
}
}
@ -70,4 +73,11 @@ class Runtime extends ContentProcessDomain {
break;
}
}
observe(subject, topic, data) {
const innerWindowID = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
this.emit("Runtime.executionContextDestroyed", {
executionContextId: innerWindowID,
});
}
}