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

Issue 6433575100481536: Issue 1148 - ABP on chrome blocks ads but IE doesnt (Closed)

Created:
Nov. 10, 2014, 12:26 p.m. by sergei
Modified:
Nov. 27, 2014, 2:57 p.m.
Reviewers:
Felix Dahlke, Oleksandr
CC:
Eric
Visibility:
Public.

Description

- IHTMLElement::getAttribute is inconvenient to use (see below) but since Windows XP all versions support IHTMLDOMAttribute and IHTMLElement4. IHTMLElement::getAttribute sometimes returns not only BSTR or integer but also null variant or IDispatch which is different from the value written in the html file. For the cases like <some-tag on-some-event="do();"/> IE returns the value of 'on-some-event' attribute as 'function(event){\ndo();\n}'. Our filters are not designed for such transformations, so we need to retrive the value of (body) of /^.*?\{(body)\}$/. Using IHTMLDOMAttribute and IHTMLElement4 solves the troubles and simplifies the code. - fix predecessor processing. We should call `tagName.ToLower();` after the tag name retrieved. The bug (typo) was we called it before which makes no sense.

Patch Set 1 #

Patch Set 2 : fix IE8 and simplify the code #

Total comments: 13

Patch Set 3 : merge GetAttributeValueAsString into the caller #

Patch Set 4 : fix according to comments #

Patch Set 5 : fix according to the discussion #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+55 lines, -23 lines) Patch
M src/plugin/PluginFilter.cpp View 1 2 3 4 8 chunks +55 lines, -22 lines 6 comments Download
M src/plugin/PluginUtil.h View 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 10
sergei
Nov. 10, 2014, 12:29 p.m. (2014-11-10 12:29:22 UTC) #1
Oleksandr
http://codereview.adblockplus.org/6433575100481536/diff/5741031244955648/src/plugin/PluginFilter.cpp File src/plugin/PluginFilter.cpp (right): http://codereview.adblockplus.org/6433575100481536/diff/5741031244955648/src/plugin/PluginFilter.cpp#newcode23 src/plugin/PluginFilter.cpp:23: std::wstring GetAttributeValueAsString(const ATL::CComVariant& vAttr) Is it really required for ...
Nov. 19, 2014, 3:24 a.m. (2014-11-19 03:24:23 UTC) #2
sergei
http://codereview.adblockplus.org/6433575100481536/diff/5741031244955648/src/plugin/PluginFilter.cpp File src/plugin/PluginFilter.cpp (right): http://codereview.adblockplus.org/6433575100481536/diff/5741031244955648/src/plugin/PluginFilter.cpp#newcode23 src/plugin/PluginFilter.cpp:23: std::wstring GetAttributeValueAsString(const ATL::CComVariant& vAttr) On 2014/11/19 03:24:23, Oleksandr wrote: ...
Nov. 19, 2014, 11:53 a.m. (2014-11-19 11:53:24 UTC) #3
Oleksandr
Let me know if we should ask for a third opinion. We can ask Eric ...
Nov. 20, 2014, 10:21 a.m. (2014-11-20 10:21:55 UTC) #4
sergei
http://codereview.adblockplus.org/6433575100481536/diff/5741031244955648/src/plugin/PluginFilter.cpp File src/plugin/PluginFilter.cpp (right): http://codereview.adblockplus.org/6433575100481536/diff/5741031244955648/src/plugin/PluginFilter.cpp#newcode36 src/plugin/PluginFilter.cpp:36: std::pair<std::wstring, bool> GetHtmlElementAttribute(IHTMLElement& htmlElement, const ATL::CComBSTR& attributeName) On 2014/11/20 ...
Nov. 21, 2014, 12:02 p.m. (2014-11-21 12:02:21 UTC) #5
Felix Dahlke
http://codereview.adblockplus.org/6433575100481536/diff/5741031244955648/src/plugin/PluginFilter.cpp File src/plugin/PluginFilter.cpp (right): http://codereview.adblockplus.org/6433575100481536/diff/5741031244955648/src/plugin/PluginFilter.cpp#newcode36 src/plugin/PluginFilter.cpp:36: std::pair<std::wstring, bool> GetHtmlElementAttribute(IHTMLElement& htmlElement, const ATL::CComBSTR& attributeName) On 2014/11/21 ...
Nov. 26, 2014, 2:23 p.m. (2014-11-26 14:23:16 UTC) #6
Oleksandr
LGTM
Nov. 27, 2014, 1:54 p.m. (2014-11-27 13:54:54 UTC) #7
Felix Dahlke
Looks good all in all. I think the whitespace changes (I particularly like the ones ...
Nov. 27, 2014, 1:58 p.m. (2014-11-27 13:58:46 UTC) #8
sergei
http://codereview.adblockplus.org/6433575100481536/diff/5754903989321728/src/plugin/PluginFilter.cpp File src/plugin/PluginFilter.cpp (right): http://codereview.adblockplus.org/6433575100481536/diff/5754903989321728/src/plugin/PluginFilter.cpp#newcode23 src/plugin/PluginFilter.cpp:23: struct GetHtmlElementAttributeResult On 2014/11/27 13:58:46, Felix H. Dahlke wrote: ...
Nov. 27, 2014, 2:47 p.m. (2014-11-27 14:47:25 UTC) #9
Felix Dahlke
Nov. 27, 2014, 2:57 p.m. (2014-11-27 14:57:26 UTC) #10
http://codereview.adblockplus.org/6433575100481536/diff/5754903989321728/src/...
File src/plugin/PluginFilter.cpp (right):

http://codereview.adblockplus.org/6433575100481536/diff/5754903989321728/src/...
src/plugin/PluginFilter.cpp:23: struct GetHtmlElementAttributeResult
On 2014/11/27 14:47:25, sergei wrote:
> On 2014/11/27 13:58:46, Felix H. Dahlke wrote:
> > How about "HtmlAttributeMatch" or something in that spirit?
> 
> I also don't feel it to be a good name, but I find "HtmlAttributeMatch" even
> more confusing.

Fair enough, yeah. Let's go with GetHtmlElementAttributeResult then.

http://codereview.adblockplus.org/6433575100481536/diff/5754903989321728/src/...
src/plugin/PluginFilter.cpp:332: ATL::CString value;
On 2014/11/27 14:47:25, sergei wrote:
> On 2014/11/27 13:58:46, Felix H. Dahlke wrote:
> > This change seems unrelated, hm? Plus we're still using CString (without
> ATL::)
> > elsewhere in this file.
> 
> Yes, it's not important here, just was irritating the eye. I would not say
that
> we don't use it in this file elsewhere is an argument. We should tend to use
> ATL:: for the same reason that we don't have `using namespace std` in any
> header.

Yes I agree. It's just that we should avoid unrelated changes, particularly with
bug fixes. A commit should make one logical change. That way we can trace down
regressions and back commits out much easier.

Powered by Google App Engine
This is Rietveld