Left: | ||
Right: |
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 } data; | 108 } data; |
109 bool needConversion = false; | 109 bool needConversion = false; |
110 DependentString error; | 110 DependentString error; |
111 | 111 |
112 Filter::Type type = CommentFilter::Parse(text); | 112 Filter::Type type = CommentFilter::Parse(text); |
113 if (type == Filter::Type::UNKNOWN) | 113 if (type == Filter::Type::UNKNOWN) |
114 type = ElemHideBase::Parse(text, data.elemhide, needConversion); | 114 type = ElemHideBase::Parse(text, data.elemhide, needConversion); |
115 if (type == Filter::Type::UNKNOWN) | 115 if (type == Filter::Type::UNKNOWN) |
116 type = RegExpFilter::Parse(text, error, data.regexp); | 116 type = RegExpFilter::Parse(text, error, data.regexp); |
117 | 117 |
118 if (needConversion && (type == ElemHideException::classType || type == ElemHid eEmulationFilter::classType)) | 118 if (needConversion) |
sergei
2018/02/12 12:53:20
Firstly I thought about moving of `(type == ElemHi
hub
2018/02/12 18:14:40
I was being overly paranoid.
Done.
| |
119 text = ElemHideBase::ConvertFilter(text, data.elemhide.mSelectorStart); | 119 text = ElemHideBase::ConvertFilter(text, data.elemhide.mSelectorStart); |
120 | 120 |
121 // At that point we failed the conversion. | 121 // At that point we failed the conversion. |
122 if (text.empty()) | 122 if (text.empty()) |
123 return nullptr; | 123 return nullptr; |
124 | 124 |
125 auto knownFilter = knownFilters.find(text); | 125 auto knownFilter = knownFilters.find(text); |
126 if (knownFilter) | 126 if (knownFilter) |
127 { | 127 { |
128 knownFilter->second->AddRef(); | 128 knownFilter->second->AddRef(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 knownFilters[filter->mText] = filter.get(); | 165 knownFilters[filter->mText] = filter.get(); |
166 else | 166 else |
167 // This is a hack: we looked up the entry using text but create it using | 167 // This is a hack: we looked up the entry using text but create it using |
168 // filter->mText. This works because both are equal at this point. However, | 168 // filter->mText. This works because both are equal at this point. However, |
169 // text refers to a temporary buffer which will go away. | 169 // text refers to a temporary buffer which will go away. |
170 knownFilter.assign(filter->mText, filter.get()); | 170 knownFilter.assign(filter->mText, filter.get()); |
171 exit_context(); | 171 exit_context(); |
172 | 172 |
173 return filter.release(); | 173 return filter.release(); |
174 } | 174 } |
LEFT | RIGHT |