Bug 1347238 - Add a check for rootNode in getAllGrids. r=jdescottes
MozReview-Commit-ID: 7MzFuiW2Ju0
--- a/devtools/server/actors/layout.js
+++ b/devtools/server/actors/layout.js
@@ -120,21 +120,26 @@ var LayoutActor = ActorClassWithSpec(lay
* iterating below the given rootNode and optionally including nested frames.
*
* @param {NodeActor} rootNode
* @param {Boolean} traverseFrames
* Whether or not we should iterate through nested frames.
* @return {Array} An array of GridActor objects.
*/
getAllGrids: function (rootNode, traverseFrames) {
+ let grids = [];
+
+ if (!rootNode) {
+ return grids;
+ }
+
if (!traverseFrames) {
return this.getGrids(rootNode.rawNode);
}
- let grids = [];
for (let {document} of this.tabActor.windows) {
grids = [...grids, ...this.getGrids(document.documentElement)];
}
return grids;
},
onNavigate: function () {