| LEFT | RIGHT |
| 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 19 matching lines...) Expand all Loading... |
| 30 #include "../filter/ElemHideFilter.h" | 30 #include "../filter/ElemHideFilter.h" |
| 31 #include "../filter/ElemHideException.h" | 31 #include "../filter/ElemHideException.h" |
| 32 #include "../filter/ElemHideEmulationFilter.h" | 32 #include "../filter/ElemHideEmulationFilter.h" |
| 33 #include "../subscription/Subscription.h" | 33 #include "../subscription/Subscription.h" |
| 34 #include "../subscription/DownloadableSubscription.h" | 34 #include "../subscription/DownloadableSubscription.h" |
| 35 #include "../subscription/UserDefinedSubscription.h" | 35 #include "../subscription/UserDefinedSubscription.h" |
| 36 #include "../storage/FilterStorage.h" | 36 #include "../storage/FilterStorage.h" |
| 37 #include "../ElemHide.h" | 37 #include "../ElemHide.h" |
| 38 #include "../ElemHideEmulation.h" | 38 #include "../ElemHideEmulation.h" |
| 39 #include "../FilterNotifier.h" | 39 #include "../FilterNotifier.h" |
| 40 |
| 41 ABP_NS_USING |
| 40 | 42 |
| 41 int main() | 43 int main() |
| 42 { | 44 { |
| 43 try | 45 try |
| 44 { | 46 { |
| 45 class_<Filter>("Filter") | 47 class_<Filter>("Filter") |
| 46 .property("text", &Filter::GetText) | 48 .property("text", &Filter::GetText) |
| 47 .function("serialize", &Filter::Serialize) | 49 .function("serialize", &Filter::Serialize) |
| 48 .class_function("fromText", &Filter::FromText) | 50 .class_function("fromText", &Filter::FromText) |
| 49 .subclass_differentiator(&Filter::mType, { | 51 .subclass_differentiator(&Filter::mType, { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi
on, &DownloadableSubscription::SetRequiredVersion) | 136 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi
on, &DownloadableSubscription::SetRequiredVersion) |
| 135 .property("downloadCount", &DownloadableSubscription::GetDownloadCount,
&DownloadableSubscription::SetDownloadCount) | 137 .property("downloadCount", &DownloadableSubscription::GetDownloadCount,
&DownloadableSubscription::SetDownloadCount) |
| 136 .class_function("parseDownload", &DownloadableSubscription::ParseDownloa
d) | 138 .class_function("parseDownload", &DownloadableSubscription::ParseDownloa
d) |
| 137 .function("serialize", &DownloadableSubscription::Serialize); | 139 .function("serialize", &DownloadableSubscription::Serialize); |
| 138 | 140 |
| 139 class_<DownloadableSubscription_Parser>("DownloadableSubscription_Parser") | 141 class_<DownloadableSubscription_Parser>("DownloadableSubscription_Parser") |
| 140 .property("redirect", &DownloadableSubscription_Parser::GetRedirect) | 142 .property("redirect", &DownloadableSubscription_Parser::GetRedirect) |
| 141 .property("homepage", &DownloadableSubscription_Parser::GetHomepage) | 143 .property("homepage", &DownloadableSubscription_Parser::GetHomepage) |
| 142 .property("error", &DownloadableSubscription_Parser::GetError) | 144 .property("error", &DownloadableSubscription_Parser::GetError) |
| 143 .function("process", &DownloadableSubscription_Parser::Process) | 145 .function("process", &DownloadableSubscription_Parser::Process) |
| 144 .function("verifyChecksum", &DownloadableSubscription_Parser::VerifyChec
ksum) | |
| 145 .function("finalize", &DownloadableSubscription_Parser::Finalize); | 146 .function("finalize", &DownloadableSubscription_Parser::Finalize); |
| 146 | 147 |
| 147 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) | 148 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) |
| 148 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) | 149 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) |
| 149 .function("subscriptionAt", &FilterStorage::SubscriptionAt) | 150 .function("subscriptionAt", &FilterStorage::SubscriptionAt) |
| 150 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) | 151 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) |
| 151 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor
Filter) | 152 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor
Filter) |
| 152 .function("addSubscription", &FilterStorage::AddSubscription) | 153 .function("addSubscription", &FilterStorage::AddSubscription) |
| 153 .function("removeSubscription", &FilterStorage::RemoveSubscription) | 154 .function("removeSubscription", &FilterStorage::RemoveSubscription) |
| 154 .function("moveSubscription", &FilterStorage::MoveSubscription) | 155 .function("moveSubscription", &FilterStorage::MoveSubscription) |
| 155 .function("clearSubscriptionFilters", &FilterStorage::ClearSubscriptionF
ilters); | 156 .function("clearSubscriptionFilters", &FilterStorage::ClearSubscriptionF
ilters); |
| 156 | 157 |
| 157 class_<ElemHide_SelectorList>("ElemHide_SelectorList") | 158 class_<ElemHide_SelectorList>("ElemHide_SelectorList") |
| 158 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) | 159 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) |
| 159 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) | 160 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) |
| 160 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); | 161 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); |
| 161 | 162 |
| 162 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) | 163 class_<ElemHide>("ElemHide") |
| 164 .class_function("create", &ElemHide::Create) |
| 163 .function("add", &ElemHide::Add) | 165 .function("add", &ElemHide::Add) |
| 164 .function("remove", &ElemHide::Remove) | 166 .function("remove", &ElemHide::Remove) |
| 165 .function("clear", &ElemHide::Clear) | 167 .function("clear", &ElemHide::Clear) |
| 166 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) | 168 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) |
| 167 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect
ors); | 169 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect
ors); |
| 168 | 170 |
| 169 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList") | 171 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList") |
| 170 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) | 172 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) |
| 171 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); | 173 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); |
| 172 | 174 |
| 173 singleton<ElemHideEmulation>("ElemHideEmulation", &ElemHideEmulation::GetIns
tance) | 175 class_<ElemHideEmulation>("ElemHideEmulation") |
| 176 .class_function("create", &ElemHideEmulation::Create) |
| 174 .function("add", &ElemHideEmulation::Add) | 177 .function("add", &ElemHideEmulation::Add) |
| 175 .function("remove", &ElemHideEmulation::Remove) | 178 .function("remove", &ElemHideEmulation::Remove) |
| 176 .function("clear", &ElemHideEmulation::Clear) | 179 .function("clear", &ElemHideEmulation::Clear) |
| 177 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); | 180 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); |
| 178 | 181 |
| 179 printBindings(); | 182 printBindings(); |
| 180 RegExpFilter::GenerateCustomBindings(); | 183 RegExpFilter::GenerateCustomBindings(); |
| 181 FilterNotifier::GenerateCustomBindings(); | 184 FilterNotifier::GenerateCustomBindings::Generate(); |
| 182 | 185 |
| 183 return 0; | 186 return 0; |
| 184 } | 187 } |
| 185 catch (const std::exception& e) | 188 catch (const std::exception& e) |
| 186 { | 189 { |
| 187 EM_ASM_ARGS( | 190 EM_ASM_ARGS( |
| 188 console.error("Error occurred generating JavaScript bindings: " + | 191 console.error("Error occurred generating JavaScript bindings: " + |
| 189 Module.AsciiToString($0)), e.what() | 192 Module.AsciiToString($0)), e.what() |
| 190 ); | 193 ); |
| 191 return 1; | 194 return 1; |
| 192 } | 195 } |
| 193 } | 196 } |
| LEFT | RIGHT |