-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adopt new amd loader with support for TrustedScriptURL, add typings f…
…or TrustedTypesFactory et al, #106396
- Loading branch information
Showing
6 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters