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

Side by Side Diff: Source/bindings/core/v8/ScriptValue.cpp

Issue 625943002: Catch uncaught promise rejections from V8 and log to console. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed Created 6 years, 2 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 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/core/v8/ScriptValue.h" 32 #include "bindings/core/v8/ScriptValue.h"
33 33
34 #include "bindings/core/v8/ScriptState.h" 34 #include "bindings/core/v8/ScriptState.h"
35 #include "bindings/core/v8/V8Binding.h" 35 #include "bindings/core/v8/V8Binding.h"
36 #include "platform/JSONValues.h" 36 #include "platform/JSONValues.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 int ScriptValue::identityHash() const
41 {
42 if (isEmpty())
43 return 0;
44 v8::HandleScope handleScope(isolate());
45 v8::Local<v8::Value> value = m_value->newLocal(isolate());
46 if (!value->IsObject())
47 return 0;
48 return v8::Local<v8::Object>::Cast(value)->GetIdentityHash();
49 }
50
40 v8::Handle<v8::Value> ScriptValue::v8Value() const 51 v8::Handle<v8::Value> ScriptValue::v8Value() const
41 { 52 {
42 if (isEmpty()) 53 if (isEmpty())
43 return v8::Handle<v8::Value>(); 54 return v8::Handle<v8::Value>();
44 55
45 ASSERT(isolate()->InContext()); 56 ASSERT(isolate()->InContext());
46 57
47 // This is a check to validate that you don't return a ScriptValue to a worl d different 58 // This is a check to validate that you don't return a ScriptValue to a worl d different
48 // from the world that created the ScriptValue. 59 // from the world that created the ScriptValue.
49 // Probably this could be: 60 // Probably this could be:
(...skipping 25 matching lines...) Expand all
75 } 86 }
76 87
77 PassRefPtr<JSONValue> ScriptValue::toJSONValue(ScriptState* scriptState) const 88 PassRefPtr<JSONValue> ScriptValue::toJSONValue(ScriptState* scriptState) const
78 { 89 {
79 ASSERT(!scriptState->contextIsValid()); 90 ASSERT(!scriptState->contextIsValid());
80 ScriptState::Scope scope(scriptState); 91 ScriptState::Scope scope(scriptState);
81 return v8ToJSONValue(scriptState->isolate(), v8Value(), JSONValue::maxDepth) ; 92 return v8ToJSONValue(scriptState->isolate(), v8Value(), JSONValue::maxDepth) ;
82 } 93 }
83 94
84 } // namespace blink 95 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698