Index: Source/modules/mediasource/SourceBuffer.cpp |
diff --git a/Source/modules/mediasource/SourceBuffer.cpp b/Source/modules/mediasource/SourceBuffer.cpp |
index e5787788affad763f8accced72c5f5278cec0db8..b96ae089ced46efedc12fce4dde6d8cac5e3b674 100644 |
--- a/Source/modules/mediasource/SourceBuffer.cpp |
+++ b/Source/modules/mediasource/SourceBuffer.cpp |
@@ -324,38 +324,41 @@ void SourceBuffer::abort(ExceptionState& exceptionState) |
void SourceBuffer::remove(double start, double end, ExceptionState& exceptionState) |
{ |
// Section 3.2 remove() method steps. |
- // 1. If start is negative or greater than duration, then throw an InvalidAccessError exception and abort these steps. |
- // 2. If end is less than or equal to start, then throw an InvalidAccessError exception and abort these steps. |
+ // 1. If duration equals NaN, then throw an InvalidAccessError exception and abort these steps. |
+ // 2. If start is negative or greater than duration, then throw an InvalidAccessError exception and abort these steps. |
if (start < 0 || (m_source && (std::isnan(m_source->duration()) || start > m_source->duration()))) { |
exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::indexOutsideRange("start", start, 0.0, ExceptionMessages::ExclusiveBound, !m_source || std::isnan(m_source->duration()) ? 0 : m_source->duration(), ExceptionMessages::ExclusiveBound)); |
return; |
} |
- if (end <= start) { |
+ |
+ // 3. If end is less than or equal to start or end equals NaN, then throw an InvalidAccessError exception and abort these steps. |
+ if (end <= start || std::isnan(end)) { |
exceptionState.throwDOMException(InvalidAccessError, "The end value provided (" + String::number(end) + ") must be greater than the start value provided (" + String::number(start) + ")."); |
return; |
} |
- // 3. If this object has been removed from the sourceBuffers attribute of the parent media source then throw an |
+ // 4. If this object has been removed from the sourceBuffers attribute of the parent media source then throw an |
// InvalidStateError exception and abort these steps. |
- // 4. If the updating attribute equals true, then throw an InvalidStateError exception and abort these steps. |
+ // 5. If the updating attribute equals true, then throw an InvalidStateError exception and abort these steps. |
if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionState)) |
return; |
TRACE_EVENT_ASYNC_BEGIN0("media", "SourceBuffer::remove", this); |
- // 5. If the readyState attribute of the parent media source is in the "ended" state then run the following steps: |
- // 5.1. Set the readyState attribute of the parent media source to "open" |
- // 5.2. Queue a task to fire a simple event named sourceopen at the parent media source . |
+ // 6. If the readyState attribute of the parent media source is in the "ended" state then run the following steps: |
+ // 6.1. Set the readyState attribute of the parent media source to "open" |
+ // 6.2. Queue a task to fire a simple event named sourceopen at the parent media source . |
m_source->openIfInEndedState(); |
- // 6. Set the updating attribute to true. |
+ // 7. Run the range removal algorithm with start and end as the start and end of the removal range. |
philipj_slow
2014/08/11 07:53:55
Looks equivalent, but it would be nice to factor o
acolwell GONE FROM CHROMIUM
2014/08/11 16:21:34
Yes. The range removal algorithm was added in one
|
+ // 7.3. Set the updating attribute to true. |
m_updating = true; |
- // 7. Queue a task to fire a simple event named updatestart at this SourceBuffer object. |
+ // 7.4. Queue a task to fire a simple event named updatestart at this SourceBuffer object. |
scheduleEvent(EventTypeNames::updatestart); |
- // 8. Return control to the caller and run the rest of the steps asynchronously. |
+ // 7.5. Return control to the caller and run the rest of the steps asynchronously. |
m_pendingRemoveStart = start; |
m_pendingRemoveEnd = end; |
m_removeAsyncPartRunner.runAsync(); |