summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp')
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index d7f3f0a0f..25a6d9233 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -838,7 +838,7 @@ static string lastFileURLPathComponent(const string& path)
ASSERT(string::npos != pos);
string tmpPath = path.substr(pos + 7);
- if (tmpPath.empty())
+ if (tmpPath.length() < 2) // Keep the lone slash to avoid empty output.
return tmpPath;
// Remove the trailing delimiter
@@ -863,7 +863,11 @@ void InjectedBundlePage::willAddMessageToConsole(WKStringRef message, uint32_t l
// FIXME: The code below does not handle additional text after url nor multiple urls. This matches DumpRenderTree implementation.
messageString = messageString.substr(0, fileProtocolStart) + lastFileURLPathComponent(messageString.substr(fileProtocolStart));
- InjectedBundle::shared().os() << "CONSOLE MESSAGE: line " << lineNumber << ": " << messageString << "\n";
+ InjectedBundle::shared().os() << "CONSOLE MESSAGE: ";
+ if (lineNumber)
+ InjectedBundle::shared().os() << "line " << lineNumber << ": ";
+ InjectedBundle::shared().os() << messageString << "\n";
+
}
void InjectedBundlePage::willSetStatusbarText(WKStringRef statusbarText)