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

Side by Side Diff: src/plugin/PluginFilter.cpp

Issue 12325013: Fix ATL assertion error in traverser (Closed)
Patch Set: Created Oct. 4, 2013, 8:45 a.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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginFilter.h" 3 #include "PluginFilter.h"
4 4
5 #if (defined PRODUCT_ADBLOCKPLUS) 5 #if (defined PRODUCT_ADBLOCKPLUS)
6 #include "PluginSettings.h" 6 #include "PluginSettings.h"
7 #include "PluginClient.h" 7 #include "PluginClient.h"
8 #include "PluginClientFactory.h" 8 #include "PluginClientFactory.h"
9 #endif 9 #endif
10 10
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 { 380 {
381 CComPtr<IHTMLElement> pDomPredecessor; 381 CComPtr<IHTMLElement> pDomPredecessor;
382 HRESULT hr = S_FALSE; 382 HRESULT hr = S_FALSE;
383 switch (m_predecessor->m_type) 383 switch (m_predecessor->m_type)
384 { 384 {
385 case ETraverserComplexType::TRAVERSER_TYPE_PARENT: 385 case ETraverserComplexType::TRAVERSER_TYPE_PARENT:
386 hr = pEl->get_parentElement(&pDomPredecessor); 386 hr = pEl->get_parentElement(&pDomPredecessor);
387 break; 387 break;
388 case ETraverserComplexType::TRAVERSER_TYPE_IMMEDIATE: 388 case ETraverserComplexType::TRAVERSER_TYPE_IMMEDIATE:
389 hr = S_FALSE; 389 hr = S_FALSE;
390 CComQIPtr<IHTMLDOMNode> pDomNode = pEl; 390 CComQIPtr<IHTMLDOMNode> pPrevSiblingNode = pEl;
391 if (pDomNode) 391 if (pPrevSiblingNode)
392 { 392 {
393 CComPtr<IHTMLDOMNode> pPrevSiblingNode = pDomNode;
394 long type; 393 long type;
395 do 394 do
396 { 395 {
397 pPrevSiblingNode->get_previousSibling(&pPrevSiblingNode); 396 IHTMLDOMNode* tmpNode;
397 pPrevSiblingNode->get_previousSibling(&tmpNode);
398 pPrevSiblingNode.Attach(tmpNode);
Wladimir Palant 2013/10/08 10:30:38 For reference: this is the only place that needed
398 if (pPrevSiblingNode) 399 if (pPrevSiblingNode)
399 { 400 {
400 hr = pPrevSiblingNode->get_nodeType(&type); 401 hr = pPrevSiblingNode->get_nodeType(&type);
401 if (hr != S_OK) 402 if (hr != S_OK)
402 pPrevSiblingNode = NULL; 403 pPrevSiblingNode.Release();
403 } 404 }
404 } while (pPrevSiblingNode && type != 1); 405 } while (pPrevSiblingNode && type != 1);
405 406
406 if (pPrevSiblingNode) 407 if (pPrevSiblingNode)
407 hr = pPrevSiblingNode.QueryInterface(&pDomPredecessor); 408 hr = pPrevSiblingNode.QueryInterface(&pDomPredecessor);
408 else 409 else
409 return false; 410 return false;
410 } 411 }
Wladimir Palant 2013/10/08 10:30:38 I think that the logic here is still unnecessarily
Felix Dahlke 2013/10/10 08:52:45 Yes, that'd be better.
411 break; 412 break;
412 } 413 }
413 if (hr != S_OK) 414 if (hr != S_OK)
414 return false; 415 return false;
415 return m_predecessor->IsMatchFilterElementHide(pDomPredecessor); 416 return m_predecessor->IsMatchFilterElementHide(pDomPredecessor);
416 } 417 }
417 418
418 return true; 419 return true;
419 } 420 }
420 421
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 if (pos > 0 && domain.GetLength() + pos == subdomain.GetLength()) 867 if (pos > 0 && domain.GetLength() + pos == subdomain.GetLength())
867 { 868 {
868 if (subdomain.GetAt(pos - 1) == '.') 869 if (subdomain.GetAt(pos - 1) == '.')
869 { 870 {
870 return true; 871 return true;
871 } 872 }
872 } 873 }
873 874
874 return false; 875 return false;
875 } 876 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld