Skip to content

Commit

Permalink
fix(devtools): prevent devTools to load when not text/html document (a…
Browse files Browse the repository at this point in the history
…ngular#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 angular#48017

PR Close angular#48021
  • Loading branch information
JeanMeche authored and trekladyone committed Feb 1, 2023
1 parent f7ea29c commit 343fcbd
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
Original file line number Diff line number Diff line change
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 343fcbd

Please sign in to comment.