Chromium Code Reviews

Unified Diff: third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOffHelper.h

Issue 2357463002: Consolidate read-only exception throwing for SVG*TearOffs (Closed)
Patch Set: Baseline updates Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOffHelper.h
diff --git a/third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOffHelper.h b/third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOffHelper.h
index 189af1eb7e330702677d0790637563cd044cd7a3..0a40a623ef0d4d77b3a01dbded641316f98ae126 100644
--- a/third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOffHelper.h
+++ b/third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOffHelper.h
@@ -31,9 +31,7 @@
#ifndef SVGListPropertyTearOffHelper_h
#define SVGListPropertyTearOffHelper_h
-#include "bindings/core/v8/ExceptionState.h"
#include "core/svg/properties/SVGPropertyTearOff.h"
-#include "wtf/HashMap.h"
#include "wtf/TypeTraits.h"
namespace blink {
@@ -90,25 +88,21 @@ public:
void clear(ExceptionState& exceptionState)
{
if (toDerived()->isImmutable()) {
- exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
+ SVGPropertyTearOffBase::throwReadOnly(exceptionState);
return;
}
-
toDerived()->target()->clear();
}
ItemTearOffType* initialize(ItemTearOffType* item, ExceptionState& exceptionState)
{
if (toDerived()->isImmutable()) {
- exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
+ SVGPropertyTearOffBase::throwReadOnly(exceptionState);
return nullptr;
}
-
- ASSERT(item);
-
+ DCHECK(item);
ItemPropertyType* value = toDerived()->target()->initialize(getValueForInsertionFromTearOff(item));
toDerived()->commitChange();
-
return createItemTearOff(value);
}
@@ -121,30 +115,24 @@ public:
ItemTearOffType* insertItemBefore(ItemTearOffType* item, unsigned long index, ExceptionState& exceptionState)
{
if (toDerived()->isImmutable()) {
- exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
+ SVGPropertyTearOffBase::throwReadOnly(exceptionState);
return nullptr;
}
-
- ASSERT(item);
-
+ DCHECK(item);
ItemPropertyType* value = toDerived()->target()->insertItemBefore(getValueForInsertionFromTearOff(item), index);
toDerived()->commitChange();
-
return createItemTearOff(value);
}
ItemTearOffType* replaceItem(ItemTearOffType* item, unsigned long index, ExceptionState& exceptionState)
{
if (toDerived()->isImmutable()) {
- exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
+ SVGPropertyTearOffBase::throwReadOnly(exceptionState);
return nullptr;
}
-
- ASSERT(item);
-
+ DCHECK(item);
ItemPropertyType* value = toDerived()->target()->replaceItem(getValueForInsertionFromTearOff(item), index, exceptionState);
toDerived()->commitChange();
-
return createItemTearOff(value);
}
@@ -157,28 +145,23 @@ public:
ItemTearOffType* removeItem(unsigned long index, ExceptionState& exceptionState)
{
if (toDerived()->isImmutable()) {
- exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
+ SVGPropertyTearOffBase::throwReadOnly(exceptionState);
return nullptr;
}
-
ItemPropertyType* value = toDerived()->target()->removeItem(index, exceptionState);
toDerived()->commitChange();
-
return createItemTearOff(value);
}
ItemTearOffType* appendItem(ItemTearOffType* item, ExceptionState& exceptionState)
{
if (toDerived()->isImmutable()) {
- exceptionState.throwDOMException(NoModificationAllowedError, "The object is read-only.");
+ SVGPropertyTearOffBase::throwReadOnly(exceptionState);
return nullptr;
}
-
- ASSERT(item);
-
+ DCHECK(item);
ItemPropertyType* value = toDerived()->target()->appendItem(getValueForInsertionFromTearOff(item));
toDerived()->commitChange();
-
return createItemTearOff(value);
}

Powered by Google App Engine