 Chromium Code Reviews
 Chromium Code Reviews Issue 405083003:
  Range.compareBoundaryPoints should throw a NotSupportedError when how has not expected value  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 405083003:
  Range.compareBoundaryPoints should throw a NotSupportedError when how has not expected value  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| Index: Source/core/dom/Range.cpp | 
| diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp | 
| index 4bc3f5f8cbceff87ce8e2b33f29a03eea3d37a0a..6434ed8ecb4fafe77cb9454317bf3740ad270454 100644 | 
| --- a/Source/core/dom/Range.cpp | 
| +++ b/Source/core/dom/Range.cpp | 
| @@ -321,10 +321,10 @@ Range::CompareResults Range::compareNode(Node* refNode, ExceptionState& exceptio | 
| return NODE_INSIDE; // ends inside the range | 
| } | 
| -short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, ExceptionState& exceptionState) const | 
| +short Range::compareBoundaryPoints(CompareHow how, const PassRefPtrWillBeRawPtr<Range> sourceRange, ExceptionState& exceptionState) const | 
| 
Yuta Kitamura
2014/07/22 06:03:39
nit: const seems unnecessary.
Just curious, TypeC
 
kangil_
2014/07/22 08:41:49
IMHO, const is generally good since it protects us
 
Yuta Kitamura
2014/07/22 09:22:43
I'm not opposing to the use of const in general. I
 | 
| { | 
| - if (!sourceRange) { | 
| - exceptionState.throwDOMException(NotFoundError, "The source range provided was null."); | 
| + if (!(how == START_TO_START || how == START_TO_END || how == END_TO_END || how == END_TO_START)) { | 
| + exceptionState.throwDOMException(NotSupportedError, "The comparison method provided must be one of 'START_TO_START', 'START_TO_END', 'END_TO_END', or 'END_TO_START'."); | 
| return 0; | 
| } | 
| @@ -357,7 +357,7 @@ short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, Exc | 
| return compareBoundaryPoints(m_start, sourceRange->m_end, exceptionState); | 
| } | 
| - exceptionState.throwDOMException(SyntaxError, "The comparison method provided must be one of 'START_TO_START', 'START_TO_END', 'END_TO_END', or 'END_TO_START'."); | 
| + ASSERT_NOT_REACHED(); | 
| return 0; | 
| } |