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

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

Issue 660543002: Fix unhandled promise console message to show stack trace of a DOMException. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « Source/bindings/core/v8/V8Initializer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 v8::Handle<v8::Value> exception = toV8(domException, creationContext, isolat e); 66 v8::Handle<v8::Value> exception = toV8(domException, creationContext, isolat e);
67 67
68 if (exception.IsEmpty()) 68 if (exception.IsEmpty())
69 return v8Undefined(); 69 return v8Undefined();
70 70
71 // Attach an Error object to the DOMException. This is then lazily used to g et the stack value. 71 // Attach an Error object to the DOMException. This is then lazily used to g et the stack value.
72 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(isolate, domExce ption->message())); 72 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(isolate, domExce ption->message()));
73 ASSERT(!error.IsEmpty()); 73 ASSERT(!error.IsEmpty());
74 ASSERT(exception->IsObject()); 74 ASSERT(exception->IsObject());
75 exception->ToObject()->SetAccessor(v8AtomicString(isolate, "stack"), domExce ptionStackGetter, domExceptionStackSetter, error); 75 exception->ToObject()->SetAccessor(v8AtomicString(isolate, "stack"), domExce ptionStackGetter, domExceptionStackSetter, error);
76 V8HiddenValue::setHiddenValue(isolate, exception->ToObject(), V8HiddenValue: :error(isolate), error);
76 77
77 return exception; 78 return exception;
78 } 79 }
79 80
80 v8::Handle<v8::Value> V8ThrowException::throwDOMException(int ec, const String& sanitizedMessage, const String& unsanitizedMessage, const v8::Handle<v8::Object> & creationContext, v8::Isolate* isolate) 81 v8::Handle<v8::Value> V8ThrowException::throwDOMException(int ec, const String& sanitizedMessage, const String& unsanitizedMessage, const v8::Handle<v8::Object> & creationContext, v8::Isolate* isolate)
81 { 82 {
82 ASSERT(ec == SecurityError || unsanitizedMessage.isEmpty()); 83 ASSERT(ec == SecurityError || unsanitizedMessage.isEmpty());
83 v8::Handle<v8::Value> exception = createDOMException(ec, sanitizedMessage, u nsanitizedMessage, creationContext, isolate); 84 v8::Handle<v8::Value> exception = createDOMException(ec, sanitizedMessage, u nsanitizedMessage, creationContext, isolate);
84 if (exception.IsEmpty()) 85 if (exception.IsEmpty())
85 return v8Undefined(); 86 return v8Undefined();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 144 }
144 145
145 v8::Handle<v8::Value> V8ThrowException::throwException(v8::Handle<v8::Value> exc eption, v8::Isolate* isolate) 146 v8::Handle<v8::Value> V8ThrowException::throwException(v8::Handle<v8::Value> exc eption, v8::Isolate* isolate)
146 { 147 {
147 if (!v8::V8::IsExecutionTerminating()) 148 if (!v8::V8::IsExecutionTerminating())
148 isolate->ThrowException(exception); 149 isolate->ThrowException(exception);
149 return v8::Undefined(isolate); 150 return v8::Undefined(isolate);
150 } 151 }
151 152
152 } // namespace blink 153 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8Initializer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698