Skip to content

Commit

Permalink
fallback in else of loader & remove csp addition (microsoft#153148)
Browse files Browse the repository at this point in the history
fallback in else of loader
  • Loading branch information
TylerLeonhardt authored Jun 24, 2022
1 parent 614bb1a commit f8663bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 8 additions & 1 deletion src/vs/nls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ export function load(name: string, req: AMDLoader.IRelativeRequire, load: AMDLoa
}
})();
} else {
req([name + suffix], messagesLoaded);
req([name + suffix], messagesLoaded, (err: Error) => {
if (suffix === '.nls') {
console.error('Failed trying to load default language strings', err);
return;
}
console.error(`Failed to load message bundle for language ${language}. Falling back to the default language:`, err);
req([name + '.nls'], messagesLoaded);
});
}
}
9 changes: 3 additions & 6 deletions src/vs/server/node/webClientServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,12 @@ export class WebClientServer {
callbackRoute: this._callbackRoute
};

let nlsBaseUrl = this._productService.extensionsGallery?.nlsBaseUrl;
if (!nlsBaseUrl?.endsWith('/')) {
nlsBaseUrl += '/';
}
const nlsBaseUrl = this._productService.extensionsGallery?.nlsBaseUrl;
const values: { [key: string]: string } = {
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',
WORKBENCH_WEB_BASE_URL: this._staticRoute,
WORKBENCH_NLS_BASE_URL: nlsBaseUrl ? `${nlsBaseUrl}${this._productService.commit}/${this._productService.version}/` : '',
WORKBENCH_NLS_BASE_URL: nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : '',
};


Expand All @@ -346,7 +343,7 @@ export class WebClientServer {
'default-src \'self\';',
'img-src \'self\' https: data: blob:;',
'media-src \'self\';',
`script-src 'self' 'unsafe-eval' ${this._getScriptCspHashes(data).join(' ')} 'sha256-fh3TwPMflhsEIpR8g1OYTIMVWhXTLcjQ9kh2tIpmv54=' http://${remoteAuthority} ${nlsBaseUrl ?? ''};`, // the sha is the same as in src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
`script-src 'self' 'unsafe-eval' ${this._getScriptCspHashes(data).join(' ')} 'sha256-fh3TwPMflhsEIpR8g1OYTIMVWhXTLcjQ9kh2tIpmv54=' http://${remoteAuthority};`, // the sha is the same as in src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
'child-src \'self\';',
`frame-src 'self' https://*.vscode-cdn.net data:;`,
'worker-src \'self\' data:;',
Expand Down

0 comments on commit f8663bc

Please sign in to comment.