зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1611096 - Add test for inspector target switching r=ochameau,rcaliman
Depends on D62622 Differential Revision: https://phabricator.services.mozilla.com/D62623
This commit is contained in:
Родитель
db1a2da5e2
Коммит
6f5f77fa4f
|
@ -61,10 +61,25 @@ class WalkerFront extends FrontClassWithSpec(walkerSpec) {
|
||||||
* set.
|
* set.
|
||||||
*/
|
*/
|
||||||
async getRootNode() {
|
async getRootNode() {
|
||||||
if (this.rootNode) {
|
// We automatically start and stop watching when getRootNode is called so
|
||||||
return this.rootNode;
|
// that consumers using getRootNode without watchRootNode can still get a
|
||||||
|
// correct rootNode. Otherwise they might receive an outdated node.
|
||||||
|
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1633348.
|
||||||
|
this._rootNodeWatchers++;
|
||||||
|
if (this.traits.watchRootNode && this._rootNodeWatchers === 1) {
|
||||||
|
await super.watchRootNode();
|
||||||
}
|
}
|
||||||
const rootNode = await this.once("root-available");
|
|
||||||
|
let rootNode = this.rootNode;
|
||||||
|
if (!rootNode) {
|
||||||
|
rootNode = await this.once("root-available");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._rootNodeWatchers--;
|
||||||
|
if (this.traits.watchRootNode && this._rootNodeWatchers === 0) {
|
||||||
|
super.unwatchRootNode();
|
||||||
|
}
|
||||||
|
|
||||||
return rootNode;
|
return rootNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче