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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 bool needConversion = false; | 109 bool needConversion = false; |
110 ParsedDomains parsedDomains; | 110 ParsedDomains parsedDomains; |
111 DependentString error; | 111 DependentString error; |
112 | 112 |
113 Filter::Type type = CommentFilter::Parse(text); | 113 Filter::Type type = CommentFilter::Parse(text); |
114 if (type == Filter::Type::UNKNOWN) | 114 if (type == Filter::Type::UNKNOWN) |
115 type = ElemHideBase::Parse(text, error, data.elemhide, needConversion, parse
dDomains); | 115 type = ElemHideBase::Parse(text, error, data.elemhide, needConversion, parse
dDomains); |
116 if (type == Filter::Type::UNKNOWN) | 116 if (type == Filter::Type::UNKNOWN) |
117 type = RegExpFilter::Parse(text, error, data.regexp); | 117 type = RegExpFilter::Parse(text, error, data.regexp); |
118 | 118 |
119 if (needConversion && (type == ElemHideException::classType || type == ElemHid
eEmulationFilter::classType)) | 119 if (needConversion) |
120 text = ElemHideBase::ConvertFilter(text, data.elemhide.mSelectorStart); | 120 text = ElemHideBase::ConvertFilter(text, data.elemhide.mSelectorStart); |
121 | 121 |
122 // At that point we failed the conversion. | 122 // At that point we failed the conversion. |
123 if (text.empty()) | 123 if (text.empty()) |
124 return nullptr; | 124 return nullptr; |
125 | 125 |
126 auto knownFilter = knownFilters.find(text); | 126 auto knownFilter = knownFilters.find(text); |
127 if (knownFilter) | 127 if (knownFilter) |
128 { | 128 { |
129 knownFilter->second->AddRef(); | 129 knownFilter->second->AddRef(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 knownFilters[filter->mText] = filter.get(); | 167 knownFilters[filter->mText] = filter.get(); |
168 else | 168 else |
169 // This is a hack: we looked up the entry using text but create it using | 169 // This is a hack: we looked up the entry using text but create it using |
170 // filter->mText. This works because both are equal at this point. However, | 170 // filter->mText. This works because both are equal at this point. However, |
171 // text refers to a temporary buffer which will go away. | 171 // text refers to a temporary buffer which will go away. |
172 knownFilter.assign(filter->mText, filter.get()); | 172 knownFilter.assign(filter->mText, filter.get()); |
173 exit_context(); | 173 exit_context(); |
174 | 174 |
175 return filter.release(); | 175 return filter.release(); |
176 } | 176 } |
LEFT | RIGHT |