mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Bug 1657435 - [devtools] Migrate from getAllDocShellsInSubtree to getAllBrowsingContextsInSubtree in DevTools. r=nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D103027
This commit is contained in:
parent
070a49e060
commit
f5a8824095
@ -92,20 +92,24 @@ function getDocShellChromeEventHandler(docShell) {
|
||||
return handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to retrieve all children docshells of a given docshell.
|
||||
*
|
||||
* Given that docshell interfaces can only be used within the same process,
|
||||
* this only returns docshells for children documents that runs in the same process
|
||||
* as the given docshell.
|
||||
*/
|
||||
function getChildDocShells(parentDocShell) {
|
||||
const allDocShells = parentDocShell.getAllDocShellsInSubtree(
|
||||
Ci.nsIDocShellTreeItem.typeAll,
|
||||
Ci.nsIDocShell.ENUMERATE_FORWARDS
|
||||
);
|
||||
|
||||
const docShells = [];
|
||||
for (const docShell of allDocShells) {
|
||||
docShell
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebProgress);
|
||||
docShells.push(docShell);
|
||||
}
|
||||
return docShells;
|
||||
return parentDocShell.browsingContext
|
||||
.getAllBrowsingContextsInSubtree()
|
||||
.filter(browsingContext => {
|
||||
// Filter out browsingContext which don't expose any docshell (e.g. remote frame)
|
||||
return browsingContext.docShell;
|
||||
})
|
||||
.map(browsingContext => {
|
||||
// Map BrowsingContext to DocShell
|
||||
return browsingContext.docShell;
|
||||
});
|
||||
}
|
||||
|
||||
exports.getChildDocShells = getChildDocShells;
|
||||
|
@ -20,7 +20,11 @@
|
||||
* timeline.on("markers", function(markers) {...})
|
||||
*/
|
||||
|
||||
const { Ci, Cu } = require("chrome");
|
||||
const { Cu } = require("chrome");
|
||||
|
||||
const {
|
||||
getChildDocShells,
|
||||
} = require("devtools/server/actors/targets/browsing-context");
|
||||
|
||||
// Be aggressive about lazy loading, as this will run on every
|
||||
// toolbox startup
|
||||
@ -101,12 +105,7 @@ Timeline.prototype = {
|
||||
return [];
|
||||
}
|
||||
|
||||
const docShells = originalDocShell.getAllDocShellsInSubtree(
|
||||
Ci.nsIDocShellTreeItem.typeAll,
|
||||
Ci.nsIDocShell.ENUMERATE_FORWARDS
|
||||
);
|
||||
|
||||
return docShells;
|
||||
return getChildDocShells(originalDocShell);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user