-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug: 936436 Change-Id: Iaedc27556016d037c4b66f05393131ec06ed9042
- Loading branch information
1 parent
19fdbf6
commit 4a7b062
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
trusted-types/TrustedTypePolicyFactory-constants.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support/helper.sub.js"></script> | ||
|
||
<meta http-equiv="Content-Security-Policy" content="trusted-types *"> | ||
<body> | ||
<script> | ||
test(t => { | ||
const empty = TrustedTypes.emptyHTML; | ||
assert_true(TrustedTypes.isHTML(empty)); | ||
assert_equals(empty.toString(), ""); | ||
}, 'TrustedTypes.emptyHTML returns the intended value.'); | ||
|
||
test(t => { | ||
try { TrustedTypes.emptyHTML = 'fake'; } catch { } | ||
assert_true(TrustedTypes.isHTML(TrustedTypes.emptyHTML)); | ||
assert_equals(TrustedTypes.emptyHTML.toString(), ""); | ||
}, 'TrustedTypes.emptyHTML cannot be redefined.'); | ||
|
||
test(t => { | ||
try { Object.defineProperty(TrustedTypes, 'emptyHTML', 'fake'); } catch { } | ||
assert_true(TrustedTypes.isHTML(TrustedTypes.emptyHTML)); | ||
assert_equals(TrustedTypes.emptyHTML.toString(), ""); | ||
}, 'TrustedTypes.emptyHTML cannot be redefined via defineProperty.'); | ||
</script> |