Skip to content

Commit 2c1cf56

Browse files
author
Brian Vaughn
authored
DevTools should inject itself for XHTML pages too (not just HTML) (#22932)
1 parent f2a59df commit 2c1cf56

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

packages/react-devtools-extensions/src/injectGlobalHook.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,18 @@ if (sessionStorageGetItem(SESSION_STORAGE_RELOAD_AND_PROFILE_KEY) === 'true') {
135135
// We need to inject this code because content scripts (ie injectGlobalHook.js) don't have access
136136
// to the webpage's window, so in order to access front end settings
137137
// and communicate with React, we must inject this code into the webpage
138-
if ('text/html' === document.contentType) {
139-
injectCode(
140-
';(' +
141-
installHook.toString() +
142-
'(window))' +
143-
saveNativeValues +
144-
detectReact,
145-
);
138+
switch (document.contentType) {
139+
case 'text/html':
140+
case 'application/xhtml+xml': {
141+
injectCode(
142+
';(' +
143+
installHook.toString() +
144+
'(window))' +
145+
saveNativeValues +
146+
detectReact,
147+
);
148+
break;
149+
}
146150
}
147151

148152
if (typeof exportFunction === 'function') {

0 commit comments

Comments
 (0)