| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 const v8::TryCatch tryCatch(jsEngine->GetIsolate()); | 182 const v8::TryCatch tryCatch(jsEngine->GetIsolate()); |
| 183 const auto contentEnd = content.cend(); | 183 const auto contentEnd = content.cend(); |
| 184 auto stringBegin = SkipEndOfLine(content.begin(), contentEnd); | 184 auto stringBegin = SkipEndOfLine(content.begin(), contentEnd); |
| 185 do | 185 do |
| 186 { | 186 { |
| 187 auto stringEnd = AdvanceToEndOfLine(stringBegin, contentEnd); | 187 auto stringEnd = AdvanceToEndOfLine(stringBegin, contentEnd); |
| 188 auto jsLine = Utils::StringBufferToV8String(jsEngine->GetIsolate
(), StringBuffer(stringBegin, stringEnd)).As<v8::Value>(); | 188 auto jsLine = Utils::StringBufferToV8String(jsEngine->GetIsolate
(), StringBuffer(stringBegin, stringEnd)).As<v8::Value>(); |
| 189 processFunc->Call(globalContext, 1, &jsLine); | 189 processFunc->Call(globalContext, 1, &jsLine); |
| 190 if (tryCatch.HasCaught()) | 190 if (tryCatch.HasCaught()) |
| 191 throw JsError(tryCatch.Exception(), tryCatch.Message()); | 191 throw JsError(jsEngine->GetIsolate(), tryCatch.Exception(), |
| 192 tryCatch.Message()); |
| 192 stringBegin = SkipEndOfLine(stringEnd, contentEnd); | 193 stringBegin = SkipEndOfLine(stringEnd, contentEnd); |
| 193 } while (stringBegin != contentEnd); | 194 } while (stringBegin != contentEnd); |
| 194 jsEngine->GetJsValues(weakData->weakResolveCallback)[0].Call(); | 195 jsEngine->GetJsValues(weakData->weakResolveCallback)[0].Call(); |
| 195 }, [weakData](const std::string& error) | 196 }, [weakData](const std::string& error) |
| 196 { | 197 { |
| 197 if (error.empty()) | 198 if (error.empty()) |
| 198 return; | 199 return; |
| 199 auto jsEngine = weakData->weakJsEngine.lock(); | 200 auto jsEngine = weakData->weakJsEngine.lock(); |
| 200 if (!jsEngine) | 201 if (!jsEngine) |
| 201 return; | 202 return; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 JsValue& FileSystemJsObject::Setup(JsEngine& jsEngine, JsValue& obj) | 360 JsValue& FileSystemJsObject::Setup(JsEngine& jsEngine, JsValue& obj) |
| 360 { | 361 { |
| 361 obj.SetProperty("read", jsEngine.NewCallback(::ReadCallback::V8Callback)); | 362 obj.SetProperty("read", jsEngine.NewCallback(::ReadCallback::V8Callback)); |
| 362 obj.SetProperty("readFromFile", jsEngine.NewCallback(::ReadFromFileCallback::V
8Callback)); | 363 obj.SetProperty("readFromFile", jsEngine.NewCallback(::ReadFromFileCallback::V
8Callback)); |
| 363 obj.SetProperty("write", jsEngine.NewCallback(::WriteCallback)); | 364 obj.SetProperty("write", jsEngine.NewCallback(::WriteCallback)); |
| 364 obj.SetProperty("move", jsEngine.NewCallback(::MoveCallback)); | 365 obj.SetProperty("move", jsEngine.NewCallback(::MoveCallback)); |
| 365 obj.SetProperty("remove", jsEngine.NewCallback(::RemoveCallback)); | 366 obj.SetProperty("remove", jsEngine.NewCallback(::RemoveCallback)); |
| 366 obj.SetProperty("stat", jsEngine.NewCallback(::StatCallback)); | 367 obj.SetProperty("stat", jsEngine.NewCallback(::StatCallback)); |
| 367 return obj; | 368 return obj; |
| 368 } | 369 } |
| OLD | NEW |