Skip to content

Commit

Permalink
Add trustedTypes.defaultPolicy getter. Fixes #185. (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
koto committed Aug 8, 2019
1 parent 77667b8 commit 38fb44d
Show file tree
Hide file tree
Showing 16 changed files with 189 additions and 110 deletions.
11 changes: 11 additions & 0 deletions dist/cjs/trustedtypes.api_only.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,13 +629,19 @@ const trustedTypesBuilderTestOnly = function() {
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,
Expand Down Expand Up @@ -697,6 +703,11 @@ function setupPolyfill() {
'emptyHTML': tt.emptyHTML,
'_isPolyfill_': true,
});
Object.defineProperty(
publicApi,
'defaultPolicy',
Object.getOwnPropertyDescriptor(tt, 'defaultPolicy') || {});

window[rootProperty] = Object.freeze(publicApi);

window['TrustedHTML'] = tt.TrustedHTML;
Expand Down
32 changes: 16 additions & 16 deletions dist/es5/trustedtypes.api_only.build.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/es5/trustedtypes.api_only.build.js.map

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions dist/es5/trustedtypes.build.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/es5/trustedtypes.build.js.map

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions dist/es6/trustedtypes.api_only.build.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/es6/trustedtypes.api_only.build.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 38fb44d

Please sign in to comment.