Commit de8996c6 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

bindings: Fix how to check a member is missing (2/N)

IDL dictionary provides a way to check if a member is missing or not.
This CL fixes a wrong way of the check in TrustedTypePolicy.

Bug: 839389
Change-Id: I47206875af24089fb29fd1d92e3a82c97050ae1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2227937
Auto-Submit: Hitoshi Yoshida <peria@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774507}
parent a1c5af6c
...@@ -45,7 +45,7 @@ TrustedHTML* TrustedTypePolicy::CreateHTML(v8::Isolate* isolate, ...@@ -45,7 +45,7 @@ TrustedHTML* TrustedTypePolicy::CreateHTML(v8::Isolate* isolate,
const String& input, const String& input,
const HeapVector<ScriptValue>& args, const HeapVector<ScriptValue>& args,
ExceptionState& exception_state) { ExceptionState& exception_state) {
if (!policy_options_->createHTML()) { if (!policy_options_->hasCreateHTML()) {
exception_state.ThrowTypeError( exception_state.ThrowTypeError(
"Policy " + name_ + "Policy " + name_ +
"'s TrustedTypePolicyOptions did not specify a 'createHTML' member."); "'s TrustedTypePolicyOptions did not specify a 'createHTML' member.");
...@@ -66,7 +66,7 @@ TrustedScript* TrustedTypePolicy::CreateScript( ...@@ -66,7 +66,7 @@ TrustedScript* TrustedTypePolicy::CreateScript(
const String& input, const String& input,
const HeapVector<ScriptValue>& args, const HeapVector<ScriptValue>& args,
ExceptionState& exception_state) { ExceptionState& exception_state) {
if (!policy_options_->createScript()) { if (!policy_options_->hasCreateScript()) {
exception_state.ThrowTypeError( exception_state.ThrowTypeError(
"Policy " + name_ + "Policy " + name_ +
"'s TrustedTypePolicyOptions did not specify a 'createScript' member."); "'s TrustedTypePolicyOptions did not specify a 'createScript' member.");
...@@ -89,7 +89,7 @@ TrustedScriptURL* TrustedTypePolicy::CreateScriptURL( ...@@ -89,7 +89,7 @@ TrustedScriptURL* TrustedTypePolicy::CreateScriptURL(
const String& input, const String& input,
const HeapVector<ScriptValue>& args, const HeapVector<ScriptValue>& args,
ExceptionState& exception_state) { ExceptionState& exception_state) {
if (!policy_options_->createScriptURL()) { if (!policy_options_->hasCreateScriptURL()) {
exception_state.ThrowTypeError("Policy " + name_ + exception_state.ThrowTypeError("Policy " + name_ +
"'s TrustedTypePolicyOptions did not " "'s TrustedTypePolicyOptions did not "
"specify a 'createScriptURL' member."); "specify a 'createScriptURL' member.");
...@@ -108,15 +108,15 @@ TrustedScriptURL* TrustedTypePolicy::CreateScriptURL( ...@@ -108,15 +108,15 @@ TrustedScriptURL* TrustedTypePolicy::CreateScriptURL(
} }
bool TrustedTypePolicy::HasCreateHTML() { bool TrustedTypePolicy::HasCreateHTML() {
return policy_options_->createHTML(); return policy_options_->hasCreateHTML();
} }
bool TrustedTypePolicy::HasCreateScript() { bool TrustedTypePolicy::HasCreateScript() {
return policy_options_->createScript(); return policy_options_->hasCreateScript();
} }
bool TrustedTypePolicy::HasCreateScriptURL() { bool TrustedTypePolicy::HasCreateScriptURL() {
return policy_options_->createScriptURL(); return policy_options_->hasCreateScriptURL();
} }
String TrustedTypePolicy::name() const { String TrustedTypePolicy::name() const {
......
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