#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h"
#include "base/memory/scoped_refptr.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom-shared.h"
#include "third_party/blink/public/platform/web_blob_info.h"
#include "third_party/blink/public/platform/web_data.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialization_tag.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_object_builder.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/fileapi/file.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/testing/file_backed_blob_factory_test_helper.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_any.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_key.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_key_path.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_value.h"
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h"
#include "third_party/blink/renderer/platform/testing/task_environment.h"
#include "third_party/blink/renderer/platform/wtf/text/string_view.h"
namespace blink {
namespace {
v8::Local<v8::Object> EvaluateScriptAsObject(V8TestingScope& scope,
const char* source) { … }
std::unique_ptr<IDBKey> ScriptToKey(V8TestingScope& scope, const char* source) { … }
std::unique_ptr<IDBKey> CheckKeyFromValueAndKeyPathInternal(
v8::Isolate* isolate,
const ScriptValue& value,
const String& key_path) { … }
void CheckKeyPathNullValue(v8::Isolate* isolate,
const ScriptValue& value,
const String& key_path) { … }
bool InjectKey(ScriptState* script_state,
IDBKey* key,
ScriptValue& value,
const String& key_path) { … }
void CheckInjection(ScriptState* script_state,
IDBKey* key,
ScriptValue& value,
const String& key_path) { … }
void CheckInjectionIgnored(ScriptState* script_state,
IDBKey* key,
ScriptValue& value,
const String& key_path) { … }
void CheckInjectionDisallowed(ScriptState* script_state,
ScriptValue& value,
const String& key_path) { … }
void CheckKeyPathStringValue(v8::Isolate* isolate,
const ScriptValue& value,
const String& key_path,
const String& expected) { … }
void CheckKeyPathNumberValue(v8::Isolate* isolate,
const ScriptValue& value,
const String& key_path,
int expected) { … }
void CheckArrayKey(const IDBKey* key, const IDBKey::KeyArray& expected) { … }
constexpr static size_t kSSVHeaderBlinkVersionTagOffset = …;
constexpr static size_t kSSVHeaderBlinkVersionOffset = …;
constexpr static size_t kSSVHeaderV8VersionTagOffset = …;
void SerializeV8Value(v8::Local<v8::Value> value,
v8::Isolate* isolate,
Vector<char>* wire_bytes) { … }
std::unique_ptr<IDBValue> CreateIDBValue(v8::Isolate* isolate,
Vector<char>&& wire_bytes,
double primary_key,
const String& key_path) { … }
TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) { … }
}
TEST(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyNumberValue) { … }
TEST(IDBKeyFromValueAndKeyPathTest, FileLastModifiedDateUseCounterTest) { … }
TEST(IDBKeyFromValueAndKeyPathTest, SubProperty) { … }
TEST(IDBKeyFromValue, Number) { … }
TEST(IDBKeyFromValue, Date) { … }
TEST(IDBKeyFromValue, String) { … }
TEST(IDBKeyFromValue, Binary) { … }
TEST(IDBKeyFromValue, InvalidSimpleKeyTypes) { … }
TEST(IDBKeyFromValue, SimpleArrays) { … }
TEST(IDBKeyFromValue, NestedArray) { … }
TEST(IDBKeyFromValue, CircularArray) { … }
TEST(IDBKeyFromValue, DeepArray) { … }
TEST(IDBKeyFromValue, SparseArray) { … }
TEST(IDBKeyFromValue, ShrinkingArray) { … }
TEST(IDBKeyFromValue, Exceptions) { … }
TEST(IDBKeyFromValueAndKeyPathTest, Exceptions) { … }
TEST(IDBKeyFromValueAndKeyPathsTest, IndexKeys) { … }
TEST(InjectIDBKeyTest, ImplicitValues) { … }
TEST(InjectIDBKeyTest, TopLevelPropertyStringValue) { … }
TEST(InjectIDBKeyTest, SubProperty) { … }
TEST(DeserializeIDBValueTest, CurrentVersions) { … }
TEST(DeserializeIDBValueTest, FutureV8Version) { … }
TEST(DeserializeIDBValueTest, InjectionIntoNonObject) { … }
TEST(DeserializeIDBValueTest, NestedInjectionIntoNonObject) { … }
}