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

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

Issue 29330709: Issue #3343 - Eliminate unescaping of URL (Closed)
Patch Set: Reverted unrelated defect introduction Created Nov. 25, 2015, 4:17 p.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 | « src/plugin/AdblockPlusDomTraverser.cpp ('k') | src/plugin/PluginDomTraverserBase.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 std::wstring CPluginClass::GetBrowserUrl() const 181 std::wstring CPluginClass::GetBrowserUrl() const
182 { 182 {
183 std::wstring url; 183 std::wstring url;
184 CComQIPtr<IWebBrowser2> browser = GetBrowser(); 184 CComQIPtr<IWebBrowser2> browser = GetBrowser();
185 if (browser) 185 if (browser)
186 { 186 {
187 CComBSTR bstrURL; 187 CComBSTR bstrURL;
188 if (SUCCEEDED(browser->get_LocationURL(&bstrURL)) && bstrURL) 188 if (SUCCEEDED(browser->get_LocationURL(&bstrURL)) && bstrURL)
189 { 189 {
190 url = std::wstring(bstrURL, SysStringLen(bstrURL)); 190 url = std::wstring(bstrURL, SysStringLen(bstrURL));
191 UnescapeUrl(url);
192 } 191 }
193 } 192 }
194 else 193 else
195 { 194 {
196 url = m_tab->GetDocumentUrl(); 195 url = m_tab->GetDocumentUrl();
197 } 196 }
198 return url; 197 return url;
199 } 198 }
200 199
201 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) 200 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr)
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 ATL::CComQIPtr<IWebBrowser2> webBrowser = frameBrowserDisp; 476 ATL::CComQIPtr<IWebBrowser2> webBrowser = frameBrowserDisp;
478 if (!webBrowser) 477 if (!webBrowser)
479 { 478 {
480 return; 479 return;
481 } 480 }
482 if (!urlVariant || urlVariant->vt != VT_BSTR) 481 if (!urlVariant || urlVariant->vt != VT_BSTR)
483 { 482 {
484 return; 483 return;
485 } 484 }
486 std::wstring url(urlVariant->bstrVal, SysStringLen(urlVariant->bstrVal)); 485 std::wstring url(urlVariant->bstrVal, SysStringLen(urlVariant->bstrVal));
487 UnescapeUrl(url);
488 486
489 // If webbrowser2 is equal to top level browser (as set in SetSite), we are 487 // If webbrowser2 is equal to top level browser (as set in SetSite), we are
490 // navigating new page 488 // navigating new page
491 CPluginClient* client = CPluginClient::GetInstance(); 489 CPluginClient* client = CPluginClient::GetInstance();
492 if (url.find(L"javascript") == 0) 490 if (url.find(L"javascript") == 0)
493 { 491 {
494 } 492 }
495 else if (GetBrowser().IsEqualObject(webBrowser)) 493 else if (GetBrowser().IsEqualObject(webBrowser))
496 { 494 {
497 m_tab->OnNavigate(url); 495 m_tab->OnNavigate(url);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 { 536 {
539 try 537 try
540 { 538 {
541 DEBUG_NAVI(L"Navi::Document Complete"); 539 DEBUG_NAVI(L"Navi::Document Complete");
542 ATL::CComQIPtr<IWebBrowser2> webBrowser2 = frameBrowserDisp; 540 ATL::CComQIPtr<IWebBrowser2> webBrowser2 = frameBrowserDisp;
543 if (!webBrowser2) 541 if (!webBrowser2)
544 { 542 {
545 return; 543 return;
546 } 544 }
547 std::wstring frameSrc = GetLocationUrl(*webBrowser2); 545 std::wstring frameSrc = GetLocationUrl(*webBrowser2);
548 UnescapeUrl(frameSrc);
549 bool isRootPageBrowser = GetBrowser().IsEqualObject(webBrowser2); 546 bool isRootPageBrowser = GetBrowser().IsEqualObject(webBrowser2);
550 m_tab->OnDocumentComplete(webBrowser2, frameSrc, isRootPageBrowser); 547 m_tab->OnDocumentComplete(webBrowser2, frameSrc, isRootPageBrowser);
551 } 548 }
552 catch (...) 549 catch (...)
553 { 550 {
554 } 551 }
555 } 552 }
556 553
557 // Entry point 554 // Entry point
558 void STDMETHODCALLTYPE CPluginClass::OnWindowStateChanged(unsigned long flags, u nsigned long validFlagsMask) 555 void STDMETHODCALLTYPE CPluginClass::OnWindowStateChanged(unsigned long flags, u nsigned long validFlagsMask)
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 s_criticalSectionLocal.Unlock(); 1729 s_criticalSectionLocal.Unlock();
1733 1730
1734 } 1731 }
1735 } 1732 }
1736 } 1733 }
1737 1734
1738 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1735 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1739 } 1736 }
1740 return hTabWnd; 1737 return hTabWnd;
1741 } 1738 }
OLDNEW
« no previous file with comments | « src/plugin/AdblockPlusDomTraverser.cpp ('k') | src/plugin/PluginDomTraverserBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld