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

Unified Diff: src/plugin/PluginTabBase.cpp

Issue 29351560: Issue 4395 - Setting page is loaded non-populated on some systems
Patch Set: Use 0 instead of NULL Created Sept. 7, 2016, 9:11 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « adblockplus.gyp ('k') | src/shared/Utils.h » ('j') | src/shared/Utils.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginTabBase.cpp
===================================================================
--- a/src/plugin/PluginTabBase.cpp
+++ b/src/plugin/PluginTabBase.cpp
@@ -157,9 +157,12 @@
// Declared static because the value is derived from an installation directory, which won't change during run-time.
static auto dir = FileUrl(HtmlFolderPath());
+ dir = EscapeUrl(CanonicalizeUrl(dir));
Eric 2016/09/07 16:50:52 There's no need to treat 'dir' as arising from a U
Oleksandr 2016/09/08 02:51:15 The thinking here is that Since dir arrives from a
+ std::wstring urlCanonicalized = EscapeUrl(CanonicalizeUrl(url));
Eric 2016/09/07 16:50:52 As a point of English usage, `urlCanonical` (with
Oleksandr 2016/09/08 02:51:15 Done.
+
DEBUG_GENERAL([&]() -> std::wstring {
std::wstring log = L"InjectABP. Current URL: ";
- log += url;
+ log += urlCanonicalized;
Eric 2016/09/07 16:50:52 It would be better here to use the argument `url`
Oleksandr 2016/09/08 02:51:15 During debugging I actually find it more convenien
log += L", template directory URL: ";
log += dir;
return log;
@@ -168,14 +171,15 @@
/*
* The length check here is defensive, in case the document URL is truncated for some reason.
*/
- if (url.length() < 5)
+ if (urlCanonicalized.length() < 5)
{
// We can't match ".html" at the end of the URL if it's too short.
return false;
}
- auto urlCstr = url.c_str();
+ auto urlCstr = urlCanonicalized.c_str();
// Check the prefix to match our directory
// Check the suffix to be an HTML file
+ // Compare escaped version and return
return (_wcsnicmp(urlCstr, dir.c_str(), dir.length()) == 0) &&
(_wcsnicmp(urlCstr + url.length() - 5, L".html", 5) == 0);
}
« no previous file with comments | « adblockplus.gyp ('k') | src/shared/Utils.h » ('j') | src/shared/Utils.cpp » ('J')

Powered by Google App Engine
This is Rietveld