String UniqueIDBDatabase::filenameForDatabaseName() const { ASSERT(!m_identifier.databaseName().isNull()); if (m_identifier.databaseName().isEmpty()) return "%00"; String filename = encodeForFileName(m_identifier.databaseName()); filename.replace('.', "%2E"); return filename; }
String SecurityOrigin::databaseIdentifier() const { // Historically, we've used the following (somewhat non-sensical) string // for the databaseIdentifier of local files. We used to compute this // string because of a bug in how we handled the scheme for file URLs. // Now that we've fixed that bug, we still need to produce this string // to avoid breaking existing persistent state. if (m_needsDatabaseIdentifierQuirkForFiles) return "file__0"; String separatorString(&SeparatorCharacter, 1); if (m_encodedHost.isEmpty()) m_encodedHost = encodeForFileName(m_host); return m_protocol + separatorString + m_encodedHost + separatorString + String::number(m_port); }
String SecurityOrigin::databaseIdentifier() const { // Historically, we've used the following (somewhat non-sensical) string // for the databaseIdentifier of local files. We used to compute this // string because of a bug in how we handled the scheme for file URLs. // Now that we've fixed that bug, we still need to produce this string // to avoid breaking existing persistent state. if (m_needsDatabaseIdentifierQuirkForFiles) return "file__0"; StringBuilder stringBuilder; stringBuilder.append(m_protocol); stringBuilder.append(separatorCharacter); stringBuilder.append(encodeForFileName(m_host)); stringBuilder.append(separatorCharacter); stringBuilder.appendNumber(m_port); return stringBuilder.toString(); }
String IDBFactoryBackendImpl::databaseFileName(const String& name, SecurityOrigin* securityOrigin) { String databaseIdentifier = securityOrigin->databaseIdentifier(); String santizedName = encodeForFileName(name); return databaseIdentifier + "@" + santizedName + ".indexeddb"; }