summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/KURLGoogle.cpp
diff options
context:
space:
mode:
authorFeng Qian <fqian@google.com>2009-06-17 12:12:20 -0700
committerFeng Qian <fqian@google.com>2009-06-17 12:12:20 -0700
commit5f1ab04193ad0130ca8204aadaceae083aca9881 (patch)
tree5a92cd389e2cfe7fb67197ce14b38469462379f8 /WebCore/platform/KURLGoogle.cpp
parent194315e5a908cc8ed67d597010544803eef1ac59 (diff)
downloadexternal_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.zip
external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.gz
external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.bz2
Get WebKit r44544.
Diffstat (limited to 'WebCore/platform/KURLGoogle.cpp')
-rw-r--r--WebCore/platform/KURLGoogle.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/WebCore/platform/KURLGoogle.cpp b/WebCore/platform/KURLGoogle.cpp
index c2e8272..d8b87e5 100644
--- a/WebCore/platform/KURLGoogle.cpp
+++ b/WebCore/platform/KURLGoogle.cpp
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2004, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -235,6 +236,7 @@ void KURLGooglePrivate::init(const KURL& base, const UChar* rel, int relLength,
charsetConverter,
&output, &m_parsed);
+
if (m_isValid || output.length()) {
if (m_parsed.ref.is_nonempty())
setUtf8(CString(output.data(), output.length()));
@@ -521,6 +523,12 @@ bool KURL::hasRef() const
return m_url.m_parsed.ref.len >= 0;
}
+String KURL::baseAsString() const
+{
+ // FIXME: There is probably a more efficient way to do this?
+ return string().left(pathAfterLastSlash());
+}
+
String KURL::query() const
{
if (m_url.m_parsed.query.len >= 0)
@@ -685,6 +693,11 @@ String KURL::prettyURL() const
return m_url.string();
}
+bool protocolIsJavaScript(const String& url)
+{
+ return protocolIs(url, "javascript");
+}
+
// We copied the KURL version here on Sept 12, 2008 while doing a WebKit
// merge.
//
@@ -800,6 +813,11 @@ String decodeURLEscapeSequences(const String& str, const TextEncoding& encoding)
bool KURL::protocolIs(const char* protocol) const
{
assertProtocolIsGood(protocol);
+
+ // JavaScript URLs are "valid" and should be executed even if KURL decides they are invalid.
+ // The free function protocolIsJavaScript() should be used instead.
+ // FIXME: Chromium code needs to be fixed for this assert to be enabled. ASSERT(strcmp(protocol, "javascript"));
+
if (m_url.m_parsed.scheme.len <= 0)
return !protocol;
return lowerCaseEqualsASCII(