| Index: Source/modules/serviceworkers/Headers.cpp
|
| diff --git a/Source/modules/serviceworkers/Headers.cpp b/Source/modules/serviceworkers/Headers.cpp
|
| index 0493a4cd859f4b12aae4263e09e138d5d5cfd2ba..e4e1933ab864a2d4b1842165ff28bcb321242e2b 100644
|
| --- a/Source/modules/serviceworkers/Headers.cpp
|
| +++ b/Source/modules/serviceworkers/Headers.cpp
|
| @@ -210,14 +210,17 @@ void Headers::set(const String& name, const String& value, ExceptionState& excep
|
| m_headerList->set(name, value);
|
| }
|
|
|
| -void Headers::forEach(PassOwnPtr<HeadersForEachCallback> callback, ScriptValue& thisArg)
|
| +void Headers::forEach(PassOwnPtr<HeadersForEachCallback> callback, const Optional<ScriptValue>& thisArg)
|
| {
|
| - forEachInternal(callback, &thisArg);
|
| -}
|
| -
|
| -void Headers::forEach(PassOwnPtr<HeadersForEachCallback> callback)
|
| -{
|
| - forEachInternal(callback, 0);
|
| + TrackExceptionState exceptionState;
|
| + for (size_t i = 0; i < m_headerList->size(); ++i) {
|
| + if (thisArg.isMissing())
|
| + callback->handleItem(m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
|
| + else
|
| + callback->handleItem(thisArg.get(), m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
|
| + if (exceptionState.hadException())
|
| + break;
|
| + }
|
| }
|
|
|
| void Headers::fillWith(const Headers* object, ExceptionState& exceptionState)
|
| @@ -309,19 +312,6 @@ Headers::Headers(FetchHeaderList* headerList)
|
| ScriptWrappable::init(this);
|
| }
|
|
|
| -void Headers::forEachInternal(PassOwnPtr<HeadersForEachCallback> callback, ScriptValue* thisArg)
|
| -{
|
| - TrackExceptionState exceptionState;
|
| - for (size_t i = 0; i < m_headerList->size(); ++i) {
|
| - if (thisArg)
|
| - callback->handleItem(*thisArg, m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
|
| - else
|
| - callback->handleItem(m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
|
| - if (exceptionState.hadException())
|
| - break;
|
| - }
|
| -}
|
| -
|
| void Headers::trace(Visitor* visitor)
|
| {
|
| visitor->trace(m_headerList);
|
|
|