From 3024e71ee622f6485dea8cec1550634169bb7e2f Mon Sep 17 00:00:00 2001 From: Emanuel Tesar Date: Fri, 30 Aug 2019 18:52:08 +0200 Subject: [PATCH 1/6] Build polyfill for multiple environments --- .eslintrc.json | 1 + .gitignore | 1 + Gulpfile.js | 4 +- dist/cjs/trustedtypes.api_only.js | 723 -------------------- dist/es5/trustedtypes.api_only.build.js.map | 2 +- dist/es5/trustedtypes.build.js.map | 2 +- dist/es6/trustedtypes.api_only.build.js.map | 2 +- dist/es6/trustedtypes.build.js.map | 2 +- dist/spec/index.html | 6 +- karma.conf.js | 1 + package.json | 12 +- rollup.config.js | 15 - src/enforcer.js | 4 +- src/polyfill/api_only.js | 2 + src/polyfill/full.js | 4 +- 15 files changed, 25 insertions(+), 756 deletions(-) delete mode 100644 dist/cjs/trustedtypes.api_only.js delete mode 100644 rollup.config.js diff --git a/.eslintrc.json b/.eslintrc.json index a1998dbb..8b6b794d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,6 +7,7 @@ "env": { "browser": true, "jasmine": true, + "node": true, "es6": true }, "plugins": [ diff --git a/.gitignore b/.gitignore index 2cfe189a..a917e217 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/ local.log browserstack.err +build/ diff --git a/Gulpfile.js b/Gulpfile.js index 0d03aa8d..0c7fd0df 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -1,4 +1,4 @@ -/* eslint-disable require-jsdoc */ +/* eslint-disable */ /** * @license * Copyright 2017 Google Inc. All Rights Reserved. @@ -103,7 +103,7 @@ gulp.task('es5.api', function() { .pipe(gulp.dest('dist/es5')); }); -gulp.task('es5.full', function(done) { +gulp.task('es5.full', function() { return gulp.src([ './src/**/*.js', ], {base: './'}) diff --git a/dist/cjs/trustedtypes.api_only.js b/dist/cjs/trustedtypes.api_only.js deleted file mode 100644 index 740b68d5..00000000 --- a/dist/cjs/trustedtypes.api_only.js +++ /dev/null @@ -1,723 +0,0 @@ -'use strict'; - -/** - * @license - * Copyright 2017 Google Inc. All Rights Reserved. - * - * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE. - * - * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document - */ - -const rejectInputFn = (s) => { - throw new TypeError('undefined conversion'); -}; - -const {toLowerCase, toUpperCase} = String.prototype; - -const HTML_NS = 'http://www.w3.org/1999/xhtml'; -const XLINK_NS = 'http://www.w3.org/1999/xlink'; -const SVG_NS = 'http://www.w3.org/2000/svg'; - -/** - * @constructor - * @property {!function(string):TrustedHTML} createHTML - * @property {!function(string):TrustedURL} createURL - * @property {!function(string):TrustedScriptURL} createScriptURL - * @property {!function(string):TrustedScript} createScript - * @property {!string} name - */ -const TrustedTypePolicy = function() { - throw new TypeError('Illegal constructor'); -}; - -/** - * @constructor - */ -const TrustedTypePolicyFactory = function() { - throw new TypeError('Illegal constructor'); -}; -/* eslint-enable no-unused-vars */ - -const DEFAULT_POLICY_NAME = 'default'; - - -const trustedTypesBuilderTestOnly = function() { - // Capture common names early. - const { - assign, create, defineProperty, freeze, getOwnPropertyNames, - getPrototypeOf, prototype: ObjectPrototype, - } = Object; - - const {hasOwnProperty} = ObjectPrototype; - - const { - forEach, push, - } = Array.prototype; - - const creatorSymbol = Symbol(); - - /** - * Getter for the privateMap. - * @param {Object} obj Key of the privateMap - * @return {Object} Private storage. - */ - const privates = function(obj) { - let v = privateMap.get(obj); - if (v === undefined) { - v = create(null); // initialize the private storage. - privateMap.set(obj, v); - } - return v; - }; - - /** - * Called before attacker-controlled code on an internal collections, - * copies prototype members onto the instance directly, so that later - * changes to prototypes cannot expose collection internals. - * @param {!T} collection - * @return {!T} collection - * @template T - */ - function selfContained(collection) { - const proto = getPrototypeOf(collection); - if (proto == null || getPrototypeOf(proto) !== ObjectPrototype) { - throw new Error(); // Loop below is insufficient. - } - for (const key of getOwnPropertyNames(proto)) { - defineProperty(collection, key, {value: collection[key]}); - } - return collection; - } - - /** - * Map for private properties of Trusted Types object. - * This is so that the access to the type constructor does not give - * the ability to create typed values. - * @type {WeakMap} - */ - const privateMap = selfContained(new WeakMap()); - - /** - * List of all configured policy names. - * @type {Array} - */ - const policyNames = selfContained([]); - - /** - * Allowed policy namess for policy names. - * @type {Array} - */ - const allowedNames = selfContained([]); - - /** - * A reference to a default policy, if created. - * @type {TrustedTypePolicy} - */ - let defaultPolicy = null; - - /** - * Whether to enforce allowedNames in createPolicy(). - * @type {boolean} - */ - let enforceNameWhitelist = false; - - - /** - * A value that is trusted to have certain security-relevant properties - * because the sources of such values are controlled. - */ - class TrustedType { - /** - * Constructor for TrustedType. Only allowed to be called from within a - * policy. - * @param {symbol} s creatorSymbol - * @param {string} policyName The name of the policy this object was - * created by. - */ - constructor(s, policyName) { - // TODO: Figure out if symbol is needed, if the value is in privateMap. - if (s !== creatorSymbol) { - throw new Error('cannot call the constructor'); - } - defineProperty(this, 'policyName', - {value: '' + policyName, enumerable: true}); - } - - /** - * Returns the wrapped string value of the object. - * @return {string} - * @override - */ - toString() { - return privates(this)['v']; - } - - /** - * Returns the wrapped string value of the object. - * @return {string} - * @override - */ - valueOf() { - return privates(this)['v']; - } - } - - /** - * @param {function(new:TrustedType, symbol, string)} SubClass - * @param {string} canonName The class name which should be independent of - * any renaming pass and which is relied upon by the enforcer and for - * native type interop. - */ - function lockdownTrustedType(SubClass, canonName) { - freeze(SubClass.prototype); - delete SubClass.name; - defineProperty(SubClass, 'name', {value: canonName}); - } - - /** - * Trusted URL object wrapping a string that can only be created from a - * TT policy. - */ - class TrustedURL extends TrustedType { - } - lockdownTrustedType(TrustedURL, 'TrustedURL'); - - /** - * Trusted Script URL object wrapping a string that can only be created from a - * TT policy. - */ - class TrustedScriptURL extends TrustedType { - } - lockdownTrustedType(TrustedScriptURL, 'TrustedScriptURL'); - - /** - * Trusted HTML object wrapping a string that can only be created from a - * TT policy. - */ - class TrustedHTML extends TrustedType { - } - lockdownTrustedType(TrustedHTML, 'TrustedHTML'); - - /** - * Trusted Script object wrapping a string that can only be created from a - * TT policy. - */ - class TrustedScript extends TrustedType { - } - lockdownTrustedType(TrustedScript, 'TrustedScript'); - - lockdownTrustedType(TrustedType, 'TrustedType'); - - // Common constants. - const emptyHTML = freeze(create(new TrustedHTML(creatorSymbol, ''))); - privates(emptyHTML)['v'] = ''; - - /** - * A map of attribute / property names to allowed types - * for known namespaces. - * @type {!Object} - * @export - */ - const TYPE_MAP = { - [HTML_NS]: { - // TODO(koto): Figure out what to to with - 'A': { - 'attributes': { - 'href': TrustedURL.name, - }, - }, - 'AREA': { - 'attributes': { - 'href': TrustedURL.name, - }, - }, - 'BASE': { - 'attributes': { - 'href': TrustedURL.name, - }, - }, - 'BUTTON': { - 'attributes': { - 'formaction': TrustedURL.name, - }, - }, - 'EMBED': { - 'attributes': { - 'src': TrustedScriptURL.name, - }, - }, - 'FORM': { - 'attributes': { - 'action': TrustedURL.name, - }, - }, - 'FRAME': { - 'attributes': { - 'src': TrustedURL.name, - }, - }, - 'IFRAME': { - 'attributes': { - 'src': TrustedURL.name, - 'srcdoc': TrustedHTML.name, - }, - }, - 'INPUT': { - 'attributes': { - 'formaction': TrustedURL.name, - }, - }, - 'OBJECT': { - 'attributes': { - 'data': TrustedScriptURL.name, - 'codebase': TrustedScriptURL.name, - }, - }, - // TODO(koto): Figure out what to do with portals. - 'SCRIPT': { - 'attributes': { - 'src': TrustedScriptURL.name, - 'text': TrustedScript.name, - }, - 'properties': { - 'innerText': TrustedScript.name, - 'textContent': TrustedScript.name, - 'text': TrustedScript.name, - }, - }, - '*': { - 'attributes': {}, - 'properties': { - 'innerHTML': TrustedHTML.name, - 'outerHTML': TrustedHTML.name, - }, - }, - }, - [XLINK_NS]: { - '*': { - 'attributes': { - 'href': TrustedURL.name, - }, - 'properties': {}, - }, - }, - [SVG_NS]: { - '*': { - 'attributes': { - 'href': TrustedURL.name, - }, - 'properties': {}, - }, - }, - }; - - /** - * A map of element property to HTML attribute names. - * @type {!Object} - */ - const ATTR_PROPERTY_MAP = { - 'codebase': 'codeBase', - 'formaction': 'formAction', - }; - - // Edge doesn't support srcdoc. - if (!('srcdoc' in HTMLIFrameElement.prototype)) { - delete TYPE_MAP[HTML_NS]['IFRAME']['attributes']['srcdoc']; - } - - // in HTML, clone attributes into properties. - for (const tag of Object.keys(TYPE_MAP[HTML_NS])) { - if (!TYPE_MAP[HTML_NS][tag]['properties']) { - TYPE_MAP[HTML_NS][tag]['properties'] = {}; - } - for (const attr of Object.keys(TYPE_MAP[HTML_NS][tag]['attributes'])) { - TYPE_MAP[HTML_NS][tag]['properties'][ - ATTR_PROPERTY_MAP[attr] ? ATTR_PROPERTY_MAP[attr] : attr - ] = TYPE_MAP[HTML_NS][tag]['attributes'][attr]; - } - } - - // Add inline event handlers attribute names. - for (const name of getOwnPropertyNames(HTMLElement.prototype)) { - if (name.slice(0, 2) === 'on') { - TYPE_MAP[HTML_NS]['*']['attributes'][name] = 'TrustedScript'; - } - } - - /** - * @type {!Object} - */ - const createTypeMapping = { - 'createHTML': TrustedHTML, - 'createScriptURL': TrustedScriptURL, - 'createURL': TrustedURL, - 'createScript': TrustedScript, - }; - - const createFunctionAllowed = createTypeMapping.hasOwnProperty; - - /** - * Function generating a type checker. - * @template T - * @param {T} type The type to check against. - * @return {function(*):boolean} - */ - function isTrustedTypeChecker(type) { - return (obj) => (obj instanceof type) && privateMap.has(obj); - } - - /** - * Wraps a user-defined policy rules with TT constructor - * @param {string} policyName The policy name - * @param {TrustedTypesInnerPolicy} innerPolicy InnerPolicy - * @return {!TrustedTypePolicy} Frozen policy object - */ - function wrapPolicy(policyName, innerPolicy) { - /** - * @template T - * @param {function(new:T, symbol, string)} Ctor a trusted type constructor - * @param {string} methodName the policy factory method name - * @return {function(string):!T} a factory that produces instances of Ctor. - */ - function creator(Ctor, methodName) { - // This causes thisValue to be null when called below. - const method = innerPolicy[methodName] || rejectInputFn; - const policySpecificType = freeze(new Ctor(creatorSymbol, policyName)); - const factory = { - [methodName](s, ...args) { - // Trick to get methodName to show in stacktrace. - let result = method('' + s, ...args); - if (result === undefined || result === null) { - result = ''; - } - const allowedValue = '' + result; - const o = freeze(create(policySpecificType)); - privates(o)['v'] = allowedValue; - return o; - }, - }[methodName]; - return freeze(factory); - } - - const policy = create(TrustedTypePolicy.prototype); - - for (const name of getOwnPropertyNames(createTypeMapping)) { - policy[name] = creator(createTypeMapping[name], name); - } - defineProperty(policy, 'name', { - value: policyName, - writable: false, - configurable: false, - enumerable: true, - }); - - return /** @type {!TrustedTypePolicy} */ (freeze(policy)); - } - - /** - * Returns the name of the trusted type required for a given element - * attribute. - * @param {string} tagName The name of the tag of the element. - * @param {string} attribute The name of the attribute. - * @param {string=} elementNs Element namespace. - * @param {string=} attributeNs The attribute namespace. - * @return {string|undefined} Required type name or undefined, if a Trusted - * Type is not required. - */ - function getAttributeType(tagName, attribute, elementNs = '', - attributeNs = '') { - const canonicalAttr = toLowerCase.apply(String(attribute)); - return getTypeInternal_(tagName, 'attributes', canonicalAttr, - elementNs, attributeNs); - } - - /** - * Returns a type name from a type map. - * @param {string} tag A tag name. - * @param {string} container 'attributes' or 'properties' - * @param {string} name The attribute / property name. - * @param {string=} elNs Element namespace. - * @param {string=} attrNs Attribute namespace. - * @return {string|undefined} - * @private - */ - function getTypeInternal_(tag, container, name, elNs = '', attrNs = '') { - const canonicalTag = toUpperCase.apply(String(tag)); - - let ns = attrNs ? attrNs : elNs; - if (!ns) { - ns = HTML_NS; - } - const map = hasOwnProperty.apply(TYPE_MAP, [ns]) ? TYPE_MAP[ns] : null; - if (!map) { - return; - } - if (hasOwnProperty.apply(map, [canonicalTag]) && - map[canonicalTag] && - hasOwnProperty.apply(map[canonicalTag][container], [name]) && - map[canonicalTag][container][name]) { - return map[canonicalTag][container][name]; - } - - if (hasOwnProperty.apply(map, ['*']) && - hasOwnProperty.apply(map['*'][container], [name]) && - map['*'][container][name]) { - return map['*'][container][name]; - } - } - - /** - * Returns the name of the trusted type required for a given element property. - * @param {string} tagName The name of the tag of the element. - * @param {string} property The property. - * @param {string=} elementNs Element namespace. - * @return {string|undefined} Required type name or undefined, if a Trusted - * Type is not required. - */ - function getPropertyType(tagName, property, elementNs = '') { - // TODO: Support namespaces. - return getTypeInternal_(tagName, 'properties', String(property), elementNs); - } - - /** - * Returns the type map-like object, that resolves a name of a type for a - * given tag + attribute / property in a given namespace. - * The keys of the map are uppercase tag names. Map entry has mappings between - * a lowercase attribute name / case-sensitive property name and a name of the - * type that is required for that attribute / property. - * Example entry for 'IMG': {"attributes": {"src": "TrustedHTML"}} - * @param {string=} namespaceUri The namespace URI (will use the current - * document namespace URI if omitted). - * @return {TrustedTypesTypeMap} - */ - function getTypeMapping(namespaceUri = '') { - if (!namespaceUri) { - try { - namespaceUri = document.documentElement.namespaceURI; - } catch (e) { - namespaceUri = HTML_NS; - } - } - /** - * @template T - * @private - * @param {T} o - * @return {T} - */ - function deepClone(o) { - return JSON.parse(JSON.stringify(o)); - } - const map = TYPE_MAP[namespaceUri]; - if (!map) { - return {}; - } - return deepClone(map); - } - - /** - * Returns all configured policy names (even for non-exposed policies). - * @return {!Array} - */ - function getPolicyNames() { - // TODO(msamuel): Should we sort policyNames to avoid leaking or - // encouraging dependency on the order in which policy names are - // registered? I think JavaScript builtin sorts are efficient for - // almost-sorted lists so the amortized cost is close to O(n). - return policyNames.slice(); - } - - /** - * Creates a TT policy. - * - * Returns a frozen object representing a policy - a collection of functions - * that may create TT objects based on the user-provided rules specified - * in the policy object. - * - * @param {string} name A unique name of the policy. - * @param {TrustedTypesInnerPolicy} policy Policy rules object. - * @return {TrustedTypePolicy} The policy that may create TT objects - * according to the policy rules. - */ - function createPolicy(name, policy) { - const pName = '' + name; // Assert it's a string - - if (enforceNameWhitelist && allowedNames.indexOf(pName) === -1) { - throw new TypeError('Policy ' + pName + ' disallowed.'); - } - - if (policyNames.indexOf(pName) !== -1) { - throw new TypeError('Policy ' + pName + ' exists.'); - } - // Register the name early so that if policy getters unwisely calls - // across protection domains to code that reenters this function, - // policy author still has rights to the name. - policyNames.push(pName); - - // Only copy own properties of names present in createTypeMapping. - const innerPolicy = create(null); - if (policy && typeof policy === 'object') { - // Treat non-objects as empty policies. - for (const key of getOwnPropertyNames(policy)) { - if (createFunctionAllowed.call(createTypeMapping, key)) { - innerPolicy[key] = policy[key]; - } - } - } else { - // eslint-disable-next-line no-console - console.warn('trustedTypes.createPolicy ' + pName + - ' was given an empty policy'); - } - freeze(innerPolicy); - - const wrappedPolicy = wrapPolicy(pName, innerPolicy); - - if (pName === DEFAULT_POLICY_NAME) { - defaultPolicy = wrappedPolicy; - } - - return wrappedPolicy; - } - - /** - * Applies the policy name whitelist. - * @param {!Array} allowedPolicyNames - */ - function setAllowedPolicyNames(allowedPolicyNames) { - if (allowedPolicyNames.indexOf('*') !== -1) { // Any policy name is allowed. - enforceNameWhitelist = false; - } else { - enforceNameWhitelist = true; - allowedNames.length = 0; - forEach.call(allowedPolicyNames, (el) => { - push.call(allowedNames, '' + el); - }); - } - } - - /** - * Returns the default policy, or null if it was not created. - * @return {TrustedTypePolicy} - */ - function getDefaultPolicy() { - return defaultPolicy; - } - - /** - * Resets the default policy. - */ - function resetDefaultPolicy() { - defaultPolicy = null; - policyNames.splice(policyNames.indexOf(DEFAULT_POLICY_NAME), 1); - } - - const api = create(TrustedTypePolicyFactory.prototype); - assign(api, { - // The main function to create policies. - createPolicy, - - getPolicyNames, - - // Type checkers, also validating the object was initialized through a - // policy. - isHTML: isTrustedTypeChecker(TrustedHTML), - isURL: isTrustedTypeChecker(TrustedURL), - isScriptURL: isTrustedTypeChecker(TrustedScriptURL), - isScript: isTrustedTypeChecker(TrustedScript), - - getAttributeType, - getPropertyType, - getTypeMapping, - emptyHTML, - defaultPolicy, // Just to make the compiler happy, this is overridden below. - - TrustedHTML: TrustedHTML, - TrustedURL: TrustedURL, - TrustedScriptURL: TrustedScriptURL, - TrustedScript: TrustedScript, - }); - - defineProperty(api, 'defaultPolicy', { - get: getDefaultPolicy, - set: () => {}, - }); - - return { - trustedTypes: freeze(api), - setAllowedPolicyNames, - getDefaultPolicy, - resetDefaultPolicy, - }; -}; - - -const { - trustedTypes, - setAllowedPolicyNames, - getDefaultPolicy, - resetDefaultPolicy, -} = trustedTypesBuilderTestOnly(); - -/** - * @license - * Copyright 2017 Google Inc. All Rights Reserved. - * - * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE. - * - * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document - */ - -const tt = trustedTypes; - -/** - * Sets up the public Trusted Types API in the global object. - */ -function setupPolyfill() { - // We use array accessors to make sure Closure compiler will not alter the - // names of the properties.. - if (typeof window === 'undefined') { - return; - } - const rootProperty = 'trustedTypes'; - - // Convert old window.TrustedTypes to window.trustedTypes. - if (window['TrustedTypes'] && typeof window[rootProperty] === 'undefined') { - window[rootProperty] = Object.freeze(window['TrustedTypes']); - } - - if (typeof window[rootProperty] !== 'undefined') { - return; - } - - const publicApi = Object.create(TrustedTypePolicyFactory.prototype); - Object.assign(publicApi, { - 'isHTML': tt.isHTML, - 'isURL': tt.isURL, - 'isScriptURL': tt.isScriptURL, - 'isScript': tt.isScript, - 'createPolicy': tt.createPolicy, - 'getPolicyNames': tt.getPolicyNames, - 'getAttributeType': tt.getAttributeType, - 'getPropertyType': tt.getPropertyType, - 'getTypeMapping': tt.getTypeMapping, - 'emptyHTML': tt.emptyHTML, - '_isPolyfill_': true, - }); - Object.defineProperty( - publicApi, - 'defaultPolicy', - Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {}); - - window[rootProperty] = Object.freeze(publicApi); - - window['TrustedHTML'] = tt.TrustedHTML; - window['TrustedURL'] = tt.TrustedURL; - window['TrustedScriptURL'] = tt.TrustedScriptURL; - window['TrustedScript'] = tt.TrustedScript; - window['TrustedTypePolicy'] = TrustedTypePolicy; - window['TrustedTypePolicyFactory'] = TrustedTypePolicyFactory; -} - -setupPolyfill(); - -module.exports = tt; diff --git a/dist/es5/trustedtypes.api_only.build.js.map b/dist/es5/trustedtypes.api_only.build.js.map index 544caa50..3fb2d6ea 100644 --- a/dist/es5/trustedtypes.api_only.build.js.map +++ b/dist/es5/trustedtypes.api_only.build.js.map @@ -1 +1 @@ -{"version":3,"sources":[" [synthetic:es6/util/arrayiterator] "," [synthetic:util/defineproperty] "," [synthetic:util/global] "," [synthetic:es6/symbol] "," [synthetic:es6/util/makeiterator] "," [synthetic:es6/util/arrayfromiterator] "," [synthetic:util/objectcreate] "," [synthetic:es6/util/setprototypeof] "," [synthetic:es6/util/inherits] "," [synthetic:util/owns] "," [synthetic:util/polyfill] "," [synthetic:es6/weakmap] "," [synthetic:es6/util/assign] "," [synthetic:es6/object/assign] ","src/trustedtypes.js"," [synthetic:es6/util/arrayfromiterable] ","src/polyfill/api_only.js"],"names":["$jscomp.defineProperty","$jscomp.global","$jscomp.initSymbol","$jscomp.Symbol","$jscomp.SymbolClass","$jscomp.SYMBOL_PREFIX","$jscomp.arrayIteratorImpl","$jscomp.objectCreate","$jscomp.setPrototypeOf","$jscomp.polyfill","$jscomp.makeIterator","$jscomp.owns","$jscomp.assign","rejectInputFn","TypeError","String","prototype","toLowerCase","toUpperCase","TrustedTypePolicy","TrustedTypePolicyFactory","trustedTypes","trustedTypesBuilderTestOnly","TrustedScript","TrustedHTML","TrustedScriptURL","TrustedURL","constructor","TrustedType","s","policyName","creatorSymbol","Error","defineProperty","value","enumerable","privates","obj","v","privateMap","get","undefined","create","set","selfContained","collection","proto","getPrototypeOf","ObjectPrototype","getOwnPropertyNames","key","lockdownTrustedType","SubClass","canonName","freeze","name","isTrustedTypeChecker","type","has","wrapPolicy","innerPolicy","creator","Ctor","methodName","method","policySpecificType","factory","args","result","$jscomp.arrayFromIterator","allowedValue","o","policy","createTypeMapping","writable","configurable","getTypeInternal_","tag","container","elNs","attrNs","canonicalTag","apply","ns","HTML_NS","map","hasOwnProperty","TYPE_MAP","getDefaultPolicy","defaultPolicy","Object","assign","Array","forEach","push","Symbol","WeakMap","policyNames","allowedNames","enforceNameWhitelist","toString","valueOf","$jscomp.inherits","emptyHTML","XLINK_NS","SVG_NS","ATTR_PROPERTY_MAP","HTMLIFrameElement","keys","attr","HTMLElement","slice","createFunctionAllowed","api","createPolicy","indexOf","call","console","warn","wrappedPolicy","DEFAULT_POLICY_NAME","getPolicyNames","isHTML","isURL","isScriptURL","isScript","getAttributeType","tagName","attribute","elementNs","attributeNs","canonicalAttr","getPropertyType","property","getTypeMapping","namespaceUri","document","documentElement","namespaceURI","e","JSON","parse","stringify","setAllowedPolicyNames","allowedPolicyNames","length","el","resetDefaultPolicy","splice","window","publicApi","tt","getOwnPropertyDescriptor"],"mappings":"A;;;;;;;;AA2B4B,QAAA,GAAQ,CAAC,CAAD,CAAQ,CAC1C,IAAI,EAAQ,CACZ,OAAO,SAAQ,EAAG,CAChB,MAAI,EAAJ,CAAY,CAAA,OAAZ,CACS,CACL,KAAM,CAAA,CADD,CAEL,MAAO,CAAA,CAAM,CAAA,EAAN,CAFF,CADT,CAMS,CAAC,KAAM,CAAA,CAAP,CAPO,CAFwB,CCS5C,IAAAA,EAC4D,UAAxD,EAAsB,MAAO,OAAA,iBAA7B,CACA,MAAA,eADA,CAEA,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA+B,CAOjC,CAAJ,EAAc,KAAA,UAAd,EAAiC,CAAjC,EAA2C,MAAA,UAA3C,GACA,CAAA,CAAO,CAAP,CADA,CACmB,CAAA,MADnB,CAPqC,CAH3C,CCQAC,EAf2B,WAAlB,EAAC,MAAO,OAAR,EAAiC,MAAjC,GAe0B,IAf1B,CAe0B,IAf1B,CAEe,WAAlB,EAAC,MAAO,OAAR,EAA2C,IAA3C,EAAiC,MAAjC,CACwB,MADxB,CAa6B,ICZd,SAAA,GAAQ,EAAG,CAE9BC,EAAA,CAAqB,QAAQ,EAAG,EAE3BD,EAAA,OAAL,GACEA,CAAA,OADF,CAC6BE,EAD7B,CAJ8B,CAeV,QAAA,GAAQ,CAAC,CAAD,CAAK,CAAL,CAAsB,CA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AAA,YAAA,CAAwBE,CAAA/H,YACxB6H,OAAA,WAAA,CAAuBE,CAAA7H,WACvB2H,OAAA,iBAAA,CAA6BE,CAAA9H,iBAC7B4H,OAAA,cAAA,CAA0BE,CAAAhI,cAC1B8H,OAAA,kBAAA,CAA8BlI,EAC9BkI,OAAA,yBAAA,CAAqCjI,CA9BrC","file":"trustedtypes.api_only.build.js","sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst rejectInputFn = (s) => {\n throw new TypeError('undefined conversion');\n};\n\nconst {toLowerCase, toUpperCase} = String.prototype;\n\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @constructor\n * @property {!function(string):TrustedHTML} createHTML\n * @property {!function(string):TrustedURL} createURL\n * @property {!function(string):TrustedScriptURL} createScriptURL\n * @property {!function(string):TrustedScript} createScript\n * @property {!string} name\n */\nexport const TrustedTypePolicy = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/**\n * @constructor\n */\nexport const TrustedTypePolicyFactory = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypesInnerPolicy}\n * @property {function(string):string} createHTML\n * @property {function(string):string} createURL\n * @property {function(string):string} createScriptURL\n * @property {function(string):string} createScript\n */\nconst TrustedTypesInnerPolicy = {};\n\n/**\n * @typedef {!Object,\n * properties: !Object}>}\n */\nconst TrustedTypesTypeMap = {};\n/* eslint-enable no-unused-vars */\n\nexport const DEFAULT_POLICY_NAME = 'default';\n\n\nexport const trustedTypesBuilderTestOnly = function() {\n // Capture common names early.\n const {\n assign, create, defineProperty, freeze, getOwnPropertyNames,\n getPrototypeOf, prototype: ObjectPrototype,\n } = Object;\n\n const {hasOwnProperty} = ObjectPrototype;\n\n const {\n forEach, push,\n } = Array.prototype;\n\n const creatorSymbol = Symbol();\n\n /**\n * Getter for the privateMap.\n * @param {Object} obj Key of the privateMap\n * @return {Object} Private storage.\n */\n const privates = function(obj) {\n let v = privateMap.get(obj);\n if (v === undefined) {\n v = create(null); // initialize the private storage.\n privateMap.set(obj, v);\n }\n return v;\n };\n\n /**\n * Called before attacker-controlled code on an internal collections,\n * copies prototype members onto the instance directly, so that later\n * changes to prototypes cannot expose collection internals.\n * @param {!T} collection\n * @return {!T} collection\n * @template T\n */\n function selfContained(collection) {\n const proto = getPrototypeOf(collection);\n if (proto == null || getPrototypeOf(proto) !== ObjectPrototype) {\n throw new Error(); // Loop below is insufficient.\n }\n for (const key of getOwnPropertyNames(proto)) {\n defineProperty(collection, key, {value: collection[key]});\n }\n return collection;\n }\n\n /**\n * Map for private properties of Trusted Types object.\n * This is so that the access to the type constructor does not give\n * the ability to create typed values.\n * @type {WeakMap}\n */\n const privateMap = selfContained(new WeakMap());\n\n /**\n * List of all configured policy names.\n * @type {Array}\n */\n const policyNames = selfContained([]);\n\n /**\n * Allowed policy namess for policy names.\n * @type {Array}\n */\n const allowedNames = selfContained([]);\n\n /**\n * A reference to a default policy, if created.\n * @type {TrustedTypePolicy}\n */\n let defaultPolicy = null;\n\n /**\n * Whether to enforce allowedNames in createPolicy().\n * @type {boolean}\n */\n let enforceNameWhitelist = false;\n\n\n /**\n * A value that is trusted to have certain security-relevant properties\n * because the sources of such values are controlled.\n */\n class TrustedType {\n /**\n * Constructor for TrustedType. Only allowed to be called from within a\n * policy.\n * @param {symbol} s creatorSymbol\n * @param {string} policyName The name of the policy this object was\n * created by.\n */\n constructor(s, policyName) {\n // TODO: Figure out if symbol is needed, if the value is in privateMap.\n if (s !== creatorSymbol) {\n throw new Error('cannot call the constructor');\n }\n defineProperty(this, 'policyName',\n {value: '' + policyName, enumerable: true});\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n toString() {\n return privates(this)['v'];\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n valueOf() {\n return privates(this)['v'];\n }\n }\n\n /**\n * @param {function(new:TrustedType, symbol, string)} SubClass\n * @param {string} canonName The class name which should be independent of\n * any renaming pass and which is relied upon by the enforcer and for\n * native type interop.\n */\n function lockdownTrustedType(SubClass, canonName) {\n freeze(SubClass.prototype);\n delete SubClass.name;\n defineProperty(SubClass, 'name', {value: canonName});\n }\n\n /**\n * Trusted URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedURL extends TrustedType {\n }\n lockdownTrustedType(TrustedURL, 'TrustedURL');\n\n /**\n * Trusted Script URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScriptURL extends TrustedType {\n }\n lockdownTrustedType(TrustedScriptURL, 'TrustedScriptURL');\n\n /**\n * Trusted HTML object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedHTML extends TrustedType {\n }\n lockdownTrustedType(TrustedHTML, 'TrustedHTML');\n\n /**\n * Trusted Script object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScript extends TrustedType {\n }\n lockdownTrustedType(TrustedScript, 'TrustedScript');\n\n lockdownTrustedType(TrustedType, 'TrustedType');\n\n // Common constants.\n const emptyHTML = freeze(create(new TrustedHTML(creatorSymbol, '')));\n privates(emptyHTML)['v'] = '';\n\n /**\n * A map of attribute / property names to allowed types\n * for known namespaces.\n * @type {!Object}\n * @export\n */\n const TYPE_MAP = {\n [HTML_NS]: {\n // TODO(koto): Figure out what to to with \n 'A': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'AREA': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BASE': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BUTTON': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'EMBED': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n },\n },\n 'FORM': {\n 'attributes': {\n 'action': TrustedURL.name,\n },\n },\n 'FRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n },\n },\n 'IFRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n 'srcdoc': TrustedHTML.name,\n },\n },\n 'INPUT': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'OBJECT': {\n 'attributes': {\n 'data': TrustedScriptURL.name,\n 'codebase': TrustedScriptURL.name,\n },\n },\n // TODO(koto): Figure out what to do with portals.\n 'SCRIPT': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n 'text': TrustedScript.name,\n },\n 'properties': {\n 'innerText': TrustedScript.name,\n 'textContent': TrustedScript.name,\n 'text': TrustedScript.name,\n },\n },\n '*': {\n 'attributes': {},\n 'properties': {\n 'innerHTML': TrustedHTML.name,\n 'outerHTML': TrustedHTML.name,\n },\n },\n },\n [XLINK_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n [SVG_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n };\n\n /**\n * A map of element property to HTML attribute names.\n * @type {!Object}\n */\n const ATTR_PROPERTY_MAP = {\n 'codebase': 'codeBase',\n 'formaction': 'formAction',\n };\n\n // Edge doesn't support srcdoc.\n if (!('srcdoc' in HTMLIFrameElement.prototype)) {\n delete TYPE_MAP[HTML_NS]['IFRAME']['attributes']['srcdoc'];\n }\n\n // in HTML, clone attributes into properties.\n for (const tag of Object.keys(TYPE_MAP[HTML_NS])) {\n if (!TYPE_MAP[HTML_NS][tag]['properties']) {\n TYPE_MAP[HTML_NS][tag]['properties'] = {};\n }\n for (const attr of Object.keys(TYPE_MAP[HTML_NS][tag]['attributes'])) {\n TYPE_MAP[HTML_NS][tag]['properties'][\n ATTR_PROPERTY_MAP[attr] ? ATTR_PROPERTY_MAP[attr] : attr\n ] = TYPE_MAP[HTML_NS][tag]['attributes'][attr];\n }\n }\n\n // Add inline event handlers attribute names.\n for (const name of getOwnPropertyNames(HTMLElement.prototype)) {\n if (name.slice(0, 2) === 'on') {\n TYPE_MAP[HTML_NS]['*']['attributes'][name] = 'TrustedScript';\n }\n }\n\n /**\n * @type {!Object}\n */\n const createTypeMapping = {\n 'createHTML': TrustedHTML,\n 'createScriptURL': TrustedScriptURL,\n 'createURL': TrustedURL,\n 'createScript': TrustedScript,\n };\n\n const createFunctionAllowed = createTypeMapping.hasOwnProperty;\n\n /**\n * Function generating a type checker.\n * @template T\n * @param {T} type The type to check against.\n * @return {function(*):boolean}\n */\n function isTrustedTypeChecker(type) {\n return (obj) => (obj instanceof type) && privateMap.has(obj);\n }\n\n /**\n * Wraps a user-defined policy rules with TT constructor\n * @param {string} policyName The policy name\n * @param {TrustedTypesInnerPolicy} innerPolicy InnerPolicy\n * @return {!TrustedTypePolicy} Frozen policy object\n */\n function wrapPolicy(policyName, innerPolicy) {\n /**\n * @template T\n * @param {function(new:T, symbol, string)} Ctor a trusted type constructor\n * @param {string} methodName the policy factory method name\n * @return {function(string):!T} a factory that produces instances of Ctor.\n */\n function creator(Ctor, methodName) {\n // This causes thisValue to be null when called below.\n const method = innerPolicy[methodName] || rejectInputFn;\n const policySpecificType = freeze(new Ctor(creatorSymbol, policyName));\n const factory = {\n [methodName](s, ...args) {\n // Trick to get methodName to show in stacktrace.\n let result = method('' + s, ...args);\n if (result === undefined || result === null) {\n result = '';\n }\n const allowedValue = '' + result;\n const o = freeze(create(policySpecificType));\n privates(o)['v'] = allowedValue;\n return o;\n },\n }[methodName];\n return freeze(factory);\n }\n\n const policy = create(TrustedTypePolicy.prototype);\n\n for (const name of getOwnPropertyNames(createTypeMapping)) {\n policy[name] = creator(createTypeMapping[name], name);\n }\n defineProperty(policy, 'name', {\n value: policyName,\n writable: false,\n configurable: false,\n enumerable: true,\n });\n\n return /** @type {!TrustedTypePolicy} */ (freeze(policy));\n }\n\n /**\n * Returns the name of the trusted type required for a given element\n * attribute.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} attribute The name of the attribute.\n * @param {string=} elementNs Element namespace.\n * @param {string=} attributeNs The attribute namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getAttributeType(tagName, attribute, elementNs = '',\n attributeNs = '') {\n const canonicalAttr = toLowerCase.apply(String(attribute));\n return getTypeInternal_(tagName, 'attributes', canonicalAttr,\n elementNs, attributeNs);\n }\n\n /**\n * Returns a type name from a type map.\n * @param {string} tag A tag name.\n * @param {string} container 'attributes' or 'properties'\n * @param {string} name The attribute / property name.\n * @param {string=} elNs Element namespace.\n * @param {string=} attrNs Attribute namespace.\n * @return {string|undefined}\n * @private\n */\n function getTypeInternal_(tag, container, name, elNs = '', attrNs = '') {\n const canonicalTag = toUpperCase.apply(String(tag));\n\n let ns = attrNs ? attrNs : elNs;\n if (!ns) {\n ns = HTML_NS;\n }\n const map = hasOwnProperty.apply(TYPE_MAP, [ns]) ? TYPE_MAP[ns] : null;\n if (!map) {\n return;\n }\n if (hasOwnProperty.apply(map, [canonicalTag]) &&\n map[canonicalTag] &&\n hasOwnProperty.apply(map[canonicalTag][container], [name]) &&\n map[canonicalTag][container][name]) {\n return map[canonicalTag][container][name];\n }\n\n if (hasOwnProperty.apply(map, ['*']) &&\n hasOwnProperty.apply(map['*'][container], [name]) &&\n map['*'][container][name]) {\n return map['*'][container][name];\n }\n }\n\n /**\n * Returns the name of the trusted type required for a given element property.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} property The property.\n * @param {string=} elementNs Element namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getPropertyType(tagName, property, elementNs = '') {\n // TODO: Support namespaces.\n return getTypeInternal_(tagName, 'properties', String(property), elementNs);\n }\n\n /**\n * Returns the type map-like object, that resolves a name of a type for a\n * given tag + attribute / property in a given namespace.\n * The keys of the map are uppercase tag names. Map entry has mappings between\n * a lowercase attribute name / case-sensitive property name and a name of the\n * type that is required for that attribute / property.\n * Example entry for 'IMG': {\"attributes\": {\"src\": \"TrustedHTML\"}}\n * @param {string=} namespaceUri The namespace URI (will use the current\n * document namespace URI if omitted).\n * @return {TrustedTypesTypeMap}\n */\n function getTypeMapping(namespaceUri = '') {\n if (!namespaceUri) {\n try {\n namespaceUri = document.documentElement.namespaceURI;\n } catch (e) {\n namespaceUri = HTML_NS;\n }\n }\n /**\n * @template T\n * @private\n * @param {T} o\n * @return {T}\n */\n function deepClone(o) {\n return JSON.parse(JSON.stringify(o));\n }\n const map = TYPE_MAP[namespaceUri];\n if (!map) {\n return {};\n }\n return deepClone(map);\n }\n\n /**\n * Returns all configured policy names (even for non-exposed policies).\n * @return {!Array}\n */\n function getPolicyNames() {\n // TODO(msamuel): Should we sort policyNames to avoid leaking or\n // encouraging dependency on the order in which policy names are\n // registered? I think JavaScript builtin sorts are efficient for\n // almost-sorted lists so the amortized cost is close to O(n).\n return policyNames.slice();\n }\n\n /**\n * Creates a TT policy.\n *\n * Returns a frozen object representing a policy - a collection of functions\n * that may create TT objects based on the user-provided rules specified\n * in the policy object.\n *\n * @param {string} name A unique name of the policy.\n * @param {TrustedTypesInnerPolicy} policy Policy rules object.\n * @return {TrustedTypePolicy} The policy that may create TT objects\n * according to the policy rules.\n */\n function createPolicy(name, policy) {\n const pName = '' + name; // Assert it's a string\n\n if (enforceNameWhitelist && allowedNames.indexOf(pName) === -1) {\n throw new TypeError('Policy ' + pName + ' disallowed.');\n }\n\n if (policyNames.indexOf(pName) !== -1) {\n throw new TypeError('Policy ' + pName + ' exists.');\n }\n // Register the name early so that if policy getters unwisely calls\n // across protection domains to code that reenters this function,\n // policy author still has rights to the name.\n policyNames.push(pName);\n\n // Only copy own properties of names present in createTypeMapping.\n const innerPolicy = create(null);\n if (policy && typeof policy === 'object') {\n // Treat non-objects as empty policies.\n for (const key of getOwnPropertyNames(policy)) {\n if (createFunctionAllowed.call(createTypeMapping, key)) {\n innerPolicy[key] = policy[key];\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn('trustedTypes.createPolicy ' + pName +\n ' was given an empty policy');\n }\n freeze(innerPolicy);\n\n const wrappedPolicy = wrapPolicy(pName, innerPolicy);\n\n if (pName === DEFAULT_POLICY_NAME) {\n defaultPolicy = wrappedPolicy;\n }\n\n return wrappedPolicy;\n }\n\n /**\n * Applies the policy name whitelist.\n * @param {!Array} allowedPolicyNames\n */\n function setAllowedPolicyNames(allowedPolicyNames) {\n if (allowedPolicyNames.indexOf('*') !== -1) { // Any policy name is allowed.\n enforceNameWhitelist = false;\n } else {\n enforceNameWhitelist = true;\n allowedNames.length = 0;\n forEach.call(allowedPolicyNames, (el) => {\n push.call(allowedNames, '' + el);\n });\n }\n }\n\n /**\n * Returns the default policy, or null if it was not created.\n * @return {TrustedTypePolicy}\n */\n function getDefaultPolicy() {\n return defaultPolicy;\n }\n\n /**\n * Resets the default policy.\n */\n function resetDefaultPolicy() {\n defaultPolicy = null;\n policyNames.splice(policyNames.indexOf(DEFAULT_POLICY_NAME), 1);\n }\n\n const api = create(TrustedTypePolicyFactory.prototype);\n assign(api, {\n // The main function to create policies.\n createPolicy,\n\n getPolicyNames,\n\n // Type checkers, also validating the object was initialized through a\n // policy.\n isHTML: isTrustedTypeChecker(TrustedHTML),\n isURL: isTrustedTypeChecker(TrustedURL),\n isScriptURL: isTrustedTypeChecker(TrustedScriptURL),\n isScript: isTrustedTypeChecker(TrustedScript),\n\n getAttributeType,\n getPropertyType,\n getTypeMapping,\n emptyHTML,\n defaultPolicy, // Just to make the compiler happy, this is overridden below.\n\n TrustedHTML: TrustedHTML,\n TrustedURL: TrustedURL,\n TrustedScriptURL: TrustedScriptURL,\n TrustedScript: TrustedScript,\n });\n\n defineProperty(api, 'defaultPolicy', {\n get: getDefaultPolicy,\n set: () => {},\n });\n\n return {\n trustedTypes: freeze(api),\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n };\n};\n\n\nexport const {\n trustedTypes,\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n} = trustedTypesBuilderTestOnly();\n\n",null,"/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that only defines the types\n * (i.e. no enforcement logic).\n */\nimport {trustedTypes, TrustedTypePolicy, TrustedTypePolicyFactory} from\n '../trustedtypes.js';\n\nconst tt = trustedTypes;\n\n/**\n * Sets up the public Trusted Types API in the global object.\n */\nfunction setupPolyfill() {\n // We use array accessors to make sure Closure compiler will not alter the\n // names of the properties..\n if (typeof window === 'undefined') {\n return;\n }\n const rootProperty = 'trustedTypes';\n\n // Convert old window.TrustedTypes to window.trustedTypes.\n if (window['TrustedTypes'] && typeof window[rootProperty] === 'undefined') {\n window[rootProperty] = Object.freeze(window['TrustedTypes']);\n }\n\n if (typeof window[rootProperty] !== 'undefined') {\n return;\n }\n\n const publicApi = Object.create(TrustedTypePolicyFactory.prototype);\n Object.assign(publicApi, {\n 'isHTML': tt.isHTML,\n 'isURL': tt.isURL,\n 'isScriptURL': tt.isScriptURL,\n 'isScript': tt.isScript,\n 'createPolicy': tt.createPolicy,\n 'getPolicyNames': tt.getPolicyNames,\n 'getAttributeType': tt.getAttributeType,\n 'getPropertyType': tt.getPropertyType,\n 'getTypeMapping': tt.getTypeMapping,\n 'emptyHTML': tt.emptyHTML,\n '_isPolyfill_': true,\n });\n Object.defineProperty(\n publicApi,\n 'defaultPolicy',\n Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {});\n\n window[rootProperty] = Object.freeze(publicApi);\n\n window['TrustedHTML'] = tt.TrustedHTML;\n window['TrustedURL'] = tt.TrustedURL;\n window['TrustedScriptURL'] = tt.TrustedScriptURL;\n window['TrustedScript'] = tt.TrustedScript;\n window['TrustedTypePolicy'] = TrustedTypePolicy;\n window['TrustedTypePolicyFactory'] = TrustedTypePolicyFactory;\n}\n\nsetupPolyfill();\n\nexport default tt;\n"]} \ No newline at end of file +{"version":3,"sources":[" [synthetic:es6/util/arrayiterator] "," [synthetic:util/defineproperty] "," [synthetic:util/global] "," [synthetic:es6/symbol] "," [synthetic:es6/util/makeiterator] "," [synthetic:es6/util/arrayfromiterator] "," [synthetic:util/objectcreate] "," [synthetic:es6/util/setprototypeof] "," [synthetic:es6/util/inherits] "," [synthetic:util/owns] "," [synthetic:util/polyfill] "," [synthetic:es6/weakmap] "," [synthetic:es6/util/assign] "," [synthetic:es6/object/assign] ","src/trustedtypes.js"," [synthetic:es6/util/arrayfromiterable] ","src/polyfill/api_only.js"],"names":["$jscomp.defineProperty","$jscomp.global","$jscomp.initSymbol","$jscomp.Symbol","$jscomp.SymbolClass","$jscomp.SYMBOL_PREFIX","$jscomp.arrayIteratorImpl","$jscomp.objectCreate","$jscomp.setPrototypeOf","$jscomp.polyfill","$jscomp.makeIterator","$jscomp.owns","$jscomp.assign","rejectInputFn","TypeError","String","prototype","toLowerCase","toUpperCase","TrustedTypePolicy","TrustedTypePolicyFactory","trustedTypes","trustedTypesBuilderTestOnly","TrustedScript","TrustedHTML","TrustedScriptURL","TrustedURL","constructor","TrustedType","s","policyName","creatorSymbol","Error","defineProperty","value","enumerable","privates","obj","v","privateMap","get","undefined","create","set","selfContained","collection","proto","getPrototypeOf","ObjectPrototype","getOwnPropertyNames","key","lockdownTrustedType","SubClass","canonName","freeze","name","isTrustedTypeChecker","type","has","wrapPolicy","innerPolicy","creator","Ctor","methodName","method","policySpecificType","factory","args","result","$jscomp.arrayFromIterator","allowedValue","o","policy","createTypeMapping","writable","configurable","getTypeInternal_","tag","container","elNs","attrNs","canonicalTag","apply","ns","HTML_NS","map","hasOwnProperty","TYPE_MAP","getDefaultPolicy","defaultPolicy","Object","assign","Array","forEach","push","Symbol","WeakMap","policyNames","allowedNames","enforceNameWhitelist","toString","valueOf","$jscomp.inherits","emptyHTML","XLINK_NS","SVG_NS","ATTR_PROPERTY_MAP","HTMLIFrameElement","keys","attr","HTMLElement","slice","createFunctionAllowed","api","createPolicy","indexOf","call","console","warn","wrappedPolicy","DEFAULT_POLICY_NAME","getPolicyNames","isHTML","isURL","isScriptURL","isScript","getAttributeType","tagName","attribute","elementNs","attributeNs","canonicalAttr","getPropertyType","property","getTypeMapping","namespaceUri","document","documentElement","namespaceURI","e","JSON","parse","stringify","setAllowedPolicyNames","allowedPolicyNames","length","el","resetDefaultPolicy","splice","window","publicApi","tt","getOwnPropertyDescriptor"],"mappings":"A;;;;;;;;AA2B4B,QAAA,GAAQ,CAAC,CAAD,CAAQ,CAC1C,IAAI,EAAQ,CACZ,OAAO,SAAQ,EAAG,CAChB,MAAI,EAAJ,CAAY,CAAA,OAAZ,CACS,CACL,KAAM,CAAA,CADD,CAEL,MAAO,CAAA,CAAM,CAAA,EAAN,CAFF,CADT,CAMS,CAAC,KAAM,CAAA,CAAP,CAPO,CAFwB,CCS5C,IAAAA,EAC4D,UAAxD,EAAsB,MAAO,OAAA,iBAA7B,CACA,MAAA,eADA,CAEA,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA+B,CAOjC,CAAJ,EAAc,KAAA,UAAd,EAAiC,CAAjC,EAA2C,MAAA,UAA3C,GACA,CAAA,CAAO,CAAP,CADA,CACmB,CAAA,MADnB,CAPqC,CAH3C,CCQAC,EAf2B,WAAlB,EAAC,MAAO,OAAR,EAAiC,MAAjC,GAe0B,IAf1B,CAe0B,IAf1B,CAEe,WAAlB,EAAC,MAAO,OAAR,EAA2C,IAA3C,EAAiC,MAAjC,CACwB,MADxB,CAa6B,ICZd,SAAA,GAAQ,EAAG,CAE9BC,EAAA,CAAqB,QAAQ,EAAG,EAE3BD,EAAA,OAAL,GACEA,CAAA,OADF,CAC6BE,EAD7B,CAJ8B,CAeV,QAAA,GAAQ,CAAC,CAAD,CAAK,CAAL,CAAsB,CAElD,IAAA,E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,CAAwBE,CAAA/H,YACxB6H,OAAA,WAAA,CAAuBE,CAAA7H,WACvB2H,OAAA,iBAAA,CAA6BE,CAAA9H,iBAC7B4H,OAAA,cAAA,CAA0BE,CAAAhI,cAC1B8H,OAAA,kBAAA,CAA8BlI,EAC9BkI,OAAA,yBAAA,CAAqCjI,CA9BrC","file":"trustedtypes.api_only.build.js","sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst rejectInputFn = (s) => {\n throw new TypeError('undefined conversion');\n};\n\nconst {toLowerCase, toUpperCase} = String.prototype;\n\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @constructor\n * @property {!function(string):TrustedHTML} createHTML\n * @property {!function(string):TrustedURL} createURL\n * @property {!function(string):TrustedScriptURL} createScriptURL\n * @property {!function(string):TrustedScript} createScript\n * @property {!string} name\n */\nexport const TrustedTypePolicy = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/**\n * @constructor\n */\nexport const TrustedTypePolicyFactory = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypesInnerPolicy}\n * @property {function(string):string} createHTML\n * @property {function(string):string} createURL\n * @property {function(string):string} createScriptURL\n * @property {function(string):string} createScript\n */\nconst TrustedTypesInnerPolicy = {};\n\n/**\n * @typedef {!Object,\n * properties: !Object}>}\n */\nconst TrustedTypesTypeMap = {};\n/* eslint-enable no-unused-vars */\n\nexport const DEFAULT_POLICY_NAME = 'default';\n\n\nexport const trustedTypesBuilderTestOnly = function() {\n // Capture common names early.\n const {\n assign, create, defineProperty, freeze, getOwnPropertyNames,\n getPrototypeOf, prototype: ObjectPrototype,\n } = Object;\n\n const {hasOwnProperty} = ObjectPrototype;\n\n const {\n forEach, push,\n } = Array.prototype;\n\n const creatorSymbol = Symbol();\n\n /**\n * Getter for the privateMap.\n * @param {Object} obj Key of the privateMap\n * @return {Object} Private storage.\n */\n const privates = function(obj) {\n let v = privateMap.get(obj);\n if (v === undefined) {\n v = create(null); // initialize the private storage.\n privateMap.set(obj, v);\n }\n return v;\n };\n\n /**\n * Called before attacker-controlled code on an internal collections,\n * copies prototype members onto the instance directly, so that later\n * changes to prototypes cannot expose collection internals.\n * @param {!T} collection\n * @return {!T} collection\n * @template T\n */\n function selfContained(collection) {\n const proto = getPrototypeOf(collection);\n if (proto == null || getPrototypeOf(proto) !== ObjectPrototype) {\n throw new Error(); // Loop below is insufficient.\n }\n for (const key of getOwnPropertyNames(proto)) {\n defineProperty(collection, key, {value: collection[key]});\n }\n return collection;\n }\n\n /**\n * Map for private properties of Trusted Types object.\n * This is so that the access to the type constructor does not give\n * the ability to create typed values.\n * @type {WeakMap}\n */\n const privateMap = selfContained(new WeakMap());\n\n /**\n * List of all configured policy names.\n * @type {Array}\n */\n const policyNames = selfContained([]);\n\n /**\n * Allowed policy namess for policy names.\n * @type {Array}\n */\n const allowedNames = selfContained([]);\n\n /**\n * A reference to a default policy, if created.\n * @type {TrustedTypePolicy}\n */\n let defaultPolicy = null;\n\n /**\n * Whether to enforce allowedNames in createPolicy().\n * @type {boolean}\n */\n let enforceNameWhitelist = false;\n\n\n /**\n * A value that is trusted to have certain security-relevant properties\n * because the sources of such values are controlled.\n */\n class TrustedType {\n /**\n * Constructor for TrustedType. Only allowed to be called from within a\n * policy.\n * @param {symbol} s creatorSymbol\n * @param {string} policyName The name of the policy this object was\n * created by.\n */\n constructor(s, policyName) {\n // TODO: Figure out if symbol is needed, if the value is in privateMap.\n if (s !== creatorSymbol) {\n throw new Error('cannot call the constructor');\n }\n defineProperty(this, 'policyName',\n {value: '' + policyName, enumerable: true});\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n toString() {\n return privates(this)['v'];\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n valueOf() {\n return privates(this)['v'];\n }\n }\n\n /**\n * @param {function(new:TrustedType, symbol, string)} SubClass\n * @param {string} canonName The class name which should be independent of\n * any renaming pass and which is relied upon by the enforcer and for\n * native type interop.\n */\n function lockdownTrustedType(SubClass, canonName) {\n freeze(SubClass.prototype);\n delete SubClass.name;\n defineProperty(SubClass, 'name', {value: canonName});\n }\n\n /**\n * Trusted URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedURL extends TrustedType {\n }\n lockdownTrustedType(TrustedURL, 'TrustedURL');\n\n /**\n * Trusted Script URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScriptURL extends TrustedType {\n }\n lockdownTrustedType(TrustedScriptURL, 'TrustedScriptURL');\n\n /**\n * Trusted HTML object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedHTML extends TrustedType {\n }\n lockdownTrustedType(TrustedHTML, 'TrustedHTML');\n\n /**\n * Trusted Script object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScript extends TrustedType {\n }\n lockdownTrustedType(TrustedScript, 'TrustedScript');\n\n lockdownTrustedType(TrustedType, 'TrustedType');\n\n // Common constants.\n const emptyHTML = freeze(create(new TrustedHTML(creatorSymbol, '')));\n privates(emptyHTML)['v'] = '';\n\n /**\n * A map of attribute / property names to allowed types\n * for known namespaces.\n * @type {!Object}\n * @export\n */\n const TYPE_MAP = {\n [HTML_NS]: {\n // TODO(koto): Figure out what to to with \n 'A': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'AREA': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BASE': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BUTTON': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'EMBED': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n },\n },\n 'FORM': {\n 'attributes': {\n 'action': TrustedURL.name,\n },\n },\n 'FRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n },\n },\n 'IFRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n 'srcdoc': TrustedHTML.name,\n },\n },\n 'INPUT': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'OBJECT': {\n 'attributes': {\n 'data': TrustedScriptURL.name,\n 'codebase': TrustedScriptURL.name,\n },\n },\n // TODO(koto): Figure out what to do with portals.\n 'SCRIPT': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n 'text': TrustedScript.name,\n },\n 'properties': {\n 'innerText': TrustedScript.name,\n 'textContent': TrustedScript.name,\n 'text': TrustedScript.name,\n },\n },\n '*': {\n 'attributes': {},\n 'properties': {\n 'innerHTML': TrustedHTML.name,\n 'outerHTML': TrustedHTML.name,\n },\n },\n },\n [XLINK_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n [SVG_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n };\n\n /**\n * A map of element property to HTML attribute names.\n * @type {!Object}\n */\n const ATTR_PROPERTY_MAP = {\n 'codebase': 'codeBase',\n 'formaction': 'formAction',\n };\n\n // Edge doesn't support srcdoc.\n if (!('srcdoc' in HTMLIFrameElement.prototype)) {\n delete TYPE_MAP[HTML_NS]['IFRAME']['attributes']['srcdoc'];\n }\n\n // in HTML, clone attributes into properties.\n for (const tag of Object.keys(TYPE_MAP[HTML_NS])) {\n if (!TYPE_MAP[HTML_NS][tag]['properties']) {\n TYPE_MAP[HTML_NS][tag]['properties'] = {};\n }\n for (const attr of Object.keys(TYPE_MAP[HTML_NS][tag]['attributes'])) {\n TYPE_MAP[HTML_NS][tag]['properties'][\n ATTR_PROPERTY_MAP[attr] ? ATTR_PROPERTY_MAP[attr] : attr\n ] = TYPE_MAP[HTML_NS][tag]['attributes'][attr];\n }\n }\n\n // Add inline event handlers attribute names.\n for (const name of getOwnPropertyNames(HTMLElement.prototype)) {\n if (name.slice(0, 2) === 'on') {\n TYPE_MAP[HTML_NS]['*']['attributes'][name] = 'TrustedScript';\n }\n }\n\n /**\n * @type {!Object}\n */\n const createTypeMapping = {\n 'createHTML': TrustedHTML,\n 'createScriptURL': TrustedScriptURL,\n 'createURL': TrustedURL,\n 'createScript': TrustedScript,\n };\n\n const createFunctionAllowed = createTypeMapping.hasOwnProperty;\n\n /**\n * Function generating a type checker.\n * @template T\n * @param {T} type The type to check against.\n * @return {function(*):boolean}\n */\n function isTrustedTypeChecker(type) {\n return (obj) => (obj instanceof type) && privateMap.has(obj);\n }\n\n /**\n * Wraps a user-defined policy rules with TT constructor\n * @param {string} policyName The policy name\n * @param {TrustedTypesInnerPolicy} innerPolicy InnerPolicy\n * @return {!TrustedTypePolicy} Frozen policy object\n */\n function wrapPolicy(policyName, innerPolicy) {\n /**\n * @template T\n * @param {function(new:T, symbol, string)} Ctor a trusted type constructor\n * @param {string} methodName the policy factory method name\n * @return {function(string):!T} a factory that produces instances of Ctor.\n */\n function creator(Ctor, methodName) {\n // This causes thisValue to be null when called below.\n const method = innerPolicy[methodName] || rejectInputFn;\n const policySpecificType = freeze(new Ctor(creatorSymbol, policyName));\n const factory = {\n [methodName](s, ...args) {\n // Trick to get methodName to show in stacktrace.\n let result = method('' + s, ...args);\n if (result === undefined || result === null) {\n result = '';\n }\n const allowedValue = '' + result;\n const o = freeze(create(policySpecificType));\n privates(o)['v'] = allowedValue;\n return o;\n },\n }[methodName];\n return freeze(factory);\n }\n\n const policy = create(TrustedTypePolicy.prototype);\n\n for (const name of getOwnPropertyNames(createTypeMapping)) {\n policy[name] = creator(createTypeMapping[name], name);\n }\n defineProperty(policy, 'name', {\n value: policyName,\n writable: false,\n configurable: false,\n enumerable: true,\n });\n\n return /** @type {!TrustedTypePolicy} */ (freeze(policy));\n }\n\n /**\n * Returns the name of the trusted type required for a given element\n * attribute.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} attribute The name of the attribute.\n * @param {string=} elementNs Element namespace.\n * @param {string=} attributeNs The attribute namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getAttributeType(tagName, attribute, elementNs = '',\n attributeNs = '') {\n const canonicalAttr = toLowerCase.apply(String(attribute));\n return getTypeInternal_(tagName, 'attributes', canonicalAttr,\n elementNs, attributeNs);\n }\n\n /**\n * Returns a type name from a type map.\n * @param {string} tag A tag name.\n * @param {string} container 'attributes' or 'properties'\n * @param {string} name The attribute / property name.\n * @param {string=} elNs Element namespace.\n * @param {string=} attrNs Attribute namespace.\n * @return {string|undefined}\n * @private\n */\n function getTypeInternal_(tag, container, name, elNs = '', attrNs = '') {\n const canonicalTag = toUpperCase.apply(String(tag));\n\n let ns = attrNs ? attrNs : elNs;\n if (!ns) {\n ns = HTML_NS;\n }\n const map = hasOwnProperty.apply(TYPE_MAP, [ns]) ? TYPE_MAP[ns] : null;\n if (!map) {\n return;\n }\n if (hasOwnProperty.apply(map, [canonicalTag]) &&\n map[canonicalTag] &&\n hasOwnProperty.apply(map[canonicalTag][container], [name]) &&\n map[canonicalTag][container][name]) {\n return map[canonicalTag][container][name];\n }\n\n if (hasOwnProperty.apply(map, ['*']) &&\n hasOwnProperty.apply(map['*'][container], [name]) &&\n map['*'][container][name]) {\n return map['*'][container][name];\n }\n }\n\n /**\n * Returns the name of the trusted type required for a given element property.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} property The property.\n * @param {string=} elementNs Element namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getPropertyType(tagName, property, elementNs = '') {\n // TODO: Support namespaces.\n return getTypeInternal_(tagName, 'properties', String(property), elementNs);\n }\n\n /**\n * Returns the type map-like object, that resolves a name of a type for a\n * given tag + attribute / property in a given namespace.\n * The keys of the map are uppercase tag names. Map entry has mappings between\n * a lowercase attribute name / case-sensitive property name and a name of the\n * type that is required for that attribute / property.\n * Example entry for 'IMG': {\"attributes\": {\"src\": \"TrustedHTML\"}}\n * @param {string=} namespaceUri The namespace URI (will use the current\n * document namespace URI if omitted).\n * @return {TrustedTypesTypeMap}\n */\n function getTypeMapping(namespaceUri = '') {\n if (!namespaceUri) {\n try {\n namespaceUri = document.documentElement.namespaceURI;\n } catch (e) {\n namespaceUri = HTML_NS;\n }\n }\n /**\n * @template T\n * @private\n * @param {T} o\n * @return {T}\n */\n function deepClone(o) {\n return JSON.parse(JSON.stringify(o));\n }\n const map = TYPE_MAP[namespaceUri];\n if (!map) {\n return {};\n }\n return deepClone(map);\n }\n\n /**\n * Returns all configured policy names (even for non-exposed policies).\n * @return {!Array}\n */\n function getPolicyNames() {\n // TODO(msamuel): Should we sort policyNames to avoid leaking or\n // encouraging dependency on the order in which policy names are\n // registered? I think JavaScript builtin sorts are efficient for\n // almost-sorted lists so the amortized cost is close to O(n).\n return policyNames.slice();\n }\n\n /**\n * Creates a TT policy.\n *\n * Returns a frozen object representing a policy - a collection of functions\n * that may create TT objects based on the user-provided rules specified\n * in the policy object.\n *\n * @param {string} name A unique name of the policy.\n * @param {TrustedTypesInnerPolicy} policy Policy rules object.\n * @return {TrustedTypePolicy} The policy that may create TT objects\n * according to the policy rules.\n */\n function createPolicy(name, policy) {\n const pName = '' + name; // Assert it's a string\n\n if (enforceNameWhitelist && allowedNames.indexOf(pName) === -1) {\n throw new TypeError('Policy ' + pName + ' disallowed.');\n }\n\n if (policyNames.indexOf(pName) !== -1) {\n throw new TypeError('Policy ' + pName + ' exists.');\n }\n // Register the name early so that if policy getters unwisely calls\n // across protection domains to code that reenters this function,\n // policy author still has rights to the name.\n policyNames.push(pName);\n\n // Only copy own properties of names present in createTypeMapping.\n const innerPolicy = create(null);\n if (policy && typeof policy === 'object') {\n // Treat non-objects as empty policies.\n for (const key of getOwnPropertyNames(policy)) {\n if (createFunctionAllowed.call(createTypeMapping, key)) {\n innerPolicy[key] = policy[key];\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn('trustedTypes.createPolicy ' + pName +\n ' was given an empty policy');\n }\n freeze(innerPolicy);\n\n const wrappedPolicy = wrapPolicy(pName, innerPolicy);\n\n if (pName === DEFAULT_POLICY_NAME) {\n defaultPolicy = wrappedPolicy;\n }\n\n return wrappedPolicy;\n }\n\n /**\n * Applies the policy name whitelist.\n * @param {!Array} allowedPolicyNames\n */\n function setAllowedPolicyNames(allowedPolicyNames) {\n if (allowedPolicyNames.indexOf('*') !== -1) { // Any policy name is allowed.\n enforceNameWhitelist = false;\n } else {\n enforceNameWhitelist = true;\n allowedNames.length = 0;\n forEach.call(allowedPolicyNames, (el) => {\n push.call(allowedNames, '' + el);\n });\n }\n }\n\n /**\n * Returns the default policy, or null if it was not created.\n * @return {TrustedTypePolicy}\n */\n function getDefaultPolicy() {\n return defaultPolicy;\n }\n\n /**\n * Resets the default policy.\n */\n function resetDefaultPolicy() {\n defaultPolicy = null;\n policyNames.splice(policyNames.indexOf(DEFAULT_POLICY_NAME), 1);\n }\n\n const api = create(TrustedTypePolicyFactory.prototype);\n assign(api, {\n // The main function to create policies.\n createPolicy,\n\n getPolicyNames,\n\n // Type checkers, also validating the object was initialized through a\n // policy.\n isHTML: isTrustedTypeChecker(TrustedHTML),\n isURL: isTrustedTypeChecker(TrustedURL),\n isScriptURL: isTrustedTypeChecker(TrustedScriptURL),\n isScript: isTrustedTypeChecker(TrustedScript),\n\n getAttributeType,\n getPropertyType,\n getTypeMapping,\n emptyHTML,\n defaultPolicy, // Just to make the compiler happy, this is overridden below.\n\n TrustedHTML: TrustedHTML,\n TrustedURL: TrustedURL,\n TrustedScriptURL: TrustedScriptURL,\n TrustedScript: TrustedScript,\n });\n\n defineProperty(api, 'defaultPolicy', {\n get: getDefaultPolicy,\n set: () => {},\n });\n\n return {\n trustedTypes: freeze(api),\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n };\n};\n\n\nexport const {\n trustedTypes,\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n} = trustedTypesBuilderTestOnly();\n\n",null,"/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that only defines the types\n * (i.e. no enforcement logic).\n */\nimport {trustedTypes, TrustedTypePolicy, TrustedTypePolicyFactory} from\n '../trustedtypes.js';\n\nconst tt = trustedTypes;\n\n/**\n * Sets up the public Trusted Types API in the global object.\n */\nfunction setupPolyfill() {\n // We use array accessors to make sure Closure compiler will not alter the\n // names of the properties..\n\n // we only setup the polyfill only in browser environment.\n if (typeof window === 'undefined') {\n return;\n }\n const rootProperty = 'trustedTypes';\n\n // Convert old window.TrustedTypes to window.trustedTypes.\n if (window['TrustedTypes'] && typeof window[rootProperty] === 'undefined') {\n window[rootProperty] = Object.freeze(window['TrustedTypes']);\n }\n\n if (typeof window[rootProperty] !== 'undefined') {\n return;\n }\n\n const publicApi = Object.create(TrustedTypePolicyFactory.prototype);\n Object.assign(publicApi, {\n 'isHTML': tt.isHTML,\n 'isURL': tt.isURL,\n 'isScriptURL': tt.isScriptURL,\n 'isScript': tt.isScript,\n 'createPolicy': tt.createPolicy,\n 'getPolicyNames': tt.getPolicyNames,\n 'getAttributeType': tt.getAttributeType,\n 'getPropertyType': tt.getPropertyType,\n 'getTypeMapping': tt.getTypeMapping,\n 'emptyHTML': tt.emptyHTML,\n '_isPolyfill_': true,\n });\n Object.defineProperty(\n publicApi,\n 'defaultPolicy',\n Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {});\n\n window[rootProperty] = Object.freeze(publicApi);\n\n window['TrustedHTML'] = tt.TrustedHTML;\n window['TrustedURL'] = tt.TrustedURL;\n window['TrustedScriptURL'] = tt.TrustedScriptURL;\n window['TrustedScript'] = tt.TrustedScript;\n window['TrustedTypePolicy'] = TrustedTypePolicy;\n window['TrustedTypePolicyFactory'] = TrustedTypePolicyFactory;\n}\n\nsetupPolyfill();\n\nexport default tt;\n"]} \ No newline at end of file diff --git a/dist/es5/trustedtypes.build.js.map b/dist/es5/trustedtypes.build.js.map index 9623aa09..86cfdbe9 100644 --- a/dist/es5/trustedtypes.build.js.map +++ b/dist/es5/trustedtypes.build.js.map @@ -1 +1 @@ -{"version":3,"sources":[" [synthetic:es6/util/arrayiterator] "," [synthetic:util/defineproperty] "," [synthetic:util/global] "," [synthetic:es6/symbol] "," [synthetic:es6/util/makeiterator] "," [synthetic:es6/util/arrayfromiterator] "," [synthetic:util/objectcreate] "," [synthetic:es6/util/setprototypeof] "," [synthetic:es6/util/inherits] "," [synthetic:util/owns] "," [synthetic:util/polyfill] "," [synthetic:es6/weakmap] "," [synthetic:es6/object/entries] "," [synthetic:es6/object/is] "," [synthetic:es6/array/includes] "," [synthetic:es6/util/assign] "," [synthetic:es6/object/assign] ","src/data/trustedtypeconfig.js","src/polyfill/full.js","src/trustedtypes.js"," [synthetic:es6/util/arrayfromiterable] ","src/utils/wrapper.js","src/enforcer.js","src/polyfill/api_only.js"],"names":["$jscomp.defineProperty","$jscomp.global","$jscomp.initSymbol","$jscomp.Symbol","$jscomp.SymbolClass","$jscomp.SYMBOL_PREFIX","$jscomp.arrayIteratorImpl","$jscomp.objectCreate","$jscomp.setPrototypeOf","$jscomp.polyfill","$jscomp.makeIterator","$jscomp.owns","$jscomp.assign","constructor","TrustedTypeConfig","isLoggingEnabled","isEnforcementEnabled","allowedPolicyNames","cspString","parseCSP","WHITESPACE","trim","split","SEMICOLON","map","serializedDirective","reduce","parsed","directive","slice","s","sort","fromCSP","csp","policy","TrustedTypeConfig$$module$src$data$trustedtypeconfig.parseCSP","enforce","DIRECTIVE_NAME","policies","filter","p","charAt","rejectInputFn","TypeError","String","prototype","toLowerCase","toUpperCase","TrustedTypePolicy","TrustedTypePolicyFactory","trustedTypesBuilderTestOnly","TrustedScript","TrustedHTML","TrustedScriptURL","TrustedURL","TrustedType","policyName","creatorSymbol","Error","defineProperty","value","enumerable","privates","obj","v","privateMap","get","undefined","create","set","selfContained","collection","proto","getPrototypeOf","ObjectPrototype","getOwnPropertyNames","key","lockdownTrustedType","SubClass","canonName","freeze","name","isTrustedTypeChecker","type","has","wrapPolicy","innerPolicy","creator","Ctor","methodName","method","policySpecificType","factory","args","result","$jscomp.arrayFromIterator","allowedValue","o","createTypeMapping","writable","configurable","getTypeInternal_","tag","container","elNs","attrNs","canonicalTag","apply","ns","HTML_NS","hasOwnProperty","TYPE_MAP","getDefaultPolicy","defaultPolicy","Object","assign","Array","forEach","push","Symbol","WeakMap","policyNames","allowedNames","enforceNameWhitelist","toString","valueOf","$jscomp.inherits","emptyHTML","XLINK_NS","SVG_NS","ATTR_PROPERTY_MAP","HTMLIFrameElement","keys","attr","HTMLElement","createFunctionAllowed","api","createPolicy","indexOf","call","console","warn","wrappedPolicy","DEFAULT_POLICY_NAME","getPolicyNames","isHTML","isURL","isScriptURL","isScript","getAttributeType","tagName","attribute","elementNs","attributeNs","canonicalAttr","getPropertyType","property","getTypeMapping","namespaceUri","document","documentElement","namespaceURI","e","JSON","parse","stringify","trustedTypes","setAllowedPolicyNames","length","el","resetDefaultPolicy","splice","installFunction","object","fn","Reflect","getOwnPropertyDescriptor","UrlConstructor","window","URL","stringifyForRangeHack","getConstructorName_","createElement","match","windowOpenObject","insertAdjacentObject","Element","SecurityPolicyViolationEvent","typeMap","TrustedTypes","STRING_TO_TYPE","attrs","entries","k","TYPE_CHECKER_MAP","TYPE_PRODUCER_MAP","TrustedTypesEnforcer","config_","config","originalSetters_","install","trustedTypesEnforcer","wrapSetter_","ShadowRoot","doc","createRange","r","createContextualFragment","f","childNodes","wrapWithEnforceFunction_","Range","Document","HTMLDocument","DOMParser","wrapSetAttribute_","installScriptMutatorGuards_","installPropertySetWrappers_","fnName","wrapFunction_","Node","originalFn","that","enforceTypeInScriptNodes_","bind","insertAdjacentTextWrapper_","setAttributeWrapper_","setAttributeNSWrapper_","context","attrName","requiredType","enforce_","checkParent","objToCheck","parentNode","HTMLScriptElement","argNumber","arg","nodeType","TEXT_NODE","textContent","createTextNode","fallbackValue","exceptionThrown","maybeCallDefaultPolicy_","processViolation_","riskyPositions","parentElement","includes","textNode","insertBefore","getKey_","nextSibling","functionBody","descriptor","Function","enforcingSetter","originalSetter","useObject","stopAt","typeName","sink","fallbackPolicy","propertyName","typeToEnforce","isInlineEventHandler","objName","localName","contextName","message","blockedURI","baseURI","href","valueSlice","event","location","isConnected","dispatchEvent","publicApi","tt","detectPolicy","currentScript","scripts","getElementsByTagName","bodyPrefix","substr","dataset","cspInMeta","head","querySelector","rootProperty","TrustedTypeConfig$$module$src$data$trustedtypeconfig.fromCSP"],"mappings":"A;;;;;;;;AA2B4B,QAAA,GAAQ,CAAC,CAAD,CAAQ,CAC1C,IAAI,EAAQ,CACZ,OAAO,SAAQ,EAAG,CAChB,MAAI,EAAJ,CAAY,CAAA,OAAZ,CACS,CACL,KAAM,CAAA,CADD,CAEL,MAAO,CAAA,CAAM,CAAA,EAAN,CAFF,CADT,CAMS,CAAC,KAAM,CAAA,CAAP,CAPO,CAFwB,CCS5C,IAAAA,EAC4D,UAAxD,EAAsB,MAAO,OAAA,iBAA7B,CACA,MAAA,eADA,CAEA,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA+B,CAOjC,CAAJ,EAAc,KAAA,UAAd,EAAiC,CAAjC,EAA2C,MAAA,UAA3C,GACA,CAAA,CAAO,CAAP,CADA,CACmB,CAAA,MADnB,CAPqC,CAH3C,CCQAC,GAf2B,WAAlB,EAAC,MAAO,OAAR,EAAiC,MAAjC,GAe0B,IAf1B,CAe0B,IAf1B,CAEe,WAAlB,EAAC,MAAO,OAAR,EAA2C,IAA3C,EAAiC,MAAjC,CACwB,MADxB,CAa6B,ICZd,SAAA,GAAQ,EAAG,CAE9BC,EAAA,CAAqB,QAAQ,EAAG,E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AA2CrH,EAA3C,CADR,CAGE,MAAOiH,EAAAzC,YAAA3N,KAAA,EAAAQ,MAAA,CAAuC2I,EAAvC,CAET,IAAIiH,CAAAK,QAAA,IAAJ,CACE,MAAOL,EAAAK,QAAA,IAET,KAAMC,EAAYhI,QAAAiI,KAAAC,cAAA,CACd,6CADc,CAElB,IAAIF,CAAJ,CACE,MAAOA,EAAA,QAAA1Q,KAAA,EAlBP,CAoBF,MAAO6I,CAAP,CAAU,EAGZ,MAAO,KAxBe,CAyDpB,IAAA,EAXuB;CAAA,CAAA,CACzB,IADyB,IACzB,GAAAxJ,CAAA,CAA2B,CAAC,cAAD,CAAiB,cAAjB,CAA3B,CADyB,CACzB,GAAA,EAAA,KAAA,EAAA,CAAA,CAAA,EAAA,KAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAA6D,CAA7D,IAAWwR,GAAX,EAAA,MACE,IAAIhH,MAAA,CAAOgH,EAAP,CAAJ,EAA4B,CAAChH,MAAA,CAAOgH,EAAP,CAAA,aAA7B,CAAmE,CAEjE,EAAA,CAAO,CAAA,CAAP,OAAA,CAFiE,CADR,CAM7D,EAAA,CAAO,CAAA,CAPkB,CAW3B,GAAI,EAAJ,CAAA,CA1BE,IAAMjQ,GAAMuP,EAAA,EAAZ,CACMlF,GAASrK,EAAA,CAAMkQ,EAAA,EAAN,CAAuC,IAAIrR,EAAJ,CAC3B,CAAA,CAD2B,CAEvB,CAAA,CAFuB,CAGzB,CAAC,GAAD,CAHyB,CAOtD0L,GAAA,EAkBF","file":"trustedtypes.build.js","sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * CSP Directive name controlling Trusted Types behavior.\n * @type {string}\n */\nexport const DIRECTIVE_NAME = 'trusted-types';\n\n/**\n * A configuration object for trusted type enforcement.\n */\nexport class TrustedTypeConfig {\n /**\n * @param {boolean} isLoggingEnabled If true enforcement wrappers will log\n * violations to the console.\n * @param {boolean} isEnforcementEnabled If true enforcement is enabled at\n * runtime.\n * @param {Array} allowedPolicyNames Whitelisted policy names.\n * @param {?string} cspString String with the CSP policy.\n */\n constructor(isLoggingEnabled,\n isEnforcementEnabled,\n allowedPolicyNames,\n cspString = null) {\n /**\n * True if logging is enabled.\n * @type {boolean}\n */\n this.isLoggingEnabled = isLoggingEnabled;\n\n /**\n * True if enforcement is enabled.\n * @type {boolean}\n */\n this.isEnforcementEnabled = isEnforcementEnabled;\n\n /**\n * Allowed policy names.\n * @type {Array}\n */\n this.allowedPolicyNames = allowedPolicyNames;\n\n /**\n * CSP string that defined the policy.\n * @type {?string}\n */\n this.cspString = cspString;\n }\n\n /**\n * Parses a CSP policy.\n * @link https://www.w3.org/TR/CSP3/#parse-serialized-policy\n * @param {string} cspString String with a CSP definition.\n * @return {Object>} Parsed CSP, keyed by directive\n * names.\n */\n static parseCSP(cspString) {\n const SEMICOLON = /\\s*;\\s*/;\n const WHITESPACE = /\\s+/;\n return cspString.trim().split(SEMICOLON)\n .map((serializedDirective) => serializedDirective.split(WHITESPACE))\n .reduce(function(parsed, directive) {\n if (directive[0]) {\n parsed[directive[0]] = directive.slice(1).map((s) => s).sort();\n }\n return parsed;\n }, {});\n }\n\n /**\n * Creates a TrustedTypeConfig object from a CSP string.\n * @param {string} cspString\n * @return {!TrustedTypeConfig}\n */\n static fromCSP(cspString) {\n const isLoggingEnabled = true;\n const policy = TrustedTypeConfig.parseCSP(cspString);\n const enforce = DIRECTIVE_NAME in policy;\n let policies = ['*'];\n if (enforce) {\n policies = policy[DIRECTIVE_NAME].filter((p) => p.charAt(0) !== '\\'');\n }\n\n return new TrustedTypeConfig(\n isLoggingEnabled,\n enforce, /* isEnforcementEnabled */\n policies, /* allowedPolicyNames */\n cspString\n );\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that enforces the types.\n */\nimport {TrustedTypesEnforcer} from '../enforcer.js';\nimport {TrustedTypeConfig} from '../data/trustedtypeconfig.js';\n/* eslint-disable no-unused-vars */\nimport TrustedTypes from './api_only.js';\n\n/* eslint-enable no-unused-vars */\n\n/**\n * Tries to guess a CSP policy from:\n * - the current polyfill script element text content (if prefixed with\n * \"Content-Security-Policy:\")\n * - the data-csp attribute value of the current script element.\n * - meta header\n * @return {?string} Guessed CSP value, or null.\n */\nfunction detectPolicy() {\n try {\n const currentScript = document.currentScript || (function() {\n const scripts = document.getElementsByTagName('script');\n return scripts[scripts.length - 1];\n })();\n\n const bodyPrefix = 'Content-Security-Policy:';\n if (currentScript &&\n currentScript.textContent.trim().substr(0, bodyPrefix.length) ==\n bodyPrefix) {\n return currentScript.textContent.trim().slice(bodyPrefix.length);\n }\n if (currentScript.dataset['csp']) {\n return currentScript.dataset['csp'];\n }\n const cspInMeta = document.head.querySelector(\n 'meta[http-equiv^=\"Content-Security-Policy\"]');\n if (cspInMeta) {\n return cspInMeta['content'].trim();\n }\n } catch (e) {\n return null;\n }\n return null;\n}\n\n/**\n * Bootstraps all trusted types polyfill and their enforcement.\n */\nexport function bootstrap() {\n const csp = detectPolicy();\n const config = csp ? TrustedTypeConfig.fromCSP(csp) : new TrustedTypeConfig(\n /* isLoggingEnabled */ false,\n /* isEnforcementEnabled */ false,\n /* allowedPolicyNames */ ['*']);\n\n const trustedTypesEnforcer = new TrustedTypesEnforcer(config);\n\n trustedTypesEnforcer.install();\n}\n\n/**\n * Determines if the enforcement should be enabled.\n * @return {boolean}\n */\nfunction shouldBootstrap() {\n for (const rootProperty of ['trustedTypes', 'TrustedTypes']) {\n if (window[rootProperty] && !window[rootProperty]['_isPolyfill_']) {\n // Native implementation exists\n return false;\n }\n }\n return true;\n}\n\n// Bootstrap only if native implementation is missing.\nif (shouldBootstrap()) {\n bootstrap();\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst rejectInputFn = (s) => {\n throw new TypeError('undefined conversion');\n};\n\nconst {toLowerCase, toUpperCase} = String.prototype;\n\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @constructor\n * @property {!function(string):TrustedHTML} createHTML\n * @property {!function(string):TrustedURL} createURL\n * @property {!function(string):TrustedScriptURL} createScriptURL\n * @property {!function(string):TrustedScript} createScript\n * @property {!string} name\n */\nexport const TrustedTypePolicy = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/**\n * @constructor\n */\nexport const TrustedTypePolicyFactory = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypesInnerPolicy}\n * @property {function(string):string} createHTML\n * @property {function(string):string} createURL\n * @property {function(string):string} createScriptURL\n * @property {function(string):string} createScript\n */\nconst TrustedTypesInnerPolicy = {};\n\n/**\n * @typedef {!Object,\n * properties: !Object}>}\n */\nconst TrustedTypesTypeMap = {};\n/* eslint-enable no-unused-vars */\n\nexport const DEFAULT_POLICY_NAME = 'default';\n\n\nexport const trustedTypesBuilderTestOnly = function() {\n // Capture common names early.\n const {\n assign, create, defineProperty, freeze, getOwnPropertyNames,\n getPrototypeOf, prototype: ObjectPrototype,\n } = Object;\n\n const {hasOwnProperty} = ObjectPrototype;\n\n const {\n forEach, push,\n } = Array.prototype;\n\n const creatorSymbol = Symbol();\n\n /**\n * Getter for the privateMap.\n * @param {Object} obj Key of the privateMap\n * @return {Object} Private storage.\n */\n const privates = function(obj) {\n let v = privateMap.get(obj);\n if (v === undefined) {\n v = create(null); // initialize the private storage.\n privateMap.set(obj, v);\n }\n return v;\n };\n\n /**\n * Called before attacker-controlled code on an internal collections,\n * copies prototype members onto the instance directly, so that later\n * changes to prototypes cannot expose collection internals.\n * @param {!T} collection\n * @return {!T} collection\n * @template T\n */\n function selfContained(collection) {\n const proto = getPrototypeOf(collection);\n if (proto == null || getPrototypeOf(proto) !== ObjectPrototype) {\n throw new Error(); // Loop below is insufficient.\n }\n for (const key of getOwnPropertyNames(proto)) {\n defineProperty(collection, key, {value: collection[key]});\n }\n return collection;\n }\n\n /**\n * Map for private properties of Trusted Types object.\n * This is so that the access to the type constructor does not give\n * the ability to create typed values.\n * @type {WeakMap}\n */\n const privateMap = selfContained(new WeakMap());\n\n /**\n * List of all configured policy names.\n * @type {Array}\n */\n const policyNames = selfContained([]);\n\n /**\n * Allowed policy namess for policy names.\n * @type {Array}\n */\n const allowedNames = selfContained([]);\n\n /**\n * A reference to a default policy, if created.\n * @type {TrustedTypePolicy}\n */\n let defaultPolicy = null;\n\n /**\n * Whether to enforce allowedNames in createPolicy().\n * @type {boolean}\n */\n let enforceNameWhitelist = false;\n\n\n /**\n * A value that is trusted to have certain security-relevant properties\n * because the sources of such values are controlled.\n */\n class TrustedType {\n /**\n * Constructor for TrustedType. Only allowed to be called from within a\n * policy.\n * @param {symbol} s creatorSymbol\n * @param {string} policyName The name of the policy this object was\n * created by.\n */\n constructor(s, policyName) {\n // TODO: Figure out if symbol is needed, if the value is in privateMap.\n if (s !== creatorSymbol) {\n throw new Error('cannot call the constructor');\n }\n defineProperty(this, 'policyName',\n {value: '' + policyName, enumerable: true});\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n toString() {\n return privates(this)['v'];\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n valueOf() {\n return privates(this)['v'];\n }\n }\n\n /**\n * @param {function(new:TrustedType, symbol, string)} SubClass\n * @param {string} canonName The class name which should be independent of\n * any renaming pass and which is relied upon by the enforcer and for\n * native type interop.\n */\n function lockdownTrustedType(SubClass, canonName) {\n freeze(SubClass.prototype);\n delete SubClass.name;\n defineProperty(SubClass, 'name', {value: canonName});\n }\n\n /**\n * Trusted URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedURL extends TrustedType {\n }\n lockdownTrustedType(TrustedURL, 'TrustedURL');\n\n /**\n * Trusted Script URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScriptURL extends TrustedType {\n }\n lockdownTrustedType(TrustedScriptURL, 'TrustedScriptURL');\n\n /**\n * Trusted HTML object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedHTML extends TrustedType {\n }\n lockdownTrustedType(TrustedHTML, 'TrustedHTML');\n\n /**\n * Trusted Script object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScript extends TrustedType {\n }\n lockdownTrustedType(TrustedScript, 'TrustedScript');\n\n lockdownTrustedType(TrustedType, 'TrustedType');\n\n // Common constants.\n const emptyHTML = freeze(create(new TrustedHTML(creatorSymbol, '')));\n privates(emptyHTML)['v'] = '';\n\n /**\n * A map of attribute / property names to allowed types\n * for known namespaces.\n * @type {!Object}\n * @export\n */\n const TYPE_MAP = {\n [HTML_NS]: {\n // TODO(koto): Figure out what to to with \n 'A': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'AREA': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BASE': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BUTTON': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'EMBED': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n },\n },\n 'FORM': {\n 'attributes': {\n 'action': TrustedURL.name,\n },\n },\n 'FRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n },\n },\n 'IFRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n 'srcdoc': TrustedHTML.name,\n },\n },\n 'INPUT': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'OBJECT': {\n 'attributes': {\n 'data': TrustedScriptURL.name,\n 'codebase': TrustedScriptURL.name,\n },\n },\n // TODO(koto): Figure out what to do with portals.\n 'SCRIPT': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n 'text': TrustedScript.name,\n },\n 'properties': {\n 'innerText': TrustedScript.name,\n 'textContent': TrustedScript.name,\n 'text': TrustedScript.name,\n },\n },\n '*': {\n 'attributes': {},\n 'properties': {\n 'innerHTML': TrustedHTML.name,\n 'outerHTML': TrustedHTML.name,\n },\n },\n },\n [XLINK_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n [SVG_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n };\n\n /**\n * A map of element property to HTML attribute names.\n * @type {!Object}\n */\n const ATTR_PROPERTY_MAP = {\n 'codebase': 'codeBase',\n 'formaction': 'formAction',\n };\n\n // Edge doesn't support srcdoc.\n if (!('srcdoc' in HTMLIFrameElement.prototype)) {\n delete TYPE_MAP[HTML_NS]['IFRAME']['attributes']['srcdoc'];\n }\n\n // in HTML, clone attributes into properties.\n for (const tag of Object.keys(TYPE_MAP[HTML_NS])) {\n if (!TYPE_MAP[HTML_NS][tag]['properties']) {\n TYPE_MAP[HTML_NS][tag]['properties'] = {};\n }\n for (const attr of Object.keys(TYPE_MAP[HTML_NS][tag]['attributes'])) {\n TYPE_MAP[HTML_NS][tag]['properties'][\n ATTR_PROPERTY_MAP[attr] ? ATTR_PROPERTY_MAP[attr] : attr\n ] = TYPE_MAP[HTML_NS][tag]['attributes'][attr];\n }\n }\n\n // Add inline event handlers attribute names.\n for (const name of getOwnPropertyNames(HTMLElement.prototype)) {\n if (name.slice(0, 2) === 'on') {\n TYPE_MAP[HTML_NS]['*']['attributes'][name] = 'TrustedScript';\n }\n }\n\n /**\n * @type {!Object}\n */\n const createTypeMapping = {\n 'createHTML': TrustedHTML,\n 'createScriptURL': TrustedScriptURL,\n 'createURL': TrustedURL,\n 'createScript': TrustedScript,\n };\n\n const createFunctionAllowed = createTypeMapping.hasOwnProperty;\n\n /**\n * Function generating a type checker.\n * @template T\n * @param {T} type The type to check against.\n * @return {function(*):boolean}\n */\n function isTrustedTypeChecker(type) {\n return (obj) => (obj instanceof type) && privateMap.has(obj);\n }\n\n /**\n * Wraps a user-defined policy rules with TT constructor\n * @param {string} policyName The policy name\n * @param {TrustedTypesInnerPolicy} innerPolicy InnerPolicy\n * @return {!TrustedTypePolicy} Frozen policy object\n */\n function wrapPolicy(policyName, innerPolicy) {\n /**\n * @template T\n * @param {function(new:T, symbol, string)} Ctor a trusted type constructor\n * @param {string} methodName the policy factory method name\n * @return {function(string):!T} a factory that produces instances of Ctor.\n */\n function creator(Ctor, methodName) {\n // This causes thisValue to be null when called below.\n const method = innerPolicy[methodName] || rejectInputFn;\n const policySpecificType = freeze(new Ctor(creatorSymbol, policyName));\n const factory = {\n [methodName](s, ...args) {\n // Trick to get methodName to show in stacktrace.\n let result = method('' + s, ...args);\n if (result === undefined || result === null) {\n result = '';\n }\n const allowedValue = '' + result;\n const o = freeze(create(policySpecificType));\n privates(o)['v'] = allowedValue;\n return o;\n },\n }[methodName];\n return freeze(factory);\n }\n\n const policy = create(TrustedTypePolicy.prototype);\n\n for (const name of getOwnPropertyNames(createTypeMapping)) {\n policy[name] = creator(createTypeMapping[name], name);\n }\n defineProperty(policy, 'name', {\n value: policyName,\n writable: false,\n configurable: false,\n enumerable: true,\n });\n\n return /** @type {!TrustedTypePolicy} */ (freeze(policy));\n }\n\n /**\n * Returns the name of the trusted type required for a given element\n * attribute.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} attribute The name of the attribute.\n * @param {string=} elementNs Element namespace.\n * @param {string=} attributeNs The attribute namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getAttributeType(tagName, attribute, elementNs = '',\n attributeNs = '') {\n const canonicalAttr = toLowerCase.apply(String(attribute));\n return getTypeInternal_(tagName, 'attributes', canonicalAttr,\n elementNs, attributeNs);\n }\n\n /**\n * Returns a type name from a type map.\n * @param {string} tag A tag name.\n * @param {string} container 'attributes' or 'properties'\n * @param {string} name The attribute / property name.\n * @param {string=} elNs Element namespace.\n * @param {string=} attrNs Attribute namespace.\n * @return {string|undefined}\n * @private\n */\n function getTypeInternal_(tag, container, name, elNs = '', attrNs = '') {\n const canonicalTag = toUpperCase.apply(String(tag));\n\n let ns = attrNs ? attrNs : elNs;\n if (!ns) {\n ns = HTML_NS;\n }\n const map = hasOwnProperty.apply(TYPE_MAP, [ns]) ? TYPE_MAP[ns] : null;\n if (!map) {\n return;\n }\n if (hasOwnProperty.apply(map, [canonicalTag]) &&\n map[canonicalTag] &&\n hasOwnProperty.apply(map[canonicalTag][container], [name]) &&\n map[canonicalTag][container][name]) {\n return map[canonicalTag][container][name];\n }\n\n if (hasOwnProperty.apply(map, ['*']) &&\n hasOwnProperty.apply(map['*'][container], [name]) &&\n map['*'][container][name]) {\n return map['*'][container][name];\n }\n }\n\n /**\n * Returns the name of the trusted type required for a given element property.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} property The property.\n * @param {string=} elementNs Element namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getPropertyType(tagName, property, elementNs = '') {\n // TODO: Support namespaces.\n return getTypeInternal_(tagName, 'properties', String(property), elementNs);\n }\n\n /**\n * Returns the type map-like object, that resolves a name of a type for a\n * given tag + attribute / property in a given namespace.\n * The keys of the map are uppercase tag names. Map entry has mappings between\n * a lowercase attribute name / case-sensitive property name and a name of the\n * type that is required for that attribute / property.\n * Example entry for 'IMG': {\"attributes\": {\"src\": \"TrustedHTML\"}}\n * @param {string=} namespaceUri The namespace URI (will use the current\n * document namespace URI if omitted).\n * @return {TrustedTypesTypeMap}\n */\n function getTypeMapping(namespaceUri = '') {\n if (!namespaceUri) {\n try {\n namespaceUri = document.documentElement.namespaceURI;\n } catch (e) {\n namespaceUri = HTML_NS;\n }\n }\n /**\n * @template T\n * @private\n * @param {T} o\n * @return {T}\n */\n function deepClone(o) {\n return JSON.parse(JSON.stringify(o));\n }\n const map = TYPE_MAP[namespaceUri];\n if (!map) {\n return {};\n }\n return deepClone(map);\n }\n\n /**\n * Returns all configured policy names (even for non-exposed policies).\n * @return {!Array}\n */\n function getPolicyNames() {\n // TODO(msamuel): Should we sort policyNames to avoid leaking or\n // encouraging dependency on the order in which policy names are\n // registered? I think JavaScript builtin sorts are efficient for\n // almost-sorted lists so the amortized cost is close to O(n).\n return policyNames.slice();\n }\n\n /**\n * Creates a TT policy.\n *\n * Returns a frozen object representing a policy - a collection of functions\n * that may create TT objects based on the user-provided rules specified\n * in the policy object.\n *\n * @param {string} name A unique name of the policy.\n * @param {TrustedTypesInnerPolicy} policy Policy rules object.\n * @return {TrustedTypePolicy} The policy that may create TT objects\n * according to the policy rules.\n */\n function createPolicy(name, policy) {\n const pName = '' + name; // Assert it's a string\n\n if (enforceNameWhitelist && allowedNames.indexOf(pName) === -1) {\n throw new TypeError('Policy ' + pName + ' disallowed.');\n }\n\n if (policyNames.indexOf(pName) !== -1) {\n throw new TypeError('Policy ' + pName + ' exists.');\n }\n // Register the name early so that if policy getters unwisely calls\n // across protection domains to code that reenters this function,\n // policy author still has rights to the name.\n policyNames.push(pName);\n\n // Only copy own properties of names present in createTypeMapping.\n const innerPolicy = create(null);\n if (policy && typeof policy === 'object') {\n // Treat non-objects as empty policies.\n for (const key of getOwnPropertyNames(policy)) {\n if (createFunctionAllowed.call(createTypeMapping, key)) {\n innerPolicy[key] = policy[key];\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn('trustedTypes.createPolicy ' + pName +\n ' was given an empty policy');\n }\n freeze(innerPolicy);\n\n const wrappedPolicy = wrapPolicy(pName, innerPolicy);\n\n if (pName === DEFAULT_POLICY_NAME) {\n defaultPolicy = wrappedPolicy;\n }\n\n return wrappedPolicy;\n }\n\n /**\n * Applies the policy name whitelist.\n * @param {!Array} allowedPolicyNames\n */\n function setAllowedPolicyNames(allowedPolicyNames) {\n if (allowedPolicyNames.indexOf('*') !== -1) { // Any policy name is allowed.\n enforceNameWhitelist = false;\n } else {\n enforceNameWhitelist = true;\n allowedNames.length = 0;\n forEach.call(allowedPolicyNames, (el) => {\n push.call(allowedNames, '' + el);\n });\n }\n }\n\n /**\n * Returns the default policy, or null if it was not created.\n * @return {TrustedTypePolicy}\n */\n function getDefaultPolicy() {\n return defaultPolicy;\n }\n\n /**\n * Resets the default policy.\n */\n function resetDefaultPolicy() {\n defaultPolicy = null;\n policyNames.splice(policyNames.indexOf(DEFAULT_POLICY_NAME), 1);\n }\n\n const api = create(TrustedTypePolicyFactory.prototype);\n assign(api, {\n // The main function to create policies.\n createPolicy,\n\n getPolicyNames,\n\n // Type checkers, also validating the object was initialized through a\n // policy.\n isHTML: isTrustedTypeChecker(TrustedHTML),\n isURL: isTrustedTypeChecker(TrustedURL),\n isScriptURL: isTrustedTypeChecker(TrustedScriptURL),\n isScript: isTrustedTypeChecker(TrustedScript),\n\n getAttributeType,\n getPropertyType,\n getTypeMapping,\n emptyHTML,\n defaultPolicy, // Just to make the compiler happy, this is overridden below.\n\n TrustedHTML: TrustedHTML,\n TrustedURL: TrustedURL,\n TrustedScriptURL: TrustedScriptURL,\n TrustedScript: TrustedScript,\n });\n\n defineProperty(api, 'defaultPolicy', {\n get: getDefaultPolicy,\n set: () => {},\n });\n\n return {\n trustedTypes: freeze(api),\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n };\n};\n\n\nexport const {\n trustedTypes,\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n} = trustedTypesBuilderTestOnly();\n\n",null,"/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst {\n defineProperty,\n} = Object;\n\n/**\n * Installs the setter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} setter A setter function}\n */\nexport function installSetter(object, name, setter) {\n const descriptor = {\n set: setter,\n };\n defineProperty(object, name, descriptor);\n}\n\n/**\n * Installs a setter and getter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} setter A setter function}\n * @param {function(*): *|undefined} getter A getter function}\n */\nexport function installSetterAndGetter(object, name, setter, getter) {\n const descriptor = {\n set: setter,\n get: getter,\n configurable: true, // This can get uninstalled, we need configurable: true\n };\n defineProperty(object, name, descriptor);\n}\n\n/**\n * Installs the setter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} fn A function}\n */\nexport function installFunction(object, name, fn) {\n defineProperty(object, name, {\n value: fn,\n });\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/* eslint-disable no-unused-vars */\nimport {DIRECTIVE_NAME, TrustedTypeConfig} from './data/trustedtypeconfig.js';\nimport {\n trustedTypes as TrustedTypes,\n setAllowedPolicyNames,\n resetDefaultPolicy,\n HTML_NS,\n} from\n './trustedtypes.js';\n\n/* eslint-enable no-unused-vars */\nimport {installFunction, installSetter, installSetterAndGetter}\n from './utils/wrapper.js';\n\nconst {apply} = Reflect;\nconst {\n getOwnPropertyNames,\n getOwnPropertyDescriptor,\n getPrototypeOf,\n} = Object;\n\nconst {\n hasOwnProperty,\n isPrototypeOf,\n} = Object.prototype;\n\nconst {slice} = String.prototype;\n\n// No URL in IE 11.\nconst UrlConstructor = typeof window.URL == 'function' ?\n URL.prototype.constructor :\n null;\n\nlet stringifyForRangeHack;\n\n/**\n * Return object constructor name\n * (their function.name is not available in IE 11).\n * @param {*} fn\n * @return {string}\n * @private\n */\nconst getConstructorName_ = document.createElement('div').constructor.name ?\n (fn) => fn.name :\n (fn) => ('' + fn).match(/^\\[object (\\S+)\\]$/)[1];\n\n// window.open on IE 11 is set on WindowPrototype\nconst windowOpenObject = getOwnPropertyDescriptor(window, 'open') ?\n window :\n window.constructor.prototype;\n\n// In IE 11, insertAdjacent(HTML|Text) is on HTMLElement prototype\nconst insertAdjacentObject = apply(hasOwnProperty, Element.prototype,\n ['insertAdjacentHTML']) ? Element.prototype : HTMLElement.prototype;\n\n// This is not available in release Firefox :(\n// https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent\n// https://bugzilla.mozilla.org/show_bug.cgi?id=1432523\nconst SecurityPolicyViolationEvent = window['SecurityPolicyViolationEvent'] ||\n null;\n\n/**\n * Parses URL, catching all the errors.\n * @param {string} url URL string to parse.\n * @return {URL|null}\n */\nfunction parseUrl_(url) {\n try {\n return new UrlConstructor(url, document.baseURI || undefined);\n } catch (e) {\n return null;\n }\n}\n\n// We don't actually need other namespaces.\n// setAttribute is hooked on Element.prototype, which all elements inherit from,\n// and all sensitive property wrappers are hooked directly on Element as well.\nconst typeMap = TrustedTypes.getTypeMapping(HTML_NS);\n\nconst STRING_TO_TYPE = {\n 'TrustedHTML': TrustedTypes.TrustedHTML,\n 'TrustedScript': TrustedTypes.TrustedScript,\n 'TrustedScriptURL': TrustedTypes.TrustedScriptURL,\n 'TrustedURL': TrustedTypes.TrustedURL,\n};\n\n/**\n * Converts an uppercase tag name to an element constructor function name.\n * Used for property setter hijacking only.\n * @param {string} tagName\n * @return {string}\n */\nfunction convertTagToConstructor(tagName) {\n if (tagName == '*') {\n return 'HTMLElement';\n }\n return getConstructorName_(document.createElement(tagName).constructor);\n}\n\nfor (const tagName of Object.keys(typeMap)) {\n const attrs = typeMap[tagName]['properties'];\n for (const [k, v] of Object.entries(attrs)) {\n attrs[k] = STRING_TO_TYPE[v];\n }\n}\n\n/**\n * Map of type names to type checking function.\n * @type {!Object}\n */\nconst TYPE_CHECKER_MAP = {\n 'TrustedHTML': TrustedTypes.isHTML,\n 'TrustedURL': TrustedTypes.isURL,\n 'TrustedScriptURL': TrustedTypes.isScriptURL,\n 'TrustedScript': TrustedTypes.isScript,\n};\n\n/**\n * Map of type names to type producing function.\n * @type {Object}\n */\nconst TYPE_PRODUCER_MAP = {\n 'TrustedHTML': 'createHTML',\n 'TrustedURL': 'createURL',\n 'TrustedScriptURL': 'createScriptURL',\n 'TrustedScript': 'createScript',\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypePolicy}\n * @property {function(string):TrustedHTML} createHTML\n * @property {function(string):TrustedURL} createURL\n * @property {function(string):TrustedScriptURL} createScriptURL\n * @property {function(string):TrustedScript} createScript\n */\nconst TrustedTypePolicy = {};\n/* eslint-enable no-unused-vars */\n\n\n/**\n * An object for enabling trusted type enforcement.\n */\nexport class TrustedTypesEnforcer {\n /**\n * @param {!TrustedTypeConfig} config The configuration for\n * trusted type enforcement.\n */\n constructor(config) {\n /**\n * A configuration for the trusted type enforcement.\n * @private {!TrustedTypeConfig}\n */\n this.config_ = config;\n /**\n * @private {Object}\n */\n this.originalSetters_ = {};\n }\n\n /**\n * Wraps HTML sinks with an enforcement setter, which will enforce\n * trusted types and do logging, if enabled.\n *\n */\n install() {\n setAllowedPolicyNames(this.config_.allowedPolicyNames);\n\n if (!this.config_.isEnforcementEnabled && !this.config_.isLoggingEnabled) {\n return;\n }\n\n if ('ShadowRoot' in window) {\n this.wrapSetter_(ShadowRoot.prototype, 'innerHTML',\n TrustedTypes.TrustedHTML);\n }\n stringifyForRangeHack = (function(doc) {\n const r = doc.createRange();\n // In IE 11 Range.createContextualFragment doesn't stringify its argument.\n const f = r.createContextualFragment(/** @type {string} */ (\n {toString: () => '
'}));\n return f.childNodes.length == 0;\n })(document);\n\n this.wrapWithEnforceFunction_(Range.prototype, 'createContextualFragment',\n TrustedTypes.TrustedHTML, 0);\n\n this.wrapWithEnforceFunction_(insertAdjacentObject,\n 'insertAdjacentHTML',\n TrustedTypes.TrustedHTML, 1);\n\n if (getOwnPropertyDescriptor(Document.prototype, 'write')) {\n // Chrome\n this.wrapWithEnforceFunction_(Document.prototype, 'write',\n TrustedTypes.TrustedHTML, 0);\n this.wrapWithEnforceFunction_(Document.prototype, 'open',\n TrustedTypes.TrustedURL, 0);\n } else {\n // Firefox\n this.wrapWithEnforceFunction_(HTMLDocument.prototype, 'write',\n TrustedTypes.TrustedHTML, 0);\n this.wrapWithEnforceFunction_(HTMLDocument.prototype, 'open',\n TrustedTypes.TrustedURL, 0);\n }\n\n this.wrapWithEnforceFunction_(windowOpenObject, 'open',\n TrustedTypes.TrustedURL, 0);\n\n if ('DOMParser' in window) {\n this.wrapWithEnforceFunction_(DOMParser.prototype, 'parseFromString',\n TrustedTypes.TrustedHTML, 0);\n }\n this.wrapWithEnforceFunction_(window, 'setInterval',\n TrustedTypes.TrustedScript, 0);\n this.wrapWithEnforceFunction_(window, 'setTimeout',\n TrustedTypes.TrustedScript, 0);\n this.wrapSetAttribute_();\n this.installScriptMutatorGuards_();\n this.installPropertySetWrappers_();\n }\n\n /**\n * Removes the original setters.\n */\n uninstall() {\n setAllowedPolicyNames(['*']);\n\n if (!this.config_.isEnforcementEnabled && !this.config_.isLoggingEnabled) {\n return;\n }\n\n if ('ShadowRoot' in window) {\n this.restoreSetter_(ShadowRoot.prototype, 'innerHTML');\n }\n this.restoreFunction_(Range.prototype, 'createContextualFragment');\n this.restoreFunction_(insertAdjacentObject, 'insertAdjacentHTML');\n this.restoreFunction_(Element.prototype, 'setAttribute');\n this.restoreFunction_(Element.prototype, 'setAttributeNS');\n\n if (getOwnPropertyDescriptor(Document.prototype, 'write')) {\n this.restoreFunction_(Document.prototype, 'write');\n this.restoreFunction_(Document.prototype, 'open');\n } else {\n this.restoreFunction_(HTMLDocument.prototype, 'write');\n this.restoreFunction_(HTMLDocument.prototype, 'open');\n }\n this.restoreFunction_(windowOpenObject, 'open');\n\n if ('DOMParser' in window) {\n this.restoreFunction_(DOMParser.prototype, 'parseFromString');\n }\n this.restoreFunction_(window, 'setTimeout');\n this.restoreFunction_(window, 'setInterval');\n this.uninstallPropertySetWrappers_();\n this.uninstallScriptMutatorGuards_();\n resetDefaultPolicy();\n }\n\n /**\n * Installs type-enforcing wrappers for APIs that allow to modify\n * script element texts.\n * @private\n */\n installScriptMutatorGuards_() {\n const that = this;\n\n ['appendChild', 'insertBefore', 'replaceChild'].forEach((fnName) => {\n this.wrapFunction_(\n Node.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ false, originalFn)\n .apply(that, args);\n });\n });\n this.wrapFunction_(\n insertAdjacentObject,\n 'insertAdjacentText',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.insertAdjacentTextWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n\n if ('after' in Element.prototype) {\n ['after', 'before', 'replaceWith'].forEach((fnName) => {\n this.wrapFunction_(\n Element.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ true, originalFn)\n .apply(that, args);\n });\n });\n ['append', 'prepend'].forEach((fnName) => {\n this.wrapFunction_(\n Element.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ false, originalFn)\n .apply(that, args);\n });\n });\n }\n }\n\n /**\n * Uninstalls type-enforcing wrappers for APIs that allow to modify\n * script element texts.\n * @private\n */\n uninstallScriptMutatorGuards_() {\n this.restoreFunction_(Node.prototype, 'appendChild');\n this.restoreFunction_(Node.prototype, 'insertBefore');\n this.restoreFunction_(Node.prototype, 'replaceChild');\n this.restoreFunction_(insertAdjacentObject, 'insertAdjacentText');\n if ('after' in Element.prototype) {\n ['after', 'before', 'replaceWith', 'append', 'prepend'].forEach(\n (fnName) => this.restoreFunction_(Element.prototype, fnName));\n }\n }\n\n /**\n * Installs wrappers for directly setting properties\n * based on the type map.\n * @private\n */\n installPropertySetWrappers_() {\n /* eslint-disable guard-for-in */\n for (const tag of getOwnPropertyNames(typeMap)) {\n for (const property of getOwnPropertyNames(typeMap[tag]['properties'])) {\n this.wrapSetter_(\n window[convertTagToConstructor(tag)].prototype,\n property,\n typeMap[tag]['properties'][property]);\n }\n }\n }\n\n /**\n * Uninstalls wrappers for directly setting properties\n * based on the type map.\n * @private\n */\n uninstallPropertySetWrappers_() {\n /* eslint-disable guard-for-in */\n for (const tag of getOwnPropertyNames(typeMap)) {\n for (const property of getOwnPropertyNames(typeMap[tag]['properties'])) {\n this.restoreSetter_(\n window[convertTagToConstructor(tag)].prototype,\n property);\n }\n }\n }\n\n /** Wraps set attribute with an enforcement function. */\n wrapSetAttribute_() {\n const that = this;\n this.wrapFunction_(\n Element.prototype,\n 'setAttribute',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.setAttributeWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n this.wrapFunction_(\n Element.prototype,\n 'setAttributeNS',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.setAttributeNSWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n }\n\n /**\n * Enforces type checking for Element.prototype.setAttribute.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original setAttribute function.\n * @return {*}\n */\n setAttributeWrapper_(context, originalFn, ...args) {\n // Note(slekies): In a normal application constructor should never be null.\n // However, there are no guarantees. If the constructor is null, we cannot\n // determine whether a special type is required. In order to not break the\n // application, we will not do any further type checks and pass the call\n // to setAttribute.\n if (context.constructor !== null && context instanceof Element) {\n const attrName = (args[0] = String(args[0])).toLowerCase();\n const requiredType = TrustedTypes.getAttributeType(context.tagName,\n attrName, context.namespaceURI);\n if (requiredType && apply(hasOwnProperty, STRING_TO_TYPE,\n [requiredType])) {\n return this.enforce_(\n context, 'setAttribute', STRING_TO_TYPE[requiredType],\n originalFn, 1, args);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Enforces type checking for Element.prototype.setAttributeNS.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original setAttributeNS function.\n * @return {*}\n */\n setAttributeNSWrapper_(context, originalFn, ...args) {\n // See the note from setAttributeWrapper_ above.\n if (context.constructor !== null && context instanceof Element) {\n const ns = args[0] ? String(args[0]) : null;\n args[0] = ns;\n const attrName = (args[1] = String(args[1])).toLowerCase();\n const requiredType = TrustedTypes.getAttributeType(context.tagName,\n attrName, context.namespaceURI, ns);\n if (requiredType && apply(hasOwnProperty, STRING_TO_TYPE,\n [requiredType])) {\n return this.enforce_(context, 'setAttributeNS',\n STRING_TO_TYPE[requiredType],\n originalFn, 2, args);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Wrapper for DOM mutator functions that enforces type checks if the context\n * (or, optionally, its parent node) is a script node.\n * For each argument, it will make sure that text nodes pass through a\n * default policy, or generate a violation. To skip that check, pass\n * TrustedScript objects instead.\n * @param {!Object} context The context for the call to the original function.\n * @param {boolean} checkParent Check parent of context instead.\n * @param {!Function} originalFn The original mutator function.\n * @return {*}\n */\n enforceTypeInScriptNodes_(context, checkParent, originalFn, ...args) {\n const objToCheck = checkParent ? context.parentNode : context;\n if (objToCheck instanceof HTMLScriptElement && args.length > 0) {\n for (let argNumber = 0; argNumber < args.length; argNumber++) {\n let arg = args[argNumber];\n if (arg instanceof Node && arg.nodeType !== Node.TEXT_NODE) {\n continue; // Type is not interesting\n }\n if (arg instanceof Node && arg.nodeType == Node.TEXT_NODE) {\n arg = arg.textContent;\n } else if (TrustedTypes.isScript(arg)) {\n // TODO(koto): Consider removing this branch, as it's hard to spec.\n // Convert to text node and go on.\n args[argNumber] = document.createTextNode(arg);\n continue;\n }\n\n // Try to run a default policy on argsthe argument\n let fallbackValue;\n let exceptionThrown;\n try {\n fallbackValue = this.maybeCallDefaultPolicy_(\n 'TrustedScript', arg, 'script.text');\n } catch (e) {\n exceptionThrown = true;\n }\n if (exceptionThrown) {\n this.processViolation_(context, originalFn.name,\n TrustedTypes.TrustedScript, arg);\n }\n args[argNumber] = document.createTextNode('' + fallbackValue);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Wrapper for Element.insertAdjacentText that enforces type checks for\n * inserting text into a script node.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original insertAdjacentText function.\n */\n insertAdjacentTextWrapper_(context, originalFn, ...args) {\n const riskyPositions = ['beforebegin', 'afterend'];\n if (context instanceof Element &&\n context.parentElement instanceof HTMLScriptElement &&\n args.length > 1 &&\n riskyPositions.includes(args[0]) &&\n !(TrustedTypes.isScript(args[1]))) {\n // Run a default policy on args[1]\n let fallbackValue;\n let exceptionThrown;\n try {\n fallbackValue = this.maybeCallDefaultPolicy_('TrustedScript',\n args[1], 'script.text');\n } catch (e) {\n exceptionThrown = true;\n }\n if (exceptionThrown) {\n this.processViolation_(context, 'insertAdjacentText',\n TrustedTypes.TrustedScript, args[1]);\n }\n\n const textNode = document.createTextNode('' + fallbackValue);\n\n\n const insertBefore = /** @type function(this: Node) */(\n this.originalSetters_[this.getKey_(Node.prototype, 'insertBefore')]);\n\n switch (args[0]) {\n case riskyPositions[0]: // 'beforebegin'\n apply(insertBefore, context.parentElement,\n [textNode, context]);\n break;\n case riskyPositions[1]: // 'afterend'\n apply(insertBefore, context.parentElement,\n [textNode, context.nextSibling]);\n break;\n }\n return;\n }\n apply(originalFn, context, args);\n }\n\n /**\n * Wraps a setter with the enforcement wrapper.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Function} type The type to enforce.\n * @param {number} argNumber Number of the argument to enforce the type of.\n * @private\n */\n wrapWithEnforceFunction_(object, name, type, argNumber) {\n const that = this;\n this.wrapFunction_(\n object,\n name,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforce_.call(that, this, name, type, originalFn,\n argNumber, args);\n });\n }\n\n\n /**\n * Wraps an existing function with a given function body and stores the\n * original function.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {function(!Function, ...*)} functionBody The wrapper function.\n */\n wrapFunction_(object, name, functionBody) {\n const descriptor = getOwnPropertyDescriptor(object, name);\n const originalFn = /** @type function(*):* */ (\n descriptor ? descriptor.value : null);\n\n if (!(originalFn instanceof Function)) {\n throw new TypeError(\n 'Property ' + name + ' on object' + object + ' is not a function');\n }\n\n const key = this.getKey_(object, name);\n if (this.originalSetters_[key]) {\n throw new Error(\n `TrustedTypesEnforcer: Double installation detected: ${key} ${name}`);\n }\n installFunction(\n object,\n name,\n /**\n * @this {TrustedTypesEnforcer}\n * @return {*}\n */\n function(...args) {\n return functionBody.bind(this, originalFn).apply(this, args);\n });\n this.originalSetters_[key] = originalFn;\n }\n\n /**\n * Wraps a setter with the enforcement wrapper.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Function} type The type to enforce.\n * @param {!Object=} descriptorObject If present, will reuse the\n * setter/getter from this one, instead of object. Used for redefining\n * setters in subclasses.\n * @private\n */\n wrapSetter_(object, name, type, descriptorObject = undefined) {\n if (descriptorObject && !isPrototypeOf.call(descriptorObject, object)) {\n throw new Error('Invalid prototype chain');\n }\n\n let useObject = descriptorObject || object;\n let descriptor;\n let originalSetter;\n const stopAt = getPrototypeOf(Node.prototype);\n\n // Find the descriptor on the object or its prototypes, stopping at Node.\n do {\n descriptor = getOwnPropertyDescriptor(useObject, name);\n originalSetter = /** @type {function(*):*} */ (descriptor ?\n descriptor.set : null);\n if (!originalSetter) {\n useObject = getPrototypeOf(useObject) || stopAt;\n }\n } while (!(originalSetter || useObject === stopAt || !useObject));\n\n if (!(originalSetter instanceof Function)) {\n throw new TypeError(\n 'No setter for property ' + name + ' on object' + object);\n }\n\n const key = this.getKey_(object, name);\n if (this.originalSetters_[key]) {\n throw new Error(\n `TrustedTypesEnforcer: Double installation detected: ${key} ${name}`);\n }\n const that = this;\n /**\n * @this {TrustedTypesEnforcer}\n * @param {*} value\n */\n const enforcingSetter = function(value) {\n that.enforce_.call(that, this, name, type, originalSetter, 0,\n [value]);\n };\n\n if (useObject === object) {\n installSetter(\n object,\n name,\n enforcingSetter);\n } else {\n // Since we're creating a new setter in subclass, we also need to\n // overwrite the getter.\n installSetterAndGetter(\n object,\n name,\n enforcingSetter,\n descriptor.get\n );\n }\n this.originalSetters_[key] = originalSetter;\n }\n\n /**\n * Restores the original setter for the property, as encountered during\n * install().\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Object=} descriptorObject If present, will restore the original\n * setter/getter from this one, instead of object.\n * @private\n */\n restoreSetter_(object, name, descriptorObject = undefined) {\n const key = this.getKey_(object, name);\n if (descriptorObject && !isPrototypeOf.call(descriptorObject, object)) {\n throw new Error('Invalid prototype chain');\n }\n if (!this.originalSetters_[key]) {\n throw new Error(\n // eslint-disable-next-line max-len\n `TrustedTypesEnforcer: Cannot restore (double uninstallation?): ${key} ${name}`);\n }\n if (descriptorObject) {\n // We have to also overwrite a getter.\n installSetterAndGetter(object, name, this.originalSetters_[key],\n getOwnPropertyDescriptor(descriptorObject, name).get);\n } else {\n installSetter(object, name, this.originalSetters_[key]);\n }\n delete this.originalSetters_[key];\n }\n\n /**\n * Restores the original method of an object, as encountered during install().\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @private\n */\n restoreFunction_(object, name) {\n const key = this.getKey_(object, name);\n if (!this.originalSetters_[key]) {\n throw new Error(\n // eslint-disable-next-line max-len\n `TrustedTypesEnforcer: Cannot restore (double uninstallation?): ${key} ${name}`);\n }\n installFunction(object, name, this.originalSetters_[key]);\n delete this.originalSetters_[key];\n }\n\n /**\n * Returns the key name for caching original setters.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @return {string} Key name.\n * @private\n */\n getKey_(object, name) {\n // TODO(msamuel): Can we use Object.prototype.toString.call(object)\n // to get an unspoofable string here?\n // TODO(msamuel): fail on '-' in object.constructor.name?\n // No Function.name in IE 11\n const ctrName = '' + (\n object.constructor.name ?\n object.constructor.name :\n object.constructor);\n return ctrName + '-' + name;\n }\n\n\n /**\n * Calls a default policy.\n * @param {string} typeName Type name to attempt to produce from a value.\n * @param {*} value The value to pass to a default policy\n * @param {string} sink The sink name that the default policy will be called\n * with.\n * @throws {Error} If the default policy throws, or not exist.\n * @return {Function} The trusted value.\n */\n maybeCallDefaultPolicy_(typeName, value, sink = '') {\n // Apply a fallback policy, if it exists.\n const fallbackPolicy = TrustedTypes.defaultPolicy;\n if (!fallbackPolicy) {\n throw new Error('Default policy does not exist');\n }\n if (!TYPE_CHECKER_MAP.hasOwnProperty(typeName)) {\n throw new Error();\n }\n return fallbackPolicy[TYPE_PRODUCER_MAP[typeName]](value, '' + sink);\n }\n\n /**\n * Logs and enforces TrustedTypes depending on the given configuration.\n * @template T\n * @param {!Object} context The object that the setter is called for.\n * @param {string} propertyName The name of the property.\n * @param {!Function} typeToEnforce The type to enforce.\n * @param {function(?):T} originalSetter Original setter.\n * @param {number} argNumber Number of argument to enforce the type of.\n * @param {Array} args Arguments.\n * @return {T}\n * @private\n */\n enforce_(context, propertyName, typeToEnforce, originalSetter, argNumber,\n args) {\n const value = args[argNumber];\n const typeName = '' + typeToEnforce.name;\n // If typed value is given, pass through.\n if (TYPE_CHECKER_MAP.hasOwnProperty(typeName) &&\n TYPE_CHECKER_MAP[typeName](value)) {\n if (stringifyForRangeHack &&\n propertyName == 'createContextualFragment') {\n // IE 11 hack, somehow the value is not stringified implicitly.\n args[argNumber] = args[argNumber].toString();\n }\n return apply(originalSetter, context, args);\n }\n\n if (typeToEnforce === TrustedTypes.TrustedScript) {\n const isInlineEventHandler =\n propertyName == 'setAttribute' ||\n propertyName === 'setAttributeNS' ||\n apply(slice, propertyName, [0, 2]) === 'on';\n // If a function (instead of string) is passed to inline event attribute,\n // or set(Timeout|Interval), pass through.\n const propertyAcceptsFunctions =\n propertyName === 'setInterval' ||\n propertyName === 'setTimeout' ||\n isInlineEventHandler;\n if ((propertyAcceptsFunctions && typeof value === 'function') ||\n (isInlineEventHandler && value === null)) {\n return apply(originalSetter, context, args);\n }\n }\n\n // Apply a fallback policy, if it exists.\n let fallbackValue;\n let exceptionThrown;\n const objName = context instanceof Element ?\n context.localName :\n getConstructorName_(context ? context.constructor : window.constructor);\n try {\n fallbackValue = this.maybeCallDefaultPolicy_(\n typeName, value, objName + '.' + propertyName);\n } catch (e) {\n exceptionThrown = true;\n }\n if (!exceptionThrown) {\n args[argNumber] = fallbackValue;\n return apply(originalSetter, context, args);\n }\n\n // This will throw a TypeError if enforcement is enabled.\n this.processViolation_(context, propertyName, typeToEnforce, value);\n\n return apply(originalSetter, context, args);\n }\n\n /**\n * Report a TT violation.\n * @param {!Object} context The object that the setter is called for.\n * @param {string} propertyName The name of the property.\n * @param {!Function} typeToEnforce The type to enforce.\n * @param {string} value The value that was violated the restrictions.\n * @throws {TypeError} if the enforcement is enabled.\n */\n processViolation_(context, propertyName, typeToEnforce, value) {\n const contextName = getConstructorName_(context.constructor) ||\n '' + context;\n const message = `Failed to set ${propertyName} on ${contextName}: `\n + `This property requires ${typeToEnforce.name}.`;\n\n if (this.config_.isLoggingEnabled) {\n // eslint-disable-next-line no-console\n console.warn(message, propertyName, context, typeToEnforce, value);\n }\n\n // Unconditionally dispatch an event.\n if (typeof SecurityPolicyViolationEvent == 'function') {\n let blockedURI = '';\n if (typeToEnforce === TrustedTypes.TrustedURL ||\n typeToEnforce === TrustedTypes.TrustedScriptURL) {\n blockedURI = parseUrl_(value) || '';\n if (blockedURI) {\n blockedURI = blockedURI.href;\n }\n }\n const valueSlice = apply(slice, '' + value, [0, 40]);\n const event = new SecurityPolicyViolationEvent(\n 'securitypolicyviolation',\n {\n 'bubbles': true,\n 'blockedURI': blockedURI,\n 'disposition': this.config_.isEnforcementEnabled ?\n 'enforce' : 'report',\n 'documentURI': document.location.href,\n 'effectiveDirective': DIRECTIVE_NAME,\n 'originalPolicy': this.config_.cspString,\n 'statusCode': 0,\n 'violatedDirective': DIRECTIVE_NAME,\n 'sample': `${contextName}.${propertyName} ${valueSlice}`,\n });\n if (context instanceof Node && context.isConnected) {\n context.dispatchEvent(event);\n } else { // Fallback - dispatch an event on base document.\n document.dispatchEvent(event);\n }\n }\n\n if (this.config_.isEnforcementEnabled) {\n throw new TypeError(message);\n }\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that only defines the types\n * (i.e. no enforcement logic).\n */\nimport {trustedTypes, TrustedTypePolicy, TrustedTypePolicyFactory} from\n '../trustedtypes.js';\n\nconst tt = trustedTypes;\n\n/**\n * Sets up the public Trusted Types API in the global object.\n */\nfunction setupPolyfill() {\n // We use array accessors to make sure Closure compiler will not alter the\n // names of the properties..\n if (typeof window === 'undefined') {\n return;\n }\n const rootProperty = 'trustedTypes';\n\n // Convert old window.TrustedTypes to window.trustedTypes.\n if (window['TrustedTypes'] && typeof window[rootProperty] === 'undefined') {\n window[rootProperty] = Object.freeze(window['TrustedTypes']);\n }\n\n if (typeof window[rootProperty] !== 'undefined') {\n return;\n }\n\n const publicApi = Object.create(TrustedTypePolicyFactory.prototype);\n Object.assign(publicApi, {\n 'isHTML': tt.isHTML,\n 'isURL': tt.isURL,\n 'isScriptURL': tt.isScriptURL,\n 'isScript': tt.isScript,\n 'createPolicy': tt.createPolicy,\n 'getPolicyNames': tt.getPolicyNames,\n 'getAttributeType': tt.getAttributeType,\n 'getPropertyType': tt.getPropertyType,\n 'getTypeMapping': tt.getTypeMapping,\n 'emptyHTML': tt.emptyHTML,\n '_isPolyfill_': true,\n });\n Object.defineProperty(\n publicApi,\n 'defaultPolicy',\n Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {});\n\n window[rootProperty] = Object.freeze(publicApi);\n\n window['TrustedHTML'] = tt.TrustedHTML;\n window['TrustedURL'] = tt.TrustedURL;\n window['TrustedScriptURL'] = tt.TrustedScriptURL;\n window['TrustedScript'] = tt.TrustedScript;\n window['TrustedTypePolicy'] = TrustedTypePolicy;\n window['TrustedTypePolicyFactory'] = TrustedTypePolicyFactory;\n}\n\nsetupPolyfill();\n\nexport default tt;\n"]} \ No newline at end of file +{"version":3,"sources":[" [synthetic:es6/util/arrayiterator] "," [synthetic:util/defineproperty] "," [synthetic:util/global] "," [synthetic:es6/symbol] "," [synthetic:es6/util/makeiterator] "," [synthetic:es6/util/arrayfromiterator] "," [synthetic:util/objectcreate] "," [synthetic:es6/util/setprototypeof] "," [synthetic:es6/util/inherits] "," [synthetic:util/owns] "," [synthetic:util/polyfill] "," [synthetic:es6/weakmap] "," [synthetic:es6/object/entries] "," [synthetic:es6/object/is] "," [synthetic:es6/array/includes] "," [synthetic:es6/util/assign] "," [synthetic:es6/object/assign] ","src/data/trustedtypeconfig.js","src/polyfill/full.js","src/trustedtypes.js"," [synthetic:es6/util/arrayfromiterable] ","src/utils/wrapper.js","src/enforcer.js","src/polyfill/api_only.js"],"names":["$jscomp.defineProperty","$jscomp.global","$jscomp.initSymbol","$jscomp.Symbol","$jscomp.SymbolClass","$jscomp.SYMBOL_PREFIX","$jscomp.arrayIteratorImpl","$jscomp.objectCreate","$jscomp.setPrototypeOf","$jscomp.polyfill","$jscomp.makeIterator","$jscomp.owns","$jscomp.assign","constructor","TrustedTypeConfig","isLoggingEnabled","isEnforcementEnabled","allowedPolicyNames","cspString","parseCSP","WHITESPACE","trim","split","SEMICOLON","map","serializedDirective","reduce","parsed","directive","slice","s","sort","fromCSP","csp","policy","TrustedTypeConfig$$module$src$data$trustedtypeconfig.parseCSP","enforce","DIRECTIVE_NAME","policies","filter","p","charAt","rejectInputFn","TypeError","String","prototype","toLowerCase","toUpperCase","TrustedTypePolicy","TrustedTypePolicyFactory","trustedTypesBuilderTestOnly","TrustedScript","TrustedHTML","TrustedScriptURL","TrustedURL","TrustedType","policyName","creatorSymbol","Error","defineProperty","value","enumerable","privates","obj","v","privateMap","get","undefined","create","set","selfContained","collection","proto","getPrototypeOf","ObjectPrototype","getOwnPropertyNames","key","lockdownTrustedType","SubClass","canonName","freeze","name","isTrustedTypeChecker","type","has","wrapPolicy","innerPolicy","creator","Ctor","methodName","method","policySpecificType","factory","args","result","$jscomp.arrayFromIterator","allowedValue","o","createTypeMapping","writable","configurable","getTypeInternal_","tag","container","elNs","attrNs","canonicalTag","apply","ns","HTML_NS","hasOwnProperty","TYPE_MAP","getDefaultPolicy","defaultPolicy","Object","assign","Array","forEach","push","Symbol","WeakMap","policyNames","allowedNames","enforceNameWhitelist","toString","valueOf","$jscomp.inherits","emptyHTML","XLINK_NS","SVG_NS","ATTR_PROPERTY_MAP","HTMLIFrameElement","keys","attr","HTMLElement","createFunctionAllowed","api","createPolicy","indexOf","call","console","warn","wrappedPolicy","DEFAULT_POLICY_NAME","getPolicyNames","isHTML","isURL","isScriptURL","isScript","getAttributeType","tagName","attribute","elementNs","attributeNs","canonicalAttr","getPropertyType","property","getTypeMapping","namespaceUri","document","documentElement","namespaceURI","e","JSON","parse","stringify","trustedTypes","setAllowedPolicyNames","length","el","resetDefaultPolicy","splice","installFunction","object","fn","Reflect","getOwnPropertyDescriptor","UrlConstructor","window","URL","stringifyForRangeHack","getConstructorName_","createElement","match","windowOpenObject","insertAdjacentObject","Element","SecurityPolicyViolationEvent","typeMap","TrustedTypes","STRING_TO_TYPE","attrs","entries","k","TYPE_CHECKER_MAP","TYPE_PRODUCER_MAP","TrustedTypesEnforcer","config_","config","originalSetters_","install","trustedTypesEnforcer","wrapSetter_","ShadowRoot","doc","createRange","r","createContextualFragment","f","childNodes","wrapWithEnforceFunction_","Range","Document","HTMLDocument","DOMParser","wrapSetAttribute_","installScriptMutatorGuards_","installPropertySetWrappers_","fnName","wrapFunction_","Node","originalFn","that","enforceTypeInScriptNodes_","bind","insertAdjacentTextWrapper_","setAttributeWrapper_","setAttributeNSWrapper_","context","attrName","requiredType","enforce_","checkParent","objToCheck","parentNode","HTMLScriptElement","argNumber","arg","nodeType","TEXT_NODE","textContent","createTextNode","fallbackValue","exceptionThrown","maybeCallDefaultPolicy_","processViolation_","riskyPositions","parentElement","includes","textNode","insertBefore","getKey_","nextSibling","functionBody","descriptor","Function","enforcingSetter","originalSetter","useObject","stopAt","typeName","sink","fallbackPolicy","propertyName","typeToEnforce","isInlineEventHandler","objName","localName","contextName","message","blockedURI","baseURI","href","valueSlice","event","location","isConnected","dispatchEvent","publicApi","tt","detectPolicy","currentScript","scripts","getElementsByTagName","bodyPrefix","substr","dataset","cspInMeta","head","querySelector","rootProperty","TrustedTypeConfig$$module$src$data$trustedtypeconfig.fromCSP"],"mappings":"A;;;;;;;;AA2B4B,QAAA,GAAQ,CAAC,CAAD,CAAQ,CAC1C,IAAI,EAAQ,CACZ,OAAO,SAAQ,EAAG,CAChB,MAAI,EAAJ,CAAY,CAAA,OAAZ,CACS,CACL,KAAM,CAAA,CADD,CAEL,MAAO,CAAA,CAAM,CAAA,EAAN,CAFF,CADT,CAMS,CAAC,KAAM,CAAA,CAAP,CAPO,CAFw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,CAAA,CA1BE,IAAMjQ,GAAMuP,EAAA,EAAZ,CACMlF,GAASrK,EAAA,CAAMkQ,EAAA,EAAN,CAAuC,IAAIrR,EAAJ,CAC3B,CAAA,CAD2B,CAEvB,CAAA,CAFuB,CAGzB,CAAC,GAAD,CAHyB,CAOtD0L,GAAA,EAkBF","file":"trustedtypes.build.js","sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * CSP Directive name controlling Trusted Types behavior.\n * @type {string}\n */\nexport const DIRECTIVE_NAME = 'trusted-types';\n\n/**\n * A configuration object for trusted type enforcement.\n */\nexport class TrustedTypeConfig {\n /**\n * @param {boolean} isLoggingEnabled If true enforcement wrappers will log\n * violations to the console.\n * @param {boolean} isEnforcementEnabled If true enforcement is enabled at\n * runtime.\n * @param {Array} allowedPolicyNames Whitelisted policy names.\n * @param {?string} cspString String with the CSP policy.\n */\n constructor(isLoggingEnabled,\n isEnforcementEnabled,\n allowedPolicyNames,\n cspString = null) {\n /**\n * True if logging is enabled.\n * @type {boolean}\n */\n this.isLoggingEnabled = isLoggingEnabled;\n\n /**\n * True if enforcement is enabled.\n * @type {boolean}\n */\n this.isEnforcementEnabled = isEnforcementEnabled;\n\n /**\n * Allowed policy names.\n * @type {Array}\n */\n this.allowedPolicyNames = allowedPolicyNames;\n\n /**\n * CSP string that defined the policy.\n * @type {?string}\n */\n this.cspString = cspString;\n }\n\n /**\n * Parses a CSP policy.\n * @link https://www.w3.org/TR/CSP3/#parse-serialized-policy\n * @param {string} cspString String with a CSP definition.\n * @return {Object>} Parsed CSP, keyed by directive\n * names.\n */\n static parseCSP(cspString) {\n const SEMICOLON = /\\s*;\\s*/;\n const WHITESPACE = /\\s+/;\n return cspString.trim().split(SEMICOLON)\n .map((serializedDirective) => serializedDirective.split(WHITESPACE))\n .reduce(function(parsed, directive) {\n if (directive[0]) {\n parsed[directive[0]] = directive.slice(1).map((s) => s).sort();\n }\n return parsed;\n }, {});\n }\n\n /**\n * Creates a TrustedTypeConfig object from a CSP string.\n * @param {string} cspString\n * @return {!TrustedTypeConfig}\n */\n static fromCSP(cspString) {\n const isLoggingEnabled = true;\n const policy = TrustedTypeConfig.parseCSP(cspString);\n const enforce = DIRECTIVE_NAME in policy;\n let policies = ['*'];\n if (enforce) {\n policies = policy[DIRECTIVE_NAME].filter((p) => p.charAt(0) !== '\\'');\n }\n\n return new TrustedTypeConfig(\n isLoggingEnabled,\n enforce, /* isEnforcementEnabled */\n policies, /* allowedPolicyNames */\n cspString\n );\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that enforces the types.\n */\nimport {TrustedTypesEnforcer} from '../enforcer.js';\nimport {TrustedTypeConfig} from '../data/trustedtypeconfig.js';\n// import and setup trusted types\nimport './api_only.js';\n\n/* eslint-enable no-unused-vars */\n\n/**\n * Tries to guess a CSP policy from:\n * - the current polyfill script element text content (if prefixed with\n * \"Content-Security-Policy:\")\n * - the data-csp attribute value of the current script element.\n * - meta header\n * @return {?string} Guessed CSP value, or null.\n */\nfunction detectPolicy() {\n try {\n const currentScript = document.currentScript || (function() {\n const scripts = document.getElementsByTagName('script');\n return scripts[scripts.length - 1];\n })();\n\n const bodyPrefix = 'Content-Security-Policy:';\n if (currentScript &&\n currentScript.textContent.trim().substr(0, bodyPrefix.length) ==\n bodyPrefix) {\n return currentScript.textContent.trim().slice(bodyPrefix.length);\n }\n if (currentScript.dataset['csp']) {\n return currentScript.dataset['csp'];\n }\n const cspInMeta = document.head.querySelector(\n 'meta[http-equiv^=\"Content-Security-Policy\"]');\n if (cspInMeta) {\n return cspInMeta['content'].trim();\n }\n } catch (e) {\n return null;\n }\n return null;\n}\n\n/**\n * Bootstraps all trusted types polyfill and their enforcement.\n */\nexport function bootstrap() {\n const csp = detectPolicy();\n const config = csp ? TrustedTypeConfig.fromCSP(csp) : new TrustedTypeConfig(\n /* isLoggingEnabled */ false,\n /* isEnforcementEnabled */ false,\n /* allowedPolicyNames */ ['*']);\n\n const trustedTypesEnforcer = new TrustedTypesEnforcer(config);\n\n trustedTypesEnforcer.install();\n}\n\n/**\n * Determines if the enforcement should be enabled.\n * @return {boolean}\n */\nfunction shouldBootstrap() {\n for (const rootProperty of ['trustedTypes', 'TrustedTypes']) {\n if (window[rootProperty] && !window[rootProperty]['_isPolyfill_']) {\n // Native implementation exists\n return false;\n }\n }\n return true;\n}\n\n// Bootstrap only if native implementation is missing.\nif (shouldBootstrap()) {\n bootstrap();\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst rejectInputFn = (s) => {\n throw new TypeError('undefined conversion');\n};\n\nconst {toLowerCase, toUpperCase} = String.prototype;\n\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @constructor\n * @property {!function(string):TrustedHTML} createHTML\n * @property {!function(string):TrustedURL} createURL\n * @property {!function(string):TrustedScriptURL} createScriptURL\n * @property {!function(string):TrustedScript} createScript\n * @property {!string} name\n */\nexport const TrustedTypePolicy = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/**\n * @constructor\n */\nexport const TrustedTypePolicyFactory = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypesInnerPolicy}\n * @property {function(string):string} createHTML\n * @property {function(string):string} createURL\n * @property {function(string):string} createScriptURL\n * @property {function(string):string} createScript\n */\nconst TrustedTypesInnerPolicy = {};\n\n/**\n * @typedef {!Object,\n * properties: !Object}>}\n */\nconst TrustedTypesTypeMap = {};\n/* eslint-enable no-unused-vars */\n\nexport const DEFAULT_POLICY_NAME = 'default';\n\n\nexport const trustedTypesBuilderTestOnly = function() {\n // Capture common names early.\n const {\n assign, create, defineProperty, freeze, getOwnPropertyNames,\n getPrototypeOf, prototype: ObjectPrototype,\n } = Object;\n\n const {hasOwnProperty} = ObjectPrototype;\n\n const {\n forEach, push,\n } = Array.prototype;\n\n const creatorSymbol = Symbol();\n\n /**\n * Getter for the privateMap.\n * @param {Object} obj Key of the privateMap\n * @return {Object} Private storage.\n */\n const privates = function(obj) {\n let v = privateMap.get(obj);\n if (v === undefined) {\n v = create(null); // initialize the private storage.\n privateMap.set(obj, v);\n }\n return v;\n };\n\n /**\n * Called before attacker-controlled code on an internal collections,\n * copies prototype members onto the instance directly, so that later\n * changes to prototypes cannot expose collection internals.\n * @param {!T} collection\n * @return {!T} collection\n * @template T\n */\n function selfContained(collection) {\n const proto = getPrototypeOf(collection);\n if (proto == null || getPrototypeOf(proto) !== ObjectPrototype) {\n throw new Error(); // Loop below is insufficient.\n }\n for (const key of getOwnPropertyNames(proto)) {\n defineProperty(collection, key, {value: collection[key]});\n }\n return collection;\n }\n\n /**\n * Map for private properties of Trusted Types object.\n * This is so that the access to the type constructor does not give\n * the ability to create typed values.\n * @type {WeakMap}\n */\n const privateMap = selfContained(new WeakMap());\n\n /**\n * List of all configured policy names.\n * @type {Array}\n */\n const policyNames = selfContained([]);\n\n /**\n * Allowed policy namess for policy names.\n * @type {Array}\n */\n const allowedNames = selfContained([]);\n\n /**\n * A reference to a default policy, if created.\n * @type {TrustedTypePolicy}\n */\n let defaultPolicy = null;\n\n /**\n * Whether to enforce allowedNames in createPolicy().\n * @type {boolean}\n */\n let enforceNameWhitelist = false;\n\n\n /**\n * A value that is trusted to have certain security-relevant properties\n * because the sources of such values are controlled.\n */\n class TrustedType {\n /**\n * Constructor for TrustedType. Only allowed to be called from within a\n * policy.\n * @param {symbol} s creatorSymbol\n * @param {string} policyName The name of the policy this object was\n * created by.\n */\n constructor(s, policyName) {\n // TODO: Figure out if symbol is needed, if the value is in privateMap.\n if (s !== creatorSymbol) {\n throw new Error('cannot call the constructor');\n }\n defineProperty(this, 'policyName',\n {value: '' + policyName, enumerable: true});\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n toString() {\n return privates(this)['v'];\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n valueOf() {\n return privates(this)['v'];\n }\n }\n\n /**\n * @param {function(new:TrustedType, symbol, string)} SubClass\n * @param {string} canonName The class name which should be independent of\n * any renaming pass and which is relied upon by the enforcer and for\n * native type interop.\n */\n function lockdownTrustedType(SubClass, canonName) {\n freeze(SubClass.prototype);\n delete SubClass.name;\n defineProperty(SubClass, 'name', {value: canonName});\n }\n\n /**\n * Trusted URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedURL extends TrustedType {\n }\n lockdownTrustedType(TrustedURL, 'TrustedURL');\n\n /**\n * Trusted Script URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScriptURL extends TrustedType {\n }\n lockdownTrustedType(TrustedScriptURL, 'TrustedScriptURL');\n\n /**\n * Trusted HTML object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedHTML extends TrustedType {\n }\n lockdownTrustedType(TrustedHTML, 'TrustedHTML');\n\n /**\n * Trusted Script object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScript extends TrustedType {\n }\n lockdownTrustedType(TrustedScript, 'TrustedScript');\n\n lockdownTrustedType(TrustedType, 'TrustedType');\n\n // Common constants.\n const emptyHTML = freeze(create(new TrustedHTML(creatorSymbol, '')));\n privates(emptyHTML)['v'] = '';\n\n /**\n * A map of attribute / property names to allowed types\n * for known namespaces.\n * @type {!Object}\n * @export\n */\n const TYPE_MAP = {\n [HTML_NS]: {\n // TODO(koto): Figure out what to to with \n 'A': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'AREA': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BASE': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BUTTON': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'EMBED': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n },\n },\n 'FORM': {\n 'attributes': {\n 'action': TrustedURL.name,\n },\n },\n 'FRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n },\n },\n 'IFRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n 'srcdoc': TrustedHTML.name,\n },\n },\n 'INPUT': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'OBJECT': {\n 'attributes': {\n 'data': TrustedScriptURL.name,\n 'codebase': TrustedScriptURL.name,\n },\n },\n // TODO(koto): Figure out what to do with portals.\n 'SCRIPT': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n 'text': TrustedScript.name,\n },\n 'properties': {\n 'innerText': TrustedScript.name,\n 'textContent': TrustedScript.name,\n 'text': TrustedScript.name,\n },\n },\n '*': {\n 'attributes': {},\n 'properties': {\n 'innerHTML': TrustedHTML.name,\n 'outerHTML': TrustedHTML.name,\n },\n },\n },\n [XLINK_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n [SVG_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n };\n\n /**\n * A map of element property to HTML attribute names.\n * @type {!Object}\n */\n const ATTR_PROPERTY_MAP = {\n 'codebase': 'codeBase',\n 'formaction': 'formAction',\n };\n\n // Edge doesn't support srcdoc.\n if (!('srcdoc' in HTMLIFrameElement.prototype)) {\n delete TYPE_MAP[HTML_NS]['IFRAME']['attributes']['srcdoc'];\n }\n\n // in HTML, clone attributes into properties.\n for (const tag of Object.keys(TYPE_MAP[HTML_NS])) {\n if (!TYPE_MAP[HTML_NS][tag]['properties']) {\n TYPE_MAP[HTML_NS][tag]['properties'] = {};\n }\n for (const attr of Object.keys(TYPE_MAP[HTML_NS][tag]['attributes'])) {\n TYPE_MAP[HTML_NS][tag]['properties'][\n ATTR_PROPERTY_MAP[attr] ? ATTR_PROPERTY_MAP[attr] : attr\n ] = TYPE_MAP[HTML_NS][tag]['attributes'][attr];\n }\n }\n\n // Add inline event handlers attribute names.\n for (const name of getOwnPropertyNames(HTMLElement.prototype)) {\n if (name.slice(0, 2) === 'on') {\n TYPE_MAP[HTML_NS]['*']['attributes'][name] = 'TrustedScript';\n }\n }\n\n /**\n * @type {!Object}\n */\n const createTypeMapping = {\n 'createHTML': TrustedHTML,\n 'createScriptURL': TrustedScriptURL,\n 'createURL': TrustedURL,\n 'createScript': TrustedScript,\n };\n\n const createFunctionAllowed = createTypeMapping.hasOwnProperty;\n\n /**\n * Function generating a type checker.\n * @template T\n * @param {T} type The type to check against.\n * @return {function(*):boolean}\n */\n function isTrustedTypeChecker(type) {\n return (obj) => (obj instanceof type) && privateMap.has(obj);\n }\n\n /**\n * Wraps a user-defined policy rules with TT constructor\n * @param {string} policyName The policy name\n * @param {TrustedTypesInnerPolicy} innerPolicy InnerPolicy\n * @return {!TrustedTypePolicy} Frozen policy object\n */\n function wrapPolicy(policyName, innerPolicy) {\n /**\n * @template T\n * @param {function(new:T, symbol, string)} Ctor a trusted type constructor\n * @param {string} methodName the policy factory method name\n * @return {function(string):!T} a factory that produces instances of Ctor.\n */\n function creator(Ctor, methodName) {\n // This causes thisValue to be null when called below.\n const method = innerPolicy[methodName] || rejectInputFn;\n const policySpecificType = freeze(new Ctor(creatorSymbol, policyName));\n const factory = {\n [methodName](s, ...args) {\n // Trick to get methodName to show in stacktrace.\n let result = method('' + s, ...args);\n if (result === undefined || result === null) {\n result = '';\n }\n const allowedValue = '' + result;\n const o = freeze(create(policySpecificType));\n privates(o)['v'] = allowedValue;\n return o;\n },\n }[methodName];\n return freeze(factory);\n }\n\n const policy = create(TrustedTypePolicy.prototype);\n\n for (const name of getOwnPropertyNames(createTypeMapping)) {\n policy[name] = creator(createTypeMapping[name], name);\n }\n defineProperty(policy, 'name', {\n value: policyName,\n writable: false,\n configurable: false,\n enumerable: true,\n });\n\n return /** @type {!TrustedTypePolicy} */ (freeze(policy));\n }\n\n /**\n * Returns the name of the trusted type required for a given element\n * attribute.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} attribute The name of the attribute.\n * @param {string=} elementNs Element namespace.\n * @param {string=} attributeNs The attribute namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getAttributeType(tagName, attribute, elementNs = '',\n attributeNs = '') {\n const canonicalAttr = toLowerCase.apply(String(attribute));\n return getTypeInternal_(tagName, 'attributes', canonicalAttr,\n elementNs, attributeNs);\n }\n\n /**\n * Returns a type name from a type map.\n * @param {string} tag A tag name.\n * @param {string} container 'attributes' or 'properties'\n * @param {string} name The attribute / property name.\n * @param {string=} elNs Element namespace.\n * @param {string=} attrNs Attribute namespace.\n * @return {string|undefined}\n * @private\n */\n function getTypeInternal_(tag, container, name, elNs = '', attrNs = '') {\n const canonicalTag = toUpperCase.apply(String(tag));\n\n let ns = attrNs ? attrNs : elNs;\n if (!ns) {\n ns = HTML_NS;\n }\n const map = hasOwnProperty.apply(TYPE_MAP, [ns]) ? TYPE_MAP[ns] : null;\n if (!map) {\n return;\n }\n if (hasOwnProperty.apply(map, [canonicalTag]) &&\n map[canonicalTag] &&\n hasOwnProperty.apply(map[canonicalTag][container], [name]) &&\n map[canonicalTag][container][name]) {\n return map[canonicalTag][container][name];\n }\n\n if (hasOwnProperty.apply(map, ['*']) &&\n hasOwnProperty.apply(map['*'][container], [name]) &&\n map['*'][container][name]) {\n return map['*'][container][name];\n }\n }\n\n /**\n * Returns the name of the trusted type required for a given element property.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} property The property.\n * @param {string=} elementNs Element namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getPropertyType(tagName, property, elementNs = '') {\n // TODO: Support namespaces.\n return getTypeInternal_(tagName, 'properties', String(property), elementNs);\n }\n\n /**\n * Returns the type map-like object, that resolves a name of a type for a\n * given tag + attribute / property in a given namespace.\n * The keys of the map are uppercase tag names. Map entry has mappings between\n * a lowercase attribute name / case-sensitive property name and a name of the\n * type that is required for that attribute / property.\n * Example entry for 'IMG': {\"attributes\": {\"src\": \"TrustedHTML\"}}\n * @param {string=} namespaceUri The namespace URI (will use the current\n * document namespace URI if omitted).\n * @return {TrustedTypesTypeMap}\n */\n function getTypeMapping(namespaceUri = '') {\n if (!namespaceUri) {\n try {\n namespaceUri = document.documentElement.namespaceURI;\n } catch (e) {\n namespaceUri = HTML_NS;\n }\n }\n /**\n * @template T\n * @private\n * @param {T} o\n * @return {T}\n */\n function deepClone(o) {\n return JSON.parse(JSON.stringify(o));\n }\n const map = TYPE_MAP[namespaceUri];\n if (!map) {\n return {};\n }\n return deepClone(map);\n }\n\n /**\n * Returns all configured policy names (even for non-exposed policies).\n * @return {!Array}\n */\n function getPolicyNames() {\n // TODO(msamuel): Should we sort policyNames to avoid leaking or\n // encouraging dependency on the order in which policy names are\n // registered? I think JavaScript builtin sorts are efficient for\n // almost-sorted lists so the amortized cost is close to O(n).\n return policyNames.slice();\n }\n\n /**\n * Creates a TT policy.\n *\n * Returns a frozen object representing a policy - a collection of functions\n * that may create TT objects based on the user-provided rules specified\n * in the policy object.\n *\n * @param {string} name A unique name of the policy.\n * @param {TrustedTypesInnerPolicy} policy Policy rules object.\n * @return {TrustedTypePolicy} The policy that may create TT objects\n * according to the policy rules.\n */\n function createPolicy(name, policy) {\n const pName = '' + name; // Assert it's a string\n\n if (enforceNameWhitelist && allowedNames.indexOf(pName) === -1) {\n throw new TypeError('Policy ' + pName + ' disallowed.');\n }\n\n if (policyNames.indexOf(pName) !== -1) {\n throw new TypeError('Policy ' + pName + ' exists.');\n }\n // Register the name early so that if policy getters unwisely calls\n // across protection domains to code that reenters this function,\n // policy author still has rights to the name.\n policyNames.push(pName);\n\n // Only copy own properties of names present in createTypeMapping.\n const innerPolicy = create(null);\n if (policy && typeof policy === 'object') {\n // Treat non-objects as empty policies.\n for (const key of getOwnPropertyNames(policy)) {\n if (createFunctionAllowed.call(createTypeMapping, key)) {\n innerPolicy[key] = policy[key];\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn('trustedTypes.createPolicy ' + pName +\n ' was given an empty policy');\n }\n freeze(innerPolicy);\n\n const wrappedPolicy = wrapPolicy(pName, innerPolicy);\n\n if (pName === DEFAULT_POLICY_NAME) {\n defaultPolicy = wrappedPolicy;\n }\n\n return wrappedPolicy;\n }\n\n /**\n * Applies the policy name whitelist.\n * @param {!Array} allowedPolicyNames\n */\n function setAllowedPolicyNames(allowedPolicyNames) {\n if (allowedPolicyNames.indexOf('*') !== -1) { // Any policy name is allowed.\n enforceNameWhitelist = false;\n } else {\n enforceNameWhitelist = true;\n allowedNames.length = 0;\n forEach.call(allowedPolicyNames, (el) => {\n push.call(allowedNames, '' + el);\n });\n }\n }\n\n /**\n * Returns the default policy, or null if it was not created.\n * @return {TrustedTypePolicy}\n */\n function getDefaultPolicy() {\n return defaultPolicy;\n }\n\n /**\n * Resets the default policy.\n */\n function resetDefaultPolicy() {\n defaultPolicy = null;\n policyNames.splice(policyNames.indexOf(DEFAULT_POLICY_NAME), 1);\n }\n\n const api = create(TrustedTypePolicyFactory.prototype);\n assign(api, {\n // The main function to create policies.\n createPolicy,\n\n getPolicyNames,\n\n // Type checkers, also validating the object was initialized through a\n // policy.\n isHTML: isTrustedTypeChecker(TrustedHTML),\n isURL: isTrustedTypeChecker(TrustedURL),\n isScriptURL: isTrustedTypeChecker(TrustedScriptURL),\n isScript: isTrustedTypeChecker(TrustedScript),\n\n getAttributeType,\n getPropertyType,\n getTypeMapping,\n emptyHTML,\n defaultPolicy, // Just to make the compiler happy, this is overridden below.\n\n TrustedHTML: TrustedHTML,\n TrustedURL: TrustedURL,\n TrustedScriptURL: TrustedScriptURL,\n TrustedScript: TrustedScript,\n });\n\n defineProperty(api, 'defaultPolicy', {\n get: getDefaultPolicy,\n set: () => {},\n });\n\n return {\n trustedTypes: freeze(api),\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n };\n};\n\n\nexport const {\n trustedTypes,\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n} = trustedTypesBuilderTestOnly();\n\n",null,"/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst {\n defineProperty,\n} = Object;\n\n/**\n * Installs the setter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} setter A setter function}\n */\nexport function installSetter(object, name, setter) {\n const descriptor = {\n set: setter,\n };\n defineProperty(object, name, descriptor);\n}\n\n/**\n * Installs a setter and getter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} setter A setter function}\n * @param {function(*): *|undefined} getter A getter function}\n */\nexport function installSetterAndGetter(object, name, setter, getter) {\n const descriptor = {\n set: setter,\n get: getter,\n configurable: true, // This can get uninstalled, we need configurable: true\n };\n defineProperty(object, name, descriptor);\n}\n\n/**\n * Installs the setter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} fn A function}\n */\nexport function installFunction(object, name, fn) {\n defineProperty(object, name, {\n value: fn,\n });\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n// TrustedTypeConfig is used only as jsdoc type\n// eslint-disable-next-line\nimport {DIRECTIVE_NAME, TrustedTypeConfig} from './data/trustedtypeconfig.js';\nimport {\n trustedTypes as TrustedTypes,\n setAllowedPolicyNames,\n resetDefaultPolicy,\n HTML_NS,\n} from\n './trustedtypes.js';\n\nimport {installFunction, installSetter, installSetterAndGetter}\n from './utils/wrapper.js';\n\nconst {apply} = Reflect;\nconst {\n getOwnPropertyNames,\n getOwnPropertyDescriptor,\n getPrototypeOf,\n} = Object;\n\nconst {\n hasOwnProperty,\n isPrototypeOf,\n} = Object.prototype;\n\nconst {slice} = String.prototype;\n\n// No URL in IE 11.\nconst UrlConstructor = typeof window.URL == 'function' ?\n URL.prototype.constructor :\n null;\n\nlet stringifyForRangeHack;\n\n/**\n * Return object constructor name\n * (their function.name is not available in IE 11).\n * @param {*} fn\n * @return {string}\n * @private\n */\nconst getConstructorName_ = document.createElement('div').constructor.name ?\n (fn) => fn.name :\n (fn) => ('' + fn).match(/^\\[object (\\S+)\\]$/)[1];\n\n// window.open on IE 11 is set on WindowPrototype\nconst windowOpenObject = getOwnPropertyDescriptor(window, 'open') ?\n window :\n window.constructor.prototype;\n\n// In IE 11, insertAdjacent(HTML|Text) is on HTMLElement prototype\nconst insertAdjacentObject = apply(hasOwnProperty, Element.prototype,\n ['insertAdjacentHTML']) ? Element.prototype : HTMLElement.prototype;\n\n// This is not available in release Firefox :(\n// https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent\n// https://bugzilla.mozilla.org/show_bug.cgi?id=1432523\nconst SecurityPolicyViolationEvent = window['SecurityPolicyViolationEvent'] ||\n null;\n\n/**\n * Parses URL, catching all the errors.\n * @param {string} url URL string to parse.\n * @return {URL|null}\n */\nfunction parseUrl_(url) {\n try {\n return new UrlConstructor(url, document.baseURI || undefined);\n } catch (e) {\n return null;\n }\n}\n\n// We don't actually need other namespaces.\n// setAttribute is hooked on Element.prototype, which all elements inherit from,\n// and all sensitive property wrappers are hooked directly on Element as well.\nconst typeMap = TrustedTypes.getTypeMapping(HTML_NS);\n\nconst STRING_TO_TYPE = {\n 'TrustedHTML': TrustedTypes.TrustedHTML,\n 'TrustedScript': TrustedTypes.TrustedScript,\n 'TrustedScriptURL': TrustedTypes.TrustedScriptURL,\n 'TrustedURL': TrustedTypes.TrustedURL,\n};\n\n/**\n * Converts an uppercase tag name to an element constructor function name.\n * Used for property setter hijacking only.\n * @param {string} tagName\n * @return {string}\n */\nfunction convertTagToConstructor(tagName) {\n if (tagName == '*') {\n return 'HTMLElement';\n }\n return getConstructorName_(document.createElement(tagName).constructor);\n}\n\nfor (const tagName of Object.keys(typeMap)) {\n const attrs = typeMap[tagName]['properties'];\n for (const [k, v] of Object.entries(attrs)) {\n attrs[k] = STRING_TO_TYPE[v];\n }\n}\n\n/**\n * Map of type names to type checking function.\n * @type {!Object}\n */\nconst TYPE_CHECKER_MAP = {\n 'TrustedHTML': TrustedTypes.isHTML,\n 'TrustedURL': TrustedTypes.isURL,\n 'TrustedScriptURL': TrustedTypes.isScriptURL,\n 'TrustedScript': TrustedTypes.isScript,\n};\n\n/**\n * Map of type names to type producing function.\n * @type {Object}\n */\nconst TYPE_PRODUCER_MAP = {\n 'TrustedHTML': 'createHTML',\n 'TrustedURL': 'createURL',\n 'TrustedScriptURL': 'createScriptURL',\n 'TrustedScript': 'createScript',\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypePolicy}\n * @property {function(string):TrustedHTML} createHTML\n * @property {function(string):TrustedURL} createURL\n * @property {function(string):TrustedScriptURL} createScriptURL\n * @property {function(string):TrustedScript} createScript\n */\nconst TrustedTypePolicy = {};\n/* eslint-enable no-unused-vars */\n\n\n/**\n * An object for enabling trusted type enforcement.\n */\nexport class TrustedTypesEnforcer {\n /**\n * @param {!TrustedTypeConfig} config The configuration for\n * trusted type enforcement.\n */\n constructor(config) {\n /**\n * A configuration for the trusted type enforcement.\n * @private {!TrustedTypeConfig}\n */\n this.config_ = config;\n /**\n * @private {Object}\n */\n this.originalSetters_ = {};\n }\n\n /**\n * Wraps HTML sinks with an enforcement setter, which will enforce\n * trusted types and do logging, if enabled.\n *\n */\n install() {\n setAllowedPolicyNames(this.config_.allowedPolicyNames);\n\n if (!this.config_.isEnforcementEnabled && !this.config_.isLoggingEnabled) {\n return;\n }\n\n if ('ShadowRoot' in window) {\n this.wrapSetter_(ShadowRoot.prototype, 'innerHTML',\n TrustedTypes.TrustedHTML);\n }\n stringifyForRangeHack = (function(doc) {\n const r = doc.createRange();\n // In IE 11 Range.createContextualFragment doesn't stringify its argument.\n const f = r.createContextualFragment(/** @type {string} */ (\n {toString: () => '
'}));\n return f.childNodes.length == 0;\n })(document);\n\n this.wrapWithEnforceFunction_(Range.prototype, 'createContextualFragment',\n TrustedTypes.TrustedHTML, 0);\n\n this.wrapWithEnforceFunction_(insertAdjacentObject,\n 'insertAdjacentHTML',\n TrustedTypes.TrustedHTML, 1);\n\n if (getOwnPropertyDescriptor(Document.prototype, 'write')) {\n // Chrome\n this.wrapWithEnforceFunction_(Document.prototype, 'write',\n TrustedTypes.TrustedHTML, 0);\n this.wrapWithEnforceFunction_(Document.prototype, 'open',\n TrustedTypes.TrustedURL, 0);\n } else {\n // Firefox\n this.wrapWithEnforceFunction_(HTMLDocument.prototype, 'write',\n TrustedTypes.TrustedHTML, 0);\n this.wrapWithEnforceFunction_(HTMLDocument.prototype, 'open',\n TrustedTypes.TrustedURL, 0);\n }\n\n this.wrapWithEnforceFunction_(windowOpenObject, 'open',\n TrustedTypes.TrustedURL, 0);\n\n if ('DOMParser' in window) {\n this.wrapWithEnforceFunction_(DOMParser.prototype, 'parseFromString',\n TrustedTypes.TrustedHTML, 0);\n }\n this.wrapWithEnforceFunction_(window, 'setInterval',\n TrustedTypes.TrustedScript, 0);\n this.wrapWithEnforceFunction_(window, 'setTimeout',\n TrustedTypes.TrustedScript, 0);\n this.wrapSetAttribute_();\n this.installScriptMutatorGuards_();\n this.installPropertySetWrappers_();\n }\n\n /**\n * Removes the original setters.\n */\n uninstall() {\n setAllowedPolicyNames(['*']);\n\n if (!this.config_.isEnforcementEnabled && !this.config_.isLoggingEnabled) {\n return;\n }\n\n if ('ShadowRoot' in window) {\n this.restoreSetter_(ShadowRoot.prototype, 'innerHTML');\n }\n this.restoreFunction_(Range.prototype, 'createContextualFragment');\n this.restoreFunction_(insertAdjacentObject, 'insertAdjacentHTML');\n this.restoreFunction_(Element.prototype, 'setAttribute');\n this.restoreFunction_(Element.prototype, 'setAttributeNS');\n\n if (getOwnPropertyDescriptor(Document.prototype, 'write')) {\n this.restoreFunction_(Document.prototype, 'write');\n this.restoreFunction_(Document.prototype, 'open');\n } else {\n this.restoreFunction_(HTMLDocument.prototype, 'write');\n this.restoreFunction_(HTMLDocument.prototype, 'open');\n }\n this.restoreFunction_(windowOpenObject, 'open');\n\n if ('DOMParser' in window) {\n this.restoreFunction_(DOMParser.prototype, 'parseFromString');\n }\n this.restoreFunction_(window, 'setTimeout');\n this.restoreFunction_(window, 'setInterval');\n this.uninstallPropertySetWrappers_();\n this.uninstallScriptMutatorGuards_();\n resetDefaultPolicy();\n }\n\n /**\n * Installs type-enforcing wrappers for APIs that allow to modify\n * script element texts.\n * @private\n */\n installScriptMutatorGuards_() {\n const that = this;\n\n ['appendChild', 'insertBefore', 'replaceChild'].forEach((fnName) => {\n this.wrapFunction_(\n Node.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ false, originalFn)\n .apply(that, args);\n });\n });\n this.wrapFunction_(\n insertAdjacentObject,\n 'insertAdjacentText',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.insertAdjacentTextWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n\n if ('after' in Element.prototype) {\n ['after', 'before', 'replaceWith'].forEach((fnName) => {\n this.wrapFunction_(\n Element.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ true, originalFn)\n .apply(that, args);\n });\n });\n ['append', 'prepend'].forEach((fnName) => {\n this.wrapFunction_(\n Element.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ false, originalFn)\n .apply(that, args);\n });\n });\n }\n }\n\n /**\n * Uninstalls type-enforcing wrappers for APIs that allow to modify\n * script element texts.\n * @private\n */\n uninstallScriptMutatorGuards_() {\n this.restoreFunction_(Node.prototype, 'appendChild');\n this.restoreFunction_(Node.prototype, 'insertBefore');\n this.restoreFunction_(Node.prototype, 'replaceChild');\n this.restoreFunction_(insertAdjacentObject, 'insertAdjacentText');\n if ('after' in Element.prototype) {\n ['after', 'before', 'replaceWith', 'append', 'prepend'].forEach(\n (fnName) => this.restoreFunction_(Element.prototype, fnName));\n }\n }\n\n /**\n * Installs wrappers for directly setting properties\n * based on the type map.\n * @private\n */\n installPropertySetWrappers_() {\n /* eslint-disable guard-for-in */\n for (const tag of getOwnPropertyNames(typeMap)) {\n for (const property of getOwnPropertyNames(typeMap[tag]['properties'])) {\n this.wrapSetter_(\n window[convertTagToConstructor(tag)].prototype,\n property,\n typeMap[tag]['properties'][property]);\n }\n }\n }\n\n /**\n * Uninstalls wrappers for directly setting properties\n * based on the type map.\n * @private\n */\n uninstallPropertySetWrappers_() {\n /* eslint-disable guard-for-in */\n for (const tag of getOwnPropertyNames(typeMap)) {\n for (const property of getOwnPropertyNames(typeMap[tag]['properties'])) {\n this.restoreSetter_(\n window[convertTagToConstructor(tag)].prototype,\n property);\n }\n }\n }\n\n /** Wraps set attribute with an enforcement function. */\n wrapSetAttribute_() {\n const that = this;\n this.wrapFunction_(\n Element.prototype,\n 'setAttribute',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.setAttributeWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n this.wrapFunction_(\n Element.prototype,\n 'setAttributeNS',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.setAttributeNSWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n }\n\n /**\n * Enforces type checking for Element.prototype.setAttribute.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original setAttribute function.\n * @return {*}\n */\n setAttributeWrapper_(context, originalFn, ...args) {\n // Note(slekies): In a normal application constructor should never be null.\n // However, there are no guarantees. If the constructor is null, we cannot\n // determine whether a special type is required. In order to not break the\n // application, we will not do any further type checks and pass the call\n // to setAttribute.\n if (context.constructor !== null && context instanceof Element) {\n const attrName = (args[0] = String(args[0])).toLowerCase();\n const requiredType = TrustedTypes.getAttributeType(context.tagName,\n attrName, context.namespaceURI);\n if (requiredType && apply(hasOwnProperty, STRING_TO_TYPE,\n [requiredType])) {\n return this.enforce_(\n context, 'setAttribute', STRING_TO_TYPE[requiredType],\n originalFn, 1, args);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Enforces type checking for Element.prototype.setAttributeNS.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original setAttributeNS function.\n * @return {*}\n */\n setAttributeNSWrapper_(context, originalFn, ...args) {\n // See the note from setAttributeWrapper_ above.\n if (context.constructor !== null && context instanceof Element) {\n const ns = args[0] ? String(args[0]) : null;\n args[0] = ns;\n const attrName = (args[1] = String(args[1])).toLowerCase();\n const requiredType = TrustedTypes.getAttributeType(context.tagName,\n attrName, context.namespaceURI, ns);\n if (requiredType && apply(hasOwnProperty, STRING_TO_TYPE,\n [requiredType])) {\n return this.enforce_(context, 'setAttributeNS',\n STRING_TO_TYPE[requiredType],\n originalFn, 2, args);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Wrapper for DOM mutator functions that enforces type checks if the context\n * (or, optionally, its parent node) is a script node.\n * For each argument, it will make sure that text nodes pass through a\n * default policy, or generate a violation. To skip that check, pass\n * TrustedScript objects instead.\n * @param {!Object} context The context for the call to the original function.\n * @param {boolean} checkParent Check parent of context instead.\n * @param {!Function} originalFn The original mutator function.\n * @return {*}\n */\n enforceTypeInScriptNodes_(context, checkParent, originalFn, ...args) {\n const objToCheck = checkParent ? context.parentNode : context;\n if (objToCheck instanceof HTMLScriptElement && args.length > 0) {\n for (let argNumber = 0; argNumber < args.length; argNumber++) {\n let arg = args[argNumber];\n if (arg instanceof Node && arg.nodeType !== Node.TEXT_NODE) {\n continue; // Type is not interesting\n }\n if (arg instanceof Node && arg.nodeType == Node.TEXT_NODE) {\n arg = arg.textContent;\n } else if (TrustedTypes.isScript(arg)) {\n // TODO(koto): Consider removing this branch, as it's hard to spec.\n // Convert to text node and go on.\n args[argNumber] = document.createTextNode(arg);\n continue;\n }\n\n // Try to run a default policy on argsthe argument\n let fallbackValue;\n let exceptionThrown;\n try {\n fallbackValue = this.maybeCallDefaultPolicy_(\n 'TrustedScript', arg, 'script.text');\n } catch (e) {\n exceptionThrown = true;\n }\n if (exceptionThrown) {\n this.processViolation_(context, originalFn.name,\n TrustedTypes.TrustedScript, arg);\n }\n args[argNumber] = document.createTextNode('' + fallbackValue);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Wrapper for Element.insertAdjacentText that enforces type checks for\n * inserting text into a script node.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original insertAdjacentText function.\n */\n insertAdjacentTextWrapper_(context, originalFn, ...args) {\n const riskyPositions = ['beforebegin', 'afterend'];\n if (context instanceof Element &&\n context.parentElement instanceof HTMLScriptElement &&\n args.length > 1 &&\n riskyPositions.includes(args[0]) &&\n !(TrustedTypes.isScript(args[1]))) {\n // Run a default policy on args[1]\n let fallbackValue;\n let exceptionThrown;\n try {\n fallbackValue = this.maybeCallDefaultPolicy_('TrustedScript',\n args[1], 'script.text');\n } catch (e) {\n exceptionThrown = true;\n }\n if (exceptionThrown) {\n this.processViolation_(context, 'insertAdjacentText',\n TrustedTypes.TrustedScript, args[1]);\n }\n\n const textNode = document.createTextNode('' + fallbackValue);\n\n\n const insertBefore = /** @type function(this: Node) */(\n this.originalSetters_[this.getKey_(Node.prototype, 'insertBefore')]);\n\n switch (args[0]) {\n case riskyPositions[0]: // 'beforebegin'\n apply(insertBefore, context.parentElement,\n [textNode, context]);\n break;\n case riskyPositions[1]: // 'afterend'\n apply(insertBefore, context.parentElement,\n [textNode, context.nextSibling]);\n break;\n }\n return;\n }\n apply(originalFn, context, args);\n }\n\n /**\n * Wraps a setter with the enforcement wrapper.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Function} type The type to enforce.\n * @param {number} argNumber Number of the argument to enforce the type of.\n * @private\n */\n wrapWithEnforceFunction_(object, name, type, argNumber) {\n const that = this;\n this.wrapFunction_(\n object,\n name,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforce_.call(that, this, name, type, originalFn,\n argNumber, args);\n });\n }\n\n\n /**\n * Wraps an existing function with a given function body and stores the\n * original function.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {function(!Function, ...*)} functionBody The wrapper function.\n */\n wrapFunction_(object, name, functionBody) {\n const descriptor = getOwnPropertyDescriptor(object, name);\n const originalFn = /** @type function(*):* */ (\n descriptor ? descriptor.value : null);\n\n if (!(originalFn instanceof Function)) {\n throw new TypeError(\n 'Property ' + name + ' on object' + object + ' is not a function');\n }\n\n const key = this.getKey_(object, name);\n if (this.originalSetters_[key]) {\n throw new Error(\n `TrustedTypesEnforcer: Double installation detected: ${key} ${name}`);\n }\n installFunction(\n object,\n name,\n /**\n * @this {TrustedTypesEnforcer}\n * @return {*}\n */\n function(...args) {\n return functionBody.bind(this, originalFn).apply(this, args);\n });\n this.originalSetters_[key] = originalFn;\n }\n\n /**\n * Wraps a setter with the enforcement wrapper.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Function} type The type to enforce.\n * @param {!Object=} descriptorObject If present, will reuse the\n * setter/getter from this one, instead of object. Used for redefining\n * setters in subclasses.\n * @private\n */\n wrapSetter_(object, name, type, descriptorObject = undefined) {\n if (descriptorObject && !isPrototypeOf.call(descriptorObject, object)) {\n throw new Error('Invalid prototype chain');\n }\n\n let useObject = descriptorObject || object;\n let descriptor;\n let originalSetter;\n const stopAt = getPrototypeOf(Node.prototype);\n\n // Find the descriptor on the object or its prototypes, stopping at Node.\n do {\n descriptor = getOwnPropertyDescriptor(useObject, name);\n originalSetter = /** @type {function(*):*} */ (descriptor ?\n descriptor.set : null);\n if (!originalSetter) {\n useObject = getPrototypeOf(useObject) || stopAt;\n }\n } while (!(originalSetter || useObject === stopAt || !useObject));\n\n if (!(originalSetter instanceof Function)) {\n throw new TypeError(\n 'No setter for property ' + name + ' on object' + object);\n }\n\n const key = this.getKey_(object, name);\n if (this.originalSetters_[key]) {\n throw new Error(\n `TrustedTypesEnforcer: Double installation detected: ${key} ${name}`);\n }\n const that = this;\n /**\n * @this {TrustedTypesEnforcer}\n * @param {*} value\n */\n const enforcingSetter = function(value) {\n that.enforce_.call(that, this, name, type, originalSetter, 0,\n [value]);\n };\n\n if (useObject === object) {\n installSetter(\n object,\n name,\n enforcingSetter);\n } else {\n // Since we're creating a new setter in subclass, we also need to\n // overwrite the getter.\n installSetterAndGetter(\n object,\n name,\n enforcingSetter,\n descriptor.get\n );\n }\n this.originalSetters_[key] = originalSetter;\n }\n\n /**\n * Restores the original setter for the property, as encountered during\n * install().\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Object=} descriptorObject If present, will restore the original\n * setter/getter from this one, instead of object.\n * @private\n */\n restoreSetter_(object, name, descriptorObject = undefined) {\n const key = this.getKey_(object, name);\n if (descriptorObject && !isPrototypeOf.call(descriptorObject, object)) {\n throw new Error('Invalid prototype chain');\n }\n if (!this.originalSetters_[key]) {\n throw new Error(\n // eslint-disable-next-line max-len\n `TrustedTypesEnforcer: Cannot restore (double uninstallation?): ${key} ${name}`);\n }\n if (descriptorObject) {\n // We have to also overwrite a getter.\n installSetterAndGetter(object, name, this.originalSetters_[key],\n getOwnPropertyDescriptor(descriptorObject, name).get);\n } else {\n installSetter(object, name, this.originalSetters_[key]);\n }\n delete this.originalSetters_[key];\n }\n\n /**\n * Restores the original method of an object, as encountered during install().\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @private\n */\n restoreFunction_(object, name) {\n const key = this.getKey_(object, name);\n if (!this.originalSetters_[key]) {\n throw new Error(\n // eslint-disable-next-line max-len\n `TrustedTypesEnforcer: Cannot restore (double uninstallation?): ${key} ${name}`);\n }\n installFunction(object, name, this.originalSetters_[key]);\n delete this.originalSetters_[key];\n }\n\n /**\n * Returns the key name for caching original setters.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @return {string} Key name.\n * @private\n */\n getKey_(object, name) {\n // TODO(msamuel): Can we use Object.prototype.toString.call(object)\n // to get an unspoofable string here?\n // TODO(msamuel): fail on '-' in object.constructor.name?\n // No Function.name in IE 11\n const ctrName = '' + (\n object.constructor.name ?\n object.constructor.name :\n object.constructor);\n return ctrName + '-' + name;\n }\n\n\n /**\n * Calls a default policy.\n * @param {string} typeName Type name to attempt to produce from a value.\n * @param {*} value The value to pass to a default policy\n * @param {string} sink The sink name that the default policy will be called\n * with.\n * @throws {Error} If the default policy throws, or not exist.\n * @return {Function} The trusted value.\n */\n maybeCallDefaultPolicy_(typeName, value, sink = '') {\n // Apply a fallback policy, if it exists.\n const fallbackPolicy = TrustedTypes.defaultPolicy;\n if (!fallbackPolicy) {\n throw new Error('Default policy does not exist');\n }\n if (!TYPE_CHECKER_MAP.hasOwnProperty(typeName)) {\n throw new Error();\n }\n return fallbackPolicy[TYPE_PRODUCER_MAP[typeName]](value, '' + sink);\n }\n\n /**\n * Logs and enforces TrustedTypes depending on the given configuration.\n * @template T\n * @param {!Object} context The object that the setter is called for.\n * @param {string} propertyName The name of the property.\n * @param {!Function} typeToEnforce The type to enforce.\n * @param {function(?):T} originalSetter Original setter.\n * @param {number} argNumber Number of argument to enforce the type of.\n * @param {Array} args Arguments.\n * @return {T}\n * @private\n */\n enforce_(context, propertyName, typeToEnforce, originalSetter, argNumber,\n args) {\n const value = args[argNumber];\n const typeName = '' + typeToEnforce.name;\n // If typed value is given, pass through.\n if (TYPE_CHECKER_MAP.hasOwnProperty(typeName) &&\n TYPE_CHECKER_MAP[typeName](value)) {\n if (stringifyForRangeHack &&\n propertyName == 'createContextualFragment') {\n // IE 11 hack, somehow the value is not stringified implicitly.\n args[argNumber] = args[argNumber].toString();\n }\n return apply(originalSetter, context, args);\n }\n\n if (typeToEnforce === TrustedTypes.TrustedScript) {\n const isInlineEventHandler =\n propertyName == 'setAttribute' ||\n propertyName === 'setAttributeNS' ||\n apply(slice, propertyName, [0, 2]) === 'on';\n // If a function (instead of string) is passed to inline event attribute,\n // or set(Timeout|Interval), pass through.\n const propertyAcceptsFunctions =\n propertyName === 'setInterval' ||\n propertyName === 'setTimeout' ||\n isInlineEventHandler;\n if ((propertyAcceptsFunctions && typeof value === 'function') ||\n (isInlineEventHandler && value === null)) {\n return apply(originalSetter, context, args);\n }\n }\n\n // Apply a fallback policy, if it exists.\n let fallbackValue;\n let exceptionThrown;\n const objName = context instanceof Element ?\n context.localName :\n getConstructorName_(context ? context.constructor : window.constructor);\n try {\n fallbackValue = this.maybeCallDefaultPolicy_(\n typeName, value, objName + '.' + propertyName);\n } catch (e) {\n exceptionThrown = true;\n }\n if (!exceptionThrown) {\n args[argNumber] = fallbackValue;\n return apply(originalSetter, context, args);\n }\n\n // This will throw a TypeError if enforcement is enabled.\n this.processViolation_(context, propertyName, typeToEnforce, value);\n\n return apply(originalSetter, context, args);\n }\n\n /**\n * Report a TT violation.\n * @param {!Object} context The object that the setter is called for.\n * @param {string} propertyName The name of the property.\n * @param {!Function} typeToEnforce The type to enforce.\n * @param {string} value The value that was violated the restrictions.\n * @throws {TypeError} if the enforcement is enabled.\n */\n processViolation_(context, propertyName, typeToEnforce, value) {\n const contextName = getConstructorName_(context.constructor) ||\n '' + context;\n const message = `Failed to set ${propertyName} on ${contextName}: `\n + `This property requires ${typeToEnforce.name}.`;\n\n if (this.config_.isLoggingEnabled) {\n // eslint-disable-next-line no-console\n console.warn(message, propertyName, context, typeToEnforce, value);\n }\n\n // Unconditionally dispatch an event.\n if (typeof SecurityPolicyViolationEvent == 'function') {\n let blockedURI = '';\n if (typeToEnforce === TrustedTypes.TrustedURL ||\n typeToEnforce === TrustedTypes.TrustedScriptURL) {\n blockedURI = parseUrl_(value) || '';\n if (blockedURI) {\n blockedURI = blockedURI.href;\n }\n }\n const valueSlice = apply(slice, '' + value, [0, 40]);\n const event = new SecurityPolicyViolationEvent(\n 'securitypolicyviolation',\n {\n 'bubbles': true,\n 'blockedURI': blockedURI,\n 'disposition': this.config_.isEnforcementEnabled ?\n 'enforce' : 'report',\n 'documentURI': document.location.href,\n 'effectiveDirective': DIRECTIVE_NAME,\n 'originalPolicy': this.config_.cspString,\n 'statusCode': 0,\n 'violatedDirective': DIRECTIVE_NAME,\n 'sample': `${contextName}.${propertyName} ${valueSlice}`,\n });\n if (context instanceof Node && context.isConnected) {\n context.dispatchEvent(event);\n } else { // Fallback - dispatch an event on base document.\n document.dispatchEvent(event);\n }\n }\n\n if (this.config_.isEnforcementEnabled) {\n throw new TypeError(message);\n }\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that only defines the types\n * (i.e. no enforcement logic).\n */\nimport {trustedTypes, TrustedTypePolicy, TrustedTypePolicyFactory} from\n '../trustedtypes.js';\n\nconst tt = trustedTypes;\n\n/**\n * Sets up the public Trusted Types API in the global object.\n */\nfunction setupPolyfill() {\n // We use array accessors to make sure Closure compiler will not alter the\n // names of the properties..\n\n // we only setup the polyfill only in browser environment.\n if (typeof window === 'undefined') {\n return;\n }\n const rootProperty = 'trustedTypes';\n\n // Convert old window.TrustedTypes to window.trustedTypes.\n if (window['TrustedTypes'] && typeof window[rootProperty] === 'undefined') {\n window[rootProperty] = Object.freeze(window['TrustedTypes']);\n }\n\n if (typeof window[rootProperty] !== 'undefined') {\n return;\n }\n\n const publicApi = Object.create(TrustedTypePolicyFactory.prototype);\n Object.assign(publicApi, {\n 'isHTML': tt.isHTML,\n 'isURL': tt.isURL,\n 'isScriptURL': tt.isScriptURL,\n 'isScript': tt.isScript,\n 'createPolicy': tt.createPolicy,\n 'getPolicyNames': tt.getPolicyNames,\n 'getAttributeType': tt.getAttributeType,\n 'getPropertyType': tt.getPropertyType,\n 'getTypeMapping': tt.getTypeMapping,\n 'emptyHTML': tt.emptyHTML,\n '_isPolyfill_': true,\n });\n Object.defineProperty(\n publicApi,\n 'defaultPolicy',\n Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {});\n\n window[rootProperty] = Object.freeze(publicApi);\n\n window['TrustedHTML'] = tt.TrustedHTML;\n window['TrustedURL'] = tt.TrustedURL;\n window['TrustedScriptURL'] = tt.TrustedScriptURL;\n window['TrustedScript'] = tt.TrustedScript;\n window['TrustedTypePolicy'] = TrustedTypePolicy;\n window['TrustedTypePolicyFactory'] = TrustedTypePolicyFactory;\n}\n\nsetupPolyfill();\n\nexport default tt;\n"]} \ No newline at end of file diff --git a/dist/es6/trustedtypes.api_only.build.js.map b/dist/es6/trustedtypes.api_only.build.js.map index ca7a8b2b..c6b09073 100644 --- a/dist/es6/trustedtypes.api_only.build.js.map +++ b/dist/es6/trustedtypes.api_only.build.js.map @@ -1 +1 @@ -{"version":3,"sources":["src/trustedtypes.js","src/polyfill/api_only.js"],"names":["rejectInputFn","TypeError","toLowerCase","toUpperCase","String","prototype","TrustedTypePolicy","TrustedTypePolicyFactory","trustedTypes","trustedTypesBuilderTestOnly","privates","obj","v","privateMap","get","undefined","create","set","selfContained","collection","proto","getPrototypeOf","ObjectPrototype","Error","key","getOwnPropertyNames","defineProperty","value","lockdownTrustedType","SubClass","canonName","freeze","name","isTrustedTypeChecker","type","has","wrapPolicy","policyName","innerPolicy","creator","Ctor","methodName","method","policySpecificType","creatorSymbol","s","args","result","allowedValue","o","factory","policy","createTypeMapping","writable","configurable","enumerable","getTypeInternal_","tag","container","elNs","attrNs","canonicalTag","apply","ns","HTML_NS","map","hasOwnProperty","TYPE_MAP","getDefaultPolicy","defaultPolicy","assign","Object","forEach","push","Array","Symbol","WeakMap","policyNames","allowedNames","enforceNameWhitelist","TrustedType","TrustedURL","TrustedScriptURL","TrustedHTML","TrustedScript","emptyHTML","XLINK_NS","SVG_NS","ATTR_PROPERTY_MAP","HTMLIFrameElement","keys","attr","HTMLElement","slice","createFunctionAllowed","api","createPolicy","indexOf","call","console","warn","wrappedPolicy","DEFAULT_POLICY_NAME","getPolicyNames","isHTML","isURL","isScriptURL","isScript","getAttributeType","tagName","attribute","elementNs","attributeNs","canonicalAttr","getPropertyType","property","getTypeMapping","namespaceUri","document","documentElement","namespaceURI","e","JSON","parse","stringify","setAllowedPolicyNames","allowedPolicyNames","length","el","resetDefaultPolicy","splice","window","publicApi","tt","getOwnPropertyDescriptor"],"mappings":"A;;;;;;;;aASA,MAAMA,EAAgB,EAAAA,EAAO,CAC3B,KAAM,KAAIC,SAAJ,CAAc,sBAAd,CAAN,CAD2B,CAA7B,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aAAA,CAAuB5D,MAAAxC,OAAA,CAAcqG,CAAd,CAEvBD,OAAA,YAAA,CAAwBE,CAAAlD,YACxBgD,OAAA,WAAA,CAAuBE,CAAApD,WACvBkD,OAAA,iBAAA,CAA6BE,CAAAnD,iBAC7BiD,OAAA,cAAA,CAA0BE,CAAAjD,cAC1B+C,OAAA,kBAAA,CAA8B7H,CAC9B6H,OAAA,yBAAA,CAAqC5H,CA9BrC","file":"trustedtypes.api_only.build.js","sourcesContent":["/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst rejectInputFn = (s) => {\n throw new TypeError('undefined conversion');\n};\n\nconst {toLowerCase, toUpperCase} = String.prototype;\n\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @constructor\n * @property {!function(string):TrustedHTML} createHTML\n * @property {!function(string):TrustedURL} createURL\n * @property {!function(string):TrustedScriptURL} createScriptURL\n * @property {!function(string):TrustedScript} createScript\n * @property {!string} name\n */\nexport const TrustedTypePolicy = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/**\n * @constructor\n */\nexport const TrustedTypePolicyFactory = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypesInnerPolicy}\n * @property {function(string):string} createHTML\n * @property {function(string):string} createURL\n * @property {function(string):string} createScriptURL\n * @property {function(string):string} createScript\n */\nconst TrustedTypesInnerPolicy = {};\n\n/**\n * @typedef {!Object,\n * properties: !Object}>}\n */\nconst TrustedTypesTypeMap = {};\n/* eslint-enable no-unused-vars */\n\nexport const DEFAULT_POLICY_NAME = 'default';\n\n\nexport const trustedTypesBuilderTestOnly = function() {\n // Capture common names early.\n const {\n assign, create, defineProperty, freeze, getOwnPropertyNames,\n getPrototypeOf, prototype: ObjectPrototype,\n } = Object;\n\n const {hasOwnProperty} = ObjectPrototype;\n\n const {\n forEach, push,\n } = Array.prototype;\n\n const creatorSymbol = Symbol();\n\n /**\n * Getter for the privateMap.\n * @param {Object} obj Key of the privateMap\n * @return {Object} Private storage.\n */\n const privates = function(obj) {\n let v = privateMap.get(obj);\n if (v === undefined) {\n v = create(null); // initialize the private storage.\n privateMap.set(obj, v);\n }\n return v;\n };\n\n /**\n * Called before attacker-controlled code on an internal collections,\n * copies prototype members onto the instance directly, so that later\n * changes to prototypes cannot expose collection internals.\n * @param {!T} collection\n * @return {!T} collection\n * @template T\n */\n function selfContained(collection) {\n const proto = getPrototypeOf(collection);\n if (proto == null || getPrototypeOf(proto) !== ObjectPrototype) {\n throw new Error(); // Loop below is insufficient.\n }\n for (const key of getOwnPropertyNames(proto)) {\n defineProperty(collection, key, {value: collection[key]});\n }\n return collection;\n }\n\n /**\n * Map for private properties of Trusted Types object.\n * This is so that the access to the type constructor does not give\n * the ability to create typed values.\n * @type {WeakMap}\n */\n const privateMap = selfContained(new WeakMap());\n\n /**\n * List of all configured policy names.\n * @type {Array}\n */\n const policyNames = selfContained([]);\n\n /**\n * Allowed policy namess for policy names.\n * @type {Array}\n */\n const allowedNames = selfContained([]);\n\n /**\n * A reference to a default policy, if created.\n * @type {TrustedTypePolicy}\n */\n let defaultPolicy = null;\n\n /**\n * Whether to enforce allowedNames in createPolicy().\n * @type {boolean}\n */\n let enforceNameWhitelist = false;\n\n\n /**\n * A value that is trusted to have certain security-relevant properties\n * because the sources of such values are controlled.\n */\n class TrustedType {\n /**\n * Constructor for TrustedType. Only allowed to be called from within a\n * policy.\n * @param {symbol} s creatorSymbol\n * @param {string} policyName The name of the policy this object was\n * created by.\n */\n constructor(s, policyName) {\n // TODO: Figure out if symbol is needed, if the value is in privateMap.\n if (s !== creatorSymbol) {\n throw new Error('cannot call the constructor');\n }\n defineProperty(this, 'policyName',\n {value: '' + policyName, enumerable: true});\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n toString() {\n return privates(this)['v'];\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n valueOf() {\n return privates(this)['v'];\n }\n }\n\n /**\n * @param {function(new:TrustedType, symbol, string)} SubClass\n * @param {string} canonName The class name which should be independent of\n * any renaming pass and which is relied upon by the enforcer and for\n * native type interop.\n */\n function lockdownTrustedType(SubClass, canonName) {\n freeze(SubClass.prototype);\n delete SubClass.name;\n defineProperty(SubClass, 'name', {value: canonName});\n }\n\n /**\n * Trusted URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedURL extends TrustedType {\n }\n lockdownTrustedType(TrustedURL, 'TrustedURL');\n\n /**\n * Trusted Script URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScriptURL extends TrustedType {\n }\n lockdownTrustedType(TrustedScriptURL, 'TrustedScriptURL');\n\n /**\n * Trusted HTML object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedHTML extends TrustedType {\n }\n lockdownTrustedType(TrustedHTML, 'TrustedHTML');\n\n /**\n * Trusted Script object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScript extends TrustedType {\n }\n lockdownTrustedType(TrustedScript, 'TrustedScript');\n\n lockdownTrustedType(TrustedType, 'TrustedType');\n\n // Common constants.\n const emptyHTML = freeze(create(new TrustedHTML(creatorSymbol, '')));\n privates(emptyHTML)['v'] = '';\n\n /**\n * A map of attribute / property names to allowed types\n * for known namespaces.\n * @type {!Object}\n * @export\n */\n const TYPE_MAP = {\n [HTML_NS]: {\n // TODO(koto): Figure out what to to with \n 'A': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'AREA': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BASE': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BUTTON': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'EMBED': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n },\n },\n 'FORM': {\n 'attributes': {\n 'action': TrustedURL.name,\n },\n },\n 'FRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n },\n },\n 'IFRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n 'srcdoc': TrustedHTML.name,\n },\n },\n 'INPUT': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'OBJECT': {\n 'attributes': {\n 'data': TrustedScriptURL.name,\n 'codebase': TrustedScriptURL.name,\n },\n },\n // TODO(koto): Figure out what to do with portals.\n 'SCRIPT': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n 'text': TrustedScript.name,\n },\n 'properties': {\n 'innerText': TrustedScript.name,\n 'textContent': TrustedScript.name,\n 'text': TrustedScript.name,\n },\n },\n '*': {\n 'attributes': {},\n 'properties': {\n 'innerHTML': TrustedHTML.name,\n 'outerHTML': TrustedHTML.name,\n },\n },\n },\n [XLINK_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n [SVG_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n };\n\n /**\n * A map of element property to HTML attribute names.\n * @type {!Object}\n */\n const ATTR_PROPERTY_MAP = {\n 'codebase': 'codeBase',\n 'formaction': 'formAction',\n };\n\n // Edge doesn't support srcdoc.\n if (!('srcdoc' in HTMLIFrameElement.prototype)) {\n delete TYPE_MAP[HTML_NS]['IFRAME']['attributes']['srcdoc'];\n }\n\n // in HTML, clone attributes into properties.\n for (const tag of Object.keys(TYPE_MAP[HTML_NS])) {\n if (!TYPE_MAP[HTML_NS][tag]['properties']) {\n TYPE_MAP[HTML_NS][tag]['properties'] = {};\n }\n for (const attr of Object.keys(TYPE_MAP[HTML_NS][tag]['attributes'])) {\n TYPE_MAP[HTML_NS][tag]['properties'][\n ATTR_PROPERTY_MAP[attr] ? ATTR_PROPERTY_MAP[attr] : attr\n ] = TYPE_MAP[HTML_NS][tag]['attributes'][attr];\n }\n }\n\n // Add inline event handlers attribute names.\n for (const name of getOwnPropertyNames(HTMLElement.prototype)) {\n if (name.slice(0, 2) === 'on') {\n TYPE_MAP[HTML_NS]['*']['attributes'][name] = 'TrustedScript';\n }\n }\n\n /**\n * @type {!Object}\n */\n const createTypeMapping = {\n 'createHTML': TrustedHTML,\n 'createScriptURL': TrustedScriptURL,\n 'createURL': TrustedURL,\n 'createScript': TrustedScript,\n };\n\n const createFunctionAllowed = createTypeMapping.hasOwnProperty;\n\n /**\n * Function generating a type checker.\n * @template T\n * @param {T} type The type to check against.\n * @return {function(*):boolean}\n */\n function isTrustedTypeChecker(type) {\n return (obj) => (obj instanceof type) && privateMap.has(obj);\n }\n\n /**\n * Wraps a user-defined policy rules with TT constructor\n * @param {string} policyName The policy name\n * @param {TrustedTypesInnerPolicy} innerPolicy InnerPolicy\n * @return {!TrustedTypePolicy} Frozen policy object\n */\n function wrapPolicy(policyName, innerPolicy) {\n /**\n * @template T\n * @param {function(new:T, symbol, string)} Ctor a trusted type constructor\n * @param {string} methodName the policy factory method name\n * @return {function(string):!T} a factory that produces instances of Ctor.\n */\n function creator(Ctor, methodName) {\n // This causes thisValue to be null when called below.\n const method = innerPolicy[methodName] || rejectInputFn;\n const policySpecificType = freeze(new Ctor(creatorSymbol, policyName));\n const factory = {\n [methodName](s, ...args) {\n // Trick to get methodName to show in stacktrace.\n let result = method('' + s, ...args);\n if (result === undefined || result === null) {\n result = '';\n }\n const allowedValue = '' + result;\n const o = freeze(create(policySpecificType));\n privates(o)['v'] = allowedValue;\n return o;\n },\n }[methodName];\n return freeze(factory);\n }\n\n const policy = create(TrustedTypePolicy.prototype);\n\n for (const name of getOwnPropertyNames(createTypeMapping)) {\n policy[name] = creator(createTypeMapping[name], name);\n }\n defineProperty(policy, 'name', {\n value: policyName,\n writable: false,\n configurable: false,\n enumerable: true,\n });\n\n return /** @type {!TrustedTypePolicy} */ (freeze(policy));\n }\n\n /**\n * Returns the name of the trusted type required for a given element\n * attribute.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} attribute The name of the attribute.\n * @param {string=} elementNs Element namespace.\n * @param {string=} attributeNs The attribute namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getAttributeType(tagName, attribute, elementNs = '',\n attributeNs = '') {\n const canonicalAttr = toLowerCase.apply(String(attribute));\n return getTypeInternal_(tagName, 'attributes', canonicalAttr,\n elementNs, attributeNs);\n }\n\n /**\n * Returns a type name from a type map.\n * @param {string} tag A tag name.\n * @param {string} container 'attributes' or 'properties'\n * @param {string} name The attribute / property name.\n * @param {string=} elNs Element namespace.\n * @param {string=} attrNs Attribute namespace.\n * @return {string|undefined}\n * @private\n */\n function getTypeInternal_(tag, container, name, elNs = '', attrNs = '') {\n const canonicalTag = toUpperCase.apply(String(tag));\n\n let ns = attrNs ? attrNs : elNs;\n if (!ns) {\n ns = HTML_NS;\n }\n const map = hasOwnProperty.apply(TYPE_MAP, [ns]) ? TYPE_MAP[ns] : null;\n if (!map) {\n return;\n }\n if (hasOwnProperty.apply(map, [canonicalTag]) &&\n map[canonicalTag] &&\n hasOwnProperty.apply(map[canonicalTag][container], [name]) &&\n map[canonicalTag][container][name]) {\n return map[canonicalTag][container][name];\n }\n\n if (hasOwnProperty.apply(map, ['*']) &&\n hasOwnProperty.apply(map['*'][container], [name]) &&\n map['*'][container][name]) {\n return map['*'][container][name];\n }\n }\n\n /**\n * Returns the name of the trusted type required for a given element property.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} property The property.\n * @param {string=} elementNs Element namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getPropertyType(tagName, property, elementNs = '') {\n // TODO: Support namespaces.\n return getTypeInternal_(tagName, 'properties', String(property), elementNs);\n }\n\n /**\n * Returns the type map-like object, that resolves a name of a type for a\n * given tag + attribute / property in a given namespace.\n * The keys of the map are uppercase tag names. Map entry has mappings between\n * a lowercase attribute name / case-sensitive property name and a name of the\n * type that is required for that attribute / property.\n * Example entry for 'IMG': {\"attributes\": {\"src\": \"TrustedHTML\"}}\n * @param {string=} namespaceUri The namespace URI (will use the current\n * document namespace URI if omitted).\n * @return {TrustedTypesTypeMap}\n */\n function getTypeMapping(namespaceUri = '') {\n if (!namespaceUri) {\n try {\n namespaceUri = document.documentElement.namespaceURI;\n } catch (e) {\n namespaceUri = HTML_NS;\n }\n }\n /**\n * @template T\n * @private\n * @param {T} o\n * @return {T}\n */\n function deepClone(o) {\n return JSON.parse(JSON.stringify(o));\n }\n const map = TYPE_MAP[namespaceUri];\n if (!map) {\n return {};\n }\n return deepClone(map);\n }\n\n /**\n * Returns all configured policy names (even for non-exposed policies).\n * @return {!Array}\n */\n function getPolicyNames() {\n // TODO(msamuel): Should we sort policyNames to avoid leaking or\n // encouraging dependency on the order in which policy names are\n // registered? I think JavaScript builtin sorts are efficient for\n // almost-sorted lists so the amortized cost is close to O(n).\n return policyNames.slice();\n }\n\n /**\n * Creates a TT policy.\n *\n * Returns a frozen object representing a policy - a collection of functions\n * that may create TT objects based on the user-provided rules specified\n * in the policy object.\n *\n * @param {string} name A unique name of the policy.\n * @param {TrustedTypesInnerPolicy} policy Policy rules object.\n * @return {TrustedTypePolicy} The policy that may create TT objects\n * according to the policy rules.\n */\n function createPolicy(name, policy) {\n const pName = '' + name; // Assert it's a string\n\n if (enforceNameWhitelist && allowedNames.indexOf(pName) === -1) {\n throw new TypeError('Policy ' + pName + ' disallowed.');\n }\n\n if (policyNames.indexOf(pName) !== -1) {\n throw new TypeError('Policy ' + pName + ' exists.');\n }\n // Register the name early so that if policy getters unwisely calls\n // across protection domains to code that reenters this function,\n // policy author still has rights to the name.\n policyNames.push(pName);\n\n // Only copy own properties of names present in createTypeMapping.\n const innerPolicy = create(null);\n if (policy && typeof policy === 'object') {\n // Treat non-objects as empty policies.\n for (const key of getOwnPropertyNames(policy)) {\n if (createFunctionAllowed.call(createTypeMapping, key)) {\n innerPolicy[key] = policy[key];\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn('trustedTypes.createPolicy ' + pName +\n ' was given an empty policy');\n }\n freeze(innerPolicy);\n\n const wrappedPolicy = wrapPolicy(pName, innerPolicy);\n\n if (pName === DEFAULT_POLICY_NAME) {\n defaultPolicy = wrappedPolicy;\n }\n\n return wrappedPolicy;\n }\n\n /**\n * Applies the policy name whitelist.\n * @param {!Array} allowedPolicyNames\n */\n function setAllowedPolicyNames(allowedPolicyNames) {\n if (allowedPolicyNames.indexOf('*') !== -1) { // Any policy name is allowed.\n enforceNameWhitelist = false;\n } else {\n enforceNameWhitelist = true;\n allowedNames.length = 0;\n forEach.call(allowedPolicyNames, (el) => {\n push.call(allowedNames, '' + el);\n });\n }\n }\n\n /**\n * Returns the default policy, or null if it was not created.\n * @return {TrustedTypePolicy}\n */\n function getDefaultPolicy() {\n return defaultPolicy;\n }\n\n /**\n * Resets the default policy.\n */\n function resetDefaultPolicy() {\n defaultPolicy = null;\n policyNames.splice(policyNames.indexOf(DEFAULT_POLICY_NAME), 1);\n }\n\n const api = create(TrustedTypePolicyFactory.prototype);\n assign(api, {\n // The main function to create policies.\n createPolicy,\n\n getPolicyNames,\n\n // Type checkers, also validating the object was initialized through a\n // policy.\n isHTML: isTrustedTypeChecker(TrustedHTML),\n isURL: isTrustedTypeChecker(TrustedURL),\n isScriptURL: isTrustedTypeChecker(TrustedScriptURL),\n isScript: isTrustedTypeChecker(TrustedScript),\n\n getAttributeType,\n getPropertyType,\n getTypeMapping,\n emptyHTML,\n defaultPolicy, // Just to make the compiler happy, this is overridden below.\n\n TrustedHTML: TrustedHTML,\n TrustedURL: TrustedURL,\n TrustedScriptURL: TrustedScriptURL,\n TrustedScript: TrustedScript,\n });\n\n defineProperty(api, 'defaultPolicy', {\n get: getDefaultPolicy,\n set: () => {},\n });\n\n return {\n trustedTypes: freeze(api),\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n };\n};\n\n\nexport const {\n trustedTypes,\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n} = trustedTypesBuilderTestOnly();\n\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that only defines the types\n * (i.e. no enforcement logic).\n */\nimport {trustedTypes, TrustedTypePolicy, TrustedTypePolicyFactory} from\n '../trustedtypes.js';\n\nconst tt = trustedTypes;\n\n/**\n * Sets up the public Trusted Types API in the global object.\n */\nfunction setupPolyfill() {\n // We use array accessors to make sure Closure compiler will not alter the\n // names of the properties..\n if (typeof window === 'undefined') {\n return;\n }\n const rootProperty = 'trustedTypes';\n\n // Convert old window.TrustedTypes to window.trustedTypes.\n if (window['TrustedTypes'] && typeof window[rootProperty] === 'undefined') {\n window[rootProperty] = Object.freeze(window['TrustedTypes']);\n }\n\n if (typeof window[rootProperty] !== 'undefined') {\n return;\n }\n\n const publicApi = Object.create(TrustedTypePolicyFactory.prototype);\n Object.assign(publicApi, {\n 'isHTML': tt.isHTML,\n 'isURL': tt.isURL,\n 'isScriptURL': tt.isScriptURL,\n 'isScript': tt.isScript,\n 'createPolicy': tt.createPolicy,\n 'getPolicyNames': tt.getPolicyNames,\n 'getAttributeType': tt.getAttributeType,\n 'getPropertyType': tt.getPropertyType,\n 'getTypeMapping': tt.getTypeMapping,\n 'emptyHTML': tt.emptyHTML,\n '_isPolyfill_': true,\n });\n Object.defineProperty(\n publicApi,\n 'defaultPolicy',\n Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {});\n\n window[rootProperty] = Object.freeze(publicApi);\n\n window['TrustedHTML'] = tt.TrustedHTML;\n window['TrustedURL'] = tt.TrustedURL;\n window['TrustedScriptURL'] = tt.TrustedScriptURL;\n window['TrustedScript'] = tt.TrustedScript;\n window['TrustedTypePolicy'] = TrustedTypePolicy;\n window['TrustedTypePolicyFactory'] = TrustedTypePolicyFactory;\n}\n\nsetupPolyfill();\n\nexport default tt;\n"]} \ No newline at end of file +{"version":3,"sources":["src/trustedtypes.js","src/polyfill/api_only.js"],"names":["rejectInputFn","TypeError","toLowerCase","toUpperCase","String","prototype","TrustedTypePolicy","TrustedTypePolicyFactory","trustedTypes","trustedTypesBuilderTestOnly","privates","obj","v","privateMap","get","undefined","create","set","selfContained","collection","proto","getPrototypeOf","ObjectPrototype","Error","key","getOwnPropertyNames","defineProperty","value","lockdownTrustedType","SubClass","canonName","freeze","name","isTrustedTypeChecker","type","has","wrapPolicy","policyName","innerPolicy","creator","Ctor","methodName","method","policySpecificType","creatorSymbol","s","args","result","allowedValue","o","factory","policy","createTypeMapping","writable","configurable","enumerable","getTypeInternal_","tag","container","elNs","attrNs","canonicalTag","apply","ns","HTML_NS","map","hasOwnProperty","TYPE_MAP","getDefaultPolicy","defaultPolicy","assign","Object","forEach","push","Array","Symbol","WeakMap","policyNames","allowedNames","enforceNameWhitelist","TrustedType","TrustedURL","TrustedScriptURL","TrustedHTML","TrustedScript","emptyHTML","XLINK_NS","SVG_NS","ATTR_PROPERTY_MAP","HTMLIFrameElement","keys","attr","HTMLElement","slice","createFunctionAllowed","api","createPolicy","indexOf","call","console","warn","wrappedPolicy","DEFAULT_POLICY_NAME","getPolicyNames","isHTML","isURL","isScriptURL","isScript","getAttributeType","tagName","attribute","elementNs","attributeNs","canonicalAttr","getPropertyType","property","getTypeMapping","namespaceUri","document","documentElement","namespaceURI","e","JSON","parse","stringify","setAllowedPolicyNames","allowedPolicyNames","length","el","resetDefaultPolicy","splice","window","publicApi","tt","getOwnPropertyDescriptor"],"mappings":"A;;;;;;;;aASA,MAAMA,EAAgB,EAAAA,EAAO,CAC3B,KAAM,KAAIC,SAAJ,CAAc,sBAAd,CAAN,CAD2B,CAA7B,CAIM,CAAC,YAAAC,CAAD,CAAc,YAAAC,CAAd,CAAA,CAA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AAA,YAAA,CAAwBE,CAAAlD,YACxBgD,OAAA,WAAA,CAAuBE,CAAApD,WACvBkD,OAAA,iBAAA,CAA6BE,CAAAnD,iBAC7BiD,OAAA,cAAA,CAA0BE,CAAAjD,cAC1B+C,OAAA,kBAAA,CAA8B7H,CAC9B6H,OAAA,yBAAA,CAAqC5H,CA9BrC","file":"trustedtypes.api_only.build.js","sourcesContent":["/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst rejectInputFn = (s) => {\n throw new TypeError('undefined conversion');\n};\n\nconst {toLowerCase, toUpperCase} = String.prototype;\n\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @constructor\n * @property {!function(string):TrustedHTML} createHTML\n * @property {!function(string):TrustedURL} createURL\n * @property {!function(string):TrustedScriptURL} createScriptURL\n * @property {!function(string):TrustedScript} createScript\n * @property {!string} name\n */\nexport const TrustedTypePolicy = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/**\n * @constructor\n */\nexport const TrustedTypePolicyFactory = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypesInnerPolicy}\n * @property {function(string):string} createHTML\n * @property {function(string):string} createURL\n * @property {function(string):string} createScriptURL\n * @property {function(string):string} createScript\n */\nconst TrustedTypesInnerPolicy = {};\n\n/**\n * @typedef {!Object,\n * properties: !Object}>}\n */\nconst TrustedTypesTypeMap = {};\n/* eslint-enable no-unused-vars */\n\nexport const DEFAULT_POLICY_NAME = 'default';\n\n\nexport const trustedTypesBuilderTestOnly = function() {\n // Capture common names early.\n const {\n assign, create, defineProperty, freeze, getOwnPropertyNames,\n getPrototypeOf, prototype: ObjectPrototype,\n } = Object;\n\n const {hasOwnProperty} = ObjectPrototype;\n\n const {\n forEach, push,\n } = Array.prototype;\n\n const creatorSymbol = Symbol();\n\n /**\n * Getter for the privateMap.\n * @param {Object} obj Key of the privateMap\n * @return {Object} Private storage.\n */\n const privates = function(obj) {\n let v = privateMap.get(obj);\n if (v === undefined) {\n v = create(null); // initialize the private storage.\n privateMap.set(obj, v);\n }\n return v;\n };\n\n /**\n * Called before attacker-controlled code on an internal collections,\n * copies prototype members onto the instance directly, so that later\n * changes to prototypes cannot expose collection internals.\n * @param {!T} collection\n * @return {!T} collection\n * @template T\n */\n function selfContained(collection) {\n const proto = getPrototypeOf(collection);\n if (proto == null || getPrototypeOf(proto) !== ObjectPrototype) {\n throw new Error(); // Loop below is insufficient.\n }\n for (const key of getOwnPropertyNames(proto)) {\n defineProperty(collection, key, {value: collection[key]});\n }\n return collection;\n }\n\n /**\n * Map for private properties of Trusted Types object.\n * This is so that the access to the type constructor does not give\n * the ability to create typed values.\n * @type {WeakMap}\n */\n const privateMap = selfContained(new WeakMap());\n\n /**\n * List of all configured policy names.\n * @type {Array}\n */\n const policyNames = selfContained([]);\n\n /**\n * Allowed policy namess for policy names.\n * @type {Array}\n */\n const allowedNames = selfContained([]);\n\n /**\n * A reference to a default policy, if created.\n * @type {TrustedTypePolicy}\n */\n let defaultPolicy = null;\n\n /**\n * Whether to enforce allowedNames in createPolicy().\n * @type {boolean}\n */\n let enforceNameWhitelist = false;\n\n\n /**\n * A value that is trusted to have certain security-relevant properties\n * because the sources of such values are controlled.\n */\n class TrustedType {\n /**\n * Constructor for TrustedType. Only allowed to be called from within a\n * policy.\n * @param {symbol} s creatorSymbol\n * @param {string} policyName The name of the policy this object was\n * created by.\n */\n constructor(s, policyName) {\n // TODO: Figure out if symbol is needed, if the value is in privateMap.\n if (s !== creatorSymbol) {\n throw new Error('cannot call the constructor');\n }\n defineProperty(this, 'policyName',\n {value: '' + policyName, enumerable: true});\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n toString() {\n return privates(this)['v'];\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n valueOf() {\n return privates(this)['v'];\n }\n }\n\n /**\n * @param {function(new:TrustedType, symbol, string)} SubClass\n * @param {string} canonName The class name which should be independent of\n * any renaming pass and which is relied upon by the enforcer and for\n * native type interop.\n */\n function lockdownTrustedType(SubClass, canonName) {\n freeze(SubClass.prototype);\n delete SubClass.name;\n defineProperty(SubClass, 'name', {value: canonName});\n }\n\n /**\n * Trusted URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedURL extends TrustedType {\n }\n lockdownTrustedType(TrustedURL, 'TrustedURL');\n\n /**\n * Trusted Script URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScriptURL extends TrustedType {\n }\n lockdownTrustedType(TrustedScriptURL, 'TrustedScriptURL');\n\n /**\n * Trusted HTML object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedHTML extends TrustedType {\n }\n lockdownTrustedType(TrustedHTML, 'TrustedHTML');\n\n /**\n * Trusted Script object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScript extends TrustedType {\n }\n lockdownTrustedType(TrustedScript, 'TrustedScript');\n\n lockdownTrustedType(TrustedType, 'TrustedType');\n\n // Common constants.\n const emptyHTML = freeze(create(new TrustedHTML(creatorSymbol, '')));\n privates(emptyHTML)['v'] = '';\n\n /**\n * A map of attribute / property names to allowed types\n * for known namespaces.\n * @type {!Object}\n * @export\n */\n const TYPE_MAP = {\n [HTML_NS]: {\n // TODO(koto): Figure out what to to with \n 'A': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'AREA': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BASE': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BUTTON': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'EMBED': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n },\n },\n 'FORM': {\n 'attributes': {\n 'action': TrustedURL.name,\n },\n },\n 'FRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n },\n },\n 'IFRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n 'srcdoc': TrustedHTML.name,\n },\n },\n 'INPUT': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'OBJECT': {\n 'attributes': {\n 'data': TrustedScriptURL.name,\n 'codebase': TrustedScriptURL.name,\n },\n },\n // TODO(koto): Figure out what to do with portals.\n 'SCRIPT': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n 'text': TrustedScript.name,\n },\n 'properties': {\n 'innerText': TrustedScript.name,\n 'textContent': TrustedScript.name,\n 'text': TrustedScript.name,\n },\n },\n '*': {\n 'attributes': {},\n 'properties': {\n 'innerHTML': TrustedHTML.name,\n 'outerHTML': TrustedHTML.name,\n },\n },\n },\n [XLINK_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n [SVG_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n };\n\n /**\n * A map of element property to HTML attribute names.\n * @type {!Object}\n */\n const ATTR_PROPERTY_MAP = {\n 'codebase': 'codeBase',\n 'formaction': 'formAction',\n };\n\n // Edge doesn't support srcdoc.\n if (!('srcdoc' in HTMLIFrameElement.prototype)) {\n delete TYPE_MAP[HTML_NS]['IFRAME']['attributes']['srcdoc'];\n }\n\n // in HTML, clone attributes into properties.\n for (const tag of Object.keys(TYPE_MAP[HTML_NS])) {\n if (!TYPE_MAP[HTML_NS][tag]['properties']) {\n TYPE_MAP[HTML_NS][tag]['properties'] = {};\n }\n for (const attr of Object.keys(TYPE_MAP[HTML_NS][tag]['attributes'])) {\n TYPE_MAP[HTML_NS][tag]['properties'][\n ATTR_PROPERTY_MAP[attr] ? ATTR_PROPERTY_MAP[attr] : attr\n ] = TYPE_MAP[HTML_NS][tag]['attributes'][attr];\n }\n }\n\n // Add inline event handlers attribute names.\n for (const name of getOwnPropertyNames(HTMLElement.prototype)) {\n if (name.slice(0, 2) === 'on') {\n TYPE_MAP[HTML_NS]['*']['attributes'][name] = 'TrustedScript';\n }\n }\n\n /**\n * @type {!Object}\n */\n const createTypeMapping = {\n 'createHTML': TrustedHTML,\n 'createScriptURL': TrustedScriptURL,\n 'createURL': TrustedURL,\n 'createScript': TrustedScript,\n };\n\n const createFunctionAllowed = createTypeMapping.hasOwnProperty;\n\n /**\n * Function generating a type checker.\n * @template T\n * @param {T} type The type to check against.\n * @return {function(*):boolean}\n */\n function isTrustedTypeChecker(type) {\n return (obj) => (obj instanceof type) && privateMap.has(obj);\n }\n\n /**\n * Wraps a user-defined policy rules with TT constructor\n * @param {string} policyName The policy name\n * @param {TrustedTypesInnerPolicy} innerPolicy InnerPolicy\n * @return {!TrustedTypePolicy} Frozen policy object\n */\n function wrapPolicy(policyName, innerPolicy) {\n /**\n * @template T\n * @param {function(new:T, symbol, string)} Ctor a trusted type constructor\n * @param {string} methodName the policy factory method name\n * @return {function(string):!T} a factory that produces instances of Ctor.\n */\n function creator(Ctor, methodName) {\n // This causes thisValue to be null when called below.\n const method = innerPolicy[methodName] || rejectInputFn;\n const policySpecificType = freeze(new Ctor(creatorSymbol, policyName));\n const factory = {\n [methodName](s, ...args) {\n // Trick to get methodName to show in stacktrace.\n let result = method('' + s, ...args);\n if (result === undefined || result === null) {\n result = '';\n }\n const allowedValue = '' + result;\n const o = freeze(create(policySpecificType));\n privates(o)['v'] = allowedValue;\n return o;\n },\n }[methodName];\n return freeze(factory);\n }\n\n const policy = create(TrustedTypePolicy.prototype);\n\n for (const name of getOwnPropertyNames(createTypeMapping)) {\n policy[name] = creator(createTypeMapping[name], name);\n }\n defineProperty(policy, 'name', {\n value: policyName,\n writable: false,\n configurable: false,\n enumerable: true,\n });\n\n return /** @type {!TrustedTypePolicy} */ (freeze(policy));\n }\n\n /**\n * Returns the name of the trusted type required for a given element\n * attribute.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} attribute The name of the attribute.\n * @param {string=} elementNs Element namespace.\n * @param {string=} attributeNs The attribute namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getAttributeType(tagName, attribute, elementNs = '',\n attributeNs = '') {\n const canonicalAttr = toLowerCase.apply(String(attribute));\n return getTypeInternal_(tagName, 'attributes', canonicalAttr,\n elementNs, attributeNs);\n }\n\n /**\n * Returns a type name from a type map.\n * @param {string} tag A tag name.\n * @param {string} container 'attributes' or 'properties'\n * @param {string} name The attribute / property name.\n * @param {string=} elNs Element namespace.\n * @param {string=} attrNs Attribute namespace.\n * @return {string|undefined}\n * @private\n */\n function getTypeInternal_(tag, container, name, elNs = '', attrNs = '') {\n const canonicalTag = toUpperCase.apply(String(tag));\n\n let ns = attrNs ? attrNs : elNs;\n if (!ns) {\n ns = HTML_NS;\n }\n const map = hasOwnProperty.apply(TYPE_MAP, [ns]) ? TYPE_MAP[ns] : null;\n if (!map) {\n return;\n }\n if (hasOwnProperty.apply(map, [canonicalTag]) &&\n map[canonicalTag] &&\n hasOwnProperty.apply(map[canonicalTag][container], [name]) &&\n map[canonicalTag][container][name]) {\n return map[canonicalTag][container][name];\n }\n\n if (hasOwnProperty.apply(map, ['*']) &&\n hasOwnProperty.apply(map['*'][container], [name]) &&\n map['*'][container][name]) {\n return map['*'][container][name];\n }\n }\n\n /**\n * Returns the name of the trusted type required for a given element property.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} property The property.\n * @param {string=} elementNs Element namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getPropertyType(tagName, property, elementNs = '') {\n // TODO: Support namespaces.\n return getTypeInternal_(tagName, 'properties', String(property), elementNs);\n }\n\n /**\n * Returns the type map-like object, that resolves a name of a type for a\n * given tag + attribute / property in a given namespace.\n * The keys of the map are uppercase tag names. Map entry has mappings between\n * a lowercase attribute name / case-sensitive property name and a name of the\n * type that is required for that attribute / property.\n * Example entry for 'IMG': {\"attributes\": {\"src\": \"TrustedHTML\"}}\n * @param {string=} namespaceUri The namespace URI (will use the current\n * document namespace URI if omitted).\n * @return {TrustedTypesTypeMap}\n */\n function getTypeMapping(namespaceUri = '') {\n if (!namespaceUri) {\n try {\n namespaceUri = document.documentElement.namespaceURI;\n } catch (e) {\n namespaceUri = HTML_NS;\n }\n }\n /**\n * @template T\n * @private\n * @param {T} o\n * @return {T}\n */\n function deepClone(o) {\n return JSON.parse(JSON.stringify(o));\n }\n const map = TYPE_MAP[namespaceUri];\n if (!map) {\n return {};\n }\n return deepClone(map);\n }\n\n /**\n * Returns all configured policy names (even for non-exposed policies).\n * @return {!Array}\n */\n function getPolicyNames() {\n // TODO(msamuel): Should we sort policyNames to avoid leaking or\n // encouraging dependency on the order in which policy names are\n // registered? I think JavaScript builtin sorts are efficient for\n // almost-sorted lists so the amortized cost is close to O(n).\n return policyNames.slice();\n }\n\n /**\n * Creates a TT policy.\n *\n * Returns a frozen object representing a policy - a collection of functions\n * that may create TT objects based on the user-provided rules specified\n * in the policy object.\n *\n * @param {string} name A unique name of the policy.\n * @param {TrustedTypesInnerPolicy} policy Policy rules object.\n * @return {TrustedTypePolicy} The policy that may create TT objects\n * according to the policy rules.\n */\n function createPolicy(name, policy) {\n const pName = '' + name; // Assert it's a string\n\n if (enforceNameWhitelist && allowedNames.indexOf(pName) === -1) {\n throw new TypeError('Policy ' + pName + ' disallowed.');\n }\n\n if (policyNames.indexOf(pName) !== -1) {\n throw new TypeError('Policy ' + pName + ' exists.');\n }\n // Register the name early so that if policy getters unwisely calls\n // across protection domains to code that reenters this function,\n // policy author still has rights to the name.\n policyNames.push(pName);\n\n // Only copy own properties of names present in createTypeMapping.\n const innerPolicy = create(null);\n if (policy && typeof policy === 'object') {\n // Treat non-objects as empty policies.\n for (const key of getOwnPropertyNames(policy)) {\n if (createFunctionAllowed.call(createTypeMapping, key)) {\n innerPolicy[key] = policy[key];\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn('trustedTypes.createPolicy ' + pName +\n ' was given an empty policy');\n }\n freeze(innerPolicy);\n\n const wrappedPolicy = wrapPolicy(pName, innerPolicy);\n\n if (pName === DEFAULT_POLICY_NAME) {\n defaultPolicy = wrappedPolicy;\n }\n\n return wrappedPolicy;\n }\n\n /**\n * Applies the policy name whitelist.\n * @param {!Array} allowedPolicyNames\n */\n function setAllowedPolicyNames(allowedPolicyNames) {\n if (allowedPolicyNames.indexOf('*') !== -1) { // Any policy name is allowed.\n enforceNameWhitelist = false;\n } else {\n enforceNameWhitelist = true;\n allowedNames.length = 0;\n forEach.call(allowedPolicyNames, (el) => {\n push.call(allowedNames, '' + el);\n });\n }\n }\n\n /**\n * Returns the default policy, or null if it was not created.\n * @return {TrustedTypePolicy}\n */\n function getDefaultPolicy() {\n return defaultPolicy;\n }\n\n /**\n * Resets the default policy.\n */\n function resetDefaultPolicy() {\n defaultPolicy = null;\n policyNames.splice(policyNames.indexOf(DEFAULT_POLICY_NAME), 1);\n }\n\n const api = create(TrustedTypePolicyFactory.prototype);\n assign(api, {\n // The main function to create policies.\n createPolicy,\n\n getPolicyNames,\n\n // Type checkers, also validating the object was initialized through a\n // policy.\n isHTML: isTrustedTypeChecker(TrustedHTML),\n isURL: isTrustedTypeChecker(TrustedURL),\n isScriptURL: isTrustedTypeChecker(TrustedScriptURL),\n isScript: isTrustedTypeChecker(TrustedScript),\n\n getAttributeType,\n getPropertyType,\n getTypeMapping,\n emptyHTML,\n defaultPolicy, // Just to make the compiler happy, this is overridden below.\n\n TrustedHTML: TrustedHTML,\n TrustedURL: TrustedURL,\n TrustedScriptURL: TrustedScriptURL,\n TrustedScript: TrustedScript,\n });\n\n defineProperty(api, 'defaultPolicy', {\n get: getDefaultPolicy,\n set: () => {},\n });\n\n return {\n trustedTypes: freeze(api),\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n };\n};\n\n\nexport const {\n trustedTypes,\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n} = trustedTypesBuilderTestOnly();\n\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that only defines the types\n * (i.e. no enforcement logic).\n */\nimport {trustedTypes, TrustedTypePolicy, TrustedTypePolicyFactory} from\n '../trustedtypes.js';\n\nconst tt = trustedTypes;\n\n/**\n * Sets up the public Trusted Types API in the global object.\n */\nfunction setupPolyfill() {\n // We use array accessors to make sure Closure compiler will not alter the\n // names of the properties..\n\n // we only setup the polyfill only in browser environment.\n if (typeof window === 'undefined') {\n return;\n }\n const rootProperty = 'trustedTypes';\n\n // Convert old window.TrustedTypes to window.trustedTypes.\n if (window['TrustedTypes'] && typeof window[rootProperty] === 'undefined') {\n window[rootProperty] = Object.freeze(window['TrustedTypes']);\n }\n\n if (typeof window[rootProperty] !== 'undefined') {\n return;\n }\n\n const publicApi = Object.create(TrustedTypePolicyFactory.prototype);\n Object.assign(publicApi, {\n 'isHTML': tt.isHTML,\n 'isURL': tt.isURL,\n 'isScriptURL': tt.isScriptURL,\n 'isScript': tt.isScript,\n 'createPolicy': tt.createPolicy,\n 'getPolicyNames': tt.getPolicyNames,\n 'getAttributeType': tt.getAttributeType,\n 'getPropertyType': tt.getPropertyType,\n 'getTypeMapping': tt.getTypeMapping,\n 'emptyHTML': tt.emptyHTML,\n '_isPolyfill_': true,\n });\n Object.defineProperty(\n publicApi,\n 'defaultPolicy',\n Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {});\n\n window[rootProperty] = Object.freeze(publicApi);\n\n window['TrustedHTML'] = tt.TrustedHTML;\n window['TrustedURL'] = tt.TrustedURL;\n window['TrustedScriptURL'] = tt.TrustedScriptURL;\n window['TrustedScript'] = tt.TrustedScript;\n window['TrustedTypePolicy'] = TrustedTypePolicy;\n window['TrustedTypePolicyFactory'] = TrustedTypePolicyFactory;\n}\n\nsetupPolyfill();\n\nexport default tt;\n"]} \ No newline at end of file diff --git a/dist/es6/trustedtypes.build.js.map b/dist/es6/trustedtypes.build.js.map index 4f865be2..ac322cd4 100644 --- a/dist/es6/trustedtypes.build.js.map +++ b/dist/es6/trustedtypes.build.js.map @@ -1 +1 @@ -{"version":3,"sources":["src/data/trustedtypeconfig.js","src/trustedtypes.js","src/utils/wrapper.js","src/enforcer.js","src/polyfill/api_only.js","src/polyfill/full.js"],"names":["parseCSP","cspString","WHITESPACE","trim","split","SEMICOLON","map","serializedDirective","reduce","parsed","directive","slice","s","sort","fromCSP","policy","TrustedTypeConfig$$module$src$data$trustedtypeconfig.parseCSP","enforce","DIRECTIVE_NAME","policies","filter","p","charAt","TrustedTypeConfig","isLoggingEnabled","isEnforcementEnabled","allowedPolicyNames","rejectInputFn","TypeError","toLowerCase","toUpperCase","String","prototype","TrustedTypePolicy","TrustedTypePolicyFactory","trustedTypes","setAllowedPolicyNames","trustedTypesBuilderTestOnly","privates","obj","v","privateMap","get","undefined","create","set","selfContained","collection","proto","getPrototypeOf","ObjectPrototype","Error","key","getOwnPropertyNames","defineProperty","value","lockdownTrustedType","SubClass","canonName","freeze","name","isTrustedTypeChecker","type","has","wrapPolicy","policyName","innerPolicy","creator","Ctor","methodName","method","policySpecificType","creatorSymbol","args","result","allowedValue","o","factory","createTypeMapping","writable","configurable","enumerable","getTypeInternal_","tag","container","elNs","attrNs","canonicalTag","apply","ns","HTML_NS","hasOwnProperty","TYPE_MAP","getDefaultPolicy","defaultPolicy","assign","Object","forEach","push","Array","Symbol","WeakMap","policyNames","allowedNames","enforceNameWhitelist","TrustedType","TrustedURL","TrustedScriptURL","TrustedHTML","TrustedScript","emptyHTML","XLINK_NS","SVG_NS","ATTR_PROPERTY_MAP","HTMLIFrameElement","keys","attr","HTMLElement","createFunctionAllowed","api","createPolicy","indexOf","call","console","warn","wrappedPolicy","DEFAULT_POLICY_NAME","getPolicyNames","isHTML","isURL","isScriptURL","isScript","getAttributeType","tagName","attribute","elementNs","attributeNs","canonicalAttr","getPropertyType","property","getTypeMapping","namespaceUri","document","documentElement","namespaceURI","e","JSON","parse","stringify","length","el","resetDefaultPolicy","splice","installFunction","object","fn","Reflect","getOwnPropertyDescriptor","UrlConstructor","window","URL","constructor","stringifyForRangeHack","getConstructorName_","createElement","match","windowOpenObject","insertAdjacentObject","Element","SecurityPolicyViolationEvent","typeMap","TrustedTypes","STRING_TO_TYPE","attrs","k","entries","TYPE_CHECKER_MAP","TYPE_PRODUCER_MAP","wrapSetter_","enforcingSetter","that","enforce_","originalSetter","useObject","descriptor","stopAt","Node","Function","getKey_","originalSetters_","wrapWithEnforceFunction_","argNumber","wrapFunction_","originalFn","wrapSetAttribute_","setAttributeWrapper_","bind","setAttributeNSWrapper_","installScriptMutatorGuards_","fnName","enforceTypeInScriptNodes_","insertAdjacentTextWrapper_","installPropertySetWrappers_","install","config_","ShadowRoot","doc","createRange","r","createContextualFragment","f","toString","childNodes","Range","Document","HTMLDocument","DOMParser","functionBody","maybeCallDefaultPolicy_","typeName","sink","fallbackPolicy","processViolation_","context","propertyName","typeToEnforce","contextName","message","blockedURI","baseURI","href","valueSlice","event","location","isConnected","dispatchEvent","TrustedTypesEnforcer","config","attrName","requiredType","checkParent","objToCheck","parentNode","HTMLScriptElement","arg","nodeType","TEXT_NODE","textContent","createTextNode","fallbackValue","exceptionThrown","riskyPositions","parentElement","includes","textNode","insertBefore","nextSibling","isInlineEventHandler","objName","localName","publicApi","tt","detectPolicy","currentScript","scripts","getElementsByTagName","bodyPrefix","substr","dataset","cspInMeta","head","querySelector","rootProperty","csp","TrustedTypeConfig$$module$src$data$trustedtypeconfig.fromCSP","trustedTypesEnforcer"],"mappings":"A;;;;;;;;aA+DEA,QAAO,GAAQ,CAACC,CAAD,CAAY,CAEzB,MAAMC,EAAa,KACnB,OAAOD,EAAAE,KAAA,EAAAC,MAAA,CAFWC,SAEX,CAAA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EAAJ,CAAA,CA3B4B,CAC1B,MAAMC,EAAMX,EAAA,EAAZ,CACMzB,EAASoC,CAAA,CAAMC,EAAA,CAA0BD,CAA1B,CAAN,CAAuC,IAAI1P,EAAJ,CAC3B,CAAA,CAD2B,CAEvB,CAAA,CAFuB,CAGzB,CAAC,GAAD,CAHyB,CAOtDoL,GAAA,CAF6BwE,IAAIvC,EAAJuC,CAAyBtC,CAAzBsC,CAE7B,CAT0B,CA2B5B","file":"trustedtypes.build.js","sourcesContent":["/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * CSP Directive name controlling Trusted Types behavior.\n * @type {string}\n */\nexport const DIRECTIVE_NAME = 'trusted-types';\n\n/**\n * A configuration object for trusted type enforcement.\n */\nexport class TrustedTypeConfig {\n /**\n * @param {boolean} isLoggingEnabled If true enforcement wrappers will log\n * violations to the console.\n * @param {boolean} isEnforcementEnabled If true enforcement is enabled at\n * runtime.\n * @param {Array} allowedPolicyNames Whitelisted policy names.\n * @param {?string} cspString String with the CSP policy.\n */\n constructor(isLoggingEnabled,\n isEnforcementEnabled,\n allowedPolicyNames,\n cspString = null) {\n /**\n * True if logging is enabled.\n * @type {boolean}\n */\n this.isLoggingEnabled = isLoggingEnabled;\n\n /**\n * True if enforcement is enabled.\n * @type {boolean}\n */\n this.isEnforcementEnabled = isEnforcementEnabled;\n\n /**\n * Allowed policy names.\n * @type {Array}\n */\n this.allowedPolicyNames = allowedPolicyNames;\n\n /**\n * CSP string that defined the policy.\n * @type {?string}\n */\n this.cspString = cspString;\n }\n\n /**\n * Parses a CSP policy.\n * @link https://www.w3.org/TR/CSP3/#parse-serialized-policy\n * @param {string} cspString String with a CSP definition.\n * @return {Object>} Parsed CSP, keyed by directive\n * names.\n */\n static parseCSP(cspString) {\n const SEMICOLON = /\\s*;\\s*/;\n const WHITESPACE = /\\s+/;\n return cspString.trim().split(SEMICOLON)\n .map((serializedDirective) => serializedDirective.split(WHITESPACE))\n .reduce(function(parsed, directive) {\n if (directive[0]) {\n parsed[directive[0]] = directive.slice(1).map((s) => s).sort();\n }\n return parsed;\n }, {});\n }\n\n /**\n * Creates a TrustedTypeConfig object from a CSP string.\n * @param {string} cspString\n * @return {!TrustedTypeConfig}\n */\n static fromCSP(cspString) {\n const isLoggingEnabled = true;\n const policy = TrustedTypeConfig.parseCSP(cspString);\n const enforce = DIRECTIVE_NAME in policy;\n let policies = ['*'];\n if (enforce) {\n policies = policy[DIRECTIVE_NAME].filter((p) => p.charAt(0) !== '\\'');\n }\n\n return new TrustedTypeConfig(\n isLoggingEnabled,\n enforce, /* isEnforcementEnabled */\n policies, /* allowedPolicyNames */\n cspString\n );\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst rejectInputFn = (s) => {\n throw new TypeError('undefined conversion');\n};\n\nconst {toLowerCase, toUpperCase} = String.prototype;\n\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @constructor\n * @property {!function(string):TrustedHTML} createHTML\n * @property {!function(string):TrustedURL} createURL\n * @property {!function(string):TrustedScriptURL} createScriptURL\n * @property {!function(string):TrustedScript} createScript\n * @property {!string} name\n */\nexport const TrustedTypePolicy = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/**\n * @constructor\n */\nexport const TrustedTypePolicyFactory = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypesInnerPolicy}\n * @property {function(string):string} createHTML\n * @property {function(string):string} createURL\n * @property {function(string):string} createScriptURL\n * @property {function(string):string} createScript\n */\nconst TrustedTypesInnerPolicy = {};\n\n/**\n * @typedef {!Object,\n * properties: !Object}>}\n */\nconst TrustedTypesTypeMap = {};\n/* eslint-enable no-unused-vars */\n\nexport const DEFAULT_POLICY_NAME = 'default';\n\n\nexport const trustedTypesBuilderTestOnly = function() {\n // Capture common names early.\n const {\n assign, create, defineProperty, freeze, getOwnPropertyNames,\n getPrototypeOf, prototype: ObjectPrototype,\n } = Object;\n\n const {hasOwnProperty} = ObjectPrototype;\n\n const {\n forEach, push,\n } = Array.prototype;\n\n const creatorSymbol = Symbol();\n\n /**\n * Getter for the privateMap.\n * @param {Object} obj Key of the privateMap\n * @return {Object} Private storage.\n */\n const privates = function(obj) {\n let v = privateMap.get(obj);\n if (v === undefined) {\n v = create(null); // initialize the private storage.\n privateMap.set(obj, v);\n }\n return v;\n };\n\n /**\n * Called before attacker-controlled code on an internal collections,\n * copies prototype members onto the instance directly, so that later\n * changes to prototypes cannot expose collection internals.\n * @param {!T} collection\n * @return {!T} collection\n * @template T\n */\n function selfContained(collection) {\n const proto = getPrototypeOf(collection);\n if (proto == null || getPrototypeOf(proto) !== ObjectPrototype) {\n throw new Error(); // Loop below is insufficient.\n }\n for (const key of getOwnPropertyNames(proto)) {\n defineProperty(collection, key, {value: collection[key]});\n }\n return collection;\n }\n\n /**\n * Map for private properties of Trusted Types object.\n * This is so that the access to the type constructor does not give\n * the ability to create typed values.\n * @type {WeakMap}\n */\n const privateMap = selfContained(new WeakMap());\n\n /**\n * List of all configured policy names.\n * @type {Array}\n */\n const policyNames = selfContained([]);\n\n /**\n * Allowed policy namess for policy names.\n * @type {Array}\n */\n const allowedNames = selfContained([]);\n\n /**\n * A reference to a default policy, if created.\n * @type {TrustedTypePolicy}\n */\n let defaultPolicy = null;\n\n /**\n * Whether to enforce allowedNames in createPolicy().\n * @type {boolean}\n */\n let enforceNameWhitelist = false;\n\n\n /**\n * A value that is trusted to have certain security-relevant properties\n * because the sources of such values are controlled.\n */\n class TrustedType {\n /**\n * Constructor for TrustedType. Only allowed to be called from within a\n * policy.\n * @param {symbol} s creatorSymbol\n * @param {string} policyName The name of the policy this object was\n * created by.\n */\n constructor(s, policyName) {\n // TODO: Figure out if symbol is needed, if the value is in privateMap.\n if (s !== creatorSymbol) {\n throw new Error('cannot call the constructor');\n }\n defineProperty(this, 'policyName',\n {value: '' + policyName, enumerable: true});\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n toString() {\n return privates(this)['v'];\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n valueOf() {\n return privates(this)['v'];\n }\n }\n\n /**\n * @param {function(new:TrustedType, symbol, string)} SubClass\n * @param {string} canonName The class name which should be independent of\n * any renaming pass and which is relied upon by the enforcer and for\n * native type interop.\n */\n function lockdownTrustedType(SubClass, canonName) {\n freeze(SubClass.prototype);\n delete SubClass.name;\n defineProperty(SubClass, 'name', {value: canonName});\n }\n\n /**\n * Trusted URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedURL extends TrustedType {\n }\n lockdownTrustedType(TrustedURL, 'TrustedURL');\n\n /**\n * Trusted Script URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScriptURL extends TrustedType {\n }\n lockdownTrustedType(TrustedScriptURL, 'TrustedScriptURL');\n\n /**\n * Trusted HTML object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedHTML extends TrustedType {\n }\n lockdownTrustedType(TrustedHTML, 'TrustedHTML');\n\n /**\n * Trusted Script object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScript extends TrustedType {\n }\n lockdownTrustedType(TrustedScript, 'TrustedScript');\n\n lockdownTrustedType(TrustedType, 'TrustedType');\n\n // Common constants.\n const emptyHTML = freeze(create(new TrustedHTML(creatorSymbol, '')));\n privates(emptyHTML)['v'] = '';\n\n /**\n * A map of attribute / property names to allowed types\n * for known namespaces.\n * @type {!Object}\n * @export\n */\n const TYPE_MAP = {\n [HTML_NS]: {\n // TODO(koto): Figure out what to to with \n 'A': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'AREA': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BASE': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BUTTON': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'EMBED': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n },\n },\n 'FORM': {\n 'attributes': {\n 'action': TrustedURL.name,\n },\n },\n 'FRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n },\n },\n 'IFRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n 'srcdoc': TrustedHTML.name,\n },\n },\n 'INPUT': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'OBJECT': {\n 'attributes': {\n 'data': TrustedScriptURL.name,\n 'codebase': TrustedScriptURL.name,\n },\n },\n // TODO(koto): Figure out what to do with portals.\n 'SCRIPT': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n 'text': TrustedScript.name,\n },\n 'properties': {\n 'innerText': TrustedScript.name,\n 'textContent': TrustedScript.name,\n 'text': TrustedScript.name,\n },\n },\n '*': {\n 'attributes': {},\n 'properties': {\n 'innerHTML': TrustedHTML.name,\n 'outerHTML': TrustedHTML.name,\n },\n },\n },\n [XLINK_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n [SVG_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n };\n\n /**\n * A map of element property to HTML attribute names.\n * @type {!Object}\n */\n const ATTR_PROPERTY_MAP = {\n 'codebase': 'codeBase',\n 'formaction': 'formAction',\n };\n\n // Edge doesn't support srcdoc.\n if (!('srcdoc' in HTMLIFrameElement.prototype)) {\n delete TYPE_MAP[HTML_NS]['IFRAME']['attributes']['srcdoc'];\n }\n\n // in HTML, clone attributes into properties.\n for (const tag of Object.keys(TYPE_MAP[HTML_NS])) {\n if (!TYPE_MAP[HTML_NS][tag]['properties']) {\n TYPE_MAP[HTML_NS][tag]['properties'] = {};\n }\n for (const attr of Object.keys(TYPE_MAP[HTML_NS][tag]['attributes'])) {\n TYPE_MAP[HTML_NS][tag]['properties'][\n ATTR_PROPERTY_MAP[attr] ? ATTR_PROPERTY_MAP[attr] : attr\n ] = TYPE_MAP[HTML_NS][tag]['attributes'][attr];\n }\n }\n\n // Add inline event handlers attribute names.\n for (const name of getOwnPropertyNames(HTMLElement.prototype)) {\n if (name.slice(0, 2) === 'on') {\n TYPE_MAP[HTML_NS]['*']['attributes'][name] = 'TrustedScript';\n }\n }\n\n /**\n * @type {!Object}\n */\n const createTypeMapping = {\n 'createHTML': TrustedHTML,\n 'createScriptURL': TrustedScriptURL,\n 'createURL': TrustedURL,\n 'createScript': TrustedScript,\n };\n\n const createFunctionAllowed = createTypeMapping.hasOwnProperty;\n\n /**\n * Function generating a type checker.\n * @template T\n * @param {T} type The type to check against.\n * @return {function(*):boolean}\n */\n function isTrustedTypeChecker(type) {\n return (obj) => (obj instanceof type) && privateMap.has(obj);\n }\n\n /**\n * Wraps a user-defined policy rules with TT constructor\n * @param {string} policyName The policy name\n * @param {TrustedTypesInnerPolicy} innerPolicy InnerPolicy\n * @return {!TrustedTypePolicy} Frozen policy object\n */\n function wrapPolicy(policyName, innerPolicy) {\n /**\n * @template T\n * @param {function(new:T, symbol, string)} Ctor a trusted type constructor\n * @param {string} methodName the policy factory method name\n * @return {function(string):!T} a factory that produces instances of Ctor.\n */\n function creator(Ctor, methodName) {\n // This causes thisValue to be null when called below.\n const method = innerPolicy[methodName] || rejectInputFn;\n const policySpecificType = freeze(new Ctor(creatorSymbol, policyName));\n const factory = {\n [methodName](s, ...args) {\n // Trick to get methodName to show in stacktrace.\n let result = method('' + s, ...args);\n if (result === undefined || result === null) {\n result = '';\n }\n const allowedValue = '' + result;\n const o = freeze(create(policySpecificType));\n privates(o)['v'] = allowedValue;\n return o;\n },\n }[methodName];\n return freeze(factory);\n }\n\n const policy = create(TrustedTypePolicy.prototype);\n\n for (const name of getOwnPropertyNames(createTypeMapping)) {\n policy[name] = creator(createTypeMapping[name], name);\n }\n defineProperty(policy, 'name', {\n value: policyName,\n writable: false,\n configurable: false,\n enumerable: true,\n });\n\n return /** @type {!TrustedTypePolicy} */ (freeze(policy));\n }\n\n /**\n * Returns the name of the trusted type required for a given element\n * attribute.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} attribute The name of the attribute.\n * @param {string=} elementNs Element namespace.\n * @param {string=} attributeNs The attribute namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getAttributeType(tagName, attribute, elementNs = '',\n attributeNs = '') {\n const canonicalAttr = toLowerCase.apply(String(attribute));\n return getTypeInternal_(tagName, 'attributes', canonicalAttr,\n elementNs, attributeNs);\n }\n\n /**\n * Returns a type name from a type map.\n * @param {string} tag A tag name.\n * @param {string} container 'attributes' or 'properties'\n * @param {string} name The attribute / property name.\n * @param {string=} elNs Element namespace.\n * @param {string=} attrNs Attribute namespace.\n * @return {string|undefined}\n * @private\n */\n function getTypeInternal_(tag, container, name, elNs = '', attrNs = '') {\n const canonicalTag = toUpperCase.apply(String(tag));\n\n let ns = attrNs ? attrNs : elNs;\n if (!ns) {\n ns = HTML_NS;\n }\n const map = hasOwnProperty.apply(TYPE_MAP, [ns]) ? TYPE_MAP[ns] : null;\n if (!map) {\n return;\n }\n if (hasOwnProperty.apply(map, [canonicalTag]) &&\n map[canonicalTag] &&\n hasOwnProperty.apply(map[canonicalTag][container], [name]) &&\n map[canonicalTag][container][name]) {\n return map[canonicalTag][container][name];\n }\n\n if (hasOwnProperty.apply(map, ['*']) &&\n hasOwnProperty.apply(map['*'][container], [name]) &&\n map['*'][container][name]) {\n return map['*'][container][name];\n }\n }\n\n /**\n * Returns the name of the trusted type required for a given element property.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} property The property.\n * @param {string=} elementNs Element namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getPropertyType(tagName, property, elementNs = '') {\n // TODO: Support namespaces.\n return getTypeInternal_(tagName, 'properties', String(property), elementNs);\n }\n\n /**\n * Returns the type map-like object, that resolves a name of a type for a\n * given tag + attribute / property in a given namespace.\n * The keys of the map are uppercase tag names. Map entry has mappings between\n * a lowercase attribute name / case-sensitive property name and a name of the\n * type that is required for that attribute / property.\n * Example entry for 'IMG': {\"attributes\": {\"src\": \"TrustedHTML\"}}\n * @param {string=} namespaceUri The namespace URI (will use the current\n * document namespace URI if omitted).\n * @return {TrustedTypesTypeMap}\n */\n function getTypeMapping(namespaceUri = '') {\n if (!namespaceUri) {\n try {\n namespaceUri = document.documentElement.namespaceURI;\n } catch (e) {\n namespaceUri = HTML_NS;\n }\n }\n /**\n * @template T\n * @private\n * @param {T} o\n * @return {T}\n */\n function deepClone(o) {\n return JSON.parse(JSON.stringify(o));\n }\n const map = TYPE_MAP[namespaceUri];\n if (!map) {\n return {};\n }\n return deepClone(map);\n }\n\n /**\n * Returns all configured policy names (even for non-exposed policies).\n * @return {!Array}\n */\n function getPolicyNames() {\n // TODO(msamuel): Should we sort policyNames to avoid leaking or\n // encouraging dependency on the order in which policy names are\n // registered? I think JavaScript builtin sorts are efficient for\n // almost-sorted lists so the amortized cost is close to O(n).\n return policyNames.slice();\n }\n\n /**\n * Creates a TT policy.\n *\n * Returns a frozen object representing a policy - a collection of functions\n * that may create TT objects based on the user-provided rules specified\n * in the policy object.\n *\n * @param {string} name A unique name of the policy.\n * @param {TrustedTypesInnerPolicy} policy Policy rules object.\n * @return {TrustedTypePolicy} The policy that may create TT objects\n * according to the policy rules.\n */\n function createPolicy(name, policy) {\n const pName = '' + name; // Assert it's a string\n\n if (enforceNameWhitelist && allowedNames.indexOf(pName) === -1) {\n throw new TypeError('Policy ' + pName + ' disallowed.');\n }\n\n if (policyNames.indexOf(pName) !== -1) {\n throw new TypeError('Policy ' + pName + ' exists.');\n }\n // Register the name early so that if policy getters unwisely calls\n // across protection domains to code that reenters this function,\n // policy author still has rights to the name.\n policyNames.push(pName);\n\n // Only copy own properties of names present in createTypeMapping.\n const innerPolicy = create(null);\n if (policy && typeof policy === 'object') {\n // Treat non-objects as empty policies.\n for (const key of getOwnPropertyNames(policy)) {\n if (createFunctionAllowed.call(createTypeMapping, key)) {\n innerPolicy[key] = policy[key];\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn('trustedTypes.createPolicy ' + pName +\n ' was given an empty policy');\n }\n freeze(innerPolicy);\n\n const wrappedPolicy = wrapPolicy(pName, innerPolicy);\n\n if (pName === DEFAULT_POLICY_NAME) {\n defaultPolicy = wrappedPolicy;\n }\n\n return wrappedPolicy;\n }\n\n /**\n * Applies the policy name whitelist.\n * @param {!Array} allowedPolicyNames\n */\n function setAllowedPolicyNames(allowedPolicyNames) {\n if (allowedPolicyNames.indexOf('*') !== -1) { // Any policy name is allowed.\n enforceNameWhitelist = false;\n } else {\n enforceNameWhitelist = true;\n allowedNames.length = 0;\n forEach.call(allowedPolicyNames, (el) => {\n push.call(allowedNames, '' + el);\n });\n }\n }\n\n /**\n * Returns the default policy, or null if it was not created.\n * @return {TrustedTypePolicy}\n */\n function getDefaultPolicy() {\n return defaultPolicy;\n }\n\n /**\n * Resets the default policy.\n */\n function resetDefaultPolicy() {\n defaultPolicy = null;\n policyNames.splice(policyNames.indexOf(DEFAULT_POLICY_NAME), 1);\n }\n\n const api = create(TrustedTypePolicyFactory.prototype);\n assign(api, {\n // The main function to create policies.\n createPolicy,\n\n getPolicyNames,\n\n // Type checkers, also validating the object was initialized through a\n // policy.\n isHTML: isTrustedTypeChecker(TrustedHTML),\n isURL: isTrustedTypeChecker(TrustedURL),\n isScriptURL: isTrustedTypeChecker(TrustedScriptURL),\n isScript: isTrustedTypeChecker(TrustedScript),\n\n getAttributeType,\n getPropertyType,\n getTypeMapping,\n emptyHTML,\n defaultPolicy, // Just to make the compiler happy, this is overridden below.\n\n TrustedHTML: TrustedHTML,\n TrustedURL: TrustedURL,\n TrustedScriptURL: TrustedScriptURL,\n TrustedScript: TrustedScript,\n });\n\n defineProperty(api, 'defaultPolicy', {\n get: getDefaultPolicy,\n set: () => {},\n });\n\n return {\n trustedTypes: freeze(api),\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n };\n};\n\n\nexport const {\n trustedTypes,\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n} = trustedTypesBuilderTestOnly();\n\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst {\n defineProperty,\n} = Object;\n\n/**\n * Installs the setter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} setter A setter function}\n */\nexport function installSetter(object, name, setter) {\n const descriptor = {\n set: setter,\n };\n defineProperty(object, name, descriptor);\n}\n\n/**\n * Installs a setter and getter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} setter A setter function}\n * @param {function(*): *|undefined} getter A getter function}\n */\nexport function installSetterAndGetter(object, name, setter, getter) {\n const descriptor = {\n set: setter,\n get: getter,\n configurable: true, // This can get uninstalled, we need configurable: true\n };\n defineProperty(object, name, descriptor);\n}\n\n/**\n * Installs the setter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} fn A function}\n */\nexport function installFunction(object, name, fn) {\n defineProperty(object, name, {\n value: fn,\n });\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/* eslint-disable no-unused-vars */\nimport {DIRECTIVE_NAME, TrustedTypeConfig} from './data/trustedtypeconfig.js';\nimport {\n trustedTypes as TrustedTypes,\n setAllowedPolicyNames,\n resetDefaultPolicy,\n HTML_NS,\n} from\n './trustedtypes.js';\n\n/* eslint-enable no-unused-vars */\nimport {installFunction, installSetter, installSetterAndGetter}\n from './utils/wrapper.js';\n\nconst {apply} = Reflect;\nconst {\n getOwnPropertyNames,\n getOwnPropertyDescriptor,\n getPrototypeOf,\n} = Object;\n\nconst {\n hasOwnProperty,\n isPrototypeOf,\n} = Object.prototype;\n\nconst {slice} = String.prototype;\n\n// No URL in IE 11.\nconst UrlConstructor = typeof window.URL == 'function' ?\n URL.prototype.constructor :\n null;\n\nlet stringifyForRangeHack;\n\n/**\n * Return object constructor name\n * (their function.name is not available in IE 11).\n * @param {*} fn\n * @return {string}\n * @private\n */\nconst getConstructorName_ = document.createElement('div').constructor.name ?\n (fn) => fn.name :\n (fn) => ('' + fn).match(/^\\[object (\\S+)\\]$/)[1];\n\n// window.open on IE 11 is set on WindowPrototype\nconst windowOpenObject = getOwnPropertyDescriptor(window, 'open') ?\n window :\n window.constructor.prototype;\n\n// In IE 11, insertAdjacent(HTML|Text) is on HTMLElement prototype\nconst insertAdjacentObject = apply(hasOwnProperty, Element.prototype,\n ['insertAdjacentHTML']) ? Element.prototype : HTMLElement.prototype;\n\n// This is not available in release Firefox :(\n// https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent\n// https://bugzilla.mozilla.org/show_bug.cgi?id=1432523\nconst SecurityPolicyViolationEvent = window['SecurityPolicyViolationEvent'] ||\n null;\n\n/**\n * Parses URL, catching all the errors.\n * @param {string} url URL string to parse.\n * @return {URL|null}\n */\nfunction parseUrl_(url) {\n try {\n return new UrlConstructor(url, document.baseURI || undefined);\n } catch (e) {\n return null;\n }\n}\n\n// We don't actually need other namespaces.\n// setAttribute is hooked on Element.prototype, which all elements inherit from,\n// and all sensitive property wrappers are hooked directly on Element as well.\nconst typeMap = TrustedTypes.getTypeMapping(HTML_NS);\n\nconst STRING_TO_TYPE = {\n 'TrustedHTML': TrustedTypes.TrustedHTML,\n 'TrustedScript': TrustedTypes.TrustedScript,\n 'TrustedScriptURL': TrustedTypes.TrustedScriptURL,\n 'TrustedURL': TrustedTypes.TrustedURL,\n};\n\n/**\n * Converts an uppercase tag name to an element constructor function name.\n * Used for property setter hijacking only.\n * @param {string} tagName\n * @return {string}\n */\nfunction convertTagToConstructor(tagName) {\n if (tagName == '*') {\n return 'HTMLElement';\n }\n return getConstructorName_(document.createElement(tagName).constructor);\n}\n\nfor (const tagName of Object.keys(typeMap)) {\n const attrs = typeMap[tagName]['properties'];\n for (const [k, v] of Object.entries(attrs)) {\n attrs[k] = STRING_TO_TYPE[v];\n }\n}\n\n/**\n * Map of type names to type checking function.\n * @type {!Object}\n */\nconst TYPE_CHECKER_MAP = {\n 'TrustedHTML': TrustedTypes.isHTML,\n 'TrustedURL': TrustedTypes.isURL,\n 'TrustedScriptURL': TrustedTypes.isScriptURL,\n 'TrustedScript': TrustedTypes.isScript,\n};\n\n/**\n * Map of type names to type producing function.\n * @type {Object}\n */\nconst TYPE_PRODUCER_MAP = {\n 'TrustedHTML': 'createHTML',\n 'TrustedURL': 'createURL',\n 'TrustedScriptURL': 'createScriptURL',\n 'TrustedScript': 'createScript',\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypePolicy}\n * @property {function(string):TrustedHTML} createHTML\n * @property {function(string):TrustedURL} createURL\n * @property {function(string):TrustedScriptURL} createScriptURL\n * @property {function(string):TrustedScript} createScript\n */\nconst TrustedTypePolicy = {};\n/* eslint-enable no-unused-vars */\n\n\n/**\n * An object for enabling trusted type enforcement.\n */\nexport class TrustedTypesEnforcer {\n /**\n * @param {!TrustedTypeConfig} config The configuration for\n * trusted type enforcement.\n */\n constructor(config) {\n /**\n * A configuration for the trusted type enforcement.\n * @private {!TrustedTypeConfig}\n */\n this.config_ = config;\n /**\n * @private {Object}\n */\n this.originalSetters_ = {};\n }\n\n /**\n * Wraps HTML sinks with an enforcement setter, which will enforce\n * trusted types and do logging, if enabled.\n *\n */\n install() {\n setAllowedPolicyNames(this.config_.allowedPolicyNames);\n\n if (!this.config_.isEnforcementEnabled && !this.config_.isLoggingEnabled) {\n return;\n }\n\n if ('ShadowRoot' in window) {\n this.wrapSetter_(ShadowRoot.prototype, 'innerHTML',\n TrustedTypes.TrustedHTML);\n }\n stringifyForRangeHack = (function(doc) {\n const r = doc.createRange();\n // In IE 11 Range.createContextualFragment doesn't stringify its argument.\n const f = r.createContextualFragment(/** @type {string} */ (\n {toString: () => '
'}));\n return f.childNodes.length == 0;\n })(document);\n\n this.wrapWithEnforceFunction_(Range.prototype, 'createContextualFragment',\n TrustedTypes.TrustedHTML, 0);\n\n this.wrapWithEnforceFunction_(insertAdjacentObject,\n 'insertAdjacentHTML',\n TrustedTypes.TrustedHTML, 1);\n\n if (getOwnPropertyDescriptor(Document.prototype, 'write')) {\n // Chrome\n this.wrapWithEnforceFunction_(Document.prototype, 'write',\n TrustedTypes.TrustedHTML, 0);\n this.wrapWithEnforceFunction_(Document.prototype, 'open',\n TrustedTypes.TrustedURL, 0);\n } else {\n // Firefox\n this.wrapWithEnforceFunction_(HTMLDocument.prototype, 'write',\n TrustedTypes.TrustedHTML, 0);\n this.wrapWithEnforceFunction_(HTMLDocument.prototype, 'open',\n TrustedTypes.TrustedURL, 0);\n }\n\n this.wrapWithEnforceFunction_(windowOpenObject, 'open',\n TrustedTypes.TrustedURL, 0);\n\n if ('DOMParser' in window) {\n this.wrapWithEnforceFunction_(DOMParser.prototype, 'parseFromString',\n TrustedTypes.TrustedHTML, 0);\n }\n this.wrapWithEnforceFunction_(window, 'setInterval',\n TrustedTypes.TrustedScript, 0);\n this.wrapWithEnforceFunction_(window, 'setTimeout',\n TrustedTypes.TrustedScript, 0);\n this.wrapSetAttribute_();\n this.installScriptMutatorGuards_();\n this.installPropertySetWrappers_();\n }\n\n /**\n * Removes the original setters.\n */\n uninstall() {\n setAllowedPolicyNames(['*']);\n\n if (!this.config_.isEnforcementEnabled && !this.config_.isLoggingEnabled) {\n return;\n }\n\n if ('ShadowRoot' in window) {\n this.restoreSetter_(ShadowRoot.prototype, 'innerHTML');\n }\n this.restoreFunction_(Range.prototype, 'createContextualFragment');\n this.restoreFunction_(insertAdjacentObject, 'insertAdjacentHTML');\n this.restoreFunction_(Element.prototype, 'setAttribute');\n this.restoreFunction_(Element.prototype, 'setAttributeNS');\n\n if (getOwnPropertyDescriptor(Document.prototype, 'write')) {\n this.restoreFunction_(Document.prototype, 'write');\n this.restoreFunction_(Document.prototype, 'open');\n } else {\n this.restoreFunction_(HTMLDocument.prototype, 'write');\n this.restoreFunction_(HTMLDocument.prototype, 'open');\n }\n this.restoreFunction_(windowOpenObject, 'open');\n\n if ('DOMParser' in window) {\n this.restoreFunction_(DOMParser.prototype, 'parseFromString');\n }\n this.restoreFunction_(window, 'setTimeout');\n this.restoreFunction_(window, 'setInterval');\n this.uninstallPropertySetWrappers_();\n this.uninstallScriptMutatorGuards_();\n resetDefaultPolicy();\n }\n\n /**\n * Installs type-enforcing wrappers for APIs that allow to modify\n * script element texts.\n * @private\n */\n installScriptMutatorGuards_() {\n const that = this;\n\n ['appendChild', 'insertBefore', 'replaceChild'].forEach((fnName) => {\n this.wrapFunction_(\n Node.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ false, originalFn)\n .apply(that, args);\n });\n });\n this.wrapFunction_(\n insertAdjacentObject,\n 'insertAdjacentText',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.insertAdjacentTextWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n\n if ('after' in Element.prototype) {\n ['after', 'before', 'replaceWith'].forEach((fnName) => {\n this.wrapFunction_(\n Element.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ true, originalFn)\n .apply(that, args);\n });\n });\n ['append', 'prepend'].forEach((fnName) => {\n this.wrapFunction_(\n Element.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ false, originalFn)\n .apply(that, args);\n });\n });\n }\n }\n\n /**\n * Uninstalls type-enforcing wrappers for APIs that allow to modify\n * script element texts.\n * @private\n */\n uninstallScriptMutatorGuards_() {\n this.restoreFunction_(Node.prototype, 'appendChild');\n this.restoreFunction_(Node.prototype, 'insertBefore');\n this.restoreFunction_(Node.prototype, 'replaceChild');\n this.restoreFunction_(insertAdjacentObject, 'insertAdjacentText');\n if ('after' in Element.prototype) {\n ['after', 'before', 'replaceWith', 'append', 'prepend'].forEach(\n (fnName) => this.restoreFunction_(Element.prototype, fnName));\n }\n }\n\n /**\n * Installs wrappers for directly setting properties\n * based on the type map.\n * @private\n */\n installPropertySetWrappers_() {\n /* eslint-disable guard-for-in */\n for (const tag of getOwnPropertyNames(typeMap)) {\n for (const property of getOwnPropertyNames(typeMap[tag]['properties'])) {\n this.wrapSetter_(\n window[convertTagToConstructor(tag)].prototype,\n property,\n typeMap[tag]['properties'][property]);\n }\n }\n }\n\n /**\n * Uninstalls wrappers for directly setting properties\n * based on the type map.\n * @private\n */\n uninstallPropertySetWrappers_() {\n /* eslint-disable guard-for-in */\n for (const tag of getOwnPropertyNames(typeMap)) {\n for (const property of getOwnPropertyNames(typeMap[tag]['properties'])) {\n this.restoreSetter_(\n window[convertTagToConstructor(tag)].prototype,\n property);\n }\n }\n }\n\n /** Wraps set attribute with an enforcement function. */\n wrapSetAttribute_() {\n const that = this;\n this.wrapFunction_(\n Element.prototype,\n 'setAttribute',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.setAttributeWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n this.wrapFunction_(\n Element.prototype,\n 'setAttributeNS',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.setAttributeNSWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n }\n\n /**\n * Enforces type checking for Element.prototype.setAttribute.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original setAttribute function.\n * @return {*}\n */\n setAttributeWrapper_(context, originalFn, ...args) {\n // Note(slekies): In a normal application constructor should never be null.\n // However, there are no guarantees. If the constructor is null, we cannot\n // determine whether a special type is required. In order to not break the\n // application, we will not do any further type checks and pass the call\n // to setAttribute.\n if (context.constructor !== null && context instanceof Element) {\n const attrName = (args[0] = String(args[0])).toLowerCase();\n const requiredType = TrustedTypes.getAttributeType(context.tagName,\n attrName, context.namespaceURI);\n if (requiredType && apply(hasOwnProperty, STRING_TO_TYPE,\n [requiredType])) {\n return this.enforce_(\n context, 'setAttribute', STRING_TO_TYPE[requiredType],\n originalFn, 1, args);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Enforces type checking for Element.prototype.setAttributeNS.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original setAttributeNS function.\n * @return {*}\n */\n setAttributeNSWrapper_(context, originalFn, ...args) {\n // See the note from setAttributeWrapper_ above.\n if (context.constructor !== null && context instanceof Element) {\n const ns = args[0] ? String(args[0]) : null;\n args[0] = ns;\n const attrName = (args[1] = String(args[1])).toLowerCase();\n const requiredType = TrustedTypes.getAttributeType(context.tagName,\n attrName, context.namespaceURI, ns);\n if (requiredType && apply(hasOwnProperty, STRING_TO_TYPE,\n [requiredType])) {\n return this.enforce_(context, 'setAttributeNS',\n STRING_TO_TYPE[requiredType],\n originalFn, 2, args);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Wrapper for DOM mutator functions that enforces type checks if the context\n * (or, optionally, its parent node) is a script node.\n * For each argument, it will make sure that text nodes pass through a\n * default policy, or generate a violation. To skip that check, pass\n * TrustedScript objects instead.\n * @param {!Object} context The context for the call to the original function.\n * @param {boolean} checkParent Check parent of context instead.\n * @param {!Function} originalFn The original mutator function.\n * @return {*}\n */\n enforceTypeInScriptNodes_(context, checkParent, originalFn, ...args) {\n const objToCheck = checkParent ? context.parentNode : context;\n if (objToCheck instanceof HTMLScriptElement && args.length > 0) {\n for (let argNumber = 0; argNumber < args.length; argNumber++) {\n let arg = args[argNumber];\n if (arg instanceof Node && arg.nodeType !== Node.TEXT_NODE) {\n continue; // Type is not interesting\n }\n if (arg instanceof Node && arg.nodeType == Node.TEXT_NODE) {\n arg = arg.textContent;\n } else if (TrustedTypes.isScript(arg)) {\n // TODO(koto): Consider removing this branch, as it's hard to spec.\n // Convert to text node and go on.\n args[argNumber] = document.createTextNode(arg);\n continue;\n }\n\n // Try to run a default policy on argsthe argument\n let fallbackValue;\n let exceptionThrown;\n try {\n fallbackValue = this.maybeCallDefaultPolicy_(\n 'TrustedScript', arg, 'script.text');\n } catch (e) {\n exceptionThrown = true;\n }\n if (exceptionThrown) {\n this.processViolation_(context, originalFn.name,\n TrustedTypes.TrustedScript, arg);\n }\n args[argNumber] = document.createTextNode('' + fallbackValue);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Wrapper for Element.insertAdjacentText that enforces type checks for\n * inserting text into a script node.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original insertAdjacentText function.\n */\n insertAdjacentTextWrapper_(context, originalFn, ...args) {\n const riskyPositions = ['beforebegin', 'afterend'];\n if (context instanceof Element &&\n context.parentElement instanceof HTMLScriptElement &&\n args.length > 1 &&\n riskyPositions.includes(args[0]) &&\n !(TrustedTypes.isScript(args[1]))) {\n // Run a default policy on args[1]\n let fallbackValue;\n let exceptionThrown;\n try {\n fallbackValue = this.maybeCallDefaultPolicy_('TrustedScript',\n args[1], 'script.text');\n } catch (e) {\n exceptionThrown = true;\n }\n if (exceptionThrown) {\n this.processViolation_(context, 'insertAdjacentText',\n TrustedTypes.TrustedScript, args[1]);\n }\n\n const textNode = document.createTextNode('' + fallbackValue);\n\n\n const insertBefore = /** @type function(this: Node) */(\n this.originalSetters_[this.getKey_(Node.prototype, 'insertBefore')]);\n\n switch (args[0]) {\n case riskyPositions[0]: // 'beforebegin'\n apply(insertBefore, context.parentElement,\n [textNode, context]);\n break;\n case riskyPositions[1]: // 'afterend'\n apply(insertBefore, context.parentElement,\n [textNode, context.nextSibling]);\n break;\n }\n return;\n }\n apply(originalFn, context, args);\n }\n\n /**\n * Wraps a setter with the enforcement wrapper.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Function} type The type to enforce.\n * @param {number} argNumber Number of the argument to enforce the type of.\n * @private\n */\n wrapWithEnforceFunction_(object, name, type, argNumber) {\n const that = this;\n this.wrapFunction_(\n object,\n name,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforce_.call(that, this, name, type, originalFn,\n argNumber, args);\n });\n }\n\n\n /**\n * Wraps an existing function with a given function body and stores the\n * original function.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {function(!Function, ...*)} functionBody The wrapper function.\n */\n wrapFunction_(object, name, functionBody) {\n const descriptor = getOwnPropertyDescriptor(object, name);\n const originalFn = /** @type function(*):* */ (\n descriptor ? descriptor.value : null);\n\n if (!(originalFn instanceof Function)) {\n throw new TypeError(\n 'Property ' + name + ' on object' + object + ' is not a function');\n }\n\n const key = this.getKey_(object, name);\n if (this.originalSetters_[key]) {\n throw new Error(\n `TrustedTypesEnforcer: Double installation detected: ${key} ${name}`);\n }\n installFunction(\n object,\n name,\n /**\n * @this {TrustedTypesEnforcer}\n * @return {*}\n */\n function(...args) {\n return functionBody.bind(this, originalFn).apply(this, args);\n });\n this.originalSetters_[key] = originalFn;\n }\n\n /**\n * Wraps a setter with the enforcement wrapper.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Function} type The type to enforce.\n * @param {!Object=} descriptorObject If present, will reuse the\n * setter/getter from this one, instead of object. Used for redefining\n * setters in subclasses.\n * @private\n */\n wrapSetter_(object, name, type, descriptorObject = undefined) {\n if (descriptorObject && !isPrototypeOf.call(descriptorObject, object)) {\n throw new Error('Invalid prototype chain');\n }\n\n let useObject = descriptorObject || object;\n let descriptor;\n let originalSetter;\n const stopAt = getPrototypeOf(Node.prototype);\n\n // Find the descriptor on the object or its prototypes, stopping at Node.\n do {\n descriptor = getOwnPropertyDescriptor(useObject, name);\n originalSetter = /** @type {function(*):*} */ (descriptor ?\n descriptor.set : null);\n if (!originalSetter) {\n useObject = getPrototypeOf(useObject) || stopAt;\n }\n } while (!(originalSetter || useObject === stopAt || !useObject));\n\n if (!(originalSetter instanceof Function)) {\n throw new TypeError(\n 'No setter for property ' + name + ' on object' + object);\n }\n\n const key = this.getKey_(object, name);\n if (this.originalSetters_[key]) {\n throw new Error(\n `TrustedTypesEnforcer: Double installation detected: ${key} ${name}`);\n }\n const that = this;\n /**\n * @this {TrustedTypesEnforcer}\n * @param {*} value\n */\n const enforcingSetter = function(value) {\n that.enforce_.call(that, this, name, type, originalSetter, 0,\n [value]);\n };\n\n if (useObject === object) {\n installSetter(\n object,\n name,\n enforcingSetter);\n } else {\n // Since we're creating a new setter in subclass, we also need to\n // overwrite the getter.\n installSetterAndGetter(\n object,\n name,\n enforcingSetter,\n descriptor.get\n );\n }\n this.originalSetters_[key] = originalSetter;\n }\n\n /**\n * Restores the original setter for the property, as encountered during\n * install().\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Object=} descriptorObject If present, will restore the original\n * setter/getter from this one, instead of object.\n * @private\n */\n restoreSetter_(object, name, descriptorObject = undefined) {\n const key = this.getKey_(object, name);\n if (descriptorObject && !isPrototypeOf.call(descriptorObject, object)) {\n throw new Error('Invalid prototype chain');\n }\n if (!this.originalSetters_[key]) {\n throw new Error(\n // eslint-disable-next-line max-len\n `TrustedTypesEnforcer: Cannot restore (double uninstallation?): ${key} ${name}`);\n }\n if (descriptorObject) {\n // We have to also overwrite a getter.\n installSetterAndGetter(object, name, this.originalSetters_[key],\n getOwnPropertyDescriptor(descriptorObject, name).get);\n } else {\n installSetter(object, name, this.originalSetters_[key]);\n }\n delete this.originalSetters_[key];\n }\n\n /**\n * Restores the original method of an object, as encountered during install().\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @private\n */\n restoreFunction_(object, name) {\n const key = this.getKey_(object, name);\n if (!this.originalSetters_[key]) {\n throw new Error(\n // eslint-disable-next-line max-len\n `TrustedTypesEnforcer: Cannot restore (double uninstallation?): ${key} ${name}`);\n }\n installFunction(object, name, this.originalSetters_[key]);\n delete this.originalSetters_[key];\n }\n\n /**\n * Returns the key name for caching original setters.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @return {string} Key name.\n * @private\n */\n getKey_(object, name) {\n // TODO(msamuel): Can we use Object.prototype.toString.call(object)\n // to get an unspoofable string here?\n // TODO(msamuel): fail on '-' in object.constructor.name?\n // No Function.name in IE 11\n const ctrName = '' + (\n object.constructor.name ?\n object.constructor.name :\n object.constructor);\n return ctrName + '-' + name;\n }\n\n\n /**\n * Calls a default policy.\n * @param {string} typeName Type name to attempt to produce from a value.\n * @param {*} value The value to pass to a default policy\n * @param {string} sink The sink name that the default policy will be called\n * with.\n * @throws {Error} If the default policy throws, or not exist.\n * @return {Function} The trusted value.\n */\n maybeCallDefaultPolicy_(typeName, value, sink = '') {\n // Apply a fallback policy, if it exists.\n const fallbackPolicy = TrustedTypes.defaultPolicy;\n if (!fallbackPolicy) {\n throw new Error('Default policy does not exist');\n }\n if (!TYPE_CHECKER_MAP.hasOwnProperty(typeName)) {\n throw new Error();\n }\n return fallbackPolicy[TYPE_PRODUCER_MAP[typeName]](value, '' + sink);\n }\n\n /**\n * Logs and enforces TrustedTypes depending on the given configuration.\n * @template T\n * @param {!Object} context The object that the setter is called for.\n * @param {string} propertyName The name of the property.\n * @param {!Function} typeToEnforce The type to enforce.\n * @param {function(?):T} originalSetter Original setter.\n * @param {number} argNumber Number of argument to enforce the type of.\n * @param {Array} args Arguments.\n * @return {T}\n * @private\n */\n enforce_(context, propertyName, typeToEnforce, originalSetter, argNumber,\n args) {\n const value = args[argNumber];\n const typeName = '' + typeToEnforce.name;\n // If typed value is given, pass through.\n if (TYPE_CHECKER_MAP.hasOwnProperty(typeName) &&\n TYPE_CHECKER_MAP[typeName](value)) {\n if (stringifyForRangeHack &&\n propertyName == 'createContextualFragment') {\n // IE 11 hack, somehow the value is not stringified implicitly.\n args[argNumber] = args[argNumber].toString();\n }\n return apply(originalSetter, context, args);\n }\n\n if (typeToEnforce === TrustedTypes.TrustedScript) {\n const isInlineEventHandler =\n propertyName == 'setAttribute' ||\n propertyName === 'setAttributeNS' ||\n apply(slice, propertyName, [0, 2]) === 'on';\n // If a function (instead of string) is passed to inline event attribute,\n // or set(Timeout|Interval), pass through.\n const propertyAcceptsFunctions =\n propertyName === 'setInterval' ||\n propertyName === 'setTimeout' ||\n isInlineEventHandler;\n if ((propertyAcceptsFunctions && typeof value === 'function') ||\n (isInlineEventHandler && value === null)) {\n return apply(originalSetter, context, args);\n }\n }\n\n // Apply a fallback policy, if it exists.\n let fallbackValue;\n let exceptionThrown;\n const objName = context instanceof Element ?\n context.localName :\n getConstructorName_(context ? context.constructor : window.constructor);\n try {\n fallbackValue = this.maybeCallDefaultPolicy_(\n typeName, value, objName + '.' + propertyName);\n } catch (e) {\n exceptionThrown = true;\n }\n if (!exceptionThrown) {\n args[argNumber] = fallbackValue;\n return apply(originalSetter, context, args);\n }\n\n // This will throw a TypeError if enforcement is enabled.\n this.processViolation_(context, propertyName, typeToEnforce, value);\n\n return apply(originalSetter, context, args);\n }\n\n /**\n * Report a TT violation.\n * @param {!Object} context The object that the setter is called for.\n * @param {string} propertyName The name of the property.\n * @param {!Function} typeToEnforce The type to enforce.\n * @param {string} value The value that was violated the restrictions.\n * @throws {TypeError} if the enforcement is enabled.\n */\n processViolation_(context, propertyName, typeToEnforce, value) {\n const contextName = getConstructorName_(context.constructor) ||\n '' + context;\n const message = `Failed to set ${propertyName} on ${contextName}: `\n + `This property requires ${typeToEnforce.name}.`;\n\n if (this.config_.isLoggingEnabled) {\n // eslint-disable-next-line no-console\n console.warn(message, propertyName, context, typeToEnforce, value);\n }\n\n // Unconditionally dispatch an event.\n if (typeof SecurityPolicyViolationEvent == 'function') {\n let blockedURI = '';\n if (typeToEnforce === TrustedTypes.TrustedURL ||\n typeToEnforce === TrustedTypes.TrustedScriptURL) {\n blockedURI = parseUrl_(value) || '';\n if (blockedURI) {\n blockedURI = blockedURI.href;\n }\n }\n const valueSlice = apply(slice, '' + value, [0, 40]);\n const event = new SecurityPolicyViolationEvent(\n 'securitypolicyviolation',\n {\n 'bubbles': true,\n 'blockedURI': blockedURI,\n 'disposition': this.config_.isEnforcementEnabled ?\n 'enforce' : 'report',\n 'documentURI': document.location.href,\n 'effectiveDirective': DIRECTIVE_NAME,\n 'originalPolicy': this.config_.cspString,\n 'statusCode': 0,\n 'violatedDirective': DIRECTIVE_NAME,\n 'sample': `${contextName}.${propertyName} ${valueSlice}`,\n });\n if (context instanceof Node && context.isConnected) {\n context.dispatchEvent(event);\n } else { // Fallback - dispatch an event on base document.\n document.dispatchEvent(event);\n }\n }\n\n if (this.config_.isEnforcementEnabled) {\n throw new TypeError(message);\n }\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that only defines the types\n * (i.e. no enforcement logic).\n */\nimport {trustedTypes, TrustedTypePolicy, TrustedTypePolicyFactory} from\n '../trustedtypes.js';\n\nconst tt = trustedTypes;\n\n/**\n * Sets up the public Trusted Types API in the global object.\n */\nfunction setupPolyfill() {\n // We use array accessors to make sure Closure compiler will not alter the\n // names of the properties..\n if (typeof window === 'undefined') {\n return;\n }\n const rootProperty = 'trustedTypes';\n\n // Convert old window.TrustedTypes to window.trustedTypes.\n if (window['TrustedTypes'] && typeof window[rootProperty] === 'undefined') {\n window[rootProperty] = Object.freeze(window['TrustedTypes']);\n }\n\n if (typeof window[rootProperty] !== 'undefined') {\n return;\n }\n\n const publicApi = Object.create(TrustedTypePolicyFactory.prototype);\n Object.assign(publicApi, {\n 'isHTML': tt.isHTML,\n 'isURL': tt.isURL,\n 'isScriptURL': tt.isScriptURL,\n 'isScript': tt.isScript,\n 'createPolicy': tt.createPolicy,\n 'getPolicyNames': tt.getPolicyNames,\n 'getAttributeType': tt.getAttributeType,\n 'getPropertyType': tt.getPropertyType,\n 'getTypeMapping': tt.getTypeMapping,\n 'emptyHTML': tt.emptyHTML,\n '_isPolyfill_': true,\n });\n Object.defineProperty(\n publicApi,\n 'defaultPolicy',\n Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {});\n\n window[rootProperty] = Object.freeze(publicApi);\n\n window['TrustedHTML'] = tt.TrustedHTML;\n window['TrustedURL'] = tt.TrustedURL;\n window['TrustedScriptURL'] = tt.TrustedScriptURL;\n window['TrustedScript'] = tt.TrustedScript;\n window['TrustedTypePolicy'] = TrustedTypePolicy;\n window['TrustedTypePolicyFactory'] = TrustedTypePolicyFactory;\n}\n\nsetupPolyfill();\n\nexport default tt;\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that enforces the types.\n */\nimport {TrustedTypesEnforcer} from '../enforcer.js';\nimport {TrustedTypeConfig} from '../data/trustedtypeconfig.js';\n/* eslint-disable no-unused-vars */\nimport TrustedTypes from './api_only.js';\n\n/* eslint-enable no-unused-vars */\n\n/**\n * Tries to guess a CSP policy from:\n * - the current polyfill script element text content (if prefixed with\n * \"Content-Security-Policy:\")\n * - the data-csp attribute value of the current script element.\n * - meta header\n * @return {?string} Guessed CSP value, or null.\n */\nfunction detectPolicy() {\n try {\n const currentScript = document.currentScript || (function() {\n const scripts = document.getElementsByTagName('script');\n return scripts[scripts.length - 1];\n })();\n\n const bodyPrefix = 'Content-Security-Policy:';\n if (currentScript &&\n currentScript.textContent.trim().substr(0, bodyPrefix.length) ==\n bodyPrefix) {\n return currentScript.textContent.trim().slice(bodyPrefix.length);\n }\n if (currentScript.dataset['csp']) {\n return currentScript.dataset['csp'];\n }\n const cspInMeta = document.head.querySelector(\n 'meta[http-equiv^=\"Content-Security-Policy\"]');\n if (cspInMeta) {\n return cspInMeta['content'].trim();\n }\n } catch (e) {\n return null;\n }\n return null;\n}\n\n/**\n * Bootstraps all trusted types polyfill and their enforcement.\n */\nexport function bootstrap() {\n const csp = detectPolicy();\n const config = csp ? TrustedTypeConfig.fromCSP(csp) : new TrustedTypeConfig(\n /* isLoggingEnabled */ false,\n /* isEnforcementEnabled */ false,\n /* allowedPolicyNames */ ['*']);\n\n const trustedTypesEnforcer = new TrustedTypesEnforcer(config);\n\n trustedTypesEnforcer.install();\n}\n\n/**\n * Determines if the enforcement should be enabled.\n * @return {boolean}\n */\nfunction shouldBootstrap() {\n for (const rootProperty of ['trustedTypes', 'TrustedTypes']) {\n if (window[rootProperty] && !window[rootProperty]['_isPolyfill_']) {\n // Native implementation exists\n return false;\n }\n }\n return true;\n}\n\n// Bootstrap only if native implementation is missing.\nif (shouldBootstrap()) {\n bootstrap();\n}\n"]} \ No newline at end of file +{"version":3,"sources":["src/data/trustedtypeconfig.js","src/trustedtypes.js","src/utils/wrapper.js","src/enforcer.js","src/polyfill/api_only.js","src/polyfill/full.js"],"names":["parseCSP","cspString","WHITESPACE","trim","split","SEMICOLON","map","serializedDirective","reduce","parsed","directive","slice","s","sort","fromCSP","policy","TrustedTypeConfig$$module$src$data$trustedtypeconfig.parseCSP","enforce","DIRECTIVE_NAME","policies","filter","p","charAt","TrustedTypeConfig","isLoggingEnabled","isEnforcementEnabled","allowedPolicyNames","rejectInputFn","TypeError","toLowerCase","toUpperCase","String","prototype","TrustedTypePolicy","TrustedTypePolicyFactory","trustedTypes","setAllowedPolicyNames","trustedTypesBuilderTestOnly","privates","obj","v","privateMap","get","undefined","create","set","selfContained","collection","proto","getPrototypeOf","ObjectPrototype","Error","key","getOwnPropertyNames","defineProperty","value","lockdownTrustedType","SubClass","canonName","freeze","name","isTrustedTypeChecker","type","has","wrapPolicy","policyName","innerPolicy","creator","Ctor","methodName","method","policySpecificType","creatorSymbol","args","result","allowedValue","o","factory","createTypeMapping","writable","configurable","enumerable","getTypeInternal_","tag","container","elNs","attrNs","canonicalTag","apply","ns","HTML_NS","hasOwnProperty","TYPE_MAP","getDefaultPolicy","defaultPolicy","assign","Object","forEach","push","Array","Symbol","WeakMap","policyNames","allowedNames","enforceNameWhitelist","TrustedType","TrustedURL","TrustedScriptURL","TrustedHTML","TrustedScript","emptyHTML","XLINK_NS","SVG_NS","ATTR_PROPERTY_MAP","HTMLIFrameElement","keys","attr","HTMLElement","createFunctionAllowed","api","createPolicy","indexOf","call","console","warn","wrappedPolicy","DEFAULT_POLICY_NAME","getPolicyNames","isHTML","isURL","isScriptURL","isScript","getAttributeType","tagName","attribute","elementNs","attributeNs","canonicalAttr","getPropertyType","property","getTypeMapping","namespaceUri","document","documentElement","namespaceURI","e","JSON","parse","stringify","length","el","resetDefaultPolicy","splice","installFunction","object","fn","Reflect","getOwnPropertyDescriptor","UrlConstructor","window","URL","constructor","stringifyForRangeHack","getConstructorName_","createElement","match","windowOpenObject","insertAdjacentObject","Element","SecurityPolicyViolationEvent","typeMap","TrustedTypes","STRING_TO_TYPE","attrs","k","entries","TYPE_CHECKER_MAP","TYPE_PRODUCER_MAP","wrapSetter_","enforcingSetter","that","enforce_","originalSetter","useObject","descriptor","stopAt","Node","Function","getKey_","originalSetters_","wrapWithEnforceFunction_","argNumber","wrapFunction_","originalFn","wrapSetAttribute_","setAttributeWrapper_","bind","setAttributeNSWrapper_","installScriptMutatorGuards_","fnName","enforceTypeInScriptNodes_","insertAdjacentTextWrapper_","installPropertySetWrappers_","install","config_","ShadowRoot","doc","createRange","r","createContextualFragment","f","toString","childNodes","Range","Document","HTMLDocument","DOMParser","functionBody","maybeCallDefaultPolicy_","typeName","sink","fallbackPolicy","processViolation_","context","propertyName","typeToEnforce","contextName","message","blockedURI","baseURI","href","valueSlice","event","location","isConnected","dispatchEvent","TrustedTypesEnforcer","config","attrName","requiredType","checkParent","objToCheck","parentNode","HTMLScriptElement","arg","nodeType","TEXT_NODE","textContent","createTextNode","fallbackValue","exceptionThrown","riskyPositions","parentElement","includes","textNode","insertBefore","nextSibling","isInlineEventHandler","objName","localName","publicApi","tt","detectPolicy","currentScript","scripts","getElementsByTagName","bodyPrefix","substr","dataset","cspInMeta","head","querySelector","rootProperty","csp","TrustedTypeConfig$$module$src$data$trustedtypeconfig.fromCSP","trustedTypesEnforcer"],"mappings":"A;;;;;;;;aA+DEA,QAAO,GAAQ,CAACC,CAAD,CAAY,CAEzB,MAAMC,EAAa,KACnB,OAAOD,EAAAE,KAAA,EAAAC,MAAA,CAFWC,SAEX,CAAAC,IAAA,CACGC,CAAD,EAAyBA,CAAAH,MAAA,CAA0BF,CAA1B,CAD3B,CAAAM,OAAA,CAEK,QAAQ,CAACC,CAAD,CAASC,CAAT,CAAoB,CAC9BA,CAAA,CAAU,CAAV,CAAJ,GACED,CAAA,CAAOC,CAAA,CAAU,CAAV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AAD,CAHyB,CAOtDoL,GAAA,CAF6BwE,IAAIvC,EAAJuC,CAAyBtC,CAAzBsC,CAE7B,CAT0B,CA2B5B","file":"trustedtypes.build.js","sourcesContent":["/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * CSP Directive name controlling Trusted Types behavior.\n * @type {string}\n */\nexport const DIRECTIVE_NAME = 'trusted-types';\n\n/**\n * A configuration object for trusted type enforcement.\n */\nexport class TrustedTypeConfig {\n /**\n * @param {boolean} isLoggingEnabled If true enforcement wrappers will log\n * violations to the console.\n * @param {boolean} isEnforcementEnabled If true enforcement is enabled at\n * runtime.\n * @param {Array} allowedPolicyNames Whitelisted policy names.\n * @param {?string} cspString String with the CSP policy.\n */\n constructor(isLoggingEnabled,\n isEnforcementEnabled,\n allowedPolicyNames,\n cspString = null) {\n /**\n * True if logging is enabled.\n * @type {boolean}\n */\n this.isLoggingEnabled = isLoggingEnabled;\n\n /**\n * True if enforcement is enabled.\n * @type {boolean}\n */\n this.isEnforcementEnabled = isEnforcementEnabled;\n\n /**\n * Allowed policy names.\n * @type {Array}\n */\n this.allowedPolicyNames = allowedPolicyNames;\n\n /**\n * CSP string that defined the policy.\n * @type {?string}\n */\n this.cspString = cspString;\n }\n\n /**\n * Parses a CSP policy.\n * @link https://www.w3.org/TR/CSP3/#parse-serialized-policy\n * @param {string} cspString String with a CSP definition.\n * @return {Object>} Parsed CSP, keyed by directive\n * names.\n */\n static parseCSP(cspString) {\n const SEMICOLON = /\\s*;\\s*/;\n const WHITESPACE = /\\s+/;\n return cspString.trim().split(SEMICOLON)\n .map((serializedDirective) => serializedDirective.split(WHITESPACE))\n .reduce(function(parsed, directive) {\n if (directive[0]) {\n parsed[directive[0]] = directive.slice(1).map((s) => s).sort();\n }\n return parsed;\n }, {});\n }\n\n /**\n * Creates a TrustedTypeConfig object from a CSP string.\n * @param {string} cspString\n * @return {!TrustedTypeConfig}\n */\n static fromCSP(cspString) {\n const isLoggingEnabled = true;\n const policy = TrustedTypeConfig.parseCSP(cspString);\n const enforce = DIRECTIVE_NAME in policy;\n let policies = ['*'];\n if (enforce) {\n policies = policy[DIRECTIVE_NAME].filter((p) => p.charAt(0) !== '\\'');\n }\n\n return new TrustedTypeConfig(\n isLoggingEnabled,\n enforce, /* isEnforcementEnabled */\n policies, /* allowedPolicyNames */\n cspString\n );\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst rejectInputFn = (s) => {\n throw new TypeError('undefined conversion');\n};\n\nconst {toLowerCase, toUpperCase} = String.prototype;\n\nexport const HTML_NS = 'http://www.w3.org/1999/xhtml';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @constructor\n * @property {!function(string):TrustedHTML} createHTML\n * @property {!function(string):TrustedURL} createURL\n * @property {!function(string):TrustedScriptURL} createScriptURL\n * @property {!function(string):TrustedScript} createScript\n * @property {!string} name\n */\nexport const TrustedTypePolicy = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/**\n * @constructor\n */\nexport const TrustedTypePolicyFactory = function() {\n throw new TypeError('Illegal constructor');\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypesInnerPolicy}\n * @property {function(string):string} createHTML\n * @property {function(string):string} createURL\n * @property {function(string):string} createScriptURL\n * @property {function(string):string} createScript\n */\nconst TrustedTypesInnerPolicy = {};\n\n/**\n * @typedef {!Object,\n * properties: !Object}>}\n */\nconst TrustedTypesTypeMap = {};\n/* eslint-enable no-unused-vars */\n\nexport const DEFAULT_POLICY_NAME = 'default';\n\n\nexport const trustedTypesBuilderTestOnly = function() {\n // Capture common names early.\n const {\n assign, create, defineProperty, freeze, getOwnPropertyNames,\n getPrototypeOf, prototype: ObjectPrototype,\n } = Object;\n\n const {hasOwnProperty} = ObjectPrototype;\n\n const {\n forEach, push,\n } = Array.prototype;\n\n const creatorSymbol = Symbol();\n\n /**\n * Getter for the privateMap.\n * @param {Object} obj Key of the privateMap\n * @return {Object} Private storage.\n */\n const privates = function(obj) {\n let v = privateMap.get(obj);\n if (v === undefined) {\n v = create(null); // initialize the private storage.\n privateMap.set(obj, v);\n }\n return v;\n };\n\n /**\n * Called before attacker-controlled code on an internal collections,\n * copies prototype members onto the instance directly, so that later\n * changes to prototypes cannot expose collection internals.\n * @param {!T} collection\n * @return {!T} collection\n * @template T\n */\n function selfContained(collection) {\n const proto = getPrototypeOf(collection);\n if (proto == null || getPrototypeOf(proto) !== ObjectPrototype) {\n throw new Error(); // Loop below is insufficient.\n }\n for (const key of getOwnPropertyNames(proto)) {\n defineProperty(collection, key, {value: collection[key]});\n }\n return collection;\n }\n\n /**\n * Map for private properties of Trusted Types object.\n * This is so that the access to the type constructor does not give\n * the ability to create typed values.\n * @type {WeakMap}\n */\n const privateMap = selfContained(new WeakMap());\n\n /**\n * List of all configured policy names.\n * @type {Array}\n */\n const policyNames = selfContained([]);\n\n /**\n * Allowed policy namess for policy names.\n * @type {Array}\n */\n const allowedNames = selfContained([]);\n\n /**\n * A reference to a default policy, if created.\n * @type {TrustedTypePolicy}\n */\n let defaultPolicy = null;\n\n /**\n * Whether to enforce allowedNames in createPolicy().\n * @type {boolean}\n */\n let enforceNameWhitelist = false;\n\n\n /**\n * A value that is trusted to have certain security-relevant properties\n * because the sources of such values are controlled.\n */\n class TrustedType {\n /**\n * Constructor for TrustedType. Only allowed to be called from within a\n * policy.\n * @param {symbol} s creatorSymbol\n * @param {string} policyName The name of the policy this object was\n * created by.\n */\n constructor(s, policyName) {\n // TODO: Figure out if symbol is needed, if the value is in privateMap.\n if (s !== creatorSymbol) {\n throw new Error('cannot call the constructor');\n }\n defineProperty(this, 'policyName',\n {value: '' + policyName, enumerable: true});\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n toString() {\n return privates(this)['v'];\n }\n\n /**\n * Returns the wrapped string value of the object.\n * @return {string}\n * @override\n */\n valueOf() {\n return privates(this)['v'];\n }\n }\n\n /**\n * @param {function(new:TrustedType, symbol, string)} SubClass\n * @param {string} canonName The class name which should be independent of\n * any renaming pass and which is relied upon by the enforcer and for\n * native type interop.\n */\n function lockdownTrustedType(SubClass, canonName) {\n freeze(SubClass.prototype);\n delete SubClass.name;\n defineProperty(SubClass, 'name', {value: canonName});\n }\n\n /**\n * Trusted URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedURL extends TrustedType {\n }\n lockdownTrustedType(TrustedURL, 'TrustedURL');\n\n /**\n * Trusted Script URL object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScriptURL extends TrustedType {\n }\n lockdownTrustedType(TrustedScriptURL, 'TrustedScriptURL');\n\n /**\n * Trusted HTML object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedHTML extends TrustedType {\n }\n lockdownTrustedType(TrustedHTML, 'TrustedHTML');\n\n /**\n * Trusted Script object wrapping a string that can only be created from a\n * TT policy.\n */\n class TrustedScript extends TrustedType {\n }\n lockdownTrustedType(TrustedScript, 'TrustedScript');\n\n lockdownTrustedType(TrustedType, 'TrustedType');\n\n // Common constants.\n const emptyHTML = freeze(create(new TrustedHTML(creatorSymbol, '')));\n privates(emptyHTML)['v'] = '';\n\n /**\n * A map of attribute / property names to allowed types\n * for known namespaces.\n * @type {!Object}\n * @export\n */\n const TYPE_MAP = {\n [HTML_NS]: {\n // TODO(koto): Figure out what to to with \n 'A': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'AREA': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BASE': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n },\n 'BUTTON': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'EMBED': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n },\n },\n 'FORM': {\n 'attributes': {\n 'action': TrustedURL.name,\n },\n },\n 'FRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n },\n },\n 'IFRAME': {\n 'attributes': {\n 'src': TrustedURL.name,\n 'srcdoc': TrustedHTML.name,\n },\n },\n 'INPUT': {\n 'attributes': {\n 'formaction': TrustedURL.name,\n },\n },\n 'OBJECT': {\n 'attributes': {\n 'data': TrustedScriptURL.name,\n 'codebase': TrustedScriptURL.name,\n },\n },\n // TODO(koto): Figure out what to do with portals.\n 'SCRIPT': {\n 'attributes': {\n 'src': TrustedScriptURL.name,\n 'text': TrustedScript.name,\n },\n 'properties': {\n 'innerText': TrustedScript.name,\n 'textContent': TrustedScript.name,\n 'text': TrustedScript.name,\n },\n },\n '*': {\n 'attributes': {},\n 'properties': {\n 'innerHTML': TrustedHTML.name,\n 'outerHTML': TrustedHTML.name,\n },\n },\n },\n [XLINK_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n [SVG_NS]: {\n '*': {\n 'attributes': {\n 'href': TrustedURL.name,\n },\n 'properties': {},\n },\n },\n };\n\n /**\n * A map of element property to HTML attribute names.\n * @type {!Object}\n */\n const ATTR_PROPERTY_MAP = {\n 'codebase': 'codeBase',\n 'formaction': 'formAction',\n };\n\n // Edge doesn't support srcdoc.\n if (!('srcdoc' in HTMLIFrameElement.prototype)) {\n delete TYPE_MAP[HTML_NS]['IFRAME']['attributes']['srcdoc'];\n }\n\n // in HTML, clone attributes into properties.\n for (const tag of Object.keys(TYPE_MAP[HTML_NS])) {\n if (!TYPE_MAP[HTML_NS][tag]['properties']) {\n TYPE_MAP[HTML_NS][tag]['properties'] = {};\n }\n for (const attr of Object.keys(TYPE_MAP[HTML_NS][tag]['attributes'])) {\n TYPE_MAP[HTML_NS][tag]['properties'][\n ATTR_PROPERTY_MAP[attr] ? ATTR_PROPERTY_MAP[attr] : attr\n ] = TYPE_MAP[HTML_NS][tag]['attributes'][attr];\n }\n }\n\n // Add inline event handlers attribute names.\n for (const name of getOwnPropertyNames(HTMLElement.prototype)) {\n if (name.slice(0, 2) === 'on') {\n TYPE_MAP[HTML_NS]['*']['attributes'][name] = 'TrustedScript';\n }\n }\n\n /**\n * @type {!Object}\n */\n const createTypeMapping = {\n 'createHTML': TrustedHTML,\n 'createScriptURL': TrustedScriptURL,\n 'createURL': TrustedURL,\n 'createScript': TrustedScript,\n };\n\n const createFunctionAllowed = createTypeMapping.hasOwnProperty;\n\n /**\n * Function generating a type checker.\n * @template T\n * @param {T} type The type to check against.\n * @return {function(*):boolean}\n */\n function isTrustedTypeChecker(type) {\n return (obj) => (obj instanceof type) && privateMap.has(obj);\n }\n\n /**\n * Wraps a user-defined policy rules with TT constructor\n * @param {string} policyName The policy name\n * @param {TrustedTypesInnerPolicy} innerPolicy InnerPolicy\n * @return {!TrustedTypePolicy} Frozen policy object\n */\n function wrapPolicy(policyName, innerPolicy) {\n /**\n * @template T\n * @param {function(new:T, symbol, string)} Ctor a trusted type constructor\n * @param {string} methodName the policy factory method name\n * @return {function(string):!T} a factory that produces instances of Ctor.\n */\n function creator(Ctor, methodName) {\n // This causes thisValue to be null when called below.\n const method = innerPolicy[methodName] || rejectInputFn;\n const policySpecificType = freeze(new Ctor(creatorSymbol, policyName));\n const factory = {\n [methodName](s, ...args) {\n // Trick to get methodName to show in stacktrace.\n let result = method('' + s, ...args);\n if (result === undefined || result === null) {\n result = '';\n }\n const allowedValue = '' + result;\n const o = freeze(create(policySpecificType));\n privates(o)['v'] = allowedValue;\n return o;\n },\n }[methodName];\n return freeze(factory);\n }\n\n const policy = create(TrustedTypePolicy.prototype);\n\n for (const name of getOwnPropertyNames(createTypeMapping)) {\n policy[name] = creator(createTypeMapping[name], name);\n }\n defineProperty(policy, 'name', {\n value: policyName,\n writable: false,\n configurable: false,\n enumerable: true,\n });\n\n return /** @type {!TrustedTypePolicy} */ (freeze(policy));\n }\n\n /**\n * Returns the name of the trusted type required for a given element\n * attribute.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} attribute The name of the attribute.\n * @param {string=} elementNs Element namespace.\n * @param {string=} attributeNs The attribute namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getAttributeType(tagName, attribute, elementNs = '',\n attributeNs = '') {\n const canonicalAttr = toLowerCase.apply(String(attribute));\n return getTypeInternal_(tagName, 'attributes', canonicalAttr,\n elementNs, attributeNs);\n }\n\n /**\n * Returns a type name from a type map.\n * @param {string} tag A tag name.\n * @param {string} container 'attributes' or 'properties'\n * @param {string} name The attribute / property name.\n * @param {string=} elNs Element namespace.\n * @param {string=} attrNs Attribute namespace.\n * @return {string|undefined}\n * @private\n */\n function getTypeInternal_(tag, container, name, elNs = '', attrNs = '') {\n const canonicalTag = toUpperCase.apply(String(tag));\n\n let ns = attrNs ? attrNs : elNs;\n if (!ns) {\n ns = HTML_NS;\n }\n const map = hasOwnProperty.apply(TYPE_MAP, [ns]) ? TYPE_MAP[ns] : null;\n if (!map) {\n return;\n }\n if (hasOwnProperty.apply(map, [canonicalTag]) &&\n map[canonicalTag] &&\n hasOwnProperty.apply(map[canonicalTag][container], [name]) &&\n map[canonicalTag][container][name]) {\n return map[canonicalTag][container][name];\n }\n\n if (hasOwnProperty.apply(map, ['*']) &&\n hasOwnProperty.apply(map['*'][container], [name]) &&\n map['*'][container][name]) {\n return map['*'][container][name];\n }\n }\n\n /**\n * Returns the name of the trusted type required for a given element property.\n * @param {string} tagName The name of the tag of the element.\n * @param {string} property The property.\n * @param {string=} elementNs Element namespace.\n * @return {string|undefined} Required type name or undefined, if a Trusted\n * Type is not required.\n */\n function getPropertyType(tagName, property, elementNs = '') {\n // TODO: Support namespaces.\n return getTypeInternal_(tagName, 'properties', String(property), elementNs);\n }\n\n /**\n * Returns the type map-like object, that resolves a name of a type for a\n * given tag + attribute / property in a given namespace.\n * The keys of the map are uppercase tag names. Map entry has mappings between\n * a lowercase attribute name / case-sensitive property name and a name of the\n * type that is required for that attribute / property.\n * Example entry for 'IMG': {\"attributes\": {\"src\": \"TrustedHTML\"}}\n * @param {string=} namespaceUri The namespace URI (will use the current\n * document namespace URI if omitted).\n * @return {TrustedTypesTypeMap}\n */\n function getTypeMapping(namespaceUri = '') {\n if (!namespaceUri) {\n try {\n namespaceUri = document.documentElement.namespaceURI;\n } catch (e) {\n namespaceUri = HTML_NS;\n }\n }\n /**\n * @template T\n * @private\n * @param {T} o\n * @return {T}\n */\n function deepClone(o) {\n return JSON.parse(JSON.stringify(o));\n }\n const map = TYPE_MAP[namespaceUri];\n if (!map) {\n return {};\n }\n return deepClone(map);\n }\n\n /**\n * Returns all configured policy names (even for non-exposed policies).\n * @return {!Array}\n */\n function getPolicyNames() {\n // TODO(msamuel): Should we sort policyNames to avoid leaking or\n // encouraging dependency on the order in which policy names are\n // registered? I think JavaScript builtin sorts are efficient for\n // almost-sorted lists so the amortized cost is close to O(n).\n return policyNames.slice();\n }\n\n /**\n * Creates a TT policy.\n *\n * Returns a frozen object representing a policy - a collection of functions\n * that may create TT objects based on the user-provided rules specified\n * in the policy object.\n *\n * @param {string} name A unique name of the policy.\n * @param {TrustedTypesInnerPolicy} policy Policy rules object.\n * @return {TrustedTypePolicy} The policy that may create TT objects\n * according to the policy rules.\n */\n function createPolicy(name, policy) {\n const pName = '' + name; // Assert it's a string\n\n if (enforceNameWhitelist && allowedNames.indexOf(pName) === -1) {\n throw new TypeError('Policy ' + pName + ' disallowed.');\n }\n\n if (policyNames.indexOf(pName) !== -1) {\n throw new TypeError('Policy ' + pName + ' exists.');\n }\n // Register the name early so that if policy getters unwisely calls\n // across protection domains to code that reenters this function,\n // policy author still has rights to the name.\n policyNames.push(pName);\n\n // Only copy own properties of names present in createTypeMapping.\n const innerPolicy = create(null);\n if (policy && typeof policy === 'object') {\n // Treat non-objects as empty policies.\n for (const key of getOwnPropertyNames(policy)) {\n if (createFunctionAllowed.call(createTypeMapping, key)) {\n innerPolicy[key] = policy[key];\n }\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn('trustedTypes.createPolicy ' + pName +\n ' was given an empty policy');\n }\n freeze(innerPolicy);\n\n const wrappedPolicy = wrapPolicy(pName, innerPolicy);\n\n if (pName === DEFAULT_POLICY_NAME) {\n defaultPolicy = wrappedPolicy;\n }\n\n return wrappedPolicy;\n }\n\n /**\n * Applies the policy name whitelist.\n * @param {!Array} allowedPolicyNames\n */\n function setAllowedPolicyNames(allowedPolicyNames) {\n if (allowedPolicyNames.indexOf('*') !== -1) { // Any policy name is allowed.\n enforceNameWhitelist = false;\n } else {\n enforceNameWhitelist = true;\n allowedNames.length = 0;\n forEach.call(allowedPolicyNames, (el) => {\n push.call(allowedNames, '' + el);\n });\n }\n }\n\n /**\n * Returns the default policy, or null if it was not created.\n * @return {TrustedTypePolicy}\n */\n function getDefaultPolicy() {\n return defaultPolicy;\n }\n\n /**\n * Resets the default policy.\n */\n function resetDefaultPolicy() {\n defaultPolicy = null;\n policyNames.splice(policyNames.indexOf(DEFAULT_POLICY_NAME), 1);\n }\n\n const api = create(TrustedTypePolicyFactory.prototype);\n assign(api, {\n // The main function to create policies.\n createPolicy,\n\n getPolicyNames,\n\n // Type checkers, also validating the object was initialized through a\n // policy.\n isHTML: isTrustedTypeChecker(TrustedHTML),\n isURL: isTrustedTypeChecker(TrustedURL),\n isScriptURL: isTrustedTypeChecker(TrustedScriptURL),\n isScript: isTrustedTypeChecker(TrustedScript),\n\n getAttributeType,\n getPropertyType,\n getTypeMapping,\n emptyHTML,\n defaultPolicy, // Just to make the compiler happy, this is overridden below.\n\n TrustedHTML: TrustedHTML,\n TrustedURL: TrustedURL,\n TrustedScriptURL: TrustedScriptURL,\n TrustedScript: TrustedScript,\n });\n\n defineProperty(api, 'defaultPolicy', {\n get: getDefaultPolicy,\n set: () => {},\n });\n\n return {\n trustedTypes: freeze(api),\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n };\n};\n\n\nexport const {\n trustedTypes,\n setAllowedPolicyNames,\n getDefaultPolicy,\n resetDefaultPolicy,\n} = trustedTypesBuilderTestOnly();\n\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\nconst {\n defineProperty,\n} = Object;\n\n/**\n * Installs the setter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} setter A setter function}\n */\nexport function installSetter(object, name, setter) {\n const descriptor = {\n set: setter,\n };\n defineProperty(object, name, descriptor);\n}\n\n/**\n * Installs a setter and getter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} setter A setter function}\n * @param {function(*): *|undefined} getter A getter function}\n */\nexport function installSetterAndGetter(object, name, setter, getter) {\n const descriptor = {\n set: setter,\n get: getter,\n configurable: true, // This can get uninstalled, we need configurable: true\n };\n defineProperty(object, name, descriptor);\n}\n\n/**\n * Installs the setter of a given property.\n * @param {!Object} object An object for which to wrap the property.\n * @param {string} name The name of the property to wrap.\n * @param {function(*): *|undefined} fn A function}\n */\nexport function installFunction(object, name, fn) {\n defineProperty(object, name, {\n value: fn,\n });\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n// TrustedTypeConfig is used only as jsdoc type\n// eslint-disable-next-line\nimport {DIRECTIVE_NAME, TrustedTypeConfig} from './data/trustedtypeconfig.js';\nimport {\n trustedTypes as TrustedTypes,\n setAllowedPolicyNames,\n resetDefaultPolicy,\n HTML_NS,\n} from\n './trustedtypes.js';\n\nimport {installFunction, installSetter, installSetterAndGetter}\n from './utils/wrapper.js';\n\nconst {apply} = Reflect;\nconst {\n getOwnPropertyNames,\n getOwnPropertyDescriptor,\n getPrototypeOf,\n} = Object;\n\nconst {\n hasOwnProperty,\n isPrototypeOf,\n} = Object.prototype;\n\nconst {slice} = String.prototype;\n\n// No URL in IE 11.\nconst UrlConstructor = typeof window.URL == 'function' ?\n URL.prototype.constructor :\n null;\n\nlet stringifyForRangeHack;\n\n/**\n * Return object constructor name\n * (their function.name is not available in IE 11).\n * @param {*} fn\n * @return {string}\n * @private\n */\nconst getConstructorName_ = document.createElement('div').constructor.name ?\n (fn) => fn.name :\n (fn) => ('' + fn).match(/^\\[object (\\S+)\\]$/)[1];\n\n// window.open on IE 11 is set on WindowPrototype\nconst windowOpenObject = getOwnPropertyDescriptor(window, 'open') ?\n window :\n window.constructor.prototype;\n\n// In IE 11, insertAdjacent(HTML|Text) is on HTMLElement prototype\nconst insertAdjacentObject = apply(hasOwnProperty, Element.prototype,\n ['insertAdjacentHTML']) ? Element.prototype : HTMLElement.prototype;\n\n// This is not available in release Firefox :(\n// https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent\n// https://bugzilla.mozilla.org/show_bug.cgi?id=1432523\nconst SecurityPolicyViolationEvent = window['SecurityPolicyViolationEvent'] ||\n null;\n\n/**\n * Parses URL, catching all the errors.\n * @param {string} url URL string to parse.\n * @return {URL|null}\n */\nfunction parseUrl_(url) {\n try {\n return new UrlConstructor(url, document.baseURI || undefined);\n } catch (e) {\n return null;\n }\n}\n\n// We don't actually need other namespaces.\n// setAttribute is hooked on Element.prototype, which all elements inherit from,\n// and all sensitive property wrappers are hooked directly on Element as well.\nconst typeMap = TrustedTypes.getTypeMapping(HTML_NS);\n\nconst STRING_TO_TYPE = {\n 'TrustedHTML': TrustedTypes.TrustedHTML,\n 'TrustedScript': TrustedTypes.TrustedScript,\n 'TrustedScriptURL': TrustedTypes.TrustedScriptURL,\n 'TrustedURL': TrustedTypes.TrustedURL,\n};\n\n/**\n * Converts an uppercase tag name to an element constructor function name.\n * Used for property setter hijacking only.\n * @param {string} tagName\n * @return {string}\n */\nfunction convertTagToConstructor(tagName) {\n if (tagName == '*') {\n return 'HTMLElement';\n }\n return getConstructorName_(document.createElement(tagName).constructor);\n}\n\nfor (const tagName of Object.keys(typeMap)) {\n const attrs = typeMap[tagName]['properties'];\n for (const [k, v] of Object.entries(attrs)) {\n attrs[k] = STRING_TO_TYPE[v];\n }\n}\n\n/**\n * Map of type names to type checking function.\n * @type {!Object}\n */\nconst TYPE_CHECKER_MAP = {\n 'TrustedHTML': TrustedTypes.isHTML,\n 'TrustedURL': TrustedTypes.isURL,\n 'TrustedScriptURL': TrustedTypes.isScriptURL,\n 'TrustedScript': TrustedTypes.isScript,\n};\n\n/**\n * Map of type names to type producing function.\n * @type {Object}\n */\nconst TYPE_PRODUCER_MAP = {\n 'TrustedHTML': 'createHTML',\n 'TrustedURL': 'createURL',\n 'TrustedScriptURL': 'createScriptURL',\n 'TrustedScript': 'createScript',\n};\n\n/* eslint-disable no-unused-vars */\n/**\n * @typedef {TrustedTypePolicy}\n * @property {function(string):TrustedHTML} createHTML\n * @property {function(string):TrustedURL} createURL\n * @property {function(string):TrustedScriptURL} createScriptURL\n * @property {function(string):TrustedScript} createScript\n */\nconst TrustedTypePolicy = {};\n/* eslint-enable no-unused-vars */\n\n\n/**\n * An object for enabling trusted type enforcement.\n */\nexport class TrustedTypesEnforcer {\n /**\n * @param {!TrustedTypeConfig} config The configuration for\n * trusted type enforcement.\n */\n constructor(config) {\n /**\n * A configuration for the trusted type enforcement.\n * @private {!TrustedTypeConfig}\n */\n this.config_ = config;\n /**\n * @private {Object}\n */\n this.originalSetters_ = {};\n }\n\n /**\n * Wraps HTML sinks with an enforcement setter, which will enforce\n * trusted types and do logging, if enabled.\n *\n */\n install() {\n setAllowedPolicyNames(this.config_.allowedPolicyNames);\n\n if (!this.config_.isEnforcementEnabled && !this.config_.isLoggingEnabled) {\n return;\n }\n\n if ('ShadowRoot' in window) {\n this.wrapSetter_(ShadowRoot.prototype, 'innerHTML',\n TrustedTypes.TrustedHTML);\n }\n stringifyForRangeHack = (function(doc) {\n const r = doc.createRange();\n // In IE 11 Range.createContextualFragment doesn't stringify its argument.\n const f = r.createContextualFragment(/** @type {string} */ (\n {toString: () => '
'}));\n return f.childNodes.length == 0;\n })(document);\n\n this.wrapWithEnforceFunction_(Range.prototype, 'createContextualFragment',\n TrustedTypes.TrustedHTML, 0);\n\n this.wrapWithEnforceFunction_(insertAdjacentObject,\n 'insertAdjacentHTML',\n TrustedTypes.TrustedHTML, 1);\n\n if (getOwnPropertyDescriptor(Document.prototype, 'write')) {\n // Chrome\n this.wrapWithEnforceFunction_(Document.prototype, 'write',\n TrustedTypes.TrustedHTML, 0);\n this.wrapWithEnforceFunction_(Document.prototype, 'open',\n TrustedTypes.TrustedURL, 0);\n } else {\n // Firefox\n this.wrapWithEnforceFunction_(HTMLDocument.prototype, 'write',\n TrustedTypes.TrustedHTML, 0);\n this.wrapWithEnforceFunction_(HTMLDocument.prototype, 'open',\n TrustedTypes.TrustedURL, 0);\n }\n\n this.wrapWithEnforceFunction_(windowOpenObject, 'open',\n TrustedTypes.TrustedURL, 0);\n\n if ('DOMParser' in window) {\n this.wrapWithEnforceFunction_(DOMParser.prototype, 'parseFromString',\n TrustedTypes.TrustedHTML, 0);\n }\n this.wrapWithEnforceFunction_(window, 'setInterval',\n TrustedTypes.TrustedScript, 0);\n this.wrapWithEnforceFunction_(window, 'setTimeout',\n TrustedTypes.TrustedScript, 0);\n this.wrapSetAttribute_();\n this.installScriptMutatorGuards_();\n this.installPropertySetWrappers_();\n }\n\n /**\n * Removes the original setters.\n */\n uninstall() {\n setAllowedPolicyNames(['*']);\n\n if (!this.config_.isEnforcementEnabled && !this.config_.isLoggingEnabled) {\n return;\n }\n\n if ('ShadowRoot' in window) {\n this.restoreSetter_(ShadowRoot.prototype, 'innerHTML');\n }\n this.restoreFunction_(Range.prototype, 'createContextualFragment');\n this.restoreFunction_(insertAdjacentObject, 'insertAdjacentHTML');\n this.restoreFunction_(Element.prototype, 'setAttribute');\n this.restoreFunction_(Element.prototype, 'setAttributeNS');\n\n if (getOwnPropertyDescriptor(Document.prototype, 'write')) {\n this.restoreFunction_(Document.prototype, 'write');\n this.restoreFunction_(Document.prototype, 'open');\n } else {\n this.restoreFunction_(HTMLDocument.prototype, 'write');\n this.restoreFunction_(HTMLDocument.prototype, 'open');\n }\n this.restoreFunction_(windowOpenObject, 'open');\n\n if ('DOMParser' in window) {\n this.restoreFunction_(DOMParser.prototype, 'parseFromString');\n }\n this.restoreFunction_(window, 'setTimeout');\n this.restoreFunction_(window, 'setInterval');\n this.uninstallPropertySetWrappers_();\n this.uninstallScriptMutatorGuards_();\n resetDefaultPolicy();\n }\n\n /**\n * Installs type-enforcing wrappers for APIs that allow to modify\n * script element texts.\n * @private\n */\n installScriptMutatorGuards_() {\n const that = this;\n\n ['appendChild', 'insertBefore', 'replaceChild'].forEach((fnName) => {\n this.wrapFunction_(\n Node.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ false, originalFn)\n .apply(that, args);\n });\n });\n this.wrapFunction_(\n insertAdjacentObject,\n 'insertAdjacentText',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.insertAdjacentTextWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n\n if ('after' in Element.prototype) {\n ['after', 'before', 'replaceWith'].forEach((fnName) => {\n this.wrapFunction_(\n Element.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ true, originalFn)\n .apply(that, args);\n });\n });\n ['append', 'prepend'].forEach((fnName) => {\n this.wrapFunction_(\n Element.prototype,\n fnName,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforceTypeInScriptNodes_\n .bind(that, this, /* checkParent */ false, originalFn)\n .apply(that, args);\n });\n });\n }\n }\n\n /**\n * Uninstalls type-enforcing wrappers for APIs that allow to modify\n * script element texts.\n * @private\n */\n uninstallScriptMutatorGuards_() {\n this.restoreFunction_(Node.prototype, 'appendChild');\n this.restoreFunction_(Node.prototype, 'insertBefore');\n this.restoreFunction_(Node.prototype, 'replaceChild');\n this.restoreFunction_(insertAdjacentObject, 'insertAdjacentText');\n if ('after' in Element.prototype) {\n ['after', 'before', 'replaceWith', 'append', 'prepend'].forEach(\n (fnName) => this.restoreFunction_(Element.prototype, fnName));\n }\n }\n\n /**\n * Installs wrappers for directly setting properties\n * based on the type map.\n * @private\n */\n installPropertySetWrappers_() {\n /* eslint-disable guard-for-in */\n for (const tag of getOwnPropertyNames(typeMap)) {\n for (const property of getOwnPropertyNames(typeMap[tag]['properties'])) {\n this.wrapSetter_(\n window[convertTagToConstructor(tag)].prototype,\n property,\n typeMap[tag]['properties'][property]);\n }\n }\n }\n\n /**\n * Uninstalls wrappers for directly setting properties\n * based on the type map.\n * @private\n */\n uninstallPropertySetWrappers_() {\n /* eslint-disable guard-for-in */\n for (const tag of getOwnPropertyNames(typeMap)) {\n for (const property of getOwnPropertyNames(typeMap[tag]['properties'])) {\n this.restoreSetter_(\n window[convertTagToConstructor(tag)].prototype,\n property);\n }\n }\n }\n\n /** Wraps set attribute with an enforcement function. */\n wrapSetAttribute_() {\n const that = this;\n this.wrapFunction_(\n Element.prototype,\n 'setAttribute',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.setAttributeWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n this.wrapFunction_(\n Element.prototype,\n 'setAttributeNS',\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.setAttributeNSWrapper_\n .bind(that, this, originalFn)\n .apply(that, args);\n });\n }\n\n /**\n * Enforces type checking for Element.prototype.setAttribute.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original setAttribute function.\n * @return {*}\n */\n setAttributeWrapper_(context, originalFn, ...args) {\n // Note(slekies): In a normal application constructor should never be null.\n // However, there are no guarantees. If the constructor is null, we cannot\n // determine whether a special type is required. In order to not break the\n // application, we will not do any further type checks and pass the call\n // to setAttribute.\n if (context.constructor !== null && context instanceof Element) {\n const attrName = (args[0] = String(args[0])).toLowerCase();\n const requiredType = TrustedTypes.getAttributeType(context.tagName,\n attrName, context.namespaceURI);\n if (requiredType && apply(hasOwnProperty, STRING_TO_TYPE,\n [requiredType])) {\n return this.enforce_(\n context, 'setAttribute', STRING_TO_TYPE[requiredType],\n originalFn, 1, args);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Enforces type checking for Element.prototype.setAttributeNS.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original setAttributeNS function.\n * @return {*}\n */\n setAttributeNSWrapper_(context, originalFn, ...args) {\n // See the note from setAttributeWrapper_ above.\n if (context.constructor !== null && context instanceof Element) {\n const ns = args[0] ? String(args[0]) : null;\n args[0] = ns;\n const attrName = (args[1] = String(args[1])).toLowerCase();\n const requiredType = TrustedTypes.getAttributeType(context.tagName,\n attrName, context.namespaceURI, ns);\n if (requiredType && apply(hasOwnProperty, STRING_TO_TYPE,\n [requiredType])) {\n return this.enforce_(context, 'setAttributeNS',\n STRING_TO_TYPE[requiredType],\n originalFn, 2, args);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Wrapper for DOM mutator functions that enforces type checks if the context\n * (or, optionally, its parent node) is a script node.\n * For each argument, it will make sure that text nodes pass through a\n * default policy, or generate a violation. To skip that check, pass\n * TrustedScript objects instead.\n * @param {!Object} context The context for the call to the original function.\n * @param {boolean} checkParent Check parent of context instead.\n * @param {!Function} originalFn The original mutator function.\n * @return {*}\n */\n enforceTypeInScriptNodes_(context, checkParent, originalFn, ...args) {\n const objToCheck = checkParent ? context.parentNode : context;\n if (objToCheck instanceof HTMLScriptElement && args.length > 0) {\n for (let argNumber = 0; argNumber < args.length; argNumber++) {\n let arg = args[argNumber];\n if (arg instanceof Node && arg.nodeType !== Node.TEXT_NODE) {\n continue; // Type is not interesting\n }\n if (arg instanceof Node && arg.nodeType == Node.TEXT_NODE) {\n arg = arg.textContent;\n } else if (TrustedTypes.isScript(arg)) {\n // TODO(koto): Consider removing this branch, as it's hard to spec.\n // Convert to text node and go on.\n args[argNumber] = document.createTextNode(arg);\n continue;\n }\n\n // Try to run a default policy on argsthe argument\n let fallbackValue;\n let exceptionThrown;\n try {\n fallbackValue = this.maybeCallDefaultPolicy_(\n 'TrustedScript', arg, 'script.text');\n } catch (e) {\n exceptionThrown = true;\n }\n if (exceptionThrown) {\n this.processViolation_(context, originalFn.name,\n TrustedTypes.TrustedScript, arg);\n }\n args[argNumber] = document.createTextNode('' + fallbackValue);\n }\n }\n return apply(originalFn, context, args);\n }\n\n /**\n * Wrapper for Element.insertAdjacentText that enforces type checks for\n * inserting text into a script node.\n * @param {!Object} context The context for the call to the original function.\n * @param {!Function} originalFn The original insertAdjacentText function.\n */\n insertAdjacentTextWrapper_(context, originalFn, ...args) {\n const riskyPositions = ['beforebegin', 'afterend'];\n if (context instanceof Element &&\n context.parentElement instanceof HTMLScriptElement &&\n args.length > 1 &&\n riskyPositions.includes(args[0]) &&\n !(TrustedTypes.isScript(args[1]))) {\n // Run a default policy on args[1]\n let fallbackValue;\n let exceptionThrown;\n try {\n fallbackValue = this.maybeCallDefaultPolicy_('TrustedScript',\n args[1], 'script.text');\n } catch (e) {\n exceptionThrown = true;\n }\n if (exceptionThrown) {\n this.processViolation_(context, 'insertAdjacentText',\n TrustedTypes.TrustedScript, args[1]);\n }\n\n const textNode = document.createTextNode('' + fallbackValue);\n\n\n const insertBefore = /** @type function(this: Node) */(\n this.originalSetters_[this.getKey_(Node.prototype, 'insertBefore')]);\n\n switch (args[0]) {\n case riskyPositions[0]: // 'beforebegin'\n apply(insertBefore, context.parentElement,\n [textNode, context]);\n break;\n case riskyPositions[1]: // 'afterend'\n apply(insertBefore, context.parentElement,\n [textNode, context.nextSibling]);\n break;\n }\n return;\n }\n apply(originalFn, context, args);\n }\n\n /**\n * Wraps a setter with the enforcement wrapper.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Function} type The type to enforce.\n * @param {number} argNumber Number of the argument to enforce the type of.\n * @private\n */\n wrapWithEnforceFunction_(object, name, type, argNumber) {\n const that = this;\n this.wrapFunction_(\n object,\n name,\n /**\n * @this {TrustedTypesEnforcer}\n * @param {function(!Function, ...*)} originalFn\n * @return {*}\n */\n function(originalFn, ...args) {\n return that.enforce_.call(that, this, name, type, originalFn,\n argNumber, args);\n });\n }\n\n\n /**\n * Wraps an existing function with a given function body and stores the\n * original function.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {function(!Function, ...*)} functionBody The wrapper function.\n */\n wrapFunction_(object, name, functionBody) {\n const descriptor = getOwnPropertyDescriptor(object, name);\n const originalFn = /** @type function(*):* */ (\n descriptor ? descriptor.value : null);\n\n if (!(originalFn instanceof Function)) {\n throw new TypeError(\n 'Property ' + name + ' on object' + object + ' is not a function');\n }\n\n const key = this.getKey_(object, name);\n if (this.originalSetters_[key]) {\n throw new Error(\n `TrustedTypesEnforcer: Double installation detected: ${key} ${name}`);\n }\n installFunction(\n object,\n name,\n /**\n * @this {TrustedTypesEnforcer}\n * @return {*}\n */\n function(...args) {\n return functionBody.bind(this, originalFn).apply(this, args);\n });\n this.originalSetters_[key] = originalFn;\n }\n\n /**\n * Wraps a setter with the enforcement wrapper.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Function} type The type to enforce.\n * @param {!Object=} descriptorObject If present, will reuse the\n * setter/getter from this one, instead of object. Used for redefining\n * setters in subclasses.\n * @private\n */\n wrapSetter_(object, name, type, descriptorObject = undefined) {\n if (descriptorObject && !isPrototypeOf.call(descriptorObject, object)) {\n throw new Error('Invalid prototype chain');\n }\n\n let useObject = descriptorObject || object;\n let descriptor;\n let originalSetter;\n const stopAt = getPrototypeOf(Node.prototype);\n\n // Find the descriptor on the object or its prototypes, stopping at Node.\n do {\n descriptor = getOwnPropertyDescriptor(useObject, name);\n originalSetter = /** @type {function(*):*} */ (descriptor ?\n descriptor.set : null);\n if (!originalSetter) {\n useObject = getPrototypeOf(useObject) || stopAt;\n }\n } while (!(originalSetter || useObject === stopAt || !useObject));\n\n if (!(originalSetter instanceof Function)) {\n throw new TypeError(\n 'No setter for property ' + name + ' on object' + object);\n }\n\n const key = this.getKey_(object, name);\n if (this.originalSetters_[key]) {\n throw new Error(\n `TrustedTypesEnforcer: Double installation detected: ${key} ${name}`);\n }\n const that = this;\n /**\n * @this {TrustedTypesEnforcer}\n * @param {*} value\n */\n const enforcingSetter = function(value) {\n that.enforce_.call(that, this, name, type, originalSetter, 0,\n [value]);\n };\n\n if (useObject === object) {\n installSetter(\n object,\n name,\n enforcingSetter);\n } else {\n // Since we're creating a new setter in subclass, we also need to\n // overwrite the getter.\n installSetterAndGetter(\n object,\n name,\n enforcingSetter,\n descriptor.get\n );\n }\n this.originalSetters_[key] = originalSetter;\n }\n\n /**\n * Restores the original setter for the property, as encountered during\n * install().\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @param {!Object=} descriptorObject If present, will restore the original\n * setter/getter from this one, instead of object.\n * @private\n */\n restoreSetter_(object, name, descriptorObject = undefined) {\n const key = this.getKey_(object, name);\n if (descriptorObject && !isPrototypeOf.call(descriptorObject, object)) {\n throw new Error('Invalid prototype chain');\n }\n if (!this.originalSetters_[key]) {\n throw new Error(\n // eslint-disable-next-line max-len\n `TrustedTypesEnforcer: Cannot restore (double uninstallation?): ${key} ${name}`);\n }\n if (descriptorObject) {\n // We have to also overwrite a getter.\n installSetterAndGetter(object, name, this.originalSetters_[key],\n getOwnPropertyDescriptor(descriptorObject, name).get);\n } else {\n installSetter(object, name, this.originalSetters_[key]);\n }\n delete this.originalSetters_[key];\n }\n\n /**\n * Restores the original method of an object, as encountered during install().\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @private\n */\n restoreFunction_(object, name) {\n const key = this.getKey_(object, name);\n if (!this.originalSetters_[key]) {\n throw new Error(\n // eslint-disable-next-line max-len\n `TrustedTypesEnforcer: Cannot restore (double uninstallation?): ${key} ${name}`);\n }\n installFunction(object, name, this.originalSetters_[key]);\n delete this.originalSetters_[key];\n }\n\n /**\n * Returns the key name for caching original setters.\n * @param {!Object} object The object of the to-be-wrapped property.\n * @param {string} name The name of the property.\n * @return {string} Key name.\n * @private\n */\n getKey_(object, name) {\n // TODO(msamuel): Can we use Object.prototype.toString.call(object)\n // to get an unspoofable string here?\n // TODO(msamuel): fail on '-' in object.constructor.name?\n // No Function.name in IE 11\n const ctrName = '' + (\n object.constructor.name ?\n object.constructor.name :\n object.constructor);\n return ctrName + '-' + name;\n }\n\n\n /**\n * Calls a default policy.\n * @param {string} typeName Type name to attempt to produce from a value.\n * @param {*} value The value to pass to a default policy\n * @param {string} sink The sink name that the default policy will be called\n * with.\n * @throws {Error} If the default policy throws, or not exist.\n * @return {Function} The trusted value.\n */\n maybeCallDefaultPolicy_(typeName, value, sink = '') {\n // Apply a fallback policy, if it exists.\n const fallbackPolicy = TrustedTypes.defaultPolicy;\n if (!fallbackPolicy) {\n throw new Error('Default policy does not exist');\n }\n if (!TYPE_CHECKER_MAP.hasOwnProperty(typeName)) {\n throw new Error();\n }\n return fallbackPolicy[TYPE_PRODUCER_MAP[typeName]](value, '' + sink);\n }\n\n /**\n * Logs and enforces TrustedTypes depending on the given configuration.\n * @template T\n * @param {!Object} context The object that the setter is called for.\n * @param {string} propertyName The name of the property.\n * @param {!Function} typeToEnforce The type to enforce.\n * @param {function(?):T} originalSetter Original setter.\n * @param {number} argNumber Number of argument to enforce the type of.\n * @param {Array} args Arguments.\n * @return {T}\n * @private\n */\n enforce_(context, propertyName, typeToEnforce, originalSetter, argNumber,\n args) {\n const value = args[argNumber];\n const typeName = '' + typeToEnforce.name;\n // If typed value is given, pass through.\n if (TYPE_CHECKER_MAP.hasOwnProperty(typeName) &&\n TYPE_CHECKER_MAP[typeName](value)) {\n if (stringifyForRangeHack &&\n propertyName == 'createContextualFragment') {\n // IE 11 hack, somehow the value is not stringified implicitly.\n args[argNumber] = args[argNumber].toString();\n }\n return apply(originalSetter, context, args);\n }\n\n if (typeToEnforce === TrustedTypes.TrustedScript) {\n const isInlineEventHandler =\n propertyName == 'setAttribute' ||\n propertyName === 'setAttributeNS' ||\n apply(slice, propertyName, [0, 2]) === 'on';\n // If a function (instead of string) is passed to inline event attribute,\n // or set(Timeout|Interval), pass through.\n const propertyAcceptsFunctions =\n propertyName === 'setInterval' ||\n propertyName === 'setTimeout' ||\n isInlineEventHandler;\n if ((propertyAcceptsFunctions && typeof value === 'function') ||\n (isInlineEventHandler && value === null)) {\n return apply(originalSetter, context, args);\n }\n }\n\n // Apply a fallback policy, if it exists.\n let fallbackValue;\n let exceptionThrown;\n const objName = context instanceof Element ?\n context.localName :\n getConstructorName_(context ? context.constructor : window.constructor);\n try {\n fallbackValue = this.maybeCallDefaultPolicy_(\n typeName, value, objName + '.' + propertyName);\n } catch (e) {\n exceptionThrown = true;\n }\n if (!exceptionThrown) {\n args[argNumber] = fallbackValue;\n return apply(originalSetter, context, args);\n }\n\n // This will throw a TypeError if enforcement is enabled.\n this.processViolation_(context, propertyName, typeToEnforce, value);\n\n return apply(originalSetter, context, args);\n }\n\n /**\n * Report a TT violation.\n * @param {!Object} context The object that the setter is called for.\n * @param {string} propertyName The name of the property.\n * @param {!Function} typeToEnforce The type to enforce.\n * @param {string} value The value that was violated the restrictions.\n * @throws {TypeError} if the enforcement is enabled.\n */\n processViolation_(context, propertyName, typeToEnforce, value) {\n const contextName = getConstructorName_(context.constructor) ||\n '' + context;\n const message = `Failed to set ${propertyName} on ${contextName}: `\n + `This property requires ${typeToEnforce.name}.`;\n\n if (this.config_.isLoggingEnabled) {\n // eslint-disable-next-line no-console\n console.warn(message, propertyName, context, typeToEnforce, value);\n }\n\n // Unconditionally dispatch an event.\n if (typeof SecurityPolicyViolationEvent == 'function') {\n let blockedURI = '';\n if (typeToEnforce === TrustedTypes.TrustedURL ||\n typeToEnforce === TrustedTypes.TrustedScriptURL) {\n blockedURI = parseUrl_(value) || '';\n if (blockedURI) {\n blockedURI = blockedURI.href;\n }\n }\n const valueSlice = apply(slice, '' + value, [0, 40]);\n const event = new SecurityPolicyViolationEvent(\n 'securitypolicyviolation',\n {\n 'bubbles': true,\n 'blockedURI': blockedURI,\n 'disposition': this.config_.isEnforcementEnabled ?\n 'enforce' : 'report',\n 'documentURI': document.location.href,\n 'effectiveDirective': DIRECTIVE_NAME,\n 'originalPolicy': this.config_.cspString,\n 'statusCode': 0,\n 'violatedDirective': DIRECTIVE_NAME,\n 'sample': `${contextName}.${propertyName} ${valueSlice}`,\n });\n if (context instanceof Node && context.isConnected) {\n context.dispatchEvent(event);\n } else { // Fallback - dispatch an event on base document.\n document.dispatchEvent(event);\n }\n }\n\n if (this.config_.isEnforcementEnabled) {\n throw new TypeError(message);\n }\n }\n}\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that only defines the types\n * (i.e. no enforcement logic).\n */\nimport {trustedTypes, TrustedTypePolicy, TrustedTypePolicyFactory} from\n '../trustedtypes.js';\n\nconst tt = trustedTypes;\n\n/**\n * Sets up the public Trusted Types API in the global object.\n */\nfunction setupPolyfill() {\n // We use array accessors to make sure Closure compiler will not alter the\n // names of the properties..\n\n // we only setup the polyfill only in browser environment.\n if (typeof window === 'undefined') {\n return;\n }\n const rootProperty = 'trustedTypes';\n\n // Convert old window.TrustedTypes to window.trustedTypes.\n if (window['TrustedTypes'] && typeof window[rootProperty] === 'undefined') {\n window[rootProperty] = Object.freeze(window['TrustedTypes']);\n }\n\n if (typeof window[rootProperty] !== 'undefined') {\n return;\n }\n\n const publicApi = Object.create(TrustedTypePolicyFactory.prototype);\n Object.assign(publicApi, {\n 'isHTML': tt.isHTML,\n 'isURL': tt.isURL,\n 'isScriptURL': tt.isScriptURL,\n 'isScript': tt.isScript,\n 'createPolicy': tt.createPolicy,\n 'getPolicyNames': tt.getPolicyNames,\n 'getAttributeType': tt.getAttributeType,\n 'getPropertyType': tt.getPropertyType,\n 'getTypeMapping': tt.getTypeMapping,\n 'emptyHTML': tt.emptyHTML,\n '_isPolyfill_': true,\n });\n Object.defineProperty(\n publicApi,\n 'defaultPolicy',\n Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {});\n\n window[rootProperty] = Object.freeze(publicApi);\n\n window['TrustedHTML'] = tt.TrustedHTML;\n window['TrustedURL'] = tt.TrustedURL;\n window['TrustedScriptURL'] = tt.TrustedScriptURL;\n window['TrustedScript'] = tt.TrustedScript;\n window['TrustedTypePolicy'] = TrustedTypePolicy;\n window['TrustedTypePolicyFactory'] = TrustedTypePolicyFactory;\n}\n\nsetupPolyfill();\n\nexport default tt;\n","/**\n * @license\n * Copyright 2017 Google Inc. All Rights Reserved.\n *\n * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE.\n *\n * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n */\n\n/**\n * @fileoverview Entry point for a polyfill that enforces the types.\n */\nimport {TrustedTypesEnforcer} from '../enforcer.js';\nimport {TrustedTypeConfig} from '../data/trustedtypeconfig.js';\n// import and setup trusted types\nimport './api_only.js';\n\n/* eslint-enable no-unused-vars */\n\n/**\n * Tries to guess a CSP policy from:\n * - the current polyfill script element text content (if prefixed with\n * \"Content-Security-Policy:\")\n * - the data-csp attribute value of the current script element.\n * - meta header\n * @return {?string} Guessed CSP value, or null.\n */\nfunction detectPolicy() {\n try {\n const currentScript = document.currentScript || (function() {\n const scripts = document.getElementsByTagName('script');\n return scripts[scripts.length - 1];\n })();\n\n const bodyPrefix = 'Content-Security-Policy:';\n if (currentScript &&\n currentScript.textContent.trim().substr(0, bodyPrefix.length) ==\n bodyPrefix) {\n return currentScript.textContent.trim().slice(bodyPrefix.length);\n }\n if (currentScript.dataset['csp']) {\n return currentScript.dataset['csp'];\n }\n const cspInMeta = document.head.querySelector(\n 'meta[http-equiv^=\"Content-Security-Policy\"]');\n if (cspInMeta) {\n return cspInMeta['content'].trim();\n }\n } catch (e) {\n return null;\n }\n return null;\n}\n\n/**\n * Bootstraps all trusted types polyfill and their enforcement.\n */\nexport function bootstrap() {\n const csp = detectPolicy();\n const config = csp ? TrustedTypeConfig.fromCSP(csp) : new TrustedTypeConfig(\n /* isLoggingEnabled */ false,\n /* isEnforcementEnabled */ false,\n /* allowedPolicyNames */ ['*']);\n\n const trustedTypesEnforcer = new TrustedTypesEnforcer(config);\n\n trustedTypesEnforcer.install();\n}\n\n/**\n * Determines if the enforcement should be enabled.\n * @return {boolean}\n */\nfunction shouldBootstrap() {\n for (const rootProperty of ['trustedTypes', 'TrustedTypes']) {\n if (window[rootProperty] && !window[rootProperty]['_isPolyfill_']) {\n // Native implementation exists\n return false;\n }\n }\n return true;\n}\n\n// Bootstrap only if native implementation is missing.\nif (shouldBootstrap()) {\n bootstrap();\n}\n"]} \ No newline at end of file diff --git a/dist/spec/index.html b/dist/spec/index.html index 7321d242..c1e50108 100644 --- a/dist/spec/index.html +++ b/dist/spec/index.html @@ -1213,7 +1213,7 @@ } - + - +