| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 .property("dataRevision", &DownloadableSubscription::GetDataRevision, &D
ownloadableSubscription::SetDataRevision) | 135 .property("dataRevision", &DownloadableSubscription::GetDataRevision, &D
ownloadableSubscription::SetDataRevision) |
| 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 .function("process", &DownloadableSubscription_Parser::Process) | 144 .function("process", &DownloadableSubscription_Parser::Process) |
| 143 .function("verifyChecksum", &DownloadableSubscription_Parser::VerifyChec
ksum) | |
| 144 .function("finalize", &DownloadableSubscription_Parser::Finalize); | 145 .function("finalize", &DownloadableSubscription_Parser::Finalize); |
| 145 | 146 |
| 146 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) | 147 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) |
| 147 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) | 148 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) |
| 148 .function("subscriptionAt", &FilterStorage::SubscriptionAt) | 149 .function("subscriptionAt", &FilterStorage::SubscriptionAt) |
| 149 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) | 150 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) |
| 150 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor
Filter) | 151 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor
Filter) |
| 151 .function("addSubscription", &FilterStorage::AddSubscription) | 152 .function("addSubscription", &FilterStorage::AddSubscription) |
| 152 .function("removeSubscription", &FilterStorage::RemoveSubscription) | 153 .function("removeSubscription", &FilterStorage::RemoveSubscription) |
| 153 .function("moveSubscription", &FilterStorage::MoveSubscription) | 154 .function("moveSubscription", &FilterStorage::MoveSubscription) |
| 154 .function("clearSubscriptionFilters", &FilterStorage::ClearSubscriptionF
ilters); | 155 .function("clearSubscriptionFilters", &FilterStorage::ClearSubscriptionF
ilters); |
| 155 | 156 |
| 156 class_<ElemHide_SelectorList>("ElemHide_SelectorList") | 157 class_<ElemHide_SelectorList>("ElemHide_SelectorList") |
| 157 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) | 158 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) |
| 158 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) | 159 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) |
| 159 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); | 160 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); |
| 160 | 161 |
| 161 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) | 162 class_<ElemHide>("ElemHide") |
| 163 .class_function("create", &ElemHide::Create) |
| 162 .function("add", &ElemHide::Add) | 164 .function("add", &ElemHide::Add) |
| 163 .function("remove", &ElemHide::Remove) | 165 .function("remove", &ElemHide::Remove) |
| 164 .function("clear", &ElemHide::Clear) | 166 .function("clear", &ElemHide::Clear) |
| 165 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) | 167 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) |
| 166 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect
ors); | 168 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect
ors); |
| 167 | 169 |
| 168 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList") | 170 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList") |
| 169 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) | 171 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) |
| 170 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); | 172 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); |
| 171 | 173 |
| 172 singleton<ElemHideEmulation>("ElemHideEmulation", &ElemHideEmulation::GetIns
tance) | 174 class_<ElemHideEmulation>("ElemHideEmulation") |
| 175 .class_function("create", &ElemHideEmulation::Create) |
| 173 .function("add", &ElemHideEmulation::Add) | 176 .function("add", &ElemHideEmulation::Add) |
| 174 .function("remove", &ElemHideEmulation::Remove) | 177 .function("remove", &ElemHideEmulation::Remove) |
| 175 .function("clear", &ElemHideEmulation::Clear) | 178 .function("clear", &ElemHideEmulation::Clear) |
| 176 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); | 179 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); |
| 177 | 180 |
| 178 printBindings(); | 181 printBindings(); |
| 179 RegExpFilter::GenerateCustomBindings(); | 182 RegExpFilter::GenerateCustomBindings(); |
| 180 FilterNotifier::GenerateCustomBindings(); | 183 FilterNotifier::GenerateCustomBindings::Generate(); |
| 181 | 184 |
| 182 return 0; | 185 return 0; |
| 183 } | 186 } |
| 184 catch (const std::exception& e) | 187 catch (const std::exception& e) |
| 185 { | 188 { |
| 186 EM_ASM_ARGS( | 189 EM_ASM_ARGS( |
| 187 console.error("Error occurred generating JavaScript bindings: " + | 190 console.error("Error occurred generating JavaScript bindings: " + |
| 188 Module.AsciiToString($0)), e.what() | 191 Module.AsciiToString($0)), e.what() |
| 189 ); | 192 ); |
| 190 return 1; | 193 return 1; |
| 191 } | 194 } |
| 192 } | 195 } |
| LEFT | RIGHT |