Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: compiled/filter/Filter.cpp

Issue 29595633: Issue 5870 - Implement the new ElemHideEmulation filter type (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebased Created Dec. 5, 2017, 6:04 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/filter/ElemHideBase.cpp ('k') | test/elemHideEmulation.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 case ElemHideEmulationFilter::classType: 143 case ElemHideEmulationFilter::classType:
144 filter = FilterPtr(new ElemHideEmulationFilter(text, data.elemhide), false ); 144 filter = FilterPtr(new ElemHideEmulationFilter(text, data.elemhide), false );
145 if (static_cast<ElemHideEmulationFilter*>(filter.get())->IsGeneric()) 145 if (static_cast<ElemHideEmulationFilter*>(filter.get())->IsGeneric())
146 filter = FilterPtr(new InvalidFilter(text, u"filter_elemhideemulation_no domain"_str), false); 146 filter = FilterPtr(new InvalidFilter(text, u"filter_elemhideemulation_no domain"_str), false);
147 break; 147 break;
148 default: 148 default:
149 // This should never happen but just in case 149 // This should never happen but just in case
150 return nullptr; 150 return nullptr;
151 } 151 }
152 152
153 // This is a hack: we looked up the entry using text but create it using
154 // filter->mText. This works because both are equal at this point. However,
155 // text refers to a temporary buffer which will go away.
156 enter_context("Adding to known filters"); 153 enter_context("Adding to known filters");
157 knownFilter.assign(filter->mText, filter.get()); 154 if (text != filter->mText)
155 knownFilters[filter->mText] = filter.get();
156 else
157 // This is a hack: we looked up the entry using text but create it using
158 // filter->mText. This works because both are equal at this point. However,
159 // text refers to a temporary buffer which will go away.
160 knownFilter.assign(filter->mText, filter.get());
158 exit_context(); 161 exit_context();
159 162
160 return filter.release(); 163 return filter.release();
161 } 164 }
OLDNEW
« no previous file with comments | « compiled/filter/ElemHideBase.cpp ('k') | test/elemHideEmulation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld