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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return v8::ThrowException(Utils::ToV8String(isolate, | 61 return v8::ThrowException(Utils::ToV8String(isolate, |
62 "_triggerEvent expects at least one parameter")); | 62 "_triggerEvent expects at least one parameter")); |
63 } | 63 } |
64 std::string eventName = converted.front()->AsString(); | 64 std::string eventName = converted.front()->AsString(); |
65 converted.erase(converted.begin()); | 65 converted.erase(converted.begin()); |
66 jsEngine->TriggerEvent(eventName, converted); | 66 jsEngine->TriggerEvent(eventName, converted); |
67 return v8::Undefined(); | 67 return v8::Undefined(); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 JsValuePtr GlobalJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo, | 71 JsValue& GlobalJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo, |
72 const JsValuePtr& obj) | 72 JsValue& obj) |
73 { | 73 { |
74 obj->SetProperty("setTimeout", jsEngine.NewCallback(::SetTimeoutCallback)); | 74 obj.SetProperty("setTimeout", *jsEngine.NewCallback(::SetTimeoutCallback)); |
75 obj->SetProperty("_triggerEvent", jsEngine.NewCallback(::TriggerEventCallback)
); | 75 obj.SetProperty("_triggerEvent", *jsEngine.NewCallback(::TriggerEventCallback)
); |
76 obj->SetProperty("_fileSystem", | 76 obj.SetProperty("_fileSystem", |
77 FileSystemJsObject::Setup(jsEngine, jsEngine.NewObject())); | 77 FileSystemJsObject::Setup(jsEngine, *jsEngine.NewObject())); |
78 obj->SetProperty("_webRequest", | 78 obj.SetProperty("_webRequest", |
79 WebRequestJsObject::Setup(jsEngine, jsEngine.NewObject())); | 79 WebRequestJsObject::Setup(jsEngine, *jsEngine.NewObject())); |
80 obj->SetProperty("console", | 80 obj.SetProperty("console", |
81 ConsoleJsObject::Setup(jsEngine, jsEngine.NewObject())); | 81 ConsoleJsObject::Setup(jsEngine, *jsEngine.NewObject())); |
82 obj->SetProperty("_appInfo", | 82 obj.SetProperty("_appInfo", |
83 AppInfoJsObject::Setup(appInfo, jsEngine.NewObject())); | 83 AppInfoJsObject::Setup(appInfo, *jsEngine.NewObject())); |
84 return obj; | 84 return obj; |
85 } | 85 } |
OLD | NEW |