Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: Source/modules/fetch/Body.cpp

Issue 1027593003: bindings: Use Maybe version of v8::String::NewFromUtf8() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698