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

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

Issue 18398002: Remove IDBNotFoundError ExceptionCode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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) 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 26 matching lines...) Expand all
37 ASSERT(info.Data()->IsObject()); 37 ASSERT(info.Data()->IsObject());
38 v8SetReturnValue(info, info.Data()->ToObject()->Get(v8::String::NewSymbol("s tack"))); 38 v8SetReturnValue(info, info.Data()->ToObject()->Get(v8::String::NewSymbol("s tack")));
39 } 39 }
40 40
41 static void domExceptionStackSetter(v8::Local<v8::String> name, v8::Local<v8::Va lue> value, const v8::PropertyCallbackInfo<void>& info) 41 static void domExceptionStackSetter(v8::Local<v8::String> name, v8::Local<v8::Va lue> value, const v8::PropertyCallbackInfo<void>& info)
42 { 42 {
43 ASSERT(info.Data()->IsObject()); 43 ASSERT(info.Data()->IsObject());
44 info.Data()->ToObject()->Set(v8::String::NewSymbol("stack"), value); 44 info.Data()->ToObject()->Set(v8::String::NewSymbol("stack"), value);
45 } 45 }
46 46
47 v8::Handle<v8::Value> V8ThrowException::setDOMException(int ec, v8::Isolate* iso late) 47 v8::Handle<v8::Value> V8ThrowException::setDOMException(int ec, const char* mess age, v8::Isolate* isolate)
48 { 48 {
49 if (ec <= 0 || v8::V8::IsExecutionTerminating()) 49 if (ec <= 0 || v8::V8::IsExecutionTerminating())
50 return v8Undefined(); 50 return v8Undefined();
51 51
52 // FIXME: Handle other WebIDL exception types. 52 // FIXME: Handle other WebIDL exception types.
53 if (ec == TypeError) 53 if (ec == TypeError)
54 return V8ThrowException::throwTypeError(0, isolate); 54 return V8ThrowException::throwTypeError(message, isolate);
55 55
56 RefPtr<DOMException> domException = DOMException::create(ec); 56 RefPtr<DOMException> domException = DOMException::create(ec, message);
57 v8::Handle<v8::Value> exception = toV8(domException, v8::Handle<v8::Object>( ), isolate); 57 v8::Handle<v8::Value> exception = toV8(domException, v8::Handle<v8::Object>( ), isolate);
58 58
59 if (exception.IsEmpty()) 59 if (exception.IsEmpty())
60 return v8Undefined(); 60 return v8Undefined();
61 61
62 // Attach an Error object to the DOMException. This is then lazily used to g et the stack value. 62 // Attach an Error object to the DOMException. This is then lazily used to g et the stack value.
63 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(domException->me ssage(), isolate)); 63 v8::Handle<v8::Value> error = v8::Exception::Error(v8String(domException->me ssage(), isolate));
64 ASSERT(!error.IsEmpty()); 64 ASSERT(!error.IsEmpty());
65 ASSERT(exception->IsObject()); 65 ASSERT(exception->IsObject());
66 exception->ToObject()->SetAccessor(v8::String::NewSymbol("stack"), domExcept ionStackGetter, domExceptionStackSetter, error); 66 exception->ToObject()->SetAccessor(v8::String::NewSymbol("stack"), domExcept ionStackGetter, domExceptionStackSetter, error);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 v8::Handle<v8::Value> V8ThrowException::throwError(v8::Handle<v8::Value> excepti on, v8::Isolate* isolate) 100 v8::Handle<v8::Value> V8ThrowException::throwError(v8::Handle<v8::Value> excepti on, v8::Isolate* isolate)
101 { 101 {
102 if (!v8::V8::IsExecutionTerminating()) 102 if (!v8::V8::IsExecutionTerminating())
103 v8::ThrowException(exception); 103 v8::ThrowException(exception);
104 return v8::Undefined(); 104 return v8::Undefined();
105 } 105 }
106 106
107 } // namespace WebCore 107 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698