mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-14 07:34:28 -05:00
trusted types - loader should use trusted script url when using script tags, https://github.com/microsoft/vscode/issues/103699
This commit is contained in:
12
src/bootstrap-window.js
vendored
12
src/bootstrap-window.js
vendored
@@ -99,6 +99,18 @@
|
||||
preferScriptTags: useCustomProtocol
|
||||
};
|
||||
|
||||
// use a trusted types policy when loading via script tags
|
||||
if (loaderConfig.preferScriptTags) {
|
||||
loaderConfig.trustedTypesPolicy = window.trustedTypes?.createPolicy('amdLoader', {
|
||||
createScriptURL(value) {
|
||||
if (value.startsWith(window.location.origin)) {
|
||||
return value;
|
||||
}
|
||||
throw new Error(`Invalid script url: ${value}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Enable loading of node modules:
|
||||
// - sandbox: we list paths of webpacked modules to help the loader
|
||||
// - non-sandbox: we signal that any module that does not begin with
|
||||
|
||||
Reference in New Issue
Block a user