OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the Adblock Plus, | 2 * This file is part of the Adblock Plus, |
3 * Copyright (C) 2006-2012 Eyeo GmbH | 3 * Copyright (C) 2006-2012 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 { | 157 { |
158 D(D_WARN, "nativeExecute()"); | 158 D(D_WARN, "nativeExecute()"); |
159 v8::HandleScope handle_scope; | 159 v8::HandleScope handle_scope; |
160 | 160 |
161 v8::Persistent<v8::Context> context((v8::Context *) pContext); | 161 v8::Persistent<v8::Context> context((v8::Context *) pContext); |
162 v8::Context::Scope context_scope(context); | 162 v8::Context::Scope context_scope(context); |
163 | 163 |
164 const std::string script = getString(pEnv, pScript); | 164 const std::string script = getString(pEnv, pScript); |
165 | 165 |
166 v8::Handle<v8::String> source = v8::String::New(script.c_str(), script.size())
; | 166 v8::Handle<v8::String> source = v8::String::New(script.c_str(), script.size())
; |
167 v8::Handle<v8::Script> compiledScript = v8::Script::Compile(source); | 167 v8::Handle<v8::Script> compiledScript; |
| 168 { |
| 169 v8::TryCatch try_catch; |
| 170 compiledScript = v8::Script::Compile(source); |
| 171 if (try_catch.HasCaught()) |
| 172 { |
| 173 reportException(&try_catch); |
| 174 return NULL; |
| 175 } |
| 176 } |
168 { | 177 { |
169 v8::TryCatch try_catch; | 178 v8::TryCatch try_catch; |
170 v8::Handle<v8::Value> result = compiledScript->Run(); | 179 v8::Handle<v8::Value> result = compiledScript->Run(); |
171 if (try_catch.HasCaught()) | 180 if (try_catch.HasCaught()) |
172 { | 181 { |
173 reportException(&try_catch); | 182 reportException(&try_catch); |
174 return NULL; | 183 return NULL; |
175 } | 184 } |
176 else | 185 else |
177 { | 186 { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 long r = 0; | 280 long r = 0; |
272 while (r == 0) | 281 while (r == 0) |
273 { | 282 { |
274 v8::TryCatch try_catch; | 283 v8::TryCatch try_catch; |
275 r = RunNextCallback(context); | 284 r = RunNextCallback(context); |
276 if (try_catch.HasCaught()) | 285 if (try_catch.HasCaught()) |
277 reportException(&try_catch); | 286 reportException(&try_catch); |
278 } | 287 } |
279 return (jlong) r; | 288 return (jlong) r; |
280 } | 289 } |
OLD | NEW |