Bug 1464747 - Doesn't set the parentID of frame when window.parent is same as window. r?jryans draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Tue, 05 Jun 2018 10:03:56 +0900
changeset 803904 cef032e228594fa0b9201ac721a8975d61b4152d
parent 803410 0ee6b755ab2ee6d2ab79b17cc97bd4e83424cbfc
push id112231
push userbmo:mantaroh@gmail.com
push dateTue, 05 Jun 2018 01:04:24 +0000
reviewersjryans
bugs1464747
milestone62.0a1
Bug 1464747 - Doesn't set the parentID of frame when window.parent is same as window. r?jryans In order to prevent infinite loop in toolbox, this patch will ignore setting the parent id if window.parent is same as current window. MozReview-Commit-ID: KMfGxtEfo6N
devtools/server/actors/tab.js
--- a/devtools/server/actors/tab.js
+++ b/devtools/server/actors/tab.js
@@ -780,17 +780,20 @@ TabActor.prototype = {
                               .getInterface(Ci.nsIWebProgress);
     const window = webProgress.DOMWindow;
     const id = window.QueryInterface(Ci.nsIInterfaceRequestor)
                    .getInterface(Ci.nsIDOMWindowUtils)
                    .outerWindowID;
     let parentID = undefined;
     // Ignore the parent of the original document on non-e10s firefox,
     // as we get the xul window as parent and don't care about it.
-    if (window.parent && window != this._originalWindow) {
+    // Furthermore, ignore setting parentID when parent window is same as
+    // current window in order to deal with front end. e.g. toolbox will be fall
+    // into infinite loop due to recursive search with by using parent id.
+    if (window.parent && window.parent != window && window != this._originalWindow) {
       parentID = window.parent
                        .QueryInterface(Ci.nsIInterfaceRequestor)
                        .getInterface(Ci.nsIDOMWindowUtils)
                        .outerWindowID;
     }
 
     return {
       id,