| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 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); | |
| 
 
sergei
2017/04/20 07:42:52
I think it deserves a separate commit. Do you mind
 
hub
2017/04/20 12:41:01
will do.
 
 | |
| 52 value->Dispose(); | 51 value->Dispose(); | 
| 53 value.reset(); | 52 value.reset(); | 
| 54 } | 53 } | 
| 55 } | 54 } | 
| 56 | 55 | 
| 57 JsValue& AdblockPlus::JsValue::operator=(const JsValue& src) | 56 JsValue& AdblockPlus::JsValue::operator=(const JsValue& src) | 
| 58 { | 57 { | 
| 59 const JsContext context(src.jsEngine); | 58 const JsContext context(src.jsEngine); | 
| 60 if (value) | 59 if (value) | 
| 61 value->Dispose(); | 60 value->Dispose(); | 
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 const v8::TryCatch tryCatch; | 261 const v8::TryCatch tryCatch; | 
| 263 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue()); | 262 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue()); | 
| 264 v8::Local<v8::Value> result = func->Call(thisObj, args.size(), | 263 v8::Local<v8::Value> result = func->Call(thisObj, args.size(), | 
| 265 args.size() ? &args[0] : nullptr); | 264 args.size() ? &args[0] : nullptr); | 
| 266 | 265 | 
| 267 if (tryCatch.HasCaught()) | 266 if (tryCatch.HasCaught()) | 
| 268 throw JsError(tryCatch.Exception(), tryCatch.Message()); | 267 throw JsError(tryCatch.Exception(), tryCatch.Message()); | 
| 269 | 268 | 
| 270 return JsValue(jsEngine, result); | 269 return JsValue(jsEngine, result); | 
| 271 } | 270 } | 
| LEFT | RIGHT |