Bug 1331774 - Apply ReactDOM patch to the inspector panel; r=gl
authorGreg Tatum <tatum.creative@gmail.com>
Tue, 17 Jan 2017 16:22:28 -0600
changeset 374895 66363b305bc6f12b1b3eea6e9b0376339d172ecc
parent 374894 0fb3b77822c1dc3a39ffaa3e77a1a3808f69555f
child 374896 0be9ebdc6488a99a072b38e4b427d0a11e575371
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1331774
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1331774 - Apply ReactDOM patch to the inspector panel; r=gl MozReview-Commit-ID: K0VowmTSlZ7
devtools/client/shared/vendor/react-dom.js
--- a/devtools/client/shared/vendor/react-dom.js
+++ b/devtools/client/shared/vendor/react-dom.js
@@ -131,28 +131,32 @@
 
   /**
    * Try to access the containing toolbox XUL document, but only if all of the iframes
    * in the heirarchy are XUL documents. Events dispatch differently in the case of all
    * privileged XUL documents. Events that fire in an iframe propagate up to the parent
    * frame. This does not happen when HTML is in the mix. Only return the toolbox if
    * it matches the proper case of a XUL iframe inside of a XUL document.
    *
+   * In addition to the XUL case, if the panel uses the toolbox's ReactDOM instance,
+   * this patch needs to be applied as well. This is the case for the inspector.
+   *
    * @param {HTMLElement} node - The DOM node inside of an iframe.
    * @return {XULDocument|null} The toolbox.xul document, or null.
    */
   function getToolboxDocIfXulOnly(node) {
     // This execution context doesn't know about XULDocuments, so don't get the toolbox.
     if (typeof XULDocument !== "function") {
       return null;
     }
 
     let doc = node.ownerDocument;
+    const inspectorUrl = "chrome://devtools/content/inspector/inspector.xhtml";
 
-    while (doc instanceof XULDocument) {
+    while (doc instanceof XULDocument || doc.location.href === inspectorUrl) {
       const {frameElement} = doc.defaultView;
 
       if (!frameElement) {
         // We're at the root element, and no toolbox was found.
         return null;
       }
 
       doc = frameElement.parentElement.ownerDocument;