mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-03 23:06:49 +01:00
This commit is contained in:
@@ -10,6 +10,7 @@ import * as path from 'path';
|
||||
import { MarkdownEngine } from './markdownEngine';
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
import { Logger } from "./logger";
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export interface ContentSecurityPolicyArbiter {
|
||||
@@ -109,7 +110,8 @@ export class MDDocumentContentProvider implements vscode.TextDocumentContentProv
|
||||
constructor(
|
||||
private engine: MarkdownEngine,
|
||||
private context: vscode.ExtensionContext,
|
||||
private cspArbiter: ContentSecurityPolicyArbiter
|
||||
private cspArbiter: ContentSecurityPolicyArbiter,
|
||||
private logger: Logger
|
||||
) {
|
||||
this.config = MarkdownPreviewConfig.getCurrentConfig();
|
||||
}
|
||||
@@ -191,6 +193,7 @@ export class MDDocumentContentProvider implements vscode.TextDocumentContentProv
|
||||
|
||||
public provideTextDocumentContent(uri: vscode.Uri): Thenable<string> {
|
||||
const sourceUri = vscode.Uri.parse(uri.query);
|
||||
|
||||
return vscode.workspace.openTextDocument(sourceUri).then(document => {
|
||||
this.config = MarkdownPreviewConfig.getCurrentConfig();
|
||||
|
||||
@@ -209,6 +212,8 @@ export class MDDocumentContentProvider implements vscode.TextDocumentContentProv
|
||||
doubleClickToSwitchToEditor: this.config.doubleClickToSwitchToEditor
|
||||
};
|
||||
|
||||
this.logger.log('provideTextDocumentContent', initialData);
|
||||
|
||||
// Content Security Policy
|
||||
const nonce = new Date().getTime() + '' + new Date().getMilliseconds();
|
||||
let csp = `<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self' http: https: data:; media-src 'self' http: https: data:; child-src 'none'; script-src 'nonce-${nonce}'; style-src 'self' 'unsafe-inline' http: https: data:; font-src 'self' http: https: data:;">`;
|
||||
|
||||
Reference in New Issue
Block a user