mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
When a browser extension is updated it becomes invalidated on currently open pages. If that extension then tries to send a message to those pages through `chrome.runtime.sendMessage(..)` then an error is thrown in the console For Angular DevTools, this results in spamming the console with "Uncaught Error: Extension context invalidated." errors. This commit catches that error and removes the event listener that triggers the `chrome.runtime.sendMessage(...)` call. PR Close #55697
16 lines
518 B
TypeScript
16 lines
518 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
/// <reference types="chrome"/>
|
|
|
|
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);
|
|
}
|