Bug 1331774 - Apply ReactDOM patch to the inspector panel; r?gl
MozReview-Commit-ID: K0VowmTSlZ7
--- 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;