| 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 21 matching lines...) Expand all Loading... |
| 32 std::string prefsContents; | 32 std::string prefsContents; |
| 33 | 33 |
| 34 std::shared_ptr<std::istream> Read(const std::string& path) const | 34 std::shared_ptr<std::istream> Read(const std::string& path) const |
| 35 { | 35 { |
| 36 if (path == "prefs.json" && !prefsContents.empty()) | 36 if (path == "prefs.json" && !prefsContents.empty()) |
| 37 return std::shared_ptr<std::istream>(new std::istringstream(prefsContent
s)); | 37 return std::shared_ptr<std::istream>(new std::istringstream(prefsContent
s)); |
| 38 | 38 |
| 39 return LazyFileSystem::Read(path); | 39 return LazyFileSystem::Read(path); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void Write(const std::string& path, std::istream& content) | 42 void Write(const std::string& path, std::ostream& content) |
| 43 { | 43 { |
| 44 if (path == "prefs.json") | 44 if (path == "prefs.json") |
| 45 { | 45 { |
| 46 std::stringstream ss; | 46 std::stringstream ss; |
| 47 ss << content.rdbuf(); | 47 ss << content.rdbuf(); |
| 48 prefsContents = ss.str(); | 48 prefsContents = ss.str(); |
| 49 } | 49 } |
| 50 else | 50 else |
| 51 LazyFileSystem::Write(path, content); | 51 LazyFileSystem::Write(path, content); |
| 52 } | 52 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 { | 209 { |
| 210 ResetJsEngine(); | 210 ResetJsEngine(); |
| 211 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; | 211 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; |
| 212 preconfiguredPrefs.emplace("suppress_first_run_page", jsEngine->NewValue(tru
e)); | 212 preconfiguredPrefs.emplace("suppress_first_run_page", jsEngine->NewValue(tru
e)); |
| 213 auto filterEngine = CreateFilterEngine(preconfiguredPrefs); | 213 auto filterEngine = CreateFilterEngine(preconfiguredPrefs); |
| 214 | 214 |
| 215 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page").IsBool()); | 215 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page").IsBool()); |
| 216 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page").AsBool()); | 216 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page").AsBool()); |
| 217 } | 217 } |
| 218 } | 218 } |
| OLD | NEW |