diff options
author | dglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 15:56:22 +0000 |
---|---|---|
committer | dglazkov@chromium.org <dglazkov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-28 15:56:22 +0000 |
commit | 8e4463443df9a9c7f737edb16a47253ca64844ea (patch) | |
tree | 4f546abc321517485aec0617914aacc74eedfba5 /webkit/glue | |
parent | 6b4b5eb6ffb9f983a2dba4312e3e6eb60563ea7e (diff) | |
download | chromium_src-8e4463443df9a9c7f737edb16a47253ca64844ea.zip chromium_src-8e4463443df9a9c7f737edb16a47253ca64844ea.tar.gz chromium_src-8e4463443df9a9c7f737edb16a47253ca64844ea.tar.bz2 |
Make dumpBackForwardList() print file and data URL results that match upstream.
R=darin
TEST=LayoutTests/fast/loader/*
BUG=8407
Review URL: http://codereview.chromium.org/243011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27363 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webkit_glue.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index a8575f0..92e62a3 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -35,6 +35,7 @@ #include "base/string_util.h" #include "base/sys_info.h" #include "base/sys_string_conversions.h" +#include "net/base/escape.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/api/public/WebHistoryItem.h" @@ -56,6 +57,19 @@ using WebKit::WebHistoryItem; using WebKit::WebString; using WebKit::WebVector; +namespace { + +static const char kLayoutTestsPattern[] = "/LayoutTests/"; +static const std::string::size_type kLayoutTestsPatternSize = + arraysize(kLayoutTestsPattern) - 1; +static const char kFileUrlPattern[] = "file:/"; +static const char kDataUrlPattern[] = "data:"; +static const std::string::size_type kDataUrlPatternSize = + arraysize(kDataUrlPattern) - 1; +static const char kFileTestPrefix[] = "(file test):"; + +} + //------------------------------------------------------------------------------ // webkit_glue impl: @@ -170,7 +184,19 @@ static std::wstring DumpHistoryItem(const WebHistoryItem& item, result.append(indent, L' '); } - result.append(UTF16ToWideHack(item.urlString())); + std::string url = item.urlString().utf8(); + size_t pos; + if (url.find(kFileUrlPattern) == 0 && + ((pos = url.find(kLayoutTestsPattern)) != std::string::npos)) { + // adjust file URLs to match upstream results. + url.replace(0, pos + kLayoutTestsPatternSize, kFileTestPrefix); + } else if (url.find(kDataUrlPattern) == 0) { + // URL-escape data URLs to match results upstream. + std::string path = EscapePath(url.substr(kDataUrlPatternSize)); + url.replace(kDataUrlPatternSize, url.length(), path); + } + + result.append(UTF8ToWide(url)); if (!item.target().isEmpty()) result.append(L" (in frame \"" + UTF16ToWide(item.target()) + L"\")"); if (item.isTargetItem()) |