Index: src/engine/Main.cpp |
=================================================================== |
--- a/src/engine/Main.cpp |
+++ b/src/engine/Main.cpp |
@@ -1,20 +1,20 @@ |
-/* |
- * This file is part of Adblock Plus <https://adblockplus.org/>, |
- * Copyright (C) 2006-2015 Eyeo GmbH |
- * |
- * Adblock Plus is free software: you can redistribute it and/or modify |
- * it under the terms of the GNU General Public License version 3 as |
- * published by the Free Software Foundation. |
- * |
- * Adblock Plus is distributed in the hope that it will be useful, |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- * GNU General Public License for more details. |
- * |
- * You should have received a copy of the GNU General Public License |
- * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
- */ |
- |
+/* |
+ * This file is part of Adblock Plus <https://adblockplus.org/>, |
+ * Copyright (C) 2006-2015 Eyeo GmbH |
+ * |
+ * Adblock Plus is free software: you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License version 3 as |
+ * published by the Free Software Foundation. |
+ * |
+ * Adblock Plus is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
+ */ |
+ |
#include <AdblockPlus.h> |
#include <functional> |
#include <vector> |
@@ -28,6 +28,7 @@ |
#include "../shared/Version.h" |
#include "../shared/CriticalSection.h" |
#include "../shared/IE_version.h" |
+#include "../shared/ContentType.h" |
#include "AdblockPlus.h" |
#include "Debug.h" |
#include "Updater.h" |
@@ -106,11 +107,16 @@ |
case Communication::PROC_MATCHES: |
{ |
std::string url; |
- std::string type; |
+ using namespace AdblockPlus; |
+ FilterEngine::ContentType contentType; |
std::string documentUrl; |
- request >> url >> type >> documentUrl; |
- referrerMapping.Add(url, documentUrl); |
- AdblockPlus::FilterPtr filter = filterEngine->Matches(url, type, referrerMapping.BuildReferrerChain(documentUrl)); |
+ request >> url >> contentType >> documentUrl; |
+ auto isFrame = contentType == FilterEngine::ContentType::CONTENT_TYPE_SUBDOCUMENT ? |
+ ReferrerMapping::FrameIndicator::FRAME_INDICATOR_FRAME: |
+ ReferrerMapping::FrameIndicator::FRAME_INDICATOR_NOT_FRAME; |
+ |
+ referrerMapping.Add(url, documentUrl, isFrame); |
+ AdblockPlus::FilterPtr filter = filterEngine->Matches(url, contentType, referrerMapping.BuildFrameStructure(documentUrl)); |
response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EXCEPTION); |
break; |
} |
@@ -210,7 +216,8 @@ |
{ |
std::string url; |
request >> url; |
- AdblockPlus::FilterPtr match = filterEngine->Matches(url, "DOCUMENT", url); |
+ AdblockPlus::FilterPtr match = filterEngine->Matches(url, |
+ AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_DOCUMENT, url); |
response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION); |
break; |
} |
@@ -218,7 +225,8 @@ |
{ |
std::string url; |
request >> url; |
- AdblockPlus::FilterPtr match = filterEngine->Matches(url, "ELEMHIDE", url); |
+ AdblockPlus::FilterPtr match = filterEngine->Matches(url, |
+ AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_ELEMHIDE, url); |
response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION); |
break; |
} |