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

Delta Between Two Patch Sets: src/plugin/PluginTabBase.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 | « src/plugin/AdblockPlusClient.cpp ('k') | no next file » | 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 namespace 207 namespace
208 { 208 {
209 ATL::CComPtr<IWebBrowser2> GetParent(IWebBrowser2& browser) 209 ATL::CComPtr<IWebBrowser2> GetParent(IWebBrowser2& browser)
210 { 210 {
211 ATL::CComPtr<IDispatch> parentDispatch; 211 ATL::CComPtr<IDispatch> parentDispatch;
212 if (FAILED(browser.get_Parent(&parentDispatch)) || !parentDispatch) 212 if (FAILED(browser.get_Parent(&parentDispatch)) || !parentDispatch)
213 { 213 {
214 return nullptr; 214 return nullptr;
215 } 215 }
216 // The InternetExplorer application always returns a pointer to itself. 216 // The InternetExplorer application always returns a pointer to itself.
Oleksandr 2015/10/28 10:12:12 Nit: I'd include a link here: https://msdn.microso
sergei 2015/10/28 10:33:28 Done.
217 // https://msdn.microsoft.com/en-us/library/aa752136(v=vs.85).aspx
217 if (parentDispatch.IsEqualObject(&browser)) 218 if (parentDispatch.IsEqualObject(&browser))
218 { 219 {
219 return nullptr; 220 return nullptr;
220 } 221 }
221 ATL::CComQIPtr<IServiceProvider> parentDocumentServiceProvider = parentDispa tch; 222 ATL::CComQIPtr<IServiceProvider> parentDocumentServiceProvider = parentDispa tch;
222 if (!parentDocumentServiceProvider) 223 if (!parentDocumentServiceProvider)
223 { 224 {
224 return nullptr; 225 return nullptr;
225 } 226 }
226 ATL::CComPtr<IWebBrowserApp> webBrowserApp; 227 ATL::CComPtr<IWebBrowser2> parentBrowser;
227 if (FAILED(parentDocumentServiceProvider->QueryService(IID_IWebBrowserApp, & webBrowserApp)) || !webBrowserApp) 228 if (FAILED(parentDocumentServiceProvider->QueryService(SID_SWebBrowserApp, & parentBrowser)))
228 { 229 {
229 return nullptr; 230 return nullptr;
230 } 231 }
231 return ATL::CComQIPtr<IWebBrowser2>(webBrowserApp); 232 return parentBrowser;
232 } 233 }
233 234
234 bool IsFrameWhiteListed(ATL::CComPtr<IWebBrowser2> frame) 235 bool IsFrameWhiteListed(ATL::CComPtr<IWebBrowser2> frame)
235 { 236 {
236 if (!frame) 237 if (!frame)
237 { 238 {
238 return false; 239 return false;
239 } 240 }
240 auto url = GetLocationUrl(*frame); 241 auto url = GetLocationUrl(*frame);
241 std::vector<std::string> frameHierarchy; 242 std::vector<std::string> frameHierarchy;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p luginError.GetProcessId(), pluginError.GetThreadId()); 432 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p luginError.GetProcessId(), pluginError.GetThreadId());
432 } 433 }
433 434
434 // Non-hanging sleep 435 // Non-hanging sleep
435 Sleep(50); 436 Sleep(50);
436 } 437 }
437 438
438 tabLoopIteration++; 439 tabLoopIteration++;
439 } 440 }
440 } 441 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld