| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "modules/fetch/Body.h" | 6 #include "modules/fetch/Body.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 ASSERT(m_responseType == ResponseAsJSON); | 416 ASSERT(m_responseType == ResponseAsJSON); |
| 417 ScriptState::Scope scope(m_resolver->scriptState()); | 417 ScriptState::Scope scope(m_resolver->scriptState()); |
| 418 v8::Isolate* isolate = m_resolver->scriptState()->isolate(); | 418 v8::Isolate* isolate = m_resolver->scriptState()->isolate(); |
| 419 v8::Local<v8::String> inputString = v8String(isolate, string); | 419 v8::Local<v8::String> inputString = v8String(isolate, string); |
| 420 v8::TryCatch trycatch; | 420 v8::TryCatch trycatch; |
| 421 v8::Local<v8::Value> parsed = v8::JSON::Parse(inputString); | 421 v8::Local<v8::Value> parsed = v8::JSON::Parse(inputString); |
| 422 if (parsed.IsEmpty()) { | 422 if (parsed.IsEmpty()) { |
| 423 if (trycatch.HasCaught()) | 423 if (trycatch.HasCaught()) |
| 424 m_resolver->reject(trycatch.Exception()); | 424 m_resolver->reject(trycatch.Exception()); |
| 425 else | 425 else |
| 426 m_resolver->reject(v8::Exception::Error(v8::String::NewFromUtf8(isol
ate, "JSON parse error"))); | 426 m_resolver->reject(v8::Exception::Error(v8AtomicString(isolate, "JSO
N parse error"))); |
| 427 return; | 427 return; |
| 428 } | 428 } |
| 429 m_resolver->resolve(parsed); | 429 m_resolver->resolve(parsed); |
| 430 } | 430 } |
| 431 | 431 |
| 432 // FileReaderLoaderClient functions. | 432 // FileReaderLoaderClient functions. |
| 433 void Body::didStartLoading() { } | 433 void Body::didStartLoading() { } |
| 434 void Body::didReceiveData() { } | 434 void Body::didReceiveData() { } |
| 435 void Body::didFinishLoading() | 435 void Body::didFinishLoading() |
| 436 { | 436 { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 479 |
| 480 void Body::didBlobHandleReceiveError(PassRefPtrWillBeRawPtr<DOMException> except
ion) | 480 void Body::didBlobHandleReceiveError(PassRefPtrWillBeRawPtr<DOMException> except
ion) |
| 481 { | 481 { |
| 482 if (!m_resolver) | 482 if (!m_resolver) |
| 483 return; | 483 return; |
| 484 m_resolver->reject(exception); | 484 m_resolver->reject(exception); |
| 485 m_resolver.clear(); | 485 m_resolver.clear(); |
| 486 } | 486 } |
| 487 | 487 |
| 488 } // namespace blink | 488 } // namespace blink |
| OLD | NEW |