Commit 06bd779b authored by Yuki Shiino's avatar Yuki Shiino Committed by Commit Bot

v8binding: Fix CSSStyleDeclaration not to throw when a prop is deleted

Blink is implementing CSSStyleDeclaration's IDL attributes as
named properties (pretending to be IDL attributes).

Recently, the named property's implementation is improved[1] to
better conform to Web IDL specification, and "deletion of named
properties" now throws an exception when named deleter is not
defined.  So, accordingly CSSStyleDeclaration has to _better
pretend_ to have IDL attributes, which are deletable, by
defining a noop deleter.

This patch introduces such a noop deleter.

[1] https://crrev.com/c/2335713

Bug: 1121628
Change-Id: I338c064b9a2ea88fa97169a9e904da0a8613e0ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377035Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801768}
parent 61112108
...@@ -196,6 +196,13 @@ NamedPropertySetterResult CSSStyleDeclaration::AnonymousNamedSetter( ...@@ -196,6 +196,13 @@ NamedPropertySetterResult CSSStyleDeclaration::AnonymousNamedSetter(
return NamedPropertySetterResult::kIntercepted; return NamedPropertySetterResult::kIntercepted;
} }
NamedPropertyDeleterResult CSSStyleDeclaration::AnonymousNamedDeleter(
const AtomicString& name) {
// Pretend to be deleted since web author can define their own property with
// the same name.
return NamedPropertyDeleterResult::kDeleted;
}
void CSSStyleDeclaration::NamedPropertyEnumerator(Vector<String>& names, void CSSStyleDeclaration::NamedPropertyEnumerator(Vector<String>& names,
ExceptionState&) { ExceptionState&) {
typedef Vector<String, numCSSProperties - 1> PreAllocatedPropertyVector; typedef Vector<String, numCSSProperties - 1> PreAllocatedPropertyVector;
......
...@@ -102,6 +102,7 @@ class CORE_EXPORT CSSStyleDeclaration : public ScriptWrappable, ...@@ -102,6 +102,7 @@ class CORE_EXPORT CSSStyleDeclaration : public ScriptWrappable,
NamedPropertySetterResult AnonymousNamedSetter(ScriptState*, NamedPropertySetterResult AnonymousNamedSetter(ScriptState*,
const AtomicString& name, const AtomicString& name,
const String& value); const String& value);
NamedPropertyDeleterResult AnonymousNamedDeleter(const AtomicString& name);
void NamedPropertyEnumerator(Vector<String>& names, ExceptionState&); void NamedPropertyEnumerator(Vector<String>& names, ExceptionState&);
bool NamedPropertyQuery(const AtomicString&, ExceptionState&); bool NamedPropertyQuery(const AtomicString&, ExceptionState&);
......
...@@ -40,4 +40,5 @@ ...@@ -40,4 +40,5 @@
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-dashed-attribute // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-dashed-attribute
[Affects=Nothing] getter DOMString (DOMString name); [Affects=Nothing] getter DOMString (DOMString name);
[CEReactions, CallWith=ScriptState] setter void (DOMString property, [TreatNullAs=EmptyString] DOMString propertyValue); [CEReactions, CallWith=ScriptState] setter void (DOMString property, [TreatNullAs=EmptyString] DOMString propertyValue);
deleter void (DOMString property);
}; };
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