Commit 6c528868 authored by Hwanseung Lee's avatar Hwanseung Lee Committed by Commit Bot

[css-typed-om] CSSStyleValue.parse/parseAll should throw TypeError

present, CSSStyleValue.parse/parseAll thrown type or syntax error.
but CSSStyleValue.parse/parseAll was decided to throw only
type error.

https://github.com/w3c/css-houdini-drafts/issues/305

Bug: 798937
Change-Id: I00d6855d1b3667441d009d8d3551daed970cab1a
Reviewed-on: https://chromium-review.googlesource.com/849972Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Commit-Queue: Hwanseung Lee <hs1217.lee@samsung.com>
Cr-Commit-Position: refs/heads/master@{#527126}
parent 95af6365
...@@ -23,8 +23,8 @@ for (const parseMethod of ['parse', 'parseAll']) { ...@@ -23,8 +23,8 @@ for (const parseMethod of ['parse', 'parseAll']) {
}, 'Calling CSSStyleValue.' + parseMethod + ' with a CSS shorthand throws a TypeError'); }, 'Calling CSSStyleValue.' + parseMethod + ' with a CSS shorthand throws a TypeError');
test(() => { test(() => {
assert_throws(new SyntaxError(), () => CSSStyleValue[parseMethod]('width', '10deg')); assert_throws(new TypeError(), () => CSSStyleValue[parseMethod]('width', '10deg'));
}, 'Calling CSSStyleValue.' + parseMethod + ' with an invalid cssText for the given property throws a SyntaxError'); }, 'Calling CSSStyleValue.' + parseMethod + ' with an invalid cssText for the given property throws a TypeError');
} }
const gValidNonListTests = [ const gValidNonListTests = [
......
...@@ -37,10 +37,9 @@ CSSStyleValueVector ParseCSSStyleValue( ...@@ -37,10 +37,9 @@ CSSStyleValueVector ParseCSSStyleValue(
const auto style_values = StyleValueFactory::FromString( const auto style_values = StyleValueFactory::FromString(
property_id, value, CSSParserContext::Create(*execution_context)); property_id, value, CSSParserContext::Create(*execution_context));
if (style_values.IsEmpty()) { if (style_values.IsEmpty()) {
exception_state.ThrowDOMException( exception_state.ThrowTypeError("The value provided ('" + value +
kSyntaxError, "The value provided ('" + value + "') could not be parsed as a '" +
"') could not be parsed as a '" + property_name + property_name + "'.");
"'.");
return CSSStyleValueVector(); return CSSStyleValueVector();
} }
......
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