Index: Source/platform/weborigin/SecurityOrigin.cpp |
diff --git a/Source/platform/weborigin/SecurityOrigin.cpp b/Source/platform/weborigin/SecurityOrigin.cpp |
index 95fbf48842cdf409d9294cdd2ff453f9ec2d382e..bacb7ba42f1a30cb2c22368b50baa2e81c1beca5 100644 |
--- a/Source/platform/weborigin/SecurityOrigin.cpp |
+++ b/Source/platform/weborigin/SecurityOrigin.cpp |
@@ -418,23 +418,46 @@ String SecurityOrigin::toString() const |
return toRawString(); |
} |
+AtomicString SecurityOrigin::toAtomicString() const |
+{ |
+ if (isUnique()) |
+ return AtomicString("null", AtomicString::ConstructFromLiteral); |
+ if (m_protocol == "file" && m_enforceFilePathSeparation) |
+ return AtomicString("null", AtomicString::ConstructFromLiteral); |
+ return toRawAtomicString(); |
+} |
+ |
String SecurityOrigin::toRawString() const |
{ |
if (m_protocol == "file") |
return "file://"; |
StringBuilder result; |
- result.reserveCapacity(m_protocol.length() + m_host.length() + 10); |
- result.append(m_protocol); |
- result.append("://"); |
- result.append(m_host); |
+ buildRawString(result); |
+ return result.toString(); |
+} |
+ |
+AtomicString SecurityOrigin::toRawAtomicString() const |
+{ |
+ if (m_protocol == "file") |
+ return AtomicString("file://", AtomicString::ConstructFromLiteral); |
+ |
+ StringBuilder result; |
+ buildRawString(result); |
+ return result.toAtomicString(); |
+} |
+ |
+inline void SecurityOrigin::buildRawString(StringBuilder& builder) const |
+{ |
+ builder.reserveCapacity(m_protocol.length() + m_host.length() + 10); |
+ builder.append(m_protocol); |
+ builder.appendLiteral("://"); |
+ builder.append(m_host); |
if (m_port) { |
- result.append(':'); |
- result.appendNumber(m_port); |
+ builder.append(':'); |
+ builder.appendNumber(m_port); |
} |
- |
- return result.toString(); |
} |
PassRefPtr<SecurityOrigin> SecurityOrigin::createFromString(const String& originString) |