Skip to content

Commit

Permalink
fix(devtools): prevent devTools to load when not text/html document (#…
Browse files Browse the repository at this point in the history
…48021)

On Firefox, Angular DevTools was breaking the XML display because of the script injected
Based on contentType, we won't inject that script anymore

Fixes #48017

PR Close #48021
  • Loading branch information
JeanMeche authored and dylhunn committed Nov 17, 2022
1 parent e4309d5 commit c7b1cc0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions devtools/projects/shell-browser/src/app/ng-validate.ts
Expand Up @@ -14,7 +14,9 @@ window.addEventListener('message', (event: MessageEvent) => {
}
});

const script = document.createElement('script');
script.src = chrome.runtime.getURL('app/detect_angular_for_extension_icon_bundle.js');
document.documentElement.appendChild(script);
document.documentElement.removeChild(script);
if (document.contentType === 'text/html') {
const script = document.createElement('script');
script.src = chrome.runtime.getURL('app/detect_angular_for_extension_icon_bundle.js');
document.documentElement.appendChild(script);
document.documentElement.removeChild(script);
}

0 comments on commit c7b1cc0

Please sign in to comment.