Skip to content

Commit

Permalink
Revert "Workaround crash that can happen in Electron/Chromium"
Browse files Browse the repository at this point in the history
This reverts commit 2ca0ccb.
  • Loading branch information
Tyriar committed Aug 15, 2023
1 parent 2eca26b commit 2aee19f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
13 changes: 4 additions & 9 deletions src/browser/renderer/dom/StyleSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* @license MIT
*/

import { isElectron } from 'common/Platform';

export interface IStyleSheet {
dispose: () => void;
setCss: (value: string) => void;
Expand Down Expand Up @@ -39,12 +37,9 @@ const createStyleElement = (parent: HTMLElement): IStyleSheet => {
};

export const createStyle = (parent: HTMLElement): IStyleSheet => {
// The combination of the CSP workaround and the DOM renderer can trigger a crash in electron
// https://github.com/microsoft/vscode/issues/189753
if (!isElectron) {
try {
return createCssStyleSheet(parent.ownerDocument);
} catch { /* Fall through */ }
try {
return createCssStyleSheet(parent.ownerDocument);
} catch {
return createStyleElement(parent);
}
return createStyleElement(parent);
};
1 change: 0 additions & 1 deletion src/common/Platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const isNode = (typeof navigator === 'undefined') ? true : false;
const userAgent = (isNode) ? 'node' : navigator.userAgent;
const platform = (isNode) ? 'node' : navigator.platform;

export const isElectron = userAgent.includes('Electron');
export const isFirefox = userAgent.includes('Firefox');
export const isLegacyEdge = userAgent.includes('Edge');
export const isSafari = /^((?!chrome|android).)*safari/i.test(userAgent);
Expand Down

0 comments on commit 2aee19f

Please sign in to comment.