| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 { | 58 { |
| 59 v8::Isolate* isolate = arguments.GetIsolate(); | 59 v8::Isolate* isolate = arguments.GetIsolate(); |
| 60 return Utils::ThrowExceptionInJS(isolate, "_triggerEvent expects at least
one parameter"); | 60 return Utils::ThrowExceptionInJS(isolate, "_triggerEvent expects at least
one parameter"); |
| 61 } | 61 } |
| 62 std::string eventName = converted.front().AsString(); | 62 std::string eventName = converted.front().AsString(); |
| 63 converted.erase(converted.cbegin()); | 63 converted.erase(converted.cbegin()); |
| 64 jsEngine->TriggerEvent(eventName, move(converted)); | 64 jsEngine->TriggerEvent(eventName, move(converted)); |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 JsValue& GlobalJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo, | 68 AdblockPlus::JsValue& AdblockPlus::GlobalJsObject::Setup(AdblockPlus::JsEngine&
jsEngine, const AppInfo& appInfo, |
| 69 JsValue& obj) | 69 AdblockPlus::JsValue& obj) |
| 70 { | 70 { |
| 71 obj.SetProperty("setTimeout", jsEngine.NewCallback(::SetTimeoutCallback)); | 71 obj.SetProperty("setTimeout", jsEngine.NewCallback(::SetTimeoutCallback)); |
| 72 obj.SetProperty("_triggerEvent", jsEngine.NewCallback(::TriggerEventCallback))
; | 72 obj.SetProperty("_triggerEvent", jsEngine.NewCallback(::TriggerEventCallback))
; |
| 73 auto value = jsEngine.NewObject(); | 73 auto value = jsEngine.NewObject(); |
| 74 obj.SetProperty("_fileSystem", FileSystemJsObject::Setup(jsEngine, value)); | 74 obj.SetProperty("_fileSystem", FileSystemJsObject::Setup(jsEngine, value)); |
| 75 value = jsEngine.NewObject(); | 75 value = jsEngine.NewObject(); |
| 76 obj.SetProperty("_webRequest", WebRequestJsObject::Setup(jsEngine, value)); | 76 obj.SetProperty("_webRequest", WebRequestJsObject::Setup(jsEngine, value)); |
| 77 value = jsEngine.NewObject(); | 77 value = jsEngine.NewObject(); |
| 78 obj.SetProperty("console", ConsoleJsObject::Setup(jsEngine, value)); | 78 obj.SetProperty("console", ConsoleJsObject::Setup(jsEngine, value)); |
| 79 value = jsEngine.NewObject(); | 79 value = jsEngine.NewObject(); |
| 80 obj.SetProperty("_appInfo", AppInfoJsObject::Setup(appInfo, value)); | 80 obj.SetProperty("_appInfo", AppInfoJsObject::Setup(appInfo, value)); |
| 81 return obj; | 81 return obj; |
| 82 } | 82 } |
| OLD | NEW |