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

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

Issue 684083002: Move the v8::Isolate* parameter to the first parameter of various binding methods in third_party/We… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 v8::Handle<v8::Value> V8ThrowException::createDOMException(int ec, const String& sanitizedMessage, const String& unsanitizedMessage, const v8::Handle<v8::Object >& creationContext, v8::Isolate* isolate) 47 v8::Handle<v8::Value> V8ThrowException::createDOMException(int ec, const String& sanitizedMessage, const String& unsanitizedMessage, const v8::Handle<v8::Object >& creationContext, 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 ASSERT(ec == SecurityError || unsanitizedMessage.isEmpty()); 52 ASSERT(ec == SecurityError || unsanitizedMessage.isEmpty());
53 53
54 if (ec == V8GeneralError) 54 if (ec == V8GeneralError)
55 return V8ThrowException::createGeneralError(sanitizedMessage, isolate); 55 return V8ThrowException::createGeneralError(isolate, sanitizedMessage);
56 if (ec == V8TypeError) 56 if (ec == V8TypeError)
57 return V8ThrowException::createTypeError(sanitizedMessage, isolate); 57 return V8ThrowException::createTypeError(sanitizedMessage, isolate);
58 if (ec == V8RangeError) 58 if (ec == V8RangeError)
59 return V8ThrowException::createRangeError(sanitizedMessage, isolate); 59 return V8ThrowException::createRangeError(sanitizedMessage, isolate);
60 if (ec == V8SyntaxError) 60 if (ec == V8SyntaxError)
61 return V8ThrowException::createSyntaxError(sanitizedMessage, isolate); 61 return V8ThrowException::createSyntaxError(sanitizedMessage, isolate);
62 if (ec == V8ReferenceError) 62 if (ec == V8ReferenceError)
63 return V8ThrowException::createReferenceError(sanitizedMessage, isolate) ; 63 return V8ThrowException::createReferenceError(sanitizedMessage, isolate) ;
64 64
65 RefPtrWillBeRawPtr<DOMException> domException = DOMException::create(ec, san itizedMessage, unsanitizedMessage); 65 RefPtrWillBeRawPtr<DOMException> domException = DOMException::create(ec, san itizedMessage, unsanitizedMessage);
(...skipping 15 matching lines...) Expand all
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 v8::Handle<v8::Value> V8ThrowException::throwDOMException(int ec, const String& sanitizedMessage, const String& unsanitizedMessage, const v8::Handle<v8::Object> & creationContext, v8::Isolate* isolate)
82 { 82 {
83 ASSERT(ec == SecurityError || unsanitizedMessage.isEmpty()); 83 ASSERT(ec == SecurityError || unsanitizedMessage.isEmpty());
84 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);
85 if (exception.IsEmpty()) 85 if (exception.IsEmpty())
86 return v8Undefined(); 86 return v8Undefined();
87 87
88 return V8ThrowException::throwException(exception, isolate); 88 return V8ThrowException::throwException(exception, isolate);
89 } 89 }
90 90
91 v8::Handle<v8::Value> V8ThrowException::createGeneralError(const String& message , v8::Isolate* isolate) 91 v8::Handle<v8::Value> V8ThrowException::createGeneralError(v8::Isolate* isolate, const String& message)
92 { 92 {
93 return v8::Exception::Error(v8String(isolate, message.isNull() ? "Error" : m essage)); 93 return v8::Exception::Error(v8String(isolate, message.isNull() ? "Error" : m essage));
94 } 94 }
95 95
96 v8::Handle<v8::Value> V8ThrowException::throwGeneralError(const String& message, v8::Isolate* isolate) 96 v8::Handle<v8::Value> V8ThrowException::throwGeneralError(v8::Isolate* isolate, const String& message)
97 { 97 {
98 v8::Handle<v8::Value> exception = V8ThrowException::createGeneralError(messa ge, isolate); 98 v8::Handle<v8::Value> exception = V8ThrowException::createGeneralError(isola te, message);
99 return V8ThrowException::throwException(exception, isolate); 99 return V8ThrowException::throwException(exception, isolate);
100 } 100 }
101 101
102 v8::Handle<v8::Value> V8ThrowException::createTypeError(const String& message, v 8::Isolate* isolate) 102 v8::Handle<v8::Value> V8ThrowException::createTypeError(const String& message, v 8::Isolate* isolate)
103 { 103 {
104 return v8::Exception::TypeError(v8String(isolate, message.isNull() ? "Type e rror" : message)); 104 return v8::Exception::TypeError(v8String(isolate, message.isNull() ? "Type e rror" : message));
105 } 105 }
106 106
107 v8::Handle<v8::Value> V8ThrowException::throwTypeError(const String& message, v8 ::Isolate* isolate) 107 v8::Handle<v8::Value> V8ThrowException::throwTypeError(const String& message, v8 ::Isolate* isolate)
108 { 108 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 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)
147 { 147 {
148 if (!v8::V8::IsExecutionTerminating()) 148 if (!v8::V8::IsExecutionTerminating())
149 isolate->ThrowException(exception); 149 isolate->ThrowException(exception);
150 return v8::Undefined(isolate); 150 return v8::Undefined(isolate);
151 } 151 }
152 152
153 } // namespace blink 153 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8ThrowException.h ('k') | Source/bindings/core/v8/WorkerScriptController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698