| OLD | NEW | 
|---|
| 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-2015 Eyeo GmbH | 3  * Copyright (C) 2006-2015 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 | 
| 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12  * GNU General Public License for more details. | 12  * GNU General Public License for more details. | 
| 13  * | 13  * | 
| 14  * You should have received a copy of the GNU General Public License | 14  * You should have received a copy of the GNU General Public License | 
| 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 16  */ | 16  */ | 
| 17 | 17 | 
| 18 #include "PluginStdAfx.h" | 18 #include "PluginStdAfx.h" | 
| 19 #include "AdblockPlusClient.h" | 19 #include "AdblockPlusClient.h" | 
| 20 #include "PluginFilter.h" | 20 #include "PluginFilter.h" | 
| 21 #include "PluginSettings.h" | 21 #include "PluginSettings.h" | 
| 22 #include "PluginMutex.h" | 22 #include "PluginMutex.h" | 
| 23 #include "PluginSettings.h" | 23 #include "PluginSettings.h" | 
| 24 #include "PluginSystem.h" | 24 #include "PluginSystem.h" | 
| 25 #include "PluginClass.h" | 25 #include "PluginClass.h" | 
| 26 #include "mlang.h" | 26 #include "mlang.h" | 
| 27 #include "..\shared\CriticalSection.h" | 27 #include "..\shared\CriticalSection.h" | 
| 28 #include "..\shared\Utils.h" | 28 #include "..\shared\Utils.h" | 
|  | 29 #include "..\shared\MsHTMLUtils.h" | 
| 29 | 30 | 
| 30 // The filters are described at http://adblockplus.org/en/filters | 31 // The filters are described at http://adblockplus.org/en/filters | 
| 31 | 32 | 
| 32 static CriticalSection s_criticalSectionFilterMap; | 33 static CriticalSection s_criticalSectionFilterMap; | 
| 33 | 34 | 
| 34 namespace |  | 
| 35 { |  | 
| 36   struct GetHtmlElementAttributeResult |  | 
| 37   { |  | 
| 38     GetHtmlElementAttributeResult() : isAttributeFound(false) |  | 
| 39     { |  | 
| 40     } |  | 
| 41     std::wstring attributeValue; |  | 
| 42     bool isAttributeFound; |  | 
| 43   }; |  | 
| 44 |  | 
| 45   GetHtmlElementAttributeResult GetHtmlElementAttribute(IHTMLElement& htmlElemen
     t, |  | 
| 46     const ATL::CComBSTR& attributeName) |  | 
| 47   { |  | 
| 48     GetHtmlElementAttributeResult retValue; |  | 
| 49     ATL::CComVariant vAttr; |  | 
| 50     ATL::CComPtr<IHTMLElement4> htmlElement4; |  | 
| 51     if (FAILED(htmlElement.QueryInterface(&htmlElement4)) || !htmlElement4) |  | 
| 52     { |  | 
| 53       return retValue; |  | 
| 54     } |  | 
| 55     ATL::CComPtr<IHTMLDOMAttribute> attributeNode; |  | 
| 56     if (FAILED(htmlElement4->getAttributeNode(attributeName, &attributeNode)) ||
      !attributeNode) |  | 
| 57     { |  | 
| 58       return retValue; |  | 
| 59     } |  | 
| 60     // we set that attribute found but it's not necessary that we can retrieve i
     ts value |  | 
| 61     retValue.isAttributeFound = true; |  | 
| 62     if (FAILED(attributeNode->get_nodeValue(&vAttr))) |  | 
| 63     { |  | 
| 64       return retValue; |  | 
| 65     } |  | 
| 66     if (vAttr.vt == VT_BSTR && vAttr.bstrVal) |  | 
| 67     { |  | 
| 68       retValue.attributeValue = vAttr.bstrVal; |  | 
| 69     } |  | 
| 70     else if (vAttr.vt == VT_I4) |  | 
| 71     { |  | 
| 72       retValue.attributeValue = std::to_wstring(vAttr.iVal); |  | 
| 73     } |  | 
| 74     return retValue; |  | 
| 75   } |  | 
| 76 } |  | 
| 77 |  | 
| 78 // ============================================================================ | 35 // ============================================================================ | 
| 79 // CFilterElementHideAttrSelector | 36 // CFilterElementHideAttrSelector | 
| 80 // ============================================================================ | 37 // ============================================================================ | 
| 81 | 38 | 
| 82 CFilterElementHideAttrSelector::CFilterElementHideAttrSelector() : m_type(TYPE_N
     ONE), m_pos(POS_NONE), m_bstrAttr(NULL) | 39 CFilterElementHideAttrSelector::CFilterElementHideAttrSelector() : m_type(TYPE_N
     ONE), m_pos(POS_NONE), m_bstrAttr(NULL) | 
| 83 { | 40 { | 
| 84 } | 41 } | 
| 85 | 42 | 
| 86 CFilterElementHideAttrSelector::CFilterElementHideAttrSelector(const CFilterElem
     entHideAttrSelector& filter) | 43 CFilterElementHideAttrSelector::CFilterElementHideAttrSelector(const CFilterElem
     entHideAttrSelector& filter) | 
| 87 { | 44 { | 
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 719       CPluginDebug::DebugResultBlocking(type, srcTrimmed, domain); | 676       CPluginDebug::DebugResultBlocking(type, srcTrimmed, domain); | 
| 720     } | 677     } | 
| 721     else | 678     else | 
| 722     { | 679     { | 
| 723       CPluginDebug::DebugResultIgnoring(type, srcTrimmed, domain); | 680       CPluginDebug::DebugResultIgnoring(type, srcTrimmed, domain); | 
| 724     } | 681     } | 
| 725   } | 682   } | 
| 726 #endif | 683 #endif | 
| 727   return result; | 684   return result; | 
| 728 } | 685 } | 
| OLD | NEW | 
|---|