OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 30 matching lines...) Expand all Loading... |
41 : jsEngine(src.jsEngine) | 41 : jsEngine(src.jsEngine) |
42 { | 42 { |
43 const JsContext context(src.jsEngine); | 43 const JsContext context(src.jsEngine); |
44 value.reset(new v8::Persistent<v8::Value>(src.jsEngine->GetIsolate(), *src.val
ue)); | 44 value.reset(new v8::Persistent<v8::Value>(src.jsEngine->GetIsolate(), *src.val
ue)); |
45 } | 45 } |
46 | 46 |
47 AdblockPlus::JsValue::~JsValue() | 47 AdblockPlus::JsValue::~JsValue() |
48 { | 48 { |
49 if (value) | 49 if (value) |
50 { | 50 { |
| 51 const JsContext context(jsEngine); |
51 value->Dispose(); | 52 value->Dispose(); |
52 value.reset(); | 53 value.reset(); |
53 } | 54 } |
54 } | 55 } |
55 | 56 |
56 JsValue& AdblockPlus::JsValue::operator=(const JsValue& src) | 57 JsValue& AdblockPlus::JsValue::operator=(const JsValue& src) |
57 { | 58 { |
58 const JsContext context(src.jsEngine); | 59 const JsContext context(src.jsEngine); |
59 if (value) | 60 if (value) |
60 value->Dispose(); | 61 value->Dispose(); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 const v8::TryCatch tryCatch; | 270 const v8::TryCatch tryCatch; |
270 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue()); | 271 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue()); |
271 v8::Local<v8::Value> result = func->Call(thisObj, args.size(), | 272 v8::Local<v8::Value> result = func->Call(thisObj, args.size(), |
272 args.size() ? &args[0] : nullptr); | 273 args.size() ? &args[0] : nullptr); |
273 | 274 |
274 if (tryCatch.HasCaught()) | 275 if (tryCatch.HasCaught()) |
275 throw JsError(tryCatch.Exception(), tryCatch.Message()); | 276 throw JsError(tryCatch.Exception(), tryCatch.Message()); |
276 | 277 |
277 return JsValue(jsEngine, result); | 278 return JsValue(jsEngine, result); |
278 } | 279 } |
OLD | NEW |