| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 200 std::string AdblockPlus::JsValue::GetClass() const | 200 std::string AdblockPlus::JsValue::GetClass() const | 
| 201 { | 201 { | 
| 202   if (!IsObject()) | 202   if (!IsObject()) | 
| 203     throw new std::runtime_error("Cannot get constructor of a non-object"); | 203     throw new std::runtime_error("Cannot get constructor of a non-object"); | 
| 204 | 204 | 
| 205   const JsContext context(jsEngine); | 205   const JsContext context(jsEngine); | 
| 206   v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(UnwrapValue()); | 206   v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(UnwrapValue()); | 
| 207   return Utils::FromV8String(obj->GetConstructorName()); | 207   return Utils::FromV8String(obj->GetConstructorName()); | 
| 208 } | 208 } | 
| 209 | 209 | 
| 210 JsValue JsValue::Call(const JsConstValueList& params, JsValuePtr thisPtr) const | 210 JsValue JsValue::Call(const JsConstValueList& params, const JsValuePtr& thisPtr)
      const | 
| 211 { | 211 { | 
| 212   const JsContext context(jsEngine); | 212   const JsContext context(jsEngine); | 
| 213   v8::Local<v8::Object> thisObj = thisPtr ? | 213   v8::Local<v8::Object> thisObj = thisPtr ? | 
| 214     v8::Local<v8::Object>::Cast(thisPtr->UnwrapValue()) : | 214     v8::Local<v8::Object>::Cast(thisPtr->UnwrapValue()) : | 
| 215     context.GetV8Context()->Global(); | 215     context.GetV8Context()->Global(); | 
| 216 | 216 | 
| 217   std::vector<v8::Handle<v8::Value>> argv; | 217   std::vector<v8::Handle<v8::Value>> argv; | 
| 218   for (const auto& param : params) | 218   for (const auto& param : params) | 
| 219     argv.push_back(param->UnwrapValue()); | 219     argv.push_back(param->UnwrapValue()); | 
| 220 | 220 | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 243   const v8::TryCatch tryCatch; | 243   const v8::TryCatch tryCatch; | 
| 244   v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue()); | 244   v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue()); | 
| 245   v8::Local<v8::Value> result = func->Call(thisObj, args.size(), | 245   v8::Local<v8::Value> result = func->Call(thisObj, args.size(), | 
| 246     args.size() ? &args[0] : nullptr); | 246     args.size() ? &args[0] : nullptr); | 
| 247 | 247 | 
| 248   if (tryCatch.HasCaught()) | 248   if (tryCatch.HasCaught()) | 
| 249     throw JsError(tryCatch.Exception(), tryCatch.Message()); | 249     throw JsError(tryCatch.Exception(), tryCatch.Message()); | 
| 250 | 250 | 
| 251   return JsValue(jsEngine, result); | 251   return JsValue(jsEngine, result); | 
| 252 } | 252 } | 
| OLD | NEW | 
|---|