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

Delta Between Two Patch Sets: src/engine/Main.cpp

Issue 5447868882092032: Issue 1793 - check whether the frame is whitelisted before injecting CSS (Closed)
Left Patch Set: rebase Created Oct. 27, 2015, 11 a.m.
Right Patch Set: rebase and rename webBrowser to parentBrowser Created Nov. 30, 2015, 3:27 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/plugin/AdblockPlusClient.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 }; 105 };
106 106
107 std::string GetWhitelistingFilter(const std::string& urlArg, 107 std::string GetWhitelistingFilter(const std::string& urlArg,
108 const std::vector<std::string>& frameHierarchy, AdblockPlus::FilterEngine::C ontentType type) 108 const std::vector<std::string>& frameHierarchy, AdblockPlus::FilterEngine::C ontentType type)
109 { 109 {
110 if (frameHierarchy.empty()) 110 if (frameHierarchy.empty())
111 { 111 {
112 return GetWhitelistingFilter(urlArg, "", type); 112 return GetWhitelistingFilter(urlArg, "", type);
113 } 113 }
114 auto frameIterator = frameHierarchy.begin(); 114 auto frameIterator = frameHierarchy.begin();
115 std::string parentUrl;
116 std::string url = urlArg; 115 std::string url = urlArg;
117 while (frameIterator != frameHierarchy.end()) 116 do
118 { 117 {
119 parentUrl = *frameIterator; 118 std::string parentUrl = *frameIterator++;
120 auto filterText = GetWhitelistingFilter(url, parentUrl, type); 119 auto filterText = GetWhitelistingFilter(url, parentUrl, type);
121 if (!filterText.empty()) 120 if (!filterText.empty())
122 { 121 {
123 return filterText; 122 return filterText;
124 } 123 }
125 url = parentUrl; 124 url = parentUrl;
126 ++frameIterator; 125 }
127 } 126 while (frameIterator != frameHierarchy.end());
128 return ""; 127 return "";
129 } 128 }
130 129
131 void WriteSubscriptions(Communication::OutputBuffer& response, 130 void WriteSubscriptions(Communication::OutputBuffer& response,
132 const std::vector<AdblockPlus::SubscriptionPtr>& subscriptions) 131 const std::vector<AdblockPlus::SubscriptionPtr>& subscriptions)
133 { 132 {
134 int32_t count = static_cast<int32_t>(subscriptions.size()); 133 int32_t count = static_cast<int32_t>(subscriptions.size());
135 response << count; 134 response << count;
136 for (int32_t i = 0; i < count; i++) 135 for (int32_t i = 0; i < count; i++)
137 { 136 {
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 }); 756 });
758 757
759 int retValue = _AtlModule.WinMain(cmdShow); 758 int retValue = _AtlModule.WinMain(cmdShow);
760 if (communicationThread.joinable()) 759 if (communicationThread.joinable())
761 { 760 {
762 communicationThread.join(); 761 communicationThread.join();
763 } 762 }
764 763
765 return retValue; 764 return retValue;
766 } 765 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld