From e584897dd84814b2840ecd27a550d6df8a256c2c Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 5 Oct 2020 12:28:15 +0200 Subject: [PATCH] use trusted types definitions from definitely typed, https://github.com/microsoft/vscode/issues/106396 --- package.json | 1 + src/typings/trustedTypes.d.ts | 36 ----------------------------------- yarn.lock | 5 +++++ 3 files changed, 6 insertions(+), 36 deletions(-) delete mode 100644 src/typings/trustedTypes.d.ts diff --git a/package.json b/package.json index 8af485bec8711..2a72973c515b9 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,7 @@ "@types/mocha": "2.2.39", "@types/node": "^12.11.7", "@types/sinon": "^1.16.36", + "@types/trusted-types": "^1.0.6", "@types/vscode-windows-registry": "^1.0.0", "@types/webpack": "^4.4.10", "@types/windows-foreground-love": "^0.3.0", diff --git a/src/typings/trustedTypes.d.ts b/src/typings/trustedTypes.d.ts deleted file mode 100644 index feb4af291844e..0000000000000 --- a/src/typings/trustedTypes.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// see https://w3c.github.io/webappsec-trusted-types/dist/spec/ -// this isn't complete nor 100% correct - -type TrustedHTML = string & object; -type TrustedScript = string; -type TrustedScriptURL = string; - -interface TrustedTypePolicyOptions { - createHTML?: (value: string) => string - createScript?: (value: string) => string - createScriptURL?: (value: string) => string -} - -interface TrustedTypePolicy { - readonly name: string; - createHTML(input: string, ...more: any[]): TrustedHTML - createScript(input: string, ...more: any[]): TrustedScript - createScriptURL(input: string, ...more: any[]): TrustedScriptURL -} - -interface TrustedTypePolicyFactory { - createPolicy(policyName: string, object: TrustedTypePolicyOptions): TrustedTypePolicy; -} - -interface Window { - trustedTypes: TrustedTypePolicyFactory | undefined; -} - -interface WorkerGlobalScope { - trustedTypes: TrustedTypePolicyFactory | undefined; -} diff --git a/yarn.lock b/yarn.lock index a38db6751b5bb..e742c87caeb01 100644 --- a/yarn.lock +++ b/yarn.lock @@ -295,6 +295,11 @@ resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370" integrity sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ== +"@types/trusted-types@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-1.0.6.tgz#569b8a08121d3203398290d602d84d73c8dcf5da" + integrity sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw== + "@types/uglify-js@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.3.tgz#801a5ca1dc642861f47c46d14b700ed2d610840b"