Commit a755f091 authored by Krzysztof Kotowicz's avatar Krzysztof Kotowicz Committed by Commit Bot

[Trusted Types] Removed trustedTypes.getPolicyNames().

Context: https://github.com/w3c/webappsec-trusted-types/issues/235

Bug: 739170
Change-Id: I8499534f4351ea2c9f689071f3d6510238382d72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089651Reviewed-by: default avatarDaniel Vogelheim <vogelheim@chromium.org>
Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org>
Auto-Submit: Krzysztof Kotowicz <koto@google.com>
Cr-Commit-Position: refs/heads/master@{#747250}
parent 5429e172
......@@ -75,14 +75,6 @@ TrustedTypePolicyFactory::TrustedTypePolicyFactory(ExecutionContext* context)
empty_html_(MakeGarbageCollected<TrustedHTML>("")),
empty_script_(MakeGarbageCollected<TrustedScript>("")) {}
Vector<String> TrustedTypePolicyFactory::getPolicyNames() const {
Vector<String> policyNames;
for (const String& name : policy_map_.Keys()) {
policyNames.push_back(name);
}
return policyNames;
}
const WrapperTypeInfo*
TrustedTypePolicyFactory::GetWrapperTypeInfoFromScriptValue(
ScriptState* script_state,
......
......@@ -37,8 +37,6 @@ class CORE_EXPORT TrustedTypePolicyFactory final
TrustedTypePolicy* defaultPolicy() const;
Vector<String> getPolicyNames() const;
bool isHTML(ScriptState*, const ScriptValue&);
bool isScript(ScriptState*, const ScriptValue&);
bool isScriptURL(ScriptState*, const ScriptValue&);
......
......@@ -11,7 +11,6 @@
[RaisesException, Unforgeable] TrustedTypePolicy createPolicy(DOMString policyName, TrustedTypePolicyOptions policyOptions);
[Unforgeable] readonly attribute TrustedTypePolicy defaultPolicy;
// All the policy object names that have been created
[Affects=Nothing, Unforgeable] sequence<DOMString> getPolicyNames();
[CallWith=ScriptState, Unforgeable] boolean isHTML(any checkedObject);
[CallWith=ScriptState, Unforgeable] boolean isScript(any checkedObject);
[CallWith=ScriptState, Unforgeable] boolean isScriptURL(any checkedObject);
......
......@@ -23,7 +23,6 @@ interface TrustedScriptURL {
interface TrustedTypePolicyFactory {
[Unforgeable] TrustedTypePolicy createPolicy(DOMString policyName, TrustedTypePolicyOptions policyOptions);
// All the policy object names that have been created
[Unforgeable] sequence<DOMString> getPolicyNames();
};
[Exposed=(Window, Worker)]
......
<!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 => {
let policy = trustedTypes.createPolicy('thisisaname', {});
assert_true(policy instanceof TrustedTypePolicy);
assert_equals(policy.name, 'thisisaname');
}, "policy.name = name");
// Retrieve policy names tests
test(t => {
let policy = trustedTypes.createPolicy('anothername', {});
let names = trustedTypes.getPolicyNames();
assert_equals(names.length, 2);
assert_true(names.includes('thisisaname'));
assert_true(names.includes('anothername'));
}, "getPolicyNames returns all policy names");
</script>
......@@ -20,14 +20,6 @@
});
}, "duplicate policy name attempt throws");
// Retrieve policy names tests
test(t => {
let policy = trustedTypes.createPolicy('SomeOtherName', {} );
let names = trustedTypes.getPolicyNames();
assert_true(names.includes('SomeName'));
assert_true(names.includes('SomeOtherName'));
}, "Retrieving policy names");
// Check error messages.
test(t => {
try {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment