Index: src/JsValue.cpp |
=================================================================== |
--- a/src/JsValue.cpp |
+++ b/src/JsValue.cpp |
@@ -12,26 +12,26 @@ namespace |
} |
v8::Local<v8::String> toV8String(const std::string& str) |
{ |
return v8::String::New(str.c_str(), str.length()); |
} |
} |
-AdblockPlus::JsValue::JsValue(AdblockPlus::JsEngine& jsEngine, |
+AdblockPlus::JsValue::JsValue(AdblockPlus::JsEnginePtr jsEngine, |
v8::Handle<v8::Value> value) |
: jsEngine(jsEngine), |
- value(v8::Persistent<v8::Value>::New(jsEngine.isolate, value)) |
+ value(v8::Persistent<v8::Value>::New(jsEngine->isolate, value)) |
{ |
} |
AdblockPlus::JsValue::~JsValue() |
{ |
- value.Dispose(jsEngine.isolate); |
+ value.Dispose(jsEngine->isolate); |
} |
bool AdblockPlus::JsValue::IsUndefined() const |
{ |
const JsEngine::Context context(jsEngine); |
return value->IsUndefined(); |
} |
@@ -187,17 +187,17 @@ AdblockPlus::JsValuePtr AdblockPlus::JsV |
AdblockPlus::JsValuePtr thisPtr) const |
{ |
if (!IsFunction()) |
throw new std::runtime_error("Attempting to call a non-function"); |
const JsEngine::Context context(jsEngine); |
if (!thisPtr) |
- thisPtr = JsValuePtr(new JsValue(jsEngine, jsEngine.context->Global())); |
+ thisPtr = JsValuePtr(new JsValue(jsEngine, jsEngine->context->Global())); |
if (!thisPtr->IsObject()) |
throw new std::runtime_error("`this` pointer has to be an object"); |
v8::Persistent<v8::Object> thisObj = v8::Persistent<v8::Object>::Cast(thisPtr->value); |
size_t argc = params.size(); |
v8::Handle<v8::Value>* argv = new v8::Handle<v8::Value>[argc]; |
for (size_t i = 0; i < argc; ++i) |
argv[i] = params[i]->value; |