• Home
  • Raw
  • Download

Lines Matching +full:traces +full:- +full:db

1 diff --git a/src/BUILD.gn b/src/BUILD.gn
3 --- a/src/BUILD.gn
5 @@ -34,7 +34,7 @@ import("//ui/base/ui_features.gni")
9 -if (is_android) {
14 @@ -104,11 +104,26 @@ group("gn_all") {
34 deps += [ "//third_party/abseil-cpp:absl_tests" ]
37 - if (!is_android && !is_chromecast) {
42 @@ -128,7 +143,7 @@ group("gn_all") {
46 - if (!is_ios && !is_android && !is_chromecast && !is_fuchsia) {
51 @@ -183,7 +198,7 @@ group("gn_all") {
55 - if (!is_ios) {
60 @@ -239,7 +254,7 @@ group("gn_all") {
64 - if (!is_ios && !is_android) {
69 @@ -255,17 +270,19 @@ group("gn_all") {
73 - deps += [
74 - "//google_apis/gcm:mcs_probe",
75 - "//media/cast:cast_unittests",
76 - "//third_party/catapult/telemetry:bitmaptools($host_toolchain)",
77 - ]
78 - if (!is_android) {
79 - deps += [ "//chrome/test:telemetry_perf_unittests" ]
80 - } else {
81 - import("//tools/perf/chrome_telemetry_build/android_browser_types.gni")
82 - foreach(_target_suffix, telemetry_android_browser_target_suffixes) {
83 - deps += [ "//chrome/test:telemetry_perf_unittests${_target_suffix}" ]
100 @@ -537,7 +554,7 @@ group("gn_all") {
104 - if (!is_chromeos_ash && !is_ios && !is_fuchsia) {
109 @@ -556,7 +573,7 @@ group("gn_all") {
113 - if (!is_android) {
118 @@ -606,7 +623,7 @@ group("gn_all") {
122 - if (is_android || (is_linux || is_chromeos_lacros)) {
127 @@ -619,7 +636,7 @@ group("gn_all") {
131 - if (!is_android) {
136 @@ -706,7 +723,7 @@ group("gn_all") {
140 - if (is_mac || is_win || is_android || is_linux || is_chromeos) {
145 @@ -1055,7 +1072,7 @@ if (!is_ios) {
149 - if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android) {
154 @@ -1493,7 +1510,7 @@ if (!is_ios) {
158 - if (!is_ios && !is_android && !is_chromecast && !is_fuchsia) {
163 @@ -1538,7 +1555,7 @@ group("chromium_builder_perf") {
167 -if (!is_ios && !is_android && !is_chromecast && !is_fuchsia) {
172 @@ -1575,7 +1592,7 @@ if (!is_ios && !is_android && !is_chromecast && !is_fuchsia) {
176 -if (is_android) {
180 # These run expensive scripts in non-default toolchains. Generally, host
181 diff --git a/src/DEPS b/src/DEPS
183 --- a/src/DEPS
185 @@ -1592,7 +1592,7 @@ deps = {
189 - Var('chromium_git') + '/chromium/deps/sqlite.git' + '@' + '9ccd3058ec6dcfa5b0ebd2edb3e88c9b978…
194 diff --git a/src/base/BUILD.gn b/src/base/BUILD.gn
196 --- a/src/base/BUILD.gn
198 @@ -72,6 +72,9 @@ declare_args() {
199 # only supported on iOS 64-bit architecture, but some project build //base
200 # for 32-bit architecture.
208 @@ -157,6 +160,21 @@ if (is_fuchsia) {
230 @@ -1318,7 +1336,16 @@ mixed_component("base") {
234 - if (is_linux || is_chromeos) {
248 @@ -1338,6 +1365,11 @@ mixed_component("base") {
253 + sources -= [ "files/scoped_file_linux.cc" ]
260 @@ -1380,6 +1412,15 @@ mixed_component("base") {
276 @@ -1476,7 +1517,7 @@ mixed_component("base") {
280 - if (is_android) {
285 @@ -1510,7 +1551,7 @@ mixed_component("base") {
289 - if (is_android) {
294 @@ -1555,6 +1596,35 @@ mixed_component("base") {
299 + sources -= [
329 sources -= [
330 @@ -2225,7 +2295,7 @@ mixed_component("base") {
334 - if (!is_android) {
336 sources -= [
339 @@ -2512,6 +2582,13 @@ mixed_component("base") {
353 diff --git a/src/base/allocator/BUILD.gn b/src/base/allocator/BUILD.gn
355 --- a/src/base/allocator/BUILD.gn
357 @@ -64,7 +64,7 @@ config("tcmalloc_flags") {
361 - if (is_linux || is_chromeos || is_android) {
364 # Keep "-Wno-*" flags in sync with upstream by comparing against:
365 # http://code.google.com/p/google-perftools/source/browse/trunk/Makefile.am
366 @@ -177,7 +177,7 @@ if (use_allocator == "tcmalloc") {
370 - if (is_android) {
375 @@ -245,7 +245,7 @@ if (use_allocator == "tcmalloc") {
379 - if (is_linux || is_chromeos || is_android) {
381 sources -= [
382 "$tcmalloc_dir/src/system-alloc.h",
384 diff --git a/src/base/allocator/allocator.gni b/src/base/allocator/allocator.gni
386 --- a/src/base/allocator/allocator.gni
388 @@ -18,7 +18,7 @@ _is_using_sanitizers = is_asan || is_hwasan || is_lsan || is_tsan || is_msan
389 # - Windows: debug CRT is not compatible, see below.
392 - is_android || is_win || is_mac || is_linux || is_chromeos || is_fuchsia
397 @@ -26,7 +26,7 @@ _is_partition_alloc_platform =
398 # Under Fuchsia the allocator shim is only required for PA-E.
401 -if ((is_linux || is_chromeos || is_android || is_apple ||
406 @@ -75,7 +75,7 @@ assert(use_allocator == "none" || use_allocator == "partition")
410 - is_fuchsia || is_apple,
415 diff --git a/src/base/allocator/allocator_shim.cc b/src/base/allocator/allocator_shim.cc
417 --- a/src/base/allocator/allocator_shim.cc
419 @@ -341,7 +341,7 @@ ALWAYS_INLINE void ShimAlignedFree(void* address, void* context) {
423 -#if BUILDFLAG(IS_ANDROID)
426 // intercepted on Android is by using link-time -wrap flags.
428 diff --git a/src/base/allocator/allocator_shim_internals.h b/src/base/allocator/allocator_shim_inte…
430 --- a/src/base/allocator/allocator_shim_internals.h
432 @@ -9,7 +9,7 @@
436 -#if BUILDFLAG(IS_POSIX)
441 diff --git a/src/base/allocator/partition_allocator/partition_bucket.cc b/src/base/allocator/partit…
443 --- a/src/base/allocator/partition_allocator/partition_bucket.cc
445 @@ -272,6 +272,9 @@ SlotSpanMetadata<thread_safe>* PartitionDirectMap(
450 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
455 @@ -378,6 +381,9 @@ SlotSpanMetadata<thread_safe>* PartitionDirectMap(
460 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
463 AddressPoolManager::GetInstance()->MarkUnused(pool, reservation_start,
465 @@ -625,6 +631,9 @@ ALWAYS_INLINE uintptr_t PartitionBucket<thread_safe>::AllocNewSuperPage(
470 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
475 @@ -690,6 +699,9 @@ ALWAYS_INLINE uintptr_t PartitionBucket<thread_safe>::AllocNewSuperPage(
476 if (root->IsQuarantineEnabled()) {
480 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
485 diff --git a/src/base/allocator/partition_allocator/partition_page.cc b/src/base/allocator/partitio…
487 --- a/src/base/allocator/partition_allocator/partition_page.cc
489 @@ -79,6 +79,9 @@ ALWAYS_INLINE void PartitionDirectUnmap(
491 ScopedUnlockGuard unlock{root->lock_};
494 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
496 UnmapNow(reservation_start, reservation_size, root->ChoosePool());
499 diff --git a/src/base/allocator/partition_allocator/partition_root.cc b/src/base/allocator/partitio…
501 --- a/src/base/allocator/partition_allocator/partition_root.cc
503 @@ -203,6 +203,9 @@ static size_t PartitionPurgeSlotSpan(
508 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
513 @@ -315,6 +318,9 @@ static size_t PartitionPurgeSlotSpan(
514 PA_DCHECK(num_new_entries == num_slots - slot_span->num_allocated_slots);
518 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
523 @@ -343,6 +349,9 @@ static size_t PartitionPurgeSlotSpan(
528 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
533 diff --git a/src/base/allocator/partition_allocator/partition_root.h b/src/base/allocator/partition…
535 --- a/src/base/allocator/partition_allocator/partition_root.h
537 @@ -1350,6 +1350,9 @@ ALWAYS_INLINE void PartitionRoot<thread_safe>::DecommitSystemPagesForData(
542 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
547 @@ -1361,6 +1364,9 @@ ALWAYS_INLINE void PartitionRoot<thread_safe>::RecommitSystemPagesForData(
552 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
557 @@ -1380,6 +1386,9 @@ ALWAYS_INLINE bool PartitionRoot<thread_safe>::TryRecommitSystemPagesForData(
562 + ALLOW_UNUSED_LOCAL(timer); // Supress compiler warning: unused-variable
567 diff --git a/src/base/allocator/partition_allocator/starscan/state_bitmap.h b/src/base/allocator/pa…
569 --- a/src/base/allocator/partition_allocator/starscan/state_bitmap.h
571 @@ -190,7 +190,7 @@ class StateBitmap final {
575 - inline void IterateImpl(size_t epoch, Callback);
580 @@ -397,7 +397,8 @@ template <typename Filter,
584 - Callback callback) {
590 @@ -423,7 +424,8 @@ StateBitmap<PageSize, PageAlignment, AllocationAlignment>::IterateImpl(
594 - if (Clear) {
600 @@ -442,7 +444,7 @@ StateBitmap<PageSize, PageAlignment, AllocationAlignment>::IterateAllocated(
603 ->IterateImpl<FilterAllocated, SimpleCallbackForwarder, Callback, false>(
604 - 0, std::move(callback));
609 @@ -452,7 +454,7 @@ StateBitmap<PageSize, PageAlignment, AllocationAlignment>::IterateQuarantined(
612 ->IterateImpl<FilterQuarantine, SimpleCallbackForwarder, Callback, false>(
613 - 0, std::move(callback));
618 @@ -463,7 +465,7 @@ StateBitmap<PageSize, PageAlignment, AllocationAlignment>::IterateQuarantined(
621 ->IterateImpl<FilterQuarantine, QuarantineCallbackForwarder, Callback,
622 - false>(epoch, std::move(callback));
627 @@ -472,7 +474,7 @@ inline void StateBitmap<PageSize, PageAlignment, AllocationAlignment>::
630 ->IterateImpl<FilterUnmarkedQuarantine, SimpleCallbackForwarder, Callback,
631 - false>(epoch, std::move(callback));
636 @@ -480,7 +482,7 @@ template <typename Callback>
640 - true>(epoch, std::move(callback));
645 diff --git a/src/base/android/build_info.cc b/src/base/android/build_info.cc
647 --- a/src/base/android/build_info.cc
649 @@ -5,11 +5,12 @@
653 -
663 @@ -36,11 +37,17 @@ int GetIntParam(const std::vector<std::string>& params, int index) {
681 diff --git a/src/base/android/build_info.h b/src/base/android/build_info.h
683 --- a/src/base/android/build_info.h
685 @@ -5,7 +5,9 @@
695 diff --git a/src/base/base_paths.h b/src/base/base_paths.h
697 --- a/src/base/base_paths.h
699 @@ -16,6 +16,8 @@
708 diff --git a/src/base/base_paths_ohos.cc b/src/base/base_paths_ohos.cc
711 --- /dev/null
713 @@ -0,0 +1,84 @@
715 +// Use of this source code is governed by a BSD-style license that can be
737 + auto bundle_path = base::CommandLine::ForCurrentProcess()->
743 + bool for_test = base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kForTest);
798 diff --git a/src/base/base_paths_ohos.h b/src/base/base_paths_ohos.h
801 --- /dev/null
803 @@ -0,0 +1,22 @@
805 +// Use of this source code is governed by a BSD-style license that can be
826 diff --git a/src/base/base_switches.cc b/src/base/base_switches.cc
828 --- a/src/base/base_switches.cc
830 @@ -135,7 +135,7 @@ const char kDisableUsbKeyboardDetect[] = "disable-usb-keyboard-detect";
832 // of lacros-chrome is complete.
834 - !BUILDFLAG(IS_CHROMEOS_LACROS)
838 // work-around this issue (a temporary directory will always be used to create
839 @@ -170,7 +170,7 @@ const char kForceFieldTrialParams[] = "force-fieldtrial-params";
843 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
848 @@ -192,4 +192,9 @@ extern const char kEnableCrashpad[] = "enable-crashpad";
849 const char kSchedulerBoostUrgent[] = "scheduler-boost-urgent";
853 +const char kForTest[] = "for-test";
854 +const char kBundleInstallationDir[] = "bundle-installation-dir";
858 diff --git a/src/base/base_switches.h b/src/base/base_switches.h
860 --- a/src/base/base_switches.h
862 @@ -44,7 +44,7 @@ extern const char kDisableUsbKeyboardDetect[];
864 // of lacros-chrome is complete.
866 - !BUILDFLAG(IS_CHROMEOS_LACROS)
871 @@ -60,7 +60,7 @@ extern const char kEnableIdleTracing[];
875 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
880 @@ -72,6 +72,11 @@ extern const char kEnableCrashpad[];
892 diff --git a/src/base/containers/checked_iterators.h b/src/base/containers/checked_iterators.h
894 --- a/src/base/containers/checked_iterators.h
896 @@ -237,6 +237,17 @@ using CheckedContiguousConstIterator = CheckedContiguousIterator<const T>;
914 diff --git a/src/base/cpu.cc b/src/base/cpu.cc
916 --- a/src/base/cpu.cc
918 @@ -19,7 +19,7 @@
922 - BUILDFLAG(IS_AIX)
927 @@ -32,7 +32,8 @@
931 - (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
937 @@ -152,7 +153,8 @@ uint64_t xgetbv(uint32_t xcr) {
941 - (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
947 @@ -344,7 +346,8 @@ void CPU::Initialize(bool require_branding) {
951 -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
957 @@ -383,7 +386,7 @@ CPU::IntelMicroArchitecture CPU::GetIntelMicroArchitecture() const {
961 - BUILDFLAG(IS_AIX)
966 diff --git a/src/base/cpu.h b/src/base/cpu.h
968 --- a/src/base/cpu.h
970 @@ -108,7 +108,7 @@ class BASE_EXPORT CPU final {
974 - BUILDFLAG(IS_AIX)
979 diff --git a/src/base/debug/debugger_posix.cc b/src/base/debug/debugger_posix.cc
981 --- a/src/base/debug/debugger_posix.cc
983 @@ -144,7 +144,7 @@ void VerifyDebugger() {
987 - BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_AIX)
992 diff --git a/src/base/debug/proc_maps_linux.cc b/src/base/debug/proc_maps_linux.cc
994 --- a/src/base/debug/proc_maps_linux.cc
996 @@ -13,7 +13,8 @@
1000 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
1006 diff --git a/src/base/debug/stack_trace_ohos.cc b/src/base/debug/stack_trace_ohos.cc
1009 --- /dev/null
1011 @@ -0,0 +1,324 @@
1013 +// Use of this source code is governed by a BSD-style license that can be
1061 + if (ip != 0 && !state->have_skipped_self) {
1062 + state->have_skipped_self = true;
1066 + state->frames[state->frame_count++] = ip;
1067 + if (state->frame_count >= state->max_depth)
1075 + s.substr(s.size() - suffix.size(), suffix.size()) == suffix;
1103 + // This does "j = -i" while avoiding integer overflow.
1104 + j = static_cast<uintptr_t>(-(i + 1)) + 1;
1106 + // Make sure we can write the '-' character.
1111 + *start++ = '-';
1129 + padding--;
1138 + // So, now, we reverse the string (except for the possible "-" sign).
1139 + while (--ptr > start) {
1157 + // This should be more than enough to store a 64-bit number in hex:
1158 + // 16 hex digits + 1 for null-terminator.
1160 + handler->HandleOutput("0x");
1163 + handler->HandleOutput(buf);
1167 + // Max unsigned 64-bit number in decimal has 20 digits (18446744073709551615).
1169 + // (including the null-terminator).
1171 + handler->HandleOutput("#");
1173 + handler->HandleOutput(buf);
1177 + // NOTE: This code MUST be async-signal safe (it's used by in-process
1188 + // NOTE: This code MUST be async-signal safe (it's used by in-process
1214 +// NOTE: This code MUST be async-signal safe (it's used by in-process
1219 + handler->HandleOutput(prefix_string);
1222 + handler->HandleOutput(" ");
1224 + handler->HandleOutput(" ");
1230 + void* address = static_cast<char*>(trace[i]) - 1;
1232 + handler->HandleOutput(buf);
1234 + handler->HandleOutput("<unknown>");
1236 + handler->HandleOutput("\n");
1246 + // TODO(phajdan.jr): De-duplicate this SIGPIPE code.
1296 + uintptr_t address = reinterpret_cast<uintptr_t>(trace_[i]) - 1;
1300 + if (address >= iter->start && address < iter->end &&
1301 + !iter->path.empty()) {
1313 + address -= iter->start;
1321 + *os << base::StringPrintf("%s", iter->path.c_str());
1322 + if (EndsWith(iter->path, ".apk")) {
1323 + *os << base::StringPrintf(" (offset 0x%llx)", iter->offset);
1336 diff --git a/src/base/files/file.h b/src/base/files/file.h
1338 --- a/src/base/files/file.h
1340 @@ -19,7 +19,8 @@
1344 - BUILDFLAG(IS_FUCHSIA) || (BUILDFLAG(IS_ANDROID) && __ANDROID_API__ < 21)
1350 diff --git a/src/base/files/file_posix.cc b/src/base/files/file_posix.cc
1352 --- a/src/base/files/file_posix.cc
1354 @@ -20,7 +20,7 @@
1356 #include "third_party/abseil-cpp/absl/types/optional.h"
1358 -#if BUILDFLAG(IS_ANDROID)
1363 @@ -133,14 +133,14 @@ void File::Info::FromStat(const stat_wrapper_t& stat_info) {
1367 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
1375 -#elif BUILDFLAG(IS_ANDROID)
1380 @@ -210,7 +210,7 @@ int64_t File::Seek(Whence whence, int64_t offset) {
1384 -#if BUILDFLAG(IS_ANDROID)
1389 @@ -296,7 +296,7 @@ int File::Write(int64_t offset, const char* data, int size) {
1393 -#if BUILDFLAG(IS_ANDROID)
1398 @@ -553,7 +553,7 @@ bool File::Flush() {
1402 - BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX)
1407 @@ -588,7 +588,8 @@ File::Error File::GetLastFileError() {
1411 - BUILDFLAG(IS_FUCHSIA) || (BUILDFLAG(IS_ANDROID) && __ANDROID_API__ < 21)
1417 diff --git a/src/base/files/file_util.h b/src/base/files/file_util.h
1419 --- a/src/base/files/file_util.h
1421 @@ -282,7 +282,8 @@ BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path, int mode);
1425 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
1431 @@ -612,7 +613,8 @@ BASE_EXPORT bool VerifyPathControlledByAdmin(const base::FilePath& path);
1432 // the directory |path|, in the number of FilePath::CharType, or -1 on failure.
1435 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
1441 diff --git a/src/base/files/file_util_posix.cc b/src/base/files/file_util_posix.cc
1443 --- a/src/base/files/file_util_posix.cc
1445 @@ -576,7 +576,7 @@ bool GetTempDir(FilePath* path) {
1449 -#if BUILDFLAG(IS_ANDROID)
1454 @@ -1275,7 +1275,8 @@ bool CopyFileContentsWithSendfile(File& infile,
1458 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
1464 diff --git a/src/base/files/scoped_file.h b/src/base/files/scoped_file.h
1466 --- a/src/base/files/scoped_file.h
1468 @@ -26,7 +26,7 @@ struct BASE_EXPORT ScopedFDCloseTraits : public ScopedGenericOwnershipTracking {
1472 -#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
1477 @@ -37,7 +37,7 @@ struct BASE_EXPORT ScopedFDCloseTraits {
1478 return -1;
1481 -#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
1486 @@ -54,7 +54,7 @@ struct ScopedFILECloser {
1490 -#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
1495 @@ -104,7 +104,7 @@ typedef ScopedGeneric<int, internal::ScopedFDCloseTraits> ScopedFD;
1499 -#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
1504 diff --git a/src/base/linux_util.cc b/src/base/linux_util.cc
1506 --- a/src/base/linux_util.cc
1508 @@ -19,6 +19,7 @@
1516 @@ -99,6 +100,8 @@ char g_linux_distro[kDistroSize] =
1525 diff --git a/src/base/logging.cc b/src/base/logging.cc
1527 --- a/src/base/logging.cc
1529 @@ -79,6 +79,10 @@ typedef HANDLE FileHandle;
1540 @@ -590,6 +594,22 @@ LogMessage::LogMessage(const char* file, int line, const char* condition)
1563 @@ -814,6 +834,25 @@ LogMessage::~LogMessage() {
1589 diff --git a/src/base/memory/discardable_shared_memory.cc b/src/base/memory/discardable_shared_memo…
1591 --- a/src/base/memory/discardable_shared_memory.cc
1593 @@ -401,7 +401,8 @@ bool DiscardableSharedMemory::Purge(Time current_time) {
1597 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
1603 @@ -467,7 +468,8 @@ void DiscardableSharedMemory::ReleaseMemoryIfPossible(size_t offset,
1607 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
1613 diff --git a/src/base/memory/discardable_shared_memory.h b/src/base/memory/discardable_shared_memor…
1615 --- a/src/base/memory/discardable_shared_memory.h
1617 @@ -26,7 +26,8 @@
1620 // platforms but doesn't provide the zero-fill-on-demand pages guarantee.
1621 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
1627 diff --git a/src/base/memory/platform_shared_memory_region.h b/src/base/memory/platform_shared_memo…
1629 --- a/src/base/memory/platform_shared_memory_region.h
1631 @@ -23,7 +23,7 @@
1635 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
1640 @@ -116,7 +116,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
1644 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
1649 @@ -263,7 +263,7 @@ class BASE_EXPORT PlatformSharedMemoryRegion {
1653 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
1658 diff --git a/src/base/memory/platform_shared_memory_region_posix.cc b/src/base/memory/platform_shar…
1660 --- a/src/base/memory/platform_shared_memory_region_posix.cc
1662 @@ -70,7 +70,7 @@ FDPair ScopedFDPair::get() const {
1666 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
1671 @@ -204,7 +204,7 @@ bool PlatformSharedMemoryRegion::MapAtInternal(off_t offset,
1675 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
1680 @@ -233,7 +233,7 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode,
1684 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
1689 diff --git a/src/base/message_loop/message_pump_for_ui.h b/src/base/message_loop/message_pump_for_u…
1691 --- a/src/base/message_loop/message_pump_for_ui.h
1693 @@ -14,6 +14,8 @@
1702 @@ -31,7 +33,7 @@ namespace base {
1704 // Windows defines it as-is.
1706 -#elif BUILDFLAG(IS_ANDROID)
1708 // Android defines it as-is.
1711 diff --git a/src/base/message_loop/message_pump_ohos.cc b/src/base/message_loop/message_pump_ohos.cc
1714 --- /dev/null
1716 @@ -0,0 +1,311 @@
1766 + non_delayed_fd_ = -1;
1767 + delayed_fd_ = -1;
1777 + message_pump_->OnNonDelayedLooperCallback();
1779 + message_pump_->OnDelayedLooperCallback();
1823 + CHECK_NE(non_delayed_fd_, -1);
1831 + CHECK_NE(delayed_fd_, -1);
1835 + ohos_event_handler_->AddFileDescriptorListener(
1838 + ohos_event_handler_->AddFileDescriptorListener(
1844 + ohos_event_handler_->RemoveFileDescriptorListener(non_delayed_fd_);
1845 + ohos_event_handler_->RemoveFileDescriptorListener(delayed_fd_);
1867 + Delegate::NextWorkInfo next_work_info = delegate_->DoWork();
1905 + next_work_info = delegate_->DoWork();
1935 + if (delegate_->DoIdleWork()) {
1951 + if (!run_loop_->BeforeRun()) {
1970 + run_loop_->AfterRun();
2014 + run_loop_->QuitWhenIdle();
2028 diff --git a/src/base/message_loop/message_pump_ohos.h b/src/base/message_loop/message_pump_ohos.h
2031 --- /dev/null
2033 @@ -0,0 +1,91 @@
2045 +#include "third_party/abseil-cpp/absl/types/optional.h"
2112 + // The file descriptor used to signal that non-delayed work is available.
2125 diff --git a/src/base/numerics/safe_conversions_impl.h b/src/base/numerics/safe_conversions_impl.h
2127 --- a/src/base/numerics/safe_conversions_impl.h
2129 @@ -10,6 +10,8 @@
2138 @@ -87,7 +89,11 @@ constexpr typename std::make_unsigned<T>::type SafeUnsignedAbs(T value) {
2150 diff --git a/src/base/path_service.cc b/src/base/path_service.cc
2152 --- a/src/base/path_service.cc
2154 @@ -32,6 +32,8 @@ bool PathProviderWin(int key, FilePath* result);
2163 @@ -98,6 +100,18 @@ Provider base_provider_android = {
2182 @@ -106,7 +120,8 @@ Provider base_provider_fuchsia = {PathProviderFuchsia, &base_provider,
2186 -#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
2192 @@ -133,6 +148,8 @@ struct PathData {
2201 diff --git a/src/base/process/kill.h b/src/base/process/kill.h
2203 --- a/src/base/process/kill.h
2205 @@ -112,7 +112,7 @@ BASE_EXPORT TerminationStatus GetTerminationStatus(ProcessHandle handle,
2209 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
2214 diff --git a/src/base/process/kill_posix.cc b/src/base/process/kill_posix.cc
2216 --- a/src/base/process/kill_posix.cc
2218 @@ -159,7 +159,7 @@ void EnsureProcessTerminated(Process process) {
2222 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
2227 diff --git a/src/base/process/launch.h b/src/base/process/launch.h
2229 --- a/src/base/process/launch.h
2231 @@ -195,7 +195,7 @@ struct BASE_EXPORT LaunchOptions {
2235 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
2237 // If non-zero, start the process using clone(), using flags as provided.
2240 @@ -420,7 +420,7 @@ BASE_EXPORT void RaiseProcessToHighPriority();
2244 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
2246 // A wrapper for clone with fork-like behavior, meaning that it returns the
2249 diff --git a/src/base/process/launch_posix.cc b/src/base/process/launch_posix.cc
2251 --- a/src/base/process/launch_posix.cc
2253 @@ -86,7 +86,7 @@ void SetEnvironment(char** env) {
2257 -#if BUILDFLAG(IS_ANDROID)
2259 // POSIX says pthread_sigmask() must be used in multi-threaded processes,
2262 @@ -196,7 +196,8 @@ struct ScopedDIRClose {
2266 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
2272 @@ -307,7 +308,8 @@ Process LaunchProcess(const std::vector<std::string>& argv,
2276 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
2282 @@ -670,7 +672,8 @@ bool GetAppOutputWithExitCode(const CommandLine& cl,
2286 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
2292 diff --git a/src/base/process/memory.h b/src/base/process/memory.h
2294 --- a/src/base/process/memory.h
2296 @@ -32,7 +32,7 @@ BASE_EXPORT void TerminateBecauseOutOfMemory(size_t size);
2300 - BUILDFLAG(IS_AIX)
2305 diff --git a/src/base/process/process_handle.cc b/src/base/process/process_handle.cc
2307 --- a/src/base/process/process_handle.cc
2309 @@ -30,7 +30,8 @@ UniqueProcId GetUniqueIdForProcess() {
2313 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
2319 diff --git a/src/base/process/process_handle.h b/src/base/process/process_handle.h
2321 --- a/src/base/process/process_handle.h
2323 @@ -106,7 +106,7 @@ BASE_EXPORT ProcessId GetCurrentProcId();
2327 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
2332 diff --git a/src/base/process/process_metrics.cc b/src/base/process/process_metrics.cc
2334 --- a/src/base/process/process_metrics.cc
2336 @@ -55,7 +55,8 @@ SystemMetrics SystemMetrics::Sample() {
2340 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2346 @@ -74,7 +75,8 @@ Value SystemMetrics::ToValue() const {
2350 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2356 diff --git a/src/base/process/process_metrics.h b/src/base/process/process_metrics.h
2358 --- a/src/base/process/process_metrics.h
2360 @@ -36,7 +36,7 @@
2364 - BUILDFLAG(IS_AIX)
2369 @@ -52,7 +52,8 @@ class Value;
2373 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2377 // Both counts are process-wide, and exclude child processes.
2379 @@ -107,7 +108,8 @@ class BASE_EXPORT ProcessMetrics {
2383 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2389 @@ -134,7 +136,7 @@ class BASE_EXPORT ProcessMetrics {
2393 - BUILDFLAG(IS_AIX)
2398 @@ -217,7 +219,8 @@ class BASE_EXPORT ProcessMetrics {
2402 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2408 @@ -238,7 +241,7 @@ class BASE_EXPORT ProcessMetrics {
2412 - BUILDFLAG(IS_AIX)
2417 @@ -249,7 +252,7 @@ class BASE_EXPORT ProcessMetrics {
2421 - BUILDFLAG(IS_AIX)
2426 @@ -274,7 +277,7 @@ class BASE_EXPORT ProcessMetrics {
2430 - BUILDFLAG(IS_AIX)
2435 @@ -317,7 +320,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsigned int max_descriptors);
2439 - BUILDFLAG(IS_FUCHSIA)
2441 // Data about system-wide memory consumption. Values are in KB. Available on
2444 @@ -352,7 +355,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
2448 - BUILDFLAG(IS_AIX)
2453 @@ -367,7 +370,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
2457 - BUILDFLAG(IS_AIX) || BUILDFLAG(IS_FUCHSIA)
2462 @@ -404,7 +407,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo);
2466 - BUILDFLAG(IS_AIX)
2469 // CPU-related ticks. Returns -1 on parse error.
2471 @@ -591,7 +594,8 @@ class BASE_EXPORT SystemMetrics {
2475 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2481 diff --git a/src/base/process/process_metrics_linux.cc b/src/base/process/process_metrics_linux.cc
2483 --- a/src/base/process/process_metrics_linux.cc
2485 @@ -263,7 +263,8 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
2489 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2495 diff --git a/src/base/process/process_metrics_posix.cc b/src/base/process/process_metrics_posix.cc
2497 --- a/src/base/process/process_metrics_posix.cc
2499 @@ -24,7 +24,8 @@
2503 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2509 @@ -53,7 +54,7 @@ static const rlim_t kSystemDefaultMaxFds = 8192;
2513 -#elif BUILDFLAG(IS_ANDROID)
2518 @@ -105,7 +106,8 @@ void IncreaseFdLimitTo(unsigned int max_descriptors) {
2522 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2528 @@ -131,7 +133,11 @@ size_t ProcessMetrics::GetMallocUsage() {
2532 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
2541 diff --git a/src/base/profiler/register_context.h b/src/base/profiler/register_context.h
2543 --- a/src/base/profiler/register_context.h
2545 @@ -17,7 +17,8 @@
2549 -#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
2555 @@ -129,7 +130,8 @@ inline uintptr_t& RegisterContextInstructionPointer(RegisterContext* context) {
2559 -#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
2565 diff --git a/src/base/profiler/sampling_profiler_thread_token.h b/src/base/profiler/sampling_profil…
2567 --- a/src/base/profiler/sampling_profiler_thread_token.h
2569 @@ -9,7 +9,8 @@
2573 -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
2579 @@ -21,7 +22,8 @@ namespace base {
2583 -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
2589 diff --git a/src/base/run_loop.h b/src/base/run_loop.h
2591 --- a/src/base/run_loop.h
2593 @@ -293,7 +293,7 @@ class BASE_EXPORT RunLoop {
2597 -#if BUILDFLAG(IS_ANDROID)
2602 diff --git a/src/base/strings/utf_string_conversions.h b/src/base/strings/utf_string_conversions.h
2604 --- a/src/base/strings/utf_string_conversions.h
2606 @@ -74,11 +74,13 @@ std::u16string WideToUTF16(const wchar_t (&str)[N]) {
2620 diff --git a/src/base/synchronization/lock_impl_posix.cc b/src/base/synchronization/lock_impl_posix…
2622 --- a/src/base/synchronization/lock_impl_posix.cc
2624 @@ -48,7 +48,8 @@ BASE_EXPORT std::string SystemErrorCodeToString(int error_code) {
2628 -#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
2634 diff --git a/src/base/system/sys_info.h b/src/base/system/sys_info.h
2636 --- a/src/base/system/sys_info.h
2638 @@ -222,7 +222,7 @@ class BASE_EXPORT SysInfo {
2642 - BUILDFLAG(IS_AIX)
2647 diff --git a/src/base/task/current_thread.cc b/src/base/task/current_thread.cc
2649 --- a/src/base/task/current_thread.cc
2651 @@ -147,7 +147,8 @@ MessagePumpForUI* CurrentUIThread::GetMessagePumpForUI() const {
2652 return static_cast<MessagePumpForUI*>(current_->GetMessagePump());
2655 -#if defined(USE_OZONE) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_WIN)
2661 diff --git a/src/base/task/current_thread.h b/src/base/task/current_thread.h
2663 --- a/src/base/task/current_thread.h
2665 @@ -224,7 +224,8 @@ class BASE_EXPORT CurrentUIThread : public CurrentThread {
2667 CurrentUIThread* operator->() { return this; }
2669 -#if defined(USE_OZONE) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_WIN)
2675 diff --git a/src/base/task/sequence_manager/sequence_manager_impl.cc b/src/base/task/sequence_manag…
2677 --- a/src/base/task/sequence_manager/sequence_manager_impl.cc
2679 @@ -355,6 +355,10 @@ void SequenceManagerImpl::BindToMessagePump(std::unique_ptr<MessagePump> pump)…
2681 controller_->AttachToMessagePump();
2685 + controller_->AttachToMessagePump();
2690 diff --git a/src/base/task/sequence_manager/thread_controller.h b/src/base/task/sequence_manager/th…
2692 --- a/src/base/task/sequence_manager/thread_controller.h
2694 @@ -93,7 +93,7 @@ class ThreadController {
2698 -#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_ANDROID)
2703 diff --git a/src/base/task/sequence_manager/thread_controller_impl.cc b/src/base/task/sequence_mana…
2705 --- a/src/base/task/sequence_manager/thread_controller_impl.cc
2707 @@ -337,7 +337,7 @@ MessagePump* ThreadControllerImpl::GetBoundMessagePump() const {
2711 -#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_ANDROID)
2716 diff --git a/src/base/task/sequence_manager/thread_controller_impl.h b/src/base/task/sequence_manag…
2718 --- a/src/base/task/sequence_manager/thread_controller_impl.h
2720 @@ -62,7 +62,7 @@ class BASE_EXPORT ThreadControllerImpl : public ThreadController,
2724 -#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_ANDROID)
2729 diff --git a/src/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc b/src/base/…
2731 --- a/src/base/task/sequence_manager/thread_controller_with_message_pump_impl.cc
2733 @@ -543,7 +543,7 @@ void ThreadControllerWithMessagePumpImpl::AttachToMessagePump() {
2735 static_cast<MessagePumpCFRunLoopBase*>(pump_.get())->Detach();
2737 -#elif BUILDFLAG(IS_ANDROID)
2740 static_cast<MessagePumpForUI*>(pump_.get())->Attach(this);
2742 diff --git a/src/base/task/sequence_manager/thread_controller_with_message_pump_impl.h b/src/base/t…
2744 --- a/src/base/task/sequence_manager/thread_controller_with_message_pump_impl.h
2746 @@ -74,7 +74,7 @@ class BASE_EXPORT ThreadControllerWithMessagePumpImpl
2750 -#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_ANDROID)
2755 diff --git a/src/base/third_party/libevent/BUILD.gn b/src/base/third_party/libevent/BUILD.gn
2757 --- a/src/base/third_party/libevent/BUILD.gn
2759 @@ -57,6 +57,17 @@ static_library("libevent") {
2767 + "ohos/event-config.h",
2777 diff --git a/src/base/third_party/libevent/event_tagging.c b/src/base/third_party/libevent/event_ta…
2779 --- a/src/base/third_party/libevent/event_tagging.c
2781 @@ -45,7 +45,9 @@
2791 diff --git a/src/base/third_party/libevent/ohos/config.h b/src/base/third_party/libevent/ohos/confi…
2794 --- /dev/null
2796 @@ -0,0 +1,268 @@
2860 +/* Define to 1 if you have the `nsl' library (-lnsl). */
2863 +/* Define to 1 if you have the `resolv' library (-lresolv). */
2866 +/* Define to 1 if you have the `rt' library (-lrt). */
2869 +/* Define to 1 if you have the `socket' library (-lsocket). */
3043 +#define VERSION "1.4.13-stable"
3065 diff --git a/src/base/third_party/libevent/ohos/event-config.h b/src/base/third_party/libevent/ohos…
3068 --- /dev/null
3069 +++ b/src/base/third_party/libevent/ohos/event-config.h
3070 @@ -0,0 +1,281 @@
3138 +/* Define to 1 if you have the `nsl' library (-lnsl). */
3141 +/* Define to 1 if you have the `resolv' library (-lresolv). */
3144 +/* Define to 1 if you have the `rt' library (-lrt). */
3147 +/* Define to 1 if you have the `socket' library (-lsocket). */
3282 +/* Define to the sub-directory in which libtool stores uninstalled libraries.
3352 diff --git a/src/base/threading/platform_thread.h b/src/base/threading/platform_thread.h
3354 --- a/src/base/threading/platform_thread.h
3356 @@ -205,7 +205,7 @@ class BASE_EXPORT PlatformThread {
3360 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
3365 diff --git a/src/base/threading/platform_thread_posix.cc b/src/base/threading/platform_thread_posix…
3367 --- a/src/base/threading/platform_thread_posix.cc
3369 @@ -236,7 +236,7 @@ PlatformThreadId PlatformThread::CurrentId() {
3373 -#elif BUILDFLAG(IS_ANDROID)
3377 // - thread_local is slow on Android (goes through emutls)
3378 diff --git a/src/base/trace_event/common/trace_event_common.h b/src/base/trace_event/common/trace_e…
3380 --- a/src/base/trace_event/common/trace_event_common.h
3382 @@ -275,6 +275,82 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3465 @@ -298,26 +374,104 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3467 // - category and name strings must have application lifetime (statics or
3557 -#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \
3558 - INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val)
3563 -#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \
3564 - arg2_val) \
3565 - INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val, \
3566 - arg2_name, arg2_val)
3576 @@ -372,6 +526,18 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3578 // - category and name strings must have application lifetime (statics or
3595 @@ -383,6 +549,21 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3617 @@ -394,6 +575,7 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3624 // - |id| is used to match the _BEGIN event with the _END event.
3625 @@ -431,6 +613,23 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3627 // - category and name strings must have application lifetime (statics or
3649 @@ -442,6 +641,26 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3676 @@ -453,11 +672,26 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3683 // non-null or it crashes. Use DCHECK(timestamp) before calling this to detect
3703 @@ -474,7 +708,19 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3723 @@ -487,6 +733,7 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3730 // - |id| is used to match the _BEGIN event with the _END event.
3731 @@ -524,6 +771,18 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3733 // - category and name strings must have application lifetime (statics or
3750 @@ -535,6 +794,7 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3756 // Records the values of a multi-parted counter called "name" immediately.
3758 @@ -558,10 +818,16 @@ struct BASE_EXPORT TraceTimestampTraits<::base::TimeTicks> {
3759 // - |timestamp| must be non-null or it crashes. Use DCHECK(timestamp) before
3775 diff --git a/src/base/trace_event/malloc_dump_provider.cc b/src/base/trace_event/malloc_dump_provid…
3777 --- a/src/base/trace_event/malloc_dump_provider.cc
3779 @@ -220,6 +220,9 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
3789 diff --git a/src/base/trace_event/trace_event_ohos.cc b/src/base/trace_event/trace_event_ohos.cc
3792 --- /dev/null
3794 @@ -0,0 +1,101 @@
3801 + * http://www.apache.org/licenses/LICENSE-2.0
3896 diff --git a/src/base/trace_event/trace_event_ohos.h b/src/base/trace_event/trace_event_ohos.h
3899 --- /dev/null
3901 @@ -0,0 +1,93 @@
3908 + * http://www.apache.org/licenses/LICENSE-2.0
3995 diff --git a/src/base/trace_event/tracing.gni b/src/base/trace_event/tracing.gni
3997 --- a/src/base/trace_event/tracing.gni
3999 @@ -17,5 +17,5 @@ declare_args() {
4003 - (!is_android && !is_chromeos_ash) || extended_tracing_enabled
4006 diff --git a/src/build/build_config.h b/src/build/build_config.h
4008 --- a/src/build/build_config.h
4010 @@ -56,6 +56,8 @@
4019 @@ -120,7 +122,7 @@
4023 - defined(OS_SOLARIS) || defined(OS_ZOS)
4028 @@ -233,6 +235,12 @@
4041 @@ -347,7 +355,7 @@
4045 -#if defined(OS_ANDROID)
4050 diff --git a/src/build/config/BUILD.gn b/src/build/config/BUILD.gn
4052 --- a/src/build/config/BUILD.gn
4054 @@ -19,7 +19,7 @@ import("//build/config/pch.gni")
4058 -if (is_android) {
4063 @@ -105,6 +105,25 @@ config("feature_flags") {
4065 # Debug/release ----------------------------------------------------------------
4089 @@ -200,7 +219,7 @@ config("default_libs") {
4093 - } else if (is_android) {
4098 @@ -304,7 +323,8 @@ config("executable_config") {
4102 - } else if (is_linux || is_chromeos || is_android || current_os == "aix") {
4108 diff --git a/src/build/config/BUILDCONFIG.gn b/src/build/config/BUILDCONFIG.gn
4110 --- a/src/build/config/BUILDCONFIG.gn
4112 @@ -46,6 +46,15 @@
4128 @@ -153,6 +162,10 @@ declare_args() {
4139 @@ -229,6 +242,8 @@ if (target_os == "android") {
4148 @@ -300,6 +315,7 @@ is_linux = current_os == "linux"
4156 @@ -370,7 +386,7 @@ if (is_fuchsia) {
4160 -if (is_android) {
4165 @@ -389,6 +405,11 @@ if (is_debug) {
4177 @@ -515,7 +536,7 @@ foreach(_target_type,
4181 - if (!defined(invoker.metadata) && is_android &&
4186 diff --git a/src/build/config/android/BUILD.gn b/src/build/config/android/BUILD.gn
4188 --- a/src/build/config/android/BUILD.gn
4190 @@ -11,7 +11,7 @@ if (current_toolchain == default_toolchain) {
4194 -assert(is_android)
4199 diff --git a/src/build/config/android/abi.gni b/src/build/config/android/abi.gni
4201 --- a/src/build/config/android/abi.gni
4203 @@ -8,7 +8,11 @@
4207 -assert(is_android || is_chromeos)
4216 diff --git a/src/build/config/android/config.gni b/src/build/config/android/config.gni
4218 --- a/src/build/config/android/config.gni
4220 @@ -7,7 +7,7 @@
4224 -if (is_android || is_chromeos) {
4229 diff --git a/src/build/config/arm.gni b/src/build/config/arm.gni
4231 --- a/src/build/config/arm.gni
4233 @@ -38,7 +38,7 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
4237 - if (current_os == "android" || target_os == "android") {
4242 diff --git a/src/build/config/c++/c++.gni b/src/build/config/c++/c++.gni
4244 --- a/src/build/config/c++/c++.gni
4246 @@ -45,6 +45,11 @@ use_custom_libcxx =
4256 # WARNING: Setting this to a non-default value is highly discouraged.
4258 diff --git a/src/build/config/clang/BUILD.gn b/src/build/config/clang/BUILD.gn
4260 --- a/src/build/config/clang/BUILD.gn
4262 @@ -25,7 +25,7 @@ config("find_bad_constructs") {
4263 "use-classify-type",
4266 - if (is_linux || is_chromeos || is_android || is_fuchsia) {
4269 "-Xclang",
4270 "-plugin-arg-find-bad-constructs",
4271 diff --git a/src/build/config/clang/clang.gni b/src/build/config/clang/clang.gni
4273 --- a/src/build/config/clang/clang.gni
4275 @@ -4,7 +4,15 @@
4279 -default_clang_base_path = "//third_party/llvm-build/Release+Asserts"
4285 + default_clang_base_path = "//third_party/llvm-build/Release+Asserts"
4291 # Indicates if the build should use the Chrome-specific plugins for enforcing
4292 diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn
4294 --- a/src/build/config/compiler/BUILD.gn
4296 @@ -104,7 +104,7 @@ declare_args() {
4300 - (is_android || chromeos_is_browser_only || is_chromecast)
4305 @@ -129,8 +129,9 @@ declare_args() {
4309 - thin_lto_enable_optimizations = (is_chromeos_ash || is_android || is_win ||
4310 - is_linux || is_mac) && is_official_build
4316 # uninitialized floating-point types (and 32-bit pointers) with 0xFF and the
4317 @@ -140,7 +141,7 @@ declare_args() {
4321 - init_stack_vars = !is_android
4326 @@ -158,8 +159,8 @@ declare_args() {
4330 - (is_android && target_cpu == "arm") ||
4331 - (is_android && target_cpu == "arm64"))
4335 # Turn off the --call-graph-profile-sort flag for lld by default. Enable
4337 @@ -194,12 +195,12 @@ declare_args() {
4341 - !(is_android && use_order_profiling) &&
4347 -if (is_android || (is_chromeos_ash && is_chromeos_device)) {
4352 @@ -270,6 +271,8 @@ config("compiler") {
4361 @@ -341,7 +344,7 @@ config("compiler") {
4364 # The x86 toolchain currently has problems with stack-protector.
4365 - if (is_android && current_cpu == "x86") {
4367 cflags += [ "-fno-stack-protector" ]
4370 @@ -405,7 +408,7 @@ config("compiler") {
4371 ldflags += [ "-Wl,--build-id" ]
4374 - if (!is_android) {
4379 @@ -431,7 +434,7 @@ config("compiler") {
4382 # ---------------------------------
4383 - if (is_linux || is_chromeos || is_android || is_fuchsia) {
4385 asmflags += [ "-fPIC" ]
4386 cflags += [ "-fPIC" ]
4387 ldflags += [ "-fPIC" ]
4388 @@ -463,7 +466,7 @@ config("compiler") {
4391 ldflags += [ "-fuse-ld=gold" ]
4392 - if (!is_android) {
4395 # it with -fuse-ld=gold, and clang gets a --gcc-toolchain flag passed
4397 @@ -562,7 +565,7 @@ config("compiler") {
4399 # ---------------------------
4401 - current_os == "aix") {
4406 @@ -717,7 +720,7 @@ config("compiler") {
4410 - if (!is_android || current_cpu == "arm64") {
4412 cflags += [ "-fwhole-program-vtables" ]
4414 ldflags += [ "-fwhole-program-vtables" ]
4415 @@ -748,7 +751,7 @@ config("compiler") {
4419 - if (use_lld && is_android) {
4421 ldflags += [ "-Wl,--no-rosegment" ]
4424 @@ -902,7 +905,7 @@ config("compiler_cpu_abi") {
4428 - if (is_clang && !is_android && !is_nacl) {
4430 cflags += [ "--target=arm-linux-gnueabihf" ]
4431 ldflags += [ "--target=arm-linux-gnueabihf" ]
4433 @@ -916,7 +919,7 @@ config("compiler_cpu_abi") {
4434 cflags += [ "-mtune=$arm_tune" ]
4437 - if (is_clang && !is_android && !is_nacl && !is_fuchsia) {
4439 cflags += [ "--target=aarch64-linux-gnu" ]
4440 ldflags += [ "--target=aarch64-linux-gnu" ]
4442 @@ -1185,7 +1188,7 @@ config("compiler_codegen") {
4446 - if (current_cpu == "arm64" && is_android) {
4450 cflags += [ "-mno-outline" ]
4451 @@ -1231,7 +1234,8 @@ config("compiler_deterministic") {
4455 - if (is_clang && strip_absolute_paths_from_debug_symbols) {
4461 @@ -1388,6 +1392,8 @@ config("runtime_library") {
4470 @@ -1449,6 +1455,47 @@ config("default_warnings") {
4471 cflags += [ "-Wno-psabi" ]
4476 + "-Wno-psabi",
4477 + "-Wno-unknown-pragmas",
4478 + "-Wno-cpp",
4479 + "-Wno-extra-tokens",
4480 + "-Wno-error=c99-designator",
4481 + "-Wno-error=anon-enum-enum-conversion",
4482 + "-Wno-error=implicit-fallthrough",
4483 + "-Wno-error=sizeof-array-div",
4484 + "-Wno-error=reorder-init-list",
4485 + "-Wno-error=range-loop-construct",
4486 + "-Wno-error=deprecated-copy",
4487 + "-Wno-error=implicit-int-float-conversion",
4488 + "-Wno-error=inconsistent-dllimport",
4489 + "-Wno-unknown-warning-option",
4490 + "-Wno-error=abstract-final-class",
4491 + "-Wno-error=sign-compare",
4492 + "-Wno-error=int-in-bool-context",
4493 + "-Wno-error=xor-used-as-pow",
4494 + "-Wno-error=return-stack-address",
4495 + "-Wno-error=dangling-gsl",
4496 + "-Wno-error=implicit-function-declaration",
4497 + "-Wno-error=non-c-typedef-for-linkage",
4498 + "-Wno-c++11-narrowing",
4499 + "-Wno-builtin-assume-aligned-alignment",
4503 + "-Wno-c++11-narrowing",
4504 + "-Wno-psabi",
4505 + "-Wno-range-loop-analysis",
4506 + "-Wno-error=sign-compare",
4507 + "-Wno-thread-safety-attributes",
4508 + "-Wno-unknown-attributes",
4509 + "-Wno-unknown-pragmas",
4510 + "-Wno-unknown-warning-option",
4511 + "-Wno-error=unused-variable",
4517 # See comment for -Wno-c++11-narrowing.
4518 @@ -1524,6 +1571,13 @@ config("default_warnings") {
4519 "-Wno-ignored-pragma-optimize",
4523 + cflags -= [
4524 + "-Wloop-analysis",
4525 + "-Wenum-compare-conditional",
4530 # TODO(https://crbug.com/1016945): Re-enable once ChromeOS toolchain is up to date
4531 cflags += [ "-Wno-builtin-assume-aligned-alignment" ]
4532 @@ -1534,7 +1588,7 @@ config("default_warnings") {
4533 cflags += [ "-Wno-deprecated-copy" ]
4536 - if (enable_wmax_tokens) {
4538 cflags += [ "-Wmax-tokens" ]
4541 @@ -1661,7 +1715,7 @@ config("chromium_code") {
4542 # Temporarily disable -Wextra-semi for Chrome on Chrome OS.
4544 # Temporarily disable -Wextra-semi for Chromecast.
4545 - } else {
4547 cflags += [ "-Wextra-semi" ]
4550 @@ -1870,7 +1924,7 @@ config("no_exceptions") {
4552 # See: https://groups.google.com/a/chromium.org/d/topic/chromium-dev/B9Q5KTD7iCo/discussion
4554 - if (is_clang) {
4556 cflags = [ "-Wglobal-constructors" ]
4559 @@ -1879,7 +1933,7 @@ config("wglobal_constructors") {
4563 - if (is_clang) {
4565 cflags = [ "-Wexit-time-destructors" ]
4568 @@ -1946,7 +2000,7 @@ if (is_win) {
4572 - if (is_android) {
4574 # TODO(jdduke) Re-enable on mips after resolving linking
4577 @@ -2070,7 +2124,7 @@ config("no_optimize") {
4578 # traces on Windows ARM64 rely on it.
4579 cflags += [ "/Oy-" ]
4581 - } else if (is_android && !android_full_debug) {
4586 @@ -2193,9 +2247,10 @@ if (is_clang && is_a_target_toolchain) {
4590 - assert(is_android || is_chromeos_lacros || is_chromeos_ash || is_chromecast,
4594 - if (is_android || is_chromecast) {
4599 @@ -2451,7 +2506,7 @@ config("minimal_symbols") {
4603 - if (is_android && is_clang) {
4606 # doesn't emit DW_AT_linkage_name in -g1 builds.
4607 # -fdebug-info-for-profiling enables that (and a bunch of other things we
4608 @@ -2494,7 +2549,7 @@ config("default_symbols") {
4612 - if (is_android && is_clang && strip_debug_info) {
4617 @@ -2528,7 +2583,7 @@ if (is_chromeos_ash && is_chromeos_device) {
4621 -if (is_android || (is_chromeos_ash && is_chromeos_device)) {
4626 diff --git a/src/build/config/compiler/compiler.gni b/src/build/config/compiler/compiler.gni
4628 --- a/src/build/config/compiler/compiler.gni
4630 @@ -13,7 +13,7 @@ import("//build/toolchain/goma.gni")
4634 -if (is_android) {
4639 @@ -124,7 +124,7 @@ assert(!is_cfi || use_thin_lto, "CFI requires ThinLTO")
4643 -optimize_for_size = is_android || is_chromecast || is_fuchsia || is_ios
4648 @@ -153,7 +153,7 @@ if (is_chromeos_ash || is_chromeos_lacros) {
4652 -} else if (is_android) {
4657 @@ -202,7 +202,7 @@ can_unwind_with_cfi_table = is_android && !is_component_build &&
4661 -enable_arm_cfi_table = is_android && !is_component_build && current_cpu == "arm"
4666 @@ -231,7 +231,7 @@ declare_args() {
4670 - (is_android && (current_cpu == "x86" || current_cpu == "x64" ||
4675 @@ -246,7 +246,7 @@ declare_args() {
4679 - is_chromeos || (is_apple && !enable_dsyms)
4684 @@ -264,13 +264,13 @@ assert(
4688 - !is_win && (use_gold || use_lld) && cc_wrapper == ""
4693 assert(symbol_level >= -1 && symbol_level <= 2, "Invalid symbol_level")
4694 if (symbol_level == -1) {
4695 - if (is_android && !is_component_build && !use_debug_fission) {
4700 diff --git a/src/build/config/gcc/BUILD.gn b/src/build/config/gcc/BUILD.gn
4702 --- a/src/build/config/gcc/BUILD.gn
4704 @@ -63,7 +63,7 @@ config("symbol_visibility_default") {
4708 - if (!is_android && !is_chromecast && current_os != "aix") {
4713 @@ -79,7 +79,7 @@ config("rpath_for_built_shared_libraries") {
4717 -if (is_component_build && !is_android) {
4722 @@ -92,14 +92,14 @@ if (is_component_build && !is_android) {
4725 ldflags = [ "-pie" ]
4726 - if (is_android) {
4729 "-Bdynamic",
4730 "-Wl,-z,nocopyreloc",
4734 - if (!is_android && current_os != "aix") {
4739 diff --git a/src/build/config/ohos/BUILD.gn b/src/build/config/ohos/BUILD.gn
4742 --- /dev/null
4744 @@ -0,0 +1,273 @@
4746 +# Use of this source code is governed by a BSD-style license that can be
4758 +# ohos-only.
4761 + "-ffunction-sections",
4762 + "-fno-short-enums",
4783 + "-Wl,--exclude-libs=libgcc.a",
4784 + "-Wl,--no-undefined",
4785 + "-Wl,--exclude-libs=libunwind_llvm.a",
4786 + "-Wl,--exclude-libs=libc++_static.a",
4791 + "-Wl,--exclude-libs=libvpx_assembly_arm.a",
4794 + # TODO(crbug.com/1184398): Move to compiler-rt when we are ready.
4798 + # ldflags += [ "--rtlib=libgcc" ]
4805 + # cflags += [ "--rtlib=libgcc" ]
4811 + abi_target = "arm-linux-androideabi"
4813 + abi_target = "arm-linux-ohosmusl"
4821 + abi_target = "aarch64-linux-ohos"
4823 + abi_target = "aarch64-linux-android"
4834 + cflags += [ "--target=$abi_target" ]
4835 + include_dirs = [ "$ohos_toolchain_root/include/libcxx-ohos/include/c++/v1" ]
4836 + ldflags += [ "--target=$abi_target" ]
4839 + "--target=$abi_target",
4840 + "-D__ANDROID_API__=$compile_api_level",
4842 + ldflags += [ "--target=$abi_target" ]
4856 +# that is Android-only. Please see that target for advice on what should go in
4872 + ldflags += [ "-Wl,--dynamic-linker,/lib/ld-musl-arm.so.1" ]
4875 + ldflags += [ "-L" + rebase_path("$ohos_sysroot/usr/lib/arm-linux-ohos",
4878 + [ "-L" + rebase_path("$ohos_toolchain_root/lib/arm-linux-ohos/c++",
4881 + [ "-L" + rebase_path(
4882 + "$ohos_toolchain_root/lib/clang/current/lib/arm-linux-ohos",
4884 + libclang_rt_file = "$ohos_toolchain_root/lib/clang/current/lib/arm-linux-ohos/libclang_rt.bu…
4888 + ldflags += [ "-Wl,-z,max-page-size=4096" ]
4889 + ldflags += [ "-Wl,--hash-style=gnu" ]
4891 + [ "-L" + rebase_path("$ohos_sysroot/usr/lib/aarch64-linux-ohos",
4893 + ldflags += [ "-L" + rebase_path(
4894 + "$ohos_toolchain_root/lib/aarch64-linux-ohos/c++",
4897 + [ "-L" + rebase_path(
4898 + "$ohos_toolchain_root/lib/clang/current/lib/aarch64-linux-ohos",
4900 + libclang_rt_file = "$ohos_toolchain_root/lib/clang/current/lib/aarch64-linux-ohos/libclang_r…
4911 + "-isystem" + rebase_path(
4914 + "-isystem" + rebase_path(
4917 + "-isystem" + rebase_path("$ohos_toolchain_root/lib64/clang/9.0.3/include",
4919 + "-isystem" + rebase_path(
4922 + "-isystem" + rebase_path(
4923 + "$ohos_ndk_root/aosp_prebuilt_libs/asdk_libs/ndk/sysroot/usr/include/arm-linux-andro…
4928 + "-isystem" + rebase_path(
4931 + "-isystem" + rebase_path(
4937 + ldflags += [ "-L" + rebase_path(
4938 + "$ohos_ndk_root/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/arm-li…
4940 + ldflags += [ "-L" + rebase_path(
4941 … "$ohos_ndk_root/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/lib/gcc/a…
4943 + ldflags += [ "-l:libgcc.a" ]
4945 + [ "-L" + rebase_path(
4948 + ldflags += [ "-l:libc++_static.a" ]
4949 + ldflags += [ "-L" + rebase_path(
4952 + ldflags += [ "-l:libclang_rt.builtins-arm-android.a" ]
4953 + ldflags += [ "-L" + rebase_path(
4956 + ldflags += [ "-l:liblog.so" ]
4957 + ldflags += [ "-L" + rebase_path(
4958 + "$ohos_ndk_root/aosp_prebuilt_libs/asdk_libs/ndk/platforms/current/arch-arm…
4963 + ldflags += [ "-Wl,-z,max-page-size=4096" ]
4964 + ldflags += [ "-Wl,--hash-style=gnu" ]
4965 + ldflags += [ "-L" + rebase_path(
4966 + "$ohos_ndk_root/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/arm-li…
4968 + ldflags += [ "-L" + rebase_path(
4969 … "$ohos_ndk_root/gcc/linux-x86/arm/gcc-linaro-7.5.0-arm-linux-gnueabi/lib/gcc/a…
4971 + ldflags += [ "-l:libgcc.a" ]
4973 + [ "-L" + rebase_path(
4976 + ldflags += [ "-l:libc++_static.a" ]
4977 + ldflags += [ "-L" + rebase_path(
4980 + ldflags += [ "-l:libclang_rt.builtins-aarch64-android.a" ]
4981 + ldflags += [ "-L" + rebase_path(
4984 + ldflags += [ "-l:liblog.so" ]
4985 + ldflags += [ "-L" + rebase_path(
4986 + "$ohos_ndk_root/aosp_prebuilt_libs/asdk_libs/ndk/platforms/current/arch-arm…
4998 + # TODO(jdduke) Re-enable on mips after resolving linking
5001 + ldflags += [ "-Wl,--warn-shared-textrel" ]
5006 + ldflags = [ "-Wl,--pack-dyn-relocs=android" ]
5012 + cflags = [ "-finstrument-function-entry-bare" ]
5014 + ldflags = [ "-Wl,-u,__cyg_profile_func_enter_bare" ]
5018 diff --git a/src/build/config/ohos/abi.gni b/src/build/config/ohos/abi.gni
5021 --- /dev/null
5023 @@ -0,0 +1,48 @@
5025 +# Use of this source code is governed by a BSD-style license that can be
5040 + ohos_app_abi = "armeabi-v7a"
5045 + ohos_app_abi = "arm64-v8a"
5059 +# ohos_app_secondary_abi for 32-bit target_cpu, since they are not used.
5062 + ohos_app_secondary_abi = "armeabi-v7a"
5072 diff --git a/src/build/config/ohos/config.gni b/src/build/config/ohos/config.gni
5075 --- /dev/null
5077 @@ -0,0 +1,205 @@
5079 +# Use of this source code is governed by a BSD-style license that can be
5133 + ohos_toolchain_root = "$ohos_ndk_root/clang/ohos/linux-x86_64/llvm"
5136 + ohos_toolchain_root = "$ohos_ndk_root/clang/host/linux-x86/clang-r353983c"
5138 + ohos_sysroot = "$ohos_ndk_root/aosp_prebuilt_libs/asdk_libs/ndk/platforms/current/arch-arm"
5140 + ohos_sysroot = "$ohos_ndk_root/aosp_prebuilt_libs/asdk_libs/ndk/platforms/current/arch-arm…
5206 + "$ohos_build_root/out/ohos-arm-release/packages/phone/system/lib"
5208 + ohos_libs_root = "$ohos_build_root/out/ohos-arm64-release/packages/phone/system/lib64"
5214 + "$ohos_libs_root/chipset-pub-sdk",
5226 + ohos_toolchain_root = "$ohos_ndk_root/toolchains/clang-r353983c"
5228 + ohos_sysroot = "$ohos_ndk_root/aosp_prebuilt_libs/asdk_libs/ndk/platforms/current/arch-arm"
5230 + ohos_sysroot = "$ohos_ndk_root/aosp_prebuilt_libs/asdk_libs/ndk/platforms/current/arch-arm…
5283 diff --git a/src/build/config/ozone.gni b/src/build/config/ozone.gni
5285 --- a/src/build/config/ozone.gni
5287 @@ -10,7 +10,7 @@ declare_args() {
5288 # Indicates if Ozone is enabled. Ozone is a low-level library layer for Linux
5291 - is_chromeos || (is_chromecast && !is_android) || is_fuchsia || is_linux
5296 @@ -102,6 +102,8 @@ declare_args() {
5305 diff --git a/src/build/config/sanitizers/BUILD.gn b/src/build/config/sanitizers/BUILD.gn
5307 --- a/src/build/config/sanitizers/BUILD.gn
5309 @@ -607,3 +607,23 @@ config("not_fuzzed") {
5319 + "-flto=thin",
5320 + "-fvisibility=hidden",
5321 + "-fsanitize=cfi-icall",
5322 + "-fsanitize-cfi-icall-generalize-pointers",
5323 + "-fsanitize-blacklist=" + rebase_path(_cfi_blocklist_path, root_build_dir),
5327 + "-flto=thin",
5328 + "-fsanitize=cfi-icall",
5329 + "-fsanitize-cfi-icall-generalize-pointers",
5333 diff --git a/src/build/config/sysroot.gni b/src/build/config/sysroot.gni
5335 --- a/src/build/config/sysroot.gni
5337 @@ -35,6 +35,9 @@ if (sysroot == "") {
5347 diff --git a/src/build/toolchain/android/BUILD.gn b/src/build/toolchain/android/BUILD.gn
5349 --- a/src/build/toolchain/android/BUILD.gn
5351 @@ -29,11 +29,11 @@ template("android_clang_toolchain") {
5355 - _use_debug_fission = use_debug_fission && target_os == "android"
5360 - current_os = "android"
5365 diff --git a/src/build/toolchain/concurrent_links.gni b/src/build/toolchain/concurrent_links.gni
5367 --- a/src/build/toolchain/concurrent_links.gni
5369 @@ -58,10 +58,10 @@ if (concurrent_links == -1) {
5371 _args = [ "--mem_per_link_gb=4" ]
5373 - } else if (is_android && !is_component_build && symbol_level == 2) {
5376 _args = [ "--mem_per_link_gb=25" ]
5377 - } else if (is_android && !is_debug && !using_sanitizer && is_java_debug &&
5381 _args = [ "--mem_per_link_gb=6" ]
5382 @@ -83,7 +83,7 @@ if (concurrent_links == -1) {
5386 - if (is_android) {
5388 _args += [ "--secondary_mem_per_link=2" ]
5391 diff --git a/src/build/toolchain/gcc_toolchain.gni b/src/build/toolchain/gcc_toolchain.gni
5393 --- a/src/build/toolchain/gcc_toolchain.gni
5395 @@ -27,7 +27,7 @@ declare_args() {
5398 # Don't enable for Android-on-Chrome OS.
5399 - (target_os == "android" || target_os == "win")
5402 # Use -MD instead of -MMD for compiler commands. This is useful for tracking
5404 @@ -36,7 +36,7 @@ declare_args() {
5408 -if ((is_linux || is_chromeos) && target_os == "android") {
5413 @@ -49,7 +49,7 @@ if (enable_resource_allowlist_generation) {
5417 - target_os == "android" || target_os == "win",
5422 diff --git a/src/build/toolchain/ohos/BUILD.gn b/src/build/toolchain/ohos/BUILD.gn
5425 --- /dev/null
5427 @@ -0,0 +1,63 @@
5429 +# Use of this source code is governed by a BSD-style license that can be
5449 +# - binary_prefix
5467 + ar = "$_prefix/llvm-ar"
5469 + readelf = "$_prefix/llvm-readobj"
5470 + nm = "$_prefix/llvm-nm"
5471 + strip = rebase_path("$clang_base_path/bin/llvm-strip", root_build_dir)
5491 diff --git a/src/build/toolchain/toolchain.gni b/src/build/toolchain/toolchain.gni
5493 --- a/src/build/toolchain/toolchain.gni
5495 @@ -18,7 +18,7 @@ declare_args() {
5499 - generate_linker_map = is_android && is_official_build
5504 @@ -27,7 +27,7 @@ if (generate_linker_map) {
5508 - target_os == "chromeos",
5513 @@ -39,7 +39,7 @@ declare_args() {
5517 -} else if (is_android && is_component_build) {
5522 diff --git a/src/build/util/version.gni b/src/build/util/version.gni
5524 --- a/src/build/util/version.gni
5526 @@ -35,7 +35,7 @@ if (is_mac) {
5527 "-e",
5530 -} else if (target_os == "android") {
5535 @@ -93,7 +93,7 @@ if (is_mac) {
5539 -} else if (target_os == "android") {
5544 diff --git a/src/cc/mojom/BUILD.gn b/src/cc/mojom/BUILD.gn
5546 --- a/src/cc/mojom/BUILD.gn
5548 @@ -21,6 +21,9 @@ component("shared_mojom_traits") {
5558 diff --git a/src/cc/mojom/render_frame_metadata.mojom b/src/cc/mojom/render_frame_metadata.mojom
5560 --- a/src/cc/mojom/render_frame_metadata.mojom
5562 @@ -1,3 +1,4 @@
5565 // Use of this source code is governed by a BSD-style license that can be
5567 @@ -108,7 +109,7 @@ struct RenderFrameMetadata {
5571 - [EnableIf=is_android]
5576 diff --git a/src/cc/mojom/render_frame_metadata_mojom_traits.cc b/src/cc/mojom/render_frame_metadat…
5578 --- a/src/cc/mojom/render_frame_metadata_mojom_traits.cc
5580 @@ -52,6 +52,9 @@ bool StructTraits<
5582 data.ReadScrollableViewportSize(&out->scrollable_viewport_size) &&
5583 data.ReadRootLayerSize(&out->root_layer_size) &&
5586 + data.ReadRootLayerSize(&out->root_layer_size) &&
5588 data.ReadViewportSizeInPixels(&out->viewport_size_in_pixels) &&
5589 data.ReadLocalSurfaceId(&out->local_surface_id) &&
5590 diff --git a/src/cc/mojom/render_frame_metadata_mojom_traits.h b/src/cc/mojom/render_frame_metadata…
5592 --- a/src/cc/mojom/render_frame_metadata_mojom_traits.h
5594 @@ -149,6 +149,13 @@ struct COMPONENT_EXPORT(CC_SHARED_MOJOM_TRAITS)
5608 diff --git a/src/cc/trees/layer_tree_host.cc b/src/cc/trees/layer_tree_host.cc
5610 --- a/src/cc/trees/layer_tree_host.cc
5612 @@ -76,6 +76,9 @@
5622 @@ -705,6 +708,10 @@ void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) {
5627 + proxy_->SetPinchSmoothMode(isEnable);
5633 @@ -1533,6 +1540,9 @@ bool LayerTreeHost::PaintContent(const LayerList& update_layer_list) {
5641 did_paint_content |= layer->Update();
5643 diff --git a/src/cc/trees/layer_tree_host.h b/src/cc/trees/layer_tree_host.h
5645 --- a/src/cc/trees/layer_tree_host.h
5647 @@ -238,6 +238,7 @@ class CC_EXPORT LayerTreeHost : public MutatorHostClient {
5655 diff --git a/src/cc/trees/layer_tree_host_impl.cc b/src/cc/trees/layer_tree_host_impl.cc
5657 --- a/src/cc/trees/layer_tree_host_impl.cc
5659 @@ -2414,6 +2414,10 @@ RenderFrameMetadata LayerTreeHostImpl::MakeRenderFrameMetadata(
5660 frame->render_passes.back()->has_transparent_background;
5664 + metadata.root_layer_size = active_tree_->ScrollableSize();
5669 last_draw_render_frame_metadata_->root_scroll_offset
5670 diff --git a/src/cc/trees/proxy.h b/src/cc/trees/proxy.h
5672 --- a/src/cc/trees/proxy.h
5674 @@ -44,6 +44,7 @@ class CC_EXPORT Proxy {
5682 diff --git a/src/cc/trees/proxy_impl.cc b/src/cc/trees/proxy_impl.cc
5684 --- a/src/cc/trees/proxy_impl.cc
5686 @@ -235,6 +235,11 @@ void ProxyImpl::SetVisibleOnImpl(bool visible) {
5687 scheduler_->SetVisible(visible);
5698 @@ -406,8 +411,11 @@ void ProxyImpl::SetNeedsPrepareTilesOnImplThread() {
5702 - TRACE_EVENT0("cc", "ProxyImpl::SetNeedsCommitOnImplThread");
5704 + if ((pinch_smooth_) && (host_impl_->IsPinchGestureActive())) {
5708 scheduler_->SetNeedsBeginMainFrame();
5711 @@ -755,6 +763,10 @@ void ProxyImpl::ScheduledActionBeginLayerTreeFrameSinkCreation() {
5715 + if ((pinch_smooth_) && (host_impl_->IsPinchGestureActive())) {
5719 host_impl_->PrepareTiles();
5722 diff --git a/src/cc/trees/proxy_impl.h b/src/cc/trees/proxy_impl.h
5724 --- a/src/cc/trees/proxy_impl.h
5726 @@ -67,6 +67,7 @@ class CC_EXPORT ProxyImpl : public LayerTreeHostImplClient,
5734 @@ -198,6 +199,8 @@ class CC_EXPORT ProxyImpl : public LayerTreeHostImplClient,
5743 diff --git a/src/cc/trees/proxy_main.cc b/src/cc/trees/proxy_main.cc
5745 --- a/src/cc/trees/proxy_main.cc
5747 @@ -457,6 +457,12 @@ void ProxyMain::SetVisible(bool visible) {
5753 + ImplThreadTaskRunner()->PostTask(
5760 diff --git a/src/cc/trees/proxy_main.h b/src/cc/trees/proxy_main.h
5762 --- a/src/cc/trees/proxy_main.h
5764 @@ -87,6 +87,7 @@ class CC_EXPORT ProxyMain : public Proxy {
5772 diff --git a/src/cc/trees/render_frame_metadata.cc b/src/cc/trees/render_frame_metadata.cc
5774 --- a/src/cc/trees/render_frame_metadata.cc
5776 @@ -1,3 +1,4 @@
5779 // Use of this source code is governed by a BSD-style license that can be
5781 @@ -36,6 +37,9 @@ bool RenderFrameMetadata::operator==(const RenderFrameMetadata& other) const {
5791 diff --git a/src/cc/trees/render_frame_metadata.h b/src/cc/trees/render_frame_metadata.h
5793 --- a/src/cc/trees/render_frame_metadata.h
5795 @@ -1,3 +1,4 @@
5798 // Use of this source code is governed by a BSD-style license that can be
5800 @@ -119,6 +120,9 @@ class CC_EXPORT RenderFrameMetadata {
5810 diff --git a/src/cc/trees/single_thread_proxy.cc b/src/cc/trees/single_thread_proxy.cc
5812 --- a/src/cc/trees/single_thread_proxy.cc
5814 @@ -123,6 +123,10 @@ void SingleThreadProxy::SetVisible(bool visible) {
5815 scheduler_on_impl_thread_->SetVisible(host_impl_->visible());
5823 DCHECK(task_runner_provider_->IsMainThread());
5825 diff --git a/src/cc/trees/single_thread_proxy.h b/src/cc/trees/single_thread_proxy.h
5827 --- a/src/cc/trees/single_thread_proxy.h
5829 @@ -51,6 +51,7 @@ class CC_EXPORT SingleThreadProxy : public Proxy,
5837 diff --git a/src/cef/BUILD.gn b/src/cef/BUILD.gn
5839 --- a/src/cef/BUILD.gn
5841 @@ -96,6 +96,7 @@
5849 @@ -109,8 +110,8 @@ import("//printing/buildflags/buildflags.gni")
5853 -import("//tools/grit/repack.gni")
5859 @@ -139,14 +140,14 @@ if (is_mac) {
5863 - [
5864 - "testonly",
5865 - "visibility",
5866 - ])
5872 - "sources must be specified for $target_name")
5875 - "output_extension must be specified for $target_name")
5880 @@ -209,14 +210,12 @@ if (is_mac) {
5884 - [
5885 - "testonly",
5886 - "visibility",
5887 - ])
5893 - public_deps = [
5894 - ":$_compile_target_name",
5895 - ]
5900 @@ -224,9 +223,7 @@ if (is_mac) {
5904 - outputs = [
5905 - "$_output_path/{{source_file_part}}",
5906 - ]
5911 @@ -255,14 +252,13 @@ assert(enable_basic_printing)
5915 -assert(enable_widevine)
5923 -
5927 @@ -270,12 +266,12 @@ if (is_clang) {
5931 - cef_plist_version = exec_script(
5932 - "//cef/tools/cef_version.py", [ "plist" ], "trim string", [])
5937 - cef_dylib_version = exec_script(
5938 - "//cef/tools/cef_version.py", [ "dylib" ], "trim string", [])
5944 @@ -312,7 +308,6 @@ group("cef") {
5948 -
5952 @@ -330,8 +325,8 @@ if (is_win) {
5956 - "//chrome/common/crash_keys.cc",
5962 @@ -344,7 +339,7 @@ if (is_win) {
5966 - defines = ["COMPILE_CONTENT_STATICALLY"]
5971 @@ -372,9 +367,7 @@ source_set("libcef_static_unittested") {
5975 - deps = [
5976 - "//base",
5977 - ]
5982 @@ -384,9 +377,7 @@ source_set("libcef_static_unittested") {
5986 - sources = [
5987 - "libcef/browser/devtools/devtools_util_unittest.cc",
5988 - ]
5993 @@ -401,413 +392,471 @@ test("libcef_static_unittests") {
5997 - sources = includes_common +
5998 - gypi_paths.autogen_cpp_includes + [
5999 - "libcef/browser/alloy/alloy_browser_context.cc",
6000 - "libcef/browser/alloy/alloy_browser_context.h",
6001 - "libcef/browser/alloy/alloy_browser_host_impl.cc",
6002 - "libcef/browser/alloy/alloy_browser_host_impl.h",
6003 - "libcef/browser/alloy/alloy_browser_main.cc",
6004 - "libcef/browser/alloy/alloy_browser_main.h",
6005 - "libcef/browser/alloy/alloy_content_browser_client.cc",
6006 - "libcef/browser/alloy/alloy_content_browser_client.h",
6007 - "libcef/browser/alloy/alloy_dialog_util.cc",
6008 - "libcef/browser/alloy/alloy_dialog_util.h",
6009 - "libcef/browser/alloy/alloy_download_util.cc",
6010 - "libcef/browser/alloy/alloy_download_util.h",
6011 - "libcef/browser/alloy/browser_platform_delegate_alloy.cc",
6012 - "libcef/browser/alloy/browser_platform_delegate_alloy.h",
6013 - "libcef/browser/alloy/chrome_browser_process_alloy.cc",
6014 - "libcef/browser/alloy/chrome_browser_process_alloy.h",
6015 - "libcef/browser/alloy/chrome_profile_manager_alloy.cc",
6016 - "libcef/browser/alloy/chrome_profile_manager_alloy.h",
6017 - "libcef/browser/alloy/chrome_profile_alloy.cc",
6018 - "libcef/browser/alloy/chrome_profile_alloy.h",
6019 - "libcef/browser/audio_capturer.cc",
6020 - "libcef/browser/audio_capturer.h",
6021 - "libcef/browser/audio_loopback_stream_creator.cc",
6022 - "libcef/browser/audio_loopback_stream_creator.h",
6023 - "libcef/browser/browser_contents_delegate.cc",
6024 - "libcef/browser/browser_contents_delegate.h",
6025 - "libcef/browser/browser_context.cc",
6026 - "libcef/browser/browser_context.h",
6027 - "libcef/browser/browser_context_keyed_service_factories.cc",
6028 - "libcef/browser/browser_context_keyed_service_factories.h",
6029 - "libcef/browser/browser_frame.cc",
6030 - "libcef/browser/browser_frame.h",
6031 - "libcef/browser/browser_host_base.cc",
6032 - "libcef/browser/browser_host_base.h",
6033 - "libcef/browser/browser_host_create.cc",
6034 - "libcef/browser/browser_info.cc",
6035 - "libcef/browser/browser_info.h",
6036 - "libcef/browser/browser_info_manager.cc",
6037 - "libcef/browser/browser_info_manager.h",
6038 - "libcef/browser/browser_manager.cc",
6039 - "libcef/browser/browser_manager.h",
6040 - "libcef/browser/browser_message_loop.cc",
6041 - "libcef/browser/browser_message_loop.h",
6042 - "libcef/browser/browser_platform_delegate.cc",
6043 - "libcef/browser/browser_platform_delegate.h",
6044 - "libcef/browser/browser_platform_delegate_create.cc",
6045 - "libcef/browser/browser_util.cc",
6046 - "libcef/browser/browser_util.h",
6047 - "libcef/browser/chrome/browser_delegate.h",
6048 - "libcef/browser/chrome/browser_platform_delegate_chrome.cc",
6049 - "libcef/browser/chrome/browser_platform_delegate_chrome.h",
6050 - "libcef/browser/chrome/chrome_browser_context.cc",
6051 - "libcef/browser/chrome/chrome_browser_context.h",
6052 - "libcef/browser/chrome/chrome_browser_delegate.cc",
6053 - "libcef/browser/chrome/chrome_browser_delegate.h",
6054 - "libcef/browser/chrome/chrome_browser_host_impl.cc",
6055 - "libcef/browser/chrome/chrome_browser_host_impl.h",
6056 - "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc",
6057 - "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h",
6058 - "libcef/browser/chrome/chrome_content_browser_client_cef.cc",
6059 - "libcef/browser/chrome/chrome_content_browser_client_cef.h",
6060 - "libcef/browser/chrome/chrome_context_menu_handler.cc",
6061 - "libcef/browser/chrome/chrome_context_menu_handler.h",
6062 - "libcef/browser/chrome_crash_reporter_client_stub.cc",
6063 - "libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.cc",
6064 - "libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.h",
6065 - "libcef/browser/context.cc",
6066 - "libcef/browser/context.h",
6067 - "libcef/browser/context_menu_params_impl.cc",
6068 - "libcef/browser/context_menu_params_impl.h",
6069 - "libcef/browser/devtools/devtools_controller.cc",
6070 - "libcef/browser/devtools/devtools_controller.h",
6071 - "libcef/browser/devtools/devtools_file_manager.cc",
6072 - "libcef/browser/devtools/devtools_file_manager.h",
6073 - "libcef/browser/devtools/devtools_frontend.cc",
6074 - "libcef/browser/devtools/devtools_frontend.h",
6075 - "libcef/browser/devtools/devtools_manager.cc",
6076 - "libcef/browser/devtools/devtools_manager.h",
6077 - "libcef/browser/devtools/devtools_manager_delegate.cc",
6078 - "libcef/browser/devtools/devtools_manager_delegate.h",
6079 - "libcef/browser/download_item_impl.cc",
6080 - "libcef/browser/download_item_impl.h",
6081 - "libcef/browser/download_manager_delegate.cc",
6082 - "libcef/browser/download_manager_delegate.h",
6083 - "libcef/browser/extension_impl.cc",
6084 - "libcef/browser/extension_impl.h",
6085 - "libcef/browser/extensions/api/file_system/cef_file_system_delegate.cc",
6086 - "libcef/browser/extensions/api/file_system/cef_file_system_delegate.h",
6087 - "libcef/browser/extensions/api/storage/sync_value_store_cache.cc",
6088 - "libcef/browser/extensions/api/storage/sync_value_store_cache.h",
6089 - "libcef/browser/extensions/api/tabs/tabs_api.cc",
6090 - "libcef/browser/extensions/api/tabs/tabs_api.h",
6091 - "libcef/browser/extensions/alloy_extensions_util.cc",
6092 - "libcef/browser/extensions/alloy_extensions_util.h",
6093 - "libcef/browser/extensions/browser_extensions_util.cc",
6094 - "libcef/browser/extensions/browser_extensions_util.h",
6095 - "libcef/browser/extensions/browser_platform_delegate_background.cc",
6096 - "libcef/browser/extensions/browser_platform_delegate_background.h",
6097 - "libcef/browser/extensions/chrome_api_registration.cc",
6098 - "libcef/browser/extensions/chrome_api_registration.h",
6099 - "libcef/browser/extensions/component_extension_resource_manager.cc",
6100 - "libcef/browser/extensions/component_extension_resource_manager.h",
6101 - "libcef/browser/extensions/extensions_api_client.cc",
6102 - "libcef/browser/extensions/extensions_api_client.h",
6103 - "libcef/browser/extensions/extensions_browser_api_provider.cc",
6104 - "libcef/browser/extensions/extensions_browser_api_provider.h",
6105 - "libcef/browser/extensions/extensions_browser_client.cc",
6106 - "libcef/browser/extensions/extensions_browser_client.h",
6107 - "libcef/browser/extensions/extension_background_host.cc",
6108 - "libcef/browser/extensions/extension_background_host.h",
6109 - "libcef/browser/extensions/extension_function_details.cc",
6110 - "libcef/browser/extensions/extension_function_details.h",
6111 - "libcef/browser/extensions/extension_host_delegate.cc",
6112 - "libcef/browser/extensions/extension_host_delegate.h",
6113 - "libcef/browser/extensions/extension_system.cc",
6114 - "libcef/browser/extensions/extension_system.h",
6115 - "libcef/browser/extensions/extension_system_factory.cc",
6116 - "libcef/browser/extensions/extension_system_factory.h",
6117 - "libcef/browser/extensions/extension_view_host.cc",
6118 - "libcef/browser/extensions/extension_view_host.h",
6119 - "libcef/browser/extensions/extension_web_contents_observer.cc",
6120 - "libcef/browser/extensions/extension_web_contents_observer.h",
6121 - "libcef/browser/extensions/mime_handler_view_guest_delegate.cc",
6122 - "libcef/browser/extensions/mime_handler_view_guest_delegate.h",
6123 - "libcef/browser/extensions/value_store/cef_value_store.cc",
6124 - "libcef/browser/extensions/value_store/cef_value_store.h",
6125 - "libcef/browser/extensions/value_store/cef_value_store_factory.cc",
6126 - "libcef/browser/extensions/value_store/cef_value_store_factory.h",
6127 - "libcef/browser/file_dialog_runner.h",
6128 - "libcef/browser/file_dialog_manager.cc",
6129 - "libcef/browser/file_dialog_manager.h",
6130 - "libcef/browser/frame_host_impl.cc",
6131 - "libcef/browser/frame_host_impl.h",
6132 - "libcef/browser/frame_service_base.h",
6133 - "libcef/browser/image_impl.cc",
6134 - "libcef/browser/image_impl.h",
6135 - "libcef/browser/iothread_state.cc",
6136 - "libcef/browser/iothread_state.h",
6137 - "libcef/browser/javascript_dialog_runner.h",
6138 - "libcef/browser/javascript_dialog_manager.cc",
6139 - "libcef/browser/javascript_dialog_manager.h",
6140 - "libcef/browser/main_runner.cc",
6141 - "libcef/browser/main_runner.h",
6142 - "libcef/browser/media_capture_devices_dispatcher.cc",
6143 - "libcef/browser/media_capture_devices_dispatcher.h",
6144 - "libcef/browser/media_router/media_route_impl.cc",
6145 - "libcef/browser/media_router/media_route_impl.h",
6146 - "libcef/browser/media_router/media_router_impl.cc",
6147 - "libcef/browser/media_router/media_router_impl.h",
6148 - "libcef/browser/media_router/media_router_manager.cc",
6149 - "libcef/browser/media_router/media_router_manager.h",
6150 - "libcef/browser/media_router/media_sink_impl.cc",
6151 - "libcef/browser/media_router/media_sink_impl.h",
6152 - "libcef/browser/media_router/media_source_impl.cc",
6153 - "libcef/browser/media_router/media_source_impl.h",
6154 - "libcef/browser/menu_manager.cc",
6155 - "libcef/browser/menu_manager.h",
6156 - "libcef/browser/menu_model_impl.cc",
6157 - "libcef/browser/menu_model_impl.h",
6158 - "libcef/browser/menu_runner.h",
6159 - "libcef/browser/native/browser_platform_delegate_native.cc",
6160 - "libcef/browser/native/browser_platform_delegate_native.h",
6161 - "libcef/browser/native/cursor_util.h",
6162 - "libcef/browser/native/cursor_util.cc",
6163 - "libcef/browser/navigation_entry_impl.cc",
6164 - "libcef/browser/navigation_entry_impl.h",
6165 - "libcef/browser/net/chrome_scheme_handler.cc",
6166 - "libcef/browser/net/chrome_scheme_handler.h",
6167 - "libcef/browser/net/crlset_file_util_impl.cc",
6168 - "libcef/browser/net/devtools_scheme_handler.cc",
6169 - "libcef/browser/net/devtools_scheme_handler.h",
6170 - "libcef/browser/net/internal_scheme_handler.cc",
6171 - "libcef/browser/net/internal_scheme_handler.h",
6172 - "libcef/browser/net/scheme_handler.cc",
6173 - "libcef/browser/net/scheme_handler.h",
6174 - "libcef/browser/net/throttle_handler.cc",
6175 - "libcef/browser/net/throttle_handler.h",
6176 - "libcef/browser/net_service/browser_urlrequest_impl.cc",
6177 - "libcef/browser/net_service/browser_urlrequest_impl.h",
6178 - "libcef/browser/net_service/cookie_helper.cc",
6179 - "libcef/browser/net_service/cookie_helper.h",
6180 - "libcef/browser/net_service/cookie_manager_impl.cc",
6181 - "libcef/browser/net_service/cookie_manager_impl.h",
6182 - "libcef/browser/net_service/login_delegate.cc",
6183 - "libcef/browser/net_service/login_delegate.h",
6184 - "libcef/browser/net_service/proxy_url_loader_factory.cc",
6185 - "libcef/browser/net_service/proxy_url_loader_factory.h",
6186 - "libcef/browser/net_service/resource_handler_wrapper.cc",
6187 - "libcef/browser/net_service/resource_handler_wrapper.h",
6188 - "libcef/browser/net_service/resource_request_handler_wrapper.cc",
6189 - "libcef/browser/net_service/resource_request_handler_wrapper.h",
6190 - "libcef/browser/net_service/response_filter_wrapper.cc",
6191 - "libcef/browser/net_service/response_filter_wrapper.h",
6192 - "libcef/browser/net_service/stream_reader_url_loader.cc",
6193 - "libcef/browser/net_service/stream_reader_url_loader.h",
6194 - "libcef/browser/net_service/url_loader_factory_getter.cc",
6195 - "libcef/browser/net_service/url_loader_factory_getter.h",
6196 - "libcef/browser/origin_whitelist_impl.cc",
6197 - "libcef/browser/origin_whitelist_impl.h",
6198 - "libcef/browser/osr/browser_platform_delegate_osr.cc",
6199 - "libcef/browser/osr/browser_platform_delegate_osr.h",
6200 - "libcef/browser/osr/host_display_client_osr.cc",
6201 - "libcef/browser/osr/host_display_client_osr.h",
6202 - "libcef/browser/osr/motion_event_osr.cc",
6203 - "libcef/browser/osr/motion_event_osr.h",
6204 - "libcef/browser/osr/osr_accessibility_util.cc",
6205 - "libcef/browser/osr/osr_accessibility_util.h",
6206 - "libcef/browser/osr/osr_util.cc",
6207 - "libcef/browser/osr/osr_util.h",
6208 - "libcef/browser/osr/render_widget_host_view_osr.cc",
6209 - "libcef/browser/osr/render_widget_host_view_osr.h",
6210 - "libcef/browser/osr/synthetic_gesture_target_osr.cc",
6211 - "libcef/browser/osr/synthetic_gesture_target_osr.h",
6212 - "libcef/browser/osr/video_consumer_osr.cc",
6213 - "libcef/browser/osr/video_consumer_osr.h",
6214 - "libcef/browser/osr/web_contents_view_osr.cc",
6215 - "libcef/browser/osr/web_contents_view_osr.h",
6216 - "libcef/browser/path_util_impl.cc",
6217 - "libcef/browser/prefs/browser_prefs.cc",
6218 - "libcef/browser/prefs/browser_prefs.h",
6219 - "libcef/browser/prefs/pref_store.cc",
6220 - "libcef/browser/prefs/pref_store.h",
6221 - "libcef/browser/prefs/renderer_prefs.cc",
6222 - "libcef/browser/prefs/renderer_prefs.h",
6223 - "libcef/browser/print_settings_impl.cc",
6224 - "libcef/browser/print_settings_impl.h",
6225 - "libcef/browser/printing/constrained_window_views_client.cc",
6226 - "libcef/browser/printing/constrained_window_views_client.h",
6227 - "libcef/browser/printing/print_view_manager.cc",
6228 - "libcef/browser/printing/print_view_manager.h",
6229 - "libcef/browser/process_util_impl.cc",
6230 - "libcef/browser/request_context_handler_map.cc",
6231 - "libcef/browser/request_context_handler_map.h",
6232 - "libcef/browser/request_context_impl.cc",
6233 - "libcef/browser/request_context_impl.h",
6234 - "libcef/browser/scheme_impl.cc",
6235 - "libcef/browser/server_impl.cc",
6236 - "libcef/browser/server_impl.h",
6237 - "libcef/browser/simple_menu_model_impl.cc",
6238 - "libcef/browser/simple_menu_model_impl.h",
6239 - "libcef/browser/speech_recognition_manager_delegate.cc",
6240 - "libcef/browser/speech_recognition_manager_delegate.h",
6241 - "libcef/browser/ssl_host_state_delegate.cc",
6242 - "libcef/browser/ssl_host_state_delegate.h",
6243 - "libcef/browser/ssl_info_impl.cc",
6244 - "libcef/browser/ssl_info_impl.h",
6245 - "libcef/browser/ssl_status_impl.cc",
6246 - "libcef/browser/ssl_status_impl.h",
6247 - "libcef/browser/stream_impl.cc",
6248 - "libcef/browser/stream_impl.h",
6249 - "libcef/browser/trace_impl.cc",
6250 - "libcef/browser/trace_subscriber.cc",
6251 - "libcef/browser/trace_subscriber.h",
6252 - "libcef/browser/thread_util.h",
6253 - "libcef/browser/web_contents_dialog_helper.cc",
6254 - "libcef/browser/web_contents_dialog_helper.h",
6255 - "libcef/browser/web_plugin_impl.cc",
6256 - "libcef/browser/web_plugin_impl.h",
6257 - "libcef/browser/x509_certificate_impl.cc",
6258 - "libcef/browser/x509_certificate_impl.h",
6259 - "libcef/browser/x509_cert_principal_impl.cc",
6260 - "libcef/browser/x509_cert_principal_impl.h",
6261 - "libcef/browser/xml_reader_impl.cc",
6262 - "libcef/browser/xml_reader_impl.h",
6263 - "libcef/browser/zip_reader_impl.cc",
6264 - "libcef/browser/zip_reader_impl.h",
6265 - "libcef/common/alloy/alloy_content_client.cc",
6266 - "libcef/common/alloy/alloy_content_client.h",
6267 - "libcef/common/alloy/alloy_main_delegate.cc",
6268 - "libcef/common/alloy/alloy_main_delegate.h",
6269 - "libcef/common/alloy/alloy_main_runner_delegate.cc",
6270 - "libcef/common/alloy/alloy_main_runner_delegate.h",
6271 - "libcef/common/app_manager.cc",
6272 - "libcef/common/app_manager.h",
6273 - "libcef/common/base_impl.cc",
6274 - "libcef/common/cef_switches.cc",
6275 - "libcef/common/cef_switches.h",
6276 - "libcef/common/chrome/chrome_content_client_cef.cc",
6277 - "libcef/common/chrome/chrome_content_client_cef.h",
6278 - "libcef/common/chrome/chrome_main_delegate_cef.cc",
6279 - "libcef/common/chrome/chrome_main_delegate_cef.h",
6280 - "libcef/common/chrome/chrome_main_runner_delegate.cc",
6281 - "libcef/common/chrome/chrome_main_runner_delegate.h",
6282 - "libcef/common/command_line_impl.cc",
6283 - "libcef/common/command_line_impl.h",
6284 - "libcef/common/crash_reporter_client.cc",
6285 - "libcef/common/crash_reporter_client.h",
6286 - "libcef/common/crash_reporting.cc",
6287 - "libcef/common/crash_reporting.h",
6288 - "libcef/common/drag_data_impl.cc",
6289 - "libcef/common/drag_data_impl.h",
6290 - "libcef/common/extensions/chrome_generated_schemas.cc",
6291 - "libcef/common/extensions/chrome_generated_schemas.h",
6292 - "libcef/common/extensions/extensions_api_provider.cc",
6293 - "libcef/common/extensions/extensions_api_provider.h",
6294 - "libcef/common/extensions/extensions_client.cc",
6295 - "libcef/common/extensions/extensions_client.h",
6296 - "libcef/common/extensions/extensions_util.cc",
6297 - "libcef/common/extensions/extensions_util.h",
6298 - "libcef/common/file_util_impl.cc",
6299 - "libcef/common/frame_util.cc",
6300 - "libcef/common/frame_util.h",
6301 - "libcef/common/i18n_util_impl.cc",
6302 - "libcef/common/json_impl.cc",
6303 - "libcef/common/main_runner_delegate.h",
6304 - "libcef/common/main_runner_handler.h",
6305 - "libcef/common/net/http_header_utils.cc",
6306 - "libcef/common/net/http_header_utils.h",
6307 - "libcef/common/net/net_resource_provider.cc",
6308 - "libcef/common/net/net_resource_provider.h",
6309 - "libcef/common/net/scheme_registration.cc",
6310 - "libcef/common/net/scheme_registration.h",
6311 - "libcef/common/net/url_util.cc",
6312 - "libcef/common/net/url_util.h",
6313 - "libcef/common/net_service/net_service_util.cc",
6314 - "libcef/common/net_service/net_service_util.h",
6315 - "libcef/common/parser_impl.cc",
6316 - "libcef/common/process_message_impl.cc",
6317 - "libcef/common/process_message_impl.h",
6318 - "libcef/common/request_impl.cc",
6319 - "libcef/common/request_impl.h",
6320 - "libcef/common/resource_bundle_delegate.cc",
6321 - "libcef/common/resource_bundle_delegate.h",
6322 - "libcef/common/resource_bundle_impl.cc",
6323 - "libcef/common/resource_bundle_impl.h",
6324 - "libcef/common/resource_util.cc",
6325 - "libcef/common/resource_util.h",
6326 - "libcef/common/response_impl.cc",
6327 - "libcef/common/response_impl.h",
6328 - "libcef/common/scheme_registrar_impl.cc",
6329 - "libcef/common/scheme_registrar_impl.h",
6330 - "libcef/common/string_list_impl.cc",
6331 - "libcef/common/string_map_impl.cc",
6332 - "libcef/common/string_multimap_impl.cc",
6333 - "libcef/common/string_types_impl.cc",
6334 - "libcef/common/string_util.cc",
6335 - "libcef/common/string_util.h",
6336 - "libcef/common/task_impl.cc",
6337 - "libcef/common/task_runner_impl.cc",
6338 - "libcef/common/task_runner_impl.h",
6339 - "libcef/common/task_runner_manager.cc",
6340 - "libcef/common/task_runner_manager.h",
6341 - "libcef/common/test/translator_test_impl.cc",
6342 - "libcef/common/thread_impl.cc",
6343 - "libcef/common/thread_impl.h",
6344 - "libcef/common/time_impl.cc",
6345 - "libcef/common/time_util.h",
6346 - "libcef/common/tracker.cc",
6347 - "libcef/common/tracker.h",
6348 - "libcef/common/urlrequest_impl.cc",
6349 - "libcef/common/value_base.cc",
6350 - "libcef/common/value_base.h",
6351 - "libcef/common/values_impl.cc",
6352 - "libcef/common/values_impl.h",
6353 - "libcef/common/waitable_event_impl.cc",
6354 - "libcef/common/waitable_event_impl.h",
6355 - "libcef/features/runtime.h",
6356 - "libcef/features/runtime_checks.h",
6357 - "libcef/renderer/alloy/alloy_content_renderer_client.cc",
6358 - "libcef/renderer/alloy/alloy_content_renderer_client.h",
6359 - "libcef/renderer/alloy/alloy_render_thread_observer.cc",
6360 - "libcef/renderer/alloy/alloy_render_thread_observer.h",
6361 - "libcef/renderer/alloy/url_loader_throttle_provider_impl.cc",
6362 - "libcef/renderer/alloy/url_loader_throttle_provider_impl.h",
6363 - "libcef/renderer/browser_impl.cc",
6364 - "libcef/renderer/browser_impl.h",
6365 - "libcef/renderer/chrome/chrome_content_renderer_client_cef.cc",
6366 - "libcef/renderer/chrome/chrome_content_renderer_client_cef.h",
6367 - "libcef/renderer/dom_document_impl.cc",
6368 - "libcef/renderer/dom_document_impl.h",
6369 - "libcef/renderer/dom_node_impl.cc",
6370 - "libcef/renderer/dom_node_impl.h",
6371 - "libcef/renderer/extensions/extensions_dispatcher_delegate.cc",
6372 - "libcef/renderer/extensions/extensions_dispatcher_delegate.h",
6373 - "libcef/renderer/extensions/extensions_renderer_client.cc",
6374 - "libcef/renderer/extensions/extensions_renderer_client.h",
6375 - "libcef/renderer/extensions/print_render_frame_helper_delegate.cc",
6376 - "libcef/renderer/extensions/print_render_frame_helper_delegate.h",
6377 - "libcef/renderer/frame_impl.cc",
6378 - "libcef/renderer/frame_impl.h",
6379 - "libcef/renderer/render_frame_observer.cc",
6380 - "libcef/renderer/render_frame_observer.h",
6381 - "libcef/renderer/render_frame_util.cc",
6382 - "libcef/renderer/render_frame_util.h",
6383 - "libcef/renderer/render_manager.cc",
6384 - "libcef/renderer/render_manager.h",
6385 - "libcef/renderer/render_urlrequest_impl.cc",
6386 - "libcef/renderer/render_urlrequest_impl.h",
6387 - "libcef/renderer/thread_util.h",
6388 - "libcef/renderer/v8_impl.cc",
6389 - "libcef/renderer/v8_impl.h",
6390 -
6391 - # For Chrome runtime support.
6392 - "//chrome/app/chrome_main_delegate.cc",
6393 - "//chrome/app/chrome_main_delegate.h",
6394 - ]
6859 - public_configs = [
6860 - "libcef/features:config",
6861 - ]
6866 @@ -821,9 +870,8 @@ static_library("libcef_static") {
6870 - "libcef/common/mojom",
6871 -
6877 @@ -888,8 +936,8 @@ static_library("libcef_static") {
6881 - "//extensions/common/api",
6887 @@ -907,11 +955,11 @@ static_library("libcef_static") {
6894 - "//third_party/widevine/cdm:headers",
6896 - "//third_party/icu",
6901 @@ -926,30 +974,39 @@ static_library("libcef_static") {
6910 + deps += [ "//components/safe_browsing/core/db:test_database_manager" ]
6914 - sources += includes_win + [
6915 - "libcef/browser/alloy/alloy_browser_main_win.cc",
6916 - "libcef/browser/native/browser_platform_delegate_native_win.cc",
6917 - "libcef/browser/native/browser_platform_delegate_native_win.h",
6918 - "libcef/browser/native/cursor_util_win.cc",
6919 - "libcef/browser/native/file_dialog_runner_win.cc",
6920 - "libcef/browser/native/file_dialog_runner_win.h",
6921 - "libcef/browser/native/javascript_dialog_runner_win.cc",
6922 - "libcef/browser/native/javascript_dialog_runner_win.h",
6923 - "libcef/browser/native/menu_2.cc",
6924 - "libcef/browser/native/menu_2.h",
6925 - "libcef/browser/native/menu_runner_win.cc",
6926 - "libcef/browser/native/menu_runner_win.h",
6927 - "libcef/browser/native/menu_wrapper.h",
6928 - "libcef/browser/native/native_menu_win.cc",
6929 - "libcef/browser/native/native_menu_win.h",
6930 - "libcef/browser/osr/browser_platform_delegate_osr_win.cc",
6931 - "libcef/browser/osr/browser_platform_delegate_osr_win.h",
6932 - ]
6955 - "//chrome/install_static:secondary_module",
6961 @@ -958,27 +1015,40 @@ static_library("libcef_static") {
6970 - data_deps = [
6971 - "//chrome/elevation_service",
6972 - ]
6990 - sources += includes_linux + [
6991 - "libcef/browser/native/browser_platform_delegate_native_linux.cc",
6992 - "libcef/browser/native/browser_platform_delegate_native_linux.h",
6993 - "libcef/browser/native/cursor_util_linux.cc",
6994 - "libcef/browser/native/menu_runner_linux.cc",
6995 - "libcef/browser/native/menu_runner_linux.h",
6996 - "libcef/browser/osr/browser_platform_delegate_osr_linux.cc",
6997 - "libcef/browser/osr/browser_platform_delegate_osr_linux.h",
6998 - "libcef/browser/printing/print_dialog_linux.cc",
6999 - "libcef/browser/printing/print_dialog_linux.h",
7000 - ]
7016 @@ -993,31 +1063,30 @@ static_library("libcef_static") {
7020 - deps += [
7021 - "//third_party/angle:libEGL",
7022 - ]
7028 - sources += includes_mac + [
7029 - "libcef/browser/native/browser_platform_delegate_native_mac.h",
7030 - "libcef/browser/native/browser_platform_delegate_native_mac.mm",
7031 - "libcef/browser/native/file_dialog_runner_mac.h",
7032 - "libcef/browser/native/file_dialog_runner_mac.mm",
7033 - "libcef/browser/native/javascript_dialog_runner_mac.h",
7034 - "libcef/browser/native/javascript_dialog_runner_mac.mm",
7035 - "libcef/browser/native/menu_runner_mac.h",
7036 - "libcef/browser/native/menu_runner_mac.mm",
7037 - "libcef/browser/osr/browser_platform_delegate_osr_mac.h",
7038 - "libcef/browser/osr/browser_platform_delegate_osr_mac.mm",
7039 - "libcef/common/util_mac.h",
7040 - "libcef/common/util_mac.mm",
7041 -
7042 - # For Chrome runtime support.
7043 - "//chrome/app/chrome_main_mac.h",
7044 - "//chrome/app/chrome_main_mac.mm",
7045 - ]
7068 @@ -1035,8 +1104,8 @@ static_library("libcef_static") {
7072 - "//components/crash/core/app",
7078 @@ -1044,7 +1113,7 @@ static_library("libcef_static") {
7082 - if (toolkit_views) {
7087 @@ -1084,9 +1153,9 @@ static_library("libcef_static") {
7091 - "libcef/browser/views/layout_impl.h",
7098 @@ -1146,8 +1215,8 @@ static_library("libcef_static") {
7102 - "//ui/base/test/ui_controls_aura.cc",
7108 @@ -1164,8 +1233,10 @@ static_library("libcef_static") {
7119 @@ -1176,17 +1247,20 @@ static_library("libcef_static") {
7136 - "$root_gen_dir/ui/ozone/test_constructor_list.cc",
7141 @@ -1194,18 +1268,17 @@ static_library("libcef_static") {
7145 - deps += [
7146 - "//ui/ozone:generate_test_support_constructor_list",
7147 - ]
7158 - # Part of //ui/aura:test_support which is testingonly.
7159 - "//ui/aura/test/x11_event_sender.h",
7164 @@ -1215,11 +1288,24 @@ static_library("libcef_static") {
7170 - "//ui/events/test/events_test_utils.cc"
7190 @@ -1233,6 +1319,7 @@ static_library("libcef_static") {
7198 @@ -1245,7 +1332,6 @@ static_library("libcef_static") {
7202 -
7206 @@ -1266,6 +1352,7 @@ config("libcef_dll_wrapper_config") {
7214 @@ -1276,10 +1363,9 @@ config("libcef_dll_wrapper_config") {
7218 - sources = includes_common +
7219 - gypi_paths.autogen_cpp_includes +
7220 - gypi_paths2.includes_capi +
7221 - gypi_paths.autogen_capi_includes +
7228 @@ -1294,10 +1380,12 @@ static_library("libcef_dll_wrapper") {
7232 - deps = [ ":cef_make_headers" ]
7239 -
7243 @@ -1305,20 +1393,25 @@ static_library("libcef_dll_wrapper") {
7250 - deps = [ "libcef/features", "//sandbox" ]
7266 - "//sandbox/mac:seatbelt"
7271 @@ -1330,9 +1423,7 @@ if (is_mac) {
7275 - outputs = [
7276 - "grit/cef_strings.h",
7277 - ]
7279 all_locales = locales + [ "fake-bidi" ]
7282 @@ -1412,11 +1503,11 @@ make_pack_header("resources") {
7291 - "//content:content_resources",
7292 - "//content:dev_ui_content_resources",
7296 @@ -1428,7 +1519,7 @@ make_pack_header("resources") {
7300 - if (toolkit_views) {
7305 @@ -1477,12 +1568,9 @@ action("make_api_hash_header") {
7309 - inputs = gypi_paths2.includes_common_capi +
7310 - gypi_paths2.includes_linux_capi +
7311 - gypi_paths2.includes_mac_capi +
7312 - gypi_paths2.includes_win_capi +
7313 - gypi_paths2.includes_capi +
7314 - gypi_paths.autogen_capi_includes
7321 @@ -1501,14 +1589,13 @@ action("make_config_header") {
7325 - ":make_pack_header_resources",
7326 - ":make_pack_header_strings",
7334 -
7338 @@ -1535,13 +1622,11 @@ if (is_mac) {
7342 - public_deps += [ "//third_party/icu:icudata", ]
7347 - sources += [
7348 - "$root_out_dir/snapshot_blob.bin",
7349 - ]
7354 @@ -1549,9 +1634,7 @@ if (is_mac) {
7358 - outputs = [
7359 - "{{bundle_resources_dir}}/{{source_file_part}}",
7360 - ]
7365 @@ -1561,12 +1644,8 @@ if (is_mac) {
7369 - outputs = [
7370 - "{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
7371 - ]
7372 - public_deps = [
7373 - "//ui/gl:angle_library_copy",
7374 - ]
7380 @@ -1577,9 +1656,7 @@ if (is_mac) {
7384 - outputs = [
7385 - "{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
7386 - ]
7391 @@ -1589,17 +1666,13 @@ if (is_mac) {
7395 - deps = [
7396 - ":cef_framework_angle_binaries",
7397 - ]
7404 - deps = [
7405 - ":cef_framework_swiftshader_binaries",
7406 - ]
7411 @@ -1612,13 +1685,10 @@ if (is_mac) {
7415 - sources = includes_common +
7416 - includes_mac +
7417 - gypi_paths.autogen_cpp_includes +
7418 - gypi_paths2.includes_capi +
7419 - gypi_paths.autogen_capi_includes +
7420 - gypi_paths2.libcef_sources_common +
7421 - gypi_paths.autogen_library_side
7429 @@ -1627,9 +1697,7 @@ if (is_mac) {
7433 - configs += [
7434 - ":libcef_autogen_config",
7435 - ]
7440 @@ -1654,28 +1722,21 @@ if (is_mac) {
7444 - shared_library("libcef") {
7445 - sources = includes_common +
7446 - gypi_paths.autogen_cpp_includes +
7447 - gypi_paths2.includes_capi +
7448 - gypi_paths.autogen_capi_includes +
7449 - gypi_paths2.libcef_sources_common +
7450 - gypi_paths.autogen_library_side
7458 - deps = [
7459 - ":libcef_static",
7460 - ]
7463 - configs += [
7464 - ":libcef_autogen_config",
7465 - ]
7469 - sources += includes_win + [
7470 - "libcef_dll/libcef_dll.rc",
7471 - ]
7474 - deps += [
7479 @@ -1683,7 +1744,7 @@ if (is_mac) {
7483 - if (is_linux && !is_debug && use_allocator=="none") {
7488 @@ -1695,7 +1756,6 @@ if (is_mac) {
7492 -
7496 @@ -1713,9 +1773,7 @@ source_set("gtest_teamcity") {
7500 - deps = [
7501 - "//testing/gtest",
7502 - ]
7507 @@ -1758,9 +1816,8 @@ if (is_mac) {
7511 - extra_substitutions = [
7512 - "BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
7513 - ]
7519 @@ -1775,7 +1832,7 @@ if (is_mac) {
7522 "-rpath",
7523 - "@executable_path/../../../../../..",
7528 @@ -1813,24 +1870,16 @@ if (is_mac) {
7532 - sources = [
7533 - "$root_out_dir/$cef_framework_name.framework",
7534 - ]
7537 - public_deps = [
7538 - ":cef_framework",
7539 - ]
7543 - sources += [
7544 - "$root_out_dir/${app_helper_name}${helper_params[2]}.app",
7545 - ]
7550 - outputs = [
7551 - "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
7552 - ]
7557 @@ -1851,9 +1900,9 @@ if (is_mac) {
7564 - ":${app_name}_framework_bundle_data",
7568 @@ -1871,20 +1920,16 @@ if (is_mac) {
7572 -
7579 - gypi_paths2.cefclient_sources_resources + [
7580 - "tests/cefclient/resources/mac/cefclient.icns",
7581 - ]
7585 - outputs = [
7586 - "{{bundle_resources_dir}}/{{source_file_part}}",
7587 - ]
7592 @@ -1895,156 +1940,111 @@ if (is_mac) {
7596 - sources = [
7597 - "tests/cefclient/resources/mac/English.lproj/InfoPlist.strings",
7598 - ]
7602 - outputs = [
7603 - "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}",
7604 - ]
7609 - sources = [
7610 - "tests/cefclient/resources/mac/English.lproj/MainMenu.xib",
7611 - ]
7618 helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist"
7619 - helper_sources = includes_common +
7620 - includes_mac +
7621 - gypi_paths2.includes_wrapper +
7622 - gypi_paths2.includes_wrapper_mac +
7623 - gypi_paths2.shared_sources_common +
7624 - gypi_paths2.shared_sources_renderer +
7625 - gypi_paths2.shared_sources_mac_helper +
7626 - gypi_paths2.cefclient_sources_common +
7627 - gypi_paths2.cefclient_sources_renderer
7628 - helper_defines = [
7629 - "CEF_USE_SANDBOX",
7630 - ]
7641 - sources = includes_common +
7642 - includes_mac +
7643 - gypi_paths2.includes_wrapper +
7644 - gypi_paths2.includes_wrapper_mac +
7645 - gypi_paths2.shared_sources_browser +
7646 - gypi_paths2.shared_sources_common +
7647 - gypi_paths2.shared_sources_mac +
7648 - gypi_paths2.cefclient_sources_browser +
7649 - gypi_paths2.cefclient_sources_common +
7650 - gypi_paths2.cefclient_sources_mac
7659 - ":cefclient_resources_bundle_data_extensions_set_page_color",
7668 - defines = [
7669 - "CEF_USE_SANDBOX",
7670 - ]
7674 -
7680 - sources = [
7681 - "tests/cefsimple/mac/cefsimple.icns",
7682 - ]
7685 - outputs = [
7686 - "{{bundle_resources_dir}}/{{source_file_part}}",
7687 - ]
7692 - sources = [
7693 - "tests/cefsimple/mac/English.lproj/InfoPlist.strings",
7694 - ]
7697 - outputs = [
7698 - "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}",
7699 - ]
7704 - sources = [
7705 - "tests/cefsimple/mac/English.lproj/MainMenu.xib",
7706 - ]
7712 helper_info_plist = "tests/cefsimple/mac/helper-Info.plist"
7713 - helper_sources = includes_common +
7714 - includes_mac +
7715 - gypi_paths2.includes_wrapper +
7716 - gypi_paths2.includes_wrapper_mac +
7717 - gypi_paths2.cefsimple_sources_mac_helper
7718 - helper_defines = [
7719 - "CEF_USE_SANDBOX",
7720 - ]
7728 - sources = includes_common +
7729 - includes_mac +
7730 - gypi_paths2.includes_wrapper +
7731 - gypi_paths2.includes_wrapper_mac +
7732 - gypi_paths2.cefsimple_sources_common +
7733 - gypi_paths2.cefsimple_sources_mac
7743 - frameworks = [
7744 - "AppKit.framework",
7745 - ]
7746 - defines = [
7747 - "CEF_USE_SANDBOX",
7748 - ]
7753 -
7759 - sources = gypi_paths2.shared_sources_resources + [
7760 - "tests/ceftests/resources/mac/ceftests.icns",
7761 - ]
7765 - outputs = [
7766 - "{{bundle_resources_dir}}/{{source_file_part}}",
7767 - ]
7772 - sources = [
7773 - "tests/ceftests/resources/mac/English.lproj/InfoPlist.strings",
7774 - ]
7777 - outputs = [
7778 - "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}",
7779 - ]
7784 - sources = [
7785 - "tests/ceftests/resources/mac/English.lproj/MainMenu.xib",
7786 - ]
7791 @@ -2060,23 +2060,15 @@ if (is_mac) {
7795 - helper_frameworks = [
7796 - "AppKit.framework",
7797 - ]
7798 - helper_defines = [
7799 - "CEF_USE_SANDBOX",
7800 - ]
7805 - sources = includes_common +
7806 - includes_mac +
7807 - gypi_paths2.includes_wrapper +
7808 - gypi_paths2.includes_wrapper_mac +
7809 - gypi_paths2.shared_sources_browser +
7810 - gypi_paths2.shared_sources_common +
7811 - gypi_paths2.shared_sources_mac +
7812 - gypi_paths2.ceftests_sources_common +
7813 - gypi_paths2.ceftests_sources_mac
7822 @@ -2084,12 +2076,8 @@ if (is_mac) {
7826 - frameworks = [
7827 - "AppKit.framework",
7828 - ]
7829 - defines = [
7830 - "CEF_USE_SANDBOX",
7831 - ]
7837 @@ -2100,9 +2088,7 @@ if (is_mac) {
7841 - packages = [
7842 - "glib-2.0",
7843 - ]
7844 + packages = [ "glib-2.0" ]
7848 @@ -2126,42 +2112,37 @@ if (is_mac) {
7852 - sources = gypi_paths2.cefclient_sources_resources_extensions_set_page_color
7860 - sources = includes_common +
7861 - gypi_paths2.includes_wrapper +
7862 - gypi_paths2.shared_sources_browser +
7863 - gypi_paths2.shared_sources_common +
7864 - gypi_paths2.shared_sources_renderer +
7865 - gypi_paths2.cefclient_sources_browser +
7866 - gypi_paths2.cefclient_sources_common +
7867 - gypi_paths2.cefclient_sources_renderer
7877 - ":libcef",
7882 - defines = [
7883 - "CEF_USE_SANDBOX",
7884 - ]
7888 - sources += includes_win +
7889 - gypi_paths2.shared_sources_win +
7894 configs -= [ "//build/config/win:console" ]
7897 - defines += [
7898 - "CEF_USE_ATL",
7899 - ]
7904 @@ -2180,14 +2161,13 @@ if (is_mac) {
7908 - "glu32.lib"
7915 - sources += includes_linux +
7916 - gypi_paths2.shared_sources_linux +
7921 @@ -2201,13 +2181,11 @@ if (is_mac) {
7925 - configs += [
7926 - ":gtk",
7927 - ]
7932 - if (use_allocator=="tcmalloc") {
7937 @@ -2219,28 +2197,23 @@ if (is_mac) {
7941 -
7947 - sources = includes_common +
7948 - gypi_paths2.includes_wrapper +
7953 - ":libcef",
7958 - defines = [
7959 - "CEF_USE_SANDBOX",
7960 - ]
7964 - sources += includes_win +
7965 - gypi_paths2.cefsimple_sources_win
7969 configs -= [ "//build/config/win:console" ]
7970 @@ -2259,13 +2232,10 @@ if (is_mac) {
7974 - sources += includes_linux +
7975 - gypi_paths2.cefsimple_sources_linux
7979 - libs = [
7980 - "X11",
7981 - ]
7986 @@ -2275,11 +2245,10 @@ if (is_mac) {
7990 -
7994 -
7999 @@ -2290,27 +2259,24 @@ if (is_mac) {
8003 - sources = includes_common +
8004 - gypi_paths2.includes_wrapper +
8005 - gypi_paths2.shared_sources_browser +
8006 - gypi_paths2.shared_sources_common +
8007 - gypi_paths2.shared_sources_renderer +
8008 - gypi_paths2.ceftests_sources_common
8016 - ":libcef",
8017 - ":libcef_dll_wrapper",
8024 - defines = [
8025 - "CEF_USE_SANDBOX",
8026 - ]
8030 - sources += gypi_paths2.shared_sources_win +
8031 - gypi_paths2.ceftests_sources_win
8037 @@ -2319,22 +2285,18 @@ if (is_mac) {
8041 - sources += gypi_paths2.shared_sources_linux +
8042 - gypi_paths2.ceftests_sources_linux
8047 - libs = [
8048 - "X11",
8049 - ]
8057 - deps += [
8058 - ":copy_ceftests_files",
8059 - ]
8064 diff --git a/src/cef/cef_paths.gypi b/src/cef/cef_paths.gypi
8066 --- a/src/cef/cef_paths.gypi
8068 @@ -8,7 +8,7 @@
8072 -# $hash=872dedb7e5a2f36745446c3d0c9ad8bd5850adb7$
8077 @@ -26,6 +26,7 @@
8085 @@ -54,6 +55,7 @@
8093 @@ -85,6 +87,7 @@
8101 @@ -125,6 +128,7 @@
8109 @@ -153,6 +157,7 @@
8117 @@ -184,6 +189,7 @@
8125 @@ -212,6 +218,8 @@
8134 @@ -230,6 +238,8 @@
8143 @@ -264,6 +274,8 @@
8152 @@ -306,14 +318,24 @@
8177 @@ -362,6 +384,8 @@
8186 @@ -414,6 +438,8 @@
8195 @@ -432,6 +458,8 @@
8204 @@ -506,6 +534,8 @@
8213 @@ -522,6 +552,8 @@
8222 @@ -540,6 +572,8 @@
8231 @@ -574,6 +608,8 @@
8240 @@ -616,14 +652,24 @@
8265 @@ -672,6 +718,8 @@
8274 @@ -724,6 +772,8 @@
8283 @@ -742,6 +792,8 @@
8292 @@ -816,6 +868,8 @@
8301 diff --git a/src/cef/cef_paths2.gypi b/src/cef/cef_paths2.gypi
8303 --- a/src/cef/cef_paths2.gypi
8305 @@ -117,15 +117,15 @@
8309 - 'libcef_dll/base/cef_atomic_flag.cc',
8310 - 'libcef_dll/base/cef_callback_helpers.cc',
8311 - 'libcef_dll/base/cef_callback_internal.cc',
8320 - 'libcef_dll/base/cef_weak_ptr.cc',
8325 @@ -197,6 +197,9 @@
8335 diff --git a/src/cef/include/base/cef_macros.h b/src/cef/include/base/cef_macros.h
8337 --- a/src/cef/include/base/cef_macros.h
8339 @@ -42,7 +42,8 @@
8340 // //styleguide/c++/c++-dos-and-donts.md for more information.
8343 -#define DISALLOW_COPY(TypeName) TypeName(const TypeName&) = delete
8349 diff --git a/src/cef/include/capi/cef_auth_callback_capi.h b/src/cef/include/capi/cef_auth_callback…
8351 --- a/src/cef/include/capi/cef_auth_callback_capi.h
8353 @@ -33,7 +33,7 @@
8357 -// $hash=01a33de48ac9780f78d606d8aee2429ddb0c81a2$
8362 @@ -67,6 +67,11 @@ typedef struct _cef_auth_callback_t {
8374 diff --git a/src/cef/include/capi/cef_browser_capi.h b/src/cef/include/capi/cef_browser_capi.h
8376 --- a/src/cef/include/capi/cef_browser_capi.h
8378 @@ -33,7 +33,7 @@
8382 -// $hash=b80e84c0039ab45d5c4562d64b67a84766c0dab3$
8387 @@ -46,8 +46,10 @@
8398 @@ -55,6 +57,8 @@ extern "C" {
8407 @@ -101,6 +105,23 @@ typedef struct _cef_browser_t {
8431 @@ -116,6 +137,18 @@ typedef struct _cef_browser_t {
8450 @@ -192,6 +225,24 @@ typedef struct _cef_browser_t {
8475 @@ -303,6 +354,12 @@ typedef struct _cef_browser_host_t {
8488 @@ -462,7 +519,8 @@ typedef struct _cef_browser_host_t {
8492 - int findNext);
8498 @@ -618,6 +676,12 @@ typedef struct _cef_browser_host_t {
8511 @@ -711,6 +775,158 @@ typedef struct _cef_browser_host_t {
8670 @@ -727,10 +943,11 @@ typedef struct _cef_browser_host_t {
8674 - // A. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR
8678 - // B. The client receives a "commit" signal of GtkIMContext (on Linux), or;
8679 - // C. insertText of NSTextInput is called (on Mac).
8685 @@ -911,6 +1128,73 @@ typedef struct _cef_browser_host_t {
8759 @@ -947,6 +1231,44 @@ CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync(
8804 diff --git a/src/cef/include/capi/cef_callback_capi.h b/src/cef/include/capi/cef_callback_capi.h
8806 --- a/src/cef/include/capi/cef_callback_capi.h
8808 @@ -33,7 +33,7 @@
8812 -// $hash=10ef5088ce2a5c6ffb38f8864d3aad6e5ac88b40$
8817 @@ -81,6 +81,37 @@ typedef struct _cef_completion_callback_t {
8855 diff --git a/src/cef/include/capi/cef_client_capi.h b/src/cef/include/capi/cef_client_capi.h
8857 --- a/src/cef/include/capi/cef_client_capi.h
8859 @@ -33,7 +33,7 @@
8863 -// $hash=8b099ca3b9cfbd41840cdf64586a0b884abaffae$
8868 @@ -54,6 +54,7 @@
8876 @@ -75,121 +76,133 @@ typedef struct _cef_client_t {
8880 - struct _cef_audio_handler_t*(CEF_CALLBACK* get_audio_handler)(
8881 - struct _cef_client_t* self);
8889 - struct _cef_context_menu_handler_t*(CEF_CALLBACK* get_context_menu_handler)(
8890 - struct _cef_client_t* self);
8898 - struct _cef_dialog_handler_t*(CEF_CALLBACK* get_dialog_handler)(
8899 - struct _cef_client_t* self);
8906 - struct _cef_display_handler_t*(CEF_CALLBACK* get_display_handler)(
8907 - struct _cef_client_t* self);
8915 - struct _cef_download_handler_t*(CEF_CALLBACK* get_download_handler)(
8916 - struct _cef_client_t* self);
8923 - struct _cef_drag_handler_t*(CEF_CALLBACK* get_drag_handler)(
8924 - struct _cef_client_t* self);
8931 - struct _cef_find_handler_t*(CEF_CALLBACK* get_find_handler)(
8932 - struct _cef_client_t* self);
8939 - struct _cef_focus_handler_t*(CEF_CALLBACK* get_focus_handler)(
8940 - struct _cef_client_t* self);
8949 - struct _cef_frame_handler_t*(CEF_CALLBACK* get_frame_handler)(
8950 - struct _cef_client_t* self);
8958 - struct _cef_jsdialog_handler_t*(CEF_CALLBACK* get_jsdialog_handler)(
8959 - struct _cef_client_t* self);
8966 - struct _cef_keyboard_handler_t*(CEF_CALLBACK* get_keyboard_handler)(
8967 - struct _cef_client_t* self);
8974 - struct _cef_life_span_handler_t*(CEF_CALLBACK* get_life_span_handler)(
8975 - struct _cef_client_t* self);
8982 - struct _cef_load_handler_t*(CEF_CALLBACK* get_load_handler)(
8983 - struct _cef_client_t* self);
8991 - struct _cef_print_handler_t*(CEF_CALLBACK* get_print_handler)(
8992 - struct _cef_client_t* self);
8997 // Return the handler for off-screen rendering events.
8999 - struct _cef_render_handler_t*(CEF_CALLBACK* get_render_handler)(
9000 - struct _cef_client_t* self);
9007 - struct _cef_request_handler_t*(CEF_CALLBACK* get_request_handler)(
9008 - struct _cef_client_t* self);
9023 - int(CEF_CALLBACK* on_process_message_received)(
9024 - struct _cef_client_t* self,
9025 - struct _cef_browser_t* browser,
9026 - struct _cef_frame_t* frame,
9027 - cef_process_id_t source_process,
9028 - struct _cef_process_message_t* message);
9047 -#endif // CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
9049 diff --git a/src/cef/include/capi/cef_context_menu_handler_capi.h b/src/cef/include/capi/cef_contex…
9051 --- a/src/cef/include/capi/cef_context_menu_handler_capi.h
9053 @@ -33,7 +33,7 @@
9057 -// $hash=fd33ce439e4379d231b6be16bdc1786f314d98e4$
9062 @@ -43,6 +43,7 @@
9070 @@ -74,6 +75,29 @@ typedef struct _cef_run_context_menu_callback_t {
9100 @@ -139,6 +163,61 @@ typedef struct _cef_context_menu_handler_t {
9162 diff --git a/src/cef/include/capi/cef_cookie_capi.h b/src/cef/include/capi/cef_cookie_capi.h
9164 --- a/src/cef/include/capi/cef_cookie_capi.h
9166 @@ -33,7 +33,7 @@
9170 -// $hash=d9790a35d74621e985b917935a4fca74ba7db1e0$
9175 @@ -61,6 +61,49 @@ typedef struct _cef_cookie_manager_t {
9225 @@ -110,6 +153,7 @@ typedef struct _cef_cookie_manager_t {
9233 @@ -132,6 +176,15 @@ typedef struct _cef_cookie_manager_t {
9249 @@ -154,6 +207,14 @@ typedef struct _cef_cookie_visitor_t {
9264 diff --git a/src/cef/include/capi/cef_data_base_capi.h b/src/cef/include/capi/cef_data_base_capi.h
9267 --- /dev/null
9269 @@ -0,0 +1,142 @@
9299 +// ---------------------------------------------------------------------------
9412 diff --git a/src/cef/include/capi/cef_dialog_handler_capi.h b/src/cef/include/capi/cef_dialog_handl…
9414 --- a/src/cef/include/capi/cef_dialog_handler_capi.h
9416 @@ -33,7 +33,7 @@
9420 -// $hash=0f56154217707d141912dc8a298279df8df04311$
9425 @@ -106,6 +106,7 @@ typedef struct _cef_dialog_handler_t {
9433 diff --git a/src/cef/include/capi/cef_display_handler_capi.h b/src/cef/include/capi/cef_display_han…
9435 --- a/src/cef/include/capi/cef_display_handler_capi.h
9437 @@ -33,7 +33,7 @@
9441 -// $hash=142637539a094a03adc71d2f3f5b711ba64918b1$
9446 @@ -80,6 +80,36 @@ typedef struct _cef_display_handler_t {
9483 @@ -154,6 +184,14 @@ typedef struct _cef_display_handler_t {
9498 diff --git a/src/cef/include/capi/cef_frame_capi.h b/src/cef/include/capi/cef_frame_capi.h
9500 --- a/src/cef/include/capi/cef_frame_capi.h
9502 @@ -33,7 +33,7 @@
9506 -// $hash=8527ceea6b8778d6fabc1b4ef82e4faa06ba777a$
9511 @@ -52,6 +52,7 @@ extern "C" {
9519 @@ -214,6 +215,18 @@ typedef struct _cef_frame_t {
9527 + // types or the User-Agent, their values may be overridden by this WebView's
9538 @@ -253,8 +266,32 @@ typedef struct _cef_frame_t {
9571 diff --git a/src/cef/include/capi/cef_life_span_handler_capi.h b/src/cef/include/capi/cef_life_span…
9573 --- a/src/cef/include/capi/cef_life_span_handler_capi.h
9575 @@ -33,7 +33,7 @@
9579 -// $hash=34a6559587adbd0dc3143989a8c6e49e0664b43e$
9584 @@ -100,6 +100,17 @@ typedef struct _cef_life_span_handler_t {
9602 diff --git a/src/cef/include/capi/cef_load_handler_capi.h b/src/cef/include/capi/cef_load_handler_c…
9604 --- a/src/cef/include/capi/cef_load_handler_capi.h
9606 @@ -33,7 +33,7 @@
9610 -// $hash=f51b6a0dbf264fa43ea3199327a5adb1044bfc04$
9615 @@ -42,7 +42,9 @@
9625 @@ -117,6 +119,52 @@ typedef struct _cef_load_handler_t {
9678 diff --git a/src/cef/include/capi/cef_navigation_entry_capi.h b/src/cef/include/capi/cef_navigation…
9680 --- a/src/cef/include/capi/cef_navigation_entry_capi.h
9682 @@ -33,7 +33,7 @@
9686 -// $hash=3a7dd4a6a1b5e0d9191be6c4dd2f0135f43de643$
9691 @@ -123,6 +123,16 @@ typedef struct _cef_navigation_entry_t {
9708 diff --git a/src/cef/include/capi/cef_permission_request_capi.h b/src/cef/include/capi/cef_permissi…
9711 --- /dev/null
9713 @@ -0,0 +1,221 @@
9743 +// ---------------------------------------------------------------------------
9935 diff --git a/src/cef/include/capi/cef_render_handler_capi.h b/src/cef/include/capi/cef_render_handl…
9937 --- a/src/cef/include/capi/cef_render_handler_capi.h
9939 @@ -33,7 +33,7 @@
9943 -// $hash=79fba8a1a86cc65251dd7251e0863dd20205bb3b$
9948 @@ -159,6 +159,36 @@ typedef struct _cef_render_handler_t {
9985 @@ -198,6 +228,14 @@ typedef struct _cef_render_handler_t {
10000 @@ -225,12 +263,14 @@ typedef struct _cef_render_handler_t {
10001 // Called when an on-screen keyboard should be shown or hidden for the
10004 - // for this browser should be hidden.
10011 - cef_text_input_mode_t input_mode);
10017 diff --git a/src/cef/include/capi/cef_request_context_capi.h b/src/cef/include/capi/cef_request_con…
10019 --- a/src/cef/include/capi/cef_request_context_capi.h
10021 @@ -33,7 +33,7 @@
10025 -// $hash=89e64a2db658ad560e85ea5d3e564a6505d4e914$
10030 @@ -42,10 +42,12 @@
10043 @@ -139,6 +141,21 @@ typedef struct _cef_request_context_t {
10054 + // Returns the web strorage for this object. If |callback| is non-NULL it will
10065 @@ -237,6 +254,16 @@ typedef struct _cef_request_context_t {
10072 + // |callback| is non-NULL it will be executed on the UI thread after
10082 diff --git a/src/cef/include/capi/cef_request_handler_capi.h b/src/cef/include/capi/cef_request_han…
10084 --- a/src/cef/include/capi/cef_request_handler_capi.h
10086 @@ -33,7 +33,7 @@
10090 -// $hash=4a05a0a7cd4a279ccf8455a3cb2f77de581b597a$
10095 @@ -54,24 +54,6 @@
10099 -///
10100 -// Callback structure used to select a client certificate for authentication.
10101 -///
10102 -typedef struct _cef_select_client_certificate_callback_t {
10103 - ///
10104 - // Base structure.
10105 - ///
10106 - cef_base_ref_counted_t base;
10107 -
10108 - ///
10109 - // Chooses the specified certificate for client certificate authentication.
10110 - // NULL value means that no client certificate should be used.
10111 - ///
10112 - void(CEF_CALLBACK* select)(
10113 - struct _cef_select_client_certificate_callback_t* self,
10114 - struct _cef_x509certificate_t* cert);
10115 -} cef_select_client_certificate_callback_t;
10116 -
10120 @@ -224,6 +206,8 @@ typedef struct _cef_request_handler_t {
10129 diff --git a/src/cef/include/capi/cef_web_storage_capi.h b/src/cef/include/capi/cef_web_storage_cap…
10132 --- /dev/null
10134 @@ -0,0 +1,161 @@
10164 +// ---------------------------------------------------------------------------
10296 diff --git a/src/cef/include/cef_api_hash.h b/src/cef/include/cef_api_hash.h
10298 --- a/src/cef/include/cef_api_hash.h
10300 @@ -42,13 +42,15 @@
10304 -#define CEF_API_HASH_UNIVERSAL "58a564a53597120d05cedf5bcd355064168af0a7"
10307 -#define CEF_API_HASH_PLATFORM "5fa37a277dca51dee1d13058e6218dc1e2e68adb"
10310 -#define CEF_API_HASH_PLATFORM "77dc909a3d568d3b98fe32fa040801f748656ad2"
10313 -#define CEF_API_HASH_PLATFORM "76077b5939104ed96c1378a24d4acbb1ae4e3cb5"
10320 diff --git a/src/cef/include/cef_auth_callback.h b/src/cef/include/cef_auth_callback.h
10322 --- a/src/cef/include/cef_auth_callback.h
10324 @@ -59,6 +59,12 @@ class CefAuthCallback : public virtual CefBaseRefCounted {
10326 /*--cef()--*/
10332 + /*--cef()--*/
10337 diff --git a/src/cef/include/cef_base.h b/src/cef/include/cef_base.h
10339 --- a/src/cef/include/cef_base.h
10341 @@ -42,7 +42,7 @@
10345 -#elif defined(OS_LINUX)
10350 diff --git a/src/cef/include/cef_browser.h b/src/cef/include/cef_browser.h
10352 --- a/src/cef/include/cef_browser.h
10354 @@ -45,11 +45,15 @@
10370 @@ -98,6 +102,24 @@ class CefBrowser : public virtual CefBaseRefCounted {
10371 /*--cef()--*/
10377 + /*--cef()--*/
10383 + /*--cef()--*/
10389 + /*--cef()--*/
10395 @@ -116,6 +138,21 @@ class CefBrowser : public virtual CefBaseRefCounted {
10396 /*--cef()--*/
10399 + /* ---------- ohos nweb_ex add begin --------- */
10403 + /*--cef()--*/
10409 + /*--cef()--*/
10412 + /* ---------- ohos nweb_ex add end --------- */
10417 @@ -195,6 +232,26 @@ class CefBrowser : public virtual CefBaseRefCounted {
10419 /*--cef()--*/
10425 + /*--cef()--*/
10431 + /*--cef()--*/
10434 + /* ---------- ohos_nweb_ex add begin --------- */
10438 + /*--cef()--*/
10440 + /* ---------- ohos_nweb_ex add end --------- */
10444 @@ -329,6 +386,12 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
10445 /*--cef()--*/
10451 + /*--cef()--*/
10457 @@ -491,7 +554,8 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
10461 - bool findNext) = 0;
10467 @@ -648,6 +712,12 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
10468 /*--cef()--*/
10474 + /*--cef()--*/
10480 @@ -738,26 +808,184 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
10481 /*--cef()--*/
10484 + /* ---------- ohos webview add begin --------- */
10490 + /*--cef()--*/
10497 + /*--cef()--*/
10503 + /*--cef()--*/
10509 + /*--cef()--*/
10515 + /*--cef()--*/
10523 + /*--cef(optional_param=method_list)--*/
10531 + /*--cef()--*/
10537 + /* ---------- ohos webview add end --------- */
10542 + /*--cef()--*/
10548 + /*--cef()--*/
10554 + /*--cef()--*/
10562 + /*--cef()--*/
10568 + /*--cef()--*/
10574 + /*--cef()--*/
10580 + /*--cef()--*/
10588 + /*--cef()--*/
10594 + /*--cef()--*/
10600 + /*--cef()--*/
10606 + /*--cef()--*/
10617 + /*--cef(optional_param=baseUrl, optional_param=data, optional_param=mimeType,
10618 + optional_param=encoding, optional_param=historyUrl)--*/
10629 + /*--cef(optional_param=data, optional_param=mimeType, optional_param=encoding,)--*/
10637 + /*--cef(optional_param=urls)--*/
10641 - // Begins a new composition or updates the existing composition. Blink has a
10642 - // special node (a composition node) that allows the input method to change
10643 - // text without affecting other DOM nodes. |text| is the optional text that
10644 - // will be inserted into the composition node. |underlines| is an optional set
10645 - // of ranges that will be underlined in the resulting text.
10646 - // |replacement_range| is an optional range of the existing text that will be
10647 - // replaced. |selection_range| is an optional range of the resulting text that
10648 - // will be selected after insertion or replacement. The |replacement_range|
10649 - // value is only used on OS X.
10660 - // This method may be called multiple times as the composition changes. When
10661 - // the client is done making changes the composition should either be canceled
10662 - // or completed. To cancel the composition call ImeCancelComposition. To
10663 - // complete the composition call either ImeCommitText or
10664 - // ImeFinishComposingText. Completion is usually signaled when:
10665 - // A. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR
10675 - // B. The client receives a "commit" signal of GtkIMContext (on Linux), or;
10676 - // C. insertText of NSTextInput is called (on Mac).
10682 @@ -939,6 +1167,107 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
10684 /*--cef()--*/
10690 + /*--cef()--*/
10698 + /*--cef()--*/
10704 + /*--cef()--*/
10710 + /*--cef()--*/
10716 + /*--cef()--*/
10722 + /*--cef()--*/
10728 + /*--cef()--*/
10734 + /*--cef()--*/
10740 + /*--cef()--*/
10746 + /*--cef()--*/
10752 + /*--cef()--*/
10760 +/*--cef(source=client)--*/
10767 + /*--cef()--*/
10771 +/* ---------- ohos webview add begin --------- */
10776 +/*--cef(source=client)--*/
10784 + /*--cef(optional_param=result)--*/
10787 +/* ---------- ohos webview add end --------- */
10790 diff --git a/src/cef/include/cef_callback.h b/src/cef/include/cef_callback.h
10792 --- a/src/cef/include/cef_callback.h
10794 @@ -72,4 +72,31 @@ class CefCompletionCallback : public virtual CefBaseRefCounted {
10801 +/*--cef(source=library)--*/
10808 + /*--cef(optional_param=cert)--*/
10815 + /*--cef()--*/
10821 + /*--cef()--*/
10826 diff --git a/src/cef/include/cef_client.h b/src/cef/include/cef_client.h
10828 --- a/src/cef/include/cef_client.h
10830 @@ -52,6 +52,7 @@
10838 @@ -168,6 +169,12 @@ class CefClient : public virtual CefBaseRefCounted {
10839 /*--cef()--*/
10845 + /*--cef()--*/
10851 @@ -180,6 +187,17 @@ class CefClient : public virtual CefBaseRefCounted {
10859 + /*--cef()--*/
10869 diff --git a/src/cef/include/cef_config.h b/src/cef/include/cef_config.h
10872 --- /dev/null
10874 @@ -0,0 +1,40 @@
10904 +// ---------------------------------------------------------------------------
10915 diff --git a/src/cef/include/cef_context_menu_handler.h b/src/cef/include/cef_context_menu_handler.h
10917 --- a/src/cef/include/cef_context_menu_handler.h
10919 @@ -41,6 +41,7 @@
10927 @@ -51,14 +52,12 @@ class CefContextMenuParams;
10928 /*--cef(source=library)--*/
10931 - typedef cef_event_flags_t EventFlags;
10932 -
10937 /*--cef(capi_name=cont)--*/
10938 - virtual void Continue(int command_id, EventFlags event_flags) = 0;
10943 @@ -67,6 +66,26 @@ class CefRunContextMenuCallback : public virtual CefBaseRefCounted {
10950 +/*--cef(source=library)--*/
10957 + /*--cef(capi_name=cont)--*/
10963 + /*--cef()--*/
10970 @@ -75,6 +94,7 @@ class CefRunContextMenuCallback : public virtual CefBaseRefCounted {
10978 @@ -131,6 +151,61 @@ class CefContextMenuHandler : public virtual CefBaseRefCounted {
10979 /*--cef()--*/
10991 + /*--cef()--*/
11007 + /*--cef()--*/
11019 + /*--cef()--*/
11027 + /*--cef()--*/
11035 + /*--cef()--*/
11040 diff --git a/src/cef/include/cef_cookie.h b/src/cef/include/cef_cookie.h
11042 --- a/src/cef/include/cef_cookie.h
11044 @@ -64,6 +64,55 @@ class CefCookieManager : public virtual CefBaseRefCounted {
11052 + /*--cef()--*/
11061 + /*--cef()--*/
11067 + /*--cef()--*/
11074 + /*--cef()--*/
11080 + /*--cef()--*/
11087 + /*--cef()--*/
11094 + /*--cef()--*/
11100 @@ -113,6 +162,7 @@ class CefCookieManager : public virtual CefBaseRefCounted {
11101 optional_param=callback)--*/
11108 @@ -143,6 +193,14 @@ class CefCookieVisitor : public virtual CefBaseRefCounted {
11118 + /*--cef()--*/
11123 diff --git a/src/cef/include/cef_data_base.h b/src/cef/include/cef_data_base.h
11126 --- /dev/null
11128 @@ -0,0 +1,129 @@
11158 +// ---------------------------------------------------------------------------
11175 +/*--cef(source=library,no_debugct_check)--*/
11181 + /*--cef()--*/
11187 + /*--cef()--*/
11193 + /*--cef()--*/
11199 + /*--cef()--*/
11208 + /*--cef()--*/
11218 + /*--cef()--*/
11224 + /*--cef()--*/
11232 + /*--cef()--*/
11240 + /*--cef()--*/
11246 + /*--cef()--*/
11252 + /*--cef()--*/
11259 diff --git a/src/cef/include/cef_dialog_handler.h b/src/cef/include/cef_dialog_handler.h
11261 --- a/src/cef/include/cef_dialog_handler.h
11263 @@ -98,6 +98,7 @@ class CefDialogHandler : public virtual CefBaseRefCounted {
11271 diff --git a/src/cef/include/cef_display_handler.h b/src/cef/include/cef_display_handler.h
11273 --- a/src/cef/include/cef_display_handler.h
11275 @@ -71,6 +71,35 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
11282 + /*--cef()--*/
11290 + /*--cef()--*/
11300 + /*--cef()--*/
11311 @@ -148,6 +177,14 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
11319 + /*--cef()--*/
11326 diff --git a/src/cef/include/cef_frame.h b/src/cef/include/cef_frame.h
11328 --- a/src/cef/include/cef_frame.h
11330 @@ -49,6 +49,7 @@ class CefBrowser;
11338 @@ -219,6 +220,17 @@ class CefFrame : public virtual CefBaseRefCounted {
11339 /*--cef()--*/
11346 + // accept types or the User-Agent, their values may be overridden by this
11349 + /*--cef(optional_param=url, optional_param=additionalHttpHeaders)--*/
11356 @@ -256,6 +268,27 @@ class CefFrame : public virtual CefBaseRefCounted {
11357 /*--cef()--*/
11364 + /*--cef()--*/
11372 +/*--cef(source=client)--*/
11379 + /*--cef()--*/
11384 diff --git a/src/cef/include/cef_life_span_handler.h b/src/cef/include/cef_life_span_handler.h
11386 --- a/src/cef/include/cef_life_span_handler.h
11388 @@ -50,7 +50,7 @@ class CefClient;
11390 /*--cef(source=client)--*/
11392 - public:
11397 @@ -94,6 +94,18 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
11404 + /*--cef(optional_param=target_url)--*/
11416 @@ -210,4 +222,4 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
11420 -#endif // CEF_INCLUDE_CEF_LIFE_SPAN_HANDLER_H_
11422 diff --git a/src/cef/include/cef_load_handler.h b/src/cef/include/cef_load_handler.h
11424 --- a/src/cef/include/cef_load_handler.h
11426 @@ -40,7 +40,9 @@
11436 @@ -111,6 +113,50 @@ class CefLoadHandler : public virtual CefBaseRefCounted {
11444 + /*--cef()--*/
11454 + /*--cef()--*/
11463 + /*--cef()--*/
11473 + /*--cef(optional_param=url)--*/
11481 + /*--cef(optional_param=url)--*/
11487 diff --git a/src/cef/include/cef_navigation_entry.h b/src/cef/include/cef_navigation_entry.h
11489 --- a/src/cef/include/cef_navigation_entry.h
11491 @@ -115,6 +115,16 @@ class CefNavigationEntry : public virtual CefBaseRefCounted {
11493 /*--cef()--*/
11499 + /*--cef()--*/
11508 diff --git a/src/cef/include/cef_permission_request.h b/src/cef/include/cef_permission_request.h
11511 --- /dev/null
11513 @@ -0,0 +1,149 @@
11515 +// Use of this source code is governed by a BSD-style license that can be
11528 +/*--cef(source=library)--*/
11534 + /*--cef()--*/
11539 + /*--cef()--*/
11544 + /*--cef()--*/
11551 +/*--cef(source=client,no_debugct_check)--*/
11560 + /*--cef()--*/
11565 + /*--cef()--*/
11573 + /*--cef()--*/
11578 + /*--cef()--*/
11586 +/*--cef(source=library)--*/
11592 + /*--cef()--*/
11598 + /*--cef()--*/
11603 + /*--cef()--*/
11610 + /*--cef()--*/
11616 + /*--cef()--*/
11622 + /*--cef()--*/
11627 + /*--cef()--*/
11635 +/*--cef(source=library)--*/
11642 + /*--cef()--*/
11648 + /*--cef()--*/
11653 + /*--cef()--*/
11658 + /*--cef()--*/
11664 diff --git a/src/cef/include/cef_render_handler.h b/src/cef/include/cef_render_handler.h
11666 --- a/src/cef/include/cef_render_handler.h
11668 @@ -161,6 +161,34 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
11676 + /*--cef()--*/
11685 + /*--cef()--*/
11693 + /*--cef()--*/
11703 @@ -202,6 +230,14 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
11710 + /*--cef()--*/
11718 @@ -226,11 +262,13 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
11719 // Called when an on-screen keyboard should be shown or hidden for the
11722 - // existing keyboard for this browser should be hidden.
11726 /*--cef()--*/
11728 - TextInputMode input_mode) {}
11734 diff --git a/src/cef/include/cef_request_context.h b/src/cef/include/cef_request_context.h
11736 --- a/src/cef/include/cef_request_context.h
11738 @@ -42,10 +42,12 @@
11751 @@ -153,6 +155,21 @@ class CefRequestContext : public virtual CefBaseRefCounted {
11758 + /*--cef()--*/
11762 + // Returns the web strorage for this object. If |callback| is non-NULL it
11766 + /*--cef(optional_param=callback)--*/
11773 @@ -250,6 +267,16 @@ class CefRequestContext : public virtual CefBaseRefCounted {
11780 + // If |callback| is non-NULL it will be executed on the UI thread after
11783 + /*--cef(optional_param=callback)--*/
11790 diff --git a/src/cef/include/cef_request_handler.h b/src/cef/include/cef_request_handler.h
11792 --- a/src/cef/include/cef_request_handler.h
11794 @@ -50,20 +50,6 @@
11798 -///
11799 -// Callback interface used to select a client certificate for authentication.
11800 -///
11801 -/*--cef(source=library)--*/
11802 -class CefSelectClientCertificateCallback : public virtual CefBaseRefCounted {
11803 - public:
11804 - ///
11805 - // Chooses the specified certificate for client certificate authentication.
11806 - // NULL value means that no client certificate should be used.
11807 - ///
11808 - /*--cef(optional_param=cert)--*/
11809 - virtual void Select(CefRefPtr<CefX509Certificate> cert) = 0;
11810 -};
11811 -
11815 @@ -223,6 +209,8 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
11824 diff --git a/src/cef/include/cef_web_storage.h b/src/cef/include/cef_web_storage.h
11827 --- /dev/null
11829 @@ -0,0 +1,113 @@
11831 +// Use of this source code is governed by a BSD-style license that can be
11849 +/*--cef(source=library,no_debugct_check)--*/
11855 + /*--cef(optional_param=callback)--*/
11862 + /*--cef()--*/
11869 + /*--cef()--*/
11875 + /*--cef(optional_param=callback)--*/
11881 + /*--cef(optional_param=origin,optional_param=callback)--*/
11890 + /*--cef(optional_param=origin,optional_param=callback)--*/
11900 +/*--cef(source=client)--*/
11906 + /*--cef()--*/
11912 + /*--cef()--*/
11918 + /*--cef()--*/
11924 + /*--cef()--*/
11932 +/*--cef(source=client)--*/
11938 + /*--cef()--*/
11943 diff --git a/src/cef/include/internal/cef_types.h b/src/cef/include/internal/cef_types.h
11945 --- a/src/cef/include/internal/cef_types.h
11947 @@ -31,7 +31,10 @@
11958 @@ -42,10 +45,19 @@
11962 -#elif defined(OS_LINUX)
11976 // 32-bit ARGB color value, not premultiplied. The color components are always
11979 @@ -646,6 +658,26 @@ typedef struct _cef_browser_settings_t {
11980 // empty then "en-US,en" will be used.
12006 @@ -1525,6 +1557,17 @@ typedef enum {
12024 @@ -1579,6 +1622,16 @@ typedef struct _cef_screen_info_t {
12041 @@ -1619,6 +1672,7 @@ typedef enum {
12048 // All user-defined menu IDs should come between MENU_ID_USER_FIRST and
12049 @@ -1635,6 +1689,10 @@ typedef enum {
12060 @@ -1770,6 +1828,10 @@ typedef enum {
12071 @@ -1893,6 +1955,18 @@ typedef enum {
12090 @@ -2593,6 +2667,11 @@ typedef enum {
12102 @@ -2613,6 +2692,11 @@ typedef enum {
12103 // Transparency with post-multiplied alpha component.
12114 @@ -2758,6 +2842,11 @@ typedef enum {
12126 @@ -3167,6 +3256,58 @@ typedef enum {
12185 diff --git a/src/cef/include/internal/cef_types_linux.h b/src/cef/include/internal/cef_types_linux.h
12187 --- a/src/cef/include/internal/cef_types_linux.h
12189 @@ -34,7 +34,7 @@
12193 -#if defined(OS_LINUX)
12198 diff --git a/src/cef/include/internal/cef_types_wrappers.h b/src/cef/include/internal/cef_types_wra…
12200 --- a/src/cef/include/internal/cef_types_wrappers.h
12202 @@ -386,6 +386,8 @@ struct CefScreenInfoTraits {
12203 target->is_monochrome = src->is_monochrome;
12204 target->rect = src->rect;
12205 target->available_rect = src->available_rect;
12206 + target->angle = src->angle;
12207 + target->orientation = src->orientation;
12211 @@ -404,9 +406,11 @@ class CefScreenInfo : public CefStructBase<CefScreenInfoTraits> {
12215 - const CefRect& available_rect) {
12220 - available_rect);
12225 @@ -414,13 +418,17 @@ class CefScreenInfo : public CefStructBase<CefScreenInfoTraits> {
12229 - const CefRect& available_rect_val) {
12244 @@ -719,6 +727,26 @@ struct CefBrowserSettingsTraits {
12245 cef_string_set(src->accept_language_list.str,
12246 src->accept_language_list.length,
12247 &target->accept_language_list, copy);
12250 + target->force_dark_mode_enabled = src->force_dark_mode_enabled;
12251 + target->javascript_can_open_windows_automatically =
12252 + src->javascript_can_open_windows_automatically;
12253 + target->loads_images_automatically = src->loads_images_automatically;
12254 + target->text_size_percent = src->text_size_percent;
12255 + target->allow_running_insecure_content =
12256 + src->allow_running_insecure_content;
12257 + target->strict_mixed_content_checking = src->strict_mixed_content_checking;
12258 + target->allow_mixed_content_upgrades = src->allow_mixed_content_upgrades;
12259 + target->geolocation_enabled = src->geolocation_enabled;
12260 + target->supports_double_tap_zoom = src->supports_double_tap_zoom;
12261 + target->supports_multi_touch_zoom = src->supports_multi_touch_zoom;
12262 + target->initialize_at_minimum_page_scale =
12263 + src->initialize_at_minimum_page_scale;
12264 + target->viewport_meta_enabled = src->viewport_meta_enabled;
12265 + target->user_gesture_required = src->user_gesture_required;
12266 + target->pinch_smooth_mode = src->pinch_smooth_mode;
12271 @@ -824,6 +852,25 @@ class CefTime : public CefStructBase<CefTimeTraits> {
12297 diff --git a/src/cef/libcef/browser/alloy/alloy_browser_context.cc b/src/cef/libcef/browser/alloy/a…
12299 --- a/src/cef/libcef/browser/alloy/alloy_browser_context.cc
12301 @@ -1,6 +1,7 @@
12302 -// Copyright (c) 2012 The Chromium Authors. All rights reserved.
12303 -// Use of this source code is governed by a BSD-style license that can be
12304 -// found in the LICENSE file.
12307 +// reserved. Use of this source code is governed by a BSD-style license that can
12312 @@ -9,6 +10,7 @@
12320 @@ -380,7 +382,9 @@ content::SSLHostStateDelegate* AlloyBrowserContext::GetSSLHostStateDelegate() {
12324 - return nullptr;
12331 diff --git a/src/cef/libcef/browser/alloy/alloy_browser_context.h b/src/cef/libcef/browser/alloy/al…
12333 --- a/src/cef/libcef/browser/alloy/alloy_browser_context.h
12335 @@ -1,6 +1,7 @@
12336 -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
12337 -// Use of this source code is governed by a BSD-style license that can be
12338 -// found in the LICENSE file.
12341 +// reserved. Use of this source code is governed by a BSD-style license that can
12346 @@ -145,6 +146,8 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
12355 diff --git a/src/cef/libcef/browser/alloy/alloy_browser_host_impl.cc b/src/cef/libcef/browser/alloy…
12357 --- a/src/cef/libcef/browser/alloy/alloy_browser_host_impl.cc
12359 @@ -1,7 +1,7 @@
12360 -// Copyright (c) 2012 The Chromium Embedded Framework Authors.
12361 -// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
12362 -// Use of this source code is governed by a BSD-style license that can be
12363 -// found in the LICENSE file.
12366 +// reserved. Use of this source code is governed by a BSD-style license that can
12371 @@ -20,6 +20,8 @@
12380 @@ -55,6 +57,10 @@
12381 #include "third_party/blink/public/mojom/widget/platform_widget.mojom-test-utils.h"
12391 @@ -386,14 +392,30 @@ CefWindowHandle AlloyBrowserHostImpl::GetOpenerWindowHandle() {
12395 - NOTREACHED() << "called on invalid thread";
12396 - return 0;
12401 + if (!event_->TimedWait(base::Milliseconds(10))) {
12412 - if (web_contents())
12413 - return content::HostZoomMap::GetZoomLevel(web_contents());
12414 -
12415 - return 0;
12420 + event_->Signal();
12428 @@ -454,16 +476,18 @@ void AlloyBrowserHostImpl::PrintToPDF(const CefString& path,
12432 - bool findNext) {
12438 - forward, matchCase, findNext));
12444 - platform_delegate_->Find(searchText, forward, matchCase, findNext);
12445 + platform_delegate_->Find(searchText, forward, matchCase, findNext,
12450 @@ -555,6 +579,10 @@ bool AlloyBrowserHostImpl::IsBackgroundHost() {
12461 @@ -1222,7 +1250,53 @@ bool AlloyBrowserHostImpl::TakeFocus(content::WebContents* source,
12465 - return HandleContextMenu(web_contents(), params);
12467 + auto rvh = web_contents()->GetRenderViewHost();
12469 + static_cast<CefRenderWidgetHostViewOSR*>(rvh->GetWidget()->GetView());
12474 + view->selection_controller_client());
12475 + if (touch_client && touch_client->HandleContextMenu(params)) {
12482 + new CefMenuManager(this, platform_delegate_->CreateMenuRunner()));
12484 + return menu_manager_->CreateContextMenu(params);
12497 + auto rvh = web_contents()->GetRenderViewHost();
12499 + if (rvh->GetWidget()->GetView()) {
12500 + rvh->GetWidget()->GetView()->SetBackgroundColor(color);
12505 + auto rvh = web_contents()->GetRenderViewHost();
12507 + static_cast<CefRenderWidgetHostViewOSR*>(rvh->GetWidget()->GetView());
12510 + view->SetDoubleTapSupportEnabled(settings_.supports_double_tap_zoom);
12511 + view->SetMultiTouchZoomSupportEnabled(settings_.supports_multi_touch_zoom);
12516 @@ -1347,8 +1421,12 @@ void AlloyBrowserHostImpl::RunFileChooser(
12517 file_dialog_manager_->RunFileChooser(listener, params);
12529 @@ -1481,6 +1559,27 @@ bool AlloyBrowserHostImpl::IsPrerender2Supported() {
12538 + contents_delegate_->RequestToLockMouse(web_contents, user_gesture,
12544 + contents_delegate_->LostMouseLock();
12550 + contents_delegate_->ShowRepostFormWarningDialog(source);
12555 // -----------------------------------------------------------------------------
12557 @@ -1495,6 +1594,8 @@ void AlloyBrowserHostImpl::RenderFrameCreated(
12560 platform_delegate_->RenderViewReady();
12566 @@ -1662,3 +1763,17 @@ void AlloyBrowserHostImpl::EnsureFileDialogManager() {
12567 this, platform_delegate_->CreateFileDialogRunner()));
12578 + static_cast<AlloyBrowserContext*>(web_contents()->GetBrowserContext());
12580 + cef_browser_context->AddVisitedURLs(urlList);
12584 diff --git a/src/cef/libcef/browser/alloy/alloy_browser_host_impl.h b/src/cef/libcef/browser/alloy/…
12586 --- a/src/cef/libcef/browser/alloy/alloy_browser_host_impl.h
12588 @@ -1,7 +1,7 @@
12589 -// Copyright (c) 2012 The Chromium Embedded Framework Authors.
12590 -// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
12591 -// Use of this source code is governed by a BSD-style license that can be
12592 -// found in the LICENSE file.
12595 +// reserved. Use of this source code is governed by a BSD-style license that can
12600 @@ -23,6 +23,7 @@
12608 @@ -83,6 +84,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
12616 @@ -97,7 +99,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
12620 - bool findNext) override;
12626 @@ -142,6 +145,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
12634 @@ -185,9 +189,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
12638 -
12648 @@ -197,6 +204,14 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
12663 @@ -289,6 +304,15 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
12679 @@ -303,6 +327,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
12687 @@ -340,6 +365,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
12698 @@ -370,6 +399,14 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
12713 diff --git a/src/cef/libcef/browser/alloy/alloy_browser_main.cc b/src/cef/libcef/browser/alloy/allo…
12715 --- a/src/cef/libcef/browser/alloy/alloy_browser_main.cc
12717 @@ -230,10 +230,6 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
12721 - auto browser_context =
12722 - global_request_context_->GetBrowserContext()->AsBrowserContext();
12723 -
12724 - CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
12728 diff --git a/src/cef/libcef/browser/alloy/alloy_client_cert_identity.h b/src/cef/libcef/browser/all…
12731 --- /dev/null
12733 @@ -0,0 +1,44 @@
12740 + * http://www.apache.org/licenses/LICENSE-2.0
12779 diff --git a/src/cef/libcef/browser/alloy/alloy_client_cert_lookup_table.cc b/src/cef/libcef/browse…
12782 --- /dev/null
12784 @@ -0,0 +1,68 @@
12791 + * http://www.apache.org/licenses/LICENSE-2.0
12853 diff --git a/src/cef/libcef/browser/alloy/alloy_client_cert_lookup_table.h b/src/cef/libcef/browser…
12856 --- /dev/null
12858 @@ -0,0 +1,68 @@
12865 + * http://www.apache.org/licenses/LICENSE-2.0
12927 diff --git a/src/cef/libcef/browser/alloy/alloy_content_browser_client.cc b/src/cef/libcef/browser/…
12929 --- a/src/cef/libcef/browser/alloy/alloy_content_browser_client.cc
12931 @@ -7,11 +7,16 @@
12948 @@ -29,6 +34,7 @@
12956 @@ -47,7 +53,9 @@
12966 @@ -93,6 +101,7 @@
12974 @@ -102,6 +111,7 @@
12982 @@ -138,6 +148,7 @@
12990 @@ -170,6 +181,18 @@
13009 @@ -287,8 +310,10 @@ class CefSelectClientCertificateCallbackImpl
13013 - std::unique_ptr<content::ClientCertificateDelegate> delegate)
13014 - : delegate_(std::move(delegate)) {}
13022 @@ -299,41 +324,193 @@ class CefSelectClientCertificateCallbackImpl
13026 - DoSelect(nullptr);
13030 - void Select(CefRefPtr<CefX509Certificate> cert) override {
13031 - if (delegate_)
13032 - DoSelect(cert);
13053 - void DoSelect(CefRefPtr<CefX509Certificate> cert) {
13079 - RunNow(std::move(delegate_), cert);
13085 - base::BindOnce(&CefSelectClientCertificateCallbackImpl::RunNow,
13086 - std::move(delegate_), cert));
13093 - static void RunNow(
13096 - CefRefPtr<CefX509Certificate> cert) {
13102 + delegate->ContinueWithCertificate(nullptr, nullptr);
13105 - if (cert) {
13106 - CefX509CertificateImpl* certImpl =
13107 - static_cast<CefX509CertificateImpl*>(cert.get());
13108 - certImpl->AcquirePrivateKey(base::BindOnce(
13109 - &CefSelectClientCertificateCallbackImpl::RunWithPrivateKey,
13110 - std::move(delegate), cert));
13117 + delegate->ContinueWithCertificate(nullptr, nullptr);
13155 - delegate->ContinueWithCertificate(nullptr, nullptr);
13204 + intermediates.push_back(bssl::UpRef(certsList[i]->cert_buffer()));
13209 + bssl::UpRef(certsList[0]->cert_buffer()),
13215 + certImpl->setClientCert(cert_X509);
13233 @@ -353,6 +530,8 @@ class CefSelectClientCertificateCallbackImpl
13242 @@ -408,7 +587,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
13246 -#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
13251 @@ -746,6 +925,16 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
13254 command_line->GetSwitchValueASCII(switches::kProcessType);
13256 + (browser_cmd->HasSwitch(switches::kNoZygote) &&
13261 + command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
13268 @@ -759,6 +948,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
13274 command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
13276 @@ -939,6 +1129,15 @@ base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate(
13281 + std::string host = cert_request_info->host_and_port.host();
13282 + int port = cert_request_info->host_and_port.port();
13286 + delegate->ContinueWithCertificate(nullptr, nullptr);
13292 @@ -950,6 +1149,8 @@ base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate(
13298 delegate->ContinueWithCertificate(nullptr, nullptr);
13301 @@ -960,20 +1161,61 @@ base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate(
13306 + for (size_t i = 0; i < cert_request_info->cert_key_types.size(); ++i) {
13307 + switch (cert_request_info->cert_key_types[i]) {
13321 + TransferVector(cert_request_info->cert_authorities, cert_authorities_cef);
13324 - new CefSelectClientCertificateCallbackImpl(std::move(delegate)));
13328 bool proceed = handler->OnSelectClientCertificate(
13329 - browser.get(), cert_request_info->is_proxy,
13330 - cert_request_info->host_and_port.host(),
13331 - cert_request_info->host_and_port.port(), certs, callbackImpl.get());
13332 + browser.get(), cert_request_info->is_proxy, host, port, key_types_cef,
13338 - if (!proceed && !certs.empty()) {
13339 - callbackImpl->Select(certs[0]);
13340 - }
13358 + if (!browser_host->settings().javascript_can_open_windows_automatically) {
13362 + return CefBrowserInfoManager::GetInstance()->CanCreateWindow(
13370 @@ -991,6 +1233,16 @@ bool AlloyContentBrowserClient::CanCreateWindow(
13379 + if (!browser_host->settings().javascript_can_open_windows_automatically) {
13384 return CefBrowserInfoManager::GetInstance()->CanCreateWindow(
13387 @@ -1163,6 +1415,7 @@ void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
13395 @@ -1175,10 +1428,14 @@ AlloyContentBrowserClient::CreateClientCertStore(
13410 @@ -1216,6 +1473,24 @@ void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactor…
13422 + auto browser_context = web_contents->GetBrowserContext();
13427 + factories->emplace(url::kFileScheme,
13429 + browser_context->GetPath(),
13430 + browser_context->GetSharedCorsOriginAccessList()));
13435 @@ -1224,13 +1499,6 @@ void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactor…
13437 factories->emplace(extensions::kExtensionScheme, std::move(factory));
13439 - content::RenderFrameHost* frame_host =
13440 - content::RenderFrameHost::FromID(render_process_id, render_frame_id);
13441 - content::WebContents* web_contents =
13442 - content::WebContents::FromRenderFrameHost(frame_host);
13443 - if (!web_contents)
13444 - return;
13445 -
13449 @@ -1309,14 +1577,31 @@ bool AlloyContentBrowserClient::ConfigureNetworkContextParams(
13451 // This method may be called during shutdown when using multi-threaded
13458 + if (cef_context->ShouldPersistSessionCookies()) {
13459 + network_context_params->file_paths =
13461 + network_context_params->file_paths->data_path = cache_path;
13463 + network_context_params->file_paths->cookie_database_name =
13464 + base::FilePath("cookie.db");
13465 + network_context_params->persist_session_cookies =
13466 + cef_context->ShouldPersistSessionCookies();
13467 + network_context_params->restore_old_session_cookies =
13468 + cef_context->ShouldRestoreOldSessionCookies();
13469 + network_context_params->http_cache_enabled = true;
13470 + network_context_params->http_cache_path = cache_path;
13478 - auto cef_context = CefBrowserContext::FromBrowserContext(context);
13479 -
13480 Profile* profile = cef_context->AsProfile();
13483 @@ -1340,6 +1625,18 @@ bool AlloyContentBrowserClient::ConfigureNetworkContextParams(
13502 @@ -1409,7 +1706,11 @@ AlloyContentBrowserClient::CreateWindowForPictureInPicture(
13514 @@ -1463,6 +1764,12 @@ std::string AlloyContentBrowserClient::GetReducedUserAgent() {
13527 @@ -1511,6 +1818,69 @@ bool AlloyContentBrowserClient::ShouldAllowPluginCreation(
13539 + return command_line->HasSwitch(switches::kEnableMultiRendererProcess) ? false
13597 diff --git a/src/cef/libcef/browser/alloy/alloy_content_browser_client.h b/src/cef/libcef/browser/a…
13599 --- a/src/cef/libcef/browser/alloy/alloy_content_browser_client.h
13601 @@ -107,6 +107,12 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
13614 @@ -148,8 +154,10 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
13625 @@ -225,6 +233,8 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
13634 @@ -240,6 +250,29 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
13664 diff --git a/src/cef/libcef/browser/alloy/alloy_ssl_platform_key.h b/src/cef/libcef/browser/alloy/a…
13667 --- /dev/null
13669 @@ -0,0 +1,91 @@
13676 + * http://www.apache.org/licenses/LICENSE-2.0
13732 + !EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, -1 /* hash length */)) {
13745 + signature->resize(sig_len);
13746 + if (!EVP_DigestSign(ctx.get(), signature->data(), &sig_len, input.data(),
13751 + signature->resize(sig_len);
13762 diff --git a/src/cef/libcef/browser/alloy/alloy_web_contents_view_delegate.cc b/src/cef/libcef/brow…
13765 --- /dev/null
13767 @@ -0,0 +1,22 @@
13769 +// Use of this source code is governed by a BSD-style license that can be
13787 + browser->ShowContextMenu(params);
13790 diff --git a/src/cef/libcef/browser/alloy/alloy_web_contents_view_delegate.h b/src/cef/libcef/brows…
13793 --- /dev/null
13795 @@ -0,0 +1,33 @@
13797 +// Use of this source code is governed by a BSD-style license that can be
13829 diff --git a/src/cef/libcef/browser/alloy/browser_platform_delegate_alloy.cc b/src/cef/libcef/brows…
13831 --- a/src/cef/libcef/browser/alloy/browser_platform_delegate_alloy.cc
13833 @@ -259,6 +259,16 @@ void CefBrowserPlatformDelegateAlloy::SendCaptureLostEvent() {
13834 widget->LostCapture();
13841 + auto frame = browser_->GetMainFrame();
13842 + if (frame && frame->IsValid()) {
13843 + static_cast<CefFrameHostImpl*>(frame.get())->SendTouchEvent(event);
13850 @@ -397,13 +407,19 @@ void CefBrowserPlatformDelegateAlloy::PrintToPDF(
13854 - bool findNext) {
13861 ->StartFinding(searchText.ToString16(), forward, matchCase, findNext,
13862 - /*run_synchronously_for_testing=*/false);
13872 diff --git a/src/cef/libcef/browser/alloy/browser_platform_delegate_alloy.h b/src/cef/libcef/browse…
13874 --- a/src/cef/libcef/browser/alloy/browser_platform_delegate_alloy.h
13876 @@ -44,6 +44,7 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
13884 @@ -62,7 +63,8 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
13888 - bool findNext) override;
13894 diff --git a/src/cef/libcef/browser/alloy/chrome_browser_process_alloy.cc b/src/cef/libcef/browser/…
13896 --- a/src/cef/libcef/browser/alloy/chrome_browser_process_alloy.cc
13898 @@ -318,10 +318,12 @@ StatusTray* ChromeBrowserProcessAlloy::status_tray() {
13911 diff --git a/src/cef/libcef/browser/alloy/chrome_browser_process_alloy.h b/src/cef/libcef/browser/a…
13913 --- a/src/cef/libcef/browser/alloy/chrome_browser_process_alloy.h
13915 @@ -88,7 +88,9 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
13925 diff --git a/src/cef/libcef/browser/browser_contents_delegate.cc b/src/cef/libcef/browser/browser_c…
13927 --- a/src/cef/libcef/browser/browser_contents_delegate.cc
13929 @@ -8,6 +8,7 @@
13937 @@ -22,9 +23,18 @@
13940 #include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
13956 @@ -34,7 +44,7 @@ CefBrowserContentsDelegate::CefBrowserContentsDelegate(
13960 -
13961 + icon_helper_->SetWebContents(new_contents);
13965 @@ -102,14 +112,11 @@ void CefBrowserContentsDelegate::LoadingStateChanged(
13969 - if (is_loading_ == is_loading && can_go_back_ == can_go_back &&
13970 - can_go_forward_ == can_go_forward) {
13976 - can_go_back_ = can_go_back;
13977 - can_go_forward_ = can_go_forward;
13981 @@ -180,10 +187,74 @@ void CefBrowserContentsDelegate::ExitFullscreenModeForTab(
13995 + contents_->GetController().ContinuePendingReload();
14001 + contents_->GetController().CancelPendingReload();
14017 + if (auto handler = c->GetLoadHandler()) {
14018 + auto navigation_lock = browser_info_->CreateNavigationLock();
14019 + handler->OnDataResubmission(browser(), callbackImpl.get());
14055 if (auto handler = c->GetKeyboardHandler()) {
14056 @@ -234,6 +305,87 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent(
14077 + if (tab_with_exclusive_access_ && registrar_->IsEmpty()) {
14078 + registrar_->Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
14080 + &tab_with_exclusive_access_->GetController()));
14081 + } else if (!tab_with_exclusive_access_ && !registrar_->IsEmpty()) {
14082 + registrar_->RemoveAll();
14093 + web_contents->GotResponseToLockMouseRequest(
14099 + web_contents->GotResponseToLockMouseRequest(
14107 + if (web_contents->GotResponseToLockMouseRequest(
14131 + tab_with_exclusive_access_->GetMainFrame()->GetRenderViewHost();
14133 + mouse_lock_view = rvh->GetWidget()->GetView();
14137 + mouse_lock_view->UnlockMouse();
14143 browser_info_->MaybeCreateFrame(render_frame_host, false /* is_guest_view */);
14144 @@ -406,20 +558,66 @@ void CefBrowserContentsDelegate::DidFinishNavigation(
14145 if (!navigation_handle->IsSameDocument()) {
14146 OnLoadStart(frame.get(), navigation_handle->GetPageTransition());
14148 -
14150 + if (!navigation_handle->IsSameDocument()) {
14151 + content::RenderFrameHost* render_frame_host = navigation_handle->GetRenderFrameHost();
14159 + self->OnOldPageNoLongerRendered(url, success);
14161 + render_frame_host->InsertVisualStateCallback(std::move(invokeVisualStateCallback));
14170 + PageTransitionCoreTypeIs(navigation_handle->GetPageTransition(),
14174 + navigation_handle->GetPageTransition());
14182 - OnLoadError(frame.get(), navigation_handle->GetURL(), error_code);
14185 + CefString cef_url(navigation_handle->GetURL().spec());
14186 + CefString cef_method(navigation_handle->IsPost() ? "POST" : "GET");
14187 + request->SetURL(cef_url);
14188 + request->SetMethod(cef_method);
14189 + request->Set(net::HttpRequestHeaders());
14190 + OnLoadError(request, navigation_handle->IsInMainFrame(),
14191 + navigation_handle->HasUserGesture(), error_code);
14202 + if (auto handler = c->GetLoadHandler()) {
14203 + auto navigation_lock = browser_info_->CreateNavigationLock();
14204 + handler->OnPageVisible(browser(), url.spec(), success);
14213 @@ -467,6 +665,7 @@ void CefBrowserContentsDelegate::DidUpdateFaviconURL(
14217 + icon_helper_->OnUpdateFaviconURL(render_frame_host, candidates);
14221 @@ -590,6 +789,21 @@ void CefBrowserContentsDelegate::OnLoadError(CefRefPtr<CefFrame> frame,
14230 + if (auto handler = c->GetLoadHandler()) {
14231 + auto navigation_lock = browser_info_->CreateNavigationLock();
14233 + handler->OnLoadErrorWithRequest(request, is_main_frame, has_user_gesture,
14242 if (auto handler = c->GetDisplayHandler()) {
14243 @@ -617,3 +831,34 @@ void CefBrowserContentsDelegate::OnStateChanged(State state_changed) {
14250 + icon_helper_->SetBrowser(CefBrowserContentsDelegate::browser());
14253 + CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
14255 + icon_helper_->SetDisplayHandler(handler);
14270 + auto handler = cefClient->GetLoadHandler();
14276 + handler->OnRefreshAccessedHistory(browser(), frame, url.spec(), isReload);
14278 diff --git a/src/cef/libcef/browser/browser_contents_delegate.h b/src/cef/libcef/browser/browser_co…
14280 --- a/src/cef/libcef/browser/browser_contents_delegate.h
14282 @@ -1,6 +1,7 @@
14283 -// Copyright 2020 The Chromium Embedded Framework Authors. All rights reserved.
14284 -// Use of this source code is governed by a BSD-style license that can be
14285 -// found in the LICENSE file.
14288 +// reserved. Use of this source code is governed by a BSD-style license that can
14293 @@ -9,6 +10,7 @@
14301 @@ -107,6 +109,16 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
14318 @@ -149,8 +161,6 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
14322 - bool can_go_back() const { return can_go_back_; }
14323 - bool can_go_forward() const { return can_go_forward_; }
14327 @@ -161,27 +171,49 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
14374 - bool can_go_back_ = false;
14375 - bool can_go_forward_ = false;
14379 @@ -199,6 +231,26 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
14406 diff --git a/src/cef/libcef/browser/browser_context.cc b/src/cef/libcef/browser/browser_context.cc
14408 --- a/src/cef/libcef/browser/browser_context.cc
14410 @@ -19,6 +19,7 @@
14418 @@ -183,7 +184,7 @@ CefBrowserContext::~CefBrowserContext() {
14422 - cache_path_ = base::FilePath(CefString(&settings_.cache_path));
14427 diff --git a/src/cef/libcef/browser/browser_frame.cc b/src/cef/libcef/browser/browser_frame.cc
14429 --- a/src/cef/libcef/browser/browser_frame.cc
14431 @@ -77,3 +77,22 @@ CefRefPtr<CefFrameHostImpl> CefBrowserFrame::GetFrameHost(
14438 + host->OnUpdateHitData(std::move(params));
14445 + host->OnGetImageForContextNode(std::move(params));
14451 + host->OnGetImageForContextNodeNull();
14454 diff --git a/src/cef/libcef/browser/browser_frame.h b/src/cef/libcef/browser/browser_frame.h
14456 --- a/src/cef/libcef/browser/browser_frame.h
14458 @@ -43,6 +43,10 @@ class CefBrowserFrame
14469 diff --git a/src/cef/libcef/browser/browser_host_base.cc b/src/cef/libcef/browser/browser_host_base…
14471 --- a/src/cef/libcef/browser/browser_host_base.cc
14473 @@ -1,35 +1,59 @@
14474 -// Copyright 2020 The Chromium Embedded Framework Authors. All rights reserved.
14475 -// Use of this source code is governed by a BSD-style license that can be
14476 -// found in the LICENSE file.
14479 +// reserved. Use of this source code is governed by a BSD-style license that can
14536 @@ -68,8 +92,39 @@ class WebContentsUserDataAdapter : public base::SupportsUserData::Data {
14559 + test_name = base_name.ToString() + file_name + "-" +
14576 @@ -146,14 +201,21 @@ CefBrowserHostBase::CefBrowserHostBase(
14581 + is_views_hosted_(platform_delegate_->IsViewsHosted()),
14584 is_views_hosted_(platform_delegate_->IsViewsHosted()) {
14587 DCHECK(!browser_info_->browser().get());
14588 browser_info_->SetBrowser(this);
14589 -
14592 contents_delegate_->AddObserver(this);
14593 + contents_delegate_->InitIconHelper();
14595 + client_->GetPermissionRequest(), GetWebContents()));
14599 @@ -162,6 +224,10 @@ void CefBrowserHostBase::InitializeBrowser() {
14610 @@ -178,6 +244,16 @@ void CefBrowserHostBase::DestroyBrowser() {
14611 browser_info_->SetBrowser(nullptr);
14621 + std::move(task)->Execute();
14627 @@ -347,7 +423,9 @@ void CefBrowserHostBase::GetNavigationEntries(
14630 visitor->Visit(entry.get(), true, current, total);
14632 std::ignore = entry->Detach(nullptr);
14637 @@ -355,7 +433,9 @@ void CefBrowserHostBase::GetNavigationEntries(
14640 cont = visitor->Visit(entry.get(), (i == current), i, total);
14642 std::ignore = entry->Detach(nullptr);
14647 @@ -377,6 +457,124 @@ CefRefPtr<CefNavigationEntry> CefBrowserHostBase::GetVisibleNavigationEntry()…
14718 + GetWebContents()->OnWebPreferencesChanged();
14722 + GetWebContents()->OnWebPreferencesChanged();
14730 + GetWebContents()->SetUserAgentOverride(
14733 + content::NavigationController& controller = GetWebContents()->GetController();
14735 + controller.GetEntryAtIndex(i)->SetIsOverridingUserAgent(true);
14752 + javascriptInjector->AddInterface(object_name.ToString(), method_vector);
14764 + javascriptInjector->RemoveInterface(object_name.ToString(), method_vector);
14772 @@ -487,7 +685,12 @@ CefRefPtr<CefBrowserHost> CefBrowserHostBase::GetHost() {
14776 - return can_go_back_;
14782 + return wc->GetController().CanGoBack();
14786 @@ -507,9 +710,30 @@ void CefBrowserHostBase::GoBack() {
14793 + return web_contents->GetController().GetOriginalUrl();
14800 + if (frame && frame->IsValid()) {
14802 + ->SetJsOnlineProperty(available);
14808 - return can_go_forward_;
14814 + return wc->GetController().CanGoForward();
14818 @@ -529,6 +753,65 @@ void CefBrowserHostBase::GoForward() {
14832 + LOG(ERROR) << "not full-screen state";
14835 + wc->GetMainFrame()->AllowInjectingJavaScript();
14837 + wc->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(jscode),
14845 + return wc->GetController().CanGoToOffset(num_steps);
14858 + if (browser_info_->IsNavigationLocked(std::move(callback))) {
14863 + if (wc && wc->GetController().CanGoToOffset(num_steps)) {
14864 + wc->GetController().GoToOffset(num_steps);
14875 + if (wc && wc->GetController().CanPruneAllButLastCommitted()) {
14876 + wc->GetController().PruneAllButLastCommitted();
14884 @@ -568,6 +851,132 @@ void CefBrowserHostBase::ReloadIgnoreCache() {
14896 + if (browser_info_->IsNavigationLocked(std::move(callback))) {
14902 + wc->GetController().Reload(content::ReloadType::ORIGINAL_REQUEST_URL, true);
14911 + callback->OnStoreWebArchiveDone("");
14915 + web_contents->GenerateMHTML(
14922 + callback->OnStoreWebArchiveDone(file_size < 0 ? "" : path);
14943 + callback->OnStoreWebArchiveDone("");
14951 + base::BindOnce(&GenerateArchiveAutoNamePath, web_contents->GetURL(),
14992 + if (frame && frame->IsValid()) {
14993 + static_cast<CefFrameHostImpl*>(frame.get())->UpdateLocale(update_locale);
14994 + g_browser_process->SetApplicationLocale(result);
15004 + if (frame->IsValid()) {
15006 + ->RemoveCache(include_disk_files);
15017 @@ -676,8 +1085,6 @@ void CefBrowserHostBase::OnStateChanged(CefBrowserContentsState state_changed)…
15020 is_loading_ = contents_delegate_->is_loading();
15021 - can_go_back_ = contents_delegate_->can_go_back();
15022 - can_go_forward_ = contents_delegate_->can_go_forward();
15026 @@ -696,6 +1103,131 @@ void CefBrowserHostBase::OnStateChanged(CefBrowserContentsState state_change…
15053 + permission_request_handler_->SendRequest(new AlloyAccessRequest(
15082 + if (permissions->ContainOrigin(origin)) {
15083 + NotifyGeolocationPermission(permissions->IsOriginAccessEnabled(origin),
15088 + GetClient()->GetPermissionRequest()->OnGeolocationShow(origin);
15122 + GetClient()->GetPermissionRequest()->OnGeolocationHide();
15132 + permission_request_handler_->SendRequest(new AlloyAccessRequest(
15139 + permission_request_handler_->CancelRequest(
15146 + permission_request_handler_->SendRequest(new AlloyAccessRequest(
15151 + permission_request_handler_->CancelRequest(
15158 @@ -766,6 +1298,12 @@ void CefBrowserHostBase::OnDidFinishLoad(CefRefPtr<CefFrameHostImpl> frame,
15159 contents_delegate_->OnLoadEnd(frame, validated_url, http_status_code);
15171 @@ -836,7 +1374,7 @@ content::BrowserContext* CefBrowserHostBase::GetBrowserContext() const {
15175 -#if defined(TOOLKIT_VIEWS)
15180 @@ -878,3 +1416,455 @@ void CefBrowserHostBase::InitializeDevToolsRegistrationOnUIThread(
15182 devtools_manager_->InitializeRegistrationOnUIThread(registration);
15188 + return web_contents->GetTitle();
15201 + web_contents->CreateWebMessagePorts(portArr);
15245 + if (port.ToString().compare(std::to_string(iter->first.first)) == 0) {
15247 + sendPorts.emplace_back(std::move(iter->second.first));
15248 + } else if (port.ToString().compare(std::to_string(iter->first.second)) ==
15251 + sendPorts.emplace_back(std::move(iter->second.second));
15258 + web_contents->PostWebMessage(msg, sendPorts, uri);
15275 + if (portHandle.ToString().compare(std::to_string(iter->first.first)) == 0) {
15276 + port = std::move(iter->second.first);
15281 + std::to_string(iter->first.second)) == 0) {
15282 + port = std::move(iter->second.second);
15290 + if (portHandle.ToString().compare(iter->first) == 0) {
15297 + if (portHandle.ToString().compare(iter->first) == 0) {
15317 + if (portHandle.ToString().compare(std::to_string(iter->first.first)) == 0) {
15318 + if (iter->second.first.CanPostMessage()) {
15319 + iter->second.first.PostMessage(blink::WebMessagePort::Message(message));
15325 + std::to_string(iter->first.second)) == 0) {
15326 + if (iter->second.second.CanPostMessage()) {
15327 + iter->second.second.PostMessage(
15354 + sequenced_task_runner_ = runner_it->second;
15364 + webMsgReceiver = receive_it->second;
15368 + webMsgReceiver->SetOnMessageCallback(callback);
15372 + if (portHandle.ToString().compare(std::to_string(iter->first.first)) == 0) {
15373 + if (iter->second.first.HasReceiver()) {
15374 + iter->second.first.ClearReceiver();
15376 + iter->second.first.SetReceiver(webMsgReceiver.get(),
15380 + std::to_string(iter->first.second)) == 0) {
15381 + if (iter->second.second.HasReceiver()) {
15382 + iter->second.second.ClearReceiver();
15384 + iter->second.second.SetReceiver(webMsgReceiver.get(),
15420 + callback_->OnJavaScriptExeResult(base::UTF16ToUTF8(data));
15435 + if (frame && frame->IsValid()) {
15437 + ->SetInitialScale(scale / (100 / virtual_pixel_ratio_));
15453 + ->GetPrimaryPage()
15471 + if (!web_contents->IsLoading()) {
15474 + return round(100 * web_contents->GetLoadProgress());
15520 + web_contents->GetController().LoadURLWithParams(loadUrlParams);
15548 + web_contents->GetController().LoadURLWithParams(loadUrlParams);
15557 + web_contents->GetMainFrame()->AllowInjectingJavaScript();
15560 + web_contents->GetMainFrame()->ExecuteJavaScript(
15569 + callback->OnJavaScriptExeResult(json);
15605 + if (frame && frame->IsValid()) {
15606 + static_cast<CefFrameHostImpl*>(frame.get())->GetImageForContextNode();
15614 + if (web_contents && frame && frame->IsValid()) {
15615 + content::RenderFrameHost* rfh = web_contents->GetMainFrame();
15618 + rfh->GetImageFromCache(
15631 + return wc->ShouldShowLoadingUI();
15636 diff --git a/src/cef/libcef/browser/browser_host_base.h b/src/cef/libcef/browser/browser_host_base.h
15638 --- a/src/cef/libcef/browser/browser_host_base.h
15640 @@ -1,19 +1,27 @@
15641 -// Copyright 2020 The Chromium Embedded Framework Authors. All rights reserved.
15642 -// Use of this source code is governed by a BSD-style license that can be
15643 -// found in the LICENSE file.
15646 +// reserved. Use of this source code is governed by a BSD-style license that can
15671 @@ -24,6 +32,8 @@ namespace extensions {
15677 // Parameters that are passed to the runtime-specific Create methods.
15680 @@ -39,7 +49,7 @@ struct CefBrowserCreateParams {
15684 -#if defined(TOOLKIT_VIEWS)
15689 @@ -49,7 +59,7 @@ struct CefBrowserCreateParams {
15690 // views-hosted browser. Currently used with the alloy runtime only.
15693 -#if defined(TOOLKIT_VIEWS)
15695 // The BrowserView that will own a Views-hosted browser. Will be nullptr for
15698 @@ -90,12 +100,32 @@ struct CefBrowserCreateParams {
15722 // shared by the alloy and chrome runtimes. All methods are thread-safe unless
15726 - public CefBrowserContentsDelegate::Observer {
15732 @@ -149,6 +179,8 @@ class CefBrowserHostBase : public CefBrowserHost,
15741 @@ -181,6 +213,35 @@ class CefBrowserHostBase : public CefBrowserHost,
15777 @@ -188,6 +249,9 @@ class CefBrowserHostBase : public CefBrowserHost,
15787 @@ -203,11 +267,71 @@ class CefBrowserHostBase : public CefBrowserHost,
15859 @@ -228,6 +352,7 @@ class CefBrowserHostBase : public CefBrowserHost,
15867 @@ -241,6 +366,9 @@ class CefBrowserHostBase : public CefBrowserHost,
15874 // Thread-safe accessors.
15877 @@ -265,7 +393,7 @@ class CefBrowserHostBase : public CefBrowserHost,
15881 -#if defined(TOOLKIT_VIEWS)
15886 @@ -275,6 +403,16 @@ class CefBrowserHostBase : public CefBrowserHost,
15903 @@ -302,8 +440,6 @@ class CefBrowserHostBase : public CefBrowserHost,
15907 - bool can_go_back_ = false;
15908 - bool can_go_forward_ = false;
15912 @@ -312,7 +448,42 @@ class CefBrowserHostBase : public CefBrowserHost,
15955 diff --git a/src/cef/libcef/browser/browser_host_create.cc b/src/cef/libcef/browser/browser_host_cr…
15957 --- a/src/cef/libcef/browser/browser_host_create.cc
15959 @@ -82,20 +82,7 @@ bool CefBrowserHost::CreateBrowser(
15963 -
15964 - auto request_context_impl =
15965 - static_cast<CefRequestContextImpl*>(request_context.get());
15966 -
15967 - // Wait for the browser context to be initialized before creating the browser.
15968 - request_context_impl->ExecuteWhenBrowserContextInitialized(base::BindOnce(
15969 - [](std::unique_ptr<CreateBrowserHelper> helper) {
15970 - // Always execute asynchronously to avoid potential issues if we're
15971 - // being called synchronously during app initialization.
15972 - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CreateBrowserHelper::Run,
15973 - std::move(helper)));
15974 - },
15975 - std::move(helper)));
15976 -
15977 + helper->Run();
15981 diff --git a/src/cef/libcef/browser/browser_info_manager.cc b/src/cef/libcef/browser/browser_info_m…
15983 --- a/src/cef/libcef/browser/browser_info_manager.cc
15985 @@ -103,6 +103,40 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
16007 + CefRefPtr<CefClient> client = browser->GetClient();
16010 + CefRefPtr<CefLifeSpanHandler> handler = client->GetLifeSpanHandler();
16012 + CefRefPtr<CefFrame> opener_frame = browser->GetFrameForHost(opener);
16014 + allow = !handler->OnPreBeforePopup(
16026 @@ -180,7 +214,9 @@ bool CefBrowserInfoManager::CanCreateWindow(
16029 if (browser->HasView()) {
16036 diff --git a/src/cef/libcef/browser/browser_info_manager.h b/src/cef/libcef/browser/browser_info_ma…
16038 --- a/src/cef/libcef/browser/browser_info_manager.h
16040 @@ -80,6 +80,12 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
16053 diff --git a/src/cef/libcef/browser/browser_platform_delegate.cc b/src/cef/libcef/browser/browser_p…
16055 --- a/src/cef/libcef/browser/browser_platform_delegate.cc
16057 @@ -113,7 +113,7 @@ CefWindowHandle CefBrowserPlatformDelegate::GetHostWindowHandle() const {
16061 -#if defined(TOOLKIT_VIEWS)
16066 @@ -384,7 +384,8 @@ void CefBrowserPlatformDelegate::PrintToPDF(
16070 - bool findNext) {
16076 diff --git a/src/cef/libcef/browser/browser_platform_delegate.h b/src/cef/libcef/browser/browser_pl…
16078 --- a/src/cef/libcef/browser/browser_platform_delegate.h
16080 @@ -57,7 +57,7 @@ class Size;
16084 -#if defined(TOOLKIT_VIEWS)
16089 @@ -173,7 +173,7 @@ class CefBrowserPlatformDelegate {
16093 -#if defined(TOOLKIT_VIEWS)
16098 @@ -356,7 +356,8 @@ class CefBrowserPlatformDelegate {
16102 - bool findNext);
16108 diff --git a/src/cef/libcef/browser/browser_platform_delegate_create.cc b/src/cef/libcef/browser/br…
16110 --- a/src/cef/libcef/browser/browser_platform_delegate_create.cc
16112 @@ -22,7 +22,7 @@
16116 -#elif BUILDFLAG(IS_LINUX)
16121 @@ -45,7 +45,7 @@ std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
16125 -#elif BUILDFLAG(IS_LINUX)
16130 @@ -61,7 +61,7 @@ std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
16134 -#elif BUILDFLAG(IS_LINUX)
16139 diff --git a/src/cef/libcef/browser/chrome/chrome_browser_host_impl.cc b/src/cef/libcef/browser/chr…
16141 --- a/src/cef/libcef/browser/chrome/chrome_browser_host_impl.cc
16143 @@ -218,7 +218,8 @@ void ChromeBrowserHostImpl::PrintToPDF(
16147 - bool findNext) {
16153 @@ -582,3 +583,5 @@ int ChromeBrowserHostImpl::GetCurrentTabIndex() const {
16159 diff --git a/src/cef/libcef/browser/chrome/chrome_browser_host_impl.h b/src/cef/libcef/browser/chro…
16161 --- a/src/cef/libcef/browser/chrome/chrome_browser_host_impl.h
16163 @@ -77,7 +77,8 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
16167 - bool findNext) override;
16173 @@ -123,6 +124,9 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
16183 diff --git a/src/cef/libcef/browser/context.cc b/src/cef/libcef/browser/context.cc
16185 --- a/src/cef/libcef/browser/context.cc
16187 @@ -408,6 +408,7 @@ SkColor CefContext::GetBackgroundColor(
16188 !GetColor(browser_settings->background_color, is_windowless, &sk_color)) {
16195 diff --git a/src/cef/libcef/browser/devtools/devtools_manager_delegate.cc b/src/cef/libcef/browser/…
16197 --- a/src/cef/libcef/browser/devtools/devtools_manager_delegate.cc
16199 @@ -102,8 +102,16 @@ void CefDevToolsManagerDelegate::StartHttpHandler(
16203 - content::DevToolsAgentHost::StartRemoteDebuggingServer(
16204 - std::move(socket_factory), browser_context->GetPath(), base::FilePath());
16212 + std::move(socket_factory), browser_context->GetPath(),
16218 @@ -116,6 +124,7 @@ void CefDevToolsManagerDelegate::StartHttpHandler(
16221 // This is a no-op if the server was never started.
16226 diff --git a/src/cef/libcef/browser/extensions/extension_system.cc b/src/cef/libcef/browser/extensi…
16228 --- a/src/cef/libcef/browser/extensions/extension_system.cc
16230 @@ -126,6 +126,7 @@ void LoadExtensionWithManifest(base::WeakPtr<CefExtensionSystem> context,
16238 @@ -145,6 +146,7 @@ void LoadExtensionFromDisk(base::WeakPtr<CefExtensionSystem> context,
16246 @@ -275,10 +277,14 @@ void CefExtensionSystem::LoadExtension(
16261 diff --git a/src/cef/libcef/browser/extensions/mime_handler_view_guest_delegate.cc b/src/cef/libcef…
16263 --- a/src/cef/libcef/browser/extensions/mime_handler_view_guest_delegate.cc
16265 @@ -69,8 +69,12 @@ bool CefMimeHandlerViewGuestDelegate::HandleContextMenu(
16270 + return owner_browser->ShowContextMenu(params);
16272 return owner_browser->HandleContextMenu(
16278 diff --git a/src/cef/libcef/browser/file_dialog_manager.cc b/src/cef/libcef/browser/file_dialog_man…
16280 --- a/src/cef/libcef/browser/file_dialog_manager.cc
16282 @@ -205,7 +205,6 @@ void CefFileDialogManager::RunFileChooser(
16286 -
16290 @@ -287,7 +286,8 @@ void CefFileDialogManager::RunFileChooserInternal(
16291 handled = handler->OnFileDialog(
16294 - params.selected_accept_filter, callbackImpl.get());
16299 callback = callbackImpl->Disconnect();
16300 diff --git a/src/cef/libcef/browser/frame_host_impl.cc b/src/cef/libcef/browser/frame_host_impl.cc
16302 --- a/src/cef/libcef/browser/frame_host_impl.cc
16304 @@ -18,10 +18,20 @@
16325 @@ -283,6 +293,14 @@ void CefFrameHostImpl::RefreshAttributes() {
16333 + render_frame->UpdateLocale(locale);
16340 @@ -640,6 +658,210 @@ void CefFrameHostImpl::UpdateDraggableRegions(
16348 + browser->OnUpdateHitData(params->type, params->extra_data_for_type);
16354 + if (image_impl != nullptr && params->image.width() > 0 &&
16355 + params->image.height() > 0) {
16356 + image_impl->AddBitmap(1.0, params->image);
16366 + auto client = browser->GetClient();
16368 + handler = client->GetContextMenuHandler();
16371 + handler->OnGetImageForContextNode(GetBrowser(), image);
16382 + auto client = browser->GetClient();
16384 + handler = client->GetContextMenuHandler();
16387 + handler->OnGetImageForContextNode(GetBrowser(), image);
16400 + auto client = browser->GetClient();
16402 + handler = client->GetContextMenuHandler();
16409 + << "OnGetImageFromCache: Read-only shared memory region is invalid";
16410 + handler->OnGetImageFromCache(image_impl);
16416 + << "OnGetImageFromCache: Read-only shared memory mapping is invalid";
16417 + handler->OnGetImageFromCache(image_impl);
16426 + sk_image->asLegacyBitmap(&bitmap);
16427 + image_impl->AddBitmap(1.0, bitmap);
16430 + handler->OnGetImageFromCache(image_impl);
16442 + touch_event->x = event.x;
16443 + touch_event->y = event.y;
16444 + touch_event->width = event.radius_x;
16445 + touch_event->height = event.radius_y;
16450 + render_frame->SendTouchEvent(std::move(touch_event));
16459 + render_frame->SetInitialScale(scale);
16468 + render_frame->SetJsOnlineProperty(network_up);
16476 + render_frame->GetImageForContextNode();
16485 + render_frame->PutZoomingForTextFactor(factor);
16492 + if (auto browser = frame->GetBrowser()) {
16493 + callback->GetImages(response);
16506 + render_frame->GetImagesWithResponse(std::move(response_callback));
16521 + render_frame->RemoveCache();
16531 + auto web_contents = browser->GetWebContents();
16538 + web_contents->GetBrowserContext()->GetBrowsingDataRemover();
16539 + remover->Remove(
16551 diff --git a/src/cef/libcef/browser/frame_host_impl.h b/src/cef/libcef/browser/frame_host_impl.h
16553 --- a/src/cef/libcef/browser/frame_host_impl.h
16555 @@ -12,6 +12,7 @@
16563 @@ -82,6 +83,11 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
16575 @@ -137,6 +143,34 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
16610 diff --git a/src/cef/libcef/browser/icon_helper.cc b/src/cef/libcef/browser/icon_helper.cc
16613 --- /dev/null
16615 @@ -0,0 +1,189 @@
16618 +// Use of this source code is governed by a BSD-style license that can be
16687 + if (!candidate->icon_url.is_valid())
16689 + switch (candidate->icon_type) {
16694 + handler_->OnReceivedTouchIconUrl(
16695 + browser_, CefString(candidate->icon_url.spec()), false);
16698 + handler_->OnReceivedTouchIconUrl(
16699 + browser_, CefString(candidate->icon_url.spec()), true);
16717 + web_contents_->DownloadImage(
16718 + candidate->icon_url,
16767 + web_contents_->GetController().GetLastCommittedEntry();
16769 + entry->GetFavicon().valid = true;
16770 + entry->GetFavicon().url = image_url;
16771 + entry->GetFavicon().image = gfx::Image::CreateFrom1xBitmap(bitmap);
16789 + handler_->OnReceivedIcon(data, width, height, color_type, alpha_type);
16802 + handler_->OnReceivedIconUrl(image_url, data, width, height, color_type,
16805 diff --git a/src/cef/libcef/browser/icon_helper.h b/src/cef/libcef/browser/icon_helper.h
16808 --- /dev/null
16810 @@ -0,0 +1,74 @@
16813 +// Use of this source code is governed by a BSD-style license that can be
16825 +#include "third_party/blink/public/mojom/favicon/favicon_url.mojom-forward.h"
16885 diff --git a/src/cef/libcef/browser/image_impl.h b/src/cef/libcef/browser/image_impl.h
16887 --- a/src/cef/libcef/browser/image_impl.h
16889 @@ -82,10 +82,10 @@ class CefImageImpl : public CefImage {
16893 - private:
16901 diff --git a/src/cef/libcef/browser/javascript/oh_gin_javascript_bridge_dispatcher_host.cc b/src/ce…
16904 --- /dev/null
16906 @@ -0,0 +1,297 @@
16909 +// Use of this source code is governed by a BSD-style license that can be
16939 + !web_contents()->GetMainFrame()->GetProcess()->GetChannel()) {
16944 + web_contents()->ForEachFrame(base::BindRepeating(
16949 + ->GetAgentSchedulingGroup();
16961 + process_global_filter->AddRoutingIdForHost(host, frame);
16964 + per_asg_filter->AddRoutingIdForHost(host, frame);
16974 + ->GetAgentSchedulingGroup();
16978 + filter->AddRoutingIdForHost(this, render_frame_host);
16984 + render_frame_host->Send(new OhGinJavascriptBridgeMsg_AddNamedObject(
16985 + render_frame_host->GetRoutingID(), iter->second.first, iter->first));
16991 + web_contents()->ForEachFrame(base::BindRepeating(
16996 + ->GetAgentSchedulingGroup();
17002 + filter->RemoveHost(host);
17012 + ->GetAgentSchedulingGroup();
17030 + if (it->second.first == object_name) {
17031 + std::unordered_set<std::string> method_set = it->second.second;
17035 + it->second.second = method_set;
17056 + web_contents_impl->SendToAllFramesIncludingPending(
17074 + if (!(object_name == it->second.first)) {
17088 + web_contents_impl->SendToAllFramesIncludingPending(
17111 + returned_method_names->emplace(*iter);
17138 + if (!result.get() || result->GetSize() == 0) {
17142 + CefRefPtr<CefValue> argument = result->GetValue(0);
17144 + switch (argument->GetType()) {
17146 + value = std::make_unique<base::Value>(result->GetInt(0));
17149 + value = std::make_unique<base::Value>(result->GetDouble(0));
17153 + value = std::make_unique<base::Value>(result->GetBool(0));
17156 + value = std::make_unique<base::Value>(result->GetString(0).ToString());
17195 + client_->NotifyJavaScriptResult(ceflistvalue, method, classname, result);
17201 + wrapped_result->Append(ParseValueTONWebValue(result));
17205 diff --git a/src/cef/libcef/browser/javascript/oh_gin_javascript_bridge_dispatcher_host.h b/src/cef…
17208 --- /dev/null
17210 @@ -0,0 +1,77 @@
17213 +// Use of this source code is governed by a BSD-style license that can be
17289 diff --git a/src/cef/libcef/browser/javascript/oh_gin_javascript_bridge_message_filter.cc b/src/cef…
17292 --- /dev/null
17294 @@ -0,0 +1,184 @@
17297 +// Use of this source code is governed by a BSD-style license that can be
17334 + content::GetUIThreadTaskRunner({})->DeleteSoon(FROM_HERE, this);
17341 + [message, this] { this->OnMessageReceivedThread(message); });
17368 + hosts_[render_frame_host->GetRoutingID()] = host;
17377 + if (iter->second == host)
17396 + rph->RemoveObserver(this);
17415 + agent_scheduling_group.GetProcess()->AddObserver(filter.get());
17431 + return iter->second;
17441 + host->OnGetMethods(object_id, returned_method_names);
17453 + host->OnHasMethod(object_id, method_name, result);
17467 + host->OnInvokeMethod(current_routing_id_, object_id, method_name, arguments,
17470 + wrapped_result->Append(std::make_unique<base::Value>());
17480 diff --git a/src/cef/libcef/browser/javascript/oh_gin_javascript_bridge_message_filter.h b/src/cef/…
17483 --- /dev/null
17485 @@ -0,0 +1,93 @@
17488 +// Use of this source code is governed by a BSD-style license that can be
17580 diff --git a/src/cef/libcef/browser/javascript/oh_gin_javascript_bridge_object_deletion_message_fil…
17583 --- /dev/null
17585 @@ -0,0 +1,136 @@
17588 +// Use of this source code is governed by a BSD-style license that can be
17629 + content::GetUIThreadTaskRunner({})->DeleteSoon(FROM_HERE, this);
17651 + hosts_[render_frame_host->GetRoutingID()] = host;
17660 + if (iter->second == host)
17679 + rph->RemoveObserver(this);
17680 + rph->RemoveUserData(kOhGinJavascriptBridgeObjectDeletionMessageFilterKey);
17696 + rph->AddFilter(filter.get());
17697 + rph->AddObserver(filter.get());
17699 + rph->SetUserData(
17712 + return iter->second;
17723 diff --git a/src/cef/libcef/browser/javascript/oh_gin_javascript_bridge_object_deletion_message_fil…
17726 --- /dev/null
17728 @@ -0,0 +1,85 @@
17731 +// Use of this source code is governed by a BSD-style license that can be
17814 diff --git a/src/cef/libcef/browser/javascript/oh_javascript_injector.cc b/src/cef/libcef/browser/j…
17817 --- /dev/null
17819 @@ -0,0 +1,34 @@
17822 +// Use of this source code is governed by a BSD-style license that can be
17833 + web_contents->SetUserData(UserDataKey(), base::WrapUnique(this));
17842 + javascript_bridge_dispatcher_host_->AddNamedObject(object_name, method_list);
17849 + javascript_bridge_dispatcher_host_->RemoveNamedObject(object_name,
17854 diff --git a/src/cef/libcef/browser/javascript/oh_javascript_injector.h b/src/cef/libcef/browser/ja…
17857 --- /dev/null
17859 @@ -0,0 +1,39 @@
17862 +// Use of this source code is governed by a BSD-style license that can be
17900 diff --git a/src/cef/libcef/browser/native/browser_platform_delegate_native_aura.cc b/src/cef/libce…
17902 --- a/src/cef/libcef/browser/native/browser_platform_delegate_native_aura.cc
17904 @@ -126,6 +126,14 @@ ui::MouseEvent CefBrowserPlatformDelegateNativeAura::TranslateUiClickEvent(
17919 @@ -206,6 +214,10 @@ int CefBrowserPlatformDelegateNativeAura::TranslateUiEventModifiers(
17930 diff --git a/src/cef/libcef/browser/native/menu_runner_linux.cc b/src/cef/libcef/browser/native/men…
17932 --- a/src/cef/libcef/browser/native/menu_runner_linux.cc
17934 @@ -7,6 +7,7 @@
17942 @@ -16,6 +17,7 @@ bool CefMenuRunnerLinux::RunContextMenu(
17948 new views::MenuRunner(model->model(), views::MenuRunner::CONTEXT_MENU));
17950 @@ -28,13 +30,18 @@ bool CefMenuRunnerLinux::RunContextMenu(
17952 menu_->RunMenuAt(parent_widget, nullptr, gfx::Rect(screen_point, gfx::Size()),
17964 menu_->Cancel();
17969 diff --git a/src/cef/libcef/browser/native/menu_runner_linux.h b/src/cef/libcef/browser/native/menu…
17971 --- a/src/cef/libcef/browser/native/menu_runner_linux.h
17973 @@ -22,7 +22,9 @@ class CefMenuRunnerLinux : public CefMenuRunner {
17983 diff --git a/src/cef/libcef/browser/navigation_entry_impl.cc b/src/cef/libcef/browser/navigation_en…
17985 --- a/src/cef/libcef/browser/navigation_entry_impl.cc
17987 @@ -7,8 +7,11 @@
17999 @@ -71,3 +74,25 @@ CefRefPtr<CefSSLStatus> CefNavigationEntryImpl::GetSSLStatus() {
18001 return new CefSSLStatusImpl(mutable_value()->GetSSL());
18010 + auto favicon_status = mutable_value()->GetFavicon();
18018 + color_type = bitmap->colorType();
18019 + alpha_type = bitmap->alphaType();
18020 + pixel_width = bitmap->width();
18021 + pixel_height = bitmap->height();
18022 + *pixel_data = bitmap->getPixels();
18026 diff --git a/src/cef/libcef/browser/navigation_entry_impl.h b/src/cef/libcef/browser/navigation_ent…
18028 --- a/src/cef/libcef/browser/navigation_entry_impl.h
18030 @@ -33,6 +33,11 @@ class CefNavigationEntryImpl
18042 diff --git a/src/cef/libcef/browser/net_database/cef_data_base_impl.cc b/src/cef/libcef/browser/net…
18045 --- /dev/null
18047 @@ -0,0 +1,166 @@
18049 +// Use of this source code is governed by a BSD-style license that can be
18072 + return context ? context->GetDataBase() : nullptr;
18214 diff --git a/src/cef/libcef/browser/net_database/cef_data_base_impl.h b/src/cef/libcef/browser/net_…
18217 --- /dev/null
18219 @@ -0,0 +1,53 @@
18221 +// Use of this source code is governed by a BSD-style license that can be
18273 diff --git a/src/cef/libcef/browser/net_database/cef_dns_data_base.cc b/src/cef/libcef/browser/net_…
18276 --- /dev/null
18278 @@ -0,0 +1,52 @@
18280 +// Use of this source code is governed by a BSD-style license that can be
18289 +#include "third_party/abseil-cpp/absl/types/optional.h"
18313 + addrInfo = it->second;
18314 + auto canonical_name = (addrInfo->ai_canonname != nullptr)
18315 + ? absl::optional<std::string>(std::string(addrInfo->ai_canonname))
18321 + for (auto ai = addrInfo; ai != NULL; ai = ai->ai_next) {
18323 + // NOTE: Ignoring non-INET* families.
18324 + if (ipe.FromSockAddr(ai->ai_addr, ai->ai_addrlen))
18327 + LOG(INFO) << "Unknown family found in addrinfo: " << ai->ai_family;
18332 diff --git a/src/cef/libcef/browser/net_database/cef_dns_data_base.h b/src/cef/libcef/browser/net_d…
18335 --- /dev/null
18337 @@ -0,0 +1,14 @@
18339 +// Use of this source code is governed by a BSD-style license that can be
18352 diff --git a/src/cef/libcef/browser/net_service/cookie_manager_impl.cc b/src/cef/libcef/browser/net…
18354 --- a/src/cef/libcef/browser/net_service/cookie_manager_impl.cc
18356 @@ -11,6 +11,7 @@
18364 @@ -20,7 +21,7 @@ namespace {
18368 - CEF_REQUIRE_UIT();
18373 @@ -29,10 +30,10 @@ CefBrowserContext* GetBrowserContext(const CefBrowserContext::Getter& getter) {
18377 - CEF_REQUIRE_UIT();
18379 return browser_context->AsBrowserContext()
18380 ->GetDefaultStoragePartition()
18381 - ->GetCookieManagerForBrowserProcess();
18382 + ->GetCookieManagerForOhos();
18386 @@ -43,33 +44,10 @@ void RunAsyncCompletionOnUIThread(CefRefPtr<CefCompletionCallback> callback) {
18390 -// Always execute the callback asynchronously.
18391 -void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
18392 - net::CookieAccessResult access_result) {
18393 - if (!callback.get())
18394 - return;
18395 - const bool is_include = access_result.status.IsInclude();
18396 - if (!is_include) {
18397 - LOG(WARNING) << "SetCookie failed with reason: "
18398 - << access_result.status.GetDebugString();
18399 - }
18400 - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefSetCookieCallback::OnComplete,
18401 - callback.get(), is_include));
18402 -}
18403 -
18404 -// Always execute the callback asynchronously.
18405 -void DeleteCookiesCallbackImpl(CefRefPtr<CefDeleteCookiesCallback> callback,
18406 - uint32_t num_deleted) {
18407 - if (!callback.get())
18408 - return;
18409 - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefDeleteCookiesCallback::OnComplete,
18410 - callback.get(), num_deleted));
18411 -}
18412 -
18416 - CEF_REQUIRE_UIT();
18421 @@ -78,6 +56,13 @@ void ExecuteVisitor(CefRefPtr<CefCookieVisitor> visitor,
18428 + visitor->Visit(cookie, 0, 0, deleteCookie);
18435 @@ -92,32 +77,15 @@ void ExecuteVisitor(CefRefPtr<CefCookieVisitor> visitor,
18440 + visitor->SetCookieLine(CefString(cookie_line));
18442 -
18443 -// Always execute the callback asynchronously.
18444 -void GetAllCookiesCallbackImpl(
18445 - CefRefPtr<CefCookieVisitor> visitor,
18446 - const CefBrowserContext::Getter& browser_context_getter,
18447 - const net::CookieList& cookies) {
18448 - CEF_POST_TASK(CEF_UIT, base::BindOnce(&ExecuteVisitor, visitor,
18449 - browser_context_getter, cookies));
18450 -}
18451 -
18452 -void GetCookiesCallbackImpl(
18453 - CefRefPtr<CefCookieVisitor> visitor,
18454 - const CefBrowserContext::Getter& browser_context_getter,
18455 - const net::CookieAccessResultList& include_cookies,
18456 - const net::CookieAccessResultList&) {
18457 - net::CookieList cookies;
18458 - for (const auto& status : include_cookies) {
18459 - cookies.push_back(status.cookie);
18460 - }
18461 - GetAllCookiesCallbackImpl(visitor, browser_context_getter, cookies);
18462 -}
18463 -
18466 -CefCookieManagerImpl::CefCookieManagerImpl() {}
18474 @@ -139,6 +107,46 @@ void CefCookieManagerImpl::Initialize(
18521 @@ -179,9 +187,9 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
18525 - if (!gurl.is_valid())
18528 -
18533 @@ -195,6 +203,7 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
18541 @@ -204,11 +213,11 @@ bool CefCookieManagerImpl::DeleteCookies(
18545 - gurl, cookie_name, callback));
18550 - return DeleteCookiesInternal(gurl, cookie_name, callback);
18555 @@ -223,6 +232,41 @@ bool CefCookieManagerImpl::FlushStore(
18566 + GetCookieManager(browser_context)->BlockThirdPartyCookies(!accept);
18586 + ->AllowFileSchemeCookies(
18597 @@ -233,8 +277,9 @@ bool CefCookieManagerImpl::VisitAllCookiesInternal(
18601 - ->GetAllCookies(base::BindOnce(&GetAllCookiesCallbackImpl, visitor,
18602 - browser_context_getter_));
18603 + ->GetAllCookies(base::BindOnce(
18609 @@ -257,9 +302,11 @@ bool CefCookieManagerImpl::VisitUrlCookiesInternal(
18613 - ->GetCookieList(url, options, net::CookiePartitionKeyCollection(),
18614 - base::BindOnce(&GetCookiesCallbackImpl, visitor,
18615 - browser_context_getter_));
18616 + ->GetCookieList(
18624 @@ -310,14 +357,17 @@ bool CefCookieManagerImpl::SetCookieInternal(
18628 - ->SetCanonicalCookie(*canonical_cookie, url, options,
18629 - base::BindOnce(SetCookieCallbackImpl, callback));
18630 + ->SetCanonicalCookie(
18644 @@ -336,13 +386,20 @@ bool CefCookieManagerImpl::DeleteCookiesInternal(
18645 deletion_filter->cookie_name = cookie_name;
18649 + deletion_filter->session_control =
18658 - ->DeleteCookies(std::move(deletion_filter),
18659 - base::BindOnce(DeleteCookiesCallbackImpl, callback));
18660 + ->DeleteCookies(
18667 @@ -356,15 +413,16 @@ bool CefCookieManagerImpl::FlushStoreInternal(
18670 ->FlushCookieStore(
18671 - base::BindOnce(RunAsyncCompletionOnUIThread, callback));
18679 - if (!CEF_CURRENTLY_ON_UIT()) {
18680 - CEF_POST_TASK(
18681 - CEF_UIT,
18682 + if (!cookie_store_task_runner_->RunsTasksInCurrentSequence()) {
18683 + cookie_store_task_runner_->PostTask(
18688 @@ -378,7 +436,8 @@ void CefCookieManagerImpl::StoreOrTriggerInitCallback(
18692 - return CEF_CURRENTLY_ON_UIT() && initialized_;
18693 + return cookie_store_task_runner_->RunsTasksInCurrentSequence() &&
18697 // CefCookieManager methods ----------------------------------------------------
18698 @@ -389,3 +448,68 @@ CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager(
18700 return context ? context->GetCookieManager(callback) : nullptr;
18723 + cookie_store_task_runner_->PostTask(
18732 + cookie_store_task_runner_->PostTask(
18741 + cookie_store_task_runner_->PostTask(
18763 + cookie_store_task_runner_->PostTask(
18767 diff --git a/src/cef/libcef/browser/net_service/cookie_manager_impl.h b/src/cef/libcef/browser/net_…
18769 --- a/src/cef/libcef/browser/net_service/cookie_manager_impl.h
18771 @@ -5,11 +5,14 @@
18786 @@ -26,6 +29,12 @@ class CefCookieManagerImpl : public CefCookieManager {
18799 @@ -35,10 +44,15 @@ class CefCookieManagerImpl : public CefCookieManager {
18815 @@ -48,9 +62,25 @@ class CefCookieManagerImpl : public CefCookieManager {
18841 @@ -61,7 +91,10 @@ class CefCookieManagerImpl : public CefCookieManager {
18852 diff --git a/src/cef/libcef/browser/net_service/login_delegate.cc b/src/cef/libcef/browser/net_serv…
18854 --- a/src/cef/libcef/browser/net_service/login_delegate.cc
18856 @@ -5,6 +5,7 @@
18864 @@ -16,11 +17,16 @@
18872 - explicit AuthCallbackImpl(base::WeakPtr<LoginDelegate> delegate)
18882 @@ -61,8 +67,40 @@ class AuthCallbackImpl : public CefAuthCallback {
18891 + if (!dataBase->ExistHttpAuthCredentials()) {
18896 + dataBase->GetHttpAuthCredentials(host_, realm_, usernamePassword);
18902 + if (!task_runner_->RunsTasksInCurrentSequence()) {
18903 + task_runner_->PostTask(
18909 + delegate_->Continue(username, password);
18923 @@ -159,7 +197,8 @@ void LoginDelegate::Start(CefRefPtr<CefBrowserHostBase> browser,
18927 - new AuthCallbackImpl(weak_ptr_factory_.GetWeakPtr());
18933 diff --git a/src/cef/libcef/browser/net_service/net_helpers.cc b/src/cef/libcef/browser/net_service…
18936 --- /dev/null
18938 @@ -0,0 +1,109 @@
18940 +// Use of this source code is governed by a BSD-style license that can be
19048 diff --git a/src/cef/libcef/browser/net_service/net_helpers.h b/src/cef/libcef/browser/net_service/…
19051 --- /dev/null
19053 @@ -0,0 +1,40 @@
19055 +// Use of this source code is governed by a BSD-style license that can be
19094 diff --git a/src/cef/libcef/browser/net_service/proxy_url_loader_factory.cc b/src/cef/libcef/browse…
19096 --- a/src/cef/libcef/browser/net_service/proxy_url_loader_factory.cc
19098 @@ -13,6 +13,7 @@
19106 @@ -24,6 +25,7 @@
19114 @@ -65,6 +67,29 @@ bool DisableRequestHandlingForTesting() {
19121 + response->SetStatus(headers->response_code());
19122 + response->SetStatusText(headers->GetStatusText());
19127 + while (headers->EnumerateHeaderLines(&headers_line, &header_name,
19131 + response->SetHeaderMap(map);
19134 + headers->GetMimeType(&mime_type);
19135 + headers->GetCharset(&encoding);
19136 + response->SetMimeType(CefString(mime_type));
19137 + response->SetCharset(CefString(encoding));
19144 @@ -218,6 +243,12 @@ class InterceptedRequest : public network::mojom::URLLoader,
19157 @@ -469,6 +500,14 @@ void InterceptedRequest::Restart() {
19171 factory_->request_handler_->OnBeforeRequest(
19172 @@ -563,6 +602,23 @@ void InterceptedRequest::OnReceiveResponse(
19176 + if (current_response_->headers &&
19177 + current_response_->headers->response_code() >= 400) {
19181 + ExtractHttpErrorResponse(current_response_->headers.get());
19183 + request->SetURL(CefString(request_.url.spec()));
19184 + request->SetMethod(CefString(request_.method));
19185 + request->Set(request_.headers);
19186 + content::GetUIThreadTaskRunner({})->PostTask(
19195 // Set-Cookie if it existed.
19196 @@ -1161,6 +1217,24 @@ void InterceptedRequest::OnUploadProgressACK() {
19210 + if (!factory_->request_handler_) {
19214 + factory_->request_handler_->OnHttpError(id, request, is_main_frame,
19221 @@ -1342,6 +1416,14 @@ void ProxyURLLoaderFactory::CreateLoaderAndStart(
19236 diff --git a/src/cef/libcef/browser/net_service/proxy_url_loader_factory.h b/src/cef/libcef/browser…
19238 --- a/src/cef/libcef/browser/net_service/proxy_url_loader_factory.h
19240 @@ -1,11 +1,13 @@
19241 -// Copyright (c) 2019 The Chromium Embedded Framework Authors. Portions
19242 -// Copyright (c) 2018 The Chromium Authors. All rights reserved. Use of this
19243 -// source code is governed by a BSD-style license that can be found in the
19244 -// LICENSE file.
19247 +// reserved. Use of this source code is governed by a BSD-style license that can
19258 @@ -20,6 +22,9 @@
19260 #include "third_party/abseil-cpp/absl/types/optional.h"
19268 @@ -128,6 +133,13 @@ class InterceptedRequestHandler {
19282 diff --git a/src/cef/libcef/browser/net_service/resource_request_handler_wrapper.cc b/src/cef/libce…
19284 --- a/src/cef/libcef/browser/net_service/resource_request_handler_wrapper.cc
19286 @@ -1,6 +1,7 @@
19287 -// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
19288 -// reserved. Use of this source code is governed by a BSD-style license that
19289 -// can be found in the LICENSE file.
19292 +// reserved. Use of this source code is governed by a BSD-style license that can
19297 @@ -32,6 +33,7 @@
19302 #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
19305 @@ -567,9 +569,9 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
19309 -
19310 if (!cookie_helper::IsCookieableScheme(request->url,
19311 - init_state_->cookieable_schemes_)) {
19312 + init_state_->cookieable_schemes_) ||
19317 @@ -702,6 +704,80 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
19334 + if (!resource_handler && state->scheme_factory_) {
19336 + resource_handler = state->scheme_factory_->Create(
19337 + init_state_->browser_, init_state_->frame_, request->url.scheme(),
19338 + state->pending_request_.get());
19345 + state->was_custom_handled_ = true;
19348 + // "Accept-Language" header here so that it can be re-added in
19368 + if (state->handler_) {
19370 + resource_handler = state->handler_->GetResourceHandler(
19371 + init_state_->browser_, init_state_->frame_,
19372 + state->pending_request_.get());
19398 @@ -750,6 +826,9 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
19408 @@ -775,11 +854,11 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
19410 // "Accept-Language" header here so that it can be re-added in
19412 - request->headers.RemoveHeader(net::HttpRequestHeaders::kAcceptLanguage);
19421 @@ -948,7 +1027,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
19424 if (!cookie_helper::IsCookieableScheme(request->url,
19425 - init_state_->cookieable_schemes_)) {
19426 + init_state_->cookieable_schemes_) ||
19431 @@ -1099,6 +1179,27 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
19441 + if (!init_state_->browser_) {
19444 + CefRefPtr<CefClient> client = init_state_->browser_->GetHost()->GetClient();
19448 + CefRefPtr<CefLoadHandler> load_handler = client->GetLoadHandler();
19452 + load_handler->OnHttpError(request, is_main_frame, has_user_gesture,
19459 diff --git a/src/cef/libcef/browser/net_service/resource_request_handler_wrapper.h b/src/cef/libcef…
19461 --- a/src/cef/libcef/browser/net_service/resource_request_handler_wrapper.h
19463 @@ -1,6 +1,7 @@
19464 -// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
19465 -// reserved. Use of this source code is governed by a BSD-style license that
19466 -// can be found in the LICENSE file.
19469 +// reserved. Use of this source code is governed by a BSD-style license that can
19474 diff --git a/src/cef/libcef/browser/net_service/restrict_cookie_manager.cc b/src/cef/libcef/browser…
19477 --- /dev/null
19479 @@ -0,0 +1,191 @@
19481 +// Use of this source code is governed by a BSD-style license that can be
19515 + restricted_cookie_manager_->AllowCookies(url_, site_for_cookies_))
19516 + client_listener_->OnCookieChange(change);
19535 + content::GetIOThreadTaskRunner({})->PostTask(
19554 + underlying_restricted_cookie_manager_->GetAllForUrl(
19570 + underlying_restricted_cookie_manager_->SetCanonicalCookie(
19595 + underlying_restricted_cookie_manager_->AddChangeListener(
19609 + underlying_restricted_cookie_manager_->SetCookieFromString(
19623 + underlying_restricted_cookie_manager_->GetCookiesString(
19671 diff --git a/src/cef/libcef/browser/net_service/restrict_cookie_manager.h b/src/cef/libcef/browser/…
19674 --- /dev/null
19676 @@ -0,0 +1,100 @@
19678 +// Use of this source code is governed by a BSD-style license that can be
19777 diff --git a/src/cef/libcef/browser/osr/browser_platform_delegate_osr.cc b/src/cef/libcef/browser/o…
19779 --- a/src/cef/libcef/browser/osr/browser_platform_delegate_osr.cc
19781 @@ -82,6 +82,7 @@ void CefBrowserPlatformDelegateOsr::NotifyBrowserDestroyed() {
19783 static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
19786 view->ReleaseCompositor();
19789 @@ -157,8 +158,13 @@ void CefBrowserPlatformDelegateOsr::SendMouseWheelEvent(
19793 - if (view)
19794 - view->SendTouchEvent(event);
19797 + view->SendTouchEvent(event);
19805 diff --git a/src/cef/libcef/browser/osr/render_widget_host_view_osr.cc b/src/cef/libcef/browser/osr…
19807 --- a/src/cef/libcef/browser/osr/render_widget_host_view_osr.cc
19809 @@ -1,7 +1,7 @@
19810 -// Copyright (c) 2014 The Chromium Embedded Framework Authors.
19811 -// Portions copyright (c) 2012 The Chromium Authors. All rights reserved.
19812 -// Use of this source code is governed by a BSD-style license that can be
19813 -// found in the LICENSE file.
19816 +// reserved. Use of this source code is governed by a BSD-style license that can
19821 @@ -12,6 +12,7 @@
19829 @@ -46,13 +47,21 @@
19851 @@ -60,6 +69,25 @@ namespace {
19877 @@ -72,7 +100,10 @@ display::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) {
19881 -
19889 @@ -180,6 +211,19 @@ ui::ImeTextSpan::UnderlineStyle GetImeUnderlineStyle(
19898 + ui::GestureConfiguration::GetInstance()->long_press_time_in_ms());
19900 + ->max_touch_move_in_pixels_for_click();
19909 @@ -224,7 +268,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
19913 - // Matching the attributes from RecyclableCompositorMac.
19916 context_factory->AllocateFrameSinkId(), context_factory,
19918 @@ -234,11 +278,22 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
19919 compositor_->SetDelegate(this);
19920 compositor_->SetRootLayer(root_layer_.get());
19921 compositor_->AddChildFrameSink(GetFrameSinkId());
19922 -
19923 - content::RenderWidgetHostImpl* render_widget_host_impl =
19924 - content::RenderWidgetHostImpl::From(render_widget_host_);
19925 - if (render_widget_host_impl)
19926 - render_widget_host_impl->SetCompositorForFlingScheduler(compositor_.get());
19929 + << static_cast<uint32_t>(browser_impl_->GetAcceleratedWidget());
19931 + browser_impl_->GetAcceleratedWidget());
19932 + accelerate_widget_map_[browser_impl_->GetAcceleratedWidget()]++;
19935 + context_factory->AllocateFrameSinkId(), context_factory,
19938 + compositor->SetAcceleratedWidget(browser_impl_->GetAcceleratedWidget());
19940 + browser_impl_->GetAcceleratedWidget(), compositor);
19946 @@ -261,6 +316,10 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
19947 if (!render_widget_host_->is_hidden())
19957 @@ -277,20 +336,51 @@ CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
19965 -
19970 + auto it = accelerate_widget_map_.find(browser_impl_->GetAcceleratedWidget());
19977 - if (is_showing_) {
19978 - delegated_frame_host_->WasHidden(
19979 - content::DelegatedFrameHost::HiddenCause::kOther);
19983 + delegated_frame_host_->WasHidden(
19986 + delegated_frame_host_->DetachFromCompositor();
19989 - delegated_frame_host_->DetachFromCompositor();
19991 - delegated_frame_host_.reset(nullptr);
19996 + if (--accelerate_widget_map_[browser_impl_->GetAcceleratedWidget()] == 0) {
20001 + << static_cast<uint32_t>(browser_impl_->GetAcceleratedWidget());
20002 + auto it = compositor_map_.find(browser_impl_->GetAcceleratedWidget());
20004 + if (it->second != nullptr) {
20005 + delete it->second;
20009 + accelerate_widget_map_.erase(browser_impl_->GetAcceleratedWidget());
20014 // Called for full-screen widgets.
20015 @@ -325,10 +415,21 @@ CefRenderWidgetHostViewOSR::GetNativeViewAccessible() {
20019 -void CefRenderWidgetHostViewOSR::Focus() {}
20025 + widget->GotFocus();
20026 + widget->SetActive(true);
20030 - return false;
20035 + return widget->is_focused();
20039 @@ -358,6 +459,18 @@ void CefRenderWidgetHostViewOSR::ShowWithVisibility(
20045 + browser_impl_->GetAcceleratedWidget());
20046 + compositor->SetDelegate(this);
20047 + compositor->SetRootLayer(root_layer_.get());
20048 + compositor->AddChildFrameSink(GetFrameSinkId());
20053 + render_widget_host_impl->SetCompositorForFlingScheduler(compositor);
20057 render_widget_host_->WasShown(
20058 @@ -371,7 +484,11 @@ void CefRenderWidgetHostViewOSR::ShowWithVisibility(
20063 delegated_frame_host_->AttachToCompositor(compositor_.get());
20065 + delegated_frame_host_->AttachToCompositor(compositor);
20067 delegated_frame_host_->WasShown(GetLocalSurfaceId(), GetViewBounds().size(),
20070 @@ -379,8 +496,13 @@ void CefRenderWidgetHostViewOSR::ShowWithVisibility(
20071 if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
20082 video_consumer_->SetActive(true);
20084 @@ -396,6 +518,10 @@ void CefRenderWidgetHostViewOSR::Hide() {
20086 browser_impl_->CancelContextMenu();
20089 + selection_controller_client_->CloseQuickMenuAndHideHandles();
20093 video_consumer_->SetActive(false);
20095 @@ -425,6 +551,11 @@ void CefRenderWidgetHostViewOSR::EnsureSurfaceSynchronizedForWebTest() {
20107 @@ -460,15 +591,36 @@ void CefRenderWidgetHostViewOSR::SetDisplayFeatureForTesting(
20111 - return blink::mojom::PointerLockResult::kPermissionDenied;
20121 - return blink::mojom::PointerLockResult::kPermissionDenied;
20129 -void CefRenderWidgetHostViewOSR::UnlockMouse() {}
20136 + render_widget_host_->SendMouseLockLost();
20137 + render_widget_host_->LostMouseLock();
20147 @@ -497,6 +649,10 @@ void CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete(
20158 @@ -679,8 +835,14 @@ display::ScreenInfos CefRenderWidgetHostViewOSR::GetNewScreenInfosForUpdate() {
20172 browser_impl_->client()->GetRenderHandler();
20173 @@ -705,6 +867,10 @@ display::ScreenInfos CefRenderWidgetHostViewOSR::GetNewScreenInfosForUpdate() {
20184 @@ -849,7 +1015,13 @@ const viz::FrameSinkId& CefRenderWidgetHostViewOSR::GetFrameSinkId() const {
20189 return compositor_ ? compositor_->frame_sink_id() : viz::FrameSinkId();
20192 + browser_impl_->GetAcceleratedWidget());
20193 + return compositor ? compositor->frame_sink_id() : viz::FrameSinkId();
20198 @@ -903,6 +1075,10 @@ void CefRenderWidgetHostViewOSR::DidNavigate() {
20209 @@ -949,6 +1125,59 @@ void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation(
20250 + selection_controller_client_->UpdateClientSelectionBounds(selection_start_,
20259 + browser_impl_->client()->GetDisplayHandler();
20261 + float ratio = browser_impl_->GetVirtualPixelRatio();
20262 + handler->OnScaleChanged(browser_impl_.get(),
20269 @@ -962,9 +1191,17 @@ CefRenderWidgetHostViewOSR::CreateHostDisplayClient() {
20275 compositor_->SetBackgroundColor(background_color_);
20279 + browser_impl_->GetAcceleratedWidget());
20281 + compositor->SetBackgroundColor(background_color_);
20287 @@ -980,6 +1217,10 @@ void CefRenderWidgetHostViewOSR::WasResized() {
20298 @@ -1073,8 +1314,15 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
20300 render_widget_host_->ProgressFlingIfNeeded(frame_time);
20304 compositor_->IssueExternalBeginFrame(
20307 + browser_impl_->GetAcceleratedWidget());
20309 + compositor->IssueExternalBeginFrame(
20314 @@ -1092,6 +1340,10 @@ void CefRenderWidgetHostViewOSR::SendKeyEvent(
20319 + selection_controller_client_->CloseQuickMenuAndHideHandles();
20323 // out-of-process iframes), pick the one that should process this event.
20324 if (render_widget_host_ && render_widget_host_->delegate()) {
20325 @@ -1120,6 +1372,10 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent(
20326 browser_impl_->CancelContextMenu();
20330 + selection_controller_client_->CloseQuickMenuAndHideHandles();
20334 if (popup_host_view_->popup_position_.Contains(
20336 @@ -1182,6 +1438,10 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
20338 browser_impl_->CancelContextMenu();
20341 + selection_controller_client_->CloseQuickMenuAndHideHandles();
20345 if (popup_host_view_->popup_position_.Contains(
20347 @@ -1271,8 +1531,14 @@ void CefRenderWidgetHostViewOSR::SendTouchEvent(const CefTouchEvent& event) {
20351 - if (!pointer_state_.OnTouch(event))
20356 + if (selection_controller_->WillHandleTouchEvent(pointer_state_)) {
20363 @@ -1334,8 +1600,13 @@ void CefRenderWidgetHostViewOSR::SetFocus(bool focus) {
20364 widget->GotFocus();
20365 widget->SetActive(true);
20369 browser_impl_->CancelContextMenu();
20372 + selection_controller_client_->CloseQuickMenuAndHideHandles();
20375 widget->SetActive(false);
20376 widget->LostFocus();
20377 @@ -1347,23 +1618,27 @@ void CefRenderWidgetHostViewOSR::OnUpdateTextInputStateCalled(
20380 const auto state = text_input_manager->GetTextInputState();
20381 - if (state && !state->show_ime_if_needed)
20382 - return;
20383 + if (state && !state->show_ime_if_needed) {
20389 if (state && state->type != ui::TEXT_INPUT_TYPE_NONE) {
20394 mode = static_cast<CefRenderHandler::TextInputMode>(state->mode);
20395 + show_keyboard = state->show_ime_if_needed;
20399 browser_impl_->GetClient()->GetRenderHandler();
20402 - handler->OnVirtualKeyboardRequested(browser_impl_->GetBrowser(), mode);
20403 + handler->OnVirtualKeyboardRequested(browser_impl_->GetBrowser(), mode,
20408 @@ -1480,6 +1755,36 @@ ui::Layer* CefRenderWidgetHostViewOSR::GetRootLayer() const {
20413 + if (text_input_manager_ && text_input_manager_->GetTextInputState())
20414 + return text_input_manager_->GetTextInputState()->type;
20428 + browser_impl_->client()->GetRenderHandler();
20430 + handler->OnTouchSelectionChanged(insert_handle, start_selection_handle,
20437 + selection_controller_client_->NeedPopupInsertTouchHandleQuickMenu();
20445 @@ -1499,9 +1804,17 @@ void CefRenderWidgetHostViewOSR::SetFrameRate() {
20451 compositor_->SetDisplayVSyncParameters(
20455 + browser_impl_->GetAcceleratedWidget());
20457 + compositor->SetDisplayVSyncParameters(
20463 @@ -1561,9 +1874,17 @@ bool CefRenderWidgetHostViewOSR::SetRootLayerSize(bool force) {
20465 GetRootLayer()->SetBounds(gfx::Rect(GetViewBounds().size()));
20470 compositor_->SetScaleAndSize(
20473 + browser_impl_->GetAcceleratedWidget());
20476 + compositor->SetScaleAndSize(
20481 @@ -1652,6 +1973,18 @@ void CefRenderWidgetHostViewOSR::OnScrollOffsetChanged() {
20489 + browser_impl_->client()->GetRenderHandler();
20491 + handler->OnRootLayerChanged(browser_impl_.get(), root_layer_size_.height(),
20500 @@ -1714,3 +2047,25 @@ void CefRenderWidgetHostViewOSR::UpdateBackgroundColorFromRenderer(
20501 GetRootLayer()->SetFillsBoundsOpaquely(opaque);
20502 GetRootLayer()->SetColor(color);
20524 + return it->second;
20526 diff --git a/src/cef/libcef/browser/osr/render_widget_host_view_osr.h b/src/cef/libcef/browser/osr/…
20528 --- a/src/cef/libcef/browser/osr/render_widget_host_view_osr.h
20530 @@ -1,7 +1,7 @@
20531 -// Copyright (c) 2014 The Chromium Embedded Framework Authors.
20532 -// Portions copyright (c) 2012 The Chromium Authors. All rights reserved.
20533 -// Use of this source code is governed by a BSD-style license that can be
20534 -// found in the LICENSE file.
20537 +// reserved. Use of this source code is governed by a BSD-style license that can
20542 @@ -9,6 +9,7 @@
20550 @@ -32,6 +33,7 @@
20551 …#include "third_party/blink/public/mojom/widget/record_content_to_visible_time_request.mojom-forwa…
20553 #include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
20558 @@ -47,6 +49,10 @@
20569 @@ -59,6 +65,7 @@ class CursorManager;
20577 @@ -118,6 +125,8 @@ class CefRenderWidgetHostViewOSR
20586 @@ -130,6 +139,7 @@ class CefRenderWidgetHostViewOSR
20594 @@ -285,6 +295,30 @@ class CefRenderWidgetHostViewOSR
20625 @@ -302,8 +336,15 @@ class CefRenderWidgetHostViewOSR
20641 @@ -342,6 +383,16 @@ class CefRenderWidgetHostViewOSR
20658 @@ -387,6 +438,9 @@ class CefRenderWidgetHostViewOSR
20668 @@ -420,6 +474,16 @@ class CefRenderWidgetHostViewOSR
20685 diff --git a/src/cef/libcef/browser/osr/touch_handle_drawable_osr.cc b/src/cef/libcef/browser/osr/t…
20688 --- /dev/null
20690 @@ -0,0 +1,117 @@
20693 +// Use of this source code is governed by a BSD-style license that can be
20771 + edge_height_ = bottom.y() - top.y();
20782 + auto browser = rwhv_->browser_impl();
20783 + auto handler = browser->GetClient()->GetRenderHandler();
20784 + handler->GetTouchHandleSize(
20792 + relative_bounds_ = gfx::RectF(-handle_width / 2.0, 0,
20796 + gfx::RectF(-handle_width / 2.0,
20797 + -edge_height_ - handle_height,
20804 + auto browser = rwhv_->browser_impl();
20805 + auto handler = browser->GetClient()->GetRenderHandler();
20806 + handler->OnTouchHandleStateChanged(browser.get(), state);
20809 diff --git a/src/cef/libcef/browser/osr/touch_handle_drawable_osr.h b/src/cef/libcef/browser/osr/to…
20812 --- /dev/null
20814 @@ -0,0 +1,64 @@
20817 +// Use of this source code is governed by a BSD-style license that can be
20880 diff --git a/src/cef/libcef/browser/osr/touch_selection_controller_client_osr.cc b/src/cef/libcef/b…
20883 --- /dev/null
20885 @@ -0,0 +1,619 @@
20888 +// Use of this source code is governed by a BSD-style license that can be
20919 +constexpr int kInvalidCommandId = -1;
20984 + state.enabled = handle->GetEnabled();
20985 + state.origin = {handle->focus_bottom().x(), handle->focus_bottom().y()};
20986 + state.edge_height = handle->focus_bottom().y() - handle->focus_top().y();
20987 + state.alpha = handle->alpha();
21013 + rwhv_->selection_controller()->HideAndDisallowShowingAutomatically();
21032 + rwhv_->selection_controller()->SetTemporarilyHidden(true);
21038 + active_client_->DidScroll();
21039 + rwhv_->selection_controller()->SetTemporarilyHidden(false);
21100 + GetTouchSelectionController()->OnSelectionBoundsChanged(start, end);
21114 + return rwhv_->selection_controller();
21131 + return active_menu_client_->IsCommandIdEnabled(command);
21143 + auto browser = rwhv_->browser_impl();
21144 + if (auto handler = browser->client()->GetContextMenuHandler()) {
21145 + handler->OnQuickMenuDismissed(browser.get(), browser->GetFocusedFrame());
21147 + if (browser->web_contents()) {
21148 + browser->web_contents()->SetShowingContextMenu(false);
21153 + auto browser = rwhv_->browser_impl();
21154 + if (auto handler = browser->client()->GetContextMenuHandler()) {
21156 + rwhv_->selection_controller()->GetVisibleRectBetweenBounds();
21160 + auto client_bounds = gfx::RectF(rwhv_->GetViewBounds());
21164 + gfx::Vector2dF diagonal = bottom_right - origin;
21169 + if (active_menu_client_->IsCommandIdEnabled(command)) {
21180 + if (!handler->RunQuickMenu(
21181 + browser, browser->GetFocusedFrame(),
21189 + callbackImpl->Disconnect();
21192 + if (browser->web_contents()) {
21193 + browser->web_contents()->SetShowingContextMenu(true);
21234 + active_client_->MoveCaret(position);
21239 + if (auto host_delegate = rwhv_->host()->delegate()) {
21240 + host_delegate->MoveCaret(gfx::ToRoundedPoint(position));
21246 + active_client_->MoveRangeSelectionExtent(extent);
21251 + if (auto host_delegate = rwhv_->host()->delegate()) {
21252 + host_delegate->MoveRangeSelectionExtent(gfx::ToRoundedPoint(extent));
21259 + active_client_->SelectBetweenCoordinates(base, extent);
21265 + if (auto host_delegate = rwhv_->host()->delegate()) {
21266 + host_delegate->SelectRange(gfx::ToRoundedPoint(base),
21278 + ConvertTouchHandleState(controller->GetInsertHandle(), insert_handle);
21279 + ConvertTouchHandleState(controller->GetStartSelectionHandle(),
21281 + ConvertTouchHandleState(controller->GetEndSelectionHandle(),
21283 + rwhv_->OnTouchSelectionChanged(insert_handle, start_selection_handle,
21299 + if (rwhv_ && rwhv_->browser_impl()) {
21301 + rwhv_->browser_impl()->GetTouchInsertHandleMenuShow();
21338 + if (rwhv_ && rwhv_->browser_impl()) {
21339 + rwhv_->browser_impl()->SetTouchInsertHandleMenuShow(false);
21377 + bool editable = rwhv_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE;
21378 + bool readable = rwhv_->GetTextInputType() != ui::TEXT_INPUT_TYPE_PASSWORD;
21379 + bool has_selection = !rwhv_->GetSelectedText().empty();
21392 + ui::Clipboard::GetForCurrentThread()->ReadText(
21394 + if (rwhv_->GetTextInputType() == ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE &&
21396 + can_paste = ui::Clipboard::GetForCurrentThread()->IsFormatAvailable(
21418 + rwhv_->selection_controller()->HideAndDisallowShowingAutomatically();
21421 + content::RenderWidgetHostDelegate* host_delegate = rwhv_->host()->delegate();
21426 + auto browser = rwhv_->browser_impl();
21427 + if (auto handler = browser->client()->GetContextMenuHandler()) {
21428 + if (handler->OnQuickMenuCommand(
21429 + browser.get(), browser->GetFocusedFrame(), command_id,
21438 + host_delegate->Cut();
21441 + host_delegate->Copy();
21442 + browser->web_contents()->CollapseSelection();
21445 + host_delegate->Paste();
21448 + host_delegate->SelectAll();
21455 + host_delegate->ExecuteEditCommand("Unselect", value);
21460 + host_delegate->ExecuteEditCommand("Unselect", value);
21467 + rwhv_->selection_controller()->GetVisibleRectBetweenBounds();
21470 + rwhv_->host()->ShowContextMenuAtPoint(gfx::ToRoundedPoint(anchor_point),
21473 + // Hide selection handles after getting rect-between-bounds from touch
21476 + rwhv_->selection_controller()->HideAndDisallowShowingAutomatically();
21481 + rwhv_->selection_controller()->GetVisibleRectBetweenBounds();
21484 + rwhv_->host()->ShowContextMenuAtPoint(gfx::ToRoundedPoint(anchor_point),
21494 + return rwhv_->GetSelectedText();
21505 diff --git a/src/cef/libcef/browser/osr/touch_selection_controller_client_osr.h b/src/cef/libcef/br…
21508 --- /dev/null
21510 @@ -0,0 +1,159 @@
21513 +// Use of this source code is governed by a BSD-style license that can be
21626 + // Not owned, non-null for the lifetime of this object.
21671 diff --git a/src/cef/libcef/browser/permission/alloy_access_request.cc b/src/cef/libcef/browser/per…
21674 --- /dev/null
21676 @@ -0,0 +1,26 @@
21678 +// Use of this source code is governed by a BSD-style license that can be
21704 diff --git a/src/cef/libcef/browser/permission/alloy_access_request.h b/src/cef/libcef/browser/perm…
21707 --- /dev/null
21709 @@ -0,0 +1,48 @@
21711 +// Use of this source code is governed by a BSD-style license that can be
21758 diff --git a/src/cef/libcef/browser/permission/alloy_geolocation_access.cc b/src/cef/libcef/browser…
21761 --- /dev/null
21763 @@ -0,0 +1,50 @@
21765 +// Use of this source code is governed by a BSD-style license that can be
21778 + return dataBase->ExistPermissionByOrigin(origin,
21788 + dataBase->GetPermissionResultByOrigin(
21798 + dataBase->SetPermissionByOrigin(origin, CefDataBaseImpl::GEOLOCATION_TYPE,
21807 + dataBase->SetPermissionByOrigin(origin, CefDataBaseImpl::GEOLOCATION_TYPE,
21814 diff --git a/src/cef/libcef/browser/permission/alloy_geolocation_access.h b/src/cef/libcef/browser/…
21817 --- /dev/null
21819 @@ -0,0 +1,34 @@
21821 +// Use of this source code is governed by a BSD-style license that can be
21854 diff --git a/src/cef/libcef/browser/permission/alloy_permission_manager.cc b/src/cef/libcef/browser…
21857 --- /dev/null
21859 @@ -0,0 +1,431 @@
21861 +// Use of this source code is governed by a BSD-style license that can be
21932 + results_[result->second] = status;
21942 + return results_[result->second];
22000 + if (!it.GetCurrentValue()->HasPermissionType(permissions[i]) ||
22001 + it.GetCurrentValue()->requesting_origin_ != requesting_origin) {
22004 + if (it.GetCurrentValue()->IsCompleted(permissions[i])) {
22005 + pending_request->SetPermissionStatus(
22007 + it.GetCurrentValue()->GetPermissionStatus(permissions[i]));
22034 + // PermissionType::MIDI is permitted within the previous for-loop, all
22037 + if (pending_request_raw->IsCompleted()) {
22038 + std::vector<PermissionStatus> results = pending_request_raw->results_;
22040 + std::move(pending_request_raw->callback_);
22057 + browser->AskGeolocationPermission(
22058 + pending_request_raw->requesting_origin_.spec(),
22064 + browser->AskProtectedMediaIdentifierPermission(
22065 + pending_request_raw->requesting_origin_.spec(),
22071 + browser->AskMIDISysexPermission(
22072 + pending_request_raw->requesting_origin_.spec(),
22100 + pending_request_raw->SetPermissionStatus(permission_type,
22106 + pending_request_raw->SetPermissionStatus(permission_type,
22123 + manager->unhandled_requests_.Lookup(request_id);
22129 + &manager->unhandled_requests_);
22131 + if (!it.GetCurrentValue()->HasPermissionType(permission) ||
22132 + it.GetCurrentValue()->requesting_origin_ !=
22133 + pending_request->requesting_origin_) {
22136 + it.GetCurrentValue()->SetPermissionStatus(permission, status);
22137 + if (it.GetCurrentValue()->IsCompleted()) {
22139 + if (!it.GetCurrentValue()->IsCancelled()) {
22141 + std::move(it.GetCurrentValue()->callback_),
22142 + std::move(it.GetCurrentValue()->results_));
22147 + manager->unhandled_requests_.Remove(id);
22170 + render_frame_host->GetMainFrame()));
22203 + if (pending_request == nullptr || pending_request->IsCancelled())
22205 + pending_request->Cancel();
22207 + const GURL& requesting_origin = pending_request->requesting_origin_;
22210 + pending_request->render_frame_host_);
22212 + for (auto permission : pending_request->permissions_) {
22214 + if (pending_request->IsCompleted(permission))
22224 + it.GetCurrentValue()->HasPermissionType(permission) &&
22225 + it.GetCurrentValue()->requesting_origin_ == requesting_origin &&
22226 + !it.GetCurrentValue()->IsCompleted(permission)) {
22234 + pending_request->SetPermissionStatus(permission, PermissionStatus::DENIED);
22240 + if (pending_request->IsCompleted())
22251 + browser->AbortAskGeolocationPermission(requesting_origin.spec());
22255 + browser->AbortAskProtectedMediaIdentifierPermission(
22260 + browser->AbortAskMIDISysexPermission(requesting_origin.spec());
22291 diff --git a/src/cef/libcef/browser/permission/alloy_permission_manager.h b/src/cef/libcef/browser/…
22294 --- /dev/null
22296 @@ -0,0 +1,93 @@
22298 +// Use of this source code is governed by a BSD-style license that can be
22390 diff --git a/src/cef/libcef/browser/permission/alloy_permission_request_handler.cc b/src/cef/libcef…
22393 --- /dev/null
22395 @@ -0,0 +1,122 @@
22397 +// Use of this source code is governed by a BSD-style license that can be
22413 + web_contents->GetController().GetLastCommittedEntry();
22414 + return entry ? entry->GetUniqueID() : 0;
22431 + if (Preauthorized(request->Origin(), request->ResourceAcessId())) {
22432 + request->ReportRequestResult(true);
22437 + client_->OnPermissionRequest(request);
22454 + CefRefPtr<CefAccessRequest> request = i->get();
22456 + client_->OnPermissionRequestCanceled(request);
22470 + if (i->get() && i->get()->Origin() == origin &&
22471 + i->get()->ResourceAcessId() == resources) {
22494 + const ui::PageTransition transition = details.entry->GetTransitionType();
22497 + contents_unique_id_ != details.entry->GetUniqueID()) {
22499 + contents_unique_id_ = details.entry->GetUniqueID();
22505 + if (!i->get())
22516 + return i != preauthorized_permission_.end() && i->second == resources;
22519 diff --git a/src/cef/libcef/browser/permission/alloy_permission_request_handler.h b/src/cef/libcef/…
22522 --- /dev/null
22524 @@ -0,0 +1,72 @@
22526 +// Use of this source code is governed by a BSD-style license that can be
22597 diff --git a/src/cef/libcef/browser/prefs/renderer_prefs.cc b/src/cef/libcef/browser/prefs/renderer…
22599 --- a/src/cef/libcef/browser/prefs/renderer_prefs.cc
22601 @@ -1,4 +1,5 @@
22602 -// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
22605 // reserved. Use of this source code is governed by a BSD-style license that can
22608 @@ -9,6 +10,7 @@
22616 @@ -32,6 +34,7 @@
22624 @@ -225,6 +228,27 @@ bool UpdatePreferredColorScheme(blink::web_pref::WebPreferences* web_prefs,
22625 return old_preferred_color_scheme != web_prefs->preferred_color_scheme;
22631 + auto frame = browser->GetMainFrame();
22632 + if (frame && frame->IsValid() &&
22633 + (browser->settings().text_size_percent > 0)) {
22636 + ->PutZoomingForTextFactor(browser->settings().text_size_percent /
22640 + static_cast<CefRenderWidgetHostViewOSR*>(rvh->GetWidget()->GetView());
22642 + view->SetDoubleTapSupportEnabled(
22643 + browser->settings().supports_double_tap_zoom);
22644 + view->SetMultiTouchZoomSupportEnabled(
22645 + browser->settings().supports_multi_touch_zoom);
22652 @@ -298,7 +322,7 @@ void SetCefPrefs(const CefBrowserSettings& cef,
22656 -
22661 @@ -318,7 +342,7 @@ void SetCefPrefs(const CefBrowserSettings& cef,
22665 - SET_STATE(cef.image_loading, web.loads_images_automatically);
22670 @@ -332,6 +356,23 @@ void SetCefPrefs(const CefBrowserSettings& cef,
22694 @@ -416,6 +457,8 @@ void PopulateWebPreferences(content::RenderViewHost* rvh,
22696 SetCefPrefs(browser->settings(), web);
22700 web.picture_in_picture_enabled = browser->IsPictureInPictureSupported();
22703 diff --git a/src/cef/libcef/browser/prefs/renderer_prefs.h b/src/cef/libcef/browser/prefs/renderer_…
22705 --- a/src/cef/libcef/browser/prefs/renderer_prefs.h
22707 @@ -1,4 +1,5 @@
22708 -// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
22711 // reserved. Use of this source code is governed by a BSD-style license that can
22714 diff --git a/src/cef/libcef/browser/request_context_impl.cc b/src/cef/libcef/browser/request_contex…
22716 --- a/src/cef/libcef/browser/request_context_impl.cc
22718 @@ -3,6 +3,7 @@
22726 @@ -20,6 +21,7 @@
22734 @@ -54,6 +56,10 @@ const char* GetTypeString(base::Value::Type type) {
22740 + net::CertDatabase::GetInstance()->NotifyObserversCertDBChanged();
22745 @@ -340,6 +346,18 @@ CefRefPtr<CefCookieManager> CefRequestContextImpl::GetCookieManager(
22764 @@ -478,6 +496,16 @@ void CefRequestContextImpl::ClearCertificateExceptions(
22781 @@ -690,6 +718,29 @@ void CefRequestContextImpl::ClearCertificateExceptionsInternal(
22798 + content::GetIOThreadTaskRunner({})->PostTask(
22811 @@ -740,6 +791,20 @@ void CefRequestContextImpl::InitializeCookieManagerInternal(
22823 + web_storage->Initialize(browser_context_getter,
22832 diff --git a/src/cef/libcef/browser/request_context_impl.h b/src/cef/libcef/browser/request_context…
22834 --- a/src/cef/libcef/browser/request_context_impl.h
22836 @@ -9,7 +9,9 @@
22846 @@ -66,6 +68,9 @@ class CefRequestContextImpl : public CefRequestContext {
22856 @@ -81,6 +86,8 @@ class CefRequestContextImpl : public CefRequestContext {
22865 @@ -149,6 +156,9 @@ class CefRequestContextImpl : public CefRequestContext {
22875 @@ -162,6 +172,8 @@ class CefRequestContextImpl : public CefRequestContext {
22884 diff --git a/src/cef/libcef/browser/storage/web_storage_impl.cc b/src/cef/libcef/browser/storage/we…
22887 --- /dev/null
22889 @@ -0,0 +1,372 @@
22891 +// Use of this source code is governed by a BSD-style license that can be
22966 + quota_manager_->GetUsageAndQuota(
23016 + return browser_context->AsBrowserContext()->GetDefaultStoragePartition();
23021 + return GetStoragePartitionDelegate(browser_context)->GetQuotaManager();
23040 + ->ClearData(
23074 + ->ClearDataForOrigin(
23108 + ->Run();
23238 + callback.get()->OnOrigins(origins);
23239 + callback.get()->OnQuotas(quotas);
23240 + callback.get()->OnUsages(usages);
23241 + callback.get()->OnComplete();
23253 + callback.get()->OnComplete(result);
23260 + return context ? context->GetWebStorage(callback) : nullptr;
23262 diff --git a/src/cef/libcef/browser/storage/web_storage_impl.h b/src/cef/libcef/browser/storage/web…
23265 --- /dev/null
23267 @@ -0,0 +1,72 @@
23269 +// Use of this source code is governed by a BSD-style license that can be
23331 + // Only accessed on the UI thread. Will be non-null after Initialize().
23340 diff --git a/src/cef/libcef/browser/views/window_impl.cc b/src/cef/libcef/browser/views/window_impl…
23342 --- a/src/cef/libcef/browser/views/window_impl.cc
23344 @@ -53,6 +53,7 @@ void InitializeUITesting() {
23352 @@ -61,6 +62,7 @@ void InitializeUITesting() {
23360 diff --git a/src/cef/libcef/browser/x509_certificate_impl.h b/src/cef/libcef/browser/x509_certifica…
23362 --- a/src/cef/libcef/browser/x509_certificate_impl.h
23364 @@ -41,6 +41,8 @@ class CefX509CertificateImpl : public CefX509Certificate {
23373 diff --git a/src/cef/libcef/common/alloy/alloy_main_delegate.cc b/src/cef/libcef/common/alloy/alloy…
23375 --- a/src/cef/libcef/common/alloy/alloy_main_delegate.cc
23377 @@ -161,7 +161,7 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
23378 command_line->AppendSwitchASCII(switches::kLang,
23379 CefString(&settings_->locale).ToString());
23380 } else if (!command_line->HasSwitch(switches::kLang)) {
23381 - command_line->AppendSwitchASCII(switches::kLang, "en-US");
23382 + command_line->AppendSwitchASCII(switches::kLang, "zh-CN");
23386 @@ -212,6 +212,10 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
23388 CefString(&settings_->javascript_flags).ToString());
23390 + if (settings_->user_data_path.length > 0) {
23391 + command_line->AppendSwitchPath(switches::kUserDataDir,
23392 + CefString(&settings_->user_data_path));
23395 if (settings_->pack_loading_disabled) {
23396 command_line->AppendSwitch(switches::kDisablePackLoading);
23397 @@ -474,6 +478,22 @@ AlloyMainDelegate::GetWebWorkerTaskRunner() {
23420 @@ -522,6 +542,10 @@ void AlloyMainDelegate::InitializeResourceBundle() {
23428 std::string locale = command_line->GetSwitchValueASCII(switches::kLang);
23431 @@ -531,7 +555,6 @@ void AlloyMainDelegate::InitializeResourceBundle() {
23434 g_browser_process->SetApplicationLocale(loaded_locale);
23435 -
23439 diff --git a/src/cef/libcef/common/alloy/alloy_main_delegate.h b/src/cef/libcef/common/alloy/alloy_…
23441 --- a/src/cef/libcef/common/alloy/alloy_main_delegate.h
23443 @@ -81,6 +81,9 @@ class AlloyMainDelegate : public content::ContentMainDelegate,
23453 diff --git a/src/cef/libcef/common/app_manager.cc b/src/cef/libcef/common/app_manager.cc
23455 --- a/src/cef/libcef/common/app_manager.cc
23457 @@ -74,6 +74,20 @@ const CefAppManager::SchemeInfoList* CefAppManager::GetCustomSchemes() {
23478 @@ -85,6 +99,34 @@ void CefAppManager::AddAdditionalSchemes(
23483 + if (cmdLine->HasSwitch(switches::kProcessType)) {
23485 + if (cmdLine->HasSwitch(switches::kOhosCustomScheme)) {
23486 + std::string cmdlineSchemes = cmdLine->GetSwitchValue(switches::kOhosCustomScheme).ToString…
23513 diff --git a/src/cef/libcef/common/app_manager.h b/src/cef/libcef/common/app_manager.h
23515 --- a/src/cef/libcef/common/app_manager.h
23517 @@ -64,6 +64,7 @@ class CefAppManager {
23525 diff --git a/src/cef/libcef/common/extensions/extensions_util.cc b/src/cef/libcef/common/extensions…
23527 --- a/src/cef/libcef/common/extensions/extensions_util.cc
23529 @@ -18,10 +18,14 @@ bool ExtensionsEnabled() {
23535 ExtensionsEnabled() && !base::CommandLine::ForCurrentProcess()->HasSwitch(
23544 diff --git a/src/cef/libcef/common/javascript/oh_gin_javascript_bridge_errors.cc b/src/cef/libcef/c…
23547 --- /dev/null
23549 @@ -0,0 +1,34 @@
23552 +// Use of this source code is governed by a BSD-style license that can be
23585 diff --git a/src/cef/libcef/common/javascript/oh_gin_javascript_bridge_errors.h b/src/cef/libcef/co…
23588 --- /dev/null
23590 @@ -0,0 +1,25 @@
23593 +// Use of this source code is governed by a BSD-style license that can be
23616 diff --git a/src/cef/libcef/common/javascript/oh_gin_javascript_bridge_message_generator.cc b/src/c…
23619 --- /dev/null
23621 @@ -0,0 +1,29 @@
23624 +// Use of this source code is governed by a BSD-style license that can be
23652 diff --git a/src/cef/libcef/common/javascript/oh_gin_javascript_bridge_message_generator.h b/src/ce…
23655 --- /dev/null
23657 @@ -0,0 +1,6 @@
23660 +// Use of this source code is governed by a BSD-style license that can be
23665 diff --git a/src/cef/libcef/common/javascript/oh_gin_javascript_bridge_messages.h b/src/cef/libcef/…
23668 --- /dev/null
23670 @@ -0,0 +1,49 @@
23673 +// Use of this source code is governed by a BSD-style license that can be
23676 +// IPC messages for injected Javascript objects (Gin-based implementation).
23721 diff --git a/src/cef/libcef/common/javascript/oh_gin_javascript_bridge_value.cc b/src/cef/libcef/co…
23724 --- /dev/null
23726 @@ -0,0 +1,147 @@
23729 +// Use of this source code is governed by a BSD-style license that can be
23796 + if (!value->is_blob())
23798 + if (value->GetBlob().size() < sizeof(Header))
23800 + base::Pickle pickle(reinterpret_cast<const char*>(value->GetBlob().data()),
23801 + value->GetBlob().size());
23803 + if (!pickle.data() || pickle.size() - pickle.payload_size() != sizeof(Header))
23806 + return (header->magic == kHeaderMagic && header->type >= TYPE_FIRST_VALUE &&
23807 + header->type < TYPE_LAST_VALUE);
23814 + value->is_blob() ? new OhGinJavascriptBridgeValue(value) : NULL);
23819 + DCHECK(header->type >= TYPE_FIRST_VALUE && header->type < TYPE_LAST_VALUE);
23820 + return static_cast<Type>(header->type);
23857 + header->magic = kHeaderMagic;
23858 + header->type = type;
23863 + : pickle_(reinterpret_cast<const char*>(value->GetBlob().data()),
23864 + value->GetBlob().size()) {
23874 diff --git a/src/cef/libcef/common/javascript/oh_gin_javascript_bridge_value.h b/src/cef/libcef/com…
23877 --- /dev/null
23879 @@ -0,0 +1,66 @@
23882 +// Use of this source code is governed by a BSD-style license that can be
23925 + // De-serialization
23947 diff --git a/src/cef/libcef/common/mojom/cef.mojom b/src/cef/libcef/common/mojom/cef.mojom
23949 --- a/src/cef/libcef/common/mojom/cef.mojom
23951 @@ -13,6 +13,9 @@ import "third_party/blink/public/mojom/loader/referrer.mojom";
23961 @@ -47,6 +50,31 @@ struct RequestParams {
23993 @@ -77,6 +105,31 @@ interface RenderFrame {
24025 @@ -93,6 +146,15 @@ interface BrowserFrame {
24041 diff --git a/src/cef/libcef/common/resource_util.cc b/src/cef/libcef/common/resource_util.cc
24043 --- a/src/cef/libcef/common/resource_util.cc
24045 @@ -13,6 +13,7 @@
24053 @@ -26,7 +27,7 @@
24057 -#if BUILDFLAG(IS_LINUX)
24062 @@ -75,6 +76,16 @@ bool GetDefaultUserDataDirectory(base::FilePath* result) {
24071 + *result = result->Append(FILE_PATH_LITERAL("cef"));
24072 + *result = result->Append(FILE_PATH_LITERAL("cef_user_data"));
24079 @@ -116,6 +127,7 @@ base::FilePath GetUserDataPath(CefSettings* settings,
24087 @@ -129,6 +141,11 @@ bool DownloadPathIsDangerous(const base::FilePath& download_path) {
24099 @@ -182,7 +199,11 @@ base::FilePath GetResourcesDir() {
24111 @@ -205,6 +226,11 @@ void OverrideUserDataDir(CefSettings* settings,
24123 @@ -216,15 +242,17 @@ void OverrideUserDataDir(CefSettings* settings,
24130 -// Same as ui::ResourceBundle::IsScaleFactorSupported.
24131 -bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor) {
24132 - const auto& supported_scale_factors = ui::GetSupportedResourceScaleFactors();
24133 - return std::find(supported_scale_factors.begin(),
24134 - supported_scale_factors.end(),
24135 - scale_factor) != supported_scale_factors.end();
24136 -}
24148 diff --git a/src/cef/libcef/common/soc_perf_util.cc b/src/cef/libcef/common/soc_perf_util.cc
24151 --- /dev/null
24153 @@ -0,0 +1,67 @@
24156 +// Use of this source code is governed by a BSD-style license that can be
24188 + ->ApplySocPerfConfigById(SOC_PERF_CONFIG_ID);
24193 + if ((base::Time().Now() - first_time_boost_timestamp).InSeconds() >=
24199 + if ((base::Time().Now() - last_time_boost_timestamp).InSeconds() >=
24205 + ->ApplySocPerfConfigById(SOC_PERF_CONFIG_ID);
24222 diff --git a/src/cef/libcef/common/soc_perf_util.h b/src/cef/libcef/common/soc_perf_util.h
24225 --- /dev/null
24227 @@ -0,0 +1,30 @@
24230 +// Use of this source code is governed by a BSD-style license that can be
24259 diff --git a/src/cef/libcef/renderer/alloy/alloy_content_renderer_client.h b/src/cef/libcef/rendere…
24261 --- a/src/cef/libcef/renderer/alloy/alloy_content_renderer_client.h
24263 @@ -77,6 +77,18 @@ class AlloyContentRendererClient
24264 // single-process mode. Blocks until cleanup is complete.
24282 diff --git a/src/cef/libcef/renderer/alloy/alloy_content_settings_client.cc b/src/cef/libcef/render…
24285 --- /dev/null
24287 @@ -0,0 +1,25 @@
24289 +// Use of this source code is governed by a BSD-style license that can be
24301 + render_frame->GetWebFrame()->SetContentSettingsClient(this);
24307 + return render_frame()->GetBlinkPreferences().allow_mixed_content_upgrades;
24313 diff --git a/src/cef/libcef/renderer/alloy/alloy_content_settings_client.h b/src/cef/libcef/rendere…
24316 --- /dev/null
24318 @@ -0,0 +1,30 @@
24320 +// Use of this source code is governed by a BSD-style license that can be
24349 diff --git a/src/cef/libcef/renderer/blink_glue.cc b/src/cef/libcef/renderer/blink_glue.cc
24351 --- a/src/cef/libcef/renderer/blink_glue.cc
24353 @@ -58,6 +58,21 @@ bool CanGoForward(blink::WebView* view) {
24354 return view->HistoryForwardListCount() > 0;
24363 + if (num_steps > 0 && view->HistoryForwardListCount() >= num_steps) {
24366 + if (num_steps < 0 && view->HistoryBackListCount() >= -num_steps) {
24375 @@ -96,6 +111,27 @@ bool IsInBackForwardCache(blink::WebLocalFrame* frame) {
24376 ->IsInBackForwardCache();
24383 + blink::WebFrame* main_frame = view->MainFrame();
24384 + if (main_frame && main_frame->IsWebLocalFrame()) {
24385 + if (num_steps > 0 && view->HistoryForwardListCount() > 0) {
24388 + ->GetLocalFrameHostRemote()
24391 + if (num_steps < 0 && view->HistoryBackListCount() > 0) {
24394 + ->GetLocalFrameHostRemote()
24403 diff --git a/src/cef/libcef/renderer/blink_glue.h b/src/cef/libcef/renderer/blink_glue.h
24405 --- a/src/cef/libcef/renderer/blink_glue.h
24407 @@ -38,6 +38,8 @@ BLINK_EXPORT bool CanGoBack(blink::WebView* view);
24416 diff --git a/src/cef/libcef/renderer/browser_impl.cc b/src/cef/libcef/renderer/browser_impl.cc
24418 --- a/src/cef/libcef/renderer/browser_impl.cc
24420 @@ -1,7 +1,7 @@
24421 -// Copyright (c) 2012 The Chromium Embedded Framework Authors.
24422 -// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
24423 -// Use of this source code is governed by a BSD-style license that can be
24424 -// found in the LICENSE file.
24427 +// reserved. Use of this source code is governed by a BSD-style license that can
24432 @@ -72,7 +72,6 @@ void CefBrowserImpl::GoBack() {
24436 -
24440 @@ -82,6 +81,22 @@ void CefBrowserImpl::GoForward() {
24463 @@ -263,6 +278,15 @@ void CefBrowserImpl::GetFrameNames(std::vector<CefString>& names) {
24477 // -----------------------------------------------------------------------------
24479 @@ -401,3 +425,24 @@ void CefBrowserImpl::OnLoadingStateChange(bool isLoading) {
24489 + blink::WebFrame* main_frame = GetWebView()->MainFrame();
24490 + if (main_frame && main_frame->IsWebLocalFrame()) {
24491 + main_frame->ToWebLocalFrame()->StartReload(
24504 diff --git a/src/cef/libcef/renderer/browser_impl.h b/src/cef/libcef/renderer/browser_impl.h
24506 --- a/src/cef/libcef/renderer/browser_impl.h
24508 @@ -1,7 +1,7 @@
24509 -// Copyright (c) 2012 The Chromium Embedded Framework Authors.
24510 -// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
24511 -// Use of this source code is governed by a BSD-style license that can be
24512 -// found in the LICENSE file.
24515 +// reserved. Use of this source code is governed by a BSD-style license that can
24520 @@ -50,9 +50,16 @@ class CefBrowserImpl : public CefBrowser, public blink::WebViewObserver {
24537 @@ -65,6 +72,9 @@ class CefBrowserImpl : public CefBrowser, public blink::WebViewObserver {
24547 @@ -93,6 +103,10 @@ class CefBrowserImpl : public CefBrowser, public blink::WebViewObserver {
24557 // of cross-origin requests multiple RenderViews may be associated with the
24558 diff --git a/src/cef/libcef/renderer/frame_impl.cc b/src/cef/libcef/renderer/frame_impl.cc
24560 --- a/src/cef/libcef/renderer/frame_impl.cc
24562 @@ -36,17 +36,24 @@
24564 #include "third_party/blink/public/mojom/frame/frame.mojom-blink.h"
24587 @@ -59,6 +66,23 @@ constexpr auto kConnectionRetryDelay = base::Seconds(1);
24611 @@ -106,6 +130,10 @@ void CefFrameImpl::ViewSource() {
24622 @@ -684,6 +712,280 @@ void CefFrameImpl::MoveOrResizeStarted() {
24635 + params->url = GURL(url.ToString());
24636 + params->method = "GET";
24637 + params->headers = additionalHttpHeaders;
24648 + data->href = element.GetAttribute("href").Utf16();
24649 + data->anchor_text = element.TextContent().Utf16();
24652 + absolute_link_url = GetAbsoluteUrl(element, data->href);
24661 + browser_frame->OnUpdateHitData(std::move(data));
24668 + DCHECK(render_frame->IsMainFrame());
24669 + blink::WebView* webview = render_frame->GetRenderView()->GetWebView();
24675 + webview->HitTestResultForTap(gfx::Point(params->x, params->y),
24676 + gfx::Size(params->width, params->height));
24680 + data->anchor_text = result.UrlElement().TextContent().Utf16();
24681 + data->href = result.UrlElement().GetAttribute("href").Utf16();
24693 + browser_frame->OnUpdateHitData(std::move(hit_test_data));
24704 + DCHECK(render_frame->IsMainFrame());
24705 + blink::WebView* webview = render_frame->GetRenderView()->GetWebView();
24710 + webview->SetInitialPageScaleOverride(initialScale);
24720 + DCHECK(render_frame->IsMainFrame());
24721 + blink::WebView* webview = render_frame->GetRenderView()->GetWebView();
24726 + webview->CancelPagePopup();
24728 + render_frame->GetWebFrame()->FrameWidget()->SetTextZoomFactor(factor);
24738 + blink::WebNode context_node = frame_->ContextMenuImageNode();
24749 + browser_frame->OnGetImageForContextNodeNull();
24760 + params->width = original_size.width();
24761 + params->height = original_size.height();
24762 + params->image = image;
24763 + params->image_extension = image_extension;
24769 + browser_frame->OnGetImageForContextNode(std::move(data));
24808 + spec.data() + prefix.length(), spec.length() - prefix.length(),
24821 + &data->extra_data_for_type)) {
24822 + data->type = HitTestDataType::kGeo;
24824 + &data->extra_data_for_type)) {
24825 + data->type = HitTestDataType::kPhone;
24827 + &data->extra_data_for_type)) {
24828 + data->type = HitTestDataType::kEmail;
24830 + data->type = HitTestDataType::kSrcLink;
24831 + data->extra_data_for_type = url.possibly_invalid_spec();
24832 + if (!data->extra_data_for_type.empty())
24833 + data->href = base::UTF8ToUTF16(data->extra_data_for_type);
24842 + data->img_src = absolute_image_url;
24851 + data->type = HitTestDataType::kSrcImageLink;
24852 + data->extra_data_for_type = data->img_src.possibly_invalid_spec();
24854 + data->href = base::UTF8ToUTF16(absolute_link_url.possibly_invalid_spec());
24856 + data->type = HitTestDataType::kImage;
24857 + data->extra_data_for_type = data->img_src.possibly_invalid_spec();
24859 + data->type = HitTestDataType::kEditText;
24860 + DCHECK_EQ(0u, data->extra_data_for_type.length());
24891 + blink::WebElementCollection collection = frame->GetDocument().GetElementsByHTMLTagName…
24903 diff --git a/src/cef/libcef/renderer/frame_impl.h b/src/cef/libcef/renderer/frame_impl.h
24905 --- a/src/cef/libcef/renderer/frame_impl.h
24907 @@ -19,6 +19,10 @@
24918 @@ -79,6 +83,7 @@ class CefFrameImpl : public CefFrame, public cef::mojom::RenderFrame {
24926 @@ -95,6 +100,12 @@ class CefFrameImpl : public CefFrame, public cef::mojom::RenderFrame {
24939 @@ -138,6 +149,32 @@ class CefFrameImpl : public CefFrame, public cef::mojom::RenderFrame {
24972 diff --git a/src/cef/libcef/renderer/javascript/oh_gin_javascript_bridge_dispatcher.cc b/src/cef/li…
24975 --- /dev/null
24977 @@ -0,0 +1,138 @@
24980 +// Use of this source code is governed by a BSD-style license that can be
25018 + if (objects_.Lookup(iter->second))
25019 + objects_.Remove(iter->second);
25022 + OhGinJavascriptBridgeObject::InjectNamed(render_frame()->GetWebFrame(),
25023 + AsWeakPtr(), iter->first,
25024 + iter->second);
25026 + objects_.AddWithID(object, iter->second);
25029 + render_frame()->Send(
25031 + iter->second));
25057 + render_frame()->Send(new OhGinJavascriptBridgeHostMsg_GetMethods(
25066 + render_frame()->Send(new OhGinJavascriptBridgeHostMsg_HasMethod(
25078 + render_frame()->Send(new OhGinJavascriptBridgeHostMsg_InvokeMethod(
25082 + return std::unique_ptr<base::Value>(result->CreateDeepCopy().release());
25103 + int object_id = object->object_id();
25108 + render_frame()->Send(new OhGinJavascriptBridgeHostMsg_ObjectWrapperDeleted(
25116 diff --git a/src/cef/libcef/renderer/javascript/oh_gin_javascript_bridge_dispatcher.h b/src/cef/lib…
25119 --- /dev/null
25121 @@ -0,0 +1,65 @@
25124 +// Use of this source code is governed by a BSD-style license that can be
25187 diff --git a/src/cef/libcef/renderer/javascript/oh_gin_javascript_bridge_object.cc b/src/cef/libcef…
25190 --- /dev/null
25192 @@ -0,0 +1,133 @@
25195 +// Use of this source code is governed by a BSD-style license that can be
25221 + v8::Local<v8::Context> context = frame->MainWorldScriptContext();
25229 + v8::Local<v8::Object> global = context->Global();
25237 + global->Set(context, gin::StringToV8(isolate, object_name), controller.ToV8())
25258 + frame_routing_id_(dispatcher_->routing_id()),
25263 + dispatcher_->OnOhGinJavascriptBridgeObjectDeleted(this);
25268 + content::RenderThread::Get()->Send(
25291 + dispatcher_->HasJavascriptMethod(object_id_, property);
25295 + ->GetFunction(isolate->GetCurrentContext())
25306 + dispatcher_->GetJavascriptMethods(object_id_, &method_names);
25327 diff --git a/src/cef/libcef/renderer/javascript/oh_gin_javascript_bridge_object.h b/src/cef/libcef/…
25330 --- /dev/null
25332 @@ -0,0 +1,76 @@
25335 +// Use of this source code is governed by a BSD-style license that can be
25349 +#include "v8/include/v8-util.h"
25409 diff --git a/src/cef/libcef/renderer/javascript/oh_gin_javascript_bridge_value_converter.cc b/src/c…
25412 --- /dev/null
25414 @@ -0,0 +1,178 @@
25417 +// Use of this source code is governed by a BSD-style license that can be
25436 + converter_->SetDateAllowed(false);
25437 + converter_->SetRegExpAllowed(false);
25438 + converter_->SetFunctionAllowed(true);
25439 + converter_->SetStrategy(this);
25447 + return converter_->ToV8Value(value, context);
25453 + return converter_->FromV8Value(value, context);
25465 + OhGinJavascriptBridgeValue::CreateObjectIDValue(unwrapped->object_id());
25499 + DCHECK_EQ(data_length, typed_array_->Length() * sizeof(ElementType));
25501 + *end = element + typed_array_->Length();
25507 + out->Append(OhGinJavascriptBridgeValue::CreateUInt32Value(*element));
25509 + out->Append(std::make_unique<base::Value>(ListType(*element)));
25524 + if (typed_array->IsInt8Array()) {
25526 + } else if (typed_array->IsUint8Array() ||
25527 + typed_array->IsUint8ClampedArray()) {
25529 + } else if (typed_array->IsInt16Array()) {
25531 + } else if (typed_array->IsUint16Array()) {
25533 + } else if (typed_array->IsInt32Array()) {
25535 + } else if (typed_array->IsUint32Array()) {
25537 + } else if (typed_array->IsFloat32Array()) {
25539 + } else if (typed_array->IsFloat64Array()) {
25552 + if (!value->IsTypedArray()) {
25572 + serializer->serializeTo(data, data_length, result.get());
25580 + double double_value = value->Value();
25593 diff --git a/src/cef/libcef/renderer/javascript/oh_gin_javascript_bridge_value_converter.h b/src/ce…
25596 --- /dev/null
25598 @@ -0,0 +1,47 @@
25601 +// Use of this source code is governed by a BSD-style license that can be
25646 diff --git a/src/cef/libcef/renderer/javascript/oh_gin_javascript_function_invocation_helper.cc b/s…
25649 --- /dev/null
25651 @@ -0,0 +1,111 @@
25654 +// Use of this source code is governed by a BSD-style license that can be
25673 + "Javascript bridge method can't be invoked on a non-injected object";
25695 + args->isolate()->ThrowException(v8::Exception::Error(
25696 + gin::StringToV8(args->isolate(), kMethodInvocationErrorMessage)));
25697 + return v8::Undefined(args->isolate());
25700 + if (args->IsConstructCall()) {
25701 + args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8(
25702 + args->isolate(), kMethodInvocationAsConstructorDisallowed)));
25703 + return v8::Undefined(args->isolate());
25707 + if (!args->GetHolder(&object) || !object) {
25708 + args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8(
25709 + args->isolate(), kMethodInvocationOnNonInjectedObjectDisallowed)));
25710 + return v8::Undefined(args->isolate());
25715 + v8::HandleScope handle_scope(args->isolate());
25716 + v8::Local<v8::Context> context = args->isolate()->GetCurrentContext();
25718 + while (args->GetNext(&val)) {
25719 + std::unique_ptr<base::Value> arg(converter_->FromV8Value(val, context));
25728 + std::unique_ptr<base::Value> result = dispatcher_->InvokeJavascriptMethod(
25729 + object->object_id(), method_name_, arguments, &error);
25731 + args->isolate()->ThrowException(v8::Exception::Error(gin::StringToV8(
25732 + args->isolate(), OhGinJavascriptBridgeErrorToString(error))));
25733 + return v8::Undefined(args->isolate());
25735 + if (!result->is_blob()) {
25736 + return converter_->ToV8Value(result.get(),
25737 + args->isolate()->GetCurrentContext());
25742 + if (gin_value->IsType(OhGinJavascriptBridgeValue::TYPE_OBJECT_ID)) {
25745 + if (gin_value->GetAsObjectID(&object_id)) {
25746 + object_result = dispatcher_->GetObject(object_id);
25750 + gin::CreateHandle(args->isolate(), object_result);
25752 + return v8::Undefined(args->isolate());
25755 + } else if (gin_value->IsType(OhGinJavascriptBridgeValue::TYPE_NONFINITE)) {
25757 + gin_value->GetAsNonFinite(&float_value);
25758 + return v8::Number::New(args->isolate(), float_value);
25760 + return v8::Undefined(args->isolate());
25763 diff --git a/src/cef/libcef/renderer/javascript/oh_gin_javascript_function_invocation_helper.h b/sr…
25766 --- /dev/null
25768 @@ -0,0 +1,40 @@
25771 +// Use of this source code is governed by a BSD-style license that can be
25809 diff --git a/src/cef/libcef/renderer/render_frame_observer.cc b/src/cef/libcef/renderer/render_fram…
25811 --- a/src/cef/libcef/renderer/render_frame_observer.cc
25813 @@ -79,7 +79,7 @@ void CefRenderFrameObserver::FocusedElementChanged(
25817 -
25818 + frame_->OnFocusedNodeChanged(element);
25819 blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
25821 CefBrowserImpl::GetBrowserForMainFrame(frame->Top());
25822 diff --git a/src/cef/libcef_dll/base/cef_logging.cc b/src/cef/libcef_dll/base/cef_logging.cc
25824 --- a/src/cef/libcef_dll/base/cef_logging.cc
25826 @@ -18,6 +18,8 @@
25835 @@ -68,6 +70,7 @@ wrap_posix_strerror_r(char* (*strerror_r_ptr)(int, char*, size_t),
25843 @@ -110,6 +113,7 @@ static void POSSIBLY_UNUSED wrap_posix_strerror_r(int (*strerror_r_ptr)(int,
25851 @@ -119,7 +123,9 @@ void safe_strerror_r(int err, char* buf, size_t len) {
25861 diff --git a/src/cef/libcef_dll/cpptoc/access_request_cpptoc.cc b/src/cef/libcef_dll/cpptoc/access_…
25864 --- /dev/null
25866 @@ -0,0 +1,102 @@
25868 +// reserved. Use of this source code is governed by a BSD-style license that
25871 +// ---------------------------------------------------------------------------
25886 +// MEMBER FUNCTIONS - Body may be edited by hand.
25892 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
25899 + CefString _retval = CefAccessRequestCppToC::Get(self)->Origin();
25909 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
25916 + int _retval = CefAccessRequestCppToC::Get(self)->ResourceAcessId();
25927 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
25934 + CefAccessRequestCppToC::Get(self)->ReportRequestResult(allowed ? true
25940 +// CONSTRUCTOR - Do not edit by hand.
25943 + GetStruct()->origin = access_request_origin;
25944 + GetStruct()->resource_acess_id = access_request_resource_acess_id;
25945 + GetStruct()->report_request_result = access_request_report_request_result;
25948 +// DESTRUCTOR - Do not edit by hand.
25969 diff --git a/src/cef/libcef_dll/cpptoc/access_request_cpptoc.h b/src/cef/libcef_dll/cpptoc/access_r…
25972 --- /dev/null
25974 @@ -0,0 +1,38 @@
25976 +// reserved. Use of this source code is governed by a BSD-style license that
25979 +// ---------------------------------------------------------------------------
25994 +#error This file can be included DLL-side only
26002 +// This class may be instantiated and accessed DLL-side only.
26013 diff --git a/src/cef/libcef_dll/cpptoc/auth_callback_cpptoc.cc b/src/cef/libcef_dll/cpptoc/auth_cal…
26015 --- a/src/cef/libcef_dll/cpptoc/auth_callback_cpptoc.cc
26017 @@ -9,7 +9,7 @@
26021 -// $hash=7497a44116b3cfc86eb309dc940c91c7cca78353$
26026 @@ -49,6 +49,23 @@ void CEF_CALLBACK auth_callback_cancel(struct _cef_auth_callback_t* self) {
26027 CefAuthCallbackCppToC::Get(self)->Cancel();
26034 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26041 + bool _retval = CefAuthCallbackCppToC::Get(self)->IsHttpAuthInfoSaved();
26049 // CONSTRUCTOR - Do not edit by hand.
26050 @@ -56,6 +73,7 @@ void CEF_CALLBACK auth_callback_cancel(struct _cef_auth_callback_t* self) {
26052 GetStruct()->cont = auth_callback_cont;
26053 GetStruct()->cancel = auth_callback_cancel;
26054 + GetStruct()->is_http_auth_info_saved = auth_callback_is_http_auth_info_saved;
26057 // DESTRUCTOR - Do not edit by hand.
26058 diff --git a/src/cef/libcef_dll/cpptoc/browser_cpptoc.cc b/src/cef/libcef_dll/cpptoc/browser_cpptoc…
26060 --- a/src/cef/libcef_dll/cpptoc/browser_cpptoc.cc
26062 @@ -9,13 +9,15 @@
26066 -// $hash=074dadfb1f84663a3efd6e8532257236b3c0634f$
26079 @@ -114,6 +116,50 @@ void CEF_CALLBACK browser_go_forward(struct _cef_browser_t* self) {
26080 CefBrowserCppToC::Get(self)->GoForward();
26087 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26094 + bool _retval = CefBrowserCppToC::Get(self)->CanGoBackOrForward(num_steps);
26104 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26111 + CefBrowserCppToC::Get(self)->GoBackOrForward(num_steps);
26117 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26124 + CefBrowserCppToC::Get(self)->DeleteHistory();
26130 @@ -156,6 +202,38 @@ void CEF_CALLBACK browser_reload_ignore_cache(struct _cef_browser_t* self) {
26131 CefBrowserCppToC::Get(self)->ReloadIgnoreCache();
26137 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26144 + CefBrowserCppToC::Get(self)->ReloadOriginalUrl();
26152 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26163 + CefBrowserCppToC::Get(self)->SetBrowserUserAgentString(CefString(user_agent));
26169 @@ -389,6 +467,58 @@ void CEF_CALLBACK browser_get_frame_names(struct _cef_browser_t* self,
26177 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26185 + CefBrowserCppToC::Get(self)->GetPermissionRequestDelegate();
26195 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26203 + CefBrowserCppToC::Get(self)->GetGeolocationPermissions();
26212 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26219 + bool _retval = CefBrowserCppToC::Get(self)->ShouldShowLoadingUI();
26227 // CONSTRUCTOR - Do not edit by hand.
26228 @@ -400,9 +530,15 @@ CefBrowserCppToC::CefBrowserCppToC() {
26229 GetStruct()->go_back = browser_go_back;
26230 GetStruct()->can_go_forward = browser_can_go_forward;
26231 GetStruct()->go_forward = browser_go_forward;
26232 + GetStruct()->can_go_back_or_forward = browser_can_go_back_or_forward;
26233 + GetStruct()->go_back_or_forward = browser_go_back_or_forward;
26234 + GetStruct()->delete_history = browser_delete_history;
26235 GetStruct()->is_loading = browser_is_loading;
26236 GetStruct()->reload = browser_reload;
26237 GetStruct()->reload_ignore_cache = browser_reload_ignore_cache;
26238 + GetStruct()->reload_original_url = browser_reload_original_url;
26239 + GetStruct()->set_browser_user_agent_string =
26241 GetStruct()->stop_load = browser_stop_load;
26242 GetStruct()->get_identifier = browser_get_identifier;
26243 GetStruct()->is_same = browser_is_same;
26244 @@ -415,6 +551,11 @@ CefBrowserCppToC::CefBrowserCppToC() {
26245 GetStruct()->get_frame_count = browser_get_frame_count;
26246 GetStruct()->get_frame_identifiers = browser_get_frame_identifiers;
26247 GetStruct()->get_frame_names = browser_get_frame_names;
26248 + GetStruct()->get_permission_request_delegate =
26250 + GetStruct()->get_geolocation_permissions =
26252 + GetStruct()->should_show_loading_ui = browser_should_show_loading_ui;
26255 // DESTRUCTOR - Do not edit by hand.
26256 diff --git a/src/cef/libcef_dll/cpptoc/browser_host_cpptoc.cc b/src/cef/libcef_dll/cpptoc/browser_h…
26258 --- a/src/cef/libcef_dll/cpptoc/browser_host_cpptoc.cc
26260 @@ -9,7 +9,7 @@
26264 -// $hash=a45e96e634e88deb54637d0d570a827d49282150$
26269 @@ -23,9 +23,12 @@
26282 @@ -132,6 +135,26 @@ browser_host_get_browser(struct _cef_browser_host_t* self) {
26291 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26302 + CefBrowserHostCppToC::Get(self)->PostTaskToUIThread(
26309 @@ -427,7 +450,8 @@ void CEF_CALLBACK browser_host_find(struct _cef_browser_host_t* self,
26313 - int findNext) {
26318 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26319 @@ -443,7 +467,7 @@ void CEF_CALLBACK browser_host_find(struct _cef_browser_host_t* self,
26321 CefBrowserHostCppToC::Get(self)->Find(
26323 - findNext ? true : false);
26328 @@ -716,6 +740,21 @@ browser_host_notify_screen_info_changed(struct _cef_browser_host_t* self) {
26329 CefBrowserHostCppToC::Get(self)->NotifyScreenInfoChanged();
26337 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26344 + CefBrowserHostCppToC::Get(self)->SetVirtualPixelRatio(ratio);
26350 @@ -933,6 +972,478 @@ browser_host_set_windowless_frame_rate(struct _cef_browser_host_t* self,
26351 CefBrowserHostCppToC::Get(self)->SetWindowlessFrameRate(frame_rate);
26359 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26375 + CefBrowserHostCppToC::Get(self)->SetWebPreferences(browser_settingsObj);
26382 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26393 + CefBrowserHostCppToC::Get(self)->PutUserAgent(CefString(ua));
26400 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26407 + CefString _retval = CefBrowserHostCppToC::Get(self)->DefaultUserAgent();
26417 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26424 + CefBrowserHostCppToC::Get(self)->SetBackgroundColor(color);
26433 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26452 + CefBrowserHostCppToC::Get(self)->RegisterArkJSfunction(CefString(object_name),
26462 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26478 + CefBrowserHostCppToC::Get(self)->UnregisterArkJSfunction(
26489 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26504 + CefBrowserHostCppToC::Get(self)->StoreWebArchive(
26513 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26520 + CefString _retval = CefBrowserHostCppToC::Get(self)->Title();
26531 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26546 + CefBrowserHostCppToC::Get(self)->CreateWebMessagePorts(portsList);
26560 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26587 + CefBrowserHostCppToC::Get(self)->PostWebMessage(messageStr, portsList,
26599 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26613 + CefBrowserHostCppToC::Get(self)->ClosePort(port_handleStr);
26620 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26627 + CefBrowserHostCppToC::Get(self)->DestroyAllWebMessagePorts();
26636 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26656 + CefBrowserHostCppToC::Get(self)->PostPortMessage(port_handleStr, dataStr);
26665 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26683 + CefBrowserHostCppToC::Get(self)->SetPortMessageCallback(
26692 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26712 + CefBrowserHostCppToC::Get(self)->GetHitData(typeVal, extra_dataStr);
26723 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26730 + CefBrowserHostCppToC::Get(self)->SetInitialScale(scale);
26737 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26744 + int _retval = CefBrowserHostCppToC::Get(self)->PageLoadProgress();
26753 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26760 + float _retval = CefBrowserHostCppToC::Get(self)->Scale();
26775 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26783 + CefBrowserHostCppToC::Get(self)->LoadWithDataAndBaseUrl(
26794 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26802 + CefBrowserHostCppToC::Get(self)->LoadWithData(
26811 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26823 + CefBrowserHostCppToC::Get(self)->AddVisitedLinks(urlsList);
26829 @@ -1288,12 +1799,199 @@ int CEF_CALLBACK browser_host_is_audio_muted(struct _cef_browser_host_t* s…
26839 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26854 + CefBrowserHostCppToC::Get(self)->ExecuteJavaScript(
26863 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26870 + CefBrowserHostCppToC::Get(self)->SetNativeWindow(window);
26878 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26885 + CefBrowserHostCppToC::Get(self)->SetWebDebuggingAccess(isEnableDebug ? true
26893 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26900 + bool _retval = CefBrowserHostCppToC::Get(self)->GetWebDebuggingAccess();
26910 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26917 + CefBrowserHostCppToC::Get(self)->GetImageForContextNode();
26925 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26936 + CefBrowserHostCppToC::Get(self)->GetImageFromCache(CefString(url));
26943 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26950 + CefBrowserHostCppToC::Get(self)->ExitFullScreen();
26957 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26968 + CefBrowserHostCppToC::Get(self)->UpdateLocale(CefString(locale));
26975 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26982 + CefString _retval = CefBrowserHostCppToC::Get(self)->GetOriginalUrl();
26993 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27000 + CefBrowserHostCppToC::Get(self)->PutNetworkAvailable(available ? true
27008 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27015 + CefBrowserHostCppToC::Get(self)->RemoveCache(include_disk_files ? true
27021 // CONSTRUCTOR - Do not edit by hand.
27024 GetStruct()->get_browser = browser_host_get_browser;
27025 + GetStruct()->post_task_to_uithread = browser_host_post_task_to_uithread;
27026 GetStruct()->close_browser = browser_host_close_browser;
27027 GetStruct()->try_close_browser = browser_host_try_close_browser;
27028 GetStruct()->set_focus = browser_host_set_focus;
27029 @@ -1327,6 +2025,7 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
27030 GetStruct()->was_hidden = browser_host_was_hidden;
27031 GetStruct()->notify_screen_info_changed =
27033 + GetStruct()->set_virtual_pixel_ratio = browser_host_set_virtual_pixel_ratio;
27034 GetStruct()->invalidate = browser_host_invalidate;
27035 GetStruct()->send_external_begin_frame =
27037 @@ -1342,6 +2041,31 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
27039 GetStruct()->set_windowless_frame_rate =
27041 + GetStruct()->set_web_preferences = browser_host_set_web_preferences;
27042 + GetStruct()->put_user_agent = browser_host_put_user_agent;
27043 + GetStruct()->default_user_agent = browser_host_default_user_agent;
27044 + GetStruct()->set_background_color = browser_host_set_background_color;
27045 + GetStruct()->register_ark_jsfunction = browser_host_register_ark_jsfunction;
27046 + GetStruct()->unregister_ark_jsfunction =
27048 + GetStruct()->store_web_archive = browser_host_store_web_archive;
27049 + GetStruct()->title = browser_host_title;
27050 + GetStruct()->create_web_message_ports = browser_host_create_web_message_ports;
27051 + GetStruct()->post_web_message = browser_host_post_web_message;
27052 + GetStruct()->close_port = browser_host_close_port;
27053 + GetStruct()->destroy_all_web_message_ports =
27055 + GetStruct()->post_port_message = browser_host_post_port_message;
27056 + GetStruct()->set_port_message_callback =
27058 + GetStruct()->get_hit_data = browser_host_get_hit_data;
27059 + GetStruct()->set_initial_scale = browser_host_set_initial_scale;
27060 + GetStruct()->page_load_progress = browser_host_page_load_progress;
27061 + GetStruct()->scale = browser_host_scale;
27062 + GetStruct()->load_with_data_and_base_url =
27064 + GetStruct()->load_with_data = browser_host_load_with_data;
27065 + GetStruct()->add_visited_links = browser_host_add_visited_links;
27066 GetStruct()->ime_set_composition = browser_host_ime_set_composition;
27067 GetStruct()->ime_commit_text = browser_host_ime_commit_text;
27068 GetStruct()->ime_finish_composing_text =
27069 @@ -1362,6 +2086,18 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
27070 GetStruct()->is_background_host = browser_host_is_background_host;
27071 GetStruct()->set_audio_muted = browser_host_set_audio_muted;
27072 GetStruct()->is_audio_muted = browser_host_is_audio_muted;
27073 + GetStruct()->execute_java_script = browser_host_execute_java_script;
27074 + GetStruct()->set_native_window = browser_host_set_native_window;
27075 + GetStruct()->set_web_debugging_access = browser_host_set_web_debugging_access;
27076 + GetStruct()->get_web_debugging_access = browser_host_get_web_debugging_access;
27077 + GetStruct()->get_image_for_context_node =
27079 + GetStruct()->get_image_from_cache = browser_host_get_image_from_cache;
27080 + GetStruct()->exit_full_screen = browser_host_exit_full_screen;
27081 + GetStruct()->update_locale = browser_host_update_locale;
27082 + GetStruct()->get_original_url = browser_host_get_original_url;
27083 + GetStruct()->put_network_available = browser_host_put_network_available;
27084 + GetStruct()->remove_cache = browser_host_remove_cache;
27087 // DESTRUCTOR - Do not edit by hand.
27088 diff --git a/src/cef/libcef_dll/cpptoc/browser_permission_request_delegate_cpptoc.cc b/src/cef/libc…
27091 --- /dev/null
27093 @@ -0,0 +1,213 @@
27095 +// reserved. Use of this source code is governed by a BSD-style license that
27098 +// ---------------------------------------------------------------------------
27113 +// MEMBER FUNCTIONS - Body may be edited by hand.
27121 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27133 + ->AskGeolocationPermission(CefString(origin), callback);
27142 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27154 + ->AbortAskGeolocationPermission(CefString(origin));
27163 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27175 + ->AskProtectedMediaIdentifierPermission(CefString(origin), callback);
27184 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27196 + ->AbortAskProtectedMediaIdentifierPermission(CefString(origin));
27204 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27215 + CefBrowserPermissionRequestDelegateCppToC::Get(self)->AskMIDISysexPermission(
27225 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27237 + ->AbortAskMIDISysexPermission(CefString(origin));
27246 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27258 + ->NotifyGeolocationPermission(value ? true : false, CefString(origin));
27263 +// CONSTRUCTOR - Do not edit by hand.
27267 + GetStruct()->ask_geolocation_permission =
27269 + GetStruct()->abort_ask_geolocation_permission =
27271 + GetStruct()->ask_protected_media_identifier_permission =
27273 + GetStruct()->abort_ask_protected_media_identifier_permission =
27275 + GetStruct()->ask_midisysex_permission =
27277 + GetStruct()->abort_ask_midisysex_permission =
27279 + GetStruct()->notify_geolocation_permission =
27283 +// DESTRUCTOR - Do not edit by hand.
27307 diff --git a/src/cef/libcef_dll/cpptoc/browser_permission_request_delegate_cpptoc.h b/src/cef/libce…
27310 --- /dev/null
27312 @@ -0,0 +1,38 @@
27314 +// reserved. Use of this source code is governed by a BSD-style license that
27317 +// ---------------------------------------------------------------------------
27332 +#error This file can be included DLL-side only
27340 +// This class may be instantiated and accessed DLL-side only.
27351 diff --git a/src/cef/libcef_dll/cpptoc/client_cpptoc.cc b/src/cef/libcef_dll/cpptoc/client_cpptoc.cc
27353 --- a/src/cef/libcef_dll/cpptoc/client_cpptoc.cc
27355 @@ -9,7 +9,7 @@
27359 -// $hash=5c9e95dca457958e3b49c85b9fd39b36bf555d4e$
27364 @@ -26,19 +26,21 @@
27379 // MEMBER FUNCTIONS - Body may be edited by hand.
27381 -cef_audio_handler_t* CEF_CALLBACK
27382 -client_get_audio_handler(struct _cef_client_t* self) {
27385 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27388 @@ -53,8 +55,8 @@ client_get_audio_handler(struct _cef_client_t* self) {
27392 -struct _cef_context_menu_handler_t* CEF_CALLBACK
27393 -client_get_context_menu_handler(struct _cef_client_t* self) {
27396 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27399 @@ -69,8 +71,8 @@ client_get_context_menu_handler(struct _cef_client_t* self) {
27403 -struct _cef_dialog_handler_t* CEF_CALLBACK
27404 -client_get_dialog_handler(struct _cef_client_t* self) {
27407 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27410 @@ -85,8 +87,8 @@ client_get_dialog_handler(struct _cef_client_t* self) {
27414 -struct _cef_display_handler_t* CEF_CALLBACK
27415 -client_get_display_handler(struct _cef_client_t* self) {
27418 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27421 @@ -101,8 +103,8 @@ client_get_display_handler(struct _cef_client_t* self) {
27425 -struct _cef_download_handler_t* CEF_CALLBACK
27426 -client_get_download_handler(struct _cef_client_t* self) {
27429 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27432 @@ -117,8 +119,8 @@ client_get_download_handler(struct _cef_client_t* self) {
27436 -struct _cef_drag_handler_t* CEF_CALLBACK
27437 -client_get_drag_handler(struct _cef_client_t* self) {
27440 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27443 @@ -133,8 +135,8 @@ client_get_drag_handler(struct _cef_client_t* self) {
27447 -struct _cef_find_handler_t* CEF_CALLBACK
27448 -client_get_find_handler(struct _cef_client_t* self) {
27451 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27454 @@ -149,8 +151,8 @@ client_get_find_handler(struct _cef_client_t* self) {
27458 -struct _cef_focus_handler_t* CEF_CALLBACK
27459 -client_get_focus_handler(struct _cef_client_t* self) {
27462 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27465 @@ -165,8 +167,8 @@ client_get_focus_handler(struct _cef_client_t* self) {
27469 -struct _cef_frame_handler_t* CEF_CALLBACK
27470 -client_get_frame_handler(struct _cef_client_t* self) {
27473 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27476 @@ -181,8 +183,8 @@ client_get_frame_handler(struct _cef_client_t* self) {
27480 -struct _cef_jsdialog_handler_t* CEF_CALLBACK
27481 -client_get_jsdialog_handler(struct _cef_client_t* self) {
27484 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27487 @@ -197,8 +199,8 @@ client_get_jsdialog_handler(struct _cef_client_t* self) {
27491 -struct _cef_keyboard_handler_t* CEF_CALLBACK
27492 -client_get_keyboard_handler(struct _cef_client_t* self) {
27495 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27498 @@ -213,8 +215,8 @@ client_get_keyboard_handler(struct _cef_client_t* self) {
27502 -struct _cef_life_span_handler_t* CEF_CALLBACK
27503 -client_get_life_span_handler(struct _cef_client_t* self) {
27506 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27509 @@ -229,8 +231,8 @@ client_get_life_span_handler(struct _cef_client_t* self) {
27513 -struct _cef_load_handler_t* CEF_CALLBACK
27514 -client_get_load_handler(struct _cef_client_t* self) {
27517 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27520 @@ -245,8 +247,8 @@ client_get_load_handler(struct _cef_client_t* self) {
27524 -struct _cef_print_handler_t* CEF_CALLBACK
27525 -client_get_print_handler(struct _cef_client_t* self) {
27528 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27531 @@ -261,8 +263,8 @@ client_get_print_handler(struct _cef_client_t* self) {
27535 -struct _cef_render_handler_t* CEF_CALLBACK
27536 -client_get_render_handler(struct _cef_client_t* self) {
27539 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27542 @@ -277,8 +279,8 @@ client_get_render_handler(struct _cef_client_t* self) {
27546 -struct _cef_request_handler_t* CEF_CALLBACK
27547 -client_get_request_handler(struct _cef_client_t* self) {
27550 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27553 @@ -293,12 +295,26 @@ client_get_request_handler(struct _cef_client_t* self) {
27557 -int CEF_CALLBACK
27558 -client_on_process_message_received(struct _cef_client_t* self,
27559 - cef_browser_t* browser,
27560 - struct _cef_frame_t* frame,
27561 - cef_process_id_t source_process,
27562 - struct _cef_process_message_t* message) {
27565 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27573 + CefClientCppToC::Get(self)->GetPermissionRequest();
27583 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27586 @@ -326,7 +342,42 @@ client_on_process_message_received(struct _cef_client_t* self,
27590 -} // namespace
27595 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27618 + int _retval = CefClientCppToC::Get(self)->NotifyJavaScriptResult(
27628 // CONSTRUCTOR - Do not edit by hand.
27630 @@ -347,7 +398,9 @@ CefClientCppToC::CefClientCppToC() {
27631 GetStruct()->get_print_handler = client_get_print_handler;
27632 GetStruct()->get_render_handler = client_get_render_handler;
27633 GetStruct()->get_request_handler = client_get_request_handler;
27634 + GetStruct()->get_permission_request = client_get_permission_request;
27635 GetStruct()->on_process_message_received = client_on_process_message_received;
27636 + GetStruct()->notify_java_script_result = client_notify_java_script_result;
27639 // DESTRUCTOR - Do not edit by hand.
27640 @@ -357,12 +410,11 @@ CefClientCppToC::~CefClientCppToC() {}
27644 - CefWrapperType type,
27645 - cef_client_t* s) {
27652 -CefWrapperType CefCppToCRefCounted<CefClientCppToC, CefClient, cef_client_t>::
27653 - kWrapperType = WT_CLIENT;
27656 diff --git a/src/cef/libcef_dll/cpptoc/context_menu_handler_cpptoc.cc b/src/cef/libcef_dll/cpptoc/c…
27658 --- a/src/cef/libcef_dll/cpptoc/context_menu_handler_cpptoc.cc
27660 @@ -9,15 +9,17 @@
27664 -// $hash=a689271e9c27cfd0d6f6fadb8bb624898f165934$
27679 @@ -167,6 +169,157 @@ void CEF_CALLBACK context_menu_handler_on_context_menu_dismissed(
27693 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27725 + bool _retval = CefContextMenuHandlerCppToC::Get(self)->RunQuickMenu(
27741 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27756 + bool _retval = CefContextMenuHandlerCppToC::Get(self)->OnQuickMenuCommand(
27770 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27785 + CefContextMenuHandlerCppToC::Get(self)->OnQuickMenuDismissed(
27795 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27810 + CefContextMenuHandlerCppToC::Get(self)->OnGetImageForContextNode(
27819 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27830 + CefContextMenuHandlerCppToC::Get(self)->OnGetImageFromCache(
27836 // CONSTRUCTOR - Do not edit by hand.
27837 @@ -179,6 +332,15 @@ CefContextMenuHandlerCppToC::CefContextMenuHandlerCppToC() {
27839 GetStruct()->on_context_menu_dismissed =
27841 + GetStruct()->run_quick_menu = context_menu_handler_run_quick_menu;
27842 + GetStruct()->on_quick_menu_command =
27844 + GetStruct()->on_quick_menu_dismissed =
27846 + GetStruct()->on_get_image_for_context_node =
27848 + GetStruct()->on_get_image_from_cache =
27852 // DESTRUCTOR - Do not edit by hand.
27853 diff --git a/src/cef/libcef_dll/cpptoc/cookie_manager_cpptoc.cc b/src/cef/libcef_dll/cpptoc/cookie_…
27855 --- a/src/cef/libcef_dll/cpptoc/cookie_manager_cpptoc.cc
27857 @@ -9,7 +9,7 @@
27861 -// $hash=630f568e46925a195008194e61cde5339645ae8e$
27866 @@ -20,8 +20,8 @@
27868 // GLOBAL FUNCTIONS - Body may be edited by hand.
27870 -CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
27871 - cef_completion_callback_t* callback) {
27874 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27877 @@ -34,13 +34,133 @@ CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
27885 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27919 // MEMBER FUNCTIONS - Body may be edited by hand.
27922 -cookie_manager_visit_all_cookies(struct _cef_cookie_manager_t* self,
27923 - struct _cef_cookie_visitor_t* visitor) {
27925 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27932 + bool _retval = CefCookieManagerCppToC::Get(self)->IsAcceptCookieAllowed();
27940 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27947 + CefCookieManagerCppToC::Get(self)->PutAcceptCookieEnabled(accept ? true
27953 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27960 + bool _retval = CefCookieManagerCppToC::Get(self)->IsThirdPartyCookieAllowed();
27968 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27975 + CefCookieManagerCppToC::Get(self)->PutAcceptThirdPartyCookieEnabled(
27981 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
27989 + CefCookieManagerCppToC::Get(self)->IsFileURLSchemeCookiesAllowed();
27997 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28004 + CefCookieManagerCppToC::Get(self)->PutAcceptFileURLSchemeCookiesEnabled(
28010 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28013 @@ -59,11 +179,9 @@ cookie_manager_visit_all_cookies(struct _cef_cookie_manager_t* self,
28017 -int CEF_CALLBACK
28018 -cookie_manager_visit_url_cookies(struct _cef_cookie_manager_t* self,
28019 - const cef_string_t* url,
28020 - int includeHttpOnly,
28021 - struct _cef_cookie_visitor_t* visitor) {
28025 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28028 @@ -87,11 +205,10 @@ cookie_manager_visit_url_cookies(struct _cef_cookie_manager_t* self,
28032 -int CEF_CALLBACK
28033 -cookie_manager_set_cookie(struct _cef_cookie_manager_t* self,
28034 - const cef_string_t* url,
28035 - const struct _cef_cookie_t* cookie,
28036 - struct _cef_set_cookie_callback_t* callback) {
28041 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28044 @@ -120,11 +237,10 @@ cookie_manager_set_cookie(struct _cef_cookie_manager_t* self,
28048 -int CEF_CALLBACK
28049 -cookie_manager_delete_cookies(struct _cef_cookie_manager_t* self,
28050 - const cef_string_t* url,
28051 - const cef_string_t* cookie_name,
28052 - struct _cef_delete_cookies_callback_t* callback) {
28057 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28060 @@ -134,16 +250,15 @@ cookie_manager_delete_cookies(struct _cef_cookie_manager_t* self,
28063 bool _retval = CefCookieManagerCppToC::Get(self)->DeleteCookies(
28064 - CefString(url), CefString(cookie_name),
28072 -int CEF_CALLBACK
28073 -cookie_manager_flush_store(struct _cef_cookie_manager_t* self,
28074 - cef_completion_callback_t* callback) {
28077 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28080 @@ -159,11 +274,23 @@ cookie_manager_flush_store(struct _cef_cookie_manager_t* self,
28084 -} // namespace
28087 // CONSTRUCTOR - Do not edit by hand.
28090 + GetStruct()->is_accept_cookie_allowed =
28092 + GetStruct()->put_accept_cookie_enabled =
28094 + GetStruct()->is_third_party_cookie_allowed =
28096 + GetStruct()->put_accept_third_party_cookie_enabled =
28098 + GetStruct()->is_file_urlscheme_cookies_allowed =
28100 + GetStruct()->put_accept_file_urlscheme_cookies_enabled =
28102 GetStruct()->visit_all_cookies = cookie_manager_visit_all_cookies;
28103 GetStruct()->visit_url_cookies = cookie_manager_visit_url_cookies;
28104 GetStruct()->set_cookie = cookie_manager_set_cookie;
28105 @@ -176,17 +303,16 @@ CefCookieManagerCppToC::CefCookieManagerCppToC() {
28109 -CefRefPtr<CefCookieManager> CefCppToCRefCounted<
28110 - CefCookieManagerCppToC,
28111 - CefCookieManager,
28112 - cef_cookie_manager_t>::UnwrapDerived(CefWrapperType type,
28113 - cef_cookie_manager_t* s) {
28124 -CefWrapperType CefCppToCRefCounted<CefCookieManagerCppToC,
28125 - CefCookieManager,
28129 diff --git a/src/cef/libcef_dll/cpptoc/cookie_visitor_cpptoc.cc b/src/cef/libcef_dll/cpptoc/cookie_…
28131 --- a/src/cef/libcef_dll/cpptoc/cookie_visitor_cpptoc.cc
28133 @@ -9,7 +9,7 @@
28137 -// $hash=922e883b71eb54b943f7cb4748bd2298eb296eee$
28142 @@ -59,12 +59,32 @@ int CEF_CALLBACK cookie_visitor_visit(struct _cef_cookie_visitor_t* self,
28151 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28162 + CefCookieVisitorCppToC::Get(self)->SetCookieLine(CefString(cookieLine));
28167 // CONSTRUCTOR - Do not edit by hand.
28170 GetStruct()->visit = cookie_visitor_visit;
28171 + GetStruct()->set_cookie_line = cookie_visitor_set_cookie_line;
28174 // DESTRUCTOR - Do not edit by hand.
28175 diff --git a/src/cef/libcef_dll/cpptoc/data_base_cpptoc.cc b/src/cef/libcef_dll/cpptoc/data_base_cp…
28178 --- /dev/null
28180 @@ -0,0 +1,292 @@
28182 +// reserved. Use of this source code is governed by a BSD-style license that
28185 +// ---------------------------------------------------------------------------
28198 +// GLOBAL FUNCTIONS - Body may be edited by hand.
28201 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28212 +// MEMBER FUNCTIONS - Body may be edited by hand.
28216 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28223 + CefDataBaseCppToC::Get(self)->DeleteHttpAuthCredentials();
28228 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28235 + bool _retval = CefDataBaseCppToC::Get(self)->ExistHttpAuthCredentials();
28247 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28270 + CefDataBaseCppToC::Get(self)->SaveHttpAuthCredentials(
28279 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28302 + CefDataBaseCppToC::Get(self)->GetHttpAuthCredentials(
28312 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28323 + bool _retval = CefDataBaseCppToC::Get(self)->ExistPermissionByOrigin(
28333 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28351 + bool _retval = CefDataBaseCppToC::Get(self)->GetPermissionResultByOrigin(
28365 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28376 + CefDataBaseCppToC::Get(self)->SetPermissionByOrigin(CefString(origin), type,
28382 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28393 + CefDataBaseCppToC::Get(self)->ClearPermissionByOrigin(CefString(origin),
28399 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28406 + CefDataBaseCppToC::Get(self)->ClearAllPermission(type);
28411 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28426 + CefDataBaseCppToC::Get(self)->GetOriginsByPermission(type, originsList);
28435 +// CONSTRUCTOR - Do not edit by hand.
28438 + GetStruct()->delete_http_auth_credentials =
28440 + GetStruct()->exist_http_auth_credentials =
28442 + GetStruct()->save_http_auth_credentials =
28444 + GetStruct()->get_http_auth_credentials = data_base_get_http_auth_credentials;
28445 + GetStruct()->exist_permission_by_origin =
28447 + GetStruct()->get_permission_result_by_origin =
28449 + GetStruct()->set_permission_by_origin = data_base_set_permission_by_origin;
28450 + GetStruct()->clear_permission_by_origin =
28452 + GetStruct()->clear_all_permission = data_base_clear_all_permission;
28453 + GetStruct()->get_origins_by_permission = data_base_get_origins_by_permission;
28456 +// DESTRUCTOR - Do not edit by hand.
28473 diff --git a/src/cef/libcef_dll/cpptoc/data_base_cpptoc.h b/src/cef/libcef_dll/cpptoc/data_base_cpp…
28476 --- /dev/null
28478 @@ -0,0 +1,37 @@
28480 +// reserved. Use of this source code is governed by a BSD-style license that
28483 +// ---------------------------------------------------------------------------
28498 +#error This file can be included DLL-side only
28506 +// This class may be instantiated and accessed DLL-side only.
28516 diff --git a/src/cef/libcef_dll/cpptoc/dialog_handler_cpptoc.cc b/src/cef/libcef_dll/cpptoc/dialog_…
28518 --- a/src/cef/libcef_dll/cpptoc/dialog_handler_cpptoc.cc
28520 @@ -9,7 +9,7 @@
28524 -// $hash=639576c610ca3898809cdee6d19c45253e9ea4d2$
28529 @@ -30,6 +30,7 @@ dialog_handler_on_file_dialog(struct _cef_dialog_handler_t* self,
28537 @@ -60,7 +61,7 @@ dialog_handler_on_file_dialog(struct _cef_dialog_handler_t* self,
28538 bool _retval = CefDialogHandlerCppToC::Get(self)->OnFileDialog(
28541 - CefFileDialogCallbackCToCpp::Wrap(callback));
28546 diff --git a/src/cef/libcef_dll/cpptoc/display_handler_cpptoc.cc b/src/cef/libcef_dll/cpptoc/displa…
28548 --- a/src/cef/libcef_dll/cpptoc/display_handler_cpptoc.cc
28550 @@ -9,7 +9,7 @@
28554 -// $hash=8963e8fd758fe86d0f35a5fd81e3f56a0b7aa3cd$
28559 @@ -101,6 +101,86 @@ display_handler_on_favicon_urlchange(struct _cef_display_handler_t* self,
28570 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28585 + CefDisplayHandlerCppToC::Get(self)->OnReceivedTouchIconUrl(
28599 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28610 + CefDisplayHandlerCppToC::Get(self)->OnReceivedIcon(data, width, height,
28624 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28639 + CefDisplayHandlerCppToC::Get(self)->OnReceivedIconUrl(
28646 @@ -287,6 +367,29 @@ int CEF_CALLBACK display_handler_on_cursor_change(
28657 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28668 + CefDisplayHandlerCppToC::Get(self)->OnScaleChanged(
28675 // CONSTRUCTOR - Do not edit by hand.
28676 @@ -295,6 +398,10 @@ CefDisplayHandlerCppToC::CefDisplayHandlerCppToC() {
28677 GetStruct()->on_address_change = display_handler_on_address_change;
28678 GetStruct()->on_title_change = display_handler_on_title_change;
28679 GetStruct()->on_favicon_urlchange = display_handler_on_favicon_urlchange;
28680 + GetStruct()->on_received_touch_icon_url =
28682 + GetStruct()->on_received_icon = display_handler_on_received_icon;
28683 + GetStruct()->on_received_icon_url = display_handler_on_received_icon_url;
28684 GetStruct()->on_fullscreen_mode_change =
28686 GetStruct()->on_tooltip = display_handler_on_tooltip;
28687 @@ -304,6 +411,7 @@ CefDisplayHandlerCppToC::CefDisplayHandlerCppToC() {
28688 GetStruct()->on_loading_progress_change =
28690 GetStruct()->on_cursor_change = display_handler_on_cursor_change;
28691 + GetStruct()->on_scale_changed = display_handler_on_scale_changed;
28694 // DESTRUCTOR - Do not edit by hand.
28695 diff --git a/src/cef/libcef_dll/cpptoc/frame_cpptoc.cc b/src/cef/libcef_dll/cpptoc/frame_cpptoc.cc
28697 --- a/src/cef/libcef_dll/cpptoc/frame_cpptoc.cc
28699 @@ -9,7 +9,7 @@
28703 -// $hash=fd44b20a616ead48395d44804c8e8df40f7bc384$
28708 @@ -19,6 +19,7 @@
28716 @@ -388,6 +389,24 @@ void CEF_CALLBACK frame_visit_dom(struct _cef_frame_t* self,
28717 CefFrameCppToC::Get(self)->VisitDOM(CefDOMVisitorCToCpp::Wrap(visitor));
28726 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28734 + CefFrameCppToC::Get(self)->LoadHeaderUrl(CefString(url),
28741 @@ -439,6 +458,26 @@ frame_send_process_message(struct _cef_frame_t* self,
28750 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28761 + CefFrameCppToC::Get(self)->GetImages(
28767 // CONSTRUCTOR - Do not edit by hand.
28768 @@ -467,8 +506,10 @@ CefFrameCppToC::CefFrameCppToC() {
28769 GetStruct()->get_browser = frame_get_browser;
28770 GetStruct()->get_v8context = frame_get_v8context;
28771 GetStruct()->visit_dom = frame_visit_dom;
28772 + GetStruct()->load_header_url = frame_load_header_url;
28773 GetStruct()->create_urlrequest = frame_create_urlrequest;
28774 GetStruct()->send_process_message = frame_send_process_message;
28775 + GetStruct()->get_images = frame_get_images;
28778 // DESTRUCTOR - Do not edit by hand.
28779 diff --git a/src/cef/libcef_dll/cpptoc/geolocation_acess_cpptoc.cc b/src/cef/libcef_dll/cpptoc/geol…
28782 --- /dev/null
28784 @@ -0,0 +1,138 @@
28786 +// reserved. Use of this source code is governed by a BSD-style license that
28789 +// ---------------------------------------------------------------------------
28804 +// MEMBER FUNCTIONS - Body may be edited by hand.
28811 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28823 + CefGeolocationAcessCppToC::Get(self)->ContainOrigin(CefString(origin));
28834 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28845 + bool _retval = CefGeolocationAcessCppToC::Get(self)->IsOriginAccessEnabled(
28857 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28868 + CefGeolocationAcessCppToC::Get(self)->Enabled(CefString(origin));
28876 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28887 + CefGeolocationAcessCppToC::Get(self)->Disabled(CefString(origin));
28892 +// CONSTRUCTOR - Do not edit by hand.
28895 + GetStruct()->contain_origin = geolocation_acess_contain_origin;
28896 + GetStruct()->is_origin_access_enabled =
28898 + GetStruct()->enabled = geolocation_acess_enabled;
28899 + GetStruct()->disabled = geolocation_acess_disabled;
28902 +// DESTRUCTOR - Do not edit by hand.
28923 diff --git a/src/cef/libcef_dll/cpptoc/geolocation_acess_cpptoc.h b/src/cef/libcef_dll/cpptoc/geolo…
28926 --- /dev/null
28928 @@ -0,0 +1,38 @@
28930 +// reserved. Use of this source code is governed by a BSD-style license that
28933 +// ---------------------------------------------------------------------------
28948 +#error This file can be included DLL-side only
28956 +// This class may be instantiated and accessed DLL-side only.
28967 diff --git a/src/cef/libcef_dll/cpptoc/get_images_callback_cpptoc.cc b/src/cef/libcef_dll/cpptoc/ge…
28970 --- /dev/null
28972 @@ -0,0 +1,65 @@
28974 +// reserved. Use of this source code is governed by a BSD-style license that
28977 +// ---------------------------------------------------------------------------
28992 +// MEMBER FUNCTIONS - Body may be edited by hand.
28999 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29006 + CefGetImagesCallbackCppToC::Get(self)->GetImages(response ? true : false);
29011 +// CONSTRUCTOR - Do not edit by hand.
29014 + GetStruct()->get_images = get_images_callback_get_images;
29017 +// DESTRUCTOR - Do not edit by hand.
29038 diff --git a/src/cef/libcef_dll/cpptoc/get_images_callback_cpptoc.h b/src/cef/libcef_dll/cpptoc/get…
29041 --- /dev/null
29043 @@ -0,0 +1,44 @@
29045 +// reserved. Use of this source code is governed by a BSD-style license that
29048 +// ---------------------------------------------------------------------------
29063 +#error This file can be included wrapper-side only
29077 +// This class may be instantiated and accessed wrapper-side only.
29088 diff --git a/src/cef/libcef_dll/cpptoc/get_origin_usage_or_quota_callback_cpptoc.cc b/src/cef/libce…
29091 --- /dev/null
29093 @@ -0,0 +1,69 @@
29095 +// reserved. Use of this source code is governed by a BSD-style license that
29098 +// ---------------------------------------------------------------------------
29113 +// MEMBER FUNCTIONS - Body may be edited by hand.
29120 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29127 + CefGetOriginUsageOrQuotaCallbackCppToC::Get(self)->OnComplete(nums);
29132 +// CONSTRUCTOR - Do not edit by hand.
29136 + GetStruct()->on_complete = get_origin_usage_or_quota_callback_on_complete;
29139 +// DESTRUCTOR - Do not edit by hand.
29163 diff --git a/src/cef/libcef_dll/cpptoc/get_origin_usage_or_quota_callback_cpptoc.h b/src/cef/libcef…
29166 --- /dev/null
29168 @@ -0,0 +1,38 @@
29170 +// reserved. Use of this source code is governed by a BSD-style license that
29173 +// ---------------------------------------------------------------------------
29188 +#error This file can be included wrapper-side only
29196 +// This class may be instantiated and accessed wrapper-side only.
29207 diff --git a/src/cef/libcef_dll/cpptoc/get_origins_callback_cpptoc.cc b/src/cef/libcef_dll/cpptoc/g…
29210 --- /dev/null
29212 @@ -0,0 +1,149 @@
29214 +// reserved. Use of this source code is governed by a BSD-style license that
29217 +// ---------------------------------------------------------------------------
29233 +// MEMBER FUNCTIONS - Body may be edited by hand.
29240 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29255 + CefGetOriginsCallbackCppToC::Get(self)->OnOrigins(originsList);
29267 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29282 + CefGetOriginsCallbackCppToC::Get(self)->OnUsages(usagesList);
29294 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29309 + CefGetOriginsCallbackCppToC::Get(self)->OnQuotas(quotasList);
29320 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29327 + CefGetOriginsCallbackCppToC::Get(self)->OnComplete();
29332 +// CONSTRUCTOR - Do not edit by hand.
29335 + GetStruct()->on_origins = get_origins_callback_on_origins;
29336 + GetStruct()->on_usages = get_origins_callback_on_usages;
29337 + GetStruct()->on_quotas = get_origins_callback_on_quotas;
29338 + GetStruct()->on_complete = get_origins_callback_on_complete;
29341 +// DESTRUCTOR - Do not edit by hand.
29362 diff --git a/src/cef/libcef_dll/cpptoc/get_origins_callback_cpptoc.h b/src/cef/libcef_dll/cpptoc/ge…
29365 --- /dev/null
29367 @@ -0,0 +1,38 @@
29369 +// reserved. Use of this source code is governed by a BSD-style license that
29372 +// ---------------------------------------------------------------------------
29387 +#error This file can be included wrapper-side only
29395 +// This class may be instantiated and accessed wrapper-side only.
29406 diff --git a/src/cef/libcef_dll/cpptoc/java_script_result_callback_cpptoc.cc b/src/cef/libcef_dll/c…
29409 --- /dev/null
29411 @@ -0,0 +1,72 @@
29413 +// reserved. Use of this source code is governed by a BSD-style license that
29416 +// ---------------------------------------------------------------------------
29431 +// MEMBER FUNCTIONS - Body may be edited by hand.
29438 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29449 + CefJavaScriptResultCallbackCppToC::Get(self)->OnJavaScriptExeResult(
29455 +// CONSTRUCTOR - Do not edit by hand.
29458 + GetStruct()->on_java_script_exe_result =
29462 +// DESTRUCTOR - Do not edit by hand.
29484 diff --git a/src/cef/libcef_dll/cpptoc/java_script_result_callback_cpptoc.h b/src/cef/libcef_dll/cp…
29487 --- /dev/null
29489 @@ -0,0 +1,40 @@
29491 +// reserved. Use of this source code is governed by a BSD-style license that
29494 +// ---------------------------------------------------------------------------
29509 +#error This file can be included wrapper-side only
29519 +// This class may be instantiated and accessed wrapper-side only.
29530 diff --git a/src/cef/libcef_dll/cpptoc/life_span_handler_cpptoc.cc b/src/cef/libcef_dll/cpptoc/life…
29532 --- a/src/cef/libcef_dll/cpptoc/life_span_handler_cpptoc.cc
29534 @@ -9,7 +9,7 @@
29538 -// $hash=f9e1fa4fa79e3b66d9d147fd0cdb14da459de85b$
29543 @@ -145,6 +145,39 @@ int CEF_CALLBACK life_span_handler_on_before_popup(
29556 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29572 + bool _retval = CefLifeSpanHandlerCppToC::Get(self)->OnPreBeforePopup(
29583 @@ -214,6 +247,7 @@ life_span_handler_on_before_close(struct _cef_life_span_handler_t* self,
29586 GetStruct()->on_before_popup = life_span_handler_on_before_popup;
29587 + GetStruct()->on_pre_before_popup = life_span_handler_on_pre_before_popup;
29588 GetStruct()->on_after_created = life_span_handler_on_after_created;
29589 GetStruct()->do_close = life_span_handler_do_close;
29590 GetStruct()->on_before_close = life_span_handler_on_before_close;
29591 diff --git a/src/cef/libcef_dll/cpptoc/load_handler_cpptoc.cc b/src/cef/libcef_dll/cpptoc/load_hand…
29593 --- a/src/cef/libcef_dll/cpptoc/load_handler_cpptoc.cc
29595 @@ -9,12 +9,15 @@
29599 -// $hash=96bad8e6efd216ede4ec354159598f3119f44ce0$
29612 @@ -131,6 +134,141 @@ void CEF_CALLBACK load_handler_on_load_error(struct _cef_load_handler_t* self,
29625 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29640 + CefLoadHandlerCppToC::Get(self)->OnLoadErrorWithRequest(
29652 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29667 + CefLoadHandlerCppToC::Get(self)->OnHttpError(
29680 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29699 + CefLoadHandlerCppToC::Get(self)->OnRefreshAccessedHistory(
29710 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29722 + CefLoadHandlerCppToC::Get(self)->OnPageVisible(
29732 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29747 + CefLoadHandlerCppToC::Get(self)->OnDataResubmission(
29753 // CONSTRUCTOR - Do not edit by hand.
29754 @@ -140,6 +278,13 @@ CefLoadHandlerCppToC::CefLoadHandlerCppToC() {
29755 GetStruct()->on_load_start = load_handler_on_load_start;
29756 GetStruct()->on_load_end = load_handler_on_load_end;
29757 GetStruct()->on_load_error = load_handler_on_load_error;
29758 + GetStruct()->on_load_error_with_request =
29760 + GetStruct()->on_http_error = load_handler_on_http_error;
29761 + GetStruct()->on_refresh_accessed_history =
29763 + GetStruct()->on_page_visible = load_handler_on_page_visible;
29764 + GetStruct()->on_data_resubmission = load_handler_on_data_resubmission;
29767 // DESTRUCTOR - Do not edit by hand.
29768 diff --git a/src/cef/libcef_dll/cpptoc/navigation_entry_cpptoc.cc b/src/cef/libcef_dll/cpptoc/navig…
29770 --- a/src/cef/libcef_dll/cpptoc/navigation_entry_cpptoc.cc
29772 @@ -9,7 +9,7 @@
29776 -// $hash=081579d10d7dd1ad8906d54350c2b63f97930fd2$
29781 @@ -192,6 +192,72 @@ navigation_entry_get_sslstatus(struct _cef_navigation_entry_t* self) {
29794 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29830 + bool _retval = CefNavigationEntryCppToC::Get(self)->GetFavicon(
29853 // CONSTRUCTOR - Do not edit by hand.
29854 @@ -207,6 +273,7 @@ CefNavigationEntryCppToC::CefNavigationEntryCppToC() {
29855 GetStruct()->get_completion_time = navigation_entry_get_completion_time;
29856 GetStruct()->get_http_status_code = navigation_entry_get_http_status_code;
29857 GetStruct()->get_sslstatus = navigation_entry_get_sslstatus;
29858 + GetStruct()->get_favicon = navigation_entry_get_favicon;
29861 // DESTRUCTOR - Do not edit by hand.
29862 diff --git a/src/cef/libcef_dll/cpptoc/permission_request_cpptoc.cc b/src/cef/libcef_dll/cpptoc/per…
29865 --- /dev/null
29867 @@ -0,0 +1,117 @@
29869 +// reserved. Use of this source code is governed by a BSD-style license that
29872 +// ---------------------------------------------------------------------------
29887 +// MEMBER FUNCTIONS - Body may be edited by hand.
29892 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29903 + CefPermissionRequestCppToC::Get(self)->OnGeolocationShow(CefString(origin));
29908 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29915 + CefPermissionRequestCppToC::Get(self)->OnGeolocationHide();
29921 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29932 + CefPermissionRequestCppToC::Get(self)->OnPermissionRequest(
29939 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29950 + CefPermissionRequestCppToC::Get(self)->OnPermissionRequestCanceled(
29956 +// CONSTRUCTOR - Do not edit by hand.
29959 + GetStruct()->on_geolocation_show = permission_request_on_geolocation_show;
29960 + GetStruct()->on_geolocation_hide = permission_request_on_geolocation_hide;
29961 + GetStruct()->on_permission_request = permission_request_on_permission_request;
29962 + GetStruct()->on_permission_request_canceled =
29966 +// DESTRUCTOR - Do not edit by hand.
29985 diff --git a/src/cef/libcef_dll/cpptoc/permission_request_cpptoc.h b/src/cef/libcef_dll/cpptoc/perm…
29988 --- /dev/null
29990 @@ -0,0 +1,38 @@
29992 +// reserved. Use of this source code is governed by a BSD-style license that
29995 +// ---------------------------------------------------------------------------
30010 +#error This file can be included wrapper-side only
30018 +// This class may be instantiated and accessed wrapper-side only.
30029 diff --git a/src/cef/libcef_dll/cpptoc/render_handler_cpptoc.cc b/src/cef/libcef_dll/cpptoc/render_…
30031 --- a/src/cef/libcef_dll/cpptoc/render_handler_cpptoc.cc
30033 @@ -9,7 +9,7 @@
30037 -// $hash=b64fcfb34da785eccf9a1232b35f485fbc838bda$
30042 @@ -324,6 +324,114 @@ render_handler_on_accelerated_paint(struct _cef_render_handler_t* self,
30053 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30071 + CefRenderHandlerCppToC::Get(self)->GetTouchHandleSize(
30085 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30105 + CefRenderHandlerCppToC::Get(self)->OnTouchHandleStateChanged(
30117 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30149 + CefRenderHandlerCppToC::Get(self)->OnTouchSelectionChanged(
30157 @@ -399,6 +507,28 @@ render_handler_on_scroll_offset_changed(struct _cef_render_handler_t* self,
30168 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30179 + CefRenderHandlerCppToC::Get(self)->OnRootLayerChanged(
30186 @@ -471,7 +601,8 @@ render_handler_on_text_selection_changed(struct _cef_render_handler_t* self,
30190 - cef_text_input_mode_t input_mode) {
30195 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30196 @@ -486,7 +617,8 @@ render_handler_on_virtual_keyboard_requested(struct _cef_render_handler_t* self,
30199 CefRenderHandlerCppToC::Get(self)->OnVirtualKeyboardRequested(
30200 - CefBrowserCToCpp::Wrap(browser), input_mode);
30206 @@ -504,10 +636,16 @@ CefRenderHandlerCppToC::CefRenderHandlerCppToC() {
30207 GetStruct()->on_popup_size = render_handler_on_popup_size;
30208 GetStruct()->on_paint = render_handler_on_paint;
30209 GetStruct()->on_accelerated_paint = render_handler_on_accelerated_paint;
30210 + GetStruct()->get_touch_handle_size = render_handler_get_touch_handle_size;
30211 + GetStruct()->on_touch_handle_state_changed =
30213 + GetStruct()->on_touch_selection_changed =
30215 GetStruct()->start_dragging = render_handler_start_dragging;
30216 GetStruct()->update_drag_cursor = render_handler_update_drag_cursor;
30217 GetStruct()->on_scroll_offset_changed =
30219 + GetStruct()->on_root_layer_changed = render_handler_on_root_layer_changed;
30220 GetStruct()->on_ime_composition_range_changed =
30222 GetStruct()->on_text_selection_changed =
30223 diff --git a/src/cef/libcef_dll/cpptoc/request_context_cpptoc.cc b/src/cef/libcef_dll/cpptoc/reques…
30225 --- a/src/cef/libcef_dll/cpptoc/request_context_cpptoc.cc
30227 @@ -9,15 +9,17 @@
30231 -// $hash=0be94c1d5a7a266610c3848f1732452cb33dd7a8$
30246 @@ -191,6 +193,41 @@ request_context_get_cookie_manager(struct _cef_request_context_t* self,
30252 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30260 + CefRequestContextCppToC::Get(self)->GetDataBase();
30269 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30278 + CefRequestContextCppToC::Get(self)->GetWebStorage(
30288 @@ -375,6 +412,21 @@ void CEF_CALLBACK request_context_clear_http_auth_credentials(
30295 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30303 + CefRequestContextCppToC::Get(self)->ClearClientAuthenticationCache(
30310 @@ -557,6 +609,8 @@ CefRequestContextCppToC::CefRequestContextCppToC() {
30311 GetStruct()->get_handler = request_context_get_handler;
30312 GetStruct()->get_cache_path = request_context_get_cache_path;
30313 GetStruct()->get_cookie_manager = request_context_get_cookie_manager;
30314 + GetStruct()->get_data_base = request_context_get_data_base;
30315 + GetStruct()->get_web_storage = request_context_get_web_storage;
30316 GetStruct()->register_scheme_handler_factory =
30318 GetStruct()->clear_scheme_handler_factories =
30319 @@ -570,6 +624,8 @@ CefRequestContextCppToC::CefRequestContextCppToC() {
30321 GetStruct()->clear_http_auth_credentials =
30323 + GetStruct()->clear_client_authentication_cache =
30325 GetStruct()->close_all_connections = request_context_close_all_connections;
30326 GetStruct()->resolve_host = request_context_resolve_host;
30327 GetStruct()->load_extension = request_context_load_extension;
30328 diff --git a/src/cef/libcef_dll/cpptoc/request_handler_cpptoc.cc b/src/cef/libcef_dll/cpptoc/reques…
30330 --- a/src/cef/libcef_dll/cpptoc/request_handler_cpptoc.cc
30332 @@ -9,7 +9,7 @@
30336 -// $hash=fa45e2603966fc7a6c93c930dd4c03692cf10fd2$
30341 @@ -23,6 +23,7 @@
30349 @@ -282,6 +283,8 @@ int CEF_CALLBACK request_handler_on_select_client_certificate(
30358 @@ -300,6 +303,14 @@ int CEF_CALLBACK request_handler_on_select_client_certificate(
30373 @@ -309,6 +320,12 @@ int CEF_CALLBACK request_handler_on_select_client_certificate(
30386 @@ -322,7 +339,7 @@ int CEF_CALLBACK request_handler_on_select_client_certificate(
30388 bool _retval = CefRequestHandlerCppToC::Get(self)->OnSelectClientCertificate(
30390 - port, certificatesList,
30395 diff --git a/src/cef/libcef_dll/cpptoc/run_quick_menu_callback_cpptoc.cc b/src/cef/libcef_dll/cppto…
30398 --- /dev/null
30400 @@ -0,0 +1,83 @@
30402 +// reserved. Use of this source code is governed by a BSD-style license that
30405 +// ---------------------------------------------------------------------------
30420 +// MEMBER FUNCTIONS - Body may be edited by hand.
30428 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30435 + CefRunQuickMenuCallbackCppToC::Get(self)->Continue(command_id, event_flags);
30442 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30449 + CefRunQuickMenuCallbackCppToC::Get(self)->Cancel();
30454 +// CONSTRUCTOR - Do not edit by hand.
30457 + GetStruct()->cont = run_quick_menu_callback_cont;
30458 + GetStruct()->cancel = run_quick_menu_callback_cancel;
30461 +// DESTRUCTOR - Do not edit by hand.
30484 diff --git a/src/cef/libcef_dll/cpptoc/run_quick_menu_callback_cpptoc.h b/src/cef/libcef_dll/cpptoc…
30487 --- /dev/null
30489 @@ -0,0 +1,38 @@
30491 +// reserved. Use of this source code is governed by a BSD-style license that
30494 +// ---------------------------------------------------------------------------
30509 +#error This file can be included DLL-side only
30517 +// This class may be instantiated and accessed DLL-side only.
30528 diff --git a/src/cef/libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.cc b/src/cef/libce…
30530 --- a/src/cef/libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.cc
30532 @@ -9,11 +9,10 @@
30536 -// $hash=5017f5bece20966b0972418228301ef32e05f740$
30541 -#include "libcef_dll/cpptoc/x509certificate_cpptoc.h"
30545 @@ -22,7 +21,8 @@ namespace {
30549 - struct _cef_x509certificate_t* cert) {
30554 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30555 @@ -30,11 +30,46 @@ void CEF_CALLBACK select_client_certificate_callback_select(
30559 - // Unverified params: cert
30570 CefSelectClientCertificateCallbackCppToC::Get(self)->Select(
30571 - CefX509CertificateCppToC::Unwrap(cert));
30579 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30586 + CefSelectClientCertificateCallbackCppToC::Get(self)->Cancel();
30593 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30600 + CefSelectClientCertificateCallbackCppToC::Get(self)->Ignore();
30604 @@ -44,6 +79,8 @@ void CEF_CALLBACK select_client_certificate_callback_select(
30607 GetStruct()->select = select_client_certificate_callback_select;
30608 + GetStruct()->cancel = select_client_certificate_callback_cancel;
30609 + GetStruct()->ignore = select_client_certificate_callback_ignore;
30612 // DESTRUCTOR - Do not edit by hand.
30613 diff --git a/src/cef/libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.h b/src/cef/libcef…
30615 --- a/src/cef/libcef_dll/cpptoc/select_client_certificate_callback_cpptoc.h
30617 @@ -9,7 +9,7 @@
30621 -// $hash=e397708024c85cf066c0b7b76f1fae74b3a3e4d6$
30626 @@ -20,8 +20,8 @@
30627 #error This file can be included DLL-side only
30630 -#include "include/capi/cef_request_handler_capi.h"
30631 -#include "include/cef_request_handler.h"
30637 diff --git a/src/cef/libcef_dll/cpptoc/store_web_archive_result_callback_cpptoc.cc b/src/cef/libcef…
30640 --- /dev/null
30642 @@ -0,0 +1,72 @@
30644 +// reserved. Use of this source code is governed by a BSD-style license that
30647 +// ---------------------------------------------------------------------------
30662 +// MEMBER FUNCTIONS - Body may be edited by hand.
30669 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30677 + CefStoreWebArchiveResultCallbackCppToC::Get(self)->OnStoreWebArchiveDone(
30683 +// CONSTRUCTOR - Do not edit by hand.
30687 + GetStruct()->on_store_web_archive_done =
30691 +// DESTRUCTOR - Do not edit by hand.
30715 diff --git a/src/cef/libcef_dll/cpptoc/store_web_archive_result_callback_cpptoc.h b/src/cef/libcef_…
30718 --- /dev/null
30720 @@ -0,0 +1,40 @@
30722 +// reserved. Use of this source code is governed by a BSD-style license that
30725 +// ---------------------------------------------------------------------------
30740 +#error This file can be included wrapper-side only
30750 +// This class may be instantiated and accessed wrapper-side only.
30761 diff --git a/src/cef/libcef_dll/cpptoc/web_storage_cpptoc.cc b/src/cef/libcef_dll/cpptoc/web_storag…
30764 --- /dev/null
30766 @@ -0,0 +1,144 @@
30768 +// reserved. Use of this source code is governed by a BSD-style license that
30771 +// ---------------------------------------------------------------------------
30786 +// GLOBAL FUNCTIONS - Body may be edited by hand.
30790 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30804 +// MEMBER FUNCTIONS - Body may be edited by hand.
30807 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30814 + CefWebStorageCppToC::Get(self)->DeleteAllData();
30819 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30830 + CefWebStorageCppToC::Get(self)->DeleteOrigin(CefString(origin));
30836 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30844 + CefWebStorageCppToC::Get(self)->GetOrigins(
30852 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30860 + CefWebStorageCppToC::Get(self)->GetOriginQuota(
30869 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30877 + CefWebStorageCppToC::Get(self)->GetOriginUsage(
30884 +// CONSTRUCTOR - Do not edit by hand.
30887 + GetStruct()->delete_all_data = web_storage_delete_all_data;
30888 + GetStruct()->delete_origin = web_storage_delete_origin;
30889 + GetStruct()->get_origins = web_storage_get_origins;
30890 + GetStruct()->get_origin_quota = web_storage_get_origin_quota;
30891 + GetStruct()->get_origin_usage = web_storage_get_origin_usage;
30894 +// DESTRUCTOR - Do not edit by hand.
30911 diff --git a/src/cef/libcef_dll/cpptoc/web_storage_cpptoc.h b/src/cef/libcef_dll/cpptoc/web_storage…
30914 --- /dev/null
30916 @@ -0,0 +1,37 @@
30918 +// reserved. Use of this source code is governed by a BSD-style license that
30921 +// ---------------------------------------------------------------------------
30936 +#error This file can be included DLL-side only
30944 +// This class may be instantiated and accessed DLL-side only.
30954 diff --git a/src/cef/libcef_dll/ctocpp/access_request_ctocpp.cc b/src/cef/libcef_dll/ctocpp/access_…
30957 --- /dev/null
30959 @@ -0,0 +1,92 @@
30961 +// reserved. Use of this source code is governed by a BSD-style license that
30964 +// ---------------------------------------------------------------------------
30977 +// VIRTUAL METHODS - Body may be edited by hand.
30979 +NO_SANITIZE("cfi-icall") CefString CefAccessRequestCToCpp::Origin() {
30986 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30989 + cef_string_userfree_t _retval = _struct->origin(_struct);
30997 +NO_SANITIZE("cfi-icall") int CefAccessRequestCToCpp::ResourceAcessId() {
31004 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31007 + int _retval = _struct->resource_acess_id(_struct);
31013 +NO_SANITIZE("cfi-icall")
31021 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31024 + _struct->report_request_result(_struct, allowed);
31027 +// CONSTRUCTOR - Do not edit by hand.
31031 +// DESTRUCTOR - Do not edit by hand.
31052 diff --git a/src/cef/libcef_dll/ctocpp/access_request_ctocpp.h b/src/cef/libcef_dll/ctocpp/access_r…
31055 --- /dev/null
31057 @@ -0,0 +1,43 @@
31059 +// reserved. Use of this source code is governed by a BSD-style license that
31062 +// ---------------------------------------------------------------------------
31077 +#error This file can be included wrapper-side only
31085 +// This class may be instantiated and accessed wrapper-side only.
31101 diff --git a/src/cef/libcef_dll/ctocpp/auth_callback_ctocpp.cc b/src/cef/libcef_dll/ctocpp/auth_cal…
31103 --- a/src/cef/libcef_dll/ctocpp/auth_callback_ctocpp.cc
31105 @@ -9,7 +9,7 @@
31109 -// $hash=3ae38c17cba153dbca73496eae905202ac09bfeb$
31114 @@ -47,6 +47,22 @@ NO_SANITIZE("cfi-icall") void CefAuthCallbackCToCpp::Cancel() {
31115 _struct->cancel(_struct);
31118 +NO_SANITIZE("cfi-icall") bool CefAuthCallbackCToCpp::IsHttpAuthInfoSaved() {
31125 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31128 + int _retval = _struct->is_http_auth_info_saved(_struct);
31134 // CONSTRUCTOR - Do not edit by hand.
31137 diff --git a/src/cef/libcef_dll/ctocpp/auth_callback_ctocpp.h b/src/cef/libcef_dll/ctocpp/auth_call…
31139 --- a/src/cef/libcef_dll/ctocpp/auth_callback_ctocpp.h
31141 @@ -9,7 +9,7 @@
31145 -// $hash=4c7396d46f103b82f979838707afc9bdc47f8607$
31150 @@ -36,6 +36,7 @@ class CefAuthCallbackCToCpp : public CefCToCppRefCounted<CefAuthCallbackCToCpp,
31158 diff --git a/src/cef/libcef_dll/ctocpp/browser_ctocpp.cc b/src/cef/libcef_dll/ctocpp/browser_ctocpp…
31160 --- a/src/cef/libcef_dll/ctocpp/browser_ctocpp.cc
31162 @@ -9,13 +9,15 @@
31166 -// $hash=e4497fd62570371469c3b8d242005add2099e463$
31179 @@ -111,6 +113,49 @@ NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::GoForward() {
31180 _struct->go_forward(_struct);
31183 +NO_SANITIZE("cfi-icall")
31191 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31194 + int _retval = _struct->can_go_back_or_forward(_struct, num_steps);
31200 +NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::GoBackOrForward(int num_steps) {
31207 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31210 + _struct->go_back_or_forward(_struct, num_steps);
31213 +NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::DeleteHistory() {
31220 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31223 + _struct->delete_history(_struct);
31226 NO_SANITIZE("cfi-icall") bool CefBrowserCToCpp::IsLoading() {
31229 @@ -153,6 +198,38 @@ NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::ReloadIgnoreCache() {
31230 _struct->reload_ignore_cache(_struct);
31233 +NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::ReloadOriginalUrl() {
31240 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31243 + _struct->reload_original_url(_struct);
31246 +NO_SANITIZE("cfi-icall")
31254 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31262 + _struct->set_browser_user_agent_string(_struct, user_agent.GetStruct());
31265 NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::StopLoad() {
31268 @@ -388,6 +465,59 @@ void CefBrowserCToCpp::GetFrameNames(std::vector<CefString>& names) {
31272 +NO_SANITIZE("cfi-icall")
31281 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31285 + _struct->get_permission_request_delegate(_struct);
31291 +NO_SANITIZE("cfi-icall")
31299 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31303 + _struct->get_geolocation_permissions(_struct);
31309 +NO_SANITIZE("cfi-icall") bool CefBrowserCToCpp::ShouldShowLoadingUI() {
31316 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31319 + int _retval = _struct->should_show_loading_ui(_struct);
31325 // CONSTRUCTOR - Do not edit by hand.
31328 diff --git a/src/cef/libcef_dll/ctocpp/browser_ctocpp.h b/src/cef/libcef_dll/ctocpp/browser_ctocpp.h
31330 --- a/src/cef/libcef_dll/ctocpp/browser_ctocpp.h
31332 @@ -9,7 +9,7 @@
31336 -// $hash=c7912e34194393590c80fdf47269afbc08a2a9be$
31341 @@ -42,9 +42,14 @@ class CefBrowserCToCpp
31356 @@ -57,6 +62,10 @@ class CefBrowserCToCpp
31367 diff --git a/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.cc b/src/cef/libcef_dll/ctocpp/browser_h…
31369 --- a/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.cc
31371 @@ -9,16 +9,19 @@
31375 -// $hash=2edab12ab1759213ab9a6b7620ea39a74291abc7$
31392 @@ -98,6 +101,25 @@ CefRefPtr<CefBrowser> CefBrowserHostCToCpp::GetBrowser() {
31396 +NO_SANITIZE("cfi-icall")
31404 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31412 + _struct->post_task_to_uithread(_struct, CefTaskCppToC::Wrap(task));
31415 NO_SANITIZE("cfi-icall")
31418 @@ -387,7 +409,8 @@ NO_SANITIZE("cfi-icall")
31422 - bool findNext) {
31428 @@ -402,7 +425,8 @@ void CefBrowserHostCToCpp::Find(const CefString& searchText,
31432 - _struct->find(_struct, searchText.GetStruct(), forward, matchCase, findNext);
31433 + _struct->find(_struct, searchText.GetStruct(), forward, matchCase, findNext,
31437 NO_SANITIZE("cfi-icall")
31438 @@ -659,6 +683,20 @@ NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::NotifyScreenInfoChanged() {
31439 _struct->notify_screen_info_changed(_struct);
31442 +NO_SANITIZE("cfi-icall")
31450 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31453 + _struct->set_virtual_pixel_ratio(_struct, ratio);
31456 NO_SANITIZE("cfi-icall")
31459 @@ -819,6 +857,435 @@ void CefBrowserHostCToCpp::SetWindowlessFrameRate(int frame_rate) {
31460 _struct->set_windowless_frame_rate(_struct, frame_rate);
31463 +NO_SANITIZE("cfi-icall")
31472 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31475 + _struct->set_web_preferences(_struct, &browser_settings);
31478 +NO_SANITIZE("cfi-icall")
31486 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31494 + _struct->put_user_agent(_struct, ua.GetStruct());
31497 +NO_SANITIZE("cfi-icall") CefString CefBrowserHostCToCpp::DefaultUserAgent() {
31504 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31507 + cef_string_userfree_t _retval = _struct->default_user_agent(_struct);
31515 +NO_SANITIZE("cfi-icall")
31523 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31526 + _struct->set_background_color(_struct, color);
31529 +NO_SANITIZE("cfi-icall")
31539 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31553 + _struct->register_ark_jsfunction(_struct, object_name.GetStruct(),
31561 +NO_SANITIZE("cfi-icall")
31571 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31586 + _struct->unregister_ark_jsfunction(_struct, object_name.GetStruct(),
31594 +NO_SANITIZE("cfi-icall")
31605 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31617 + _struct->store_web_archive(
31622 +NO_SANITIZE("cfi-icall") CefString CefBrowserHostCToCpp::Title() {
31629 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31632 + cef_string_userfree_t _retval = _struct->title(_struct);
31640 +NO_SANITIZE("cfi-icall")
31649 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31658 + _struct->create_web_message_ports(_struct, portsList);
31668 +NO_SANITIZE("cfi-icall")
31678 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31687 + _struct->post_web_message(_struct, message.GetWritableStruct(), portsList,
31698 +NO_SANITIZE("cfi-icall")
31706 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31709 + _struct->close_port(_struct, port_handle.GetWritableStruct());
31712 +NO_SANITIZE("cfi-icall")
31720 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31723 + _struct->destroy_all_web_message_ports(_struct);
31726 +NO_SANITIZE("cfi-icall")
31735 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31738 + _struct->post_port_message(_struct, port_handle.GetWritableStruct(),
31742 +NO_SANITIZE("cfi-icall")
31752 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31760 + _struct->set_port_message_callback(
31765 +NO_SANITIZE("cfi-icall")
31773 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31776 + _struct->get_hit_data(_struct, &type, extra_data.GetWritableStruct());
31779 +NO_SANITIZE("cfi-icall")
31787 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31790 + _struct->set_initial_scale(_struct, scale);
31793 +NO_SANITIZE("cfi-icall") int CefBrowserHostCToCpp::PageLoadProgress() {
31800 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31803 + int _retval = _struct->page_load_progress(_struct);
31809 +NO_SANITIZE("cfi-icall") float CefBrowserHostCToCpp::Scale() {
31816 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31819 + float _retval = _struct->scale(_struct);
31825 +NO_SANITIZE("cfi-icall")
31837 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31842 + _struct->load_with_data_and_base_url(
31847 +NO_SANITIZE("cfi-icall")
31857 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31862 + _struct->load_with_data(_struct, data.GetStruct(), mimeType.GetStruct(),
31866 +NO_SANITIZE("cfi-icall")
31874 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31885 + _struct->add_visited_links(_struct, urlsList);
31892 NO_SANITIZE("cfi-icall")
31895 @@ -999,8 +1466,8 @@ void CefBrowserHostCToCpp::DragSourceSystemDragEnded() {
31898 NO_SANITIZE("cfi-icall")
31899 -CefRefPtr<CefNavigationEntry>
31900 -CefBrowserHostCToCpp::GetVisibleNavigationEntry() {
31906 @@ -1110,6 +1577,187 @@ NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::IsAudioMuted() {
31910 +NO_SANITIZE("cfi-icall")
31920 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31932 + _struct->execute_java_script(
31937 +NO_SANITIZE("cfi-icall")
31945 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31948 + _struct->set_native_window(_struct, window);
31951 +NO_SANITIZE("cfi-icall")
31959 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31962 + _struct->set_web_debugging_access(_struct, isEnableDebug);
31965 +NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::GetWebDebuggingAccess() {
31972 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31975 + int _retval = _struct->get_web_debugging_access(_struct);
31981 +NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::GetImageForContextNode() {
31988 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31991 + _struct->get_image_for_context_node(_struct);
31994 +NO_SANITIZE("cfi-icall")
32002 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32010 + _struct->get_image_from_cache(_struct, url.GetStruct());
32013 +NO_SANITIZE("cfi-icall") void CefBrowserHostCToCpp::ExitFullScreen() {
32020 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32023 + _struct->exit_full_screen(_struct);
32026 +NO_SANITIZE("cfi-icall")
32034 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32042 + _struct->update_locale(_struct, locale.GetStruct());
32045 +NO_SANITIZE("cfi-icall") CefString CefBrowserHostCToCpp::GetOriginalUrl() {
32052 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32055 + cef_string_userfree_t _retval = _struct->get_original_url(_struct);
32063 +NO_SANITIZE("cfi-icall")
32071 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32074 + _struct->put_network_available(_struct, available);
32077 +NO_SANITIZE("cfi-icall")
32085 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32088 + _struct->remove_cache(_struct, include_disk_files);
32091 // CONSTRUCTOR - Do not edit by hand.
32094 diff --git a/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.h b/src/cef/libcef_dll/ctocpp/browser_ho…
32096 --- a/src/cef/libcef_dll/ctocpp/browser_host_ctocpp.h
32098 @@ -9,7 +9,7 @@
32102 -// $hash=6de4205143b6855e7ccf54da14a0494db0b4aaa3$
32107 @@ -38,6 +38,7 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
32115 @@ -67,7 +68,8 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
32119 - bool findNext) override;
32125 @@ -89,6 +91,7 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
32133 @@ -105,6 +108,44 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
32178 @@ -132,6 +173,19 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
32198 diff --git a/src/cef/libcef_dll/ctocpp/browser_permission_request_delegate_ctocpp.cc b/src/cef/libc…
32201 --- /dev/null
32203 @@ -0,0 +1,191 @@
32205 +// reserved. Use of this source code is governed by a BSD-style license that
32208 +// ---------------------------------------------------------------------------
32221 +// VIRTUAL METHODS - Body may be edited by hand.
32223 +NO_SANITIZE("cfi-icall")
32232 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32240 + _struct->ask_geolocation_permission(_struct, origin.GetStruct(), callback);
32243 +NO_SANITIZE("cfi-icall")
32252 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32260 + _struct->abort_ask_geolocation_permission(_struct, origin.GetStruct());
32263 +NO_SANITIZE("cfi-icall")
32273 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32281 + _struct->ask_protected_media_identifier_permission(
32285 +NO_SANITIZE("cfi-icall")
32295 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32303 + _struct->abort_ask_protected_media_identifier_permission(_struct,
32307 +NO_SANITIZE("cfi-icall")
32316 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32324 + _struct->ask_midisysex_permission(_struct, origin.GetStruct(), callback);
32327 +NO_SANITIZE("cfi-icall")
32336 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32344 + _struct->abort_ask_midisysex_permission(_struct, origin.GetStruct());
32347 +NO_SANITIZE("cfi-icall")
32356 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32364 + _struct->notify_geolocation_permission(_struct, value, origin.GetStruct());
32367 +// CONSTRUCTOR - Do not edit by hand.
32372 +// DESTRUCTOR - Do not edit by hand.
32395 diff --git a/src/cef/libcef_dll/ctocpp/browser_permission_request_delegate_ctocpp.h b/src/cef/libce…
32398 --- /dev/null
32400 @@ -0,0 +1,52 @@
32402 +// reserved. Use of this source code is governed by a BSD-style license that
32405 +// ---------------------------------------------------------------------------
32420 +#error This file can be included wrapper-side only
32428 +// This class may be instantiated and accessed wrapper-side only.
32453 diff --git a/src/cef/libcef_dll/ctocpp/client_ctocpp.cc b/src/cef/libcef_dll/ctocpp/client_ctocpp.cc
32455 --- a/src/cef/libcef_dll/ctocpp/client_ctocpp.cc
32457 @@ -9,12 +9,13 @@
32461 -// $hash=f31f5010a3c5c4624b93d994b6fce1e795eeac93$
32472 @@ -29,6 +30,7 @@
32480 @@ -37,14 +39,14 @@
32482 NO_SANITIZE("cfi-icall")
32484 - cef_client_t* _struct = GetStruct();
32489 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32492 - cef_audio_handler_t* _retval = _struct->get_audio_handler(_struct);
32493 + cef_audio_handler_t *_retval = _struct->get_audio_handler(_struct);
32497 @@ -52,14 +54,14 @@ CefRefPtr<CefAudioHandler> CefClientCToCpp::GetAudioHandler() {
32499 NO_SANITIZE("cfi-icall")
32501 - cef_client_t* _struct = GetStruct();
32506 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32509 - cef_context_menu_handler_t* _retval =
32511 _struct->get_context_menu_handler(_struct);
32514 @@ -68,14 +70,14 @@ CefRefPtr<CefContextMenuHandler> CefClientCToCpp::GetContextMenuHandler() {
32516 NO_SANITIZE("cfi-icall")
32518 - cef_client_t* _struct = GetStruct();
32523 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32526 - cef_dialog_handler_t* _retval = _struct->get_dialog_handler(_struct);
32527 + cef_dialog_handler_t *_retval = _struct->get_dialog_handler(_struct);
32531 @@ -83,14 +85,14 @@ CefRefPtr<CefDialogHandler> CefClientCToCpp::GetDialogHandler() {
32533 NO_SANITIZE("cfi-icall")
32535 - cef_client_t* _struct = GetStruct();
32540 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32543 - cef_display_handler_t* _retval = _struct->get_display_handler(_struct);
32544 + cef_display_handler_t *_retval = _struct->get_display_handler(_struct);
32548 @@ -98,14 +100,14 @@ CefRefPtr<CefDisplayHandler> CefClientCToCpp::GetDisplayHandler() {
32550 NO_SANITIZE("cfi-icall")
32552 - cef_client_t* _struct = GetStruct();
32557 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32560 - cef_download_handler_t* _retval = _struct->get_download_handler(_struct);
32561 + cef_download_handler_t *_retval = _struct->get_download_handler(_struct);
32565 @@ -113,14 +115,14 @@ CefRefPtr<CefDownloadHandler> CefClientCToCpp::GetDownloadHandler() {
32567 NO_SANITIZE("cfi-icall")
32569 - cef_client_t* _struct = GetStruct();
32574 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32577 - cef_drag_handler_t* _retval = _struct->get_drag_handler(_struct);
32578 + cef_drag_handler_t *_retval = _struct->get_drag_handler(_struct);
32582 @@ -128,14 +130,14 @@ CefRefPtr<CefDragHandler> CefClientCToCpp::GetDragHandler() {
32584 NO_SANITIZE("cfi-icall")
32586 - cef_client_t* _struct = GetStruct();
32591 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32594 - cef_find_handler_t* _retval = _struct->get_find_handler(_struct);
32595 + cef_find_handler_t *_retval = _struct->get_find_handler(_struct);
32599 @@ -143,14 +145,14 @@ CefRefPtr<CefFindHandler> CefClientCToCpp::GetFindHandler() {
32601 NO_SANITIZE("cfi-icall")
32603 - cef_client_t* _struct = GetStruct();
32608 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32611 - cef_focus_handler_t* _retval = _struct->get_focus_handler(_struct);
32612 + cef_focus_handler_t *_retval = _struct->get_focus_handler(_struct);
32616 @@ -158,14 +160,14 @@ CefRefPtr<CefFocusHandler> CefClientCToCpp::GetFocusHandler() {
32618 NO_SANITIZE("cfi-icall")
32620 - cef_client_t* _struct = GetStruct();
32625 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32628 - cef_frame_handler_t* _retval = _struct->get_frame_handler(_struct);
32629 + cef_frame_handler_t *_retval = _struct->get_frame_handler(_struct);
32633 @@ -173,14 +175,14 @@ CefRefPtr<CefFrameHandler> CefClientCToCpp::GetFrameHandler() {
32635 NO_SANITIZE("cfi-icall")
32637 - cef_client_t* _struct = GetStruct();
32642 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32645 - cef_jsdialog_handler_t* _retval = _struct->get_jsdialog_handler(_struct);
32646 + cef_jsdialog_handler_t *_retval = _struct->get_jsdialog_handler(_struct);
32650 @@ -188,14 +190,14 @@ CefRefPtr<CefJSDialogHandler> CefClientCToCpp::GetJSDialogHandler() {
32652 NO_SANITIZE("cfi-icall")
32654 - cef_client_t* _struct = GetStruct();
32659 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32662 - cef_keyboard_handler_t* _retval = _struct->get_keyboard_handler(_struct);
32663 + cef_keyboard_handler_t *_retval = _struct->get_keyboard_handler(_struct);
32667 @@ -203,14 +205,14 @@ CefRefPtr<CefKeyboardHandler> CefClientCToCpp::GetKeyboardHandler() {
32669 NO_SANITIZE("cfi-icall")
32671 - cef_client_t* _struct = GetStruct();
32676 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32679 - cef_life_span_handler_t* _retval = _struct->get_life_span_handler(_struct);
32680 + cef_life_span_handler_t *_retval = _struct->get_life_span_handler(_struct);
32684 @@ -218,14 +220,14 @@ CefRefPtr<CefLifeSpanHandler> CefClientCToCpp::GetLifeSpanHandler() {
32686 NO_SANITIZE("cfi-icall")
32688 - cef_client_t* _struct = GetStruct();
32693 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32696 - cef_load_handler_t* _retval = _struct->get_load_handler(_struct);
32697 + cef_load_handler_t *_retval = _struct->get_load_handler(_struct);
32701 @@ -233,14 +235,14 @@ CefRefPtr<CefLoadHandler> CefClientCToCpp::GetLoadHandler() {
32703 NO_SANITIZE("cfi-icall")
32705 - cef_client_t* _struct = GetStruct();
32710 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32713 - cef_print_handler_t* _retval = _struct->get_print_handler(_struct);
32714 + cef_print_handler_t *_retval = _struct->get_print_handler(_struct);
32718 @@ -248,14 +250,14 @@ CefRefPtr<CefPrintHandler> CefClientCToCpp::GetPrintHandler() {
32720 NO_SANITIZE("cfi-icall")
32722 - cef_client_t* _struct = GetStruct();
32727 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32730 - cef_render_handler_t* _retval = _struct->get_render_handler(_struct);
32731 + cef_render_handler_t *_retval = _struct->get_render_handler(_struct);
32735 @@ -263,26 +265,39 @@ CefRefPtr<CefRenderHandler> CefClientCToCpp::GetRenderHandler() {
32737 NO_SANITIZE("cfi-icall")
32739 - cef_client_t* _struct = GetStruct();
32744 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32747 - cef_request_handler_t* _retval = _struct->get_request_handler(_struct);
32748 + cef_request_handler_t *_retval = _struct->get_request_handler(_struct);
32754 +NO_SANITIZE("cfi-icall")
32760 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32763 + cef_permission_request_t *_retval = _struct->get_permission_request(_struct);
32769 NO_SANITIZE("cfi-icall")
32771 - CefRefPtr<CefBrowser> browser,
32772 - CefRefPtr<CefFrame> frame,
32773 - CefProcessId source_process,
32774 - CefRefPtr<CefProcessMessage> message) {
32775 - cef_client_t* _struct = GetStruct();
32782 @@ -310,6 +325,43 @@ bool CefClientCToCpp::OnProcessMessageReceived(
32786 +NO_SANITIZE("cfi-icall")
32795 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32815 + int _retval = _struct->notify_java_script_result(
32823 // CONSTRUCTOR - Do not edit by hand.
32826 @@ -319,14 +371,13 @@ CefClientCToCpp::CefClientCToCpp() {}
32830 -cef_client_t*
32833 - CefWrapperType type,
32834 - CefClient* c) {
32841 -CefWrapperType CefCToCppRefCounted<CefClientCToCpp, CefClient, cef_client_t>::
32842 - kWrapperType = WT_CLIENT;
32845 diff --git a/src/cef/libcef_dll/ctocpp/client_ctocpp.h b/src/cef/libcef_dll/ctocpp/client_ctocpp.h
32847 --- a/src/cef/libcef_dll/ctocpp/client_ctocpp.h
32849 @@ -9,7 +9,7 @@
32853 -// $hash=c4370b0b3a14c9739b5a639eda06c286f6981e10$
32858 @@ -28,7 +28,7 @@
32859 // This class may be instantiated and accessed DLL-side only.
32862 - public:
32867 @@ -49,10 +49,15 @@ class CefClientCToCpp
32882 -#endif // CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_
32884 diff --git a/src/cef/libcef_dll/ctocpp/context_menu_handler_ctocpp.cc b/src/cef/libcef_dll/ctocpp/c…
32886 --- a/src/cef/libcef_dll/ctocpp/context_menu_handler_ctocpp.cc
32888 @@ -9,15 +9,17 @@
32892 -// $hash=7b91234844f040546245a09f4724142efdf929ff$
32906 // VIRTUAL METHODS - Body may be edited by hand.
32907 @@ -169,6 +171,149 @@ void CefContextMenuHandlerCToCpp::OnContextMenuDismissed(
32911 +NO_SANITIZE("cfi-icall")
32925 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32941 + int _retval = _struct->run_quick_menu(
32950 +NO_SANITIZE("cfi-icall")
32962 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32974 + int _retval = _struct->on_quick_menu_command(
32982 +NO_SANITIZE("cfi-icall")
32992 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33004 + _struct->on_quick_menu_dismissed(_struct, CefBrowserCppToC::Wrap(browser),
33008 +NO_SANITIZE("cfi-icall")
33018 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33030 + _struct->on_get_image_for_context_node(
33034 +NO_SANITIZE("cfi-icall")
33043 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33051 + _struct->on_get_image_from_cache(_struct, CefImageCppToC::Wrap(image));
33054 // CONSTRUCTOR - Do not edit by hand.
33057 diff --git a/src/cef/libcef_dll/ctocpp/context_menu_handler_ctocpp.h b/src/cef/libcef_dll/ctocpp/co…
33059 --- a/src/cef/libcef_dll/ctocpp/context_menu_handler_ctocpp.h
33061 @@ -9,7 +9,7 @@
33065 -// $hash=3dba1df692cc69ba3aab91b989cceb9a7d363858$
33070 @@ -51,6 +51,21 @@ class CefContextMenuHandlerCToCpp
33092 diff --git a/src/cef/libcef_dll/ctocpp/cookie_manager_ctocpp.cc b/src/cef/libcef_dll/ctocpp/cookie_…
33094 --- a/src/cef/libcef_dll/ctocpp/cookie_manager_ctocpp.cc
33096 @@ -9,7 +9,7 @@
33100 -// $hash=e675ed75d36a3ce409ed3131229fb591f7e1a05a$
33105 @@ -28,19 +28,122 @@ CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager(
33109 - cef_cookie_manager_t* _retval = cef_cookie_manager_get_global_manager(
33117 +NO_SANITIZE("cfi-icall")
33121 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33140 // VIRTUAL METHODS - Body may be edited by hand.
33142 +NO_SANITIZE("cfi-icall") bool CefCookieManagerCToCpp::IsAcceptCookieAllowed() {
33147 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33150 + int _retval = _struct->is_accept_cookie_allowed(_struct);
33156 +NO_SANITIZE("cfi-icall")
33162 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33165 + _struct->put_accept_cookie_enabled(_struct, accept);
33168 +NO_SANITIZE("cfi-icall")
33174 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33177 + int _retval = _struct->is_third_party_cookie_allowed(_struct);
33183 +NO_SANITIZE("cfi-icall")
33189 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33192 + _struct->put_accept_third_party_cookie_enabled(_struct, accept);
33195 +NO_SANITIZE("cfi-icall")
33201 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33204 + int _retval = _struct->is_file_urlscheme_cookies_allowed(_struct);
33210 +NO_SANITIZE("cfi-icall")
33216 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33219 + _struct->put_accept_file_urlscheme_cookies_enabled(_struct, allow);
33222 NO_SANITIZE("cfi-icall")
33225 - cef_cookie_manager_t* _struct = GetStruct();
33230 @@ -61,10 +164,9 @@ bool CefCookieManagerCToCpp::VisitAllCookies(
33232 NO_SANITIZE("cfi-icall")
33234 - const CefString& url,
33235 - bool includeHttpOnly,
33238 - cef_cookie_manager_t* _struct = GetStruct();
33243 @@ -90,10 +192,9 @@ bool CefCookieManagerCToCpp::VisitUrlCookies(
33245 NO_SANITIZE("cfi-icall")
33247 - const CefString& url,
33248 - const CefCookie& cookie,
33251 - cef_cookie_manager_t* _struct = GetStruct();
33256 @@ -115,10 +216,9 @@ bool CefCookieManagerCToCpp::SetCookie(
33258 NO_SANITIZE("cfi-icall")
33260 - const CefString& url,
33261 - const CefString& cookie_name,
33264 - cef_cookie_manager_t* _struct = GetStruct();
33269 @@ -127,9 +227,9 @@ bool CefCookieManagerCToCpp::DeleteCookies(
33273 - int _retval =
33274 - _struct->delete_cookies(_struct, url.GetStruct(), cookie_name.GetStruct(),
33275 - CefDeleteCookiesCallbackCppToC::Wrap(callback));
33276 + int _retval = _struct->delete_cookies(
33282 @@ -138,7 +238,7 @@ bool CefCookieManagerCToCpp::DeleteCookies(
33283 NO_SANITIZE("cfi-icall")
33286 - cef_cookie_manager_t* _struct = GetStruct();
33291 @@ -163,17 +263,15 @@ CefCookieManagerCToCpp::CefCookieManagerCToCpp() {}
33295 -cef_cookie_manager_t*
33296 -CefCToCppRefCounted<CefCookieManagerCToCpp,
33297 - CefCookieManager,
33301 - CefCookieManager* c) {
33308 -CefWrapperType CefCToCppRefCounted<CefCookieManagerCToCpp,
33309 - CefCookieManager,
33313 diff --git a/src/cef/libcef_dll/ctocpp/cookie_manager_ctocpp.h b/src/cef/libcef_dll/ctocpp/cookie_m…
33315 --- a/src/cef/libcef_dll/ctocpp/cookie_manager_ctocpp.h
33317 @@ -9,7 +9,7 @@
33321 -// $hash=2e127461190840c11239b8b08aa3f88f5dc4013f$
33326 @@ -35,6 +35,12 @@ class CefCookieManagerCToCpp
33339 @@ -44,6 +50,7 @@ class CefCookieManagerCToCpp
33347 diff --git a/src/cef/libcef_dll/ctocpp/cookie_visitor_ctocpp.cc b/src/cef/libcef_dll/ctocpp/cookie_…
33349 --- a/src/cef/libcef_dll/ctocpp/cookie_visitor_ctocpp.cc
33351 @@ -9,7 +9,7 @@
33355 -// $hash=252841f4863d24030d5b42fd34179cfe23ac84c4$
33360 @@ -44,6 +44,25 @@ bool CefCookieVisitorCToCpp::Visit(const CefCookie& cookie,
33364 +NO_SANITIZE("cfi-icall")
33372 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33380 + _struct->set_cookie_line(_struct, cookieLine.GetStruct());
33383 // CONSTRUCTOR - Do not edit by hand.
33386 diff --git a/src/cef/libcef_dll/ctocpp/cookie_visitor_ctocpp.h b/src/cef/libcef_dll/ctocpp/cookie_v…
33388 --- a/src/cef/libcef_dll/ctocpp/cookie_visitor_ctocpp.h
33390 @@ -9,7 +9,7 @@
33394 -// $hash=cf0a0d91c37feb03b7526f21494d84d661cef6e4$
33399 @@ -39,6 +39,7 @@ class CefCookieVisitorCToCpp
33407 diff --git a/src/cef/libcef_dll/ctocpp/data_base_ctocpp.cc b/src/cef/libcef_dll/ctocpp/data_base_ct…
33410 --- /dev/null
33412 @@ -0,0 +1,273 @@
33414 +// reserved. Use of this source code is governed by a BSD-style license that
33417 +// ---------------------------------------------------------------------------
33430 +// STATIC METHODS - Body may be edited by hand.
33432 +NO_SANITIZE("cfi-icall")
33434 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33443 +// VIRTUAL METHODS - Body may be edited by hand.
33445 +NO_SANITIZE("cfi-icall") void CefDataBaseCToCpp::DeleteHttpAuthCredentials() {
33450 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33453 + _struct->delete_http_auth_credentials(_struct);
33456 +NO_SANITIZE("cfi-icall") bool CefDataBaseCToCpp::ExistHttpAuthCredentials() {
33461 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33464 + int _retval = _struct->exist_http_auth_credentials(_struct);
33470 +NO_SANITIZE("cfi-icall")
33479 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33499 + _struct->save_http_auth_credentials(_struct, host.GetStruct(),
33504 +NO_SANITIZE("cfi-icall")
33513 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33531 + _struct->get_http_auth_credentials(_struct, host.GetStruct(),
33542 +NO_SANITIZE("cfi-icall")
33549 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33558 + _struct->exist_permission_by_origin(_struct, origin.GetStruct(), type);
33564 +NO_SANITIZE("cfi-icall")
33571 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33582 + int _retval = _struct->get_permission_result_by_origin(
33592 +NO_SANITIZE("cfi-icall")
33599 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33607 + _struct->set_permission_by_origin(_struct, origin.GetStruct(), type, result);
33610 +NO_SANITIZE("cfi-icall")
33617 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33625 + _struct->clear_permission_by_origin(_struct, origin.GetStruct(), type);
33628 +NO_SANITIZE("cfi-icall") void CefDataBaseCToCpp::ClearAllPermission(int type) {
33633 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33636 + _struct->clear_all_permission(_struct, type);
33639 +NO_SANITIZE("cfi-icall")
33646 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33655 + _struct->get_origins_by_permission(_struct, type, originsList);
33665 +// CONSTRUCTOR - Do not edit by hand.
33669 +// DESTRUCTOR - Do not edit by hand.
33686 diff --git a/src/cef/libcef_dll/ctocpp/data_base_ctocpp.h b/src/cef/libcef_dll/ctocpp/data_base_cto…
33689 --- /dev/null
33691 @@ -0,0 +1,61 @@
33693 +// reserved. Use of this source code is governed by a BSD-style license that
33696 +// ---------------------------------------------------------------------------
33711 +#error This file can be included wrapper-side only
33720 +// This class may be instantiated and accessed wrapper-side only.
33753 diff --git a/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.cc b/src/cef/libcef_dll/ctocpp/dialog_…
33755 --- a/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.cc
33757 @@ -9,7 +9,7 @@
33761 -// $hash=cac933371fc47c864230d4537ef1da76cd7e4d8e$
33766 @@ -28,6 +28,7 @@ bool CefDialogHandlerCToCpp::OnFileDialog(
33774 @@ -61,7 +62,7 @@ bool CefDialogHandlerCToCpp::OnFileDialog(
33775 int _retval = _struct->on_file_dialog(
33778 - CefFileDialogCallbackCppToC::Wrap(callback));
33783 diff --git a/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.h b/src/cef/libcef_dll/ctocpp/dialog_h…
33785 --- a/src/cef/libcef_dll/ctocpp/dialog_handler_ctocpp.h
33787 @@ -9,7 +9,7 @@
33791 -// $hash=4c07a40d3bd171adf3ae3cc4aa935bc7eca4aa5e$
33796 @@ -42,6 +42,7 @@ class CefDialogHandlerCToCpp
33804 diff --git a/src/cef/libcef_dll/ctocpp/display_handler_ctocpp.cc b/src/cef/libcef_dll/ctocpp/displa…
33806 --- a/src/cef/libcef_dll/ctocpp/display_handler_ctocpp.cc
33808 @@ -9,7 +9,7 @@
33812 -// $hash=f40564d59c337fede5e8c3121ed735166d5e05a3$
33817 @@ -105,6 +105,86 @@ void CefDisplayHandlerCToCpp::OnFaviconURLChange(
33821 +NO_SANITIZE("cfi-icall")
33832 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33844 + _struct->on_received_touch_icon_url(_struct, CefBrowserCppToC::Wrap(browser),
33848 +NO_SANITIZE("cfi-icall")
33860 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33868 + _struct->on_received_icon(_struct, data, width, height, color_type,
33872 +NO_SANITIZE("cfi-icall")
33885 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33897 + _struct->on_received_icon_url(_struct, image_url.GetStruct(), data, width,
33901 NO_SANITIZE("cfi-icall")
33904 @@ -277,6 +357,28 @@ bool CefDisplayHandlerCToCpp::OnCursorChange(
33908 +NO_SANITIZE("cfi-icall")
33918 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33926 + _struct->on_scale_changed(_struct, CefBrowserCppToC::Wrap(browser),
33930 // CONSTRUCTOR - Do not edit by hand.
33933 diff --git a/src/cef/libcef_dll/ctocpp/display_handler_ctocpp.h b/src/cef/libcef_dll/ctocpp/display…
33935 --- a/src/cef/libcef_dll/ctocpp/display_handler_ctocpp.h
33937 @@ -9,7 +9,7 @@
33941 -// $hash=f6769db4bda5143d4e42a2e68788b58c68292c1d$
33946 @@ -43,6 +43,20 @@ class CefDisplayHandlerCToCpp
33967 @@ -61,6 +75,9 @@ class CefDisplayHandlerCToCpp
33977 diff --git a/src/cef/libcef_dll/ctocpp/frame_ctocpp.cc b/src/cef/libcef_dll/ctocpp/frame_ctocpp.cc
33979 --- a/src/cef/libcef_dll/ctocpp/frame_ctocpp.cc
33981 @@ -9,11 +9,12 @@
33985 -// $hash=69f1920b81a34d3d65bd1e1a6b41c37c0b6f28d6$
33995 @@ -395,6 +396,24 @@ void CefFrameCToCpp::VisitDOM(CefRefPtr<CefDOMVisitor> visitor) {
33996 _struct->visit_dom(_struct, CefDOMVisitorCppToC::Wrap(visitor));
33999 +NO_SANITIZE("cfi-icall")
34008 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34013 + _struct->load_header_url(_struct, url.GetStruct(),
34017 NO_SANITIZE("cfi-icall")
34020 @@ -446,6 +465,25 @@ void CefFrameCToCpp::SendProcessMessage(CefProcessId target_process,
34024 +NO_SANITIZE("cfi-icall")
34032 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34040 + _struct->get_images(_struct, CefGetImagesCallbackCppToC::Wrap(callback));
34043 // CONSTRUCTOR - Do not edit by hand.
34046 diff --git a/src/cef/libcef_dll/ctocpp/frame_ctocpp.h b/src/cef/libcef_dll/ctocpp/frame_ctocpp.h
34048 --- a/src/cef/libcef_dll/ctocpp/frame_ctocpp.h
34050 @@ -9,7 +9,7 @@
34054 -// $hash=7671d54b3de24e8e66322daf68d66b8b8acba50c$
34059 @@ -64,11 +64,14 @@ class CefFrameCToCpp
34074 diff --git a/src/cef/libcef_dll/ctocpp/geolocation_acess_ctocpp.cc b/src/cef/libcef_dll/ctocpp/geol…
34077 --- /dev/null
34079 @@ -0,0 +1,126 @@
34081 +// reserved. Use of this source code is governed by a BSD-style license that
34084 +// ---------------------------------------------------------------------------
34097 +// VIRTUAL METHODS - Body may be edited by hand.
34099 +NO_SANITIZE("cfi-icall")
34107 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34115 + int _retval = _struct->contain_origin(_struct, origin.GetStruct());
34121 +NO_SANITIZE("cfi-icall")
34129 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34137 + int _retval = _struct->is_origin_access_enabled(_struct, origin.GetStruct());
34143 +NO_SANITIZE("cfi-icall")
34151 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34159 + _struct->enabled(_struct, origin.GetStruct());
34162 +NO_SANITIZE("cfi-icall")
34170 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34178 + _struct->disabled(_struct, origin.GetStruct());
34181 +// CONSTRUCTOR - Do not edit by hand.
34185 +// DESTRUCTOR - Do not edit by hand.
34206 diff --git a/src/cef/libcef_dll/ctocpp/geolocation_acess_ctocpp.h b/src/cef/libcef_dll/ctocpp/geolo…
34209 --- /dev/null
34211 @@ -0,0 +1,44 @@
34213 +// reserved. Use of this source code is governed by a BSD-style license that
34216 +// ---------------------------------------------------------------------------
34231 +#error This file can be included wrapper-side only
34239 +// This class may be instantiated and accessed wrapper-side only.
34256 diff --git a/src/cef/libcef_dll/ctocpp/geolocation_permissions_ctocpp.cc b/src/cef/libcef_dll/ctocp…
34259 --- /dev/null
34261 @@ -0,0 +1,128 @@
34263 +// reserved. Use of this source code is governed by a BSD-style license that
34266 +// ---------------------------------------------------------------------------
34279 +// VIRTUAL METHODS - Body may be edited by hand.
34281 +NO_SANITIZE("cfi-icall")
34289 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34297 + int _retval = _struct->has_origin(_struct, origin.GetStruct());
34303 +NO_SANITIZE("cfi-icall")
34312 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34320 + int _retval = _struct->is_origin_allowed(_struct, origin.GetStruct());
34326 +NO_SANITIZE("cfi-icall")
34334 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34342 + _struct->allow(_struct, origin.GetStruct());
34345 +NO_SANITIZE("cfi-icall")
34353 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34361 + _struct->deny(_struct, origin.GetStruct());
34364 +// CONSTRUCTOR - Do not edit by hand.
34368 +// DESTRUCTOR - Do not edit by hand.
34390 diff --git a/src/cef/libcef_dll/ctocpp/geolocation_permissions_ctocpp.h b/src/cef/libcef_dll/ctocpp…
34393 --- /dev/null
34395 @@ -0,0 +1,44 @@
34397 +// reserved. Use of this source code is governed by a BSD-style license that
34400 +// ---------------------------------------------------------------------------
34415 +#error This file can be included wrapper-side only
34423 +// This class may be instantiated and accessed wrapper-side only.
34440 diff --git a/src/cef/libcef_dll/ctocpp/get_images_callback_ctocpp.cc b/src/cef/libcef_dll/ctocpp/ge…
34443 --- /dev/null
34445 @@ -0,0 +1,58 @@
34447 +// reserved. Use of this source code is governed by a BSD-style license that
34450 +// ---------------------------------------------------------------------------
34463 +// VIRTUAL METHODS - Body may be edited by hand.
34465 +NO_SANITIZE("cfi-icall")
34473 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34476 + _struct->get_images(_struct, response);
34479 +// CONSTRUCTOR - Do not edit by hand.
34483 +// DESTRUCTOR - Do not edit by hand.
34504 diff --git a/src/cef/libcef_dll/ctocpp/get_images_callback_ctocpp.h b/src/cef/libcef_dll/ctocpp/get…
34507 --- /dev/null
34509 @@ -0,0 +1,47 @@
34511 +// reserved. Use of this source code is governed by a BSD-style license that
34514 +// ---------------------------------------------------------------------------
34529 +#error This file can be included DLL-side only
34543 +// This class may be instantiated and accessed DLL-side only.
34557 diff --git a/src/cef/libcef_dll/ctocpp/get_origin_usage_or_quota_callback_ctocpp.cc b/src/cef/libce…
34560 --- /dev/null
34562 @@ -0,0 +1,61 @@
34564 +// reserved. Use of this source code is governed by a BSD-style license that
34567 +// ---------------------------------------------------------------------------
34580 +// VIRTUAL METHODS - Body may be edited by hand.
34582 +NO_SANITIZE("cfi-icall")
34590 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34593 + _struct->on_complete(_struct, nums);
34596 +// CONSTRUCTOR - Do not edit by hand.
34601 +// DESTRUCTOR - Do not edit by hand.
34624 diff --git a/src/cef/libcef_dll/ctocpp/get_origin_usage_or_quota_callback_ctocpp.h b/src/cef/libcef…
34627 --- /dev/null
34629 @@ -0,0 +1,41 @@
34631 +// reserved. Use of this source code is governed by a BSD-style license that
34634 +// ---------------------------------------------------------------------------
34649 +#error This file can be included DLL-side only
34657 +// This class may be instantiated and accessed DLL-side only.
34671 diff --git a/src/cef/libcef_dll/ctocpp/get_origins_callback_ctocpp.cc b/src/cef/libcef_dll/ctocpp/g…
34674 --- /dev/null
34676 @@ -0,0 +1,139 @@
34678 +// reserved. Use of this source code is governed by a BSD-style license that
34681 +// ---------------------------------------------------------------------------
34695 +// VIRTUAL METHODS - Body may be edited by hand.
34697 +NO_SANITIZE("cfi-icall")
34705 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34714 + _struct->on_origins(_struct, originsList);
34724 +NO_SANITIZE("cfi-icall")
34732 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34741 + _struct->on_usages(_struct, usagesList);
34751 +NO_SANITIZE("cfi-icall")
34759 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34768 + _struct->on_quotas(_struct, quotasList);
34778 +NO_SANITIZE("cfi-icall") void CefGetOriginsCallbackCToCpp::OnComplete() {
34785 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34788 + _struct->on_complete(_struct);
34791 +// CONSTRUCTOR - Do not edit by hand.
34795 +// DESTRUCTOR - Do not edit by hand.
34816 diff --git a/src/cef/libcef_dll/ctocpp/get_origins_callback_ctocpp.h b/src/cef/libcef_dll/ctocpp/ge…
34819 --- /dev/null
34821 @@ -0,0 +1,45 @@
34823 +// reserved. Use of this source code is governed by a BSD-style license that
34826 +// ---------------------------------------------------------------------------
34841 +#error This file can be included DLL-side only
34850 +// This class may be instantiated and accessed DLL-side only.
34867 diff --git a/src/cef/libcef_dll/ctocpp/java_script_result_callback_ctocpp.cc b/src/cef/libcef_dll/c…
34870 --- /dev/null
34872 @@ -0,0 +1,65 @@
34874 +// reserved. Use of this source code is governed by a BSD-style license that
34877 +// ---------------------------------------------------------------------------
34890 +// VIRTUAL METHODS - Body may be edited by hand.
34892 +NO_SANITIZE("cfi-icall")
34901 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34909 + _struct->on_java_script_exe_result(_struct, result.GetStruct());
34912 +// CONSTRUCTOR - Do not edit by hand.
34916 +// DESTRUCTOR - Do not edit by hand.
34938 diff --git a/src/cef/libcef_dll/ctocpp/java_script_result_callback_ctocpp.h b/src/cef/libcef_dll/ct…
34941 --- /dev/null
34943 @@ -0,0 +1,43 @@
34945 +// reserved. Use of this source code is governed by a BSD-style license that
34948 +// ---------------------------------------------------------------------------
34963 +#error This file can be included DLL-side only
34973 +// This class may be instantiated and accessed DLL-side only.
34987 diff --git a/src/cef/libcef_dll/ctocpp/life_span_handler_ctocpp.cc b/src/cef/libcef_dll/ctocpp/life…
34989 --- a/src/cef/libcef_dll/ctocpp/life_span_handler_ctocpp.cc
34991 @@ -9,7 +9,7 @@
34995 -// $hash=374e065650a2c8fb36590542723d8e171f5de9ad$
35000 @@ -102,6 +102,40 @@ bool CefLifeSpanHandlerCToCpp::OnBeforePopup(
35004 +NO_SANITIZE("cfi-icall")
35017 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35030 + int _retval = _struct->on_pre_before_popup(
35038 NO_SANITIZE("cfi-icall")
35041 diff --git a/src/cef/libcef_dll/ctocpp/life_span_handler_ctocpp.h b/src/cef/libcef_dll/ctocpp/life_…
35043 --- a/src/cef/libcef_dll/ctocpp/life_span_handler_ctocpp.h
35045 @@ -9,7 +9,7 @@
35049 -// $hash=0061dae2023d2285c9f3e3d2bd9bfa4603208535$
35054 @@ -49,6 +49,11 @@ class CefLifeSpanHandlerCToCpp
35066 diff --git a/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.cc b/src/cef/libcef_dll/ctocpp/load_hand…
35068 --- a/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.cc
35070 @@ -9,12 +9,15 @@
35074 -// $hash=4a9f8a50b70bb46729c6d808f825d174ccc0f15e$
35086 // VIRTUAL METHODS - Body may be edited by hand.
35087 @@ -128,6 +131,144 @@ void CefLoadHandlerCToCpp::OnLoadError(CefRefPtr<CefBrowser> browser,
35091 +NO_SANITIZE("cfi-icall")
35103 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35115 + _struct->on_load_error_with_request(_struct, CefRequestCppToC::Wrap(request),
35120 +NO_SANITIZE("cfi-icall")
35131 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35143 + _struct->on_http_error(_struct, CefRequestCppToC::Wrap(request),
35148 +NO_SANITIZE("cfi-icall")
35160 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35176 + _struct->on_refresh_accessed_history(_struct, CefBrowserCppToC::Wrap(browser),
35181 +NO_SANITIZE("cfi-icall")
35191 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35200 + _struct->on_page_visible(_struct, CefBrowserCppToC::Wrap(browser),
35204 +NO_SANITIZE("cfi-icall")
35213 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35225 + _struct->on_data_resubmission(_struct, CefBrowserCppToC::Wrap(browser),
35229 // CONSTRUCTOR - Do not edit by hand.
35232 diff --git a/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.h b/src/cef/libcef_dll/ctocpp/load_handl…
35234 --- a/src/cef/libcef_dll/ctocpp/load_handler_ctocpp.h
35236 @@ -9,7 +9,7 @@
35240 -// $hash=cb01f52ced702a16d6cce14ec3b7aacd2f5b6d34$
35245 @@ -49,6 +49,24 @@ class CefLoadHandlerCToCpp : public CefCToCppRefCounted<CefLoadHandlerCToCpp,
35270 diff --git a/src/cef/libcef_dll/ctocpp/navigation_entry_ctocpp.cc b/src/cef/libcef_dll/ctocpp/navig…
35272 --- a/src/cef/libcef_dll/ctocpp/navigation_entry_ctocpp.cc
35274 @@ -9,7 +9,7 @@
35278 -// $hash=824aed5040e7aee5f9bf2079eafdf6d612b7d2d0$
35283 @@ -108,7 +108,7 @@ NO_SANITIZE("cfi-icall") CefString CefNavigationEntryCToCpp::GetTitle() {
35285 NO_SANITIZE("cfi-icall")
35287 -CefNavigationEntryCToCpp::GetTransitionType() {
35292 @@ -189,6 +189,33 @@ CefRefPtr<CefSSLStatus> CefNavigationEntryCToCpp::GetSSLStatus() {
35296 +NO_SANITIZE("cfi-icall")
35308 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35316 + int _retval = _struct->get_favicon(_struct, pixel_data, &color_type,
35323 // CONSTRUCTOR - Do not edit by hand.
35326 diff --git a/src/cef/libcef_dll/ctocpp/navigation_entry_ctocpp.h b/src/cef/libcef_dll/ctocpp/naviga…
35328 --- a/src/cef/libcef_dll/ctocpp/navigation_entry_ctocpp.h
35330 @@ -9,7 +9,7 @@
35334 -// $hash=6f127ca09c0419845e4fc6aec71b0bf9373ff290$
35339 @@ -45,6 +45,11 @@ class CefNavigationEntryCToCpp
35351 diff --git a/src/cef/libcef_dll/ctocpp/permission_request_ctocpp.cc b/src/cef/libcef_dll/ctocpp/per…
35354 --- /dev/null
35356 @@ -0,0 +1,108 @@
35358 +// reserved. Use of this source code is governed by a BSD-style license that
35361 +// ---------------------------------------------------------------------------
35374 +// VIRTUAL METHODS - Body may be edited by hand.
35376 +NO_SANITIZE("cfi-icall")
35382 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35390 + _struct->on_geolocation_show(_struct, origin.GetStruct());
35393 +NO_SANITIZE("cfi-icall") void CefPermissionRequestCToCpp::OnGeolocationHide() {
35398 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35401 + _struct->on_geolocation_hide(_struct);
35404 +NO_SANITIZE("cfi-icall")
35411 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35419 + _struct->on_permission_request(_struct,
35423 +NO_SANITIZE("cfi-icall")
35430 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35438 + _struct->on_permission_request_canceled(
35442 +// CONSTRUCTOR - Do not edit by hand.
35446 +// DESTRUCTOR - Do not edit by hand.
35465 diff --git a/src/cef/libcef_dll/ctocpp/permission_request_ctocpp.h b/src/cef/libcef_dll/ctocpp/perm…
35468 --- /dev/null
35470 @@ -0,0 +1,45 @@
35472 +// reserved. Use of this source code is governed by a BSD-style license that
35475 +// ---------------------------------------------------------------------------
35490 +#error This file can be included DLL-side only
35498 +// This class may be instantiated and accessed DLL-side only.
35516 diff --git a/src/cef/libcef_dll/ctocpp/render_handler_ctocpp.cc b/src/cef/libcef_dll/ctocpp/render_…
35518 --- a/src/cef/libcef_dll/ctocpp/render_handler_ctocpp.cc
35520 @@ -9,7 +9,7 @@
35524 -// $hash=8d30c4f8cf47bac2f9f728de876abb759b38041f$
35529 @@ -21,8 +21,8 @@
35530 // VIRTUAL METHODS - Body may be edited by hand.
35532 NO_SANITIZE("cfi-icall")
35533 -CefRefPtr<CefAccessibilityHandler>
35534 -CefRenderHandlerCToCpp::GetAccessibilityHandler() {
35540 @@ -265,6 +265,71 @@ void CefRenderHandlerCToCpp::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
35544 +NO_SANITIZE("cfi-icall")
35555 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35563 + _struct->get_touch_handle_size(_struct, CefBrowserCppToC::Wrap(browser),
35567 +NO_SANITIZE("cfi-icall")
35577 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35585 + _struct->on_touch_handle_state_changed(
35589 +NO_SANITIZE("cfi-icall")
35601 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35604 + _struct->on_touch_selection_changed(_struct, &insert_handle,
35609 NO_SANITIZE("cfi-icall")
35612 @@ -341,6 +406,28 @@ void CefRenderHandlerCToCpp::OnScrollOffsetChanged(
35616 +NO_SANITIZE("cfi-icall")
35626 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35634 + _struct->on_root_layer_changed(_struct, CefBrowserCppToC::Wrap(browser),
35638 NO_SANITIZE("cfi-icall")
35641 @@ -410,7 +497,8 @@ void CefRenderHandlerCToCpp::OnTextSelectionChanged(
35642 NO_SANITIZE("cfi-icall")
35645 - TextInputMode input_mode) {
35651 @@ -426,7 +514,7 @@ void CefRenderHandlerCToCpp::OnVirtualKeyboardRequested(
35654 _struct->on_virtual_keyboard_requested(
35655 - _struct, CefBrowserCppToC::Wrap(browser), input_mode);
35659 // CONSTRUCTOR - Do not edit by hand.
35660 diff --git a/src/cef/libcef_dll/ctocpp/render_handler_ctocpp.h b/src/cef/libcef_dll/ctocpp/render_h…
35662 --- a/src/cef/libcef_dll/ctocpp/render_handler_ctocpp.h
35664 @@ -9,7 +9,7 @@
35668 -// $hash=de430ab07ee4a1ba234c17ae560813a0aeeef5da$
35673 @@ -57,6 +57,16 @@ class CefRenderHandlerCToCpp
35690 @@ -67,6 +77,9 @@ class CefRenderHandlerCToCpp
35700 @@ -74,7 +87,8 @@ class CefRenderHandlerCToCpp
35704 - TextInputMode input_mode) override;
35710 diff --git a/src/cef/libcef_dll/ctocpp/request_context_ctocpp.cc b/src/cef/libcef_dll/ctocpp/reques…
35712 --- a/src/cef/libcef_dll/ctocpp/request_context_ctocpp.cc
35714 @@ -9,7 +9,7 @@
35718 -// $hash=34a53ca8c93eb3dd0999d9e34d3f86307995e82d$
35723 @@ -19,10 +19,12 @@
35735 // STATIC METHODS - Body may be edited by hand.
35736 @@ -184,6 +186,40 @@ CefRefPtr<CefCookieManager> CefRequestContextCToCpp::GetCookieManager(
35740 +NO_SANITIZE("cfi-icall")
35746 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35749 + cef_data_base_t* _retval = _struct->get_data_base(_struct);
35755 +NO_SANITIZE("cfi-icall")
35762 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35767 + cef_web_storage_t* _retval = _struct->get_web_storage(
35774 NO_SANITIZE("cfi-icall")
35777 @@ -360,6 +396,22 @@ void CefRequestContextCToCpp::ClearHttpAuthCredentials(
35781 +NO_SANITIZE("cfi-icall")
35788 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35793 + _struct->clear_client_authentication_cache(
35797 NO_SANITIZE("cfi-icall")
35800 diff --git a/src/cef/libcef_dll/ctocpp/request_context_ctocpp.h b/src/cef/libcef_dll/ctocpp/request…
35802 --- a/src/cef/libcef_dll/ctocpp/request_context_ctocpp.h
35804 @@ -9,7 +9,7 @@
35808 -// $hash=693f5845874072abc324f643981531ed08d17b37$
35813 @@ -47,6 +47,9 @@ class CefRequestContextCToCpp
35823 @@ -64,6 +67,8 @@ class CefRequestContextCToCpp
35832 diff --git a/src/cef/libcef_dll/ctocpp/request_handler_ctocpp.cc b/src/cef/libcef_dll/ctocpp/reques…
35834 --- a/src/cef/libcef_dll/ctocpp/request_handler_ctocpp.cc
35836 @@ -9,7 +9,7 @@
35840 -// $hash=be460a1bbdf46dd4e317b39981878b3993675884$
35845 @@ -23,6 +23,7 @@
35851 // VIRTUAL METHODS - Body may be edited by hand.
35853 @@ -100,15 +101,14 @@ bool CefRequestHandlerCToCpp::OnOpenURLFromTab(
35856 NO_SANITIZE("cfi-icall")
35857 -CefRefPtr<CefResourceRequestHandler>
35858 -CefRequestHandlerCToCpp::GetResourceRequestHandler(
35859 - CefRefPtr<CefBrowser> browser,
35860 - CefRefPtr<CefFrame> frame,
35861 - CefRefPtr<CefRequest> request,
35862 - bool is_navigation,
35863 - bool is_download,
35864 - const CefString& request_initiator,
35865 - bool& disable_default_handling) {
35877 @@ -277,6 +277,8 @@ bool CefRequestHandlerCToCpp::OnSelectClientCertificate(
35886 @@ -300,6 +302,16 @@ bool CefRequestHandlerCToCpp::OnSelectClientCertificate(
35903 @@ -316,9 +328,15 @@ bool CefRequestHandlerCToCpp::OnSelectClientCertificate(
35905 int _retval = _struct->on_select_client_certificate(
35907 - certificatesCount, certificatesList,
35920 diff --git a/src/cef/libcef_dll/ctocpp/request_handler_ctocpp.h b/src/cef/libcef_dll/ctocpp/request…
35922 --- a/src/cef/libcef_dll/ctocpp/request_handler_ctocpp.h
35924 @@ -9,7 +9,7 @@
35928 -// $hash=2db5977714e59976ae9617a49a65cadb72623ebd$
35933 @@ -20,6 +20,7 @@
35934 #error This file can be included DLL-side only
35941 @@ -75,6 +76,8 @@ class CefRequestHandlerCToCpp
35950 diff --git a/src/cef/libcef_dll/ctocpp/run_context_menu_callback_ctocpp.cc b/src/cef/libcef_dll/cto…
35952 --- a/src/cef/libcef_dll/ctocpp/run_context_menu_callback_ctocpp.cc
35954 @@ -9,7 +9,7 @@
35958 -// $hash=f77743d285768c21bd89b9955d47176ef52f1e1a$
35963 @@ -19,7 +19,7 @@
35965 NO_SANITIZE("cfi-icall")
35967 - EventFlags event_flags) {
35972 diff --git a/src/cef/libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h b/src/cef/libcef_dll/ctoc…
35974 --- a/src/cef/libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h
35976 @@ -9,7 +9,7 @@
35980 -// $hash=9b70c0c42b514b6d44f4fff612eaf4d3fb62ef06$
35985 @@ -35,7 +35,7 @@ class CefRunContextMenuCallbackCToCpp
35989 - void Continue(int command_id, EventFlags event_flags) override;
35994 diff --git a/src/cef/libcef_dll/ctocpp/run_quick_menu_callback_ctocpp.cc b/src/cef/libcef_dll/ctocp…
35997 --- /dev/null
35999 @@ -0,0 +1,73 @@
36001 +// reserved. Use of this source code is governed by a BSD-style license that
36004 +// ---------------------------------------------------------------------------
36017 +// VIRTUAL METHODS - Body may be edited by hand.
36019 +NO_SANITIZE("cfi-icall")
36028 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36031 + _struct->cont(_struct, command_id, event_flags);
36034 +NO_SANITIZE("cfi-icall") void CefRunQuickMenuCallbackCToCpp::Cancel() {
36041 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36044 + _struct->cancel(_struct);
36047 +// CONSTRUCTOR - Do not edit by hand.
36051 +// DESTRUCTOR - Do not edit by hand.
36073 diff --git a/src/cef/libcef_dll/ctocpp/run_quick_menu_callback_ctocpp.h b/src/cef/libcef_dll/ctocpp…
36076 --- /dev/null
36078 @@ -0,0 +1,42 @@
36080 +// reserved. Use of this source code is governed by a BSD-style license that
36083 +// ---------------------------------------------------------------------------
36098 +#error This file can be included wrapper-side only
36106 +// This class may be instantiated and accessed wrapper-side only.
36121 diff --git a/src/cef/libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.cc b/src/cef/libce…
36123 --- a/src/cef/libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.cc
36125 @@ -9,18 +9,18 @@
36129 -// $hash=97852992a8406868d2b0dedf08a538a78b1cde9c$
36134 -#include "libcef_dll/ctocpp/x509certificate_ctocpp.h"
36137 // VIRTUAL METHODS - Body may be edited by hand.
36139 NO_SANITIZE("cfi-icall")
36141 - CefRefPtr<CefX509Certificate> cert) {
36147 @@ -29,10 +29,46 @@ void CefSelectClientCertificateCallbackCToCpp::Select(
36149 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36151 - // Unverified params: cert
36162 + _struct->select(_struct, private_key_file.GetStruct(),
36166 +NO_SANITIZE("cfi-icall")
36174 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36177 + _struct->cancel(_struct);
36180 +NO_SANITIZE("cfi-icall")
36188 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36191 - _struct->select(_struct, CefX509CertificateCToCpp::Unwrap(cert));
36192 + _struct->ignore(_struct);
36195 // CONSTRUCTOR - Do not edit by hand.
36196 diff --git a/src/cef/libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.h b/src/cef/libcef…
36198 --- a/src/cef/libcef_dll/ctocpp/select_client_certificate_callback_ctocpp.h
36200 @@ -9,7 +9,7 @@
36204 -// $hash=83b5b56f948ce72bcac08190cde41f7f20a9fbc4$
36209 @@ -20,8 +20,8 @@
36210 #error This file can be included wrapper-side only
36213 -#include "include/capi/cef_request_handler_capi.h"
36214 -#include "include/cef_request_handler.h"
36220 @@ -35,7 +35,10 @@ class CefSelectClientCertificateCallbackCToCpp
36224 - void Select(CefRefPtr<CefX509Certificate> cert) override;
36232 diff --git a/src/cef/libcef_dll/ctocpp/store_web_archive_result_callback_ctocpp.cc b/src/cef/libcef…
36235 --- /dev/null
36237 @@ -0,0 +1,64 @@
36239 +// reserved. Use of this source code is governed by a BSD-style license that
36242 +// ---------------------------------------------------------------------------
36255 +// VIRTUAL METHODS - Body may be edited by hand.
36257 +NO_SANITIZE("cfi-icall")
36266 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36271 + _struct->on_store_web_archive_done(_struct, result.GetStruct());
36274 +// CONSTRUCTOR - Do not edit by hand.
36279 +// DESTRUCTOR - Do not edit by hand.
36302 diff --git a/src/cef/libcef_dll/ctocpp/store_web_archive_result_callback_ctocpp.h b/src/cef/libcef_…
36305 --- /dev/null
36307 @@ -0,0 +1,43 @@
36309 +// reserved. Use of this source code is governed by a BSD-style license that
36312 +// ---------------------------------------------------------------------------
36327 +#error This file can be included DLL-side only
36337 +// This class may be instantiated and accessed DLL-side only.
36351 diff --git a/src/cef/libcef_dll/ctocpp/web_storage_ctocpp.cc b/src/cef/libcef_dll/ctocpp/web_storag…
36354 --- /dev/null
36356 @@ -0,0 +1,138 @@
36358 +// reserved. Use of this source code is governed by a BSD-style license that
36361 +// ---------------------------------------------------------------------------
36376 +// STATIC METHODS - Body may be edited by hand.
36378 +NO_SANITIZE("cfi-icall")
36381 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36393 +// VIRTUAL METHODS - Body may be edited by hand.
36395 +NO_SANITIZE("cfi-icall") void CefWebStorageCToCpp::DeleteAllData() {
36400 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36403 + _struct->delete_all_data(_struct);
36406 +NO_SANITIZE("cfi-icall")
36412 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36420 + _struct->delete_origin(_struct, origin.GetStruct());
36423 +NO_SANITIZE("cfi-icall")
36430 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36435 + _struct->get_origins(_struct, CefGetOriginsCallbackCppToC::Wrap(callback));
36438 +NO_SANITIZE("cfi-icall")
36446 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36451 + _struct->get_origin_quota(
36456 +NO_SANITIZE("cfi-icall")
36464 + // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36469 + _struct->get_origin_usage(
36474 +// CONSTRUCTOR - Do not edit by hand.
36478 +// DESTRUCTOR - Do not edit by hand.
36495 diff --git a/src/cef/libcef_dll/ctocpp/web_storage_ctocpp.h b/src/cef/libcef_dll/ctocpp/web_storage…
36498 --- /dev/null
36500 @@ -0,0 +1,48 @@
36502 +// reserved. Use of this source code is governed by a BSD-style license that
36505 +// ---------------------------------------------------------------------------
36520 +#error This file can be included wrapper-side only
36528 +// This class may be instantiated and accessed wrapper-side only.
36549 diff --git a/src/cef/libcef_dll/wrapper/libcef_dll_dylib.cc b/src/cef/libcef_dll/wrapper/libcef_dll…
36551 --- a/src/cef/libcef_dll/wrapper/libcef_dll_dylib.cc
36553 @@ -9,7 +9,7 @@
36557 -// $hash=ac1c94b2e83a4c806bed11fd0f456f8fe7ff1c44$
36562 @@ -21,6 +21,7 @@
36570 @@ -49,6 +50,7 @@
36578 @@ -201,6 +203,10 @@ typedef struct _cef_command_line_t* (*cef_command_line_get_global_ptr)();
36589 @@ -283,6 +289,8 @@ typedef struct _cef_dictionary_value_t* (*cef_dictionary_value_create_ptr)();
36598 @@ -578,6 +586,8 @@ struct libcef_pointers {
36607 @@ -625,6 +635,7 @@ struct libcef_pointers {
36615 @@ -793,6 +804,8 @@ int libcef_init_pointers(const char* path) {
36624 @@ -838,6 +851,7 @@ int libcef_init_pointers(const char* path) {
36632 @@ -1305,6 +1319,18 @@ struct _cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
36636 +NO_SANITIZE("cfi-icall")
36644 +NO_SANITIZE("cfi-icall") struct _cef_data_base_t* cef_data_base_get_global() {
36648 NO_SANITIZE("cfi-icall") struct _cef_drag_data_t* cef_drag_data_create() {
36651 @@ -1559,6 +1585,12 @@ struct _cef_waitable_event_t* cef_waitable_event_create(
36655 +NO_SANITIZE("cfi-icall")
36661 NO_SANITIZE("cfi-icall")
36664 diff --git a/src/cef/libcef_dll/wrapper_types.h b/src/cef/libcef_dll/wrapper_types.h
36666 --- a/src/cef/libcef_dll/wrapper_types.h
36668 @@ -9,7 +9,7 @@
36672 -// $hash=ec2815ca7044a7ee3ba7f0afcb293a31da5a9feb$
36677 @@ -19,6 +19,7 @@
36685 @@ -28,6 +29,7 @@ enum CefWrapperType {
36693 @@ -45,6 +47,7 @@ enum CefWrapperType {
36701 @@ -66,10 +69,15 @@ enum CefWrapperType {
36717 @@ -94,6 +102,7 @@ enum CefWrapperType {
36725 @@ -120,6 +129,7 @@ enum CefWrapperType {
36733 @@ -129,6 +139,7 @@ enum CefWrapperType {
36741 @@ -166,6 +177,7 @@ enum CefWrapperType {
36749 diff --git a/src/cef/tests/cefclient/browser/client_handler.cc b/src/cef/tests/cefclient/browser/cl…
36751 --- a/src/cef/tests/cefclient/browser/client_handler.cc
36753 @@ -815,6 +815,8 @@ bool ClientHandler::OnSelectClientCertificate(
36762 diff --git a/src/cef/tests/cefclient/browser/client_handler.h b/src/cef/tests/cefclient/browser/cli…
36764 --- a/src/cef/tests/cefclient/browser/client_handler.h
36766 @@ -260,6 +260,8 @@ class ClientHandler : public CefClient,
36775 diff --git a/src/cef/tests/ceftests/os_rendering_unittest.cc b/src/cef/tests/ceftests/os_rendering_…
36777 --- a/src/cef/tests/ceftests/os_rendering_unittest.cc
36779 @@ -1271,7 +1271,8 @@ class OSRTestHandler : public RoutingTestHandler,
36783 - TextInputMode input_mode) override {
36789 diff --git a/src/cef/tools/cef_api_hash.py b/src/cef/tools/cef_api_hash.py
36791 --- a/src/cef/tools/cef_api_hash.py
36793 @@ -35,7 +35,7 @@ class cef_api_hash:
36797 - self.platforms = ["windows", "mac", "linux"]
36802 @@ -49,6 +49,9 @@ class cef_api_hash:
36812 diff --git a/src/cef/tools/make_api_hash_header.py b/src/cef/tools/make_api_hash_header.py
36814 --- a/src/cef/tools/make_api_hash_header.py
36816 @@ -39,6 +39,8 @@ def make_api_hash_header(cpp_header_dir):
36825 diff --git a/src/cef/tools/make_config_header.py b/src/cef/tools/make_config_header.py
36827 --- a/src/cef/tools/make_config_header.py
36829 @@ -21,7 +21,7 @@ def make_config_header(gn_config):
36833 - if not 'ozone_platform_x11=false' in lines:
36838 diff --git a/src/chrome/BUILD.gn b/src/chrome/BUILD.gn
36840 --- a/src/chrome/BUILD.gn
36842 @@ -1706,6 +1706,14 @@ if (is_android) {
36847 + deps -= [
36857 diff --git a/src/chrome/android/BUILD.gn b/src/chrome/android/BUILD.gn
36859 --- a/src/chrome/android/BUILD.gn
36861 @@ -1669,6 +1669,7 @@ android_library("chrome_test_java") {
36862 "//content/test/data/android/webshare-many.html",
36863 "//content/test/data/android/webshare-large.html",
36864 "//content/test/data/android/webshare-long.html",
36865 + "//content/test/data/android/webshare-separator.html",
36869 diff --git a/src/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.jav…
36871 --- a/src/chrome/android/javatests/src/org/chromium/chrome/browser/webshare/WebShareTest.java
36873 @@ -58,6 +58,8 @@ public class WebShareTest {
36874 private static final String TEST_FILE_OGG = "/content/test/data/android/webshare-ogg.html";
36875 private static final String TEST_FILE_MANY = "/content/test/data/android/webshare-many.html";
36876 private static final String TEST_FILE_LARGE = "/content/test/data/android/webshare-large.html";
36878 + "/content/test/data/android/webshare-separator.html";
36879 private static final String TEST_LONG_TEXT = "/content/test/data/android/webshare-long.html";
36882 @@ -209,6 +211,22 @@ public class WebShareTest {
36905 diff --git a/src/chrome/app/chrome_main_delegate.cc b/src/chrome/app/chrome_main_delegate.cc
36907 --- a/src/chrome/app/chrome_main_delegate.cc
36909 @@ -163,7 +163,7 @@
36913 - BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
36918 @@ -363,7 +363,7 @@ void HandleHelpSwitches(const base::CommandLine& command_line) {
36922 -#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
36927 @@ -1168,8 +1168,10 @@ void ChromeMainDelegate::PreSandboxStartup() {
36938 diff --git a/src/chrome/app/chromium_strings.grd b/src/chrome/app/chromium_strings.grd
36940 --- a/src/chrome/app/chromium_strings.grd
36942 @@ -785,7 +785,7 @@ Chromium is unable to recover your settings.
36945 <!-- Enterprise sign-in dialog -->
36946 - <if expr="toolkit_views">
36948 …e title of the dialog to confirm linking the browser profile with the signed-in enterprise account…
36951 diff --git a/src/chrome/app/generated_resources.grd b/src/chrome/app/generated_resources.grd
36953 --- a/src/chrome/app/generated_resources.grd
36955 @@ -401,7 +401,7 @@ are declared in tools/grit/grit_rule.gni.
36959 - <if expr="is_win or desktop_linux or is_fuchsia">
36964 @@ -3067,7 +3067,7 @@ are declared in tools/grit/grit_rule.gni.
36967 <!-- Win certificate selector dialog strings. -->
36968 - <if expr="toolkit_views">
36973 @@ -8362,7 +8362,7 @@ Keep your key file in a safe place. You will need it to create new versions o…
36976 <!-- Accessiblility strings for Infobars in Views -->
36977 - <if expr="toolkit_views">
36982 @@ -9374,7 +9374,7 @@ Please help our engineers fix this problem. Tell us what happened right befor…
36985 <!-- Translate Bubble -->
36986 - <if expr="toolkit_views">
36991 @@ -10650,7 +10650,7 @@ Please help our engineers fix this problem. Tell us what happened right bef…
36995 - <if expr="toolkit_views">
36997 …OURCE_TYPE_THIS_TAB" desc="Text for one of the dialog-tabs on the media picker dialog. This dialog
37000 @@ -10779,7 +10779,7 @@ Please help our engineers fix this problem. Tell us what happened right bef…
37001 …<ph name="WINDOW_TITLE">$1<ex>Google Search</ex></ph> - Permission requested, press ⌘ + Option + U…
37004 - <if expr="is_win or desktop_linux or is_fuchsia">
37006 …Linux or Fuchsia, when a tab has a pending request. Example: 'Google Search - Permission requested…
37007 … <ph name="WINDOW_TITLE">$1<ex>Google Search</ex></ph> - Permission requested, press F6 to respond
37009 @@ -11448,6 +11448,20 @@ Please help our engineers fix this problem. Tell us what happened right be…
37013 + <!-- File System Access dangerous file dialogs. -->
37027 <!-- Relaunch notification bubble and dialog. -->
37030 @@ -11466,7 +11480,7 @@ Please help our engineers fix this problem. Tell us what happened right bef…
37033 <!-- Web-modal dialog shown during Web Authenticaton API requests. -->
37034 - <if expr="is_win or is_macosx or desktop_linux or chromeos or is_fuchsia">
37039 @@ -11736,7 +11750,7 @@ Please help our engineers fix this problem. Tell us what happened right bef…
37042 <!-- WebAuthn strings that are used on both Android and Desktop -->
37043 - <if expr="is_win or is_macosx or desktop_linux or chromeos or is_android or is_fuchsia">
37048 diff --git a/src/chrome/app/generated_resources_grd/IDS_FILE_SYSTEM_ACCESS_DANGEROUS_FILE_DONT_SAVE…
37051 --- /dev/null
37053 @@ -0,0 +1 @@
37056 diff --git a/src/chrome/app/generated_resources_grd/IDS_FILE_SYSTEM_ACCESS_DANGEROUS_FILE_SAVE.png.…
37059 --- /dev/null
37061 @@ -0,0 +1 @@
37064 diff --git a/src/chrome/app/generated_resources_grd/IDS_FILE_SYSTEM_ACCESS_DANGEROUS_FILE_TEXT.png.…
37067 --- /dev/null
37069 @@ -0,0 +1 @@
37072 diff --git a/src/chrome/app/generated_resources_grd/IDS_FILE_SYSTEM_ACCESS_DANGEROUS_FILE_TITLE.png…
37075 --- /dev/null
37077 @@ -0,0 +1 @@
37080 diff --git a/src/chrome/app/google_chrome_strings.grd b/src/chrome/app/google_chrome_strings.grd
37082 --- a/src/chrome/app/google_chrome_strings.grd
37084 @@ -793,7 +793,7 @@ Google Chrome is unable to recover your settings.
37087 <!-- Enterprise sign-in dialog -->
37088 - <if expr="toolkit_views">
37090 …e title of the dialog to confirm linking the browser profile with the signed-in enterprise account…
37093 diff --git a/src/chrome/app/settings_strings.grdp b/src/chrome/app/settings_strings.grdp
37095 --- a/src/chrome/app/settings_strings.grdp
37097 @@ -150,6 +150,11 @@
37109 @@ -1773,6 +1778,9 @@
37119 diff --git a/src/chrome/app/theme/theme_resources.grd b/src/chrome/app/theme/theme_resources.grd
37121 --- a/src/chrome/app/theme/theme_resources.grd
37123 @@ -28,7 +28,7 @@
37125 …mage" name="IDR_ACCESSIBILITY_CAPTIONS_PREVIEW_BACKGROUND" file="common/captions-preview-bg.png" />
37127 - <if expr="toolkit_views and not is_macosx">
37132 @@ -52,7 +52,7 @@
37136 - <if expr="toolkit_views">
37141 diff --git a/src/chrome/browser/BUILD.gn b/src/chrome/browser/BUILD.gn
37143 --- a/src/chrome/browser/BUILD.gn
37145 @@ -1854,6 +1854,14 @@ static_library("browser") {
37150 + sources -= [
37160 @@ -1883,6 +1891,15 @@ static_library("browser") {
37165 + allow_circular_includes_from -= [
37176 @@ -2412,6 +2429,32 @@ static_library("browser") {
37182 + deps -= [
37194 + "//components/safe_browsing/core/browser/db:database_manager",
37209 @@ -3360,6 +3403,18 @@ static_library("browser") {
37215 + sources -= [
37228 @@ -3534,6 +3589,10 @@ static_library("browser") {
37233 + deps -= [ "//components/safe_browsing/core/password_protection:password_protection_metrics_u…
37238 deps -= [ "//components/storage_monitor" ]
37239 @@ -4431,6 +4490,14 @@ static_library("browser") {
37245 + sources -= [
37254 @@ -5525,6 +5592,13 @@ static_library("browser") {
37260 + deps -= [
37268 @@ -5815,6 +5889,20 @@ static_library("browser") {
37289 @@ -5851,7 +5939,7 @@ static_library("browser") {
37293 - if (is_linux || is_chromeos_lacros) {
37298 @@ -5970,7 +6058,7 @@ static_library("browser") {
37302 - if (is_win || is_linux || is_chromeos || is_fuchsia) {
37307 @@ -5990,7 +6078,8 @@ static_library("browser") {
37311 - if (is_win || is_mac || (is_linux || is_chromeos_lacros) || is_fuchsia) {
37317 @@ -6011,7 +6100,7 @@ static_library("browser") {
37321 - if (is_mac || (is_linux || is_chromeos_lacros)) {
37326 @@ -6126,7 +6215,7 @@ static_library("browser") {
37330 - if (is_win || is_mac || is_linux || is_chromeos || is_fuchsia) {
37335 @@ -6295,7 +6384,7 @@ static_library("browser") {
37339 - if (is_linux || is_chromeos) {
37344 @@ -7374,7 +7463,7 @@ grit("resources") {
37348 - if (is_linux || is_chromeos_lacros) {
37353 @@ -7385,7 +7474,7 @@ grit("resources") {
37357 - if (is_win || is_mac || is_linux || is_chromeos || is_fuchsia) {
37362 @@ -7581,6 +7670,11 @@ static_library("test_support") {
37368 + public_deps -= [ "//chrome/browser/safe_browsing:test_support" ]
37374 @@ -7629,6 +7723,13 @@ static_library("test_support") {
37379 + deps -= [
37388 @@ -7813,6 +7914,10 @@ static_library("test_support") {
37393 + deps -= [ "//components/safe_browsing/core/browser/db:v4_test_util" ]
37399 diff --git a/src/chrome/browser/accuracy_tips/accuracy_service_factory.cc b/src/chrome/browser/accu…
37401 --- a/src/chrome/browser/accuracy_tips/accuracy_service_factory.cc
37403 @@ -48,10 +48,14 @@ KeyedService* AccuracyServiceFactory::BuildServiceInstanceFor(
37411 g_browser_process->safe_browsing_service()
37412 ? g_browser_process->safe_browsing_service()->database_manager()
37418 diff --git a/src/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/src/chrome/br…
37420 --- a/src/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
37422 @@ -1490,6 +1490,38 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, MAYBE_KeyboardFocusWindowCycl…
37436 + GetGuestViewManager()->WaitForSingleGuestCreated()->GetMainFrame();
37461 diff --git a/src/chrome/browser/apps/platform_apps/api/music_manager_private/BUILD.gn b/src/chrome/…
37463 --- a/src/chrome/browser/apps/platform_apps/api/music_manager_private/BUILD.gn
37465 @@ -33,7 +33,7 @@ source_set("music_manager_private") {
37469 - } else if (is_linux || is_chromeos_lacros) {
37474 diff --git a/src/chrome/browser/apps/platform_apps/api/music_manager_private/device_id_linux.cc b/s…
37476 --- a/src/chrome/browser/apps/platform_apps/api/music_manager_private/device_id_linux.cc
37478 @@ -41,9 +41,11 @@ const char* const kDeviceNames[] = {
37480 // "em" prefix and PCI cards use the p[0-9]c[0-9] format based on PCI
37490 @@ -152,7 +154,7 @@ class MacAddressProcessor {
37494 -
37499 @@ -169,6 +171,10 @@ std::string GetMacAddress(IsValidMacAddressCallback is_valid_mac_address) {
37510 diff --git a/src/chrome/browser/browser_process.h b/src/chrome/browser/browser_process.h
37512 --- a/src/chrome/browser/browser_process.h
37514 @@ -20,6 +20,7 @@
37522 @@ -213,8 +214,10 @@ class BrowserProcess {
37533 diff --git a/src/chrome/browser/browser_process_impl.cc b/src/chrome/browser/browser_process_impl.cc
37535 --- a/src/chrome/browser/browser_process_impl.cc
37537 @@ -394,8 +394,10 @@ void BrowserProcessImpl::StartTearDown() {
37543 safe_browsing_service()->ShutDown();
37548 @@ -1016,6 +1018,7 @@ StatusTray* BrowserProcessImpl::status_tray() {
37556 @@ -1023,6 +1026,7 @@ BrowserProcessImpl::safe_browsing_service() {
37564 @@ -1276,6 +1280,7 @@ void BrowserProcessImpl::CreateBackgroundPrintingManager() {
37572 @@ -1295,6 +1300,7 @@ void BrowserProcessImpl::CreateSafeBrowsingService() {
37574 safe_browsing_service_->Initialize();
37580 diff --git a/src/chrome/browser/browser_process_impl.h b/src/chrome/browser/browser_process_impl.h
37582 --- a/src/chrome/browser/browser_process_impl.h
37584 @@ -28,6 +28,7 @@
37592 @@ -189,7 +190,9 @@ class BrowserProcessImpl : public BrowserProcess,
37602 @@ -241,7 +244,9 @@ class BrowserProcessImpl : public BrowserProcess,
37612 @@ -338,9 +343,10 @@ class BrowserProcessImpl : public BrowserProcess,
37616 -
37624 diff --git a/src/chrome/browser/browser_resources.grd b/src/chrome/browser/browser_resources.grd
37626 --- a/src/chrome/browser/browser_resources.grd
37628 @@ -24,7 +24,7 @@
37632 - <if expr="is_win or is_macosx or desktop_linux or chromeos or is_fuchsia">
37637 @@ -129,7 +129,7 @@
37641 - <if expr="desktop_linux">
37645 …<include name="IDR_URL_MOJOM_LITE_JS" file="${root_gen_dir}\url\mojom\url.mojom-lite.js" use_base_…
37646 diff --git a/src/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/src/chrome…
37648 --- a/src/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
37650 @@ -631,6 +631,7 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
37657 g_browser_process->safe_browsing_service();
37658 @@ -645,7 +646,7 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData(
37662 -
37664 if (filter_builder->GetMode() ==
37667 diff --git a/src/chrome/browser/chrome_browser_main_linux.cc b/src/chrome/browser/chrome_browser_ma…
37669 --- a/src/chrome/browser/chrome_browser_main_linux.cc
37671 @@ -57,7 +57,8 @@ ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() {
37675 -#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
37678 // No-op: Ash and Lacros Bluetooth DBusManager initialization depend on
37681 @@ -122,7 +123,8 @@ void ChromeBrowserMainPartsLinux::PostBrowserStart() {
37685 -#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS)
37688 // No-op; per PostBrowserStart() comment, this is done elsewhere.
37691 diff --git a/src/chrome/browser/chrome_content_browser_client.cc b/src/chrome/browser/chrome_conten…
37693 --- a/src/chrome/browser/chrome_content_browser_client.cc
37695 @@ -448,7 +448,7 @@
37699 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
37704 @@ -518,6 +518,7 @@
37712 @@ -949,9 +950,14 @@ class CertificateReportingServiceCertReporter : public SSLCertReporter {
37718 - web_contents->GetBrowserContext())) {}
37719 -
37720 + web_contents->GetBrowserContext())) {
37729 @@ -962,11 +968,15 @@ class CertificateReportingServiceCertReporter : public SSLCertReporter {
37734 service_->Send(serialized_report);
37745 @@ -1460,7 +1470,9 @@ void ChromeContentBrowserClient::PostAfterStartupTask(
37750 safe_browsing_service_ = g_browser_process->safe_browsing_service();
37755 @@ -4277,6 +4289,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
37758 // g_browser_process->safe_browsing_service() may be null in unittests.
37761 g_browser_process->safe_browsing_service()
37762 ? g_browser_process->safe_browsing_service()->ui_manager().get()
37763 @@ -4285,12 +4298,15 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
37778 // of lacros-chrome is complete.
37779 @@ -5724,6 +5740,7 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
37787 @@ -5744,6 +5761,9 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
37797 @@ -5755,7 +5775,7 @@ ChromeContentBrowserClient::GetUrlLookupService(
37801 -
37806 @@ -5763,12 +5783,14 @@ ChromeContentBrowserClient::GetUrlLookupService(
37810 -#endif
37822 @@ -6045,11 +6067,16 @@ bool ChromeContentBrowserClient::IsClipboardPasteAllowed(
37828 + ->HasRecentInteractiveInputEvent()) {
37833 const GURL& url = render_frame_host->GetLastCommittedOrigin().GetURL();
37835 render_frame_host->GetBrowserContext();
37836 - Profile* profile = Profile::FromBrowserContext(browser_context);
37837 - DCHECK(profile);
37840 browser_context->GetPermissionController();
37841 @@ -6057,34 +6084,37 @@ bool ChromeContentBrowserClient::IsClipboardPasteAllowed(
37842 permission_controller->GetPermissionStatusForFrame(
37848 - // True if this paste is executed from an extension URL with read permission.
37849 - bool is_extension_paste_allowed = false;
37850 - // True if any active extension can use content scripts to read on this page.
37851 - bool is_content_script_paste_allowed = false;
37853 - // TODO(https://crbug.com/982361): Provide proper browser-side content script
37854 - // tracking below, possibly based on hooks like those in
37855 - // URLLoaderFactoryManager's WillExecuteCode() and ReadyToCommitNavigation().
37856 - // Until this is implemented, platforms supporting extensions (all platforms
37857 - // except Android) will essentially no-op here and return true.
37858 - is_content_script_paste_allowed = true;
37864 - auto* process_map = extensions::ProcessMap::Get(profile);
37865 - auto* registry = extensions::ExtensionRegistry::Get(profile);
37866 - is_extension_paste_allowed = URLHasExtensionPermission(
37867 - process_map, registry, url, render_frame_host->GetProcess()->GetID(),
37868 - APIPermissionID::kClipboardRead);
37871 + render_frame_host->GetProcess()->GetID(),
37879 + *render_frame_host->GetProcess());
37882 + registry->enabled_extensions().GetByID(extension_id);
37883 + if (extension && extension->permissions_data()->HasAPIPermission(
37889 - if (!is_extension_paste_allowed && !is_content_script_paste_allowed &&
37890 - !render_frame_host->HasTransientUserActivation() &&
37891 - status != blink::mojom::PermissionStatus::GRANTED) {
37892 - // Paste requires either (1) origination from a chrome extension, (2) user
37893 - // activation, or (3) granted web permission.
37894 - return false;
37895 - }
37896 - return true;
37902 diff --git a/src/chrome/browser/chrome_content_browser_client_receiver_bindings.cc b/src/chrome/bro…
37904 --- a/src/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
37906 @@ -132,6 +132,7 @@
37914 @@ -144,6 +145,7 @@ void MaybeCreateSafeBrowsingForRenderer(
37922 @@ -183,8 +185,9 @@ void MaybeCreateSafeBrowsingForRenderer(
37928 -
37933 @@ -238,6 +241,7 @@ void ChromeContentBrowserClient::ExposeInterfacesToRenderer(
37936 render_process_host->GetBrowserContext()->GetResourceContext();
37938 registry->AddInterface(
37940 &MaybeCreateSafeBrowsingForRenderer, render_process_host->GetID(),
37941 @@ -246,6 +250,7 @@ void ChromeContentBrowserClient::ExposeInterfacesToRenderer(
37949 diff --git a/src/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc b/s…
37951 --- a/src/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc
37953 @@ -32,6 +32,7 @@
37958 #include "testing/gmock/include/gmock/gmock-matchers.h"
37961 @@ -645,11 +646,8 @@ IN_PROC_BROWSER_TEST_F(DataTransferDlpBlinkBrowserTest, MAYBE_ProceedOnWarn) {
37965 - content::UpdateUserActivationStateInterceptor user_activation_interceptor(
37966 - GetActiveWebContents()->GetMainFrame());
37967 - user_activation_interceptor.UpdateUserActivationState(
37968 - blink::mojom::UserActivationUpdateType::kNotifyActivation,
37969 - blink::mojom::UserActivationNotificationType::kTest);
37975 @@ -738,12 +736,8 @@ IN_PROC_BROWSER_TEST_F(DataTransferDlpBlinkBrowserTest, MAYBE_CancelWarn) {
37979 -
37980 - content::UpdateUserActivationStateInterceptor user_activation_interceptor(
37981 - GetActiveWebContents()->GetMainFrame());
37982 - user_activation_interceptor.UpdateUserActivationState(
37983 - blink::mojom::UserActivationUpdateType::kNotifyActivation,
37984 - blink::mojom::UserActivationNotificationType::kTest);
37990 @@ -830,11 +824,8 @@ IN_PROC_BROWSER_TEST_F(DataTransferDlpBlinkBrowserTest,
37994 - content::UpdateUserActivationStateInterceptor user_activation_interceptor(
37995 - GetActiveWebContents()->GetMainFrame());
37996 - user_activation_interceptor.UpdateUserActivationState(
37997 - blink::mojom::UserActivationUpdateType::kNotifyActivation,
37998 - blink::mojom::UserActivationNotificationType::kTest);
38002 dlp_controller_->force_paste_on_warn_ = true;
38003 GetActiveWebContents()->Paste();
38004 @@ -910,11 +901,8 @@ IN_PROC_BROWSER_TEST_F(DataTransferDlpBlinkBrowserTest, DISABLED_Reporting) {
38008 - content::UpdateUserActivationStateInterceptor user_activation_interceptor(
38009 - GetActiveWebContents()->GetMainFrame());
38010 - user_activation_interceptor.UpdateUserActivationState(
38011 - blink::mojom::UserActivationUpdateType::kNotifyActivation,
38012 - blink::mojom::UserActivationNotificationType::kTest);
38016 GetActiveWebContents()->Paste();
38017 EXPECT_FALSE(dlp_controller_->ObserveWidget());
38018 diff --git a/src/chrome/browser/component_updater/file_type_policies_component_installer.cc b/src/c…
38020 --- a/src/chrome/browser/component_updater/file_type_policies_component_installer.cc
38022 @@ -20,6 +20,7 @@
38030 @@ -52,8 +53,10 @@ void LoadFileTypesFromDisk(const base::FilePath& pb_path) {
38035 safe_browsing::FileTypePolicies::GetInstance()->PopulateFromDynamicUpdate(
38041 diff --git a/src/chrome/browser/component_updater/registration.cc b/src/chrome/browser/component_up…
38043 --- a/src/chrome/browser/component_updater/registration.cc
38045 @@ -200,7 +200,9 @@ void RegisterComponentsForUpdate() {
38055 diff --git a/src/chrome/browser/device_api/managed_configuration_api.cc b/src/chrome/browser/device…
38057 --- a/src/chrome/browser/device_api/managed_configuration_api.cc
38059 @@ -4,12 +4,16 @@
38076 @@ -116,9 +120,7 @@ class ManagedConfigurationAPI::ManagedConfigurationDownloader {
38080 - profile->GetPath().AppendASCII(kManagedConfigurationDirectoryName)),
38081 - backend_task_runner_(base::ThreadPool::CreateSequencedTaskRunner(
38082 - {base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})) {
38083 + profile->GetPath().AppendASCII(kManagedConfigurationDirectoryName)) {
38085 pref_change_registrar_->Init(profile_->GetPrefs());
38086 pref_change_registrar_->Add(
38087 @@ -146,16 +148,21 @@ void ManagedConfigurationAPI::GetOriginPolicyConfiguration(
38091 - backend_task_runner_->PostTaskAndReplyWithResult(
38092 - FROM_HERE,
38093 - base::BindOnce(&ManagedConfigurationAPI::GetConfigurationOnBackend,
38094 - base::Unretained(this), origin, keys),
38095 - std::move(callback));
38107 - if (CanHaveManagedStore(observer->GetOrigin())) {
38108 - GetOrLoadStoreForOrigin(observer->GetOrigin())->AddObserver(observer);
38109 + url::Origin origin = observer->GetOrigin();
38116 @@ -168,7 +175,7 @@ void ManagedConfigurationAPI::RemoveObserver(Observer* observer) {
38120 - GetOrLoadStoreForOrigin(observer->GetOrigin())->RemoveObserver(observer);
38121 + observers_[observer->GetOrigin()].RemoveObserver(observer);
38125 @@ -217,37 +224,17 @@ void ManagedConfigurationAPI::OnConfigurationPolicyChanged() {
38129 -ManagedConfigurationStore* ManagedConfigurationAPI::GetOrLoadStoreForOrigin(
38132 - auto it = store_map_.find(origin);
38133 - if (it != store_map_.end())
38134 - return it->second.get();
38140 - auto store = std::make_unique<ManagedConfigurationStore>(
38141 - backend_task_runner_, origin, GetStoreLocation(origin));
38142 - ManagedConfigurationStore* store_ptr = store.get();
38143 - store_map_[origin] = std::move(store);
38144 - return store_ptr;
38145 -}
38146 -
38147 -std::unique_ptr<base::DictionaryValue>
38148 -ManagedConfigurationAPI::GetConfigurationOnBackend(
38149 - const url::Origin& origin,
38150 - const std::vector<std::string>& keys) {
38151 - // If there was no policy set for this origin, there is no reason to create
38152 - // or load a store.
38153 - if (!base::Contains(store_map_, origin))
38154 - return nullptr;
38155 -
38156 - value_store::LeveldbValueStore::ReadResult result =
38157 - store_map_[origin]->Get(keys);
38158 - if (!result.status().ok())
38159 - return nullptr;
38160 -
38161 - auto dict = std::make_unique<base::DictionaryValue>();
38162 - dict->Swap(&result.settings());
38163 - return dict;
38171 @@ -334,17 +321,24 @@ void ManagedConfigurationAPI::ProcessDecodedConfiguration(
38175 - // Safe to use unretained here, since we own the task runner.
38176 - backend_task_runner_->PostTask(
38177 - FROM_HERE,
38178 - base::BindOnce(&ManagedConfigurationAPI::StoreConfigurationOnBackend,
38179 - base::Unretained(this), origin, std::move(configuration)));
38189 -void ManagedConfigurationAPI::StoreConfigurationOnBackend(
38192 - base::DictionaryValue configuration) {
38193 - GetOrLoadStoreForOrigin(origin)->SetCurrentPolicy(configuration);
38204 diff --git a/src/chrome/browser/device_api/managed_configuration_api.h b/src/chrome/browser/device_…
38206 --- a/src/chrome/browser/device_api/managed_configuration_api.h
38208 @@ -8,7 +8,8 @@
38212 -#include "base/observer_list_types.h"
38218 @@ -83,14 +84,10 @@ class ManagedConfigurationAPI : public KeyedService {
38225 - std::unique_ptr<base::DictionaryValue> GetConfigurationOnBackend(
38226 - const url::Origin& origin,
38227 - const std::vector<std::string>& keys);
38228 - void StoreConfigurationOnBackend(const url::Origin& origin,
38229 - base::DictionaryValue configuration);
38230 -
38231 - ManagedConfigurationStore* GetOrLoadStoreForOrigin(const url::Origin& origin);
38236 @@ -103,10 +100,12 @@ class ManagedConfigurationAPI : public KeyedService {
38240 - std::map<url::Origin, std::unique_ptr<ManagedConfigurationStore>> store_map_;
38250 @@ -114,9 +113,6 @@ class ManagedConfigurationAPI : public KeyedService {
38254 - // Blocking task runner for IO related tasks.
38255 - scoped_refptr<base::SequencedTaskRunner> backend_task_runner_;
38256 -
38260 diff --git a/src/chrome/browser/device_api/managed_configuration_store.cc b/src/chrome/browser/devi…
38262 --- a/src/chrome/browser/device_api/managed_configuration_store.cc
38264 @@ -4,44 +4,24 @@
38268 -ManagedConfigurationStore::ManagedConfigurationStore(
38269 - scoped_refptr<base::SequencedTaskRunner> backend_sequence,
38270 - const url::Origin& origin,
38271 - const base::FilePath& path)
38272 - : backend_sequence_(backend_sequence),
38273 - origin_(origin),
38274 - path_(path),
38275 - observers_(new base::ObserverListThreadSafe<
38276 - ManagedConfigurationAPI::Observer>()) {}
38279 -void ManagedConfigurationStore::InitializeOnBackend() {
38288 - DCHECK(backend_sequence_->RunsTasksInCurrentSequence());
38293 -ManagedConfigurationStore::~ManagedConfigurationStore() {
38294 - // Delete ValueStore on the FILE thread, since it can only operate on that
38295 - // thread.
38296 - backend_sequence_->DeleteSoon(FROM_HERE, std::move(store_));
38297 -}
38298 -
38299 -void ManagedConfigurationStore::AddObserver(
38300 - ManagedConfigurationAPI::Observer* observer) {
38301 - observers_->AddObserver(observer);
38302 -}
38303 -
38304 -void ManagedConfigurationStore::RemoveObserver(
38305 - ManagedConfigurationAPI::Observer* observer) {
38306 - observers_->RemoveObserver(observer);
38307 -}
38308 -
38309 -void ManagedConfigurationStore::SetCurrentPolicy(
38312 - DCHECK(backend_sequence_->RunsTasksInCurrentSequence());
38314 - InitializeOnBackend();
38318 value_store::ValueStore::ReadResult read_result = store_->Get();
38319 @@ -79,17 +59,18 @@ void ManagedConfigurationStore::SetCurrentPolicy(
38323 - if (!store_updated)
38324 - return;
38325 - observers_->Notify(
38326 - FROM_HERE,
38327 - &ManagedConfigurationAPI::Observer::OnManagedConfigurationChanged);
38331 -value_store::ValueStore::ReadResult ManagedConfigurationStore::Get(
38334 - DCHECK(backend_sequence_->RunsTasksInCurrentSequence());
38336 - InitializeOnBackend();
38337 - return store_->Get(keys);
38340 + auto result = store_->Get(keys);
38347 diff --git a/src/chrome/browser/device_api/managed_configuration_store.h b/src/chrome/browser/devic…
38349 --- a/src/chrome/browser/device_api/managed_configuration_store.h
38351 @@ -6,47 +6,35 @@
38355 -#include "base/observer_list_threadsafe.h"
38356 -#include "chrome/browser/device_api/managed_configuration_api.h"
38361 -namespace base {
38362 -class SequencedTaskRunner;
38363 -}
38364 -
38365 -// Class responsible for internal storage of the managed configuration. Adding
38366 -// and removing observers is allowed on any thread, while setting/getting the
38367 -// data is only allowed on the FILE thread.
38376 - ManagedConfigurationStore(
38377 - scoped_refptr<base::SequencedTaskRunner> backend_sequence,
38378 - const url::Origin& origin,
38379 - const base::FilePath& path);
38384 - // Initializes connection to the database. Must be called on
38385 - // |backend_sequence_|.
38386 - void InitializeOnBackend();
38387 -
38388 - void AddObserver(ManagedConfigurationAPI::Observer* observer);
38389 - void RemoveObserver(ManagedConfigurationAPI::Observer* observer);
38390 -
38391 - // Read/Write operations must be called on |backend_sequence_|.
38392 - void SetCurrentPolicy(const base::DictionaryValue& current_configuration);
38393 - value_store::ValueStore::ReadResult Get(const std::vector<std::string>& keys);
38401 - scoped_refptr<base::SequencedTaskRunner> backend_sequence_;
38408 - scoped_refptr<base::ObserverListThreadSafe<ManagedConfigurationAPI::Observer>>
38409 - observers_;
38413 diff --git a/src/chrome/browser/devtools/devtools_window.cc b/src/chrome/browser/devtools/devtools_…
38415 --- a/src/chrome/browser/devtools/devtools_window.cc
38417 @@ -1607,8 +1607,10 @@ void DevToolsWindow::ShowCertificateViewer(const std::string& cert_chain) {
38422 gfx::NativeWindow parent = browser->window()->GetNativeWindow();
38428 diff --git a/src/chrome/browser/download/chrome_download_manager_delegate.cc b/src/chrome/browser/d…
38430 --- a/src/chrome/browser/download/chrome_download_manager_delegate.cc
38432 @@ -93,6 +93,9 @@
38442 @@ -134,7 +137,11 @@ using content::DownloadManager;
38454 @@ -436,12 +443,14 @@ ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
38460 g_browser_process->safe_browsing_service();
38461 if (sb_service && !profile_->IsOffTheRecord()) {
38463 sb_service->AddDownloadManager(dm);
38469 @@ -790,13 +799,14 @@ void ChromeDownloadManagerDelegate::ChooseSavePath(
38477 if (file_type_policies->GetFileDangerLevel(*filename) ==
38480 -
38484 *filename = filename->AddExtension(default_filename.BaseName().value());
38485 @@ -1544,7 +1554,9 @@ void ChromeDownloadManagerDelegate::OnDownloadTargetDetermined(
38490 DownloadItemModel(item).SetDangerLevel(target_info->danger_level);
38493 if (ShouldBlockFile(target_info->danger_type, item)) {
38495 @@ -1696,7 +1708,6 @@ void ChromeDownloadManagerDelegate::MaybeSendDangerousDownloadOpenedReport(
38496 service->MaybeSendDangerousDownloadOpenedReport(download,
38499 -#endif
38500 if (!download->GetAutoOpened()) {
38502 download::DownloadContentFromMimeType(download->GetMimeType(), false);
38503 @@ -1704,6 +1715,7 @@ void ChromeDownloadManagerDelegate::MaybeSendDangerousDownloadOpenedReport(
38504 download->GetDangerType(), download_content, base::Time::Now(),
38505 download->GetEndTime(), show_download_in_folder);
38511 diff --git a/src/chrome/browser/download/download_commands.cc b/src/chrome/browser/download/downloa…
38513 --- a/src/chrome/browser/download/download_commands.cc
38515 @@ -27,7 +27,7 @@
38519 - BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA)
38524 @@ -168,7 +168,7 @@ void DownloadCommands::ExecuteCommand(Command command) {
38528 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
38533 diff --git a/src/chrome/browser/download/download_commands.h b/src/chrome/browser/download/download…
38535 --- a/src/chrome/browser/download/download_commands.h
38537 @@ -54,7 +54,7 @@ class DownloadCommands {
38541 - BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA)
38546 diff --git a/src/chrome/browser/download/download_danger_prompt.cc b/src/chrome/browser/download/do…
38548 --- a/src/chrome/browser/download/download_danger_prompt.cc
38550 @@ -24,7 +24,7 @@ using safe_browsing::ClientDownloadResponse;
38554 -
38559 @@ -73,9 +73,11 @@ const char* GetDangerTypeString(
38571 @@ -118,10 +120,12 @@ void DownloadDangerPrompt::SendSafeBrowsingDownloadReport(
38582 safe_browsing::FileTypePolicies::GetInstance()->UmaValueForFile(
38584 @@ -137,4 +141,5 @@ void DownloadDangerPrompt::RecordDownloadDangerPrompt(
38590 diff --git a/src/chrome/browser/download/download_danger_prompt.h b/src/chrome/browser/download/dow…
38592 --- a/src/chrome/browser/download/download_danger_prompt.h
38594 @@ -6,6 +6,7 @@
38602 @@ -53,6 +54,7 @@ class DownloadDangerPrompt {
38610 @@ -63,6 +65,7 @@ class DownloadDangerPrompt {
38618 diff --git a/src/chrome/browser/download/download_item_model.cc b/src/chrome/browser/download/downl…
38620 --- a/src/chrome/browser/download/download_item_model.cc
38622 @@ -596,6 +596,7 @@ bool DownloadItemModel::IsCommandEnabled(
38623 return download_->CanOpenDownload() &&
38630 @@ -604,6 +605,10 @@ bool DownloadItemModel::IsCommandEnabled(
38631 ->IsAllowedToOpenAutomatically(
38632 download_->GetTargetFilePath()) &&
38635 + return download_->CanOpenDownload() &&
38639 return !download_->IsSavePackageDownload() &&
38641 @@ -789,6 +794,7 @@ void DownloadItemModel::ExecuteCommand(DownloadCommands* download_commands,
38647 g_browser_process->safe_browsing_service();
38649 @@ -814,6 +820,7 @@ void DownloadItemModel::ExecuteCommand(DownloadCommands* download_commands,
38657 diff --git a/src/chrome/browser/download/download_prefs.cc b/src/chrome/browser/download/download_p…
38659 --- a/src/chrome/browser/download/download_prefs.cc
38661 @@ -75,14 +75,14 @@ namespace {
38665 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
38673 -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
38678 @@ -256,6 +256,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) {
38686 @@ -264,6 +265,7 @@ DownloadPrefs::DownloadPrefs(Profile* profile) : profile_(profile) {
38694 @@ -476,11 +478,12 @@ bool DownloadPrefs::IsAutoOpenByPolicy(const GURL& url,
38699 if (!FileTypePolicies::GetInstance()->IsAllowedToOpenAutomatically(
38703 -
38708 diff --git a/src/chrome/browser/download/download_stats.cc b/src/chrome/browser/download/download_s…
38710 --- a/src/chrome/browser/download/download_stats.cc
38712 @@ -9,6 +9,7 @@
38720 @@ -26,10 +27,12 @@ void RecordDangerousDownloadWarningShown(
38733 diff --git a/src/chrome/browser/download/download_target_determiner.cc b/src/chrome/browser/downloa…
38735 --- a/src/chrome/browser/download/download_target_determiner.cc
38737 @@ -297,14 +297,14 @@ base::FilePath DownloadTargetDeterminer::GenerateFileName() const {
38739 download_->GetURL(), download_->GetContentDisposition(), referrer_charset,
38741 -
38745 if (safe_browsing::FileTypePolicies::GetInstance()->IsCheckedBinaryFile(
38749 -
38754 @@ -1114,9 +1114,12 @@ DownloadFileType::DangerLevel DownloadTargetDeterminer::GetDangerLevel(
38755 download_->HasUserGesture())
38758 - DownloadFileType::DangerLevel danger_level =
38762 safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel(
38768 diff --git a/src/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc b/src/c…
38770 --- a/src/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc
38772 @@ -33,13 +33,17 @@
38790 @@ -129,6 +133,7 @@ bool* UIEnabledStorage() {
38798 @@ -140,7 +145,7 @@ safe_browsing::EventResult CalculateEventResult(
38802 -
38807 @@ -173,6 +178,7 @@ void ContentAnalysisDelegate::BypassWarnings(
38815 @@ -198,6 +204,7 @@ void ContentAnalysisDelegate::BypassWarnings(
38823 @@ -208,6 +215,7 @@ void ContentAnalysisDelegate::Cancel(bool warning) {
38831 @@ -215,6 +223,7 @@ void ContentAnalysisDelegate::Cancel(bool warning) {
38832 base::TimeTicks::Now() - upload_start_time_, 0,
38839 @@ -395,8 +404,12 @@ ContentAnalysisDelegate::ContentAnalysisDelegate(
38843 - callback_(std::move(callback)),
38844 - access_point_(access_point) {
38852 profile_ = Profile::FromBrowserContext(web_contents->GetBrowserContext());
38853 url_ = web_contents->GetLastCommittedURL();
38854 @@ -412,9 +425,11 @@ void ContentAnalysisDelegate::StringRequestCallback(
38860 base::TimeTicks::Now() - upload_start_time_,
38866 @@ -428,11 +443,13 @@ void ContentAnalysisDelegate::StringRequestCallback(
38880 @@ -458,11 +475,11 @@ void ContentAnalysisDelegate::FileRequestCallback(
38884 -
38887 base::TimeTicks::Now() - upload_start_time_,
38889 -
38894 @@ -470,13 +487,14 @@ void ContentAnalysisDelegate::FileRequestCallback(
38905 -
38910 @@ -502,9 +520,11 @@ void ContentAnalysisDelegate::FileRequestCallback(
38916 base::TimeTicks::Now() - upload_start_time_,
38922 @@ -541,8 +561,10 @@ bool ContentAnalysisDelegate::UploadData() {
38933 @@ -567,7 +589,7 @@ bool ContentAnalysisDelegate::UploadData() {
38937 -
38942 @@ -615,6 +637,7 @@ void ContentAnalysisDelegate::PreparePageRequest() {
38950 @@ -654,7 +677,11 @@ void ContentAnalysisDelegate::FillAllResultsWith(bool status) {
38962 diff --git a/src/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.h b/src/ch…
38964 --- a/src/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.h
38966 @@ -26,6 +26,7 @@
38974 @@ -257,6 +258,7 @@ class ContentAnalysisDelegate : public ContentAnalysisDelegateBase {
38982 @@ -264,7 +266,7 @@ class ContentAnalysisDelegate : public ContentAnalysisDelegateBase {
38986 -
38991 @@ -347,8 +349,10 @@ class ContentAnalysisDelegate : public ContentAnalysisDelegateBase {
39002 @@ -370,9 +374,10 @@ class ContentAnalysisDelegate : public ContentAnalysisDelegateBase {
39009 -
39014 diff --git a/src/chrome/browser/enterprise/connectors/connectors_service.cc b/src/chrome/browser/en…
39016 --- a/src/chrome/browser/enterprise/connectors/connectors_service.cc
39018 @@ -460,6 +460,7 @@ absl::optional<std::string> ConnectorsService::GetDMTokenForRealTimeUrlCheck()
39026 @@ -472,6 +473,7 @@ ConnectorsService::GetAppliedRealTimeUrlCheck() const {
39027 Profile::FromBrowserContext(context_)->GetPrefs()->GetInteger(
39034 diff --git a/src/chrome/browser/enterprise/connectors/connectors_service.h b/src/chrome/browser/ent…
39036 --- a/src/chrome/browser/enterprise/connectors/connectors_service.h
39038 @@ -15,7 +15,12 @@
39051 @@ -80,11 +85,13 @@ class ConnectorsService : public KeyedService {
39056 // Returns the value to used by the enterprise real-time URL check Connector
39057 // if it is set and if the scope it's set at has a valid browser-profile
39065 diff --git a/src/chrome/browser/enterprise/signals/context_info_fetcher.cc b/src/chrome/browser/ent…
39067 --- a/src/chrome/browser/enterprise/signals/context_info_fetcher.cc
39069 @@ -204,7 +204,9 @@ void ContextInfoFetcher::Fetch(ContextInfoCallback callback) {
39079 @@ -219,11 +221,13 @@ void ContextInfoFetcher::Fetch(ContextInfoCallback callback) {
39081 utils::GetThirdPartyBlockingEnabled(g_browser_process->local_state());
39086 utils::GetSafeBrowsingProtectionLevel(profile->GetPrefs());
39088 utils::GetPasswordProtectionWarningTrigger(profile->GetPrefs());
39093 @@ -262,10 +266,12 @@ std::vector<std::string> ContextInfoFetcher::GetAnalysisConnectorProviders(
39094 return connectors_service_->GetAnalysisServiceProviderNames(connector);
39100 return connectors_service_->GetAppliedRealTimeUrlCheck();
39105 return connectors_service_->GetReportingServiceProviderNames(
39106 @@ -299,7 +305,7 @@ ScopedUfwConfigPathForTesting::~ScopedUfwConfigPathForTesting() {
39110 -#if BUILDFLAG(IS_POSIX)
39115 diff --git a/src/chrome/browser/enterprise/signals/context_info_fetcher.h b/src/chrome/browser/ente…
39117 --- a/src/chrome/browser/enterprise/signals/context_info_fetcher.h
39119 @@ -5,6 +5,7 @@
39127 @@ -12,7 +13,10 @@
39138 @@ -38,13 +42,19 @@ struct ContextInfo {
39158 @@ -89,7 +99,9 @@ class ContextInfoFetcher {
39168 diff --git a/src/chrome/browser/error_reporting/BUILD.gn b/src/chrome/browser/error_reporting/BUILD…
39170 --- a/src/chrome/browser/error_reporting/BUILD.gn
39172 @@ -5,7 +5,7 @@ import("//build/config/chromeos/ui_mode.gni")
39175 # thunking issues. Fix & re-enable.
39176 -assert(is_linux || is_chromeos_ash || is_chromeos_lacros)
39181 diff --git a/src/chrome/browser/extensions/BUILD.gn b/src/chrome/browser/extensions/BUILD.gn
39183 --- a/src/chrome/browser/extensions/BUILD.gn
39185 @@ -784,6 +784,7 @@ static_library("extensions") {
39193 @@ -1205,7 +1206,7 @@ static_library("extensions") {
39197 - if (is_linux) {
39202 @@ -1317,7 +1318,7 @@ static_library("extensions") {
39206 - if (toolkit_views) {
39211 diff --git a/src/chrome/browser/extensions/api/debugger/debugger_api.cc b/src/chrome/browser/extens…
39213 --- a/src/chrome/browser/extensions/api/debugger/debugger_api.cc
39215 @@ -37,9 +37,11 @@
39227 @@ -48,6 +50,9 @@
39237 @@ -131,6 +136,14 @@ bool ExtensionMayAttachToWebContents(const Extension& extension,
39245 + security_interstitial_tab_helper->IsDisplayingInterstitial()) {
39251 // web_contents.GetMainFrame()->GetLastCommittedURL(), with the
39252 @@ -140,6 +153,13 @@ bool ExtensionMayAttachToWebContents(const Extension& extension,
39258 + extension, web_contents.GetController().GetPendingEntry()->GetURL(),
39264 web_contents.GetMainFrame()->ForEachRenderFrameHost(base::BindRepeating(
39266 @@ -660,7 +680,7 @@ ExtensionFunction::ResponseAction DebuggerSendCommandFunction::Run() {
39269 client_host_->SendMessageToBackend(this, params->method,
39270 - params->command_params.get());
39271 + params->command_params.get());
39275 @@ -714,8 +734,7 @@ base::Value SerializeTarget(scoped_refptr<DevToolsAgentHost> host) {
39276 std::string type = host->GetType();
39279 - int tab_id =
39280 - extensions::ExtensionTabUtil::GetTabId(host->GetWebContents());
39281 + int tab_id = extensions::ExtensionTabUtil::GetTabId(host->GetWebContents());
39285 diff --git a/src/chrome/browser/extensions/api/debugger/debugger_apitest.cc b/src/chrome/browser/ex…
39287 --- a/src/chrome/browser/extensions/api/debugger/debugger_apitest.cc
39289 @@ -30,6 +30,11 @@
39301 @@ -57,6 +62,9 @@ class DebuggerApiTest : public ExtensionApiTest {
39311 @@ -104,9 +112,13 @@ void DebuggerApiTest::SetUpOnMainThread() {
39315 - content::WebContents* web_contents =
39316 - browser()->tab_strip_model()->GetActiveWebContents();
39317 + return RunAttachFunction(browser()->tab_strip_model()->GetActiveWebContents(),
39327 @@ -217,6 +229,59 @@ IN_PROC_BROWSER_TEST_F(DebuggerApiTest,
39366 + browser()->tab_strip_model()->GetActiveWebContents();
39369 + GURL("https://google.com/"), web_contents->GetMainFrame());
39370 + navigation_handle->set_has_committed(true);
39371 + navigation_handle->set_is_same_document(false);
39379 + ->DidFinishNavigation(navigation_handle.get());
39386 browser()->tab_strip_model()->GetActiveWebContents())
39387 diff --git a/src/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_r…
39389 --- a/src/chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_…
39391 @@ -215,6 +215,8 @@ base::FilePath GetEndpointVerificationDir() {
39400 diff --git a/src/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_pr…
39402 --- a/src/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_a…
39404 @@ -72,10 +72,13 @@ api::enterprise_reporting_private::ContextInfo ToContextInfo(
39418 @@ -83,9 +86,11 @@ api::enterprise_reporting_private::ContextInfo ToContextInfo(
39430 @@ -125,6 +130,7 @@ api::enterprise_reporting_private::ContextInfo ToContextInfo(
39438 diff --git a/src/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_fa…
39440 --- a/src/chrome/browser/extensions/api/networking_private/networking_private_ui_delegate_factory_i…
39442 @@ -15,6 +15,10 @@
39453 diff --git a/src/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc b…
39455 --- a/src/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_api.cc
39457 @@ -24,10 +24,10 @@ using safe_browsing::SafeBrowsingNavigationObserverManager;
39461 -
39465 -
39470 @@ -53,7 +53,7 @@ SafeBrowsingPrivateGetReferrerChainFunction::Run() {
39472 base::StringPrintf("Could not find tab with id %d.", params->tab_id)));
39474 -
39478 profile->GetPrefs(), g_browser_process->safe_browsing_service()))
39479 @@ -89,6 +89,9 @@ SafeBrowsingPrivateGetReferrerChainFunction::Run() {
39489 diff --git a/src/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_ro…
39491 --- a/src/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc
39493 @@ -70,6 +70,7 @@ const char kProfilePolicyClientDescription[] = "a profile-level user";
39501 @@ -101,6 +102,7 @@ std::string MalwareRuleToThreatType(const std::string& rule_name) {
39509 @@ -269,7 +271,7 @@ void SafeBrowsingPrivateEventRouter::OnPolicySpecifiedPasswordReuseDetected(
39511 event_router_->BroadcastEvent(std::move(extension_event));
39513 -
39518 @@ -285,6 +287,7 @@ void SafeBrowsingPrivateEventRouter::OnPolicySpecifiedPasswordReuseDetected(
39526 @@ -342,6 +345,7 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDownloadOpened(
39527 event_router_->BroadcastEvent(std::move(extension_event));
39534 @@ -360,9 +364,11 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDownloadOpened(
39546 @@ -372,6 +378,7 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDownloadOpened(
39554 @@ -398,7 +405,7 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialShown(
39556 event_router_->BroadcastEvent(std::move(extension_event));
39558 -
39563 @@ -422,6 +429,7 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialShown(
39571 @@ -449,6 +457,7 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialProceeded(
39572 event_router_->BroadcastEvent(std::move(extension_event));
39579 @@ -462,12 +471,15 @@ void SafeBrowsingPrivateEventRouter::OnSecurityInterstitialProceeded(
39588 -
39596 @@ -481,6 +493,7 @@ void SafeBrowsingPrivateEventRouter::OnAnalysisConnectorResult(
39604 @@ -492,6 +505,7 @@ void SafeBrowsingPrivateEventRouter::OnAnalysisConnectorResult(
39612 @@ -507,6 +521,7 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDeepScanningResult(
39620 @@ -526,8 +541,12 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDeepScanningResult(
39633 @@ -544,6 +563,7 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDeepScanningResult(
39641 @@ -556,6 +576,7 @@ void SafeBrowsingPrivateEventRouter::OnSensitiveDataEvent(
39649 @@ -574,8 +595,12 @@ void SafeBrowsingPrivateEventRouter::OnSensitiveDataEvent(
39662 @@ -588,6 +613,7 @@ void SafeBrowsingPrivateEventRouter::OnSensitiveDataEvent(
39670 @@ -601,6 +627,7 @@ void SafeBrowsingPrivateEventRouter::OnAnalysisConnectorWarningBypassed(
39678 @@ -619,9 +646,13 @@ void SafeBrowsingPrivateEventRouter::OnAnalysisConnectorWarningBypassed(
39692 @@ -636,6 +667,7 @@ void SafeBrowsingPrivateEventRouter::OnAnalysisConnectorWarningBypassed(
39700 @@ -648,6 +680,7 @@ void SafeBrowsingPrivateEventRouter::OnUnscannedFileEvent(
39708 @@ -667,13 +700,18 @@ void SafeBrowsingPrivateEventRouter::OnUnscannedFileEvent(
39727 @@ -719,9 +757,10 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDownloadEvent(
39734 -
39739 @@ -752,6 +791,7 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDownloadWarningBypassed(
39747 @@ -772,9 +812,11 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDownloadWarningBypassed(
39759 @@ -782,6 +824,7 @@ void SafeBrowsingPrivateEventRouter::OnDangerousDownloadWarningBypassed(
39767 @@ -1107,7 +1150,11 @@ void SafeBrowsingPrivateEventRouter::ReportRealtimeEvent(
39779 diff --git a/src/chrome/browser/extensions/api/sessions/sessions_api.cc b/src/chrome/browser/extens…
39781 --- a/src/chrome/browser/extensions/api/sessions/sessions_api.cc
39783 @@ -19,6 +19,7 @@
39791 @@ -605,6 +606,9 @@ ExtensionFunction::ResponseAction SessionsRestoreFunction::Run() {
39792 if (profile != profile->GetOriginalProfile())
39798 if (!params->session_id)
39801 diff --git a/src/chrome/browser/extensions/api/sessions/sessions_apitest.cc b/src/chrome/browser/ex…
39803 --- a/src/chrome/browser/extensions/api/sessions/sessions_apitest.cc
39805 @@ -20,6 +20,7 @@
39813 @@ -27,6 +28,7 @@
39821 @@ -357,6 +359,27 @@ IN_PROC_BROWSER_TEST_F(ExtensionSessionsTest, RestoreInIncognito) {
39828 + // Set up a browser with a non-editable tabstrip, simulating one in the midst
39832 + Browser::CreateParams params(browser()->profile(), true);
39837 + browser_window->SetIsTabStripEditable(false);
39849 diff --git a/src/chrome/browser/extensions/api/settings_private/generated_prefs.cc b/src/chrome/bro…
39851 --- a/src/chrome/browser/extensions/api/settings_private/generated_prefs.cc
39853 @@ -16,6 +16,7 @@
39861 @@ -100,8 +101,10 @@ void GeneratedPrefs::CreatePrefs() {
39872 diff --git a/src/chrome/browser/extensions/api/settings_private/prefs_util.cc b/src/chrome/browser/…
39874 --- a/src/chrome/browser/extensions/api/settings_private/prefs_util.cc
39876 @@ -296,8 +296,10 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlistedKeys() {
39887 diff --git a/src/chrome/browser/extensions/api/tabs/tabs_api.cc b/src/chrome/browser/extensions/api…
39889 --- a/src/chrome/browser/extensions/api/tabs/tabs_api.cc
39891 @@ -15,6 +15,7 @@
39899 @@ -810,10 +811,30 @@ ExtensionFunction::ResponseAction WindowsCreateFunction::Run() {
39903 - if (focused)
39905 new_window->window()->Show();
39906 - else
39916 + Browser* active_browser = browser_list->GetLastActive();
39918 + // Check if there's a currently-active window that should re-take focus.
39921 + if (active_browser && active_browser->window()->IsActive())
39923 new_window->window()->ShowInactive();
39927 + active_browser->window()->Activate();
39931 // (otherwise the tabstrip is empty), and window()->show() has been called
39932 diff --git a/src/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc b/src/chrome/browser/e…
39934 --- a/src/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc
39936 @@ -20,15 +20,25 @@
39962 @@ -194,7 +204,113 @@ INSTANTIATE_TEST_SUITE_P(EventPage,
39974 + const GURL url1 = embedded_test_server()->GetURL("/title1.html");
39975 + const GURL url2 = embedded_test_server()->GetURL("/title2.html");
39981 + browser()->window()->Activate();
39984 + ASSERT_TRUE(browser()->window()->IsActive());
40031 + ASSERT_EQ(2u, browser_list->size());
40035 + Browser* new_browser = browser_list->get(0) == browser()
40036 + ? browser_list->get(1)
40037 + : browser_list->get(0);
40042 + EXPECT_EQ(1, new_browser->tab_strip_model()->count());
40043 + EXPECT_EQ(url2, new_browser->tab_strip_model()
40044 + ->GetActiveWebContents()
40045 + ->GetLastCommittedURL());
40060 + EXPECT_FALSE(new_browser->window()->IsActive());
40061 + EXPECT_TRUE(browser()->window()->IsActive());
40070 + // BrowserView::GetBrowserViewForBrowser(browser())->frame(),
40071 + // BrowserView::GetBrowserViewForBrowser(new_browser)->frame()));
40076 diff --git a/src/chrome/browser/extensions/api/tabs/windows_event_router.cc b/src/chrome/browser/ex…
40078 --- a/src/chrome/browser/extensions/api/tabs/windows_event_router.cc
40080 @@ -165,6 +165,8 @@ WindowsEventRouter::WindowsEventRouter(Profile* profile)
40081 &g_browser_process->platform_part()->key_window_notifier());
40083 views::WidgetFocusManager::GetInstance()->AddFocusChangeListener(this);
40089 diff --git a/src/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/src/chrom…
40091 --- a/src/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
40093 @@ -46,6 +46,7 @@
40101 @@ -245,8 +246,10 @@ void ShowBlockedByParentDialog(const Extension* extension,
40112 @@ -1192,6 +1195,7 @@ WebstorePrivateGetReferrerChainFunction::
40119 profile->GetPrefs(), g_browser_process->safe_browsing_service()))
40120 @@ -1238,6 +1242,9 @@ WebstorePrivateGetReferrerChainFunction::Run() {
40130 diff --git a/src/chrome/browser/extensions/blocklist_state_fetcher.cc b/src/chrome/browser/extensio…
40132 --- a/src/chrome/browser/extensions/blocklist_state_fetcher.cc
40134 @@ -38,6 +38,7 @@ BlocklistStateFetcher::~BlocklistStateFetcher() {
40140 if (g_browser_process && g_browser_process->safe_browsing_service()) {
40142 @@ -53,7 +54,7 @@ void BlocklistStateFetcher::Request(const std::string& id,
40146 -
40151 diff --git a/src/chrome/browser/extensions/chrome_extensions_browser_client.cc b/src/chrome/browser…
40153 --- a/src/chrome/browser/extensions/chrome_extensions_browser_client.cc
40155 @@ -606,6 +606,7 @@ void ChromeExtensionsBrowserClient::NotifyExtensionApiTabExecuteScript(
40163 @@ -615,6 +616,7 @@ void ChromeExtensionsBrowserClient::NotifyExtensionApiTabExecuteScript(
40166 telemetry_service->AddSignal(std::move(signal));
40171 diff --git a/src/chrome/browser/extensions/extension_service.cc b/src/chrome/browser/extensions/ext…
40173 --- a/src/chrome/browser/extensions/extension_service.cc
40175 @@ -861,6 +861,7 @@ bool ExtensionService::IsExtensionEnabled(
40183 @@ -872,6 +873,8 @@ void ExtensionService::PerformActionBasedOnOmahaAttributes(
40184 error_controller_->ShowErrorIfNeeded();
40192 diff --git a/src/chrome/browser/extensions/extension_service.h b/src/chrome/browser/extensions/exte…
40194 --- a/src/chrome/browser/extensions/extension_service.h
40196 @@ -31,6 +31,7 @@
40204 @@ -305,9 +306,11 @@ class ExtensionService : public ExtensionServiceInterface,
40215 // the |disable_reasons| (a bitmask of disable_reason::DisableReason - there
40216 diff --git a/src/chrome/browser/extensions/extension_system_impl.cc b/src/chrome/browser/extensions…
40218 --- a/src/chrome/browser/extensions/extension_system_impl.cc
40220 @@ -464,8 +464,10 @@ void ExtensionSystemImpl::InstallUpdate(
40225 extension_service()->PerformActionBasedOnOmahaAttributes(extension_id,
40231 diff --git a/src/chrome/browser/extensions/webstore_standalone_installer.cc b/src/chrome/browser/ex…
40233 --- a/src/chrome/browser/extensions/webstore_standalone_installer.cc
40235 @@ -31,24 +31,24 @@
40249 - : id_(webstore_item_id),
40250 - callback_(std::move(callback)),
40251 - profile_(profile),
40252 - install_source_(WebstoreInstaller::INSTALL_SOURCE_INLINE),
40253 - show_user_count_(true),
40254 - average_rating_(0.0),
40255 - rating_count_(0) {}
40263 - // AbortInstall, which both release this ref.
40268 @@ -95,8 +95,8 @@ void WebstoreStandaloneInstaller::AbortInstall() {
40272 - Release(); // Matches the AddRef in BeginInstall.
40278 @@ -125,7 +125,7 @@ void WebstoreStandaloneInstaller::CompleteInstall(
40282 - Release(); // Matches the AddRef in BeginInstall.
40287 @@ -399,6 +399,15 @@ void WebstoreStandaloneInstaller::OnExtensionInstallFailure(
40303 @@ -424,4 +433,12 @@ void WebstoreStandaloneInstaller::OnWebStoreDataFetcherDone() {
40316 diff --git a/src/chrome/browser/extensions/webstore_standalone_installer.h b/src/chrome/browser/ext…
40318 --- a/src/chrome/browser/extensions/webstore_standalone_installer.h
40320 @@ -11,11 +11,14 @@
40335 @@ -41,7 +44,8 @@ class WebstoreStandaloneInstaller
40339 - public WebstoreInstallHelper::Delegate {
40345 @@ -195,14 +199,23 @@ class WebstoreStandaloneInstaller
40363 - WebstoreInstaller::InstallSource install_source_;
40370 @@ -214,10 +227,10 @@ class WebstoreStandaloneInstaller
40374 - bool show_user_count_;
40377 - double average_rating_;
40378 - int rating_count_;
40384 diff --git a/src/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc …
40386 --- a/src/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
40388 @@ -35,7 +35,11 @@
40400 @@ -44,6 +48,7 @@
40408 @@ -57,6 +62,8 @@
40417 @@ -112,14 +119,14 @@ void ShowFileSystemAccessRestrictedDirectoryDialogOnUIThread(
40421 - void(ChromeFileSystemAccessPermissionContext::SensitiveDirectoryResult)>
40426 if (!rfh || !rfh->IsActive()) {
40428 - std::move(callback).Run(ChromeFileSystemAccessPermissionContext::
40429 - SensitiveDirectoryResult::kAbort);
40435 @@ -127,8 +134,8 @@ void ShowFileSystemAccessRestrictedDirectoryDialogOnUIThread(
40439 - std::move(callback).Run(ChromeFileSystemAccessPermissionContext::
40440 - SensitiveDirectoryResult::kAbort);
40446 @@ -136,6 +143,37 @@ void ShowFileSystemAccessRestrictedDirectoryDialogOnUIThread(
40460 + if (!rfh || !rfh->IsActive()) {
40483 constexpr const int kNoBasePathKey = -1;
40484 @@ -304,7 +342,7 @@ BindResultCallbackToCurrentSequence(
40488 -
40493 @@ -381,6 +419,7 @@ InterpretSafeBrowsingResult(safe_browsing::DownloadCheckResult result) {
40501 @@ -772,9 +811,9 @@ struct ChromeFileSystemAccessPermissionContext::OriginState {
40505 - kPersistentPermissionExpirationTimeoutNonPWA;
40508 - kPersistentPermissionExpirationTimeoutPWA;
40513 @@ -994,18 +1033,19 @@ ChromeFileSystemAccessPermissionContext::GetGrantedObjects(
40517 - bool is_installed_pwa = OriginIsInstalledPWA(origin);
40523 - [this, &is_installed_pwa](const std::unique_ptr<Object>& object) {
40528 object->value.FindKey(kPermissionLastUsedTimeKey))
40530 - return this->PersistentPermissionIsExpired(last_activity_time,
40531 - is_installed_pwa);
40532 + return this->PersistentPermissionIsExpired(
40537 @@ -1022,26 +1062,27 @@ ChromeFileSystemAccessPermissionContext::GetAllGrantedObjects() {
40541 - bool is_installed_pwa = false;
40549 - [this, &is_installed_pwa, &origin,
40552 if (object->origin != origin_as_url) {
40553 origin_as_url = object->origin;
40554 origin = url::Origin::Create(object->origin);
40555 - is_installed_pwa = OriginIsInstalledPWA(origin);
40561 object->value.FindKey(kPermissionLastUsedTimeKey))
40563 return this->PersistentPermissionIsExpired(
40564 - last_activity_time, is_installed_pwa);
40569 @@ -1106,13 +1147,14 @@ bool ChromeFileSystemAccessPermissionContext::CanObtainWritePermission(
40573 -void ChromeFileSystemAccessPermissionContext::ConfirmSensitiveDirectoryAccess(
40581 - base::OnceCallback<void(SensitiveDirectoryResult)> callback) {
40586 @@ -1121,7 +1163,9 @@ void ChromeFileSystemAccessPermissionContext::ConfirmSensitiveDirectoryAccess(
40590 - std::move(callback).Run(SensitiveDirectoryResult::kAllowed);
40597 @@ -1130,10 +1174,11 @@ void ChromeFileSystemAccessPermissionContext::ConfirmSensitiveDirectoryAcce…
40601 - GetWeakPtr(), origin, path, handle_type, frame_id,
40602 - std::move(callback)));
40611 @@ -1155,18 +1200,42 @@ void ChromeFileSystemAccessPermissionContext::PerformAfterWriteChecks(
40624 - base::OnceCallback<void(SensitiveDirectoryResult)> callback,
40629 - std::move(callback).Run(SensitiveDirectoryResult::kAllowed);
40635 + safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel(
40644 + content::GetUIThreadTaskRunner({})->PostTask(
40656 @@ -1451,9 +1520,28 @@ bool ChromeFileSystemAccessPermissionContext::AncestorHasActivePermission(
40660 -bool ChromeFileSystemAccessPermissionContext::OriginIsInstalledPWA(
40666 - return DoesOriginContainAnyInstalledWebApp(profile_, origin.GetURL());
40680 + web_app_provider->registrar().FindAppWithUrlInScope(origin.GetURL());
40682 + web_app_provider->registrar().IsActivelyInstalled(app_id.value());
40687 @@ -1467,7 +1555,7 @@ void ChromeFileSystemAccessPermissionContext::UpdatePersistedPermissions() {
40691 - bool is_installed_pwa = false;
40696 @@ -1476,10 +1564,10 @@ void ChromeFileSystemAccessPermissionContext::UpdatePersistedPermissions() {
40697 if (object->origin != origin_as_url) {
40698 origin_as_url = object->origin;
40699 origin = url::Origin::Create(object->origin);
40700 - is_installed_pwa = OriginIsInstalledPWA(origin);
40703 MaybeRenewOrRevokePersistedPermission(origin, std::move(object->value),
40704 - is_installed_pwa);
40709 @@ -1490,20 +1578,20 @@ void ChromeFileSystemAccessPermissionContext::
40713 - bool is_installed_pwa = OriginIsInstalledPWA(origin);
40719 MaybeRenewOrRevokePersistedPermission(origin, std::move(object->value),
40720 - is_installed_pwa);
40728 - bool is_installed_pwa) {
40733 @@ -1545,7 +1633,7 @@ void ChromeFileSystemAccessPermissionContext::
40737 - is_installed_pwa)) {
40742 @@ -1613,27 +1701,28 @@ bool ChromeFileSystemAccessPermissionContext::HasPersistedPermission(
40746 - auto is_installed_pwa = OriginIsInstalledPWA(origin);
40749 base::ValueToTime(grant->FindKey(kPermissionLastUsedTimeKey)).value();
40754 - is_installed_pwa ? "PWA" : "NonPWA"}),
40756 clock_->Now() - last_activity_time, base::Seconds(1), base::Days(24),
40760 - return !PersistentPermissionIsExpired(last_activity_time, is_installed_pwa);
40767 - bool is_installed_pwa) {
40768 - base::TimeDelta duration = is_installed_pwa
40769 - ? kPersistentPermissionExpirationTimeoutPWA
40770 - : kPersistentPermissionExpirationTimeoutNonPWA;
40776 return (last_used + duration) < clock_->Now();
40778 diff --git a/src/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h b…
40780 --- a/src/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
40782 @@ -19,6 +19,7 @@
40790 @@ -79,17 +80,20 @@ class ChromeFileSystemAccessPermissionContext
40794 - void ConfirmSensitiveDirectoryAccess(
40802 - base::OnceCallback<void(SensitiveDirectoryResult)> callback) override;
40813 @@ -160,9 +164,9 @@ class ChromeFileSystemAccessPermissionContext
40817 - kPersistentPermissionExpirationTimeoutNonPWA = base::Hours(5);
40818 - static constexpr base::TimeDelta kPersistentPermissionExpirationTimeoutPWA =
40819 - base::Days(30);
40826 @@ -176,8 +180,9 @@ class ChromeFileSystemAccessPermissionContext
40830 - // Overridden in tests.
40831 - virtual bool OriginIsInstalledPWA(const url::Origin& origin);
40838 @@ -189,8 +194,9 @@ class ChromeFileSystemAccessPermissionContext
40844 - base::OnceCallback<void(SensitiveDirectoryResult)> callback,
40849 @@ -223,7 +229,7 @@ class ChromeFileSystemAccessPermissionContext
40853 - bool is_installed_pwa);
40858 @@ -237,7 +243,7 @@ class ChromeFileSystemAccessPermissionContext
40862 - bool is_installed_pwa);
40867 diff --git a/src/chrome/browser/file_system_access/chrome_file_system_access_permission_context_uni…
40869 --- a/src/chrome/browser/file_system_access/chrome_file_system_access_permission_context_unittest.cc
40871 @@ -18,6 +18,7 @@
40879 @@ -34,6 +35,7 @@
40887 @@ -53,7 +55,7 @@ using PersistedPermissionOptions =
40891 - ChromeFileSystemAccessPermissionContext::SensitiveDirectoryResult;
40896 @@ -72,11 +74,6 @@ class TestFileSystemAccessPermissionContext
40900 - protected:
40901 - bool OriginIsInstalledPWA(const url::Origin& origin) override {
40902 - return false;
40903 - }
40904 -
40908 @@ -110,22 +107,19 @@ class ChromeFileSystemAccessPermissionContextTest : public testing::Test {
40912 - SensitiveDirectoryResult ConfirmSensitiveDirectoryAccessSync(
40917 - HandleType handle_type) {
40918 - base::RunLoop loop;
40919 - SensitiveDirectoryResult out_result;
40920 - permission_context_->ConfirmSensitiveDirectoryAccess(
40921 - kTestOrigin, path_type, path, handle_type,
40922 - content::GlobalRenderFrameHostId(),
40923 - base::BindLambdaForTesting([&](SensitiveDirectoryResult result) {
40924 - out_result = result;
40925 - loop.Quit();
40926 - }));
40927 - loop.Run();
40928 - return out_result;
40934 + permission_context_->ConfirmSensitiveEntryAccess(
40941 @@ -204,7 +198,7 @@ class ChromeFileSystemAccessPermissionContextNoPersistenceTest
40945 - ConfirmSensitiveDirectoryAccess_NoSpecialPath) {
40950 @@ -213,77 +207,87 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
40954 - EXPECT_EQ(SensitiveDirectoryResult::kAllowed,
40955 - ConfirmSensitiveDirectoryAccessSync(permission_context(),
40956 - PathType::kLocal, kTestPath,
40957 - HandleType::kFile));
40958 - EXPECT_EQ(SensitiveDirectoryResult::kAllowed,
40959 - ConfirmSensitiveDirectoryAccessSync(permission_context(),
40960 - PathType::kLocal, kTestPath,
40961 - HandleType::kDirectory));
40962 -
40963 - // External (relative) paths should also be allowed.
40966 - ConfirmSensitiveDirectoryAccessSync(
40967 - permission_context(), PathType::kExternal,
40968 - base::FilePath(FILE_PATH_LITERAL("foo/bar")), HandleType::kFile));
40987 - ConfirmSensitiveDirectoryAccess_DontBlockAllChildren) {
40993 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
40994 - ConfirmSensitiveDirectoryAccessSync(permission_context(),
40995 - PathType::kLocal, home_dir,
40996 - HandleType::kDirectory));
41003 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41004 - ConfirmSensitiveDirectoryAccessSync(
41005 - permission_context(), PathType::kLocal, temp_dir_.GetPath(),
41006 - HandleType::kDirectory));
41013 - EXPECT_EQ(SensitiveDirectoryResult::kAllowed,
41014 - ConfirmSensitiveDirectoryAccessSync(
41015 - permission_context(), PathType::kLocal,
41016 - home_dir.AppendASCII("foo"), HandleType::kFile));
41017 - EXPECT_EQ(SensitiveDirectoryResult::kAllowed,
41018 - ConfirmSensitiveDirectoryAccessSync(
41019 - permission_context(), PathType::kLocal,
41020 - home_dir.AppendASCII("foo"), HandleType::kDirectory));
41034 - ConfirmSensitiveDirectoryAccess_BlockAllChildren) {
41040 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41041 - ConfirmSensitiveDirectoryAccessSync(permission_context(),
41042 - PathType::kLocal, app_dir,
41043 - HandleType::kDirectory));
41050 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41051 - ConfirmSensitiveDirectoryAccessSync(
41052 - permission_context(), PathType::kLocal, temp_dir_.GetPath(),
41053 - HandleType::kDirectory));
41060 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41061 - ConfirmSensitiveDirectoryAccessSync(
41062 - permission_context(), PathType::kLocal,
41063 - app_dir.AppendASCII("foo"), HandleType::kFile));
41064 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41065 - ConfirmSensitiveDirectoryAccessSync(
41066 - permission_context(), PathType::kLocal,
41067 - app_dir.AppendASCII("foo"), HandleType::kDirectory));
41081 - ConfirmSensitiveDirectoryAccess_BlockChildrenNested) {
41086 @@ -292,29 +296,34 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41090 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41091 - ConfirmSensitiveDirectoryAccessSync(permission_context(),
41092 - PathType::kLocal, user_data_dir,
41093 - HandleType::kDirectory));
41100 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41101 - ConfirmSensitiveDirectoryAccessSync(
41102 - permission_context(), PathType::kLocal, temp_dir_.GetPath(),
41103 - HandleType::kDirectory));
41110 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41111 - ConfirmSensitiveDirectoryAccessSync(permission_context(),
41112 - PathType::kLocal, download_dir,
41113 - HandleType::kDirectory));
41121 - ConfirmSensitiveDirectoryAccessSync(
41124 - download_dir.AppendASCII("foo"), HandleType::kFile));
41128 - ConfirmSensitiveDirectoryAccessSync(
41131 - download_dir.AppendASCII("foo"), HandleType::kDirectory));
41137 @@ -324,65 +333,101 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41141 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41142 - ConfirmSensitiveDirectoryAccessSync(
41143 - permission_context(), PathType::kLocal, internet_cache,
41144 - HandleType::kDirectory));
41152 - ConfirmSensitiveDirectoryAccessSync(
41155 - internet_cache.AppendASCII("foo"), HandleType::kFile));
41160 - ConfirmSensitiveDirectoryAccessSync(
41163 - internet_cache.AppendASCII("foo"), HandleType::kDirectory));
41170 - ConfirmSensitiveDirectoryAccess_RelativePathBlock) {
41176 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41177 - ConfirmSensitiveDirectoryAccessSync(
41178 - permission_context(), PathType::kLocal,
41179 - home_dir.AppendASCII(".ssh"), HandleType::kDirectory));
41187 - ConfirmSensitiveDirectoryAccessSync(
41190 - home_dir.AppendASCII(".ssh/id_rsa"), HandleType::kFile));
41196 - ConfirmSensitiveDirectoryAccess_ExplicitPathBlock) {
41204 - ConfirmSensitiveDirectoryAccessSync(
41207 - base::FilePath(FILE_PATH_LITERAL("/dev")), HandleType::kDirectory));
41211 - EXPECT_EQ(SensitiveDirectoryResult::kAbort,
41212 - ConfirmSensitiveDirectoryAccessSync(
41213 - permission_context(), PathType::kLocal,
41214 - base::FilePath(FILE_PATH_LITERAL("/dev/foo")),
41215 - HandleType::kDirectory));
41218 - ConfirmSensitiveDirectoryAccessSync(
41221 - base::FilePath(FILE_PATH_LITERAL("/dev/foo")), HandleType::kFile));
41264 @@ -1192,7 +1237,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41268 - kPersistentPermissionExpirationTimeoutNonPWA +
41273 @@ -1261,7 +1306,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41277 - kPersistentPermissionExpirationTimeoutNonPWA +
41282 @@ -1276,7 +1321,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41286 - kPersistentPermissionExpirationTimeoutNonPWA -
41287 + kPersistentPermissionExpirationTimeoutDefault -
41289 permission_context()->UpdatePersistedPermissionsForTesting();
41290 objects = permission_context()->GetAllGrantedOrExpiredObjects();
41291 @@ -1286,7 +1331,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41295 - kPersistentPermissionExpirationTimeoutNonPWA +
41298 permission_context()->UpdatePersistedPermissionsForTesting();
41299 objects = permission_context()->GetAllGrantedOrExpiredObjects();
41300 @@ -1316,7 +1361,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41304 - kPersistentPermissionExpirationTimeoutNonPWA +
41309 @@ -1331,7 +1376,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41313 - kPersistentPermissionExpirationTimeoutNonPWA -
41314 + kPersistentPermissionExpirationTimeoutDefault -
41316 permission_context()->UpdatePersistedPermissionsForTesting();
41317 objects = permission_context()->GetAllGrantedOrExpiredObjects();
41318 @@ -1341,7 +1386,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41322 - kPersistentPermissionExpirationTimeoutNonPWA +
41325 permission_context()->UpdatePersistedPermissionsForTesting();
41326 objects = permission_context()->GetAllGrantedOrExpiredObjects();
41327 @@ -1382,7 +1427,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41331 - kPersistentPermissionExpirationTimeoutNonPWA -
41332 + kPersistentPermissionExpirationTimeoutDefault -
41336 @@ -1461,7 +1506,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41340 - kPersistentPermissionExpirationTimeoutNonPWA -
41341 + kPersistentPermissionExpirationTimeoutDefault -
41344 // Auto-grant because active permissions exist. This should update the
41345 @@ -1498,7 +1543,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41349 - kPersistentPermissionExpirationTimeoutNonPWA -
41350 + kPersistentPermissionExpirationTimeoutDefault -
41354 @@ -1514,7 +1559,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41358 - kPersistentPermissionExpirationTimeoutNonPWA +
41363 @@ -1554,7 +1599,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41367 - kPersistentPermissionExpirationTimeoutNonPWA -
41368 + kPersistentPermissionExpirationTimeoutDefault -
41371 // Auto-grant because active permissions exist. This should update the
41372 @@ -1570,7 +1615,7 @@ TEST_F(ChromeFileSystemAccessPermissionContextTest,
41376 - kPersistentPermissionExpirationTimeoutNonPWA -
41377 + kPersistentPermissionExpirationTimeoutDefault -
41379 EXPECT_TRUE(permission_context()->HasPersistedPermissionForTesting(
41381 diff --git a/src/chrome/browser/first_run/first_run.cc b/src/chrome/browser/first_run/first_run.cc
41383 --- a/src/chrome/browser/first_run/first_run.cc
41385 @@ -286,7 +286,7 @@ void SetupInitialPrefsFromInstallPrefs(
41386 // -- Platform-specific functions --
41389 - !BUILDFLAG(IS_FUCHSIA)
41394 diff --git a/src/chrome/browser/first_run/first_run_dialog.h b/src/chrome/browser/first_run/first_r…
41396 --- a/src/chrome/browser/first_run/first_run_dialog.h
41398 @@ -12,7 +12,9 @@
41401 // of lacros-chrome is complete.
41402 -#if BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
41409 diff --git a/src/chrome/browser/first_run/first_run_internal_posix.cc b/src/chrome/browser/first_ru…
41411 --- a/src/chrome/browser/first_run/first_run_internal_posix.cc
41413 @@ -37,7 +37,7 @@ enum class ForcedShowDialogState {
41417 -#if !BUILDFLAG(IS_CHROMEOS_ASH)
41421 // real, official-build first run, initializes the default metrics reporting if
41422 @@ -82,7 +82,7 @@ void ForceFirstRunDialogShownForTesting(bool shown) {
41426 -#if !BUILDFLAG(IS_CHROMEOS_ASH)
41431 diff --git a/src/chrome/browser/flag_descriptions.cc b/src/chrome/browser/flag_descriptions.cc
41433 --- a/src/chrome/browser/flag_descriptions.cc
41435 @@ -5323,7 +5323,7 @@ const char kDownloadShelfWebUIDescription[] =
41436 // Random platform combinations -----------------------------------------------
41439 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
41444 diff --git a/src/chrome/browser/flag_descriptions.h b/src/chrome/browser/flag_descriptions.h
41446 --- a/src/chrome/browser/flag_descriptions.h
41448 @@ -3070,7 +3070,7 @@ extern const char kDownloadShelfWebUIDescription[];
41449 // Random platform combinations -----------------------------------------------
41452 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
41457 diff --git a/src/chrome/browser/hid/chrome_hid_delegate.cc b/src/chrome/browser/hid/chrome_hid_dele…
41459 --- a/src/chrome/browser/hid/chrome_hid_delegate.cc
41461 @@ -38,10 +38,15 @@ std::unique_ptr<content::HidChooser> ChromeHidDelegate::RunChooser(
41477 diff --git a/src/chrome/browser/image_editor/BUILD.gn b/src/chrome/browser/image_editor/BUILD.gn
41479 --- a/src/chrome/browser/image_editor/BUILD.gn
41481 @@ -3,7 +3,7 @@
41485 -assert(is_chromeos || is_linux || is_mac || is_win || is_fuchsia,
41490 diff --git a/src/chrome/browser/intranet_redirect_detector.h b/src/chrome/browser/intranet_redirect…
41492 --- a/src/chrome/browser/intranet_redirect_detector.h
41494 @@ -27,7 +27,7 @@ class SimpleURLLoader;
41498 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA))
41503 diff --git a/src/chrome/browser/media/router/discovery/discovery_network_list_posix.cc b/src/chrome…
41505 --- a/src/chrome/browser/media/router/discovery/discovery_network_list_posix.cc
41507 @@ -40,6 +40,7 @@ using sll = struct sockaddr_dl;
41515 @@ -88,12 +89,14 @@ void GetDiscoveryNetworkInfoListImpl(
41530 @@ -102,6 +105,9 @@ std::vector<DiscoveryNetworkInfo> GetDiscoveryNetworkInfoList() {
41540 diff --git a/src/chrome/browser/media/webrtc/display_media_access_handler.cc b/src/chrome/browser/m…
41542 --- a/src/chrome/browser/media/webrtc/display_media_access_handler.cc
41544 @@ -23,6 +23,7 @@
41552 @@ -106,6 +107,7 @@ void DisplayMediaAccessHandler::HandleRequest(
41560 @@ -121,6 +123,7 @@ void DisplayMediaAccessHandler::HandleRequest(
41561 observer->OnDesktopCaptureRequest();
41568 diff --git a/src/chrome/browser/media/webrtc/webrtc_event_log_uploader.cc b/src/chrome/browser/medi…
41570 --- a/src/chrome/browser/media/webrtc/webrtc_event_log_uploader.cc
41572 @@ -44,6 +44,8 @@ const char kProduct[] = "Chrome_ChromeOS";
41581 diff --git a/src/chrome/browser/media/webrtc/webrtc_log_uploader.cc b/src/chrome/browser/media/webr…
41583 --- a/src/chrome/browser/media/webrtc/webrtc_log_uploader.cc
41585 @@ -361,6 +361,8 @@ void WebRtcLogUploader::SetupMultipart(
41594 diff --git a/src/chrome/browser/media_galleries/media_file_system_registry.cc b/src/chrome/browser/…
41596 --- a/src/chrome/browser/media_galleries/media_file_system_registry.cc
41598 @@ -17,31 +17,24 @@
41609 -#include "chrome/browser/media_galleries/media_galleries_dialog_controller.h"
41613 -#include "chrome/common/chrome_paths.h"
41614 -#include "chrome/common/extensions/extension_constants.h"
41616 -#include "components/prefs/pref_service.h"
41621 -#include "content/public/browser/navigation_details.h"
41622 -#include "content/public/browser/render_frame_host.h"
41625 -#include "content/public/browser/render_process_host_observer.h"
41626 -#include "content/public/browser/render_view_host.h"
41628 -#include "content/public/browser/web_contents_observer.h"
41632 @@ -94,169 +87,27 @@ struct InvalidatedGalleriesInfo {
41636 -// Tracks the liveness of multiple RenderProcessHosts that the caller is
41637 -// interested in. Once all of the RPHs have closed or been destroyed a call
41638 -// back informs the caller.
41639 -class RPHReferenceManager {
41645 - // |no_references_callback| is called when the last WebContents reference
41646 - // goes away. WebContents references are added through
41647 - // ReferenceFromWebContents().
41648 - explicit RPHReferenceManager(base::OnceClosure no_references_callback);
41649 - virtual ~RPHReferenceManager();
41650 -
41651 - // Remove all references, but don't call |no_references_callback|.
41652 - void Reset() { observer_map_.clear(); }
41653 -
41654 - // Returns true if there are no references.
41655 - bool empty() const { return observer_map_.empty(); }
41656 -
41657 - // Adds a reference to the passed |contents|. Calling this multiple times with
41658 - // the same |contents| is a no-op.
41659 - void ReferenceFromWebContents(content::WebContents* contents);
41668 - class RPHWebContentsObserver : public content::WebContentsObserver {
41669 - public:
41670 - RPHWebContentsObserver(RPHReferenceManager* manager,
41671 - WebContents* web_contents);
41672 -
41673 - private:
41674 - // content::WebContentsObserver
41675 - void WebContentsDestroyed() override;
41676 - void NavigationEntryCommitted(
41677 - const content::LoadCommittedDetails& load_details) override;
41678 -
41679 - raw_ptr<RPHReferenceManager> manager_;
41680 - };
41681 -
41682 - class RPHObserver : public content::RenderProcessHostObserver {
41683 - public:
41684 - RPHObserver(RPHReferenceManager* manager, RenderProcessHost* host);
41685 - ~RPHObserver() override;
41686 -
41687 - void AddWebContentsObserver(WebContents* web_contents);
41688 - void RemoveWebContentsObserver(WebContents* web_contents);
41689 - bool HasWebContentsObservers() { return !observed_web_contentses_.empty(); }
41690 -
41691 - private:
41692 - void RenderProcessHostDestroyed(RenderProcessHost* host) override;
41693 -
41694 - raw_ptr<RPHReferenceManager> manager_;
41695 - raw_ptr<RenderProcessHost> host_;
41696 - std::map<WebContents*, std::unique_ptr<RPHWebContentsObserver>>
41697 - observed_web_contentses_;
41698 - };
41699 -
41700 - // Handlers for observed events.
41701 - void OnRenderProcessHostDestroyed(RenderProcessHost* rph);
41702 - void OnWebContentsDestroyedOrNavigated(WebContents* contents);
41703 -
41704 - // A callback to call when the last RVH reference goes away.
41705 - base::OnceClosure no_references_callback_;
41709 - // The set of render processes and web contents that may have references to
41710 - // the file system ids this instance manages.
41711 - std::map<const RenderProcessHost*, std::unique_ptr<RPHObserver>>
41712 - observer_map_;
41717 -RPHReferenceManager::RPHReferenceManager(
41718 - base::OnceClosure no_references_callback)
41719 - : no_references_callback_(std::move(no_references_callback)) {}
41720 -
41721 -RPHReferenceManager::~RPHReferenceManager() {
41722 - Reset();
41723 -}
41724 -
41725 -void RPHReferenceManager::ReferenceFromWebContents(
41726 - content::WebContents* contents) {
41727 - RenderProcessHost* rph = contents->GetMainFrame()->GetProcess();
41728 - if (!base::Contains(observer_map_, rph)) {
41729 - observer_map_[rph] = std::make_unique<RPHObserver>(this, rph);
41730 - }
41731 - observer_map_[rph]->AddWebContentsObserver(contents);
41732 -}
41733 -
41734 -RPHReferenceManager::RPHWebContentsObserver::RPHWebContentsObserver(
41735 - RPHReferenceManager* manager,
41736 - WebContents* web_contents)
41737 - : content::WebContentsObserver(web_contents),
41738 - manager_(manager) {
41739 -}
41740 -
41741 -void RPHReferenceManager::RPHWebContentsObserver::WebContentsDestroyed() {
41742 - manager_->OnWebContentsDestroyedOrNavigated(web_contents());
41743 -}
41744 -
41745 -void RPHReferenceManager::RPHWebContentsObserver::NavigationEntryCommitted(
41746 - const content::LoadCommittedDetails& load_details) {
41747 - if (load_details.is_same_document)
41748 - return;
41749 -
41750 - manager_->OnWebContentsDestroyedOrNavigated(web_contents());
41751 -}
41752 -
41753 -RPHReferenceManager::RPHObserver::RPHObserver(
41754 - RPHReferenceManager* manager, RenderProcessHost* host)
41755 - : manager_(manager),
41756 - host_(host) {
41757 - host->AddObserver(this);
41758 -}
41759 -
41760 -RPHReferenceManager::RPHObserver::~RPHObserver() {
41761 - observed_web_contentses_.clear();
41762 - if (host_)
41763 - host_->RemoveObserver(this);
41764 -}
41765 -
41766 -void RPHReferenceManager::RPHObserver::AddWebContentsObserver(
41767 - WebContents* web_contents) {
41768 - if (base::Contains(observed_web_contentses_, web_contents))
41769 - return;
41770 -
41771 - observed_web_contentses_[web_contents] =
41772 - std::make_unique<RPHWebContentsObserver>(manager_, web_contents);
41773 -}
41774 -
41775 -void RPHReferenceManager::RPHObserver::RemoveWebContentsObserver(
41776 - WebContents* web_contents) {
41777 - DCHECK(observed_web_contentses_.find(web_contents) !=
41778 - observed_web_contentses_.end());
41779 - observed_web_contentses_.erase(web_contents);
41780 -}
41781 -
41782 -void RPHReferenceManager::RPHObserver::RenderProcessHostDestroyed(
41783 - RenderProcessHost* host) {
41784 - host_ = nullptr;
41785 - manager_->OnRenderProcessHostDestroyed(host);
41786 -}
41787 -
41788 -void RPHReferenceManager::OnRenderProcessHostDestroyed(
41789 - RenderProcessHost* rph) {
41790 - auto rph_info = observer_map_.find(rph);
41791 - // This could be a potential problem if the RPH is navigated to a page on the
41792 - // same renderer (triggering OnWebContentsDestroyedOrNavigated()) and then the
41793 - // renderer crashes.
41794 - if (rph_info == observer_map_.end()) {
41795 - NOTREACHED();
41796 - return;
41797 - }
41798 - observer_map_.erase(rph_info);
41799 - if (observer_map_.empty())
41800 - std::move(no_references_callback_).Run();
41801 -}
41802 -
41803 -void RPHReferenceManager::OnWebContentsDestroyedOrNavigated(
41804 - WebContents* contents) {
41805 - RenderProcessHost* rph = contents->GetMainFrame()->GetProcess();
41806 - auto rph_info = observer_map_.find(rph);
41807 - DCHECK(rph_info != observer_map_.end());
41808 -
41809 - rph_info->second->RemoveWebContentsObserver(contents);
41810 - if (!rph_info->second->HasWebContentsObservers())
41811 - OnRenderProcessHostDestroyed(rph);
41812 -}
41817 @@ -283,8 +134,7 @@ MediaFileSystemInfo::~MediaFileSystemInfo() {}
41821 -class ExtensionGalleriesHost
41822 - : public base::RefCountedThreadSafe<ExtensionGalleriesHost> {
41827 @@ -296,9 +146,13 @@ class ExtensionGalleriesHost
41831 - no_references_callback_(std::move(no_references_callback)),
41832 - rph_refs_(base::BindRepeating(&ExtensionGalleriesHost::CleanUp,
41833 - base::Unretained(this))) {}
41838 + file_system_context_->RevokeFileSystem(it.second.fsid);
41844 @@ -322,8 +176,8 @@ class ExtensionGalleriesHost
41848 - this, base::Owned(device_ids), galleries, galleries_info,
41849 - std::move(callback)));
41855 @@ -338,8 +192,8 @@ class ExtensionGalleriesHost
41859 - this, base::Owned(device_ids), gallery,
41860 - std::move(callback)));
41866 @@ -352,7 +206,6 @@ class ExtensionGalleriesHost
41870 - rph_refs_.Reset();
41874 @@ -361,20 +214,24 @@ class ExtensionGalleriesHost
41878 - rph_refs_.ReferenceFromWebContents(web_contents);
41882 + web_contents->GetPrimaryPage(),
41888 + referring_page_count_--;
41897 - // Private destructor and friend declaration for ref counted implementation.
41898 - friend class base::RefCountedThreadSafe<ExtensionGalleriesHost>;
41899 -
41900 - virtual ~ExtensionGalleriesHost() {
41901 - DCHECK(rph_refs_.empty());
41902 - DCHECK(pref_id_map_.empty());
41903 - }
41904 -
41908 @@ -382,14 +239,6 @@ class ExtensionGalleriesHost
41912 - if (rph_refs_.empty()) {
41913 - // We're actually in the middle of shutdown, and Filter...() lagging
41914 - // which can invoke this method interleaved in the destruction callback
41915 - // sequence and re-populate pref_id_map_.
41916 - std::move(callback).Run(result);
41917 - return;
41918 - }
41919 -
41923 @@ -428,7 +277,6 @@ class ExtensionGalleriesHost
41927 - rph_refs_.Reset();
41931 @@ -442,10 +290,7 @@ class ExtensionGalleriesHost
41935 - // If rph_refs is empty then we're actually in the middle of shutdown, and
41936 - // Filter...() lagging which can invoke this method interleaved in the
41937 - // destruction callback sequence and re-populate pref_id_map_.
41938 - if (!attached_device->empty() && !rph_refs_.empty()) {
41939 + if (!attached_device->empty()) {
41943 @@ -469,7 +314,6 @@ class ExtensionGalleriesHost
41947 - rph_refs_.Reset();
41950 content::GetIOThreadTaskRunner({})->PostTask(
41951 @@ -484,14 +328,9 @@ class ExtensionGalleriesHost
41955 - DCHECK(rph_refs_.empty());
41956 - for (PrefIdFsInfoMap::const_iterator it = pref_id_map_.begin();
41957 - it != pref_id_map_.end();
41958 - ++it) {
41959 - file_system_context_->RevokeFileSystem(it->second.fsid);
41960 - }
41961 - pref_id_map_.clear();
41962 -
41969 @@ -511,9 +350,12 @@ class ExtensionGalleriesHost
41973 - // The set of render processes and web contents that may have references to
41974 - // the file system ids this instance manages.
41975 - RPHReferenceManager rph_refs_;
41985 @@ -524,8 +366,7 @@ void MediaFileSystemRegistry::GetMediaFileSystemsForExtension(
41989 - // TODO(tommycli): Change to DCHECK after fixing http://crbug.com/374330.
41990 - CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
41993 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
41995 @@ -811,14 +652,18 @@ ExtensionGalleriesHost* MediaFileSystemRegistry::GetExtensionGalleryHost(
41996 if (extension_hosts->second.empty())
41997 preferences->AddGalleryChangeObserver(this);
41999 - ExtensionGalleriesHost* result = extension_hosts->second[extension_id].get();
42000 - if (!result) {
42001 - result = new ExtensionGalleriesHost(
42002 - file_system_context_.get(), profile->GetPath(), extension_id,
42003 - base::BindOnce(&MediaFileSystemRegistry::OnExtensionGalleriesHostEmpty,
42004 - base::Unretained(this), profile, extension_id));
42005 - extension_hosts_map_[profile][extension_id] = result;
42006 + auto it = extension_hosts->second.find(extension_id);
42007 + if (it != extension_hosts->second.end()) {
42008 + return it->second.get();
42012 + file_system_context_.get(), profile->GetPath(), extension_id,
42017 + extension_hosts->second[extension_id] = std::move(new_host);
42021 diff --git a/src/chrome/browser/media_galleries/media_file_system_registry.h b/src/chrome/browser/m…
42023 --- a/src/chrome/browser/media_galleries/media_file_system_registry.h
42025 @@ -16,7 +16,6 @@
42029 -#include "base/memory/ref_counted.h"
42033 @@ -109,7 +108,8 @@ class MediaFileSystemRegistry
42037 - scoped_refptr<ExtensionGalleriesHost>> ExtensionHostMap;
42043 diff --git a/src/chrome/browser/metrics/chrome_metrics_service_client.cc b/src/chrome/browser/metri…
42045 --- a/src/chrome/browser/metrics/chrome_metrics_service_client.cc
42047 @@ -835,8 +835,10 @@ void ChromeMetricsServiceClient::RegisterMetricsServiceProviders() {
42048 metrics_service_->RegisterMetricsProvider(
42052 metrics_service_->RegisterMetricsProvider(
42057 metrics_service_->RegisterMetricsProvider(
42058 diff --git a/src/chrome/browser/net/profile_network_context_service.cc b/src/chrome/browser/net/pro…
42060 --- a/src/chrome/browser/net/profile_network_context_service.cc
42062 @@ -625,6 +625,10 @@ ProfileNetworkContextService::CreateClientCertStore() {
42073 diff --git a/src/chrome/browser/notifications/notification_display_service_impl.cc b/src/chrome/bro…
42075 --- a/src/chrome/browser/notifications/notification_display_service_impl.cc
42077 @@ -31,7 +31,7 @@
42081 - BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA)
42086 diff --git a/src/chrome/browser/offline_pages/android/offline_page_archive_publisher_impl.cc b/src/…
42088 --- a/src/chrome/browser/offline_pages/android/offline_page_archive_publisher_impl.cc
42090 @@ -21,6 +21,7 @@
42098 @@ -203,4 +204,9 @@ int OfflinePageArchivePublisherImpl::Delegate::Remove(
42108 diff --git a/src/chrome/browser/offline_pages/android/offline_page_archive_publisher_impl.h b/src/c…
42110 --- a/src/chrome/browser/offline_pages/android/offline_page_archive_publisher_impl.h
42112 @@ -7,11 +7,9 @@
42116 -#include "base/callback.h"
42120 -#include "components/offline_pages/core/offline_page_types.h"
42124 @@ -56,10 +54,12 @@ class OfflinePageArchivePublisherImpl : public OfflinePageArchivePublisher {
42137 diff --git a/src/chrome/browser/offline_pages/offline_page_utils.cc b/src/chrome/browser/offline_pa…
42139 --- a/src/chrome/browser/offline_pages/offline_page_utils.cc
42141 @@ -119,6 +119,7 @@ void DoCalculateSizeBetween(
42149 @@ -127,7 +128,9 @@ content::WebContents* GetWebContentsByFrameID(int render_process_id,
42159 @@ -144,6 +147,7 @@ content::WebContents::Getter GetWebContentsGetter(
42160 web_contents->GetMainFrame()->GetProcess()->GetID(),
42161 web_contents->GetMainFrame()->GetRoutingID());
42167 diff --git a/src/chrome/browser/password_manager/chrome_password_manager_client.cc b/src/chrome/bro…
42169 --- a/src/chrome/browser/password_manager/chrome_password_manager_client.cc
42171 @@ -263,10 +263,11 @@ void ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient(
42175 -
42177 contents->SetUserData(UserDataKey(),
42184 @@ -837,16 +838,22 @@ autofill::LanguageCode ChromePasswordManagerClient::GetPageLanguage() const {
42207 @@ -854,6 +861,7 @@ void ChromePasswordManagerClient::CheckSafeBrowsingReputation(
42208 web_contents(), web_contents()->GetLastCommittedURL(), form_action,
42209 frame_url, pps->GetAccountInfo().hosted_domain);
42215 @@ -863,6 +871,7 @@ void ChromePasswordManagerClient::CheckProtectedPasswordEntry(
42223 @@ -871,14 +880,18 @@ void ChromePasswordManagerClient::CheckProtectedPasswordEntry(
42224 pps->MaybeStartProtectedPasswordEntryRequest(
42225 web_contents(), web_contents()->GetLastCommittedURL(), username,
42236 pps->MaybeLogPasswordReuseDetectedEvent(web_contents());
42242 @@ -1375,6 +1388,7 @@ void ChromePasswordManagerClient::OnPaste() {
42250 @@ -1385,7 +1399,8 @@ void ChromePasswordManagerClient::OnPaste() {
42252 clipboard->ReadText(ui::ClipboardBuffer::kCopyPaste, &data_dst, &text);
42254 -
42260 @@ -1417,6 +1432,7 @@ void ChromePasswordManagerClient::OnInputEvent(
42268 @@ -1426,6 +1442,7 @@ void ChromePasswordManagerClient::OnInputEvent(
42276 @@ -1463,6 +1480,7 @@ bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage(
42284 @@ -1473,6 +1491,7 @@ bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage(
42285 observer->OnPasswordSaveOrAutofillDenied();
42290 if (log_manager_->IsLoggingActive()) {
42292 diff --git a/src/chrome/browser/password_manager/chrome_password_manager_client.h b/src/chrome/brow…
42294 --- a/src/chrome/browser/password_manager/chrome_password_manager_client.h
42296 @@ -206,6 +206,7 @@ class ChromePasswordManagerClient
42304 @@ -219,7 +220,8 @@ class ChromePasswordManagerClient
42308 - bool password_field_exists) override;
42314 diff --git a/src/chrome/browser/permissions/abusive_origin_permission_revocation_request.cc b/src/c…
42316 --- a/src/chrome/browser/permissions/abusive_origin_permission_revocation_request.cc
42318 @@ -17,7 +17,10 @@
42321 #include "components/safe_browsing/core/browser/db/database_manager.h"
42329 @@ -76,6 +79,7 @@ void SetOriginStatus(Profile* profile,
42336 ->GetSettingsMap(profile)
42337 @@ -91,6 +95,7 @@ void RevokePermission(const GURL& origin, Profile* profile) {
42345 @@ -136,6 +141,7 @@ void AbusiveOriginPermissionRevocationRequest::CheckAndRevokeIfAbusive() {
42351 !safe_browsing::IsSafeBrowsingEnabled(*profile_->GetPrefs()) ||
42353 @@ -169,6 +175,7 @@ void AbusiveOriginPermissionRevocationRequest::OnSiteReputationReady(
42355 site_reputation->notification_ux_quality() ==
42358 DCHECK(g_browser_process->safe_browsing_service());
42360 if (g_browser_process->safe_browsing_service()) {
42361 @@ -180,12 +187,15 @@ void AbusiveOriginPermissionRevocationRequest::OnSiteReputationReady(
42377 @@ -196,6 +206,7 @@ void AbusiveOriginPermissionRevocationRequest::OnSafeBrowsingVerdictReceived(
42385 diff --git a/src/chrome/browser/permissions/abusive_origin_permission_revocation_request.h b/src/ch…
42387 --- a/src/chrome/browser/permissions/abusive_origin_permission_revocation_request.h
42389 @@ -10,6 +10,7 @@
42394 #include "third_party/abseil-cpp/absl/types/optional.h"
42397 @@ -64,8 +65,9 @@ class AbusiveOriginPermissionRevocationRequest {
42401 -
42408 diff --git a/src/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc b/src…
42410 --- a/src/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
42412 @@ -21,6 +21,7 @@
42417 #include "components/safe_browsing/core/browser/db/database_manager.h"
42420 @@ -108,6 +109,7 @@ absl::optional<Decision> GetDecisionBasedOnSiteReputation(
42428 @@ -127,6 +129,7 @@ bool ShouldHoldBackQuietUI(QuietUiReason quiet_ui_reason) {
42436 @@ -151,9 +154,11 @@ void ContextualNotificationPermissionUiSelector::SelectUiToUse(
42448 @@ -183,9 +188,11 @@ void ContextualNotificationPermissionUiSelector::OnSiteReputationReady(
42450 if (!decision || (!decision->quiet_ui_reason && !decision->warning_reason)) {
42452 - return;
42459 DCHECK(g_browser_process->safe_browsing_service());
42461 @@ -197,11 +204,13 @@ void ContextualNotificationPermissionUiSelector::OnSiteReputationReady(
42475 @@ -219,6 +228,7 @@ void ContextualNotificationPermissionUiSelector::OnSafeBrowsingVerdictReceived(
42483 diff --git a/src/chrome/browser/permissions/contextual_notification_permission_ui_selector.h b/src/…
42485 --- a/src/chrome/browser/permissions/contextual_notification_permission_ui_selector.h
42487 @@ -9,6 +9,7 @@
42492 #include "third_party/abseil-cpp/absl/types/optional.h"
42495 @@ -59,8 +60,9 @@ class ContextualNotificationPermissionUiSelector
42499 -
42506 diff --git a/src/chrome/browser/permissions/prediction_based_permission_ui_selector.cc b/src/chrome…
42508 --- a/src/chrome/browser/permissions/prediction_based_permission_ui_selector.cc
42510 @@ -26,6 +26,7 @@
42518 @@ -307,10 +308,11 @@ bool PredictionBasedPermissionUiSelector::ShouldHoldBack(
42523 if (!safe_browsing::IsSafeBrowsingEnabled(*(profile_->GetPrefs()))) {
42526 -
42531 diff --git a/src/chrome/browser/platform_util_linux.cc b/src/chrome/browser/platform_util_linux.cc
42533 --- a/src/chrome/browser/platform_util_linux.cc
42535 @@ -25,14 +25,18 @@
42551 #include "third_party/abseil-cpp/absl/types/optional.h"
42554 @@ -42,6 +46,7 @@ namespace platform_util {
42562 @@ -55,6 +60,7 @@ const char kFreedesktopPortalPath[] = "/org/freedesktop/portal/desktop";
42570 @@ -76,14 +82,17 @@ class ShowItemHelper : public content::NotificationObserver {
42577 bus_->ShutdownOnDBusThreadAndBlock();
42586 // Sets up the D-Bus connection.
42588 @@ -109,9 +118,11 @@ class ShowItemHelper : public content::NotificationObserver {
42600 @@ -277,13 +288,13 @@ class ShowItemHelper : public content::NotificationObserver {
42604 -
42607 -
42612 -
42617 diff --git a/src/chrome/browser/plugins/plugins_resource_service.cc b/src/chrome/browser/plugins/pl…
42619 --- a/src/chrome/browser/plugins/plugins_resource_service.cc
42621 @@ -66,6 +66,8 @@ GURL GetPluginsServerURL() {
42630 diff --git a/src/chrome/browser/policy/BUILD.gn b/src/chrome/browser/policy/BUILD.gn
42632 --- a/src/chrome/browser/policy/BUILD.gn
42634 @@ -10,7 +10,7 @@ import("//extensions/buildflags/buildflags.gni")
42638 - if (is_chromeos || is_linux) {
42643 diff --git a/src/chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc b/src/…
42645 --- a/src/chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc
42647 @@ -46,7 +46,7 @@
42651 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
42656 @@ -88,7 +88,7 @@ void ChromeBrowserCloudManagementControllerDesktop::
42660 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
42665 diff --git a/src/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/src/chrome/b…
42667 --- a/src/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
42669 @@ -311,7 +311,9 @@ void ChromeBrowserMainExtraPartsProfiles::
42679 @@ -518,7 +520,9 @@ void ChromeBrowserMainExtraPartsProfiles::
42689 diff --git a/src/chrome/browser/profiles/profile_impl.cc b/src/chrome/browser/profiles/profile_impl…
42691 --- a/src/chrome/browser/profiles/profile_impl.cc
42693 @@ -628,6 +628,7 @@ void ProfileImpl::LoadPrefsForNormalStartup(bool async_prefs) {
42699 g_browser_process->safe_browsing_service());
42701 @@ -639,6 +640,7 @@ void ProfileImpl::LoadPrefsForNormalStartup(bool async_prefs) {
42709 diff --git a/src/chrome/browser/profiles/profiles_state.cc b/src/chrome/browser/profiles/profiles_s…
42711 --- a/src/chrome/browser/profiles/profiles_state.cc
42713 @@ -250,6 +250,7 @@ void UpdateGaiaProfileInfoIfNeeded(Profile* profile) {
42721 @@ -266,6 +267,7 @@ void RemoveBrowsingDataForProfile(const base::FilePath& profile_path) {
42722 profile = profile->GetPrimaryOTRProfile(/*create_if_needed=*/true);
42724 profile->Wipe();
42729 diff --git a/src/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc b/src/chrome/br…
42731 --- a/src/chrome/browser/renderer_context_menu/link_to_text_menu_observer.cc
42733 @@ -73,7 +73,7 @@ std::vector<std::string> GetAggregatedSelectors(
42737 - content::RenderFrameHost* render_frame_host) {
42740 content::WebContents* web_contents = proxy->GetWebContents();
42742 @@ -83,16 +83,16 @@ std::unique_ptr<LinkToTextMenuObserver> LinkToTextMenuObserver::Create(
42746 - DCHECK(render_frame_host);
42747 - return base::WrapUnique(new LinkToTextMenuObserver(proxy, render_frame_host));
42755 - content::RenderFrameHost* render_frame_host) {
42756 - proxy_ = proxy;
42757 - render_frame_host_ = render_frame_host;
42758 -}
42765 @@ -237,10 +237,12 @@ void LinkToTextMenuObserver::StartLinkGenerationRequestWithTimeout() {
42772 - !render_frame_host_->GetBrowserContext()->IsOffTheRecord()
42773 + !rfh->GetBrowserContext()->IsOffTheRecord()
42775 - render_frame_host_->GetMainFrame()->GetLastCommittedOrigin())
42776 + rfh->GetLastCommittedOrigin())
42780 @@ -258,12 +260,16 @@ void LinkToTextMenuObserver::CopyLinkToClipboard() {
42784 - DCHECK(remote_.is_bound());
42785 - DCHECK(remote_.is_connected());
42786 - if (is_generation_complete_)
42787 - return;
42788 - remote_->Cancel();
42789 - remote_.reset();
42793 + if (rfh && rfh->IsRenderFrameLive()) {
42797 + remote_->Cancel();
42803 @@ -327,10 +333,12 @@ void LinkToTextMenuObserver::ReshareLink() {
42810 - !render_frame_host_->GetBrowserContext()->IsOffTheRecord()
42811 + !rfh->GetBrowserContext()->IsOffTheRecord()
42813 - render_frame_host_->GetMainFrame()->GetLastCommittedOrigin())
42814 + rfh->GetLastCommittedOrigin())
42818 @@ -357,7 +365,9 @@ void LinkToTextMenuObserver::RemoveHighlights() {
42822 - render_frame_host_->GetRemoteInterfaces()->GetInterface(
42825 + rfh->GetRemoteInterfaces()->GetInterface(
42829 diff --git a/src/chrome/browser/renderer_context_menu/link_to_text_menu_observer.h b/src/chrome/bro…
42831 --- a/src/chrome/browser/renderer_context_menu/link_to_text_menu_observer.h
42833 @@ -21,7 +21,7 @@ class LinkToTextMenuObserver : public RenderViewContextMenuObserver {
42837 - content::RenderFrameHost* render_frame_host);
42842 @@ -40,8 +40,9 @@ class LinkToTextMenuObserver : public RenderViewContextMenuObserver {
42846 - explicit LinkToTextMenuObserver(RenderViewContextMenuProxy* proxy,
42847 - content::RenderFrameHost* render_frame_host);
42854 @@ -91,7 +92,7 @@ class LinkToTextMenuObserver : public RenderViewContextMenuObserver {
42858 - raw_ptr<content::RenderFrameHost> render_frame_host_;
42863 diff --git a/src/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest…
42865 --- a/src/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest.cc
42867 @@ -27,7 +27,7 @@ class MockLinkToTextMenuObserver : public LinkToTextMenuObserver {
42871 - content::RenderFrameHost* render_frame_host) {
42874 content::WebContents* web_contents = proxy->GetWebContents();
42876 @@ -37,13 +37,12 @@ class MockLinkToTextMenuObserver : public LinkToTextMenuObserver {
42880 - DCHECK(render_frame_host);
42882 - new MockLinkToTextMenuObserver(proxy, render_frame_host));
42886 - content::RenderFrameHost* render_frame_host)
42887 - : LinkToTextMenuObserver(proxy, render_frame_host) {}
42893 @@ -104,7 +103,7 @@ class LinkToTextMenuObserverTest : public extensions::ExtensionBrowserTest {
42897 - MockLinkToTextMenuObserver::Create(menu_.get(), getRenderFrameHost());
42899 menu_->SetObserver(observer_.get());
42902 @@ -120,9 +119,9 @@ class LinkToTextMenuObserverTest : public extensions::ExtensionBrowserTest {
42906 - content::RenderFrameHost* getRenderFrameHost() {
42908 auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents();
42909 - return web_contents->GetMainFrame();
42910 + return web_contents->GetMainFrame()->GetGlobalId();
42914 @@ -267,7 +266,7 @@ IN_PROC_BROWSER_TEST_F(LinkToTextMenuObserverTest, HiddenForExtensions) {
42915 menu()->set_web_contents(web_contents);
42918 - MockLinkToTextMenuObserver::Create(menu(), getRenderFrameHost());
42923 diff --git a/src/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/src/chrome/brow…
42925 --- a/src/chrome/browser/renderer_context_menu/render_view_context_menu.cc
42927 @@ -1801,8 +1801,9 @@ void RenderViewContextMenu::AppendLinkToTextItems() {
42931 - link_to_text_menu_observer_ =
42932 - LinkToTextMenuObserver::Create(this, GetRenderFrameHost());
42938 link_to_text_menu_observer_->InitMenu(params_);
42939 diff --git a/src/chrome/browser/reputation/reputation_service.cc b/src/chrome/browser/reputation/re…
42941 --- a/src/chrome/browser/reputation/reputation_service.cc
42943 @@ -28,6 +28,10 @@
42954 @@ -119,6 +123,7 @@ void ReputationService::GetReputationStatus(const GURL& url,
42962 @@ -136,6 +141,7 @@ void ReputationService::GetReputationStatus(const GURL& url,
42965 service->GetLatestEngagedSites());
42970 diff --git a/src/chrome/browser/resources/BUILD.gn b/src/chrome/browser/resources/BUILD.gn
42972 --- a/src/chrome/browser/resources/BUILD.gn
42974 @@ -76,7 +76,8 @@ group("resources") {
42978 - if (is_win || is_mac || is_linux || is_chromeos_lacros || is_fuchsia) {
42984 diff --git a/src/chrome/browser/resources/browser_switch/BUILD.gn b/src/chrome/browser/resources/br…
42986 --- a/src/chrome/browser/resources/browser_switch/BUILD.gn
42988 @@ -8,7 +8,8 @@ import("//tools/polymer/html_to_js.gni")
42992 -assert(is_win || is_mac || is_linux || is_chromeos_lacros || is_fuchsia)
42998 diff --git a/src/chrome/browser/resources/settings/controls/extension_controlled_indicator.html b/s…
43000 --- a/src/chrome/browser/resources/settings/controls/extension_controlled_indicator.html
43002 @@ -11,6 +11,18 @@
43003 margin-inline-end: 16px;
43006 + iron-icon[icon='cr:open-in-new'] {
43007 + fill: var(--text-color);
43008 + height: var(--cr-icon-size);
43009 + margin-inline-end: -10px;
43010 + margin-inline-start: 6px;
43011 + width: var(--cr-icon-size);
43015 + margin-inline-start: 8px;
43021 @@ -20,7 +32,11 @@
43024 <img role="presentation" src="chrome://extension-icon/[[extensionId]]/20/1">
43025 -<span inner-h-t-m-l="[[getLabel_(extensionId, extensionName)]]"></span>
43027 +<cr-button id="manage" on-click="onManageClick_">
43029 + <iron-icon icon="cr:open-in-new"></iron-icon>
43030 +</cr-button>
43031 <template is="dom-if" if="[[extensionCanBeDisabled]]" restamp>
43032 - <cr-button on-click="onDisableTap_">$i18n{disable}</cr-button>
43033 + <cr-button id="disable" on-click="onDisableClick_">$i18n{disable}</cr-button>
43035 diff --git a/src/chrome/browser/resources/tab_search/BUILD.gn b/src/chrome/browser/resources/tab_se…
43037 --- a/src/chrome/browser/resources/tab_search/BUILD.gn
43039 @@ -11,7 +11,7 @@ import("//tools/typescript/ts_library.gni")
43043 -assert(is_linux || is_chromeos || is_win || is_mac || is_fuchsia)
43048 diff --git a/src/chrome/browser/safe_browsing/BUILD.gn b/src/chrome/browser/safe_browsing/BUILD.gn
43050 --- a/src/chrome/browser/safe_browsing/BUILD.gn
43052 @@ -14,6 +14,13 @@ static_library("safe_browsing") {
43057 + sources -= [
43066 @@ -400,6 +407,11 @@ static_library("safe_browsing") {
43072 + deps -=
43078 diff --git a/src/chrome/browser/safe_browsing/chrome_password_protection_service.h b/src/chrome/bro…
43080 --- a/src/chrome/browser/safe_browsing/chrome_password_protection_service.h
43082 @@ -217,8 +217,13 @@ class ChromePasswordProtectionService : public PasswordProtectionService,
43096 diff --git a/src/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/src/chrome/brow…
43098 --- a/src/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
43100 @@ -145,6 +145,7 @@ const char kEmptyPage[] = "/empty.html";
43108 @@ -530,6 +531,16 @@ class SafeBrowsingBlockingPageBrowserTest
43109 ->AddDangerousUrl(url, threat_type);
43118 + service->database_manager().get())
43119 + ->AddDangerousUrlPattern(url, threat_pattern_type);
43125 @@ -1859,6 +1870,49 @@ IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageBrowserTest,
43126 EXPECT_EQ(bad_url, contents->GetLastCommittedURL());
43132 + GURL url = embedded_test_server()->GetURL(kCrossSiteMaliciousEmbedPage);
43133 + GURL embed_url = embedded_test_server()->GetURL(kMaliciousIframe);
43139 + WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
43141 + content::WaitForRenderFrameReady(contents->GetMainFrame()));
43150 + GURL url = embedded_test_server()->GetURL(kMaliciousJsPage);
43151 + GURL js_url = embedded_test_server()->GetURL(kMaliciousJs);
43159 + WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
43161 + content::WaitForRenderFrameReady(contents->GetMainFrame()));
43175 diff --git a/src/chrome/browser/safe_browsing/url_checker_delegate_impl.cc b/src/chrome/browser/saf…
43177 --- a/src/chrome/browser/safe_browsing/url_checker_delegate_impl.cc
43179 @@ -52,6 +52,7 @@ void DestroyNoStatePrefetchContents(
43187 @@ -77,6 +78,7 @@ void CreateSafeBrowsingUserInteractionObserver(
43195 @@ -113,10 +115,12 @@ void UrlCheckerDelegateImpl::StartDisplayingBlockingPageHelper(
43200 content::GetUIThreadTaskRunner({})->PostTask(
43208 @@ -124,9 +128,11 @@ void UrlCheckerDelegateImpl::
43213 content::GetUIThreadTaskRunner({})->PostTask(
43220 diff --git a/src/chrome/browser/safe_browsing/url_lookup_service_factory.cc b/src/chrome/browser/sa…
43222 --- a/src/chrome/browser/safe_browsing/url_lookup_service_factory.cc
43224 @@ -59,6 +59,7 @@ RealTimeUrlLookupServiceFactory::RealTimeUrlLookupServiceFactory()
43229 if (!g_browser_process->safe_browsing_service()) {
43232 @@ -81,6 +82,9 @@ KeyedService* RealTimeUrlLookupServiceFactory::BuildServiceInstanceFor(
43233 profile->IsOffTheRecord(), g_browser_process->variations_service(),
43242 diff --git a/src/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc b/src/chrome/brow…
43244 --- a/src/chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc
43246 @@ -63,7 +63,7 @@ ReceivingUiHandlerRegistry::GetToolbarButtonControllerForProfile(
43250 -#elif BUILDFLAG(IS_ANDROID)
43255 diff --git a/src/chrome/browser/serial/chrome_serial_delegate.cc b/src/chrome/browser/serial/chrome…
43257 --- a/src/chrome/browser/serial/chrome_serial_delegate.cc
43259 @@ -32,9 +32,14 @@ std::unique_ptr<content::SerialChooser> ChromeSerialDelegate::RunChooser(
43274 diff --git a/src/chrome/browser/site_isolation/chrome_site_per_process_browsertest.cc b/src/chrome/…
43276 --- a/src/chrome/browser/site_isolation/chrome_site_per_process_browsertest.cc
43278 @@ -1572,4 +1572,50 @@ IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, TestInitialDSFForOOPIF) {
43288 + GURL main_url(embedded_test_server()->GetURL(
43292 + browser()->tab_strip_model()->GetActiveWebContents();
43295 + const std::string no_op_script = "// No-op script";
43304 + GURL popup_url(embedded_test_server()->GetURL("popup.com", "/"));
43320 + EXPECT_EQ(2, browser()->tab_strip_model()->count());
43323 + browser()->tab_strip_model()->GetActiveWebContents();
43324 + EXPECT_EQ(embedded_test_server()->GetURL("popup.com", "/title1.html"),
43325 + popup->GetLastCommittedURL());
43329 diff --git a/src/chrome/browser/ssl/chrome_security_blocking_page_factory.cc b/src/chrome/browser/s…
43331 --- a/src/chrome/browser/ssl/chrome_security_blocking_page_factory.cc
43333 @@ -99,6 +99,7 @@ bool IsEnterpriseManaged() {
43341 @@ -113,6 +114,9 @@ void OpenLoginPage(content::WebContents* web_contents) {
43351 diff --git a/src/chrome/browser/ssl/sct_reporting_service_factory.cc b/src/chrome/browser/ssl/sct_r…
43353 --- a/src/chrome/browser/ssl/sct_reporting_service_factory.cc
43355 @@ -32,6 +32,7 @@ SCTReportingServiceFactory::~SCTReportingServiceFactory() = default;
43361 g_browser_process->safe_browsing_service();
43363 @@ -41,6 +42,9 @@ KeyedService* SCTReportingServiceFactory::BuildServiceInstanceFor(
43373 diff --git a/src/chrome/browser/ssl/security_state_tab_helper.cc b/src/chrome/browser/ssl/security_…
43375 --- a/src/chrome/browser/ssl/security_state_tab_helper.cc
43377 @@ -184,6 +184,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
43378 web_contents()->GetController().GetVisibleEntry();
43383 g_browser_process->safe_browsing_service();
43385 @@ -264,6 +265,9 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
43395 diff --git a/src/chrome/browser/subresource_filter/chrome_content_subresource_filter_web_contents_h…
43397 --- a/src/chrome/browser/subresource_filter/chrome_content_subresource_filter_web_contents_helper_f…
43399 @@ -18,10 +18,14 @@ namespace {
43407 g_browser_process->safe_browsing_service();
43408 return safe_browsing_service ? safe_browsing_service->database_manager()
43414 diff --git a/src/chrome/browser/ui/BUILD.gn b/src/chrome/browser/ui/BUILD.gn
43416 --- a/src/chrome/browser/ui/BUILD.gn
43418 @@ -667,6 +667,11 @@ static_library("ui") {
43423 + deps -=
43430 @@ -1776,7 +1781,7 @@ static_library("ui") {
43434 - if (!toolkit_views) {
43439 @@ -3191,7 +3196,7 @@ static_library("ui") {
43443 - if (is_win || is_mac || is_linux || is_chromeos || is_fuchsia) {
43448 @@ -3269,7 +3274,7 @@ static_library("ui") {
43452 - if (is_win || is_mac || is_fuchsia || is_linux) {
43457 @@ -3280,7 +3285,8 @@ static_library("ui") {
43461 - if (is_win || is_mac || is_fuchsia || (is_linux || is_chromeos_lacros)) {
43467 @@ -3351,7 +3357,7 @@ static_library("ui") {
43471 - if (enable_dice_support) {
43476 @@ -3745,7 +3751,7 @@ static_library("ui") {
43480 - if (is_linux || is_chromeos_lacros || is_mac) {
43485 @@ -3753,7 +3759,7 @@ static_library("ui") {
43489 - if (is_linux) {
43494 @@ -3770,7 +3776,7 @@ static_library("ui") {
43498 - if (is_linux || is_chromeos_lacros) {
43503 @@ -3810,6 +3816,15 @@ static_library("ui") {
43519 @@ -3856,7 +3871,7 @@ static_library("ui") {
43523 - if (toolkit_views) {
43528 @@ -4141,6 +4156,8 @@ static_library("ui") {
43537 @@ -4845,7 +4862,7 @@ static_library("ui") {
43541 - if (is_linux || is_chromeos_lacros) {
43546 @@ -4859,11 +4876,11 @@ static_library("ui") {
43550 - if (is_linux || is_chromeos) {
43555 - if (is_linux) {
43560 @@ -4922,7 +4939,7 @@ static_library("ui") {
43564 - if (is_win || is_fuchsia || (is_linux || is_chromeos_lacros)) {
43569 diff --git a/src/chrome/browser/ui/apps/chrome_app_window_client.cc b/src/chrome/browser/ui/apps/ch…
43571 --- a/src/chrome/browser/ui/apps/chrome_app_window_client.cc
43573 @@ -73,7 +73,7 @@ ChromeAppWindowClient::CreateAppWindowForLockScreenAction(
43577 -#if BUILDFLAG(IS_ANDROID)
43582 diff --git a/src/chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.cc b/src/chrome…
43584 --- a/src/chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.cc
43586 @@ -41,11 +41,15 @@ void WebDragBookmarkHandlerAura::OnDragOver() {
43591 if (bookmark_tab_helper_ && bookmark_tab_helper_->bookmark_drag_delegate()) {
43602 diff --git a/src/chrome/browser/ui/bookmarks/bookmark_utils.cc b/src/chrome/browser/ui/bookmarks/bo…
43604 --- a/src/chrome/browser/ui/bookmarks/bookmark_utils.cc
43606 @@ -37,7 +37,7 @@
43610 -#if defined(TOOLKIT_VIEWS)
43615 @@ -58,7 +58,7 @@ using ::bookmarks::BookmarkModel;
43619 -#if defined(TOOLKIT_VIEWS)
43624 @@ -272,7 +272,7 @@ bool IsValidBookmarkDropLocation(Profile* profile,
43628 -#if defined(TOOLKIT_VIEWS)
43633 diff --git a/src/chrome/browser/ui/bookmarks/bookmark_utils.h b/src/chrome/browser/ui/bookmarks/boo…
43635 --- a/src/chrome/browser/ui/bookmarks/bookmark_utils.h
43637 @@ -98,7 +98,7 @@ bool IsValidBookmarkDropLocation(Profile* profile,
43641 -#if defined(TOOLKIT_VIEWS)
43646 diff --git a/src/chrome/browser/ui/browser_commands.cc b/src/chrome/browser/ui/browser_commands.cc
43648 --- a/src/chrome/browser/ui/browser_commands.cc
43650 @@ -1799,7 +1799,7 @@ void ToggleCommander(Browser* browser) {
43651 commander::Commander::Get()->ToggleForBrowser(browser);
43654 -#if !defined(TOOLKIT_VIEWS)
43659 diff --git a/src/chrome/browser/ui/browser_dialogs.cc b/src/chrome/browser/ui/browser_dialogs.cc
43661 --- a/src/chrome/browser/ui/browser_dialogs.cc
43663 @@ -18,7 +18,7 @@ void RecordDialogCreation(DialogIdentifier identifier) {
43667 -#if !defined(TOOLKIT_VIEWS)
43672 @@ -31,7 +31,7 @@ void ShowWindowNamePromptForTesting(Browser* browser,
43676 -#if !defined(TOOLKIT_VIEWS)
43681 diff --git a/src/chrome/browser/ui/browser_dialogs.h b/src/chrome/browser/ui/browser_dialogs.h
43683 --- a/src/chrome/browser/ui/browser_dialogs.h
43685 @@ -284,7 +284,7 @@ void HideTaskManagerViews();
43689 -#if defined(TOOLKIT_VIEWS)
43692 // Creates a toolkit-views based LoginHandler (e.g. HTTP-Auth dialog).
43694 diff --git a/src/chrome/browser/ui/file_system_access_dialogs.cc b/src/chrome/browser/ui/file_syste…
43696 --- a/src/chrome/browser/ui/file_system_access_dialogs.cc
43698 @@ -6,7 +6,7 @@
43702 -#if !defined(TOOLKIT_VIEWS)
43707 @@ -20,14 +20,27 @@ void ShowFileSystemAccessRestrictedDirectoryDialog(
43711 - base::OnceCallback<void(
43712 - content::FileSystemAccessPermissionContext::SensitiveDirectoryResult)>
43719 - std::move(callback).Run(content::FileSystemAccessPermissionContext::
43720 - SensitiveDirectoryResult::kAbort);
43739 diff --git a/src/chrome/browser/ui/file_system_access_dialogs.h b/src/chrome/browser/ui/file_system…
43741 --- a/src/chrome/browser/ui/file_system_access_dialogs.h
43743 @@ -42,8 +42,19 @@ void ShowFileSystemAccessRestrictedDirectoryDialog(
43747 - base::OnceCallback<void(
43748 - content::FileSystemAccessPermissionContext::SensitiveDirectoryResult)>
43765 diff --git a/src/chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_…
43767 --- a/src/chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop…
43769 @@ -16,6 +16,7 @@
43777 @@ -36,6 +37,8 @@ JavaScriptTabModalDialogManagerDelegateDesktop::
43786 @@ -46,6 +49,7 @@ void JavaScriptTabModalDialogManagerDelegateDesktop::WillRunDialog() {
43788 observer->OnJavaScriptDialog();
43794 diff --git a/src/chrome/browser/ui/page_info/chrome_page_info_delegate.cc b/src/chrome/browser/ui/p…
43796 --- a/src/chrome/browser/ui/page_info/chrome_page_info_delegate.cc
43798 @@ -187,11 +187,13 @@ void ChromePageInfoDelegate::OpenCookiesDialog() {
43803 gfx::NativeWindow top_window = web_contents_->GetTopLevelNativeWindow();
43812 diff --git a/src/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc b/src/chrom…
43814 --- a/src/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
43816 @@ -14,12 +14,14 @@
43825 #include "third_party/abseil-cpp/absl/types/optional.h"
43831 @@ -153,3 +155,16 @@ void HandleOnPerformDrop(
43848 diff --git a/src/chrome/browser/ui/tab_helpers.cc b/src/chrome/browser/ui/tab_helpers.cc
43850 --- a/src/chrome/browser/ui/tab_helpers.cc
43852 @@ -178,7 +178,7 @@
43856 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
43861 @@ -360,6 +360,7 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
43869 @@ -376,6 +377,7 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
43877 diff --git a/src/chrome/browser/ui/tabs/tab_group_model.cc b/src/chrome/browser/ui/tabs/tab_group_m…
43879 --- a/src/chrome/browser/ui/tabs/tab_group_model.cc
43881 @@ -25,6 +25,10 @@ TabGroupModel::~TabGroupModel() {}
43885 + // The tab group must not already exist - replacing the old group without
43892 diff --git a/src/chrome/browser/ui/toolbar/media_router_action_controller.cc b/src/chrome/browser/u…
43894 --- a/src/chrome/browser/ui/toolbar/media_router_action_controller.cc
43896 @@ -22,9 +22,7 @@ MediaRouterActionController::MediaRouterActionController(Profile* profile)
43900 -MediaRouterActionController::~MediaRouterActionController() {
43901 - DCHECK_EQ(dialog_count_, 0u);
43902 -}
43907 diff --git a/src/chrome/browser/ui/views/BUILD.gn b/src/chrome/browser/ui/views/BUILD.gn
43909 --- a/src/chrome/browser/ui/views/BUILD.gn
43911 @@ -6,7 +6,7 @@ import("//build/config/chromeos/ui_mode.gni")
43915 -assert(toolkit_views)
43920 diff --git a/src/chrome/browser/ui/views/certificate_selector.cc b/src/chrome/browser/ui/views/cert…
43922 --- a/src/chrome/browser/ui/views/certificate_selector.cc
43924 @@ -277,8 +277,12 @@ void CertificateSelector::ViewCertButtonPressed() {
43929 ShowCertificateViewer(web_contents_, web_contents_->GetTopLevelNativeWindow(),
43930 cert->certificate());
43937 diff --git a/src/chrome/browser/ui/views/chrome_views_delegate.h b/src/chrome/browser/ui/views/chro…
43939 --- a/src/chrome/browser/ui/views/chrome_views_delegate.h
43941 @@ -51,7 +51,7 @@ class ChromeViewsDelegate : public views::ViewsDelegate {
43944 // of lacros-chrome is complete.
43945 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
43950 diff --git a/src/chrome/browser/ui/views/close_bubble_on_tab_activation_helper.cc b/src/chrome/brow…
43952 --- a/src/chrome/browser/ui/views/close_bubble_on_tab_activation_helper.cc
43954 @@ -18,7 +18,8 @@ CloseBubbleOnTabActivationHelper::CloseBubbleOnTabActivationHelper(
43958 - browser_->tab_strip_model()->RemoveObserver(this);
43960 + browser_->tab_strip_model()->RemoveObserver(this);
43964 @@ -35,3 +36,10 @@ void CloseBubbleOnTabActivationHelper::OnTabStripModelChanged(
43972 + browser_->tab_strip_model()->RemoveObserver(this);
43975 diff --git a/src/chrome/browser/ui/views/close_bubble_on_tab_activation_helper.h b/src/chrome/brows…
43977 --- a/src/chrome/browser/ui/views/close_bubble_on_tab_activation_helper.h
43979 @@ -37,6 +37,7 @@ class CloseBubbleOnTabActivationHelper : public TabStripModelObserver {
43987 diff --git a/src/chrome/browser/ui/views/download/download_danger_prompt_views.cc b/src/chrome/brow…
43989 --- a/src/chrome/browser/ui/views/download/download_danger_prompt_views.cc
43991 @@ -303,11 +303,13 @@ void DownloadDangerPromptViews::RunDone(Action action) {
43992 if (!download_->GetURL().is_empty() &&
43994 ->IsOffTheRecord()) {
44004 download_->RemoveObserver(this);
44005 diff --git a/src/chrome/browser/ui/views/download/download_item_view.cc b/src/chrome/browser/ui/vie…
44007 --- a/src/chrome/browser/ui/views/download/download_item_view.cc
44009 @@ -838,11 +838,18 @@ void DownloadItemView::UpdateLabels() {
44010 deep_scanning_label_->SetVisible(mode_ ==
44012 if (deep_scanning_label_->GetVisible()) {
44013 - const int id = (model_->download() &&
44014 - safe_browsing::DeepScanningRequest::ShouldUploadBinary(
44015 - model_->download()))
44016 - ? IDS_PROMPT_DEEP_SCANNING_DOWNLOAD
44017 - : IDS_PROMPT_DEEP_SCANNING_APP_DOWNLOAD;
44020 + id = (model_->download() &&
44022 + model_->download()))
44026 + id = model_->download() ? IDS_PROMPT_DEEP_SCANNING_DOWNLOAD
44032 deep_scanning_label_->SetText(
44033 @@ -887,13 +894,17 @@ void DownloadItemView::UpdateButtons() {
44040 model_->profile())
44041 ->DelayUntilVerdict(
44043 - open_button_->SetEnabled((mode_ == download::DownloadItemMode::kNormal) ||
44044 - prompt_to_scan || allow_open_during_deep_scan);
44045 + open_button_->SetEnabled((mode_ == Mode::kNormal) || prompt_to_scan ||
44051 open_now_button_->SetVisible(allow_open_during_deep_scan);
44053 @@ -1433,7 +1444,9 @@ void DownloadItemView::ShowContextMenuImpl(const gfx::Rect& rect,
44058 model_->CompleteSafeBrowsingScan();
44060 model_->SetOpenWhenComplete(true);
44063 diff --git a/src/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc b/src/chrome/browser/u…
44065 --- a/src/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
44067 @@ -2084,4 +2084,75 @@ INSTANTIATE_TEST_SUITE_P(
44080 + browser_view->toolbar()->location_bar()->omnibox_view();
44103 + if (browser()->tab_strip_model()->count() == 1) {
44110 + ->tab_strip_model()
44111 + ->GetActiveWebContents()
44112 + ->GetContainerBounds();
44122 + EXPECT_EQ(1, browser()->tab_strip_model()->count());
44127 + browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(),
44133 + EXPECT_EQ(2, browser()->tab_strip_model()->count());
44139 + EXPECT_EQ(1, browser()->tab_strip_model()->count());
44143 diff --git a/src/chrome/browser/ui/views/file_system_access/file_system_access_browsertest.cc b/src…
44145 --- a/src/chrome/browser/ui/views/file_system_access/file_system_access_browsertest.cc
44147 @@ -413,7 +413,8 @@ IN_PROC_BROWSER_TEST_F(FileSystemAccessBrowserSlowLoadTest, WaitUntilLoaded) {
44151 - const base::FilePath test_file = temp_dir_.GetPath().AppendASCII("test.exe");
44157 @@ -444,9 +445,9 @@ IN_PROC_BROWSER_TEST_F(FileSystemAccessBrowserTest, SafeBrowsing) {
44158 EXPECT_EQ(request->url(), expected_url);
44159 EXPECT_EQ(request->digests().sha256(), expected_hash);
44160 EXPECT_EQ(request->length(), 3);
44161 - EXPECT_EQ(request->file_basename(), "test.exe");
44162 + EXPECT_EQ(request->file_basename(), file_name);
44163 EXPECT_EQ(request->download_type(),
44164 - ClientDownloadRequest::WIN_EXECUTABLE);
44167 ASSERT_GE(request->resources_size(), 2);
44169 diff --git a/src/chrome/browser/ui/views/file_system_access/file_system_access_dangerous_file_dialo…
44172 --- /dev/null
44174 @@ -0,0 +1,94 @@
44176 +// Use of this source code is governed by a BSD-style license that can be
44233 + std::move(dialog->callback_).Run(result);
44243 + set_margins(ChromeLayoutProvider::Get()->GetDialogInsetsForContentType(
44248 + set_fixed_width(views::LayoutProvider::Get()->GetDistanceMetric(
44270 diff --git a/src/chrome/browser/ui/views/file_system_access/file_system_access_dangerous_file_dialo…
44273 --- /dev/null
44275 @@ -0,0 +1,61 @@
44277 +// Use of this source code is governed by a BSD-style license that can be
44338 diff --git a/src/chrome/browser/ui/views/file_system_access/file_system_access_dangerous_file_dialo…
44341 --- /dev/null
44343 @@ -0,0 +1,63 @@
44345 +// Use of this source code is governed by a BSD-style license that can be
44372 + browser()->tab_strip_model()->GetActiveWebContents());
44388 + widget_->widget_delegate()->AsDialogDelegate()->AcceptDialog();
44397 + widget_->widget_delegate()->AsDialogDelegate()->CancelDialog();
44408 diff --git a/src/chrome/browser/ui/views/file_system_access/file_system_access_restricted_directory…
44410 --- a/src/chrome/browser/ui/views/file_system_access/file_system_access_restricted_directory_dialog…
44412 @@ -89,8 +89,8 @@ void ShowFileSystemAccessRestrictedDirectoryDialog(
44416 - base::OnceCallback<void(
44417 - content::FileSystemAccessPermissionContext::SensitiveDirectoryResult)>
44423 diff --git a/src/chrome/browser/ui/views/file_system_access/file_system_access_restricted_directory…
44425 --- a/src/chrome/browser/ui/views/file_system_access/file_system_access_restricted_directory_dialog…
44427 @@ -33,7 +33,7 @@ class FileSystemAccessRestrictedDirectoryDialogView
44431 - content::FileSystemAccessPermissionContext::SensitiveDirectoryResult;
44436 @@ -41,7 +41,7 @@ class FileSystemAccessRestrictedDirectoryDialogView
44440 - // Creates and shows the dialog. The |callback| is called when the dialog is
44445 diff --git a/src/chrome/browser/ui/views/file_system_access/file_system_access_restricted_directory…
44447 --- a/src/chrome/browser/ui/views/file_system_access/file_system_access_restricted_directory_dialog…
44449 @@ -13,8 +13,8 @@
44453 -using SensitiveDirectoryResult =
44454 - content::FileSystemAccessPermissionContext::SensitiveDirectoryResult;
44460 @@ -24,7 +24,7 @@ class FileSystemAccessRestrictedDirectoryDialogViewTest
44464 - base::BindLambdaForTesting([&](SensitiveDirectoryResult result) {
44469 @@ -38,8 +38,7 @@ class FileSystemAccessRestrictedDirectoryDialogViewTest
44473 - SensitiveDirectoryResult callback_result_ =
44474 - SensitiveDirectoryResult::kAllowed;
44479 @@ -47,7 +46,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemAccessRestrictedDirectoryDialogViewTest,
44481 widget_->widget_delegate()->AsDialogDelegate()->AcceptDialog();
44483 - EXPECT_EQ(SensitiveDirectoryResult::kTryAgain, callback_result_);
44488 @@ -56,7 +55,7 @@ IN_PROC_BROWSER_TEST_F(FileSystemAccessRestrictedDirectoryDialogViewTest,
44490 widget_->widget_delegate()->AsDialogDelegate()->CancelDialog();
44492 - EXPECT_EQ(SensitiveDirectoryResult::kAbort, callback_result_);
44497 diff --git a/src/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.h b/src/chrom…
44499 --- a/src/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_linux.h
44501 @@ -95,7 +95,7 @@ class BrowserDesktopWindowTreeHostLinux
44505 -#elif BUILDFLAG(IS_LINUX)
44510 diff --git a/src/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_platform.cc b/src/c…
44513 --- /dev/null
44515 @@ -0,0 +1,46 @@
44517 +// Use of this source code is governed by a BSD-style license that can be
44562 diff --git a/src/chrome/browser/ui/views/frame/browser_desktop_window_tree_host_platform.h b/src/ch…
44565 --- /dev/null
44567 @@ -0,0 +1,42 @@
44569 +// Use of this source code is governed by a BSD-style license that can be
44610 diff --git a/src/chrome/browser/ui/views/frame/desktop_browser_frame_aura_linux.cc b/src/chrome/bro…
44612 --- a/src/chrome/browser/ui/views/frame/desktop_browser_frame_aura_linux.cc
44614 @@ -86,7 +86,12 @@ bool DesktopBrowserFrameAuraLinux::UseCustomFrame() const {
44619 host_->TabDraggingKindChanged(tab_drag_kind);
44627 @@ -99,7 +104,12 @@ void DesktopBrowserFrameAuraLinux::OnUseCustomChromeFrameChanged() {
44630 browser_frame()->FrameTypeChanged();
44632 host_->UpdateFrameHints();
44640 diff --git a/src/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.cc b/src…
44642 --- a/src/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.cc
44644 @@ -104,14 +104,15 @@ bool MediaRouterDialogControllerViews::IsShowingMediaRouterDialog() const {
44648 - if (IsShowingMediaRouterDialog() && GetActionController())
44650 GetActionController()->OnDialogHidden();
44656 -void MediaRouterDialogControllerViews::OnWidgetClosing(views::Widget* widget) {
44661 ui_->LogMediaSinkStatus();
44662 diff --git a/src/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.h b/src/…
44664 --- a/src/chrome/browser/ui/views/media_router/media_router_dialog_controller_views.h
44666 @@ -46,7 +46,7 @@ class MediaRouterDialogControllerViews
44670 - void OnWidgetClosing(views::Widget* widget) override;
44675 diff --git a/src/chrome/browser/ui/views/media_router/media_router_dialog_controller_views_browsert…
44677 --- a/src/chrome/browser/ui/views/media_router/media_router_dialog_controller_views_browsertest.cc
44679 @@ -8,6 +8,7 @@
44687 @@ -18,6 +19,8 @@
44696 @@ -48,6 +51,7 @@ class MediaRouterDialogControllerViewsTest : public InProcessBrowserTest {
44704 @@ -74,6 +78,10 @@ void MediaRouterDialogControllerViewsTest::OpenMediaRouterDialog() {
44705 ASSERT_TRUE(dialog_controller_->IsShowingMediaRouterDialog());
44709 + initiator_->Close();
44715 @@ -162,4 +170,22 @@ IN_PROC_BROWSER_TEST_F(GlobalMediaControlsDialogTest,
44726 + EXPECT_TRUE(widget->HasObserver(dialog_controller_));
44730 + CastDialogView::GetInstance()->set_close_on_deactivate(false);
44732 + widget->native_widget_private()->Close();
44738 diff --git a/src/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc b/src/chrome/b…
44740 --- a/src/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc
44742 @@ -19,6 +19,7 @@
44750 @@ -34,6 +35,7 @@
44758 @@ -117,7 +119,10 @@ IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest, OpenDialogFromContextMenu) {
44760 EXPECT_TRUE(dialog_controller->IsShowingMediaRouterDialog());
44764 dialog_controller->HideMediaRouterDialog();
44766 EXPECT_FALSE(dialog_controller->IsShowingMediaRouterDialog());
44769 @@ -132,10 +137,13 @@ IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest, OpenDialogFromAppMenu) {
44771 ASSERT_FALSE(dialog_controller->IsShowingMediaRouterDialog());
44772 app_menu_test_api->ExecuteCommand(IDC_ROUTE_MEDIA);
44775 EXPECT_TRUE(dialog_controller->IsShowingMediaRouterDialog());
44777 dialog_controller->HideMediaRouterDialog();
44778 EXPECT_FALSE(dialog_controller->IsShowingMediaRouterDialog());
44783 @@ -157,8 +165,12 @@ IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest,
44785 dialog_controller->ShowMediaRouterDialog(MediaRouterDialogOpenOrigin::PAGE);
44793 EXPECT_FALSE(dialog_controller->IsShowingMediaRouterDialog());
44796 @@ -256,18 +268,32 @@ IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest,
44797 browser()->tab_strip_model()->GetActiveWebContents());
44804 + browser()->tab_strip_model()->GetActiveWebContents());
44808 - // The reload should have closed the dialog.
44809 - EXPECT_FALSE(dialog_controller->IsShowingMediaRouterDialog());
44812 + EXPECT_FALSE(dialog_controller->IsShowingMediaRouterDialog());
44815 EXPECT_TRUE(dialog_controller->IsShowingMediaRouterDialog());
44819 -
44820 - // The navigation should have closed the dialog.
44821 - EXPECT_FALSE(dialog_controller->IsShowingMediaRouterDialog());
44822 - SetAlwaysShowActionPref(false);
44830 + EXPECT_FALSE(dialog_controller->IsShowingMediaRouterDialog());
44835 diff --git a/src/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_browsertest.cc b/src/chr…
44837 --- a/src/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_browsertest.cc
44839 @@ -23,12 +23,15 @@
44850 #include "third_party/abseil-cpp/absl/types/optional.h"
44855 @@ -138,6 +141,47 @@ IN_PROC_BROWSER_TEST_F(WebAppUninstallDialogViewBrowserTest,
44870 + AppId app_id = InstallTestWebApp(browser()->profile());
44873 + web_app::WebAppUninstallDialog::Create(browser()->profile(),
44890 + dialog->ConfirmUninstall(app_id, webapps::WebappUninstallSource::kAppMenu,
44903 diff --git a/src/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_view.cc b/src/chrome/bro…
44905 --- a/src/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_view.cc
44907 @@ -146,8 +146,7 @@ void WebAppUninstallDialogDelegateView::OnDialogCanceled() {
44911 - if (dialog_)
44912 - std::exchange(dialog_, nullptr)->UninstallCancelled();
44913 + // `dialog_->UninstallCancelled()` is handled in the destructor.
44917 diff --git a/src/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc b/src/chrome/browse…
44919 --- a/src/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc
44921 @@ -317,7 +317,8 @@ static constexpr const char* const kChromeUrls[] = {
44922 "chrome://linux-proxy-config",
44923 "chrome://multidevice-setup",
44925 - "chrome://oobe",
44928 "chrome://os-credits",
44929 "chrome://os-settings",
44931 diff --git a/src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/src/chrome/browser/u…
44933 --- a/src/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
44935 @@ -200,6 +200,7 @@
44943 @@ -254,12 +255,14 @@
44958 @@ -705,8 +708,10 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
44969 @@ -884,8 +889,18 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
44973 - if (url.host_piece() == chrome::kChromeUIOobeHost)
44974 - return &NewWebUI<chromeos::OobeUI>;
44979 + bool is_running_test = command_line->HasSwitch(::switches::kTestName) ||
44980 + command_line->HasSwitch(::switches::kTestType);
44990 diff --git a/src/chrome/browser/ui/webui/discards/BUILD.gn b/src/chrome/browser/ui/webui/discards/B…
44992 --- a/src/chrome/browser/ui/webui/discards/BUILD.gn
44994 @@ -4,7 +4,7 @@
44998 -if (is_win || is_mac || is_linux || is_chromeos || is_fuchsia) {
45003 diff --git a/src/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc b/src/chrome/browser/ui…
45005 --- a/src/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
45007 @@ -377,7 +377,9 @@ void DownloadsDOMHandler::OpenDuringScanningRequiringGesture(
45017 diff --git a/src/chrome/browser/ui/webui/favicon_source.cc b/src/chrome/browser/ui/webui/favicon_so…
45019 --- a/src/chrome/browser/ui/webui/favicon_source.cc
45021 @@ -220,7 +220,12 @@ bool FaviconSource::ShouldServiceRequest(
45034 diff --git a/src/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/src/chrome/browser/ui/w…
45036 --- a/src/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
45038 @@ -239,6 +239,7 @@ std::unique_ptr<BadClockBlockingPage> CreateBadClockBlockingPage(
45046 @@ -254,6 +255,7 @@ std::unique_ptr<LookalikeUrlBlockingPage> CreateLookalikeInterstitialPage(
45054 @@ -273,6 +275,7 @@ CreateHttpsOnlyModePage(content::WebContents* web_contents) {
45062 @@ -386,6 +389,7 @@ CreateSafeBrowsingQuietBlockingPage(content::WebContents* web_contents) {
45063 g_browser_process->safe_browsing_service()->ui_manager().get(),
45070 @@ -501,12 +505,16 @@ void InterstitialHTMLSource::StartDataRequest(
45072 } else if (path_without_query == "/blocked-interception") {
45087 @@ -520,10 +528,12 @@ void InterstitialHTMLSource::StartDataRequest(
45094 html = blocking_page->GetHTML();
45100 diff --git a/src/chrome/browser/ui/webui/management/management_ui_handler.cc b/src/chrome/browser/u…
45102 --- a/src/chrome/browser/ui/webui/management/management_ui_handler.cc
45104 @@ -819,11 +819,13 @@ base::Value ManagementUIHandler::GetThreatProtectionInfo(Profile* profile) {
45109 if (connectors_service->GetAppliedRealTimeUrlCheck() !=
45117 connectors_service->GetManagementDomain();
45118 diff --git a/src/chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_handler.…
45120 --- a/src/chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_handler.cc
45122 @@ -23,7 +23,9 @@ NewTabPageThirdPartyHandler::NewTabPageThirdPartyHandler(
45132 @@ -59,9 +61,13 @@ void NewTabPageThirdPartyHandler::NotifyAboutTheme() {
45133 most_visited->use_title_pill = false;
45134 theme->text_color = theme_provider.GetColor(ThemeProperties::COLOR_NTP_TEXT);
45135 most_visited->is_dark = !color_utils::IsDark(theme->text_color);
45137 theme->color_background = color_utils::SkColorToRgbaString(
45144 theme->background_tiling = GetNewTabBackgroundTilingCSS(theme_provider);
45145 theme->background_position = GetNewTabBackgroundPositionCSS(theme_provider);
45146 diff --git a/src/chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_handler.…
45148 --- a/src/chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_handler.h
45150 @@ -53,7 +53,9 @@ class NewTabPageThirdPartyHandler
45160 diff --git a/src/chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_ui.cc b/…
45162 --- a/src/chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_ui.cc
45164 @@ -67,10 +67,14 @@ content::WebUIDataSource* CreateNewTabPageThirdPartyUiHtmlSource(
45166 source->AddString("backgroundTiling",
45169 source->AddString("colorBackground",
45176 source->AddString("themeId",
45177 profile->GetPrefs()->GetString(prefs::kCurrentThemeID));
45178 source->AddString("hascustombackground",
45179 diff --git a/src/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/src/chrome/browser/ui/webui/nt…
45181 --- a/src/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
45183 @@ -416,7 +416,11 @@ void NTPResourceCache::CreateNewTabGuestHTML() {
45193 profile_->GetPrimaryOTRProfile(/*create_if_needed=*/true));
45195 @@ -428,8 +432,10 @@ void NTPResourceCache::CreateNewTabIncognitoCSS(
45196 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID);
45206 @@ -449,7 +455,12 @@ void NTPResourceCache::CreateNewTabIncognitoCSS(
45219 diff --git a/src/chrome/browser/ui/webui/settings/about_handler.cc b/src/chrome/browser/ui/webui/se…
45221 --- a/src/chrome/browser/ui/webui/settings/about_handler.cc
45223 @@ -353,6 +353,7 @@ void AboutHandler::RegisterMessages() {
45229 version_updater_.reset(VersionUpdater::Create(web_ui()->GetWebContents()));
45231 @@ -362,6 +363,7 @@ void AboutHandler::OnJavascriptAllowed() {
45239 diff --git a/src/chrome/browser/ui/webui/settings/chromeos/main_section.cc b/src/chrome/browser/ui/…
45241 --- a/src/chrome/browser/ui/webui/settings/chromeos/main_section.cc
45243 @@ -124,6 +124,7 @@ void MainSection::AddLoadTimeData(content::WebUIDataSource* html_source) {
45251 diff --git a/src/chrome/browser/ui/webui/settings/import_data_handler.cc b/src/chrome/browser/ui/we…
45253 --- a/src/chrome/browser/ui/webui/settings/import_data_handler.cc
45255 @@ -72,9 +72,14 @@ void ImportDataHandler::OnJavascriptDisallowed() {
45259 - // Stops listening to updates from any ongoing imports.
45260 - if (importer_host_)
45263 + // also clear our pointer, as otherwise this can lead to a use-after-free
45266 importer_host_->set_observer(nullptr);
45272 diff --git a/src/chrome/browser/ui/webui/settings/safety_check_handler.cc b/src/chrome/browser/ui/w…
45274 --- a/src/chrome/browser/ui/webui/settings/safety_check_handler.cc
45276 @@ -293,6 +293,7 @@ void SafetyCheckHandler::PerformSafetyCheck() {
45282 version_updater_.reset(VersionUpdater::Create(web_ui()->GetWebContents()));
45284 @@ -305,6 +306,7 @@ void SafetyCheckHandler::PerformSafetyCheck() {
45292 diff --git a/src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/src/chro…
45294 --- a/src/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
45296 @@ -164,6 +164,7 @@ void AddCommonStrings(content::WebUIDataSource* html_source, Profile* profile) {
45304 diff --git a/src/chrome/browser/ui/webui/signin/profile_picker_handler.cc b/src/chrome/browser/ui/w…
45306 --- a/src/chrome/browser/ui/webui/signin/profile_picker_handler.cc
45308 @@ -143,6 +143,7 @@ base::Value GetAutogeneratedProfileThemeInfoValue(int color_id,
45316 @@ -155,6 +156,7 @@ base::Value CreateDefaultProfileThemeInfo(float scale_factor, bool dark_mode) {
45324 @@ -618,10 +620,15 @@ void ProfilePickerHandler::HandleGetProfileThemeInfo(
45330 web_ui()->GetDeviceScaleFactor(),
45331 webui::GetNativeTheme(web_ui()->GetWebContents())
45332 ->ShouldUseDarkColors());
45340 diff --git a/src/chrome/browser/ui/webui/tab_strip/tab_strip_ui_browsertest.cc b/src/chrome/browser…
45342 --- a/src/chrome/browser/ui/webui/tab_strip/tab_strip_ui_browsertest.cc
45344 @@ -50,6 +50,7 @@ class MockTabStripUIEmbedder : public TabStripUIEmbedder {
45352 diff --git a/src/chrome/browser/ui/webui/theme_handler.cc b/src/chrome/browser/ui/webui/theme_handl…
45354 --- a/src/chrome/browser/ui/webui/theme_handler.cc
45356 @@ -40,11 +40,13 @@ void ThemeHandler::OnJavascriptAllowed() {
45358 ThemeServiceFactory::GetForProfile(GetProfile())->AddObserver(this);
45364 webui::GetNativeTheme(web_ui()->GetWebContents()));
45370 @@ -60,12 +62,14 @@ void ThemeHandler::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) {
45376 webui::GetNativeTheme(web_ui()->GetWebContents());
45385 diff --git a/src/chrome/browser/ui/window_sizer/window_sizer.cc b/src/chrome/browser/ui/window_size…
45387 --- a/src/chrome/browser/ui/window_sizer/window_sizer.cc
45389 @@ -173,7 +173,7 @@ void WindowSizer::GetBrowserWindowBoundsAndShowState(
45393 -#if !BUILDFLAG(IS_LINUX)
45398 diff --git a/src/chrome/browser/usb/web_usb_chooser_desktop.cc b/src/chrome/browser/usb/web_usb_cho…
45400 --- a/src/chrome/browser/usb/web_usb_chooser_desktop.cc
45402 @@ -20,8 +20,10 @@ WebUsbChooserDesktop::~WebUsbChooserDesktop() = default;
45413 diff --git a/src/chrome/browser/web_applications/BUILD.gn b/src/chrome/browser/web_applications/BUI…
45415 --- a/src/chrome/browser/web_applications/BUILD.gn
45417 @@ -177,7 +177,7 @@ source_set("web_applications") {
45421 - if (is_linux) {
45426 @@ -213,7 +213,7 @@ source_set("web_applications") {
45430 - if (is_win || is_mac || (is_linux && !is_chromeos_lacros)) {
45435 @@ -528,7 +528,7 @@ source_set("web_applications_unit_tests") {
45439 - if (is_linux) {
45444 @@ -537,7 +537,7 @@ source_set("web_applications_unit_tests") {
45448 - if (is_win || is_mac || (is_linux && !is_chromeos_lacros)) {
45453 @@ -596,7 +596,7 @@ source_set("web_applications_unit_tests") {
45457 - if (is_win || is_mac || (is_linux && !is_chromeos_lacros)) {
45462 @@ -619,7 +619,7 @@ source_set("web_applications_browser_tests") {
45466 - if (is_linux) {
45471 diff --git a/src/chrome/browser/web_applications/web_app_file_handler_registration.h b/src/chrome/b…
45473 --- a/src/chrome/browser/web_applications/web_app_file_handler_registration.h
45475 @@ -44,7 +44,7 @@ void UnregisterFileHandlersWithOs(const AppId& app_id,
45479 -#if BUILDFLAG(IS_LINUX)
45482 // MIME-type-to-file-extensions mappings corresponding to |file_handlers|. File
45484 diff --git a/src/chrome/browser/web_applications/web_app_install_manager_unittest.cc b/src/chrome/b…
45486 --- a/src/chrome/browser/web_applications/web_app_install_manager_unittest.cc
45488 @@ -947,6 +947,7 @@ TEST_P(WebAppInstallManagerTest_SyncOnly, DefaultAndUser_UninstallWebApp) {
45496 @@ -966,6 +967,7 @@ TEST_P(WebAppInstallManagerTest_SyncOnly, DefaultAndUser_UninstallWebApp) {
45504 @@ -985,12 +987,16 @@ TEST_P(WebAppInstallManagerTest, InstallWebAppFromInfo) {
45521 @@ -1044,6 +1050,22 @@ TEST_P(WebAppInstallManagerTest, TaskQueueWebContentsReadyRace) {
45528 + default_app->SetDisplayMode(DisplayMode::kStandalone);
45529 + default_app->SetUserDisplayMode(DisplayMode::kBrowser);
45531 + const AppId app_id = default_app->app_id();
45544 @@ -1061,6 +1083,7 @@ TEST_P(WebAppInstallManagerTest_SyncOnly,
45552 @@ -1073,6 +1096,7 @@ TEST_P(WebAppInstallManagerTest_SyncOnly,
45560 @@ -1173,6 +1197,7 @@ TEST_P(WebAppInstallManagerTest_SyncOnly,
45562 EXPECT_EQ(DisplayMode::kStandalone, web_app->display_mode());
45563 EXPECT_EQ(DisplayMode::kBrowser, web_app->user_display_mode());
45566 ASSERT_TRUE(web_app->theme_color().has_value());
45567 EXPECT_EQ(SK_ColorWHITE, web_app->theme_color().value());
45568 @@ -1221,6 +1246,7 @@ TEST_P(WebAppInstallManagerTest_SyncOnly, InstallSubApp) {
45575 EXPECT_EQ(parent_app_id, app->parent_app_id());
45576 diff --git a/src/chrome/browser/web_applications/web_app_registrar.cc b/src/chrome/browser/web_appl…
45578 --- a/src/chrome/browser/web_applications/web_app_registrar.cc
45580 @@ -466,6 +466,16 @@ bool WebAppRegistrar::IsLocallyInstalled(const AppId& app_id) const {
45590 + return !web_app->HasOnlySource(web_app::Source::kDefault) ||
45596 return web_app && web_app->HasOnlySource(Source::Type::kDefault);
45597 diff --git a/src/chrome/browser/web_applications/web_app_registrar.h b/src/chrome/browser/web_appli…
45599 --- a/src/chrome/browser/web_applications/web_app_registrar.h
45601 @@ -72,6 +72,11 @@ class WebAppRegistrar : public ProfileManagerObserver {
45613 diff --git a/src/chrome/browser/web_applications/web_app_registrar_unittest.cc b/src/chrome/browser…
45615 --- a/src/chrome/browser/web_applications/web_app_registrar_unittest.cc
45617 @@ -415,10 +415,12 @@ TEST_F(WebAppRegistrarTest, GetAppDataFields) {
45624 web_app_ptr->SetIsLocallyInstalled(/*is_locally_installed*/ true);
45630 diff --git a/src/chrome/browser/web_applications/web_app_shortcut.h b/src/chrome/browser/web_applic…
45632 --- a/src/chrome/browser/web_applications/web_app_shortcut.h
45634 @@ -19,7 +19,7 @@
45638 -#if BUILDFLAG(IS_LINUX)
45643 @@ -47,7 +47,7 @@ struct ScopedShortcutOverrideForTesting {
45647 -#elif BUILDFLAG(IS_LINUX)
45652 @@ -89,7 +89,7 @@ struct ShortcutInfo {
45656 -#if BUILDFLAG(IS_LINUX)
45661 diff --git a/src/chrome/browser/webshare/chromeos/sharesheet_client_browsertest.cc b/src/chrome/bro…
45663 --- a/src/chrome/browser/webshare/chromeos/sharesheet_client_browsertest.cc
45665 @@ -90,7 +90,7 @@ class SharesheetClientBrowserTest : public InProcessBrowserTest {
45669 -IN_PROC_BROWSER_TEST_F(SharesheetClientBrowserTest, ShareTwoFiles) {
45672 ASSERT_TRUE(embedded_test_server()->Start());
45674 @@ -110,26 +110,30 @@ IN_PROC_BROWSER_TEST_F(SharesheetClientBrowserTest, ShareTwoFiles) {
45678 - EXPECT_EQ(content_types.size(), 2U);
45689 - EXPECT_EQ(file_paths.size(), 2U);
45693 file_manager::util::GetShareCacheFilePath(browser()->profile());
45697 - share_cache.AppendASCII(".WebShare/share2/_sample.mp4"));
45708 diff --git a/src/chrome/browser/webshare/chromeos/sharesheet_client_unittest.cc b/src/chrome/browse…
45710 --- a/src/chrome/browser/webshare/chromeos/sharesheet_client_unittest.cc
45712 @@ -10,6 +10,7 @@
45720 diff --git a/src/chrome/browser/webshare/share_service_impl.cc b/src/chrome/browser/webshare/share_…
45722 --- a/src/chrome/browser/webshare/share_service_impl.cc
45724 @@ -8,6 +8,7 @@
45732 @@ -67,52 +68,52 @@ void ShareServiceImpl::Create(
45736 -bool ShareServiceImpl::IsDangerousFilename(base::StringPiece name) {
45737 - constexpr std::array<const char*, 40> kPermitted = {
45738 - ".bmp", // image/bmp / image/x-ms-bmp
45739 - ".css", // text/css
45740 - ".csv", // text/csv / text/comma-separated-values
45741 - ".ehtml", // text/html
45742 - ".flac", // audio/flac
45743 - ".gif", // image/gif
45744 - ".htm", // text/html
45745 - ".html", // text/html
45746 - ".ico", // image/x-icon
45747 - ".jfif", // image/jpeg
45748 - ".jpeg", // image/jpeg
45749 - ".jpg", // image/jpeg
45750 - ".m4a", // audio/x-m4a
45751 - ".m4v", // video/mp4
45752 - ".mp3", // audio/mpeg audio/mp3
45753 - ".mp4", // video/mp4
45754 - ".mpeg", // video/mpeg
45755 - ".mpg", // video/mpeg
45756 - ".oga", // audio/ogg
45757 - ".ogg", // audio/ogg
45758 - ".ogm", // video/ogg
45759 - ".ogv", // video/ogg
45760 - ".opus", // audio/ogg
45761 - ".pdf", // application/pdf
45762 - ".pjp", // image/jpeg
45763 - ".pjpeg", // image/jpeg
45764 - ".png", // image/png
45765 - ".shtm", // text/html
45766 - ".shtml", // text/html
45767 - ".svg", // image/svg+xml
45768 - ".svgz", // image/svg+xml
45769 - ".text", // text/plain
45770 - ".tif", // image/tiff
45771 - ".tiff", // image/tiff
45772 - ".txt", // text/plain
45773 - ".wav", // audio/wav
45774 - ".weba", // audio/webm
45775 - ".webm", // video/webm
45776 - ".webp", // image/webp
45777 - ".xbm", // image/x-xbitmap
45780 + FILE_PATH_LITERAL(".bmp"), // image/bmp / image/x-ms-bmp
45782 + FILE_PATH_LITERAL(".csv"), // text/csv / text/comma-separated-values
45788 + FILE_PATH_LITERAL(".ico"), // image/x-icon
45792 + FILE_PATH_LITERAL(".m4a"), // audio/x-m4a
45818 + FILE_PATH_LITERAL(".xbm"), // image/x-xbitmap
45821 - for (const char* permitted : kPermitted) {
45822 - if (base::EndsWith(name, permitted, base::CompareCase::INSENSITIVE_ASCII))
45829 @@ -185,10 +186,11 @@ void ShareServiceImpl::Share(const std::string& title,
45833 - if (IsDangerousFilename(file->name) ||
45834 + const base::FilePath& path = file->name.path();
45836 IsDangerousMimeType(file->blob->content_type)) {
45837 - VLOG(1) << "File type is not supported: " << file->name
45838 - << " has mime type " << file->blob->content_type;
45840 + << file->blob->content_type;
45844 diff --git a/src/chrome/browser/webshare/share_service_impl.h b/src/chrome/browser/webshare/share_s…
45846 --- a/src/chrome/browser/webshare/share_service_impl.h
45848 @@ -8,6 +8,7 @@
45856 @@ -44,8 +45,8 @@ class ShareServiceImpl
45860 - static bool IsDangerousFilename(base::StringPiece);
45861 - static bool IsDangerousMimeType(base::StringPiece);
45867 diff --git a/src/chrome/browser/webshare/share_service_unittest.cc b/src/chrome/browser/webshare/sh…
45869 --- a/src/chrome/browser/webshare/share_service_unittest.cc
45871 @@ -6,6 +6,8 @@
45880 @@ -66,7 +68,7 @@ class ShareServiceUnitTest : public ChromeRenderViewHostTestHarness {
45884 - ShareError ShareGeneratedFileData(const std::string& extension,
45889 @@ -76,8 +78,13 @@ class ShareServiceUnitTest : public ChromeRenderViewHostTestHarness {
45893 - const std::string name =
45894 - base::StringPrintf("share%d%s", index, extension.c_str());
45905 @@ -93,10 +100,15 @@ class ShareServiceUnitTest : public ChromeRenderViewHostTestHarness {
45914 - blink::mojom::SharedFilePtr CreateSharedFile(const std::string& name,
45915 - const std::string& content_type,
45916 - unsigned file_length) {
45924 @@ -118,7 +130,8 @@ class ShareServiceUnitTest : public ChromeRenderViewHostTestHarness {
45928 - return blink::mojom::SharedFile::New(name, std::move(blob));
45934 @@ -165,29 +178,30 @@ class ShareServiceUnitTest : public ChromeRenderViewHostTestHarness {
45938 - EXPECT_EQ(ShareError::OK, ShareGeneratedFileData(".txt", "text/plain", 1234,
45939 - kMaxSharedFileCount));
45944 - ShareGeneratedFileData(".txt", "text/plain", 1234,
45945 - kMaxSharedFileCount + 1));
45951 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename(""));
45952 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("."));
45953 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("./"));
45954 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename(".\\"));
45960 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("a.a"));
45961 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("zzz.zzz"));
45965 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("a/a"));
45966 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("zzz/zzz"));
45970 - EXPECT_FALSE(ShareServiceImpl::IsDangerousFilename("1.XBM"));
45971 - EXPECT_FALSE(ShareServiceImpl::IsDangerousFilename("2.bMP"));
45972 - EXPECT_FALSE(ShareServiceImpl::IsDangerousFilename("3.Flac"));
45973 - EXPECT_FALSE(ShareServiceImpl::IsDangerousFilename("4.webM"));
45981 @@ -205,26 +219,32 @@ TEST_F(ShareServiceUnitTest, DangerousMimeType) {
45985 - EXPECT_EQ(ShareError::OK, ShareGeneratedFileData(".bmp", "image/bmp"));
45986 - EXPECT_EQ(ShareError::OK, ShareGeneratedFileData(".xbm", "image/x-xbitmap"));
45987 - EXPECT_EQ(ShareError::OK, ShareGeneratedFileData(".flac", "audio/flac"));
45988 - EXPECT_EQ(ShareError::OK, ShareGeneratedFileData(".webm", "video/webm"));
45992 + "image/x-xbitmap"));
46000 - EXPECT_EQ(ShareError::OK, ShareGeneratedFileData(".pdf", "application/pdf"));
46008 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("CON"));
46009 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("PRN"));
46010 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("AUX"));
46011 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("NUL"));
46012 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("COM1"));
46013 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("COM9"));
46014 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("LPT1"));
46015 - EXPECT_TRUE(ShareServiceImpl::IsDangerousFilename("LPT9"));
46027 @@ -232,30 +252,32 @@ TEST_F(ShareServiceUnitTest, ReservedNames) {
46031 - ShareGeneratedFileData(".apk", "text/plain"));
46034 - ShareGeneratedFileData(".dex", "text/plain"));
46037 - ShareGeneratedFileData(".txt", "vnd.android.package-archive"));
46039 + "vnd.android.package-archive"));
46044 - ShareGeneratedFileData(".txt", "text/plain",
46050 - ShareGeneratedFileData(".txt", "text/plain",
46058 - ShareGeneratedFileData(".txt", "text/plain", kMaxSharedFileBytes));
46059 - EXPECT_EQ(
46060 - ShareError::PERMISSION_DENIED,
46061 - ShareGeneratedFileData(".txt", "text/plain", kMaxSharedFileBytes + 1));
46069 diff --git a/src/chrome/browser/webshare/win/share_operation.cc b/src/chrome/browser/webshare/win/s…
46071 --- a/src/chrome/browser/webshare/win/share_operation.cc
46073 @@ -416,7 +416,7 @@ void ShareOperation::Run(blink::mojom::ShareService::ShareCallback callback) {
46076 if (FAILED(attachment_services->SetFileName(
46077 - base::UTF8ToWide(file->name).c_str()))) {
46078 + file->name.path().value().c_str()))) {
46082 @@ -573,7 +573,7 @@ bool ShareOperation::PutShareContentInDataPackage(IDataRequest* data_request) {
46084 web_contents_->GetBrowserContext()->GetBlobStorageContext(),
46085 file_bytes_shared, file->blob->uuid);
46086 - auto name_h = base::win::ScopedHString::Create(file->name);
46087 + auto name_h = base::win::ScopedHString::Create(file->name.path().value());
46090 [operation](IOutputStream* stream) -> HRESULT {
46091 diff --git a/src/chrome/browser/webshare/win/share_operation_unittest.cc b/src/chrome/browser/websh…
46093 --- a/src/chrome/browser/webshare/win/share_operation_unittest.cc
46095 @@ -4,6 +4,7 @@
46103 @@ -147,9 +148,10 @@ class ShareOperationUnitTest : public ChromeRenderViewHostTestHarness {
46104 ASSERT_HRESULT_SUCCEEDED(closable_input_stream->Close());
46107 - blink::mojom::SharedFilePtr CreateSharedFile(const std::string& name,
46108 - const std::string& content_type,
46109 - const std::string& contents) {
46116 blob->uuid = uuid;
46117 @@ -171,7 +173,8 @@ class ShareOperationUnitTest : public ChromeRenderViewHostTestHarness {
46121 - return blink::mojom::SharedFile::New(name, std::move(blob));
46127 @@ -292,8 +295,8 @@ TEST_F(ShareOperationUnitTest, BasicFile) {
46131 - files.push_back(
46132 - CreateSharedFile("MyFile.txt", "text/plain", "Contents of the file"));
46138 @@ -326,7 +329,7 @@ TEST_F(ShareOperationUnitTest, SingleFileAtSizeLimit) {
46142 - CreateSharedFile("MyFile.txt", "text/plain",
46147 @@ -360,7 +363,7 @@ TEST_F(ShareOperationUnitTest, SingleFileLargerThanSizeLimit) {
46151 - CreateSharedFile("MyFile.txt", "text/plain",
46156 @@ -396,10 +399,10 @@ TEST_F(ShareOperationUnitTest, FilesTotallingSizeLimit) {
46160 - CreateSharedFile("File1.txt", "text/plain",
46164 - CreateSharedFile("File2.txt", "text/plain",
46169 @@ -439,10 +442,10 @@ TEST_F(ShareOperationUnitTest, FilesTotallingLargerThanSizeLimit) {
46173 - CreateSharedFile("File1.txt", "text/plain",
46177 - CreateSharedFile("File2.txt", "text/plain",
46182 diff --git a/src/chrome/chrome_paks.gni b/src/chrome/chrome_paks.gni
46184 --- a/src/chrome/chrome_paks.gni
46186 @@ -58,7 +58,7 @@ template("chrome_repack_percent") {
46190 - if (toolkit_views) {
46195 @@ -138,6 +138,11 @@ template("chrome_extra_paks") {
46207 diff --git a/src/chrome/chrome_repack_locales.gni b/src/chrome/chrome_repack_locales.gni
46209 --- a/src/chrome/chrome_repack_locales.gni
46211 @@ -67,6 +67,11 @@ template("chrome_repack_locales") {
46223 diff --git a/src/chrome/common/BUILD.gn b/src/chrome/common/BUILD.gn
46225 --- a/src/chrome/common/BUILD.gn
46227 @@ -457,7 +457,7 @@ static_library("common") {
46231 - if (is_linux || is_chromeos) {
46236 @@ -606,7 +606,7 @@ static_library("constants") {
46240 - } else if (is_linux || is_chromeos) {
46245 diff --git a/src/chrome/common/channel_info.h b/src/chrome/common/channel_info.h
46247 --- a/src/chrome/common/channel_info.h
46249 @@ -107,7 +107,7 @@ std::string GetChannelSuffixForDataDir();
46252 // of lacros-chrome is complete.
46253 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
46255 // Returns the channel-specific filename of the desktop shortcut used to launch
46258 diff --git a/src/chrome/common/channel_info_posix.cc b/src/chrome/common/channel_info_posix.cc
46260 --- a/src/chrome/common/channel_info_posix.cc
46262 @@ -93,7 +93,7 @@ std::string GetChannelSuffixForDataDir() {
46265 // of lacros-chrome is complete.
46266 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
46271 diff --git a/src/chrome/common/chrome_features.cc b/src/chrome/common/chrome_features.cc
46273 --- a/src/chrome/common/chrome_features.cc
46275 @@ -113,7 +113,7 @@ const base::Feature kAsyncDns {
46279 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
46284 @@ -128,7 +128,8 @@ const base::Feature kAutofillPasswordSurvey{"AutofillPasswordSurvey",
46288 -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
46294 @@ -645,7 +646,7 @@ const base::Feature kIncognitoNtpRevamp{"IncognitoNtpRevamp",
46298 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
46303 diff --git a/src/chrome/common/chrome_features.h b/src/chrome/common/chrome_features.h
46305 --- a/src/chrome/common/chrome_features.h
46307 @@ -95,7 +95,7 @@ extern const base::Feature kArcPiGhostWindow;
46311 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
46316 @@ -104,7 +104,8 @@ COMPONENT_EXPORT(CHROME_FEATURES)
46320 -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
46326 @@ -435,7 +436,7 @@ COMPONENT_EXPORT(CHROME_FEATURES)
46330 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
46335 diff --git a/src/chrome/common/chrome_paths.h b/src/chrome/common/chrome_paths.h
46337 --- a/src/chrome/common/chrome_paths.h
46339 @@ -88,7 +88,7 @@ enum {
46343 - // to the component updated Widevine CDM.
46348 @@ -105,7 +105,8 @@ enum {
46352 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
46358 diff --git a/src/chrome/common/chrome_switches.cc b/src/chrome/common/chrome_switches.cc
46360 --- a/src/chrome/common/chrome_switches.cc
46362 @@ -790,7 +790,7 @@ const char kAllowNaClSocketAPI[] = "allow-nacl-socket-api";
46366 - BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA)
46368 const char kEnableNewAppMenuIcon[] = "enable-new-app-menu-icon";
46371 diff --git a/src/chrome/common/chrome_switches.h b/src/chrome/common/chrome_switches.h
46373 --- a/src/chrome/common/chrome_switches.h
46375 @@ -247,7 +247,7 @@ extern const char kAllowNaClSocketAPI[];
46379 - BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA)
46384 diff --git a/src/chrome/common/importer/BUILD.gn b/src/chrome/common/importer/BUILD.gn
46386 --- a/src/chrome/common/importer/BUILD.gn
46388 @@ -92,7 +92,7 @@ source_set("importer") {
46392 - if (is_chromeos || is_linux || is_fuchsia) {
46397 diff --git a/src/chrome/common/pref_names.cc b/src/chrome/common/pref_names.cc
46399 --- a/src/chrome/common/pref_names.cc
46401 @@ -1194,7 +1194,7 @@ const char kUseAshProxy[] = "lacros.proxy.use_ash_proxy";
46404 // of lacros-chrome is complete.
46405 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
46410 @@ -1297,7 +1297,7 @@ const char kShowUpdatePromotionInfoBar[] =
46413 // of lacros-chrome is complete.
46414 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
46419 @@ -1776,7 +1776,7 @@ const char kDownloadDefaultDirectory[] = "download.default_directory";
46423 - BUILDFLAG(IS_MAC)
46428 @@ -2065,8 +2065,9 @@ const char kWebAppsPreferences[] = "web_apps.web_app_ids";
46432 -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
46433 - (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
46440 @@ -2193,7 +2194,8 @@ const char kAmbientAuthenticationInPrivateModesEnabled[] =
46444 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
46447 // Boolean that specifies whether OK-AS-DELEGATE flag from KDC is respected
46450 @@ -2851,7 +2853,7 @@ const char kSigninAllowedOnNextStartup[] = "signin.allowed_on_next_startup";
46454 -#if BUILDFLAG(IS_CHROMEOS)
46459 @@ -3117,7 +3119,7 @@ const char kBlockAutoplayEnabled[] = "media.block_autoplay";
46463 -#if BUILDFLAG(IS_LINUX)
46468 diff --git a/src/chrome/common/pref_names.h b/src/chrome/common/pref_names.h
46470 --- a/src/chrome/common/pref_names.h
46472 @@ -375,7 +375,7 @@ extern const char kUseAshProxy[];
46475 // of lacros-chrome is complete.
46476 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
46481 @@ -404,7 +404,7 @@ extern const char kShowUpdatePromotionInfoBar[];
46484 // of lacros-chrome is complete.
46485 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
46490 @@ -587,7 +587,7 @@ extern const char kDownloadExtensionsToOpenByPolicy[];
46494 - BUILDFLAG(IS_MAC)
46499 @@ -694,8 +694,9 @@ extern const char kWebAppsUninstalledDefaultChromeApps[];
46503 -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
46504 - (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
46511 @@ -834,7 +835,8 @@ extern const char kGloballyScopeHTTPAuthCacheEnabled[];
46515 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
46521 @@ -956,7 +958,7 @@ extern const char kBrowserProfilePickerShown[];
46525 -#if BUILDFLAG(IS_CHROMEOS)
46530 @@ -1068,7 +1070,7 @@ extern const char kBlockAutoplayEnabled[];
46534 -#if BUILDFLAG(IS_LINUX)
46539 diff --git a/src/chrome/common/webui_url_constants.cc b/src/chrome/common/webui_url_constants.cc
46541 --- a/src/chrome/common/webui_url_constants.cc
46543 @@ -439,7 +439,7 @@ const char kChromeUIConnectorsInternalsHost[] = "connectors-internals";
46547 - BUILDFLAG(IS_CHROMEOS)
46552 @@ -461,7 +461,8 @@ const char kChromeUISandboxHost[] = "sandbox";
46554 // of lacros-chrome is complete.
46556 - (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
46559 const char kChromeUIBrowserSwitchHost[] = "browser-switch";
46560 const char kChromeUIBrowserSwitchURL[] = "chrome://browser-switch/";
46562 diff --git a/src/chrome/common/webui_url_constants.h b/src/chrome/common/webui_url_constants.h
46564 --- a/src/chrome/common/webui_url_constants.h
46566 @@ -371,7 +371,7 @@ extern const char kOsUIFlagsURL[];
46570 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
46575 @@ -382,7 +382,7 @@ extern const char kChromeUIConnectorsInternalsHost[];
46579 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
46584 @@ -397,14 +397,15 @@ extern const char kChromeUILinuxProxyConfigHost[];
46588 - BUILDFLAG(IS_ANDROID)
46594 // of lacros-chrome is complete.
46596 - (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
46602 @@ -418,7 +419,7 @@ extern const char kChromeUIProfilePickerStartupQuery[];
46606 - defined(USE_AURA)
46611 diff --git a/src/chrome/services/printing/public/mojom/BUILD.gn b/src/chrome/services/printing/publ…
46613 --- a/src/chrome/services/printing/public/mojom/BUILD.gn
46615 @@ -38,7 +38,7 @@ mojom("mojom") {
46619 - if (enable_oop_printing) {
46624 diff --git a/src/chrome/test/BUILD.gn b/src/chrome/test/BUILD.gn
46626 --- a/src/chrome/test/BUILD.gn
46628 @@ -1108,7 +1108,7 @@ if (!is_android && !is_fuchsia) {
46632 - "//chrome/browser/media/router:test_support",
46637 @@ -2958,6 +2958,7 @@ if (!is_android && !is_fuchsia) {
46645 @@ -4350,7 +4351,7 @@ template("performance_test_suite_template_base") {
46649 - "//components:components_perftests",
46654 @@ -4366,7 +4367,7 @@ template("performance_test_suite_template_base") {
46658 - if (!is_android && !is_fuchsia) {
46663 diff --git a/src/chrome/test/data/extensions/api_test/debugger/background.js b/src/chrome/test/data…
46665 --- a/src/chrome/test/data/extensions/api_test/debugger/background.js
46667 @@ -130,13 +130,12 @@ chrome.test.getConfig(config => chrome.test.runTests([
46676 - chrome.tabs.remove(tab.id, function() {
46677 - chrome.test.assertNoLastError();
46678 - chrome.test.succeed();
46679 - });
46684 diff --git a/src/chrome/test/data/extensions/platform_apps/web_view/pointer_lock_pending/main.html …
46687 --- /dev/null
46689 @@ -0,0 +1,10 @@
46690 +<!--
46692 + * source code is governed by a BSD-style license that can be found in the
46694 +-->
46700 diff --git a/src/chrome/test/data/extensions/platform_apps/web_view/pointer_lock_pending/main.js b/…
46703 --- /dev/null
46705 @@ -0,0 +1,22 @@
46707 +// Use of this source code is governed by a BSD-style license that can be
46728 diff --git a/src/chrome/test/data/extensions/platform_apps/web_view/pointer_lock_pending/manifest.j…
46731 --- /dev/null
46733 @@ -0,0 +1,13 @@
46747 diff --git a/src/chrome/test/data/extensions/platform_apps/web_view/pointer_lock_pending/test.js b/…
46750 --- /dev/null
46752 @@ -0,0 +1,7 @@
46754 +// Use of this source code is governed by a BSD-style license that can be
46760 diff --git a/src/chrome/test/data/safe_browsing/malware4.html b/src/chrome/test/data/safe_browsing/…
46763 --- /dev/null
46765 @@ -0,0 +1,9 @@
46775 diff --git a/src/chrome/test/data/webshare/index.html b/src/chrome/test/data/webshare/index.html
46777 --- a/src/chrome/test/data/webshare/index.html
46779 @@ -34,7 +34,8 @@
46783 - await navigator.share({files: [first_file, second_file]});
46789 diff --git a/src/chrome/utility/BUILD.gn b/src/chrome/utility/BUILD.gn
46791 --- a/src/chrome/utility/BUILD.gn
46793 @@ -76,7 +76,35 @@ static_library("utility") {
46797 - if (!is_android) {
46830 diff --git a/src/chrome/utility/importer/firefox_importer.cc b/src/chrome/utility/importer/firefox_…
46832 --- a/src/chrome/utility/importer/firefox_importer.cc
46834 @@ -26,7 +26,7 @@
46838 -#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_FUCHSIA)
46843 @@ -149,7 +149,7 @@ void FirefoxImporter::StartImport(const importer::SourceProfile& source_profile,
46845 bridge_->NotifyItemEnded(importer::FAVORITES);
46847 -#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_FUCHSIA)
46850 bridge_->NotifyItemStarted(importer::PASSWORDS);
46852 @@ -374,7 +374,7 @@ void FirefoxImporter::ImportBookmarks() {
46856 -#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_FUCHSIA)
46861 diff --git a/src/chrome/utility/importer/firefox_importer.h b/src/chrome/utility/importer/firefox_i…
46863 --- a/src/chrome/utility/importer/firefox_importer.h
46865 @@ -61,7 +61,7 @@ class FirefoxImporter : public Importer {
46869 -#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_FUCHSIA)
46874 diff --git a/src/components/BUILD.gn b/src/components/BUILD.gn
46876 --- a/src/components/BUILD.gn
46878 @@ -48,7 +48,7 @@ if (is_ios) {
46882 - if (is_android || is_linux || is_chromeos || is_mac || is_win || is_fuchsia) {
46887 @@ -451,7 +451,7 @@ test("components_unittests") {
46890 # Desktop - only deps.
46891 - if (!is_android && !is_ios) {
46895 # guest_view is currently non - mobile.
46896 diff --git a/src/components/autofill_payments_strings.grdp b/src/components/autofill_payments_strin…
46898 --- a/src/components/autofill_payments_strings.grdp
46900 @@ -627,7 +627,7 @@
46904 - <if expr="toolkit_views">
46909 diff --git a/src/components/bookmarks/browser/BUILD.gn b/src/components/bookmarks/browser/BUILD.gn
46911 --- a/src/components/bookmarks/browser/BUILD.gn
46913 @@ -81,7 +81,7 @@ static_library("browser") {
46917 - if (toolkit_views && !is_mac) {
46922 diff --git a/src/components/bookmarks/browser/bookmark_node_data.h b/src/components/bookmarks/brows…
46924 --- a/src/components/bookmarks/browser/bookmark_node_data.h
46926 @@ -18,7 +18,7 @@
46930 -#if defined(TOOLKIT_VIEWS)
46935 @@ -27,7 +27,7 @@ class Pickle;
46939 -#if defined(TOOLKIT_VIEWS)
46944 @@ -114,7 +114,7 @@ struct BookmarkNodeData {
46948 -#if defined(TOOLKIT_VIEWS)
46953 @@ -133,7 +133,7 @@ struct BookmarkNodeData {
46957 -#if defined(TOOLKIT_VIEWS)
46962 diff --git a/src/components/browser_ui/webshare/android/BUILD.gn b/src/components/browser_ui/websha…
46964 --- a/src/components/browser_ui/webshare/android/BUILD.gn
46966 @@ -16,6 +16,7 @@ android_library("java") {
46974 diff --git a/src/components/browser_ui/webshare/android/java/src/org/chromium/components/browser_ui…
46976 --- a/src/components/browser_ui/webshare/android/java/src/org/chromium/components/browser_ui/websha…
46978 @@ -217,7 +217,8 @@ public class ShareServiceImpl implements ShareService {
46982 - if (isDangerousFilename(file.name) || isDangerousMimeType(file.blob.contentType)) {
46988 @@ -247,7 +248,8 @@ public class ShareServiceImpl implements ShareService {
46992 - "." + FileUtils.getExtension(files[index].name), sharePath);
46998 diff --git a/src/components/captive_portal/core/features.gni b/src/components/captive_portal/core/f…
47000 --- a/src/components/captive_portal/core/features.gni
47002 @@ -6,5 +6,5 @@ import("//build/config/compiler/compiler.gni")
47006 - enable_captive_portal_detection = !is_android && !is_chromecast && !is_ios
47009 diff --git a/src/components/content_settings/core/browser/website_settings_registry.cc b/src/compon…
47011 --- a/src/components/content_settings/core/browser/website_settings_registry.cc
47013 @@ -92,6 +92,8 @@ const WebsiteSettingsInfo* WebsiteSettingsRegistry::Register(
47022 diff --git a/src/components/crash/content/browser/BUILD.gn b/src/components/crash/content/browser/B…
47024 --- a/src/components/crash/content/browser/BUILD.gn
47026 @@ -21,7 +21,7 @@ source_set("browser") {
47030 - if (is_linux || is_chromeos || is_android) {
47035 diff --git a/src/components/crash/core/app/BUILD.gn b/src/components/crash/core/app/BUILD.gn
47037 --- a/src/components/crash/core/app/BUILD.gn
47039 @@ -52,7 +52,7 @@ static_library("app") {
47043 - if (is_linux || is_chromeos) {
47048 @@ -88,7 +88,7 @@ static_library("app") {
47052 - if (is_android || is_linux || is_chromeos) {
47057 @@ -96,7 +96,7 @@ static_library("app") {
47061 - if (is_linux || is_chromeos) {
47066 @@ -211,7 +211,7 @@ if (is_win) {
47070 -if (is_mac || is_android || is_linux || is_chromeos) {
47072 # We build a chromium-specific crashpad_handler executable so that we can
47075 diff --git a/src/components/crash/core/app/crash_switches.cc b/src/components/crash/core/app/crash_…
47077 --- a/src/components/crash/core/app/crash_switches.cc
47079 @@ -18,7 +18,7 @@ namespace switches {
47081 const char kCrashpadHandler[] = "crashpad-handler";
47083 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
47086 const char kCrashpadHandlerPid[] = "crashpad-handler-pid";
47088 diff --git a/src/components/crash/core/app/crash_switches.h b/src/components/crash/core/app/crash_s…
47090 --- a/src/components/crash/core/app/crash_switches.h
47092 @@ -13,7 +13,7 @@ namespace switches {
47096 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
47101 diff --git a/src/components/crash/core/app/crashpad.cc b/src/components/crash/core/app/crashpad.cc
47103 --- a/src/components/crash/core/app/crashpad.cc
47105 @@ -123,7 +123,7 @@ bool InitializeCrashpadImpl(bool initial_client,
47107 process_type == "notification-helper" ||
47109 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
47114 @@ -201,7 +201,7 @@ bool InitializeCrashpadImpl(bool initial_client,
47118 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
47123 @@ -293,12 +293,12 @@ void DumpWithoutCrashAndDeferProcessingAtPath(const base::FilePath& path) {
47127 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
47133 - // BUILDFLAG(IS_ANDROID)
47138 diff --git a/src/components/crash/core/app/crashpad.h b/src/components/crash/core/app/crashpad.h
47140 --- a/src/components/crash/core/app/crashpad.h
47142 @@ -42,7 +42,7 @@ class CrashReportDatabase;
47146 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
47151 @@ -168,7 +168,7 @@ bool ProcessExternalDump(
47155 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
47160 @@ -232,15 +232,18 @@ bool DumpWithoutCrashingForClient(CrashReporterClient* client);
47164 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
47169 // is used by V8 for trap-based bounds checks.
47176 -#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
47181 diff --git a/src/components/crash/core/app/crashpad_linux.cc b/src/components/crash/core/app/crashp…
47183 --- a/src/components/crash/core/app/crashpad_linux.cc
47185 @@ -35,6 +35,7 @@ namespace crash_reporter {
47193 @@ -49,15 +50,18 @@ bool FirstChanceHandlerHelper(int signo,
47211 return base::CommandLine::ForCurrentProcess()->HasSwitch(
47212 diff --git a/src/components/embedder_support/user_agent_utils.cc b/src/components/embedder_support/…
47214 --- a/src/components/embedder_support/user_agent_utils.cc
47216 @@ -409,7 +409,7 @@ std::string GetFullUserAgent(
47220 -#if BUILDFLAG(IS_ANDROID)
47222 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
47225 diff --git a/src/components/favicon/core/favicon_database_unittest.cc b/src/components/favicon/core…
47227 --- a/src/components/favicon/core/favicon_database_unittest.cc
47229 @@ -176,8 +176,8 @@ base::Time GetLastUpdated(FaviconDatabase* db, favicon_base::FaviconID icon) {
47233 - FaviconDatabaseTest() {}
47234 - ~FaviconDatabaseTest() override {}
47240 @@ -1030,18 +1030,14 @@ TEST_F(FaviconDatabaseTest, Recovery) {
47244 - // Corrupt the |icon_mapping.page_url| index by deleting an element
47245 - // from the backing table but not the index.
47253 - static const char kDeleteSql[] =
47254 - "DELETE FROM icon_mapping WHERE page_url = 'http://yahoo.com/'";
47255 - EXPECT_TRUE(
47256 - sql::test::CorruptTableOrIndex(file_name_, kIndexName, kDeleteSql));
47261 @@ -1052,18 +1048,18 @@ TEST_F(FaviconDatabaseTest, Recovery) {
47265 - sql::test::ScopedErrorExpecter expecter;
47266 - expecter.ExpectError(SQLITE_CORRUPT);
47267 FaviconDatabase db;
47268 ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
47270 - // Data for kPageUrl2 was deleted, but the index entry remains,
47271 - // this will throw SQLITE_CORRUPT. The corruption handler will
47272 - // recover the database and poison the handle, so the outer call
47273 - // fails.
47274 - EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, nullptr));
47275 -
47276 - ASSERT_TRUE(expecter.SawExpectedErrors());
47283 + EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, nullptr));
47289 @@ -1076,18 +1072,18 @@ TEST_F(FaviconDatabaseTest, Recovery) {
47293 - // Database should also be recovered at higher levels.
47297 FaviconDatabase db;
47298 ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
47300 - // Now this fails because there is no mapping.
47301 - EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, nullptr));
47302 -
47303 - // Other data was retained by recovery.
47304 EXPECT_TRUE(CheckPageHasIcon(&db, kPageUrl1,
47307 + EXPECT_TRUE(CheckPageHasIcon(&db, kPageUrl2,
47313 @@ -1105,17 +1101,20 @@ TEST_F(FaviconDatabaseTest, Recovery) {
47317 - sql::test::ScopedErrorExpecter expecter;
47318 - expecter.ExpectError(SQLITE_CORRUPT);
47319 FaviconDatabase db;
47320 - ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
47324 + ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
47328 - EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, nullptr));
47329 EXPECT_TRUE(CheckPageHasIcon(&db, kPageUrl1,
47332 -
47333 - ASSERT_TRUE(expecter.SawExpectedErrors());
47334 + EXPECT_TRUE(CheckPageHasIcon(&db, kPageUrl2,
47340 @@ -1124,18 +1123,14 @@ TEST_F(FaviconDatabaseTest, Recovery7) {
47344 - // Corrupt the |icon_mapping.page_url| index by deleting an element
47345 - // from the backing table but not the index.
47353 - static const char kDeleteSql[] =
47354 - "DELETE FROM icon_mapping WHERE page_url = 'http://yahoo.com/'";
47355 - EXPECT_TRUE(
47356 - sql::test::CorruptTableOrIndex(file_name_, kIndexName, kDeleteSql));
47361 @@ -1147,18 +1142,17 @@ TEST_F(FaviconDatabaseTest, Recovery7) {
47365 - sql::test::ScopedErrorExpecter expecter;
47366 - expecter.ExpectError(SQLITE_CORRUPT);
47367 FaviconDatabase db;
47368 ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
47369 -
47370 - // Data for kPageUrl2 was deleted, but the index entry remains,
47371 - // this will throw SQLITE_CORRUPT. The corruption handler will
47372 - // recover the database and poison the handle, so the outer call
47373 - // fails.
47374 - EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, nullptr));
47375 -
47376 - ASSERT_TRUE(expecter.SawExpectedErrors());
47383 + EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, nullptr));
47389 @@ -1171,18 +1165,18 @@ TEST_F(FaviconDatabaseTest, Recovery7) {
47393 - // Database should also be recovered at higher levels.
47397 FaviconDatabase db;
47398 ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
47400 - // Now this fails because there is no mapping.
47401 - EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, nullptr));
47402 -
47403 - // Other data was retained by recovery.
47404 EXPECT_TRUE(CheckPageHasIcon(&db, kPageUrl1,
47407 + EXPECT_TRUE(CheckPageHasIcon(&db, kPageUrl2,
47413 @@ -1200,17 +1194,20 @@ TEST_F(FaviconDatabaseTest, Recovery7) {
47417 - sql::test::ScopedErrorExpecter expecter;
47418 - expecter.ExpectError(SQLITE_CORRUPT);
47419 FaviconDatabase db;
47420 - ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
47424 + ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
47428 - EXPECT_FALSE(db.GetIconMappingsForPageURL(kPageUrl2, nullptr));
47429 EXPECT_TRUE(CheckPageHasIcon(&db, kPageUrl1,
47432 -
47433 - ASSERT_TRUE(expecter.SawExpectedErrors());
47434 + EXPECT_TRUE(CheckPageHasIcon(&db, kPageUrl2,
47440 diff --git a/src/components/feature_engagement/public/event_constants.cc b/src/components/feature_e…
47442 --- a/src/components/feature_engagement/public/event_constants.cc
47444 @@ -11,7 +11,7 @@ namespace feature_engagement {
47448 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
47453 diff --git a/src/components/feature_engagement/public/event_constants.h b/src/components/feature_en…
47455 --- a/src/components/feature_engagement/public/event_constants.h
47457 @@ -13,7 +13,7 @@ namespace events {
47461 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
47466 diff --git a/src/components/feature_engagement/public/feature_constants.cc b/src/components/feature…
47468 --- a/src/components/feature_engagement/public/feature_constants.cc
47470 @@ -22,7 +22,7 @@ const base::Feature kIPHDummyFeature{"IPH_Dummy",
47474 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
47479 @@ -275,7 +275,8 @@ const base::Feature kIPHDiscoverFeedHeaderFeature{
47483 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
47489 diff --git a/src/components/feature_engagement/public/feature_constants.h b/src/components/feature_…
47491 --- a/src/components/feature_engagement/public/feature_constants.h
47493 @@ -30,7 +30,7 @@ extern const base::Feature kUseClientConfigIPH;
47497 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
47502 @@ -170,7 +170,8 @@ extern const base::Feature kIPHDiscoverFeedHeaderFeature;
47506 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
47512 diff --git a/src/components/feature_engagement/public/feature_list.cc b/src/components/feature_enga…
47514 --- a/src/components/feature_engagement/public/feature_list.cc
47516 @@ -117,7 +117,7 @@ const base::Feature* const kAllFeatures[] = {
47520 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
47525 diff --git a/src/components/feature_engagement/public/feature_list.h b/src/components/feature_engag…
47527 --- a/src/components/feature_engagement/public/feature_list.h
47529 @@ -223,7 +223,7 @@ DEFINE_VARIATION_PARAM(kIPHDiscoverFeedHeaderFeature,
47533 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
47538 @@ -356,7 +356,7 @@ constexpr flags_ui::FeatureEntry::FeatureVariation
47542 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
47547 diff --git a/src/components/find_in_page/find_tab_helper.cc b/src/components/find_in_page/find_tab_…
47549 --- a/src/components/find_in_page/find_tab_helper.cc
47551 @@ -45,7 +45,12 @@ void FindTabHelper::StartFinding(std::u16string search_string,
47555 - bool run_synchronously_for_testing) {
47565 @@ -60,10 +65,15 @@ void FindTabHelper::StartFinding(std::u16string search_string,
47569 -
47582 diff --git a/src/components/find_in_page/find_tab_helper.h b/src/components/find_in_page/find_tab_h…
47584 --- a/src/components/find_in_page/find_tab_helper.h
47586 @@ -56,7 +56,12 @@ class FindTabHelper : public content::WebContentsUserData<FindTabHelper> {
47590 - bool run_synchronously_for_testing = false);
47600 diff --git a/src/components/flags_ui/flags_state.cc b/src/components/flags_ui/flags_state.cc
47602 --- a/src/components/flags_ui/flags_state.cc
47604 @@ -54,6 +54,7 @@ const struct {
47612 @@ -660,6 +661,8 @@ unsigned short FlagsState::GetCurrentPlatform() {
47621 diff --git a/src/components/flags_ui/flags_state.h b/src/components/flags_ui/flags_state.h
47623 --- a/src/components/flags_ui/flags_state.h
47625 @@ -44,12 +44,13 @@ enum {
47631 - kDeprecated = 1 << 9,
47635 // a manually-added flag.
47636 - kFlagInfrastructure = 1 << 10,
47640 // A flag controlling the behavior of the |ConvertFlagsToSwitches| function -
47641 diff --git a/src/components/history/core/browser/top_sites_database.h b/src/components/history/core…
47643 --- a/src/components/history/core/browser/top_sites_database.h
47645 @@ -49,8 +49,10 @@ class TopSitesDatabase {
47649 - FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, Recovery3);
47650 - FRIEND_TEST_ALL_PREFIXES(TopSitesDatabaseTest, Recovery4);
47658 diff --git a/src/components/history/core/browser/top_sites_database_unittest.cc b/src/components/hi…
47660 --- a/src/components/history/core/browser/top_sites_database_unittest.cc
47662 @@ -210,7 +210,7 @@ TEST_F(TopSitesDatabaseTest, Recovery2) {
47666 -TEST_F(TopSitesDatabaseTest, Recovery3) {
47671 @@ -219,28 +219,30 @@ TEST_F(TopSitesDatabaseTest, Recovery3) {
47675 - sql::test::ScopedErrorExpecter expecter;
47676 - expecter.ExpectError(SQLITE_CORRUPT);
47678 - EXPECT_TRUE(raw_db.Open(file_name_));
47686 - ASSERT_TRUE(expecter.SawExpectedErrors());
47691 - sql::test::ScopedErrorExpecter expecter;
47692 - expecter.ExpectError(SQLITE_CORRUPT);
47693 -
47694 TopSitesDatabase db;
47695 - ASSERT_TRUE(db.Init(file_name_));
47699 + ASSERT_TRUE(db.Init(file_name_));
47704 db.GetSites(&urls);
47707 -
47708 - ASSERT_TRUE(expecter.SawExpectedErrors());
47711 // Double-check database integrity.
47712 @@ -249,17 +251,26 @@ TEST_F(TopSitesDatabaseTest, Recovery3) {
47728 + TopSitesDatabase db;
47729 + ASSERT_TRUE(db.Init(file_name_));
47732 - // Corrupt the thumnails.url auto-index by deleting an element from the table
47733 - // but leaving it in the index.
47734 + // Corrupt the thumbnails.url auto-index.
47737 - // TODO(shess): Refactor CorruptTableOrIndex() to make parameterized
47738 - // statements easy.
47739 - static const char kDeleteSql[] =
47740 - "DELETE FROM top_sites WHERE url = "
47741 - "'http://www.google.com/chrome/intl/en/welcome.html'";
47742 - EXPECT_TRUE(
47743 - sql::test::CorruptTableOrIndex(file_name_, kIndexName, kDeleteSql));
47748 @@ -278,13 +289,13 @@ TEST_F(TopSitesDatabaseTest, Recovery3) {
47752 - // Data for kUrl1 was deleted, but the index entry remains, this will
47753 - // throw SQLITE_CORRUPT. The corruption handler will recover the database
47754 - // and poison the handle, so the outer call fails.
47759 db.GetURLRank(MostVisitedURL(kUrl1, std::u16string())));
47761 - ASSERT_TRUE(expecter.SawExpectedErrors());
47766 @@ -295,25 +306,27 @@ TEST_F(TopSitesDatabaseTest, Recovery3) {
47770 - // After recovery, the database accesses won't throw errors. The top-ranked
47771 - // item is removed, but the ranking was revised in post-processing.
47775 TopSitesDatabase db;
47776 ASSERT_TRUE(db.Init(file_name_));
47777 VerifyTablesAndColumns(db.db_.get());
47779 - EXPECT_EQ(TopSitesDatabase::kRankOfNonExistingURL,
47780 - db.GetURLRank(MostVisitedURL(kUrl1, std::u16string())));
47781 + EXPECT_EQ(0, db.GetURLRank(MostVisitedURL(kUrl0, std::u16string())));
47782 + EXPECT_EQ(1, db.GetURLRank(MostVisitedURL(kUrl1, std::u16string())));
47783 + EXPECT_EQ(2, db.GetURLRank(MostVisitedURL(kUrl2, std::u16string())));
47786 db.GetSites(&urls);
47787 - ASSERT_EQ(2u, urls.size());
47790 - EXPECT_EQ(kUrl2, urls[1].url); // [1] because of url_rank.
47796 -TEST_F(TopSitesDatabaseTest, Recovery4) {
47801 @@ -322,28 +335,30 @@ TEST_F(TopSitesDatabaseTest, Recovery4) {
47805 - sql::test::ScopedErrorExpecter expecter;
47806 - expecter.ExpectError(SQLITE_CORRUPT);
47808 - EXPECT_TRUE(raw_db.Open(file_name_));
47816 - ASSERT_TRUE(expecter.SawExpectedErrors());
47821 - sql::test::ScopedErrorExpecter expecter;
47822 - expecter.ExpectError(SQLITE_CORRUPT);
47823 -
47824 TopSitesDatabase db;
47825 - ASSERT_TRUE(db.Init(file_name_));
47829 + ASSERT_TRUE(db.Init(file_name_));
47834 db.GetSites(&urls);
47837 -
47838 - ASSERT_TRUE(expecter.SawExpectedErrors());
47841 // Double-check database integrity.
47842 @@ -352,17 +367,15 @@ TEST_F(TopSitesDatabaseTest, Recovery4) {
47848 - // Corrupt the tops_sites.url auto-index by deleting an element from the table
47849 - // but leaving it in the index.
47854 + // Corrupt the thumnails.url auto-index.
47856 - // TODO(shess): Refactor CorruptTableOrIndex() to make parameterized
47857 - // statements easy.
47858 - static const char kDeleteSql[] =
47859 - "DELETE FROM top_sites WHERE url = "
47860 - "'http://www.google.com/chrome/intl/en/welcome.html'";
47861 - EXPECT_TRUE(
47862 - sql::test::CorruptTableOrIndex(file_name_, kIndexName, kDeleteSql));
47867 @@ -381,9 +394,9 @@ TEST_F(TopSitesDatabaseTest, Recovery4) {
47871 - // Data for kUrl1 was deleted, but the index entry remains, this will
47872 - // throw SQLITE_CORRUPT. The corruption handler will recover the database
47873 - // and poison the handle, so the outer call fails.
47878 db.GetURLRank(MostVisitedURL(kUrl1, std::u16string())));
47880 @@ -398,13 +411,85 @@ TEST_F(TopSitesDatabaseTest, Recovery4) {
47884 - // After recovery, the database accesses won't throw errors. The top-ranked
47885 - // item is removed, but the ranking was revised in post-processing.
47889 + TopSitesDatabase db;
47890 + ASSERT_TRUE(db.Init(file_name_));
47891 + VerifyTablesAndColumns(db.db_.get());
47893 + EXPECT_EQ(0, db.GetURLRank(MostVisitedURL(kUrl0, std::u16string())));
47894 + EXPECT_EQ(1, db.GetURLRank(MostVisitedURL(kUrl1, std::u16string())));
47895 + EXPECT_EQ(2, db.GetURLRank(MostVisitedURL(kUrl2, std::u16string())));
47898 + db.GetSites(&urls);
47918 + // Corrupt the thumnails.url auto-index.
47932 + TopSitesDatabase db;
47933 + ASSERT_TRUE(db.Init(file_name_));
47943 + db.GetURLRank(MostVisitedURL(kUrl0, std::u16string())));
47959 TopSitesDatabase db;
47960 ASSERT_TRUE(db.Init(file_name_));
47961 VerifyTablesAndColumns(db.db_.get());
47963 + EXPECT_EQ(0, db.GetURLRank(MostVisitedURL(kUrl0, std::u16string())));
47964 + EXPECT_EQ(1, db.GetURLRank(MostVisitedURL(kUrl2, std::u16string())));
47966 db.GetURLRank(MostVisitedURL(kUrl1, std::u16string())));
47968 diff --git a/src/components/javascript_dialogs/BUILD.gn b/src/components/javascript_dialogs/BUILD.gn
47970 --- a/src/components/javascript_dialogs/BUILD.gn
47972 @@ -42,7 +42,7 @@ static_library("javascript_dialogs") {
47976 - if (toolkit_views) {
47981 diff --git a/src/components/live_caption/BUILD.gn b/src/components/live_caption/BUILD.gn
47983 --- a/src/components/live_caption/BUILD.gn
47985 @@ -28,7 +28,7 @@ if (!is_android) {
47989 - if (toolkit_views) {
47994 diff --git a/src/components/metrics/BUILD.gn b/src/components/metrics/BUILD.gn
47996 --- a/src/components/metrics/BUILD.gn
47998 @@ -153,7 +153,7 @@ static_library("metrics") {
48002 - if (is_linux || is_chromeos) {
48007 diff --git a/src/components/offline_pages/buildflags/features.gni b/src/components/offline_pages/bu…
48009 --- a/src/components/offline_pages/buildflags/features.gni
48011 @@ -5,7 +5,7 @@
48013 # Whether to enable OfflinePages support. Currently user-visible features
48014 # are Android-only.
48015 - enable_offline_pages = is_android
48018 # This enables test API for locally-built harness which is used for quality
48020 diff --git a/src/components/offline_pages/core/model/offline_page_model_taskified.cc b/src/componen…
48022 --- a/src/components/offline_pages/core/model/offline_page_model_taskified.cc
48024 @@ -32,8 +32,8 @@
48030 -#include "components/offline_pages/core/offline_page_feature.h"
48034 @@ -186,7 +186,7 @@ OfflinePageModelTaskified::OfflinePageModelTaskified(
48038 -OfflinePageModelTaskified::~OfflinePageModelTaskified() {}
48043 @@ -582,9 +582,9 @@ void OfflinePageModelTaskified::OnDeleteDone(
48047 - task_runner_->PostTask(FROM_HERE,
48048 - base::BindOnce(&OfflinePageModelTaskified::Unpublish,
48049 - archive_publisher_.get(), publish_ids));
48050 + task_runner_->PostTask(
48052 + archive_publisher_->GetWeakPtr(), publish_ids));
48056 @@ -609,9 +609,9 @@ void OfflinePageModelTaskified::OnStoreFaviconDone(int64_t offline_id,
48060 - OfflinePageArchivePublisher* publisher,
48063 - if (!publish_ids.empty())
48065 publisher->UnpublishArchives(publish_ids);
48068 @@ -663,7 +663,7 @@ void OfflinePageModelTaskified::RunMaintenanceTasks(base::Time now,
48072 - Unpublish(archive_publisher_.get(), ids_of_deleted_pages);
48073 + Unpublish(archive_publisher_->GetWeakPtr(), ids_of_deleted_pages);
48077 diff --git a/src/components/offline_pages/core/model/offline_page_model_taskified.h b/src/component…
48079 --- a/src/components/offline_pages/core/model/offline_page_model_taskified.h
48081 @@ -10,18 +10,14 @@
48085 -#include "base/callback.h"
48086 -#include "base/memory/ref_counted.h"
48089 -#include "components/keyed_service/core/keyed_service.h"
48096 -#include "components/offline_pages/core/offline_store_types.h"
48100 @@ -185,7 +181,7 @@ class OfflinePageModelTaskified : public OfflinePageModel,
48104 - static void Unpublish(OfflinePageArchivePublisher* publisher,
48109 diff --git a/src/components/offline_pages/core/offline_page_archive_publisher.h b/src/components/of…
48111 --- a/src/components/offline_pages/core/offline_page_archive_publisher.h
48113 @@ -7,7 +7,6 @@
48117 -#include "base/callback.h"
48121 @@ -60,7 +59,7 @@ class OfflinePageArchivePublisher {
48125 - virtual ~OfflinePageArchivePublisher() {}
48130 @@ -72,6 +71,8 @@ class OfflinePageArchivePublisher {
48139 diff --git a/src/components/offline_pages/core/offline_page_test_archive_publisher.cc b/src/compone…
48141 --- a/src/components/offline_pages/core/offline_page_test_archive_publisher.cc
48143 @@ -8,12 +8,10 @@
48147 -#include "base/files/file_util.h"
48152 -#include "url/gurl.h"
48156 @@ -69,4 +67,9 @@ void OfflinePageTestArchivePublisher::UnpublishArchives(
48166 diff --git a/src/components/offline_pages/core/offline_page_test_archive_publisher.h b/src/componen…
48168 --- a/src/components/offline_pages/core/offline_page_test_archive_publisher.h
48170 @@ -7,11 +7,9 @@
48174 -#include "base/callback.h"
48178 -#include "components/offline_pages/core/offline_page_types.h"
48182 @@ -35,6 +33,8 @@ class OfflinePageTestArchivePublisher : public OfflinePageArchivePublisher {
48191 diff --git a/src/components/optimization_guide/core/entity_metadata.cc b/src/components/optimizatio…
48193 --- a/src/components/optimization_guide/core/entity_metadata.cc
48195 @@ -4,6 +4,7 @@
48203 @@ -67,7 +68,7 @@ bool operator==(const ScoredEntityMetadata& lhs,
48205 constexpr const double kScoreTolerance = 1e-6;
48207 - abs(lhs.score - rhs.score) <= kScoreTolerance;
48208 + std::abs(lhs.score - rhs.score) <= kScoreTolerance;
48212 diff --git a/src/components/optimization_guide/core/page_content_annotations_common.cc b/src/compon…
48214 --- a/src/components/optimization_guide/core/page_content_annotations_common.cc
48216 @@ -5,6 +5,7 @@
48224 @@ -40,7 +41,7 @@ WeightedString::~WeightedString() = default;
48226 constexpr double kWeightTolerance = 1e-6;
48227 return this->value_ == other.value_ &&
48228 - abs(this->weight_ - other.weight_) <= kWeightTolerance;
48229 + std::abs(this->weight_ - other.weight_) <= kWeightTolerance;
48233 diff --git a/src/components/optimization_guide/features.gni b/src/components/optimization_guide/fea…
48235 --- a/src/components/optimization_guide/features.gni
48237 @@ -8,7 +8,7 @@ declare_args() {
48241 - is_linux || is_mac || is_chromeos || is_fuchsia
48246 diff --git a/src/components/os_crypt/BUILD.gn b/src/components/os_crypt/BUILD.gn
48248 --- a/src/components/os_crypt/BUILD.gn
48250 @@ -57,7 +57,7 @@ component("os_crypt") {
48254 - if ((is_posix || is_fuchsia) && !is_apple && (!is_linux || is_chromecast)) {
48259 @@ -74,7 +74,7 @@ component("os_crypt") {
48263 - if (is_linux && !is_chromecast) {
48268 diff --git a/src/components/os_crypt/os_crypt.h b/src/components/os_crypt/os_crypt.h
48270 --- a/src/components/os_crypt/os_crypt.h
48272 @@ -37,13 +37,13 @@ class OSCrypt {
48276 -#if BUILDFLAG(IS_LINUX)
48283 -#endif // BUILDFLAG(IS_LINUX)
48288 diff --git a/src/components/os_crypt/os_crypt_linux.cc b/src/components/os_crypt/os_crypt_linux.cc
48290 --- a/src/components/os_crypt/os_crypt_linux.cc
48292 @@ -273,6 +273,7 @@ std::string OSCrypt::GetRawEncryptionKey() {
48293 return key->key();
48300 @@ -296,3 +297,4 @@ void OSCrypt::SetEncryptionPasswordForTesting(const std::string& password) {
48305 diff --git a/src/components/password_manager/content/browser/content_password_manager_driver.cc b/s…
48307 --- a/src/components/password_manager/content/browser/content_password_manager_driver.cc
48309 @@ -407,7 +407,7 @@ void ContentPasswordManagerDriver::CheckSafeBrowsingReputation(
48310 if (client_->GetMetricsRecorder()) {
48311 client_->GetMetricsRecorder()->RecordUserFocusedPasswordField();
48313 -#if defined(ON_FOCUS_PING_ENABLED)
48315 client_->CheckSafeBrowsingReputation(form_action, frame_url);
48318 diff --git a/src/components/password_manager/core/browser/password_manager_client.h b/src/component…
48320 --- a/src/components/password_manager/core/browser/password_manager_client.h
48322 @@ -348,7 +348,7 @@ class PasswordManagerClient {
48326 -#if defined(ON_FOCUS_PING_ENABLED)
48331 diff --git a/src/components/policy/BUILD.gn b/src/components/policy/BUILD.gn
48333 --- a/src/components/policy/BUILD.gn
48335 @@ -21,7 +21,7 @@ gen_policy_templates_local = false
48339 -gen_policy_templates_linux = is_linux || is_chromeos
48344 @@ -141,6 +141,11 @@ action("policy_code_generate") {
48346 "--risk-tag-header=" + rebase_path(risk_tag_header_path, root_build_dir),
48350 + args -= [ "--target-platform=" + target_os ]
48351 + args += [ "--target-platform=linux" ]
48356 @@ -177,6 +182,11 @@ action("full_runtime_code_generate") {
48362 + args -= [ "--target-platform=" + target_os ]
48363 + args += [ "--target-platform=linux" ]
48368 diff --git a/src/components/policy/core/common/cloud/cloud_policy_util.cc b/src/components/policy/c…
48370 --- a/src/components/policy/core/common/cloud/cloud_policy_util.cc
48372 @@ -77,7 +77,7 @@ namespace em = enterprise_management;
48376 - BUILDFLAG(IS_FUCHSIA)
48381 diff --git a/src/components/renderer_context_menu/BUILD.gn b/src/components/renderer_context_menu/B…
48383 --- a/src/components/renderer_context_menu/BUILD.gn
48385 @@ -29,7 +29,7 @@ static_library("renderer_context_menu") {
48389 - if (toolkit_views) {
48394 diff --git a/src/components/safe_browsing/content/browser/base_ui_manager.cc b/src/components/safe_…
48396 --- a/src/components/safe_browsing/content/browser/base_ui_manager.cc
48398 @@ -21,6 +21,7 @@
48402 +#include "services/network/public/mojom/fetch_api.mojom-shared.h"
48406 @@ -207,12 +208,19 @@ content::WebContents* GetEmbeddingWebContentsForInterstitial(
48410 - if (resource.is_subresource && !resource.is_subframe) {
48418 - // main-frame or sub-frame resource. Similar warning restrictions should be
48419 - // applied to malware sites tagged as "landing sites" (see "Types of
48420 - // Malware sites" under
48421 - // https://developers.google.com/safe-browsing/developers_guide_v3#UserWarnings).
48422 + // main-frame or frame-like (subframe, embed, object) resource. Similar
48425 + // https://developers.google.com/safe-browsing/v4/metadata#malware-sites).
48431 diff --git a/src/components/safe_browsing/content/common/proto/BUILD.gn b/src/components/safe_brows…
48433 --- a/src/components/safe_browsing/content/common/proto/BUILD.gn
48435 @@ -5,7 +5,7 @@
48439 -if (safe_browsing_mode != 0) {
48444 diff --git a/src/components/safe_browsing/core/browser/db/BUILD.gn b/src/components/safe_browsing/c…
48446 --- a/src/components/safe_browsing/core/browser/db/BUILD.gn
48447 +++ b/src/components/safe_browsing/core/browser/db/BUILD.gn
48448 @@ -79,6 +79,7 @@ static_library("test_database_manager") {
48456 diff --git a/src/components/safe_browsing/core/browser/db/fake_database_manager.cc b/src/components…
48458 --- a/src/components/safe_browsing/core/browser/db/fake_database_manager.cc
48459 +++ b/src/components/safe_browsing/core/browser/db/fake_database_manager.cc
48460 @@ -3,6 +3,7 @@
48463 #include "components/safe_browsing/core/browser/db/fake_database_manager.h"
48464 +#include "components/safe_browsing/core/browser/db/util.h"
48468 @@ -20,6 +21,12 @@ void FakeSafeBrowsingDatabaseManager::AddDangerousUrl(
48481 @@ -46,10 +53,16 @@ bool FakeSafeBrowsingDatabaseManager::CheckBrowseUrl(
48488 + pattern_type = it1->second;
48491 io_task_runner()->PostTask(
48494 - result_threat_type, client));
48499 @@ -102,9 +115,11 @@ bool FakeSafeBrowsingDatabaseManager::IsSupported() const {
48505 - client->OnCheckBrowseUrlResult(url, result_threat_type,
48506 - safe_browsing::ThreatMetadata());
48509 + client->OnCheckBrowseUrlResult(url, result_threat_type, metadata);
48513 diff --git a/src/components/safe_browsing/core/browser/db/fake_database_manager.h b/src/components/…
48515 --- a/src/components/safe_browsing/core/browser/db/fake_database_manager.h
48516 +++ b/src/components/safe_browsing/core/browser/db/fake_database_manager.h
48517 @@ -7,6 +7,7 @@
48520 #include "components/safe_browsing/core/browser/db/test_database_manager.h"
48521 +#include "components/safe_browsing/core/browser/db/util.h"
48525 @@ -20,6 +21,8 @@ class FakeSafeBrowsingDatabaseManager : public TestSafeBrowsingDatabaseManager {
48534 @@ -43,12 +46,14 @@ class FakeSafeBrowsingDatabaseManager : public TestSafeBrowsingDatabaseManager {
48549 diff --git a/src/components/security_interstitials/content/utils.cc b/src/components/security_inter…
48551 --- a/src/components/security_interstitials/content/utils.cc
48553 @@ -34,7 +34,7 @@ void LaunchDateAndTimeSettings() {
48557 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
48562 diff --git a/src/components/signin/core/browser/account_reconcilor.cc b/src/components/signin/core/…
48564 --- a/src/components/signin/core/browser/account_reconcilor.cc
48566 @@ -695,7 +695,7 @@ void AccountReconcilor::ScheduleStartReconcileIfChromeAccountsChanged() {
48568 base::ThreadTaskRunnerHandle::Get()->PostTask(
48570 - base::Unretained(this),
48575 diff --git a/src/components/signin/features.gni b/src/components/signin/features.gni
48577 --- a/src/components/signin/features.gni
48579 @@ -5,7 +5,7 @@
48583 -enable_dice_support = is_linux || is_mac || is_win || is_fuchsia
48588 diff --git a/src/components/storage_monitor/BUILD.gn b/src/components/storage_monitor/BUILD.gn
48590 --- a/src/components/storage_monitor/BUILD.gn
48592 @@ -70,7 +70,7 @@ static_library("storage_monitor") {
48596 - } else if (is_linux || is_chromeos_lacros) {
48601 diff --git a/src/components/sync_device_info/BUILD.gn b/src/components/sync_device_info/BUILD.gn
48603 --- a/src/components/sync_device_info/BUILD.gn
48605 @@ -58,7 +58,7 @@ static_library("sync_device_info") {
48609 - if (is_linux || is_chromeos) {
48614 diff --git a/src/components/update_client/update_query_params.cc b/src/components/update_client/upd…
48616 --- a/src/components/update_client/update_query_params.cc
48618 @@ -40,6 +40,8 @@ const char kOs[] =
48627 diff --git a/src/components/variations/client_filterable_state.cc b/src/components/variations/clien…
48629 --- a/src/components/variations/client_filterable_state.cc
48631 @@ -28,7 +28,7 @@ Study::Platform ClientFilterableState::GetCurrentPlatform() {
48635 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || BUILDFLAG(IS_SOLARIS)
48640 diff --git a/src/components/variations/service/variations_service.cc b/src/components/variations/se…
48642 --- a/src/components/variations/service/variations_service.cc
48644 @@ -113,6 +113,8 @@ std::string GetPlatformString() {
48653 diff --git a/src/components/viz/common/features.cc b/src/components/viz/common/features.cc
48655 --- a/src/components/viz/common/features.cc
48657 @@ -64,7 +64,7 @@ const base::Feature kUseSkiaRenderer {
48661 - BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_MAC)
48666 diff --git a/src/components/viz/service/display/gl_renderer.cc b/src/components/viz/service/display…
48668 --- a/src/components/viz/service/display/gl_renderer.cc
48670 @@ -513,11 +513,17 @@ void GLRenderer::ReleaseRenderPassTextures() {
48681 output_surface_->capabilities().uses_default_gl_framebuffer;
48685 gl_->DiscardFramebufferEXT(GL_FRAMEBUFFER, base::size(attachments),
48688 diff --git a/src/components/viz/service/display/overlay_candidate_temporal_tracker.cc b/src/compone…
48690 --- a/src/components/viz/service/display/overlay_candidate_temporal_tracker.cc
48692 @@ -5,6 +5,7 @@
48700 diff --git a/src/content/app/content_main.cc b/src/content/app/content_main.cc
48702 --- a/src/content/app/content_main.cc
48704 @@ -85,7 +85,7 @@ namespace {
48708 -
48710 // Setup signal-handling state: resanitize most signals, ignore SIGPIPE.
48713 @@ -112,6 +112,7 @@ void SetupSignalHandlers() {
48721 @@ -304,8 +305,11 @@ int ContentMainInitialize(ContentMainParams params,
48727 -#endif
48734 diff --git a/src/content/app/content_main_runner_impl.cc b/src/content/app/content_main_runner_impl…
48736 --- a/src/content/app/content_main_runner_impl.cc
48738 @@ -88,6 +88,7 @@
48746 @@ -726,11 +727,19 @@ int ContentMainRunnerImpl::Initialize(ContentMainParams params) {
48750 - g_fds->Set(kMojoIPCChannel,
48751 - kMojoIPCChannel + base::GlobalDescriptors::kBaseDescriptor);
48752 -
48753 - g_fds->Set(kFieldTrialDescriptor,
48754 - kFieldTrialDescriptor + base::GlobalDescriptors::kBaseDescriptor);
48760 + g_fds->Set(kMojoIPCChannel,
48762 + g_fds->Set(
48771 @@ -972,6 +981,11 @@ int NO_STACK_PROTECTOR ContentMainRunnerImpl::Run() {
48777 + return -1;
48781 delegate_->PostFieldTrialInitialization();
48783 @@ -1153,6 +1167,22 @@ int ContentMainRunnerImpl::RunBrowser(MainFunctionParams main_params,
48806 diff --git a/src/content/app/content_main_runner_impl.h b/src/content/app/content_main_runner_impl.h
48808 --- a/src/content/app/content_main_runner_impl.h
48810 @@ -55,7 +55,9 @@ class CONTENT_EXPORT ContentMainRunnerImpl : public ContentMainRunner {
48814 -
48821 diff --git a/src/content/browser/BUILD.gn b/src/content/browser/BUILD.gn
48823 --- a/src/content/browser/BUILD.gn
48825 @@ -2225,6 +2225,23 @@ source_set("browser") {
48849 @@ -2279,6 +2296,23 @@ source_set("browser") {
48873 @@ -2892,6 +2926,10 @@ source_set("browser") {
48878 + sources -= [ "media/session/audio_focus_delegate_default.cc" ]
48884 diff --git a/src/content/browser/child_process_launcher_helper.h b/src/content/browser/child_proces…
48886 --- a/src/content/browser/child_process_launcher_helper.h
48888 @@ -47,6 +47,10 @@
48899 @@ -210,6 +214,10 @@ class ChildProcessLauncherHelper :
48910 @@ -255,6 +263,11 @@ class ChildProcessLauncherHelper :
48922 diff --git a/src/content/browser/child_process_launcher_helper_linux.cc b/src/content/browser/child…
48924 --- a/src/content/browser/child_process_launcher_helper_linux.cc
48926 @@ -2,6 +2,11 @@
48927 // Use of this source code is governed by a BSD-style license that can be
48938 @@ -99,7 +104,41 @@ ChildProcessLauncherHelper::LaunchProcessOnLauncherThread(
48944 + base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kForTest);
48948 + const std::vector<std::string> argv_str = command_line()->argv();
48951 + for (int i = 0; i < argv_str.size() - 1; ++i) {
48954 + argv_ss << argv_str[argv_str.size() - 1];
48964 + int ret = app_mgr_client_adapter_->StartRenderProcess(
48980 @@ -110,6 +149,41 @@ void ChildProcessLauncherHelper::AfterLaunchOnLauncherThread(
49000 + // is by oom-killer.
49022 @@ -117,6 +191,22 @@ ChildProcessTerminationInfo ChildProcessLauncherHelper::GetTerminationInfo(
49024 info.status = process.zygote->GetTerminationStatus(
49029 + int ret = app_mgr_client_adapter_->GetRenderProcessTerminationStatus(
49045 diff --git a/src/content/browser/devtools/devtools_http_handler.cc b/src/content/browser/devtools/d…
49047 --- a/src/content/browser/devtools/devtools_http_handler.cc
49049 @@ -278,6 +278,7 @@ void StartServerOnHandlerThread(
49055 // Write this port to a well-known file in the profile directory
49057 diff --git a/src/content/browser/devtools/protocol/page_handler.cc b/src/content/browser/devtools/p…
49059 --- a/src/content/browser/devtools/protocol/page_handler.cc
49061 @@ -226,6 +226,8 @@ PageHandler::PageHandler(
49070 diff --git a/src/content/browser/file_system_access/fake_file_system_access_permission_context.cc b…
49072 --- a/src/content/browser/file_system_access/fake_file_system_access_permission_context.cc
49074 @@ -35,22 +35,24 @@ FakeFileSystemAccessPermissionContext::GetWritePermissionGrant(
49078 -void FakeFileSystemAccessPermissionContext::ConfirmSensitiveDirectoryAccess(
49086 - base::OnceCallback<void(SensitiveDirectoryResult)> callback) {
49087 - std::move(callback).Run(SensitiveDirectoryResult::kAllowed);
49091 -
49103 diff --git a/src/content/browser/file_system_access/fake_file_system_access_permission_context.h b/…
49105 --- a/src/content/browser/file_system_access/fake_file_system_access_permission_context.h
49107 @@ -4,6 +4,7 @@
49115 @@ -32,19 +33,20 @@ class FakeFileSystemAccessPermissionContext
49119 - void ConfirmSensitiveDirectoryAccess(
49127 - base::OnceCallback<void(SensitiveDirectoryResult)> callback) override;
49128 -
49135 -
49140 diff --git a/src/content/browser/file_system_access/file_system_access_file_writer_impl.cc b/src/co…
49142 --- a/src/content/browser/file_system_access/file_system_access_file_writer_impl.cc
49144 @@ -49,7 +49,9 @@ FileSystemAccessFileWriterImpl::FileSystemAccessFileWriterImpl(
49153 DCHECK_EQ(lock_->type(),
49154 diff --git a/src/content/browser/file_system_access/file_system_access_file_writer_impl.h b/src/con…
49156 --- a/src/content/browser/file_system_access/file_system_access_file_writer_impl.h
49158 @@ -115,9 +115,11 @@ class CONTENT_EXPORT FileSystemAccessFileWriterImpl
49170 diff --git a/src/content/browser/file_system_access/file_system_access_manager_impl.cc b/src/conten…
49172 --- a/src/content/browser/file_system_access/file_system_access_manager_impl.cc
49174 @@ -63,8 +63,8 @@ namespace content {
49178 -using SensitiveDirectoryResult =
49179 - FileSystemAccessPermissionContext::SensitiveDirectoryResult;
49185 @@ -519,6 +519,16 @@ void FileSystemAccessManagerImpl::SetDefaultPathAndShowPicker(
49202 @@ -1120,7 +1130,7 @@ void FileSystemAccessManagerImpl::DidChooseEntries(
49206 - SensitiveDirectoryResult::kAllowed);
49211 @@ -1130,9 +1140,9 @@ void FileSystemAccessManagerImpl::DidChooseEntries(
49215 - permission_context_->ConfirmSensitiveDirectoryAccess(
49216 + permission_context_->ConfirmSensitiveEntryAccess(
49218 - is_directory ? HandleType::kDirectory : HandleType::kFile,
49223 @@ -1148,19 +1158,19 @@ void FileSystemAccessManagerImpl::DidVerifySensitiveDirectoryAccess(
49227 - SensitiveDirectoryResult result) {
49233 - if (result == SensitiveDirectoryResult::kAbort) {
49241 - if (result == SensitiveDirectoryResult::kTryAgain) {
49246 diff --git a/src/content/browser/file_system_access/file_system_access_manager_impl.h b/src/content…
49248 --- a/src/content/browser/file_system_access/file_system_access_manager_impl.h
49250 @@ -399,7 +399,7 @@ class CONTENT_EXPORT FileSystemAccessManagerImpl
49254 - FileSystemAccessPermissionContext::SensitiveDirectoryResult result);
49259 diff --git a/src/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc b/s…
49261 --- a/src/content/browser/file_system_access/file_system_access_manager_impl_unittest.cc
49263 @@ -48,6 +48,7 @@
49265 …#include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom-forwa…
49266 …#include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom-share…
49271 @@ -1209,13 +1210,14 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_OpenFile) {
49275 - ConfirmSensitiveDirectoryAccess_(
49281 web_contents_->GetMainFrame()->GetGlobalId(), testing::_))
49282 - .WillOnce(RunOnceCallback<5>(FileSystemAccessPermissionContext::
49283 - SensitiveDirectoryResult::kAllowed));
49289 @@ -1291,13 +1293,14 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_SaveFile) {
49293 - ConfirmSensitiveDirectoryAccess_(
49299 web_contents_->GetMainFrame()->GetGlobalId(), testing::_))
49300 - .WillOnce(RunOnceCallback<5>(FileSystemAccessPermissionContext::
49301 - SensitiveDirectoryResult::kAllowed));
49307 @@ -1368,13 +1371,14 @@ TEST_F(FileSystemAccessManagerImplTest, ChooseEntries_OpenDirectory) {
49311 - ConfirmSensitiveDirectoryAccess_(
49317 web_contents_->GetMainFrame()->GetGlobalId(), testing::_))
49318 - .WillOnce(RunOnceCallback<5>(FileSystemAccessPermissionContext::
49319 - SensitiveDirectoryResult::kAllowed));
49325 diff --git a/src/content/browser/file_system_access/file_system_chooser.cc b/src/content/browser/fi…
49327 --- a/src/content/browser/file_system_access/file_system_chooser.cc
49329 @@ -71,33 +71,6 @@ base::FilePath::StringType GetLastExtension(
49333 -// Returns whether the specified extension receives special handling by the
49334 -// Windows shell.
49335 -bool IsShellIntegratedExtension(const base::FilePath::StringType& extension) {
49336 - // TODO(https://crbug.com/1154757): Figure out some way to unify this with
49337 - // net::IsSafePortablePathComponent, with the result probably ending up in
49338 - // base/i18n/file_util_icu.h.
49339 - base::FilePath::StringType extension_lower = base::ToLowerASCII(extension);
49340 -
49341 - // .lnk files may be used to execute arbitrary code (see
49342 - // https://nvd.nist.gov/vuln/detail/CVE-2010-2568). .local files are used by
49343 - // Windows to determine which DLLs to load for an application.
49344 - if ((extension_lower == FILE_PATH_LITERAL("local")) ||
49345 - (extension_lower == FILE_PATH_LITERAL("lnk"))) {
49346 - return true;
49347 - }
49348 -
49349 - // Setting a file's extension to a CLSID may conceal its actual file type on
49350 - // some Windows versions (see https://nvd.nist.gov/vuln/detail/CVE-2004-0420).
49351 - if (!extension_lower.empty() &&
49352 - (extension_lower.front() == FILE_PATH_LITERAL('{')) &&
49353 - (extension_lower.back() == FILE_PATH_LITERAL('}'))) {
49354 - return true;
49355 - }
49356 -
49357 - return false;
49358 -}
49359 -
49363 @@ -105,7 +78,7 @@ bool IsInvalidExtension(base::FilePath::StringType& extension) {
49367 - IsShellIntegratedExtension(GetLastExtension(extension));
49372 @@ -290,6 +263,42 @@ void FileSystemChooser::CreateAndShow(
49382 + // - For the sake of consistency across platforms, we sanitize '.lnk' and
49384 + // - There are some extensions (i.e. '.scf') we would like to sanitize which
49390 + // https://nvd.nist.gov/vuln/detail/CVE-2010-2568 and
49402 + // some Windows versions (see https://nvd.nist.gov/vuln/detail/CVE-2004-0420).
49415 diff --git a/src/content/browser/file_system_access/file_system_chooser.h b/src/content/browser/fil…
49417 --- a/src/content/browser/file_system_access/file_system_chooser.h
49419 @@ -68,6 +68,12 @@ class CONTENT_EXPORT FileSystemChooser : public ui::SelectFileDialog::Listener {
49432 diff --git a/src/content/browser/file_system_access/file_system_chooser_browsertest.cc b/src/conten…
49434 --- a/src/content/browser/file_system_access/file_system_chooser_browsertest.cc
49436 @@ -44,8 +44,8 @@ namespace content {
49440 -using SensitiveDirectoryResult =
49441 - FileSystemAccessPermissionContext::SensitiveDirectoryResult;
49447 @@ -507,12 +507,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest, OpenDirectory_DenyAccess…
49451 - EXPECT_CALL(permission_context,
49452 - ConfirmSensitiveDirectoryAccess_(
49453 - origin, PathType::kLocal, test_dir,
49454 - FileSystemAccessPermissionContext::HandleType::kDirectory,
49455 - frame_id, testing::_))
49456 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAllowed));
49467 @@ -585,12 +586,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest,
49471 - EXPECT_CALL(permission_context,
49472 - ConfirmSensitiveDirectoryAccess_(
49473 - origin, PathType::kLocal, test_dir,
49474 - FileSystemAccessPermissionContext::HandleType::kDirectory,
49475 - frame_id, testing::_))
49476 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAllowed));
49487 @@ -670,12 +672,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest,
49491 - EXPECT_CALL(permission_context,
49492 - ConfirmSensitiveDirectoryAccess_(
49493 - origin, PathType::kLocal, test_dir,
49494 - FileSystemAccessPermissionContext::HandleType::kDirectory,
49495 - frame_id, testing::_))
49496 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAllowed));
49507 @@ -760,12 +763,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest,
49511 - EXPECT_CALL(permission_context,
49512 - ConfirmSensitiveDirectoryAccess_(
49513 - origin, PathType::kLocal, test_file,
49514 - FileSystemAccessPermissionContext::HandleType::kFile,
49515 - frame_id, testing::_))
49516 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAbort));
49526 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
49527 @@ -823,12 +827,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest,
49531 - EXPECT_CALL(permission_context,
49532 - ConfirmSensitiveDirectoryAccess_(
49533 - origin, PathType::kLocal, test_file,
49534 - FileSystemAccessPermissionContext::HandleType::kFile,
49535 - frame_id, testing::_))
49536 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAbort));
49546 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")));
49547 @@ -960,12 +965,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest,
49551 - EXPECT_CALL(permission_context,
49552 - ConfirmSensitiveDirectoryAccess_(
49553 - origin, PathType::kLocal, test_dir,
49554 - FileSystemAccessPermissionContext::HandleType::kDirectory,
49555 - frame_id, testing::_))
49556 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAllowed));
49567 @@ -1050,12 +1056,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest,
49571 - EXPECT_CALL(permission_context,
49572 - ConfirmSensitiveDirectoryAccess_(
49573 - origin, PathType::kLocal, test_dir,
49574 - FileSystemAccessPermissionContext::HandleType::kDirectory,
49575 - frame_id, testing::_))
49576 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAllowed));
49587 @@ -1134,12 +1141,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest,
49591 - EXPECT_CALL(permission_context,
49592 - ConfirmSensitiveDirectoryAccess_(
49593 - origin, PathType::kLocal, test_dir,
49594 - FileSystemAccessPermissionContext::HandleType::kDirectory,
49595 - frame_id, testing::_))
49596 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAllowed));
49607 @@ -1226,12 +1234,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest,
49611 - EXPECT_CALL(permission_context,
49612 - ConfirmSensitiveDirectoryAccess_(
49613 - origin, PathType::kLocal, test_dir,
49614 - FileSystemAccessPermissionContext::HandleType::kDirectory,
49615 - frame_id, testing::_))
49616 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAllowed));
49627 @@ -1317,12 +1326,13 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest,
49631 - EXPECT_CALL(permission_context,
49632 - ConfirmSensitiveDirectoryAccess_(
49633 - origin, PathType::kLocal, test_dir,
49634 - FileSystemAccessPermissionContext::HandleType::kDirectory,
49635 - frame_id, testing::_))
49636 - .WillOnce(RunOnceCallback<5>(SensitiveDirectoryResult::kAllowed));
49647 @@ -1556,22 +1566,41 @@ IN_PROC_BROWSER_TEST_F(FileSystemChooserBrowserTest, SuggestedName) {
49651 -#if BUILDFLAG(IS_WIN)
49652 - // ".local" and ".lnk" extensions should be sanitized on Windows.
49653 - name_infos.push_back({"dangerous_extension.local", ListValueOf(".local"),
49654 - true, "dangerous_extension.download", false});
49658 -#else
49659 - // ".local" and ".lnk" extensions should be allowed on other OSes.
49660 - // TODO(https://crbug.com/1154757): `expected_exclude_accept_all_option` is
49661 - // false here because ".local" and ".lnk" extensions are not allowed in
49662 - // `accepts`, but are only sanitized by net::GenerateSafeFileName on Windows.
49670 - true, "dangerous_extension.local", false});
49671 - name_infos.push_back({"dangerous_extension.lnk", ListValueOf(".lnk"), true,
49672 - "dangerous_extension.lnk", false});
49673 -#endif
49702 diff --git a/src/content/browser/file_system_access/file_system_chooser_unittest.cc b/src/content/b…
49704 --- a/src/content/browser/file_system_access/file_system_chooser_unittest.cc
49706 @@ -189,7 +189,7 @@ TEST_F(FileSystemChooserTest, IgnoreShellIntegratedExtensions) {
49710 - {"lnk", "foo.lnk", "foo.bar.local", "text", "local"})));
49715 diff --git a/src/content/browser/file_system_access/mock_file_system_access_permission_context.cc b…
49717 --- a/src/content/browser/file_system_access/mock_file_system_access_permission_context.cc
49719 @@ -11,22 +11,24 @@ MockFileSystemAccessPermissionContext::MockFileSystemAccessPermissionContext() =
49723 -void MockFileSystemAccessPermissionContext::ConfirmSensitiveDirectoryAccess(
49731 - base::OnceCallback<void(SensitiveDirectoryResult)> callback) {
49732 - ConfirmSensitiveDirectoryAccess_(origin, path_type, path, handle_type,
49733 - frame_id, callback);
49738 -
49749 diff --git a/src/content/browser/file_system_access/mock_file_system_access_permission_context.h b/…
49751 --- a/src/content/browser/file_system_access/mock_file_system_access_permission_context.h
49753 @@ -33,26 +33,29 @@ class MockFileSystemAccessPermissionContext
49757 - void ConfirmSensitiveDirectoryAccess(
49765 - base::OnceCallback<void(SensitiveDirectoryResult)> callback) override;
49768 - ConfirmSensitiveDirectoryAccess_,
49776 - base::OnceCallback<void(SensitiveDirectoryResult)>& callback));
49777 -
49788 diff --git a/src/content/browser/file_system_access/safe_move_helper.cc b/src/content/browser/file_…
49790 --- a/src/content/browser/file_system_access/safe_move_helper.cc
49792 @@ -135,9 +135,13 @@ SafeMoveHelper::SafeMoveHelper(
49796 - quarantine_connection_callback_(
49797 - std::move(quarantine_connection_callback)),
49798 - has_transient_user_activation_(has_transient_user_activation) {}
49809 @@ -150,7 +154,7 @@ void SafeMoveHelper::Start(SafeMoveHelperCallback callback) {
49813 -
49815 if (!RequireSecurityChecks() || !manager_->permission_context()) {
49818 @@ -159,6 +163,10 @@ void SafeMoveHelper::Start(SafeMoveHelperCallback callback) {
49829 @@ -178,6 +186,7 @@ void SafeMoveHelper::ComputeHashForSourceFile(HashCallback callback) {
49837 @@ -209,6 +218,7 @@ void SafeMoveHelper::DoAfterWriteCheck(base::File::Error hash_result,
49845 diff --git a/src/content/browser/file_system_access/safe_move_helper.h b/src/content/browser/file_s…
49847 --- a/src/content/browser/file_system_access/safe_move_helper.h
49849 @@ -51,10 +51,11 @@ class CONTENT_EXPORT SafeMoveHelper {
49853 -
49862 @@ -86,7 +87,9 @@ class CONTENT_EXPORT SafeMoveHelper {
49872 diff --git a/src/content/browser/media/frameless_media_interface_proxy.cc b/src/content/browser/med…
49874 --- a/src/content/browser/media/frameless_media_interface_proxy.cc
49876 @@ -76,14 +76,16 @@ void FramelessMediaInterfaceProxy::CreateFlingingRenderer(
49889 -#endif // BUILDFLAG(IS_ANDROID)
49894 diff --git a/src/content/browser/media/frameless_media_interface_proxy.h b/src/content/browser/medi…
49896 --- a/src/content/browser/media/frameless_media_interface_proxy.h
49898 @@ -55,13 +55,15 @@ class FramelessMediaInterfaceProxy final
49902 -#if BUILDFLAG(IS_ANDROID)
49915 diff --git a/src/content/browser/media/media_interface_proxy.cc b/src/content/browser/media/media_i…
49917 --- a/src/content/browser/media/media_interface_proxy.cc
49919 @@ -65,6 +65,11 @@
49931 @@ -313,7 +318,9 @@ void MediaInterfaceProxy::CreateFlingingRenderer(
49941 @@ -324,7 +331,11 @@ void MediaInterfaceProxy::CreateMediaPlayerRenderer(
49950 render_frame_host().GetProcess()->GetID(),
49953 diff --git a/src/content/browser/media/media_interface_proxy.h b/src/content/browser/media/media_in…
49955 --- a/src/content/browser/media/media_interface_proxy.h
49957 @@ -73,13 +73,15 @@ class MediaInterfaceProxy final : public DocumentUserData<MediaInterfaceProxy>,
49969 -#endif // BUILDFLAG(IS_ANDROID)
49974 diff --git a/src/content/browser/media/ohos/ohos_media_player_renderer.cc b/src/content/browser/med…
49977 --- /dev/null
49979 @@ -0,0 +1,200 @@
49981 +// Use of this source code is governed by a BSD-style license that can be
50026 + if (media_resource->GetType() != media::MediaResource::Type::URL) {
50032 + CreateMediaPlayer(media_resource->GetMediaUrlParams(), std::move(init_cb));
50038 + const std::string user_agent = GetContentClient()->browser()->GetUserAgent();
50045 + int32_t ret = media_player_->Initialize();
50065 + media_player_->SeekTo(time);
50066 + renderer_client_->OnBufferingStateChange(
50075 + media_player_->Pause();
50089 + media_player_->SetPlaybackSpeed(mode);
50090 + media_player_->Start();
50099 + media_player_->FinishPaint(fd);
50112 + ohos_buffer->buffer_size = size;
50114 + ohos_buffer->fd_browser = fd;
50115 + ohos_buffer->coded_width = coded_width;
50116 + ohos_buffer->coded_height = coded_height;
50117 + ohos_buffer->visible_width = visible_width;
50118 + ohos_buffer->visible_height = visible_height;
50119 + ohos_buffer->format = format;
50120 + ohos_buffer->buffer_fd = mojo::PlatformHandle(std::move(buffer_fd));
50121 + client_extension_->OnFrameUpdate(std::move(ohos_buffer));
50131 + client_extension_->OnDurationChange(duration);
50136 + renderer_client_->OnEnded();
50147 + renderer_client_->OnError(media::PIPELINE_ERROR_EXTERNAL_RENDERER_FAILED);
50158 + client_extension_->OnVideoSizeChange(video_size_);
50169 + media_player_->SetVolume(volume_);
50174 + return media_player_->GetMediaTime();
50180 diff --git a/src/content/browser/media/ohos/ohos_media_player_renderer.h b/src/content/browser/medi…
50183 --- /dev/null
50185 @@ -0,0 +1,120 @@
50187 +// Use of this source code is governed by a BSD-style license that can be
50306 diff --git a/src/content/browser/media/session/audio_focus_delegate_ohos.cc b/src/content/browser/m…
50309 --- /dev/null
50311 @@ -0,0 +1,90 @@
50313 +// Use of this source code is governed by a BSD-style license that can be
50336 + if (!media_session_->IsActive() ||
50340 + media_session_->Suspend(MediaSession::SuspendType::kSystem);
50344 + if (!media_session_->IsSuspended())
50347 + media_session_->Resume(MediaSession::SuspendType::kSystem);
50402 diff --git a/src/content/browser/media/session/audio_focus_delegate_ohos.h b/src/content/browser/me…
50405 --- /dev/null
50407 @@ -0,0 +1,58 @@
50409 +// Use of this source code is governed by a BSD-style license that can be
50466 diff --git a/src/content/browser/message_port_provider.cc b/src/content/browser/message_port_provid…
50468 --- a/src/content/browser/message_port_provider.cc
50470 @@ -73,6 +73,25 @@ void MessagePortProvider::PostMessageToFrame(
50496 diff --git a/src/content/browser/portal/portal.cc b/src/content/browser/portal/portal.cc
50498 --- a/src/content/browser/portal/portal.cc
50500 @@ -625,6 +625,11 @@ void Portal::ActivateImpl(blink::TransferableMessage data,
50501 devtools_instrumentation::PortalActivated(outer_contents->GetMainFrame());
50502 successor_contents_raw->set_portal(nullptr);
50507 + outer_contents->CancelActiveAndPendingDialogs();
50510 delegate->ActivatePortalWebContents(outer_contents,
50512 diff --git a/src/content/browser/renderer_host/input/input_router_impl.cc b/src/content/browser/ren…
50514 --- a/src/content/browser/renderer_host/input/input_router_impl.cc
50516 @@ -140,7 +140,12 @@ void InputRouterImpl::SendGestureEvent(
50520 -
50524 + client_->GetWidgetInputHandler()->StartFling();
50529 disposition_handler_->OnGestureEventAck(
50530 diff --git a/src/content/browser/renderer_host/navigation_controller_impl.cc b/src/content/browser/…
50532 --- a/src/content/browser/renderer_host/navigation_controller_impl.cc
50534 @@ -1135,6 +1135,9 @@ base::WeakPtr<NavigationHandle> NavigationControllerImpl::LoadURL(
50544 @@ -4501,4 +4504,17 @@ bool NavigationControllerImpl::ShouldMaintainTrivialSessionHistory(
50545 frame_tree_node->IsInFencedFrameTree();
50555 + return entry->GetOriginalRequestURL().spec();
50562 diff --git a/src/content/browser/renderer_host/navigation_controller_impl.h b/src/content/browser/r…
50564 --- a/src/content/browser/renderer_host/navigation_controller_impl.h
50566 @@ -124,6 +124,9 @@ class CONTENT_EXPORT NavigationControllerImpl : public NavigationController {
50576 diff --git a/src/content/browser/renderer_host/render_frame_host_impl.cc b/src/content/browser/rend…
50578 --- a/src/content/browser/renderer_host/render_frame_host_impl.cc
50580 @@ -4637,6 +4637,13 @@ void RenderFrameHostImpl::OnSmartClipDataExtracted(int32_t callback_id,
50587 + GetAssociatedLocalFrame()->GetImageFromCache(url, std::move(callback));
50594 @@ -6621,6 +6628,21 @@ base::WeakPtr<RenderFrameHostImpl> RenderFrameHostImpl::GetWeakPtr() {
50602 + allow_popup || frame_tree_node_->HasTransientUserActivation();
50603 + bool can_create_window = GetContentClient()->browser()->CanCreateWindow(
50616 diff --git a/src/content/browser/renderer_host/render_frame_host_impl.h b/src/content/browser/rende…
50618 --- a/src/content/browser/renderer_host/render_frame_host_impl.h
50620 @@ -1151,6 +1151,11 @@ class CONTENT_EXPORT RenderFrameHostImpl
50629 // Request a one-time snapshot of the accessibility tree without changing
50632 @@ -2627,6 +2632,12 @@ class CONTENT_EXPORT RenderFrameHostImpl
50645 diff --git a/src/content/browser/renderer_host/render_process_host_impl.cc b/src/content/browser/re…
50647 --- a/src/content/browser/renderer_host/render_process_host_impl.cc
50649 @@ -3482,6 +3482,11 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
50661 diff --git a/src/content/browser/renderer_host/render_widget_host_impl.cc b/src/content/browser/ren…
50663 --- a/src/content/browser/renderer_host/render_widget_host_impl.cc
50665 @@ -321,6 +321,11 @@ class UnboundWidgetInputHandler : public blink::mojom::WidgetInputHandler {
50677 diff --git a/src/content/browser/scheduler/browser_task_executor.cc b/src/content/browser/scheduler…
50679 --- a/src/content/browser/scheduler/browser_task_executor.cc
50681 @@ -260,7 +260,7 @@ void BrowserTaskExecutor::CreateInternal(
50682 g_browser_task_executor->browser_ui_thread_handle_
50683 ->EnableAllExceptBestEffortQueues();
50685 -#if BUILDFLAG(IS_ANDROID)
50690 diff --git a/src/content/browser/scheduler/responsiveness/native_event_observer.cc b/src/content/br…
50692 --- a/src/content/browser/scheduler/responsiveness/native_event_observer.cc
50694 @@ -15,7 +15,7 @@
50698 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
50703 @@ -39,7 +39,7 @@ NativeEventObserver::~NativeEventObserver() {
50707 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
50710 aura::Env::GetInstance()->AddWindowEventDispatcherObserver(this);
50712 diff --git a/src/content/browser/scheduler/responsiveness/native_event_observer.h b/src/content/bro…
50714 --- a/src/content/browser/scheduler/responsiveness/native_event_observer.h
50716 @@ -15,7 +15,7 @@
50720 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
50725 @@ -40,7 +40,7 @@ namespace responsiveness {
50729 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
50734 @@ -57,7 +57,7 @@ class CONTENT_EXPORT NativeEventObserver
50738 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
50743 @@ -73,7 +73,7 @@ class CONTENT_EXPORT NativeEventObserver
50747 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
50752 @@ -90,7 +90,7 @@ class CONTENT_EXPORT NativeEventObserver
50756 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
50761 diff --git a/src/content/browser/service_worker/service_worker_version.cc b/src/content/browser/ser…
50763 --- a/src/content/browser/service_worker/service_worker_version.cc
50765 @@ -1981,18 +1981,17 @@ void ServiceWorkerVersion::OnTimeoutTimer() {
50780 - // Detach the worker. Remove |this| as a listener first; otherwise
50781 - // OnStoppedInternal might try to restart before the new worker
50782 - // is created. Also, protect |this|, since swapping out the
50783 - // EmbeddedWorkerInstance could destroy our ServiceWorkerHost which could in
50784 - // turn destroy |this|.
50785 - scoped_refptr<ServiceWorkerVersion> protect_this(this);
50786 embedded_worker_->RemoveObserver(this);
50787 embedded_worker_->Detach();
50789 @@ -2019,7 +2018,6 @@ void ServiceWorkerVersion::OnTimeoutTimer() {
50793 - scoped_refptr<ServiceWorkerVersion> protect(this);
50796 embedded_worker_->Stop();
50797 @@ -2028,17 +2026,26 @@ void ServiceWorkerVersion::OnTimeoutTimer() {
50801 - auto timeout_iter = request_timeouts_.begin();
50802 - while (timeout_iter != request_timeouts_.end()) {
50811 - if (!RequestExpired(info.expiration))
50819 - timeout_iter = request_timeouts_.erase(timeout_iter);
50826 embedded_worker_->Stop();
50828 diff --git a/src/content/browser/service_worker/service_worker_version.h b/src/content/browser/serv…
50830 --- a/src/content/browser/service_worker/service_worker_version.h
50832 @@ -852,6 +852,8 @@ class CONTENT_EXPORT ServiceWorkerVersion
50841 diff --git a/src/content/browser/speech/tts_ohos.cc b/src/content/browser/speech/tts_ohos.cc
50844 --- /dev/null
50846 @@ -0,0 +1,47 @@
50848 +// Use of this source code is governed by a BSD-style license that can be
50894 diff --git a/src/content/browser/storage_partition_impl.cc b/src/content/browser/storage_partition_…
50896 --- a/src/content/browser/storage_partition_impl.cc
50898 @@ -12,6 +12,10 @@
50909 @@ -1417,6 +1421,30 @@ StoragePartitionImpl::GetCookieManagerForBrowserProcess() {
50921 + GetIOThreadTaskRunner({})->PostTask(
50931 + GetNetworkContext()->GetCookieManager(
50940 diff --git a/src/content/browser/storage_partition_impl.h b/src/content/browser/storage_partition_i…
50942 --- a/src/content/browser/storage_partition_impl.h
50944 @@ -16,6 +16,11 @@
50956 @@ -144,6 +149,9 @@ class CONTENT_EXPORT StoragePartitionImpl
50966 @@ -566,6 +574,10 @@ class CONTENT_EXPORT StoragePartitionImpl
50977 @@ -669,6 +681,12 @@ class CONTENT_EXPORT StoragePartitionImpl
50990 diff --git a/src/content/browser/web_contents/web_contents_impl.cc b/src/content/browser/web_conten…
50992 --- a/src/content/browser/web_contents/web_contents_impl.cc
50994 @@ -123,6 +123,9 @@
51004 @@ -1022,10 +1025,22 @@ WebContentsImpl::~WebContentsImpl() {
51005 outermost->SetAsFocusedWebContentsIfNecessary();
51008 - if (mouse_lock_widget_)
51010 mouse_lock_widget_->RejectMouseLockOrUnlockIfNecessary(
51020 + current = current->GetOuterWebContents()) {
51021 + current->mouse_lock_widget_ = nullptr;
51026 widget->DetachDelegate();
51028 @@ -1775,6 +1790,14 @@ void WebContentsImpl::SetUserAgentOverride(
51043 @@ -1889,6 +1912,28 @@ void WebContentsImpl::SetDisplayCutoutSafeArea(gfx::Insets insets) {
51071 GetRenderManager()->speculative_frame_host()
51072 @@ -2806,7 +2851,7 @@ void WebContentsImpl::SetSlowWebPreferences(
51076 -#if BUILDFLAG(IS_ANDROID)
51081 @@ -2998,16 +3043,16 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
51085 - WebContentsViewDelegate* delegate =
51086 - GetContentClient()->browser()->GetWebContentsViewDelegate(this);
51088 + GetContentClient()->browser()->GetWebContentsViewDelegate(this);
51090 - if (browser_plugin_guest_) {
51091 - view_ = std::make_unique<WebContentsViewChildFrame>(
51092 - this, delegate, &render_view_host_delegate_view_);
51093 - } else {
51094 - view_.reset(CreateWebContentsView(this, delegate,
51095 - &render_view_host_delegate_view_));
51096 - }
51107 @@ -3874,12 +3919,9 @@ FrameTree* WebContentsImpl::CreateNewWindow(
51111 - delegate_->GetCustomWebContentsView(this,
51112 - params.target_url,
51113 - render_process_id,
51114 - opener->GetRoutingID(),
51115 - &create_params.view,
51116 - &create_params.delegate_view);
51117 + delegate_->GetCustomWebContentsView(
51118 + this, params.target_url, render_process_id, opener->GetRoutingID(),
51123 @@ -4289,9 +4331,10 @@ bool WebContentsImpl::ShouldIgnoreUnresponsiveRenderer() {
51127 - // Ignore unresponsive renderers if the debugger is attached to them since the
51128 - // unresponsiveness might be a result of the renderer sitting on a breakpoint.
51129 - //
51137 @@ -5984,6 +6027,7 @@ WebContentsImpl::GetOrCreateWebPreferences() {
51143 // Get all the RenderViewHosts (except the ones for currently back-forward
51145 @@ -6055,8 +6099,8 @@ WebContentsImpl::GetJavaRenderFrameHostDelegate() {
51149 - OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::DOMContentLoaded",
51150 - "render_frame_host", render_frame_host);
51156 diff --git a/src/content/browser/web_contents/web_contents_impl.h b/src/content/browser/web_content…
51158 --- a/src/content/browser/web_contents/web_contents_impl.h
51160 @@ -373,6 +373,13 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
51174 @@ -1302,6 +1309,10 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
51185 diff --git a/src/content/browser/web_contents/web_contents_view_aura.cc b/src/content/browser/web_c…
51187 --- a/src/content/browser/web_contents/web_contents_view_aura.cc
51189 @@ -1507,8 +1507,9 @@ void WebContentsViewAura::OnDragExited() {
51193 - if (current_rvh_for_drag_ !=
51194 - GetRenderViewHostID(web_contents_->GetRenderViewHost()) ||
51195 + if (web_contents_->IsBeingDestroyed() ||
51197 + GetRenderViewHostID(web_contents_->GetRenderViewHost()) ||
51201 diff --git a/src/content/common/BUILD.gn b/src/content/common/BUILD.gn
51203 --- a/src/content/common/BUILD.gn
51205 @@ -338,6 +338,18 @@ source_set("common") {
51206 sources -= [ "cursors/webcursor_aura.cc" ]
51224 @@ -359,7 +371,7 @@ source_set("common") {
51228 - if (is_mac || is_win || is_android || is_fuchsia) {
51230 sources -= [ "font_list_fontconfig.cc" ]
51233 @@ -401,7 +413,7 @@ source_set("common") {
51237 -if (is_linux || is_chromeos) {
51242 diff --git a/src/content/common/cursors/webcursor.cc b/src/content/common/cursors/webcursor.cc
51244 --- a/src/content/common/cursors/webcursor.cc
51246 @@ -22,16 +22,19 @@ WebCursor::WebCursor(const ui::Cursor& cursor) {
51250 - static constexpr int kMaxSize = 1024;
51252 + // - kMaximumCursorSize in Blink's EventHandler
51253 + // - kCursorSize in Chrome's DevToolsEyeDropper
51258 - (cursor.custom_bitmap().width() > kMaxSize ||
51259 - cursor.custom_bitmap().height() > kMaxSize ||
51263 - kMaxSize ||
51266 - kMaxSize))) {
51271 diff --git a/src/content/common/cursors/webcursor_mac.mm b/src/content/common/cursors/webcursor_mac…
51273 --- a/src/content/common/cursors/webcursor_mac.mm
51275 @@ -265,6 +265,7 @@ gfx::NativeCursor WebCursor::GetNativeCursor() {
51283 diff --git a/src/content/common/cursors/webcursor_unittest.cc b/src/content/common/cursors/webcurso…
51285 --- a/src/content/common/cursors/webcursor_unittest.cc
51287 @@ -122,11 +122,11 @@ TEST(WebCursorTest, SetCursor) {
51291 - cursor.set_custom_bitmap(CreateTestBitmap(1025, 3));
51296 - cursor.set_custom_bitmap(CreateTestBitmap(3, 1025));
51301 @@ -136,7 +136,7 @@ TEST(WebCursorTest, SetCursor) {
51305 - cursor.set_custom_bitmap(CreateTestBitmap(5, 200));
51310 diff --git a/src/content/common/features.gni b/src/content/common/features.gni
51312 --- a/src/content/common/features.gni
51314 @@ -6,7 +6,7 @@ import("//build/config/chromecast_build.gni")
51318 - use_external_popup_menu = is_android || is_mac
51323 @@ -14,8 +14,9 @@ declare_args() {
51327 - mbi_mode = is_linux || is_chromeos || is_mac || is_win || is_android
51333 - is_linux || is_chromeos || is_mac || is_win || is_android
51335 diff --git a/src/content/common/frame.mojom b/src/content/common/frame.mojom
51337 --- a/src/content/common/frame.mojom
51339 @@ -622,6 +622,9 @@ interface FrameHost {
51349 diff --git a/src/content/common/set_process_title.cc b/src/content/common/set_process_title.cc
51351 --- a/src/content/common/set_process_title.cc
51353 @@ -38,13 +38,14 @@
51364 - !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA)
51369 @@ -92,11 +93,19 @@ void SetProcessTitleFromCommandLine(const char** main_argv) {
51374 for (size_t i = 1; i < command_line->argv().size(); ++i) {
51377 title += command_line->argv()[i];
51381 + command_line->GetSwitchValueASCII(switches::kProcessType);
51383 + title = "webview-" + process_type;
51386 // Disable prepending argv[0] with '-' if we prepended it ourselves above.
51387 setproctitle(have_argv0 ? "-%s" : "%s", title.c_str());
51389 diff --git a/src/content/common/zygote/zygote_communication_linux.cc b/src/content/common/zygote/zy…
51391 --- a/src/content/common/zygote/zygote_communication_linux.cc
51393 @@ -236,6 +236,15 @@ void ZygoteCommunication::Init(
51409 diff --git a/src/content/public/app/content_main_delegate.cc b/src/content/public/app/content_main_…
51411 --- a/src/content/public/app/content_main_delegate.cc
51413 @@ -24,7 +24,7 @@ absl::variant<int, MainFunctionParams> ContentMainDelegate::RunProcess(
51417 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
51422 diff --git a/src/content/public/app/content_main_delegate.h b/src/content/public/app/content_main_d…
51424 --- a/src/content/public/app/content_main_delegate.h
51426 @@ -57,7 +57,7 @@ class CONTENT_EXPORT ContentMainDelegate {
51430 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
51435 diff --git a/src/content/public/browser/content_browser_client.h b/src/content/public/browser/conte…
51437 --- a/src/content/public/browser/content_browser_client.h
51439 @@ -948,6 +948,15 @@ class CONTENT_EXPORT ContentBrowserClient {
51455 diff --git a/src/content/public/browser/file_system_access_permission_context.h b/src/content/publi…
51457 --- a/src/content/public/browser/file_system_access_permission_context.h
51459 @@ -6,10 +6,12 @@
51467 …#include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom-share…
51472 @@ -87,32 +89,37 @@ class FileSystemAccessPermissionContext {
51476 - enum class SensitiveDirectoryResult {
51477 - kAllowed = 0, // Access to directory is okay.
51478 - kTryAgain = 1, // User should pick a different directory.
51485 - // Checks if access to the given |path| should be allowed or blocked. This is
51489 - // Calls |callback| with the result of the check, after potentially showing
51490 - // some UI to the user if the path should not be accessed.
51491 - virtual void ConfirmSensitiveDirectoryAccess(
51502 - base::OnceCallback<void(SensitiveDirectoryResult)> callback) = 0;
51518 diff --git a/src/content/public/browser/message_port_provider.h b/src/content/public/browser/messag…
51520 --- a/src/content/public/browser/message_port_provider.h
51522 @@ -41,6 +41,13 @@ class CONTENT_EXPORT MessagePortProvider {
51536 diff --git a/src/content/public/browser/navigation_controller.h b/src/content/public/browser/naviga…
51538 --- a/src/content/public/browser/navigation_controller.h
51540 @@ -439,6 +439,9 @@ class NavigationController {
51549 // browser-initiated navigations.
51550 diff --git a/src/content/public/browser/render_frame_host.h b/src/content/public/browser/render_fra…
51552 --- a/src/content/public/browser/render_frame_host.h
51554 @@ -31,6 +31,9 @@
51555 #include "third_party/blink/public/mojom/page/page_visibility_state.mojom-forward.h"
51556 …#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-forwa…
51564 @@ -604,6 +607,13 @@ class CONTENT_EXPORT RenderFrameHost : public IPC::Listener,
51565 // the image has a non-data URL).
51578 diff --git a/src/content/public/browser/storage_partition.h b/src/content/public/browser/storage_pa…
51580 --- a/src/content/public/browser/storage_partition.h
51582 @@ -118,7 +118,9 @@ class CONTENT_EXPORT StoragePartition {
51586 -
51593 diff --git a/src/content/public/browser/web_contents.h b/src/content/public/browser/web_contents.h
51595 --- a/src/content/public/browser/web_contents.h
51597 @@ -37,6 +37,9 @@
51599 #include "services/network/public/mojom/web_sandbox_flags.mojom-shared.h"
51600 #include "third_party/abseil-cpp/absl/types/optional.h"
51604 #include "third_party/blink/public/mojom/favicon/favicon_url.mojom-forward.h"
51605 #include "third_party/blink/public/mojom/frame/find_in_page.mojom-forward.h"
51607 @@ -569,6 +572,29 @@ class WebContents : public PageNavigator,
51637 diff --git a/src/content/public/common/content_constants.cc b/src/content/public/common/content_con…
51639 --- a/src/content/public/common/content_constants.cc
51641 @@ -49,7 +49,7 @@ std::string GetCorsExemptRequestedWithHeaderName() {
51642 return base::JoinString(pieces, "-");
51645 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
51650 diff --git a/src/content/public/common/content_constants.h b/src/content/public/common/content_cons…
51652 --- a/src/content/public/common/content_constants.h
51654 @@ -59,7 +59,7 @@ CONTENT_EXPORT extern const char kCorsExemptPurposeHeaderName[];
51658 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
51663 diff --git a/src/content/public/common/content_features.cc b/src/content/public/common/content_feat…
51665 --- a/src/content/public/common/content_features.cc
51667 @@ -554,7 +554,7 @@ const base::Feature kNavigationThreadingOptimizations{
51671 -#if BUILDFLAG(IS_ANDROID)
51676 diff --git a/src/content/public/common/content_switches.cc b/src/content/public/common/content_swit…
51678 --- a/src/content/public/common/content_switches.cc
51680 @@ -991,13 +991,19 @@ const char kEnableAutomation[] = "enable-automation";
51683 // of lacros-chrome is complete.
51684 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
51686 // Allows sending text-to-speech requests to speech-dispatcher, a common
51689 const char kEnableSpeechDispatcher[] = "enable-speech-dispatcher";
51693 +const char kEnableMultiRendererProcess[] = "enable-multi-renderer-process";
51694 +const char kForBrowser[] = "for-browser";
51695 +const char kOhosCustomScheme[] = "ohos-custom-scheme";
51701 diff --git a/src/content/public/common/content_switches.h b/src/content/public/common/content_switc…
51703 --- a/src/content/public/common/content_switches.h
51705 @@ -272,10 +272,16 @@ CONTENT_EXPORT extern const char kRendererWaitForJavaDebugger[];
51708 // of lacros-chrome is complete.
51709 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
51723 diff --git a/src/content/public/renderer/render_frame_media_playback_options.h b/src/content/public…
51725 --- a/src/content/public/renderer/render_frame_media_playback_options.h
51727 @@ -13,7 +13,7 @@ namespace content {
51731 -#if BUILDFLAG(IS_ANDROID)
51736 diff --git a/src/content/public/test/browser_test_utils.cc b/src/content/public/test/browser_test_u…
51738 --- a/src/content/public/test/browser_test_utils.cc
51740 @@ -2331,6 +2331,11 @@ RenderWidgetHost* GetKeyboardLockWidget(WebContents* web_contents) {
51741 return static_cast<WebContentsImpl*>(web_contents)->GetKeyboardLockWidget();
51746 + ->mouse_lock_widget_for_testing();
51752 diff --git a/src/content/public/test/browser_test_utils.h b/src/content/public/test/browser_test_ut…
51754 --- a/src/content/public/test/browser_test_utils.h
51756 @@ -1053,6 +1053,9 @@ void UiaGetPropertyValueVtArrayVtUnknownValidate(
51766 diff --git a/src/content/renderer/BUILD.gn b/src/content/renderer/BUILD.gn
51768 --- a/src/content/renderer/BUILD.gn
51770 @@ -19,6 +19,15 @@ if (is_component_build) {
51786 @@ -200,7 +209,19 @@ target(link_target_type, "renderer") {
51790 - if (is_linux || is_chromeos) {
51807 @@ -541,7 +562,7 @@ target(link_target_type, "renderer") {
51811 - if (is_linux || is_chromeos || is_android) {
51816 diff --git a/src/content/renderer/media/media_factory.cc b/src/content/renderer/media/media_factory…
51818 --- a/src/content/renderer/media/media_factory.cc
51820 @@ -127,6 +127,10 @@
51831 @@ -573,6 +577,14 @@ MediaFactory::CreateRendererFactorySelector(
51839 + factory_selector->AddFactory(RendererType::kOHOSMediaPlayer,
51846 diff --git a/src/content/renderer/media/media_interface_factory.cc b/src/content/renderer/media/med…
51848 --- a/src/content/renderer/media/media_interface_factory.cc
51850 @@ -109,7 +109,7 @@ void MediaInterfaceFactory::CreateCastRenderer(
51854 -#if BUILDFLAG(IS_ANDROID)
51859 @@ -131,7 +131,9 @@ void MediaInterfaceFactory::CreateMediaPlayerRenderer(
51869 diff --git a/src/content/renderer/media/media_interface_factory.h b/src/content/renderer/media/medi…
51871 --- a/src/content/renderer/media/media_interface_factory.h
51873 @@ -65,13 +65,15 @@ class MediaInterfaceFactory final : public media::mojom::InterfaceFactory {
51885 -#endif // BUILDFLAG(IS_ANDROID)
51890 diff --git a/src/content/renderer/media/ohos/ohos_media_player_renderer_client.cc b/src/content/ren…
51893 --- /dev/null
51895 @@ -0,0 +1,190 @@
51897 +// Use of this source code is governed by a BSD-style license that can be
51941 + DCHECK(media_task_runner_->BelongsToCurrentThread());
51959 + sink_->SetFinishPaintCallback(
51965 + if (!media_task_runner_->BelongsToCurrentThread()) {
51966 + media_task_runner_->PostTask(
51976 + renderer_extension_remote_->FinishPaint(temp_buffer.fd_browser_);
51983 + DCHECK(media_task_runner_->BelongsToCurrentThread());
51994 + client_->OnStatisticsUpdate(stats);
52000 + client_->OnVideoNaturalSizeChange(size);
52004 + DCHECK(media_task_runner_->BelongsToCurrentThread());
52005 + media_resource_->ForwardDurationChangeToDemuxerHost(duration);
52010 + if (!media_task_runner_->BelongsToCurrentThread()) {
52011 + media_task_runner_->PostTask(
52017 + auto fd = ohos_surface_buffer_handle->buffer_fd.TakeFD().release();
52018 + uint32_t buffer_size = ohos_surface_buffer_handle->buffer_size;
52019 + int fd_browser = ohos_surface_buffer_handle->fd_browser;
52020 + int32_t coded_width = ohos_surface_buffer_handle->coded_width;
52021 + int32_t coded_height = ohos_surface_buffer_handle->coded_height;
52022 + int32_t visible_width = ohos_surface_buffer_handle->visible_width;
52023 + int32_t visible_height = ohos_surface_buffer_handle->visible_height;
52024 + int32_t src_format = ohos_surface_buffer_handle->format;
52050 + sink_->PaintSingleFrame(std::move(dst_frame));
52071 + natural_size, src_frame->timestamp());
52078 + renderer_extension_remote_->FinishPaint(fd_browser);
52081 + sink_->PaintSingleFrame(std::move(dst_frame));
52086 diff --git a/src/content/renderer/media/ohos/ohos_media_player_renderer_client.h b/src/content/rend…
52089 --- /dev/null
52091 @@ -0,0 +1,114 @@
52093 +// Use of this source code is governed by a BSD-style license that can be
52206 diff --git a/src/content/renderer/media/ohos/ohos_media_player_renderer_client_factory.cc b/src/con…
52209 --- /dev/null
52211 @@ -0,0 +1,55 @@
52213 +// Use of this source code is governed by a BSD-style license that can be
52250 + mojo_renderer_factory_->CreateMediaPlayerRenderer(
52267 diff --git a/src/content/renderer/media/ohos/ohos_media_player_renderer_client_factory.h b/src/cont…
52270 --- /dev/null
52272 @@ -0,0 +1,44 @@
52274 +// Use of this source code is governed by a BSD-style license that can be
52317 diff --git a/src/content/renderer/render_frame_impl.cc b/src/content/renderer/render_frame_impl.cc
52319 --- a/src/content/renderer/render_frame_impl.cc
52321 @@ -247,6 +247,10 @@
52332 @@ -1028,7 +1032,7 @@ void FillMiscNavigationParams(
52333 navigation_params->is_cross_site_cross_browsing_context_group =
52336 -#if BUILDFLAG(IS_ANDROID)
52339 navigation_params->grant_load_local_resources =
52341 @@ -1953,6 +1957,10 @@ RenderFrameImpl::RenderFrameImpl(CreateParams params)
52352 diff --git a/src/content/renderer/render_remote_proxy.cc b/src/content/renderer/render_remote_proxy…
52355 --- /dev/null
52357 @@ -0,0 +1,88 @@
52359 +// Use of this source code is governed by a BSD-style license that can be
52388 + g_fds->Set(kMojoIPCChannel, ipcFd);
52391 + g_fds->Set(kMojoIPCChannel, new_ipc_fd);
52399 + g_fds->Set(kFieldTrialDescriptor, sharedFd);
52402 + g_fds->Set(kFieldTrialDescriptor, new_shared_fd);
52417 + g_app_mgr_client_adapter->AttachRenderProcess(g_render_remote_proxy);
52434 + g_app_mgr_client_adapter->AttachRenderProcess(g_render_remote_proxy);
52446 diff --git a/src/content/renderer/render_remote_proxy.h b/src/content/renderer/render_remote_proxy.h
52449 --- /dev/null
52451 @@ -0,0 +1,39 @@
52453 +// Use of this source code is governed by a BSD-style license that can be
52492 diff --git a/src/content/renderer/render_view_impl.cc b/src/content/renderer/render_view_impl.cc
52494 --- a/src/content/renderer/render_view_impl.cc
52496 @@ -241,6 +241,22 @@ void RenderViewImpl::Destroy() {
52499 // blink::WebViewClient ------------------------------------------------------
52505 + auto* frame_host = creator_frame->GetFrameHost();
52509 + if (!frame_host->GetCreateNewWindow(target_url, NavigationPolicyToDisposition(policy), allow_pop…
52519 @@ -265,6 +281,12 @@ WebView* RenderViewImpl::CreateView(
52520 params->allow_popup = false;
52521 if (GetContentClient()->renderer()->AllowPopup())
52522 params->allow_popup = true;
52524 + if (GetNewWindowWebView(creator_frame, request.Url(), policy, params->allow_popup)) {
52530 params->window_container_type = WindowFeaturesToContainerType(features);
52532 diff --git a/src/content/renderer/render_view_impl.h b/src/content/renderer/render_view_impl.h
52534 --- a/src/content/renderer/render_view_impl.h
52536 @@ -102,6 +102,11 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient,
52538 // blink::WebViewClient implementation --------------------------------------
52548 diff --git a/src/content/shell/app/shell_main_delegate.cc b/src/content/shell/app/shell_main_delega…
52550 --- a/src/content/shell/app/shell_main_delegate.cc
52552 @@ -191,8 +191,9 @@ bool ShellMainDelegate::ShouldCreateFeatureList() {
52556 -#if defined(ARCH_CPU_ARM_FAMILY) && \
52557 - (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
52564 @@ -211,7 +212,7 @@ void ShellMainDelegate::PreSandboxStartup() {
52565 // Reporting for sub-processes will be initialized in ZygoteForked.
52568 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
52573 @@ -270,7 +271,7 @@ absl::variant<int, MainFunctionParams> ShellMainDelegate::RunProcess(
52577 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
52580 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
52582 @@ -282,7 +283,10 @@ void ShellMainDelegate::ZygoteForked() {
52586 -#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
52594 diff --git a/src/content/shell/app/shell_main_delegate.h b/src/content/shell/app/shell_main_delegat…
52596 --- a/src/content/shell/app/shell_main_delegate.h
52598 @@ -37,8 +37,10 @@ class ShellMainDelegate : public ContentMainDelegate {
52602 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
52610 diff --git a/src/content/test/BUILD.gn b/src/content/test/BUILD.gn
52612 --- a/src/content/test/BUILD.gn
52614 @@ -729,9 +729,9 @@ if (is_fuchsia) {
52618 - deps = [
52619 - "//tools/perf/chrome_telemetry_build:telemetry_chrome_test_without_chrome",
52620 - ]
52627 diff --git a/src/content/test/data/android/webshare-separator.html b/src/content/test/data/android/…
52630 --- /dev/null
52631 +++ b/src/content/test/data/android/webshare-separator.html
52632 @@ -0,0 +1,31 @@
52664 diff --git a/src/content/web_test/BUILD.gn b/src/content/web_test/BUILD.gn
52666 --- a/src/content/web_test/BUILD.gn
52668 @@ -8,7 +8,7 @@ import("//mojo/public/tools/bindings/mojom.gni")
52672 -if (is_android) {
52677 diff --git a/src/content/zygote/BUILD.gn b/src/content/zygote/BUILD.gn
52679 --- a/src/content/zygote/BUILD.gn
52681 @@ -5,7 +5,7 @@
52685 -if (is_linux || is_chromeos) {
52690 diff --git a/src/device/gamepad/BUILD.gn b/src/device/gamepad/BUILD.gn
52692 --- a/src/device/gamepad/BUILD.gn
52694 @@ -122,7 +122,7 @@ component("gamepad") {
52698 - if (!is_android && !is_fuchsia) {
52703 diff --git a/src/device/gamepad/gamepad_provider.cc b/src/device/gamepad/gamepad_provider.cc
52705 --- a/src/device/gamepad/gamepad_provider.cc
52707 @@ -220,7 +220,7 @@ void GamepadProvider::Initialize(std::unique_ptr<GamepadDataFetcher> fetcher) {
52711 -#elif BUILDFLAG(IS_ANDROID)
52716 diff --git a/src/extensions/browser/api/system_cpu/BUILD.gn b/src/extensions/browser/api/system_cpu…
52718 --- a/src/extensions/browser/api/system_cpu/BUILD.gn
52720 @@ -30,7 +30,7 @@ source_set("system_cpu") {
52724 - if (is_linux || is_chromeos) {
52729 diff --git a/src/extensions/browser/content_script_tracker.cc b/src/extensions/browser/content_scri…
52731 --- a/src/extensions/browser/content_script_tracker.cc
52733 @@ -106,6 +106,8 @@ class RenderProcessHostUserData : public base::SupportsUserData::Data {
52742 @@ -441,6 +443,18 @@ const Extension* FindExtensionByHostId(content::BrowserContext* browser_contex…
52755 + return process_data->content_scripts();
52761 diff --git a/src/extensions/browser/content_script_tracker.h b/src/extensions/browser/content_scrip…
52763 --- a/src/extensions/browser/content_script_tracker.h
52765 @@ -54,6 +54,11 @@ class ContentScriptTracker {
52777 diff --git a/src/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc b/src/extension…
52779 --- a/src/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc
52781 @@ -66,7 +66,7 @@ void JavaScriptDialogHelper::RunJavaScriptDialog(
52782 web_view_permission_helper->RequestPermission(
52785 - base::Unretained(this), std::move(callback)),
52790 diff --git a/src/extensions/browser/guest_view/web_view/javascript_dialog_helper.h b/src/extensions…
52792 --- a/src/extensions/browser/guest_view/web_view/javascript_dialog_helper.h
52794 @@ -6,6 +6,7 @@
52802 @@ -46,6 +47,8 @@ class JavaScriptDialogHelper : public content::JavaScriptDialogManager {
52811 diff --git a/src/extensions/browser/updater/update_service.cc b/src/extensions/browser/updater/upda…
52813 --- a/src/extensions/browser/updater/update_service.cc
52815 @@ -17,6 +17,7 @@
52823 @@ -122,6 +123,7 @@ void UpdateService::OnEvent(Events event, const std::string& extension_id) {
52831 @@ -129,6 +131,7 @@ void UpdateService::OnEvent(Events event, const std::string& extension_id) {
52833 ->PerformActionBasedOnOmahaAttributes(extension_id, attributes);
52839 diff --git a/src/gpu/command_buffer/common/gpu_memory_buffer_support.cc b/src/gpu/command_buffer/co…
52841 --- a/src/gpu/command_buffer/common/gpu_memory_buffer_support.cc
52843 @@ -134,7 +134,7 @@ uint32_t GetPlatformSpecificTextureTarget() {
52847 - BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
52852 diff --git a/src/gpu/command_buffer/service/BUILD.gn b/src/gpu/command_buffer/service/BUILD.gn
52854 --- a/src/gpu/command_buffer/service/BUILD.gn
52856 @@ -364,7 +364,7 @@ target(link_target_type, "gles2_sources") {
52860 - if (is_linux || is_chromeos || is_fuchsia || is_android || is_win) {
52865 diff --git a/src/gpu/command_buffer/service/external_semaphore.cc b/src/gpu/command_buffer/service/…
52867 --- a/src/gpu/command_buffer/service/external_semaphore.cc
52869 @@ -27,7 +27,8 @@ GLuint ImportSemaphoreHandleToGLSemaphore(SemaphoreHandle handle) {
52873 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
52879 diff --git a/src/gpu/command_buffer/service/external_vk_image_backing.cc b/src/gpu/command_buffer/s…
52881 --- a/src/gpu/command_buffer/service/external_vk_image_backing.cc
52883 @@ -592,7 +592,8 @@ GLuint ExternalVkImageBacking::ProduceGLTextureInternal() {
52887 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
52890 auto memory_fd = image_->GetMemoryFd();
52893 diff --git a/src/gpu/command_buffer/service/gles2_cmd_decoder.cc b/src/gpu/command_buffer/service/g…
52895 --- a/src/gpu/command_buffer/service/gles2_cmd_decoder.cc
52897 @@ -6834,8 +6834,6 @@ void GLES2DecoderImpl::InvalidateFramebufferImpl(
52900 if (!validators_->backbuffer_attachment.IsValid(attachment)) {
52901 - LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, attachment,
52902 - "attachments");
52906 diff --git a/src/gpu/config/BUILD.gn b/src/gpu/config/BUILD.gn
52908 --- a/src/gpu/config/BUILD.gn
52910 @@ -55,7 +55,7 @@ action("process_json") {
52914 - } else if (is_android) {
52919 @@ -236,10 +236,10 @@ source_set("config_sources") {
52923 - if (is_linux || is_chromeos) {
52927 - if (is_linux || is_chromeos || is_mac) {
52932 diff --git a/src/gpu/config/gpu_control_list.cc b/src/gpu/config/gpu_control_list.cc
52934 --- a/src/gpu/config/gpu_control_list.cc
52936 @@ -785,6 +785,8 @@ GpuControlList::OsType GpuControlList::GetOsType() {
52945 diff --git a/src/gpu/config/gpu_control_list.h b/src/gpu/config/gpu_control_list.h
52947 --- a/src/gpu/config/gpu_control_list.h
52949 @@ -32,6 +32,7 @@ class GPU_EXPORT GpuControlList {
52957 diff --git a/src/gpu/config/gpu_info_collector.cc b/src/gpu/config/gpu_info_collector.cc
52959 --- a/src/gpu/config/gpu_info_collector.cc
52961 @@ -397,7 +397,7 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) {
52962 gpu_info->max_msaa_samples = base::NumberToString(max_samples);
52965 -#if BUILDFLAG(IS_ANDROID)
52967 gpu_info->can_support_threaded_texture_mailbox =
52970 @@ -558,7 +558,7 @@ void FillGPUInfoFromSystemInfo(GPUInfo* gpu_info,
52974 -#if BUILDFLAG(IS_ANDROID)
52979 diff --git a/src/gpu/config/gpu_test_config.cc b/src/gpu/config/gpu_test_config.cc
52981 --- a/src/gpu/config/gpu_test_config.cc
52983 @@ -29,7 +29,7 @@ GPUTestConfig::OS GetCurrentOS() {
52987 - BUILDFLAG(IS_OPENBSD)
52992 diff --git a/src/gpu/ipc/common/gpu_memory_buffer_support.cc b/src/gpu/ipc/common/gpu_memory_buffer…
52994 --- a/src/gpu/ipc/common/gpu_memory_buffer_support.cc
52996 @@ -89,6 +89,8 @@ bool GpuMemoryBufferSupport::IsNativeGpuMemoryBufferConfigurationSupported(
53005 diff --git a/src/gpu/ipc/service/BUILD.gn b/src/gpu/ipc/service/BUILD.gn
53007 --- a/src/gpu/ipc/service/BUILD.gn
53009 @@ -130,7 +130,7 @@ component("service") {
53013 - if (is_linux || is_chromeos) {
53018 diff --git a/src/gpu/ipc/service/image_transport_surface_linux.cc b/src/gpu/ipc/service/image_trans…
53020 --- a/src/gpu/ipc/service/image_transport_surface_linux.cc
53022 @@ -17,7 +17,7 @@ scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface(
53026 -#if defined(USE_OZONE)
53031 diff --git a/src/gpu/vulkan/BUILD.gn b/src/gpu/vulkan/BUILD.gn
53033 --- a/src/gpu/vulkan/BUILD.gn
53035 @@ -123,7 +123,7 @@ if (enable_vulkan) {
53039 - if (is_linux || is_chromeos) {
53044 diff --git a/src/gpu/vulkan/features.gni b/src/gpu/vulkan/features.gni
53046 --- a/src/gpu/vulkan/features.gni
53048 @@ -8,7 +8,7 @@ import("//build/config/ui.gni")
53052 - enable_vulkan = is_linux || is_chromeos || is_android || is_fuchsia || is_win
53056 # --use-vulkan=swiftshader and some tests which use swiftshader vulkan will
53057 diff --git a/src/gpu/vulkan/vulkan_function_pointers.cc b/src/gpu/vulkan/vulkan_function_pointers.cc
53059 --- a/src/gpu/vulkan/vulkan_function_pointers.cc
53061 @@ -916,7 +916,8 @@ bool VulkanFunctionPointers::BindDeviceFunctionPointers(
53065 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
53071 @@ -961,7 +962,8 @@ bool VulkanFunctionPointers::BindDeviceFunctionPointers(
53075 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
53081 diff --git a/src/gpu/vulkan/vulkan_function_pointers.h b/src/gpu/vulkan/vulkan_function_pointers.h
53083 --- a/src/gpu/vulkan/vulkan_function_pointers.h
53085 @@ -256,7 +256,8 @@ struct COMPONENT_EXPORT(VULKAN) VulkanFunctionPointers {
53089 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
53095 @@ -268,7 +269,8 @@ struct COMPONENT_EXPORT(VULKAN) VulkanFunctionPointers {
53099 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
53105 @@ -309,7 +311,7 @@ struct COMPONENT_EXPORT(VULKAN) VulkanFunctionPointers {
53109 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
53114 @@ -1030,7 +1032,8 @@ ALWAYS_INLINE VkResult vkGetAndroidHardwareBufferPropertiesANDROID(
53118 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
53124 @@ -1064,7 +1067,8 @@ vkImportSemaphoreWin32HandleKHR(VkDevice device,
53128 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
53134 @@ -1200,7 +1204,7 @@ ALWAYS_INLINE VkResult vkQueuePresentKHR(VkQueue queue,
53138 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
53143 diff --git a/src/gpu/vulkan/vulkan_image.h b/src/gpu/vulkan/vulkan_image.h
53145 --- a/src/gpu/vulkan/vulkan_image.h
53147 @@ -86,7 +86,7 @@ class COMPONENT_EXPORT(VULKAN) VulkanImage {
53151 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
53156 @@ -170,7 +170,7 @@ class COMPONENT_EXPORT(VULKAN) VulkanImage {
53160 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
53165 diff --git a/src/ipc/ipc_channel.h b/src/ipc/ipc_channel.h
53167 --- a/src/ipc/ipc_channel.h
53169 @@ -235,7 +235,7 @@ class COMPONENT_EXPORT(IPC) Channel : public Sender {
53173 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
53178 diff --git a/src/ipc/ipc_channel_common.cc b/src/ipc/ipc_channel_common.cc
53180 --- a/src/ipc/ipc_channel_common.cc
53182 @@ -10,7 +10,7 @@
53186 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
53191 @@ -26,7 +26,7 @@ int Channel::GetGlobalPid() {
53195 -#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
53200 diff --git a/src/ipc/ipc_message_start.h b/src/ipc/ipc_message_start.h
53202 --- a/src/ipc/ipc_message_start.h
53204 @@ -21,6 +21,7 @@ enum IPCMessageStart {
53212 diff --git a/src/ipc/ipc_message_utils.cc b/src/ipc/ipc_message_utils.cc
53214 --- a/src/ipc/ipc_message_utils.cc
53216 @@ -349,7 +349,7 @@ void ParamTraits<unsigned int>::Log(const param_type& p, std::string* l) {
53220 - BUILDFLAG(IS_FUCHSIA) || \
53224 l->append(base::NumberToString(p));
53225 diff --git a/src/ipc/ipc_message_utils.h b/src/ipc/ipc_message_utils.h
53227 --- a/src/ipc/ipc_message_utils.h
53229 @@ -205,7 +205,7 @@ struct ParamTraits<unsigned int> {
53233 - BUILDFLAG(IS_FUCHSIA) || \
53238 diff --git a/src/media/audio/BUILD.gn b/src/media/audio/BUILD.gn
53240 --- a/src/media/audio/BUILD.gn
53242 @@ -241,6 +241,20 @@ source_set("audio") {
53263 diff --git a/src/media/audio/ohos/ohos_audio_manager.cc b/src/media/audio/ohos/ohos_audio_manager.cc
53266 --- /dev/null
53268 @@ -0,0 +1,97 @@
53270 +// Use of this source code is governed by a BSD-style license that can be
53315 + if (base::CommandLine::ForCurrentProcess()->HasSwitch(
53366 diff --git a/src/media/audio/ohos/ohos_audio_manager.h b/src/media/audio/ohos/ohos_audio_manager.h
53369 --- /dev/null
53371 @@ -0,0 +1,53 @@
53373 +// Use of this source code is governed by a BSD-style license that can be
53425 diff --git a/src/media/audio/ohos/ohos_audio_output_stream.cc b/src/media/audio/ohos/ohos_audio_out…
53428 --- /dev/null
53430 @@ -0,0 +1,214 @@
53432 +// Use of this source code is governed by a BSD-style license that can be
53461 + (void)audio_renderer_->Release();
53491 + manager_->ReleaseOutputStream(this);
53516 + if (!audio_renderer_->Stop()) {
53527 + (void)audio_renderer_->SetVolume(volume);
53531 + *volume = static_cast<double>(audio_renderer_->GetVolume());
53543 + int32_t ret = audio_renderer_->Create(rendererOptions);
53545 + if (!audio_renderer_->Release()) {
53554 + if (!audio_renderer_->Start()) {
53556 + if (!audio_renderer_->Release()) {
53570 + callback_->OnError(AudioSourceCallback::ErrorType::kUnknown);
53584 + now - stream_time - parameters_.GetBufferDuration() / 2,
53589 + audio_renderer_->GetLatency(latency);
53594 + int frames_filled = callback_->OnMoreData(delay, now, 0, audio_bus_.get());
53595 + DCHECK_EQ(frames_filled, audio_bus_->frames());
53596 + audio_bus_->Scale(volume_);
53597 + audio_bus_->ToInterleaved<SignedInt16SampleTypeTraits>(
53602 + int32_t result = audio_renderer_->Write(audio_data_[active_buffer_index_],
53619 + timer_.Start(FROM_HERE, GetCurrentStreamTime() - now,
53645 diff --git a/src/media/audio/ohos/ohos_audio_output_stream.h b/src/media/audio/ohos/ohos_audio_outp…
53648 --- /dev/null
53650 @@ -0,0 +1,98 @@
53652 +// Use of this source code is governed by a BSD-style license that can be
53749 diff --git a/src/media/base/BUILD.gn b/src/media/base/BUILD.gn
53751 --- a/src/media/base/BUILD.gn
53753 @@ -449,7 +449,7 @@ source_set("base") {
53757 - if (is_android) {
53762 diff --git a/src/media/base/demuxer_memory_limit.h b/src/media/base/demuxer_memory_limit.h
53764 --- a/src/media/base/demuxer_memory_limit.h
53766 @@ -45,7 +45,7 @@ constexpr size_t kDemuxerStreamVideoMemoryLimitDefault = 150 * 1024 * 1024;
53770 -#if BUILDFLAG(IS_ANDROID)
53775 diff --git a/src/media/base/demuxer_memory_limit_android.cc b/src/media/base/demuxer_memory_limit_a…
53777 --- a/src/media/base/demuxer_memory_limit_android.cc
53779 @@ -4,7 +4,9 @@
53789 @@ -17,12 +19,14 @@ size_t SelectLimit(size_t default_limit,
53795 if (base::android::BuildInfo::GetInstance()->sdk_int() >=
53804 diff --git a/src/media/base/media_switches.cc b/src/media/base/media_switches.cc
53806 --- a/src/media/base/media_switches.cc
53808 @@ -283,7 +283,7 @@ const base::Feature kPreloadMetadataLazyLoad{"PreloadMetadataLazyLoad",
53811 "resume-background-video",
53812 -#if BUILDFLAG(IS_ANDROID)
53817 diff --git a/src/media/base/null_video_sink.cc b/src/media/base/null_video_sink.cc
53819 --- a/src/media/base/null_video_sink.cc
53821 @@ -100,4 +100,8 @@ void NullVideoSink::PaintSingleFrame(scoped_refptr<VideoFrame> frame,
53830 diff --git a/src/media/base/null_video_sink.h b/src/media/base/null_video_sink.h
53832 --- a/src/media/base/null_video_sink.h
53834 @@ -41,6 +41,9 @@ class MEDIA_EXPORT NullVideoSink : public VideoRendererSink {
53844 diff --git a/src/media/base/ohos/BUILD.gn b/src/media/base/ohos/BUILD.gn
53847 --- /dev/null
53849 @@ -0,0 +1,38 @@
53851 +# Use of this source code is governed by a BSD-style license that can be
53889 diff --git a/src/media/base/ohos/ohos_media_player_bridge.cc b/src/media/base/ohos/ohos_media_playe…
53892 --- /dev/null
53894 @@ -0,0 +1,361 @@
53896 +// Use of this source code is governed by a BSD-style license that can be
53909 +static constexpr int PLAYER_INIT_ERROR = -1;
53930 + player_->Release();
53981 + int32_t ret = player_->SetPlayerCallback(media_player_callback);
53990 + ret = player_->SetSource(url_.spec());
54004 + consumer_surface_->RegisterConsumerListener(listener_);
54005 + consumer_surface_->SetUserData(surfaceFormat,
54007 + consumer_surface_->SetQueueSize(3);
54008 + ret = player_->SetVideoSurface(consumer_surface_);
54015 + ret = player_->PrepareAsync();
54023 + player_->Play();
54029 + int32_t ret = player_->Pause();
54053 + int32_t ret = player_->Seek(time.InMilliseconds(),
54068 + int32_t ret = player_->SetVolume(volume, volume);
54077 + client_->OnMediaDurationChanged(duration_);
54082 + int32_t time = -1;
54083 + (void)player_->GetDuration(time);
54094 + int32_t time = -1;
54095 + (void)player_->GetCurrentTime(time);
54100 + if (!task_runner_->BelongsToCurrentThread()) {
54101 + task_runner_->PostTask(FROM_HERE,
54108 + if (cached_buffers_.front()->GetBufferHandle()->fd != fd) {
54110 + << cached_buffers_.front()->GetBufferHandle()->fd;
54113 + if (cached_buffers_.front()->GetBufferHandle()->reserve[0] != fd) {
54115 + << cached_buffers_.front()->GetBufferHandle()->reserve[0];
54119 + consumer_surface_->ReleaseBuffer(cached_buffers_.front(), -1);
54129 + int32_t ret = player_->SetPlaybackSpeed(mode);
54137 + client_->OnPlaybackComplete();
54141 + client_->OnError(error_code);
54186 + if (!task_runner_->BelongsToCurrentThread()) {
54187 + task_runner_->PostTask(
54195 + int fd = buffer->GetBufferHandle()->fd;
54197 + int fd = buffer->GetBufferHandle()->reserve[0];
54201 + OHOS::SurfaceError ret = consumer_surface_->ReleaseBuffer(buffer, -1);
54209 + client_->OnFrameAvailable(fd, buffer->GetSize(), buffer->GetWidth(),
54210 + buffer->GetHeight(), buffer->GetWidth(),
54211 + buffer->GetHeight(), buffer->GetFormat());
54220 + if (buffer->GetHeight() % step_height == 0) {
54221 + coded_height = buffer->GetHeight();
54223 + coded_height = (buffer->GetHeight() / step_height + 1) * step_height;
54225 + if (buffer->GetFormat() == PIXEL_FMT_RGBA_8888) {
54226 + coded_width = buffer->GetStride() / argb_stride_step;
54228 + coded_width = buffer->GetStride();
54230 + client_->OnFrameAvailable(fd, buffer->GetSize(), coded_width, coded_height,
54231 + buffer->GetWidth(), buffer->GetHeight(),
54232 + buffer->GetFormat());
54241 + return -1;
54247 + return -1;
54250 + int32_t ret = player_->SetSource(fd, 0, length);
54256 diff --git a/src/media/base/ohos/ohos_media_player_bridge.h b/src/media/base/ohos/ohos_media_player…
54259 --- /dev/null
54261 @@ -0,0 +1,114 @@
54263 +// Use of this source code is governed by a BSD-style license that can be
54376 diff --git a/src/media/base/ohos/ohos_media_player_callback.cc b/src/media/base/ohos/ohos_media_pla…
54379 --- /dev/null
54381 @@ -0,0 +1,95 @@
54383 +// Use of this source code is governed by a BSD-style license that can be
54412 + task_runner_->PostTask(
54423 + task_runner_->PostTask(
54428 + task_runner_->PostTask(
54477 diff --git a/src/media/base/ohos/ohos_media_player_callback.h b/src/media/base/ohos/ohos_media_play…
54480 --- /dev/null
54482 @@ -0,0 +1,47 @@
54484 +// Use of this source code is governed by a BSD-style license that can be
54530 diff --git a/src/media/base/ohos/ohos_media_player_listener.cc b/src/media/base/ohos/ohos_media_pla…
54533 --- /dev/null
54535 @@ -0,0 +1,48 @@
54537 +// Use of this source code is governed by a BSD-style license that can be
54566 + ret = surface_temp->AcquireBuffer(buffer, fence, timestamp, damage);
54572 + if (buffer->GetFormat() == PIXEL_FMT_RGBA_8888 ||
54573 + buffer->GetFormat() == PIXEL_FMT_YCBCR_420_SP) {
54574 + task_runner_->PostTask(
54578 + LOG(ERROR) << "Unsupport format for:" << buffer->GetFormat();
54579 + surface_temp->ReleaseBuffer(buffer, -1);
54584 diff --git a/src/media/base/ohos/ohos_media_player_listener.h b/src/media/base/ohos/ohos_media_play…
54587 --- /dev/null
54589 @@ -0,0 +1,44 @@
54591 +// Use of this source code is governed by a BSD-style license that can be
54634 diff --git a/src/media/base/renderer_factory_selector.cc b/src/media/base/renderer_factory_selector…
54636 --- a/src/media/base/renderer_factory_selector.cc
54638 @@ -33,6 +33,10 @@ std::string GetRendererName(RendererType renderer_type) {
54649 diff --git a/src/media/base/renderer_factory_selector.h b/src/media/base/renderer_factory_selector.h
54651 --- a/src/media/base/renderer_factory_selector.h
54653 @@ -31,7 +31,13 @@ enum class RendererType {
54667 diff --git a/src/media/base/video_renderer_sink.h b/src/media/base/video_renderer_sink.h
54669 --- a/src/media/base/video_renderer_sink.h
54671 @@ -70,6 +70,10 @@ class MEDIA_EXPORT VideoRendererSink {
54682 diff --git a/src/media/capture/BUILD.gn b/src/media/capture/BUILD.gn
54684 --- a/src/media/capture/BUILD.gn
54686 @@ -252,7 +252,7 @@ component("capture_lib") {
54690 - if (is_linux || is_chromeos) {
54695 @@ -382,7 +382,7 @@ source_set("test_support") {
54699 - if (is_linux || is_chromeos_lacros) {
54704 diff --git a/src/media/capture/video/fake_video_capture_device_factory.cc b/src/media/capture/video…
54706 --- a/src/media/capture/video/fake_video_capture_device_factory.cc
54708 @@ -213,7 +213,7 @@ void FakeVideoCaptureDeviceFactory::GetDevicesInfo(
54712 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
54717 diff --git a/src/media/media_options.gni b/src/media/media_options.gni
54719 --- a/src/media/media_options.gni
54721 @@ -36,7 +36,7 @@ declare_args() {
54725 - if (is_ios || is_android || !proprietary_codecs) {
54730 @@ -78,7 +78,7 @@ declare_args() {
54734 - enable_media_drm_storage = is_android || is_chromecast
54739 @@ -127,7 +127,7 @@ declare_args() {
54741 # Alsa should be used on non-Android, non-Mac POSIX systems.
54742 # Alsa should be used on desktop Chromecast and audio-only Chromecast builds.
54743 - if (is_posix && !is_android && !is_mac &&
54748 @@ -201,7 +201,7 @@ _default_mojo_media_host = ""
54752 -} else if (is_android) {
54757 @@ -259,7 +259,7 @@ declare_args() {
54761 - enable_media_remoting_rpc = enable_media_remoting && !is_android
54766 @@ -298,6 +298,12 @@ if (is_fuchsia) {
54779 diff --git a/src/media/midi/midi_manager.cc b/src/media/midi/midi_manager.cc
54781 --- a/src/media/midi/midi_manager.cc
54783 @@ -186,7 +186,7 @@ void MidiManager::EndAllSessions() {
54787 - CompleteInitialization(Result::NOT_SUPPORTED);
54792 diff --git a/src/media/mojo/clients/mojo_renderer_factory.cc b/src/media/mojo/clients/mojo_renderer…
54794 --- a/src/media/mojo/clients/mojo_renderer_factory.cc
54796 @@ -102,7 +102,9 @@ std::unique_ptr<MojoRenderer> MojoRendererFactory::CreateFlingingRenderer(
54806 @@ -122,6 +124,6 @@ std::unique_ptr<MojoRenderer> MojoRendererFactory::CreateMediaPlayerRenderer(
54810 -#endif // BUILDFLAG(IS_ANDROID)
54814 diff --git a/src/media/mojo/clients/mojo_renderer_factory.h b/src/media/mojo/clients/mojo_renderer_…
54816 --- a/src/media/mojo/clients/mojo_renderer_factory.h
54818 @@ -70,7 +70,9 @@ class MojoRendererFactory final : public RendererFactory {
54828 @@ -78,7 +80,7 @@ class MojoRendererFactory final : public RendererFactory {
54832 -#endif // defined (OS_ANDROID)
54837 diff --git a/src/media/mojo/mojom/BUILD.gn b/src/media/mojo/mojom/BUILD.gn
54839 --- a/src/media/mojo/mojom/BUILD.gn
54841 @@ -94,6 +94,10 @@ mojom("mojom") {
54852 diff --git a/src/media/mojo/mojom/interface_factory.mojom b/src/media/mojo/mojom/interface_factory.…
54854 --- a/src/media/mojo/mojom/interface_factory.mojom
54856 @@ -40,7 +40,7 @@ interface InterfaceFactory {
54860 - [EnableIf=is_android]
54863 // - |renderer_extension| is bound in MediaPlayerRenderer, and receives calls
54865 diff --git a/src/media/mojo/mojom/media_types.mojom b/src/media/mojo/mojom/media_types.mojom
54867 --- a/src/media/mojo/mojom/media_types.mojom
54869 @@ -539,4 +539,7 @@ enum RendererType {
54877 diff --git a/src/media/mojo/mojom/media_types_enum_mojom_traits.h b/src/media/mojo/mojom/media_type…
54879 --- a/src/media/mojo/mojom/media_types_enum_mojom_traits.h
54881 @@ -287,6 +287,10 @@ struct EnumTraits<media::mojom::RendererType, ::media::RendererType> {
54892 @@ -328,6 +332,11 @@ struct EnumTraits<media::mojom::RendererType, ::media::RendererType> {
54904 diff --git a/src/media/mojo/mojom/renderer_extensions.mojom b/src/media/mojo/mojom/renderer_extensi…
54906 --- a/src/media/mojo/mojom/renderer_extensions.mojom
54908 @@ -9,6 +9,18 @@ import "mojo/public/mojom/base/time.mojom";
54927 @@ -19,6 +31,8 @@ interface MediaPlayerRendererClientExtension {
54936 @@ -33,6 +47,9 @@ interface MediaPlayerRendererExtension {
54937 // StreamTexture's set-up.
54946 diff --git a/src/media/mojo/services/interface_factory_impl.cc b/src/media/mojo/services/interface_…
54948 --- a/src/media/mojo/services/interface_factory_impl.cc
54950 @@ -141,7 +141,7 @@ void InterfaceFactoryImpl::CreateCastRenderer(
54954 -#if BUILDFLAG(IS_ANDROID)
54959 @@ -150,7 +150,9 @@ void InterfaceFactoryImpl::CreateMediaPlayerRenderer(
54969 diff --git a/src/media/mojo/services/interface_factory_impl.h b/src/media/mojo/services/interface_f…
54971 --- a/src/media/mojo/services/interface_factory_impl.h
54973 @@ -66,13 +66,15 @@ class InterfaceFactoryImpl final
54977 -#if BUILDFLAG(IS_ANDROID)
54990 diff --git a/src/mojo/public/cpp/bindings/interface_endpoint_client.h b/src/mojo/public/cpp/binding…
54992 --- a/src/mojo/public/cpp/bindings/interface_endpoint_client.h
54994 @@ -213,20 +213,32 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) InterfaceEndpointClient
54998 - // Maps from the id of a response to the MessageReceiver that handles the
54999 - // response.
55000 - using AsyncResponderMap =
55001 - std::map<uint64_t, std::unique_ptr<MessageReceiver>>;
55020 - explicit SyncResponseInfo(bool* in_response_received);
55031 // Points to a stack-allocated variable.
55032 diff --git a/src/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc b/src/mojo/public/cpp/bi…
55034 --- a/src/mojo/public/cpp/bindings/lib/interface_endpoint_client.cc
55036 @@ -27,6 +27,7 @@
55040 +#include "third_party/abseil-cpp/absl/types/optional.h"
55044 @@ -312,9 +313,27 @@ class ResponderThunk : public MessageReceiverWithStatus {
55046 // ----------------------------------------------------------------------------
55067 - : response_received(in_response_received) {}
55073 @@ -598,6 +617,7 @@ bool InterfaceEndpointClient::SendMessageWithResponder(
55077 + const uint32_t message_name = message->name();
55078 const bool is_sync = message->has_flag(Message::kFlagIsSync);
55079 const bool exclusive_wait = message->has_flag(Message::kFlagNoInterrupt);
55080 if (!controller_->SendMessage(message))
55081 @@ -614,7 +634,8 @@ bool InterfaceEndpointClient::SendMessageWithResponder(
55082 controller_->RegisterExternalSyncWaiter(request_id);
55085 - async_responders_[request_id] = std::move(responder);
55091 @@ -622,7 +643,8 @@ bool InterfaceEndpointClient::SendMessageWithResponder(
55095 - request_id, std::make_unique<SyncResponseInfo>(&response_received)));
55101 @@ -800,13 +822,13 @@ void InterfaceEndpointClient::ResetFromAnotherSequenceUnsafe() {
55105 - std::unique_ptr<MessageReceiver> responder;
55112 - responder = std::move(it->second);
55113 + response = std::move(it->second);
55117 @@ -872,6 +894,10 @@ bool InterfaceEndpointClient::HandleValidatedMessage(Message* message) {
55120 if (it->second) {
55121 + if (message->name() != it->second->request_message_name) {
55125 it->second->response = std::move(*message);
55126 *it->second->response_received = true;
55128 @@ -882,18 +908,22 @@ bool InterfaceEndpointClient::HandleValidatedMessage(Message* message) {
55132 - std::unique_ptr<MessageReceiver> responder;
55139 - responder = std::move(it->second);
55140 + pending_response = std::move(it->second);
55144 + if (message->name() != pending_response->request_message_name) {
55149 - return responder->Accept(message);
55150 + return pending_response->responder->Accept(message);
55154 diff --git a/src/mojo/public/mojom/base/BUILD.gn b/src/mojo/public/mojom/base/BUILD.gn
55156 --- a/src/mojo/public/mojom/base/BUILD.gn
55158 @@ -67,6 +67,21 @@ mojom_component("base") {
55180 diff --git a/src/mojo/public/tools/bindings/mojom.gni b/src/mojo/public/tools/bindings/mojom.gni
55182 --- a/src/mojo/public/tools/bindings/mojom.gni
55184 @@ -688,6 +688,8 @@ template("mojom") {
55193 diff --git a/src/net/BUILD.gn b/src/net/BUILD.gn
55195 --- a/src/net/BUILD.gn
55197 @@ -1175,6 +1175,13 @@ component("net") {
55211 @@ -1196,7 +1203,7 @@ component("net") {
55215 - if (is_linux || is_chromeos_lacros) {
55220 @@ -1205,7 +1212,7 @@ component("net") {
55224 - if (is_linux || is_chromeos || is_android) {
55229 @@ -1347,7 +1354,7 @@ component("net") {
55233 - if (is_android || is_chromeos_ash) {
55238 @@ -1380,7 +1387,7 @@ component("net") {
55242 - if (is_posix && !is_linux && !is_chromeos) {
55247 @@ -1409,6 +1416,10 @@ component("net") {
55258 @@ -2525,7 +2536,7 @@ if (is_android) {
55262 -if (is_android || is_linux || is_chromeos) {
55267 @@ -4712,7 +4723,7 @@ test("net_unittests") {
55271 - if (is_posix && !is_linux && !is_chromeos) {
55276 diff --git a/src/net/base/address_list.h b/src/net/base/address_list.h
55278 --- a/src/net/base/address_list.h
55280 @@ -8,6 +8,7 @@
55288 diff --git a/src/net/base/network_change_notifier.cc b/src/net/base/network_change_notifier.cc
55290 --- a/src/net/base/network_change_notifier.cc
55292 @@ -38,7 +38,7 @@
55296 -#elif BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_ANDROID)
55301 @@ -303,7 +303,7 @@ std::unique_ptr<NetworkChangeNotifier> NetworkChangeNotifier::CreateIfNeeded(
55303 network_change_notifier->WatchForAddressChange();
55305 -#elif BUILDFLAG(IS_ANDROID)
55310 @@ -511,7 +511,7 @@ const char* NetworkChangeNotifier::ConnectionTypeToString(
55314 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
55319 @@ -855,7 +855,7 @@ NetworkChangeNotifier::NetworkChangeNotifier(
55323 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
55328 diff --git a/src/net/base/network_change_notifier.h b/src/net/base/network_change_notifier.h
55330 --- a/src/net/base/network_change_notifier.h
55332 @@ -24,7 +24,7 @@ struct NetworkInterface;
55336 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
55341 @@ -449,7 +449,7 @@ class NET_EXPORT NetworkChangeNotifier {
55345 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
55350 @@ -611,7 +611,7 @@ class NET_EXPORT NetworkChangeNotifier {
55354 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
55359 diff --git a/src/net/base/network_change_notifier_posix.cc b/src/net/base/network_change_notifier_p…
55361 --- a/src/net/base/network_change_notifier_posix.cc
55363 @@ -6,6 +6,7 @@
55371 @@ -18,6 +19,77 @@
55414 + network_change_notifier_posix_->OnConnectionChanged(
55416 + network_change_notifier_posix_->OnConnectionSubtypeChanged(
55425 + network_change_notifier_posix_->OnDNSChanged();
55426 + network_change_notifier_posix_->OnIPAddressChanged();
55433 + network_change_notifier_posix_->OnConnectionChanged(
55435 + network_change_notifier_posix_->OnConnectionSubtypeChanged(
55449 @@ -34,12 +106,36 @@ NetworkChangeNotifierPosix::NetworkChangeNotifierPosix(
55459 - initial_connection_subtype)) {}
55465 + ohos_net_conn_adapter_->RegisterNetConnCallback(g_net_connect_callback);
55477 + int32_t ret = ohos_net_conn_adapter_->UnregisterNetConnCallback(
55487 diff --git a/src/net/base/network_change_notifier_posix.h b/src/net/base/network_change_notifier_po…
55489 --- a/src/net/base/network_change_notifier_posix.h
55491 @@ -5,6 +5,8 @@
55500 @@ -14,6 +16,9 @@
55510 @@ -70,6 +75,11 @@ class NET_EXPORT NetworkChangeNotifierPosix : public NetworkChangeNotifier {
55522 diff --git a/src/net/cert/cert_status_flags_list.h b/src/net/cert/cert_status_flags_list.h
55524 --- a/src/net/cert/cert_status_flags_list.h
55526 @@ -44,4 +44,5 @@ CERT_STATUS_FLAG(KNOWN_INTERCEPTION_DETECTED, 1 << 21)
55532 diff --git a/src/net/cert/cert_verify_proc.cc b/src/net/cert/cert_verify_proc.cc
55534 --- a/src/net/cert/cert_verify_proc.cc
55536 @@ -55,6 +55,8 @@
55545 @@ -476,6 +478,8 @@ scoped_refptr<CertVerifyProc> CertVerifyProc::CreateSystemVerifyProc(
55554 @@ -667,6 +671,7 @@ int CertVerifyProc::Verify(X509Certificate* cert,
55557 [&] { return verify_result->NetLogParams(rv); });
55562 diff --git a/src/net/cert/cert_verify_proc_ohos.cc b/src/net/cert/cert_verify_proc_ohos.cc
55565 --- /dev/null
55567 @@ -0,0 +1,505 @@
55569 +// Use of this source code is governed by a BSD-style license that can be
55609 + chain_bytes->reserve(1 + cert->intermediate_buffers().size());
55610 + chain_bytes->emplace_back(
55611 + net::x509_util::CryptoBufferAsStringPiece(cert->cert_buffer()));
55612 + for (const auto& handle : cert->intermediate_buffers()) {
55613 + chain_bytes->emplace_back(
55633 + for (i = server_cert_sum - 1; i > 0; i--) {
55651 + auto error = ctx->error;
55654 + << X509_verify_cert_error_string(ctx->error)
55736 +// while path-building from |start| have an issuer in |certs| (including if
55752 + // Find an issuer for |last| (which might be |last| itself if self-signed).
55754 + if (cert->normalized_subject() == last->normalized_issuer()) {
55763 + if (last_issuer->normalized_subject() == last_issuer->normalized_issuer()) {
55764 + // A chain can be built from |start| to a self-signed certificate, so
55793 + std::unique_ptr<CertNetFetcher::Request> request(fetcher->FetchCaIssuers(
55797 + request->WaitForResult(&error, &aia_fetch_bytes);
55823 + verified_chain->assign(cert_chain.begin(), cert_chain.end());
55836 + cert_bytes.push_back(cert->der_cert().AsString());
55846 + verify_result->is_issued_by_known_root = is_issued_by_known_root;
55884 + // |certs| either contains a loop, or contains a full chain to a self-signed
55892 + // If chain-building has terminated in a certificate that does not have an
55898 + // would accomodate chains where the server serves Leaf -> I1 signed by a
55901 + if (!last_cert_with_unknown_issuer->has_authority_info_access()) {
55906 + for (const auto& uri : last_cert_with_unknown_issuer->ca_issuers_uris()) {
55954 + &verify_result->is_issued_by_known_root, &verified_chain);
55972 + verify_result->cert_status |= CERT_STATUS_AUTHORITY_INVALID;
55976 + verify_result->cert_status |= CERT_STATUS_DATE_INVALID;
55979 + verify_result->cert_status |= CERT_STATUS_DEPTH_ZERO_SELF_SIGNED_CERT;
55983 + verify_result->cert_status |= CERT_STATUS_INVALID;
55996 + verify_result->verified_cert = std::move(verified_cert);
55999 + verify_result->cert_status |= CERT_STATUS_INVALID;
56010 + verify_result->cert_status |= CERT_STATUS_INVALID;
56016 + verify_result->public_key_hashes.push_back(sha256);
56018 + if (!verify_result->is_issued_by_known_root) {
56019 + verify_result->is_issued_by_known_root =
56024 + // Reverse the hash list, to maintain the leaf->root ordering.
56025 + std::reverse(verify_result->public_key_hashes.begin(),
56026 + verify_result->public_key_hashes.end());
56065 + if (IsCertStatusError(verify_result->cert_status)) {
56066 + return MapCertStatusToNetError(verify_result->cert_status);
56073 diff --git a/src/net/cert/cert_verify_proc_ohos.h b/src/net/cert/cert_verify_proc_ohos.h
56076 --- /dev/null
56078 @@ -0,0 +1,43 @@
56080 +// Use of this source code is governed by a BSD-style license that can be
56122 diff --git a/src/net/cookies/canonical_cookie.cc b/src/net/cookies/canonical_cookie.cc
56124 --- a/src/net/cookies/canonical_cookie.cc
56126 @@ -56,6 +56,7 @@
56134 @@ -506,6 +507,11 @@ std::unique_ptr<CanonicalCookie> CanonicalCookie::Create(
56146 @@ -1389,6 +1395,9 @@ bool CanonicalCookie::IsCanonicalForFromStorage() const {
56156 @@ -1507,6 +1516,40 @@ CookieEffectiveSameSite CanonicalCookie::GetEffectiveSameSite(
56167 + const base::StringPiece host_prefix = "__Host-";
56182 + const base::StringPiece secure_prefix = "__Secure-";
56195 return (base::Time::Now() - creation_date_) <= age_threshold;
56197 diff --git a/src/net/cookies/canonical_cookie.h b/src/net/cookies/canonical_cookie.h
56199 --- a/src/net/cookies/canonical_cookie.h
56201 @@ -416,6 +416,7 @@ class NET_EXPORT CanonicalCookie {
56209 @@ -479,6 +480,9 @@ class NET_EXPORT CanonicalCookie {
56219 diff --git a/src/net/cookies/canonical_cookie_unittest.cc b/src/net/cookies/canonical_cookie_unitte…
56221 --- a/src/net/cookies/canonical_cookie_unittest.cc
56223 @@ -2227,6 +2227,16 @@ TEST(CanonicalCookieTest, SecureCookiePrefix) {
56228 + // Hidden __Secure- prefixes should be rejected.
56229 + EXPECT_FALSE(CanonicalCookie::Create(https_url, "=__Secure-A=B; Secure",
56235 + EXPECT_TRUE(CanonicalCookie::Create(https_url, "A=__Secure-A=B; Secure",
56240 @@ -2311,6 +2321,18 @@ TEST(CanonicalCookieTest, HostCookiePrefix) {
56245 + // Hidden __Host- prefixes should be rejected.
56247 + "=__Host-A=B; Path=/; Secure;",
56254 + "A=__Host-A=B; Path=/; Secure;",
56259 @@ -2336,6 +2358,31 @@ TEST(CanonicalCookieTest, CanCreateSecureCookiesFromAnyScheme) {
56266 + "", "__Secure-a=b", "x.y", "/", base::Time(), base::Time(),
56269 + ->IsCanonical());
56272 + "", "__Host-a=b", "x.y", "/", base::Time(), base::Time(),
56275 + ->IsCanonical());
56278 + "a", "__Secure-a=b", "x.y", "/", base::Time(), base::Time(),
56281 + ->IsCanonical());
56284 + "a", "__Host-a=b", "x.y", "/", base::Time(), base::Time(),
56287 + ->IsCanonical());
56291 @@ -3361,6 +3408,39 @@ TEST(CanonicalCookieTest, CreateSanitizedCookie_Logic) {
56298 + GURL("https://www.foo.com"), "", "__Host-A=B", "", "/", two_hours_ago,
56306 + GURL("https://www.foo.com"), "", "__Secure-A=B", "", "/", two_hours_ago,
56315 + GURL("https://www.foo.com"), "A", "__Host-A=B", "", "/", two_hours_ago,
56322 + GURL("https://www.foo.com"), "A", "__Secure-A=B", "", "/", two_hours_ago,
56331 @@ -4888,4 +4968,47 @@ TEST(CanonicalCookieTest, TestIsCanonicalWithInvalidSizeHistograms) {
56346 + {"__Secure-abc", false},
56347 + {"__Secur=e-abc", false},
56349 + {"__Host-abc", false},
56350 + {"__Hos=t-abc", false},
56352 + {" __Secure-abc", false},
56353 + {"\t__Host-", false},
56354 + {"a__Host-abc=123", false},
56355 + {"a__Secure-abc=123", false},
56356 + {"__Host-abc=", true},
56357 + {"__Host-abc=123", true},
56358 + {" __Host-abc=123", true},
56359 + {" __Host-abc=", true},
56360 + {"\t\t\t\t\t__Host-abc=123", true},
56361 + {"\t __Host-abc=", true},
56362 + {"__Secure-abc=", true},
56363 + {"__Secure-abc=123", true},
56364 + {" __Secure-abc=123", true},
56365 + {" __Secure-abc=", true},
56366 + {"\t\t\t\t\t__Secure-abc=123", true},
56367 + {"\t __Secure-abc=", true},
56368 + {"__Secure-abc=123=d=4=fg=", true},
56379 diff --git a/src/net/dns/BUILD.gn b/src/net/dns/BUILD.gn
56381 --- a/src/net/dns/BUILD.gn
56383 @@ -413,7 +413,7 @@ source_set("tests") {
56387 - if (is_android) {
56392 diff --git a/src/net/dns/dns_config_service_posix.cc b/src/net/dns/dns_config_service_posix.cc
56394 --- a/src/net/dns/dns_config_service_posix.cc
56396 @@ -25,7 +25,6 @@
56400 -#include "net/dns/public/resolv_reader.h"
56402 #include "third_party/abseil-cpp/absl/types/optional.h"
56404 @@ -33,6 +32,10 @@
56415 @@ -93,6 +96,7 @@ absl::optional<DnsConfig> ReadDnsConfig() {
56423 @@ -100,6 +104,7 @@ absl::optional<DnsConfig> ReadDnsConfig() {
56424 dns_config = ConvertResStateToDnsConfig(scoped_res_state->state());
56431 @@ -246,6 +251,7 @@ void DnsConfigServicePosix::CreateReader() {
56439 @@ -301,7 +307,7 @@ absl::optional<DnsConfig> ConvertResStateToDnsConfig(
56443 -
56448 diff --git a/src/net/dns/dns_reloader.cc b/src/net/dns/dns_reloader.cc
56450 --- a/src/net/dns/dns_reloader.cc
56452 @@ -7,7 +7,7 @@
56456 - !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA)
56461 diff --git a/src/net/dns/host_resolver_manager.cc b/src/net/dns/host_resolver_manager.cc
56463 --- a/src/net/dns/host_resolver_manager.cc
56465 @@ -121,11 +121,15 @@
56469 -#else // !BUILDFLAG(IS_ANDROID)
56482 @@ -253,7 +257,7 @@ bool HaveOnlyLoopbackAddresses() {
56486 -#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
56491 @@ -287,6 +291,8 @@ bool HaveOnlyLoopbackAddresses() {
56500 @@ -3006,7 +3012,8 @@ HostResolverManager::HostResolverManager(
56504 -#if (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)) || \
56510 @@ -3015,7 +3022,7 @@ HostResolverManager::HostResolverManager(
56512 system_dns_config_notifier_->AddObserver(this);
56514 - !BUILDFLAG(IS_ANDROID)
56519 @@ -3298,6 +3305,26 @@ int HostResolverManager::Resolve(RequestImpl* request) {
56546 @@ -3340,6 +3367,11 @@ HostCache::Entry HostResolverManager::ResolveLocally(
56558 @@ -3402,6 +3434,13 @@ HostCache::Entry HostResolverManager::ResolveLocally(
56572 @@ -4062,7 +4101,8 @@ void HostResolverManager::OnIPAddressChanged() {
56576 -#if (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)) || \
56582 diff --git a/src/net/dns/host_resolver_proc.cc b/src/net/dns/host_resolver_proc.cc
56584 --- a/src/net/dns/host_resolver_proc.cc
56586 @@ -176,8 +176,8 @@ int SystemHostResolverCall(const std::string& host,
56590 -#if BUILDFLAG(IS_POSIX) && \
56591 - !(BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_ANDROID))
56597 diff --git a/src/net/dns/public/BUILD.gn b/src/net/dns/public/BUILD.gn
56599 --- a/src/net/dns/public/BUILD.gn
56601 @@ -37,7 +37,7 @@ source_set("public") {
56605 - if (is_posix && !is_android) {
56610 diff --git a/src/net/dns/public/scoped_res_state.cc b/src/net/dns/public/scoped_res_state.cc
56612 --- a/src/net/dns/public/scoped_res_state.cc
56614 @@ -13,7 +13,7 @@
56618 -#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA)
56623 @@ -25,10 +25,10 @@ ScopedResState::ScopedResState() {
56627 -#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
56631 -#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
56636 @@ -43,7 +43,7 @@ bool ScopedResState::IsValid() const {
56640 -#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FUCHSIA)
56645 diff --git a/src/net/dns/public/scoped_res_state.h b/src/net/dns/public/scoped_res_state.h
56647 --- a/src/net/dns/public/scoped_res_state.h
56649 @@ -31,7 +31,7 @@ class NET_EXPORT ScopedResState {
56653 -#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
56658 diff --git a/src/net/http/http_status_code.cc b/src/net/http/http_status_code.cc
56660 --- a/src/net/http/http_status_code.cc
56662 @@ -7,6 +7,7 @@
56670 @@ -24,4 +25,20 @@ const char* GetHttpReasonPhrase(HttpStatusCode code) {
56691 diff --git a/src/net/http/http_status_code.h b/src/net/http/http_status_code.h
56693 --- a/src/net/http/http_status_code.h
56695 @@ -5,8 +5,8 @@
56701 -
56705 @@ -28,6 +28,10 @@ enum HttpStatusCode {
56716 diff --git a/src/net/socket/unix_domain_server_socket_posix.cc b/src/net/socket/unix_domain_server_…
56718 --- a/src/net/socket/unix_domain_server_socket_posix.cc
56720 @@ -34,7 +34,7 @@ UnixDomainServerSocket::~UnixDomainServerSocket() = default;
56724 - BUILDFLAG(IS_FUCHSIA)
56729 diff --git a/src/net/socket/unix_domain_server_socket_posix.h b/src/net/socket/unix_domain_server_s…
56731 --- a/src/net/socket/unix_domain_server_socket_posix.h
56733 @@ -29,7 +29,7 @@ class NET_EXPORT UnixDomainServerSocket : public ServerSocket {
56737 - BUILDFLAG(IS_FUCHSIA)
56740 // than Windows/OS X. It's useful for permission-based authorization on
56742 diff --git a/src/ohos_nweb/BUILD.gn b/src/ohos_nweb/BUILD.gn
56745 --- /dev/null
56747 @@ -0,0 +1,283 @@
56753 +# http://www.apache.org/licenses/LICENSE-2.0
56972 + public_deps = [ "//third_party/abseil-cpp:absl" ]
57031 diff --git a/src/ohos_nweb/README.md b/src/ohos_nweb/README.md
57034 --- /dev/null
57036 @@ -0,0 +1,30 @@
57041 +- `include`:提供暴露给OHOS的接口和相关定义。OHOS侧可通过这些方法加载和使用web内核
57042 +- `src`:对web内核的封装实现,其中各子目录中的内容表示对不同web内核的封装,其它部分为一些通用逻辑的实现
57043 + - `cef_delegate`: 对cef接口的封装
57051 +autoninja -C <output_path> libweb_engine libnweb_adapter web_renderer
57056 + - `libweb_engine.so`,包含整个chromium内核和cef框架实现
57057 + - `libnweb_adapter.so`,包含OHOS与web内核的对接框架在内核侧的实现
57058 + - `web_renderer`二进制,用于起render子进程和网络子进程
57068 diff --git a/src/ohos_nweb/include/nweb.h b/src/ohos_nweb/include/nweb.h
57071 --- /dev/null
57073 @@ -0,0 +1,564 @@
57080 + * http://www.apache.org/licenses/LICENSE-2.0
57114 + COLOR_TYPE_UNKNOWN = -1,
57128 + ALPHA_TYPE_UNKNOWN = -1,
57133 + // Transparency with pre-multiplied alpha component.
57136 + // Transparency with post-multiplied alpha component.
57399 + * accept types or the User-Agent, their values may be overridden by this
57425 + * defaults to 'about:blank'. If non-null, this must be a valid URL. This
57638 diff --git a/src/ohos_nweb/include/nweb_access_request.h b/src/ohos_nweb/include/nweb_access_reques…
57641 --- /dev/null
57643 @@ -0,0 +1,69 @@
57650 + * http://www.apache.org/licenses/LICENSE-2.0
57714 diff --git a/src/ohos_nweb/include/nweb_console_log.h b/src/ohos_nweb/include/nweb_console_log.h
57717 --- /dev/null
57719 @@ -0,0 +1,90 @@
57726 + * http://www.apache.org/licenses/LICENSE-2.0
57811 diff --git a/src/ohos_nweb/include/nweb_context_menu_params.h b/src/ohos_nweb/include/nweb_context_…
57814 --- /dev/null
57816 @@ -0,0 +1,146 @@
57823 + * http://www.apache.org/licenses/LICENSE-2.0
57964 diff --git a/src/ohos_nweb/include/nweb_controller_handler.h b/src/ohos_nweb/include/nweb_controlle…
57967 --- /dev/null
57969 @@ -0,0 +1,26 @@
57971 +// Use of this source code is governed by a BSD-style license that can be
57996 diff --git a/src/ohos_nweb/include/nweb_cookie_manager.h b/src/ohos_nweb/include/nweb_cookie_manage…
57999 --- /dev/null
58001 @@ -0,0 +1,145 @@
58008 + * http://www.apache.org/licenses/LICENSE-2.0
58049 + * @return true if the instance allows the setting of third-party cookies.
58054 + * By default, this value is set to be false. Nweb does not allow the setting of third-party c…
58056 + * @param accept whether the instance allows the setting of third-party cookies.
58087 + * @brief Sets a single cookie (key-value pair) for the given URL.
58090 + * @param value the cookie as a string, using the format of the 'Set-Cookie' HTTP response hea…
58097 + * @brief Sets a single cookie (key-value pair) for the given URL sync.
58100 + * @param value the cookie as a string, using the format of the 'Set-Cookie' HTTP response hea…
58148 diff --git a/src/ohos_nweb/include/nweb_data_base.h b/src/ohos_nweb/include/nweb_data_base.h
58151 --- /dev/null
58153 @@ -0,0 +1,123 @@
58160 + * http://www.apache.org/licenses/LICENSE-2.0
58277 diff --git a/src/ohos_nweb/include/nweb_data_resubmission_callback.h b/src/ohos_nweb/include/nweb_d…
58280 --- /dev/null
58282 @@ -0,0 +1,26 @@
58284 +// Use of this source code is governed by a BSD-style license that can be
58310 diff --git a/src/ohos_nweb/include/nweb_download_callback.h b/src/ohos_nweb/include/nweb_download_c…
58313 --- /dev/null
58315 @@ -0,0 +1,46 @@
58322 + * http://www.apache.org/licenses/LICENSE-2.0
58349 + * @param contentDisposition Content-disposition http header, if present.
58363 diff --git a/src/ohos_nweb/include/nweb_errors.h b/src/ohos_nweb/include/nweb_errors.h
58366 --- /dev/null
58368 @@ -0,0 +1,32 @@
58375 + * http://www.apache.org/licenses/LICENSE-2.0
58389 + NWEB_ERR = -1,
58401 diff --git a/src/ohos_nweb/include/nweb_export.h b/src/ohos_nweb/include/nweb_export.h
58404 --- /dev/null
58406 @@ -0,0 +1,29 @@
58413 + * http://www.apache.org/licenses/LICENSE-2.0
58436 diff --git a/src/ohos_nweb/include/nweb_file_selector_params.h b/src/ohos_nweb/include/nweb_file_se…
58439 --- /dev/null
58441 @@ -0,0 +1,50 @@
58448 + * http://www.apache.org/licenses/LICENSE-2.0
58493 diff --git a/src/ohos_nweb/include/nweb_find_callback.h b/src/ohos_nweb/include/nweb_find_callback.h
58496 --- /dev/null
58498 @@ -0,0 +1,47 @@
58505 + * http://www.apache.org/licenses/LICENSE-2.0
58531 + * @param activeMatchOrdinal int: the zero-based ordinal of the currently
58546 diff --git a/src/ohos_nweb/include/nweb_full_screen_exit_handler.h b/src/ohos_nweb/include/nweb_ful…
58549 --- /dev/null
58551 @@ -0,0 +1,34 @@
58558 + * http://www.apache.org/licenses/LICENSE-2.0
58586 diff --git a/src/ohos_nweb/include/nweb_geolocation_callback_interface.h b/src/ohos_nweb/include/nw…
58589 --- /dev/null
58591 @@ -0,0 +1,43 @@
58598 + * http://www.apache.org/licenses/LICENSE-2.0
58635 diff --git a/src/ohos_nweb/include/nweb_handler.h b/src/ohos_nweb/include/nweb_handler.h
58638 --- /dev/null
58640 @@ -0,0 +1,471 @@
58647 + * http://www.apache.org/licenses/LICENSE-2.0
58685 + // Render process non-zero exit status
59050 + * @brief called when the page enter the full-screen mode.
59051 + * @param handler to exit full-screen mode.
59057 + * @brief called when the page exit the full-screen mode.
59112 diff --git a/src/ohos_nweb/include/nweb_history_list.h b/src/ohos_nweb/include/nweb_history_list.h
59115 --- /dev/null
59117 @@ -0,0 +1,51 @@
59124 + * http://www.apache.org/licenses/LICENSE-2.0
59170 diff --git a/src/ohos_nweb/include/nweb_hit_testresult.h b/src/ohos_nweb/include/nweb_hit_testresul…
59173 --- /dev/null
59175 @@ -0,0 +1,92 @@
59182 + * http://www.apache.org/licenses/LICENSE-2.0
59268 diff --git a/src/ohos_nweb/include/nweb_javascript_result_callback.h b/src/ohos_nweb/include/nweb_j…
59271 --- /dev/null
59273 @@ -0,0 +1,37 @@
59280 + * http://www.apache.org/licenses/LICENSE-2.0
59312 diff --git a/src/ohos_nweb/include/nweb_js_dialog_result.h b/src/ohos_nweb/include/nweb_js_dialog_r…
59315 --- /dev/null
59317 @@ -0,0 +1,32 @@
59319 +// Use of this source code is governed by a BSD-style license that can be
59351 diff --git a/src/ohos_nweb/include/nweb_js_http_auth_result.h b/src/ohos_nweb/include/nweb_js_http_…
59354 --- /dev/null
59356 @@ -0,0 +1,30 @@
59358 +// Use of this source code is governed by a BSD-style license that can be
59388 diff --git a/src/ohos_nweb/include/nweb_js_ssl_error_result.h b/src/ohos_nweb/include/nweb_js_ssl_e…
59391 --- /dev/null
59393 @@ -0,0 +1,37 @@
59400 + * http://www.apache.org/licenses/LICENSE-2.0
59432 diff --git a/src/ohos_nweb/include/nweb_js_ssl_select_cert_result.h b/src/ohos_nweb/include/nweb_js…
59435 --- /dev/null
59437 @@ -0,0 +1,44 @@
59444 + * http://www.apache.org/licenses/LICENSE-2.0
59482 diff --git a/src/ohos_nweb/include/nweb_key_event.h b/src/ohos_nweb/include/nweb_key_event.h
59485 --- /dev/null
59487 @@ -0,0 +1,29 @@
59489 +// Use of this source code is governed by a BSD-style license that can be
59517 diff --git a/src/ohos_nweb/include/nweb_preference.h b/src/ohos_nweb/include/nweb_preference.h
59520 --- /dev/null
59522 @@ -0,0 +1,521 @@
59529 + * http://www.apache.org/licenses/LICENSE-2.0
59617 + * The default is "UTF-8".
59689 + * Put the sans-serif font family name. The default is "sans-serif".
59703 + * Put the standard font family name. The default is "sans-serif".
59710 + * Put the user-agent string to the nweb. If it is null or empty,
59711 + * webview will use the system default value. Changing the user-agent
59714 + * @param ua user-agent string. The value may be null.
59867 + * Get the default user-agent string to the nweb.
59868 + * An instance of WebView could use a different User-Agent that
59946 + * Get the sans-serif font family name.
59967 + * Get the user-agent string to the nweb.
60044 diff --git a/src/ohos_nweb/include/nweb_touch_handle_state.h b/src/ohos_nweb/include/nweb_touch_han…
60047 --- /dev/null
60049 @@ -0,0 +1,52 @@
60056 + * http://www.apache.org/licenses/LICENSE-2.0
60103 diff --git a/src/ohos_nweb/include/nweb_url_resource_error.h b/src/ohos_nweb/include/nweb_url_resou…
60106 --- /dev/null
60108 @@ -0,0 +1,47 @@
60115 + * http://www.apache.org/licenses/LICENSE-2.0
60157 diff --git a/src/ohos_nweb/include/nweb_url_resource_request.h b/src/ohos_nweb/include/nweb_url_res…
60160 --- /dev/null
60162 @@ -0,0 +1,76 @@
60169 + * http://www.apache.org/licenses/LICENSE-2.0
60230 + * @brief Gets whether the request was a result of a server-side redirect.
60240 diff --git a/src/ohos_nweb/include/nweb_url_resource_response.h b/src/ohos_nweb/include/nweb_url_re…
60243 --- /dev/null
60245 @@ -0,0 +1,235 @@
60252 + * http://www.apache.org/licenses/LICENSE-2.0
60284 + * {"utf-8"}.
60288 + * "OK". Must be non-empty.
60290 + * mapping of header name -> header value.
60342 + * @param encoding encoding { "utf-8" }
60436 + readyCallback_->Continue();
60481 diff --git a/src/ohos_nweb/include/nweb_value.h b/src/ohos_nweb/include/nweb_value.h
60484 --- /dev/null
60486 @@ -0,0 +1,81 @@
60493 + * http://www.apache.org/licenses/LICENSE-2.0
60568 diff --git a/src/ohos_nweb/include/nweb_value_callback.h b/src/ohos_nweb/include/nweb_value_callbac…
60571 --- /dev/null
60573 @@ -0,0 +1,33 @@
60580 + * http://www.apache.org/licenses/LICENSE-2.0
60608 diff --git a/src/ohos_nweb/include/nweb_web_storage.h b/src/ohos_nweb/include/nweb_web_storage.h
60611 --- /dev/null
60613 @@ -0,0 +1,65 @@
60620 + * http://www.apache.org/licenses/LICENSE-2.0
60679 diff --git a/src/ohos_nweb/src/capi/nweb_app_client_extension_callback.h b/src/ohos_nweb/src/capi/n…
60682 --- /dev/null
60684 @@ -0,0 +1,37 @@
60691 + * http://www.apache.org/licenses/LICENSE-2.0
60722 diff --git a/src/ohos_nweb/src/capi/nweb_capi_export.h b/src/ohos_nweb/src/capi/nweb_capi_export.h
60725 --- /dev/null
60727 @@ -0,0 +1,25 @@
60734 + * http://www.apache.org/licenses/LICENSE-2.0
60753 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.cc b/src/ohos_nweb/src/cef…
60756 --- /dev/null
60758 @@ -0,0 +1,53 @@
60765 + * http://www.apache.org/licenses/LICENSE-2.0
60784 + return request_->Origin();
60791 + return request_->ResourceAcessId();
60793 + return -1;
60799 + request_->ReportRequestResult(true);
60801 + request_->ReportRequestResult(false);
60808 + request_->ReportRequestResult(false);
60812 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_access_request_delegate.h b/src/ohos_nweb/src/cef_…
60815 --- /dev/null
60817 @@ -0,0 +1,41 @@
60824 + * http://www.apache.org/licenses/LICENSE-2.0
60859 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_application.cc b/src/ohos_nweb/src/cef_delegate/nw…
60862 --- /dev/null
60864 @@ -0,0 +1,170 @@
60871 + * http://www.apache.org/licenses/LICENSE-2.0
60933 + if (command_line->HasSwitch(::switches::kOhosCustomScheme)) {
60934 + std::string cmdline_scheme = command_line->GetSwitchValue(::switches::kOhosCustomScheme).ToStr…
60951 + registrar->AddCustomScheme(scheme[0], options);
60969 + if (CefCommandLine::GetGlobalCommandLine()->HasSwitch(::switches::kOhosCustomScheme)) {
60970 + command_line->AppendSwitchWithValue(::switches::kOhosCustomScheme, CefCommandLine::GetGlobalCo…
60989 + if (command_line->HasSwitch(switches::kOffScreenFrameRate)) {
60991 + atoi(command_line->GetSwitchValue(switches::kOffScreenFrameRate)
61005 + preference_delegate_->ComputeBrowserSettings(browser_settings);
61007 + if (command_line->HasSwitch(switches::kForTest)) {
61008 + preference_delegate_->PutHasInternetPermission(true);
61009 + preference_delegate_->PutBlockNetwork(false);
61013 + url = command_line->GetSwitchValue(switches::kUrl);
61029 + auto browser = handler_delegate_->GetBrowser();
61030 + if (browser && browser->GetHost()) {
61031 + browser->GetHost()->SetNativeWindow(window_);
61035 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_application.h b/src/ohos_nweb/src/cef_delegate/nwe…
61038 --- /dev/null
61040 @@ -0,0 +1,76 @@
61047 + * http://www.apache.org/licenses/LICENSE-2.0
61067 +const char kOffScreenFrameRate[] = "off-screen-frame-rate";
61068 +const char kForTest[] = "for-test";
61117 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_context_menu_params_impl.cc b/src/ohos_nweb/src/ce…
61120 --- /dev/null
61122 @@ -0,0 +1,296 @@
61129 + * http://www.apache.org/licenses/LICENSE-2.0
61208 + return iter->second;
61229 + return static_cast<CmMt>(iter->second);
61241 + return params_->GetXCoord();
61243 + return -1;
61248 + return params_->GetYCoord();
61250 + return -1;
61255 + return ConvertMenuFlags(params_->GetTypeFlags(), kCmTypeFlagMap);
61262 + return params_->GetLinkUrl().ToString();
61269 + return params_->GetUnfilteredLinkUrl().ToString();
61276 + return params_->GetSourceUrl().ToString();
61283 + return params_->HasImageContents();
61290 + return params_->GetTitleText();
61297 + return params_->GetPageUrl();
61304 + return ConvertContextMenuMediaType(params_->GetMediaType());
61311 + return params_->HasImageContents();
61313 + return params_->IsEditable();
61318 + return ConvertMenuFlags(params_->GetEditStateFlags(), kCmEditStateFlagsMap);
61389 + callback_->Continue(ConvertCommandId(commandId),
61396 + callback_->Cancel();
61408 + callback_->Continue(commandId,
61415 + callback_->Cancel();
61420 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_context_menu_params_impl.h b/src/ohos_nweb/src/cef…
61423 --- /dev/null
61425 @@ -0,0 +1,91 @@
61432 + * http://www.apache.org/licenses/LICENSE-2.0
61518 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_controller_handler_impl.cc b/src/ohos_nweb/src/cef…
61521 --- /dev/null
61523 @@ -0,0 +1,34 @@
61530 + * http://www.apache.org/licenses/LICENSE-2.0
61558 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_controller_handler_impl.h b/src/ohos_nweb/src/cef_…
61561 --- /dev/null
61563 @@ -0,0 +1,39 @@
61570 + * http://www.apache.org/licenses/LICENSE-2.0
61588 …it NWebControllerHandlerImpl(int32_t id, bool isFrist) : id_(id), isFrist_(isFrist), nwebId_(-1) {}
61603 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.cc b/src/ohos_nweb/src/cef…
61606 --- /dev/null
61608 @@ -0,0 +1,454 @@
61615 + * http://www.apache.org/licenses/LICENSE-2.0
61649 + event_->Signal();
61652 + callback_->OnReceiveValue(true);
61670 + event_->Signal();
61673 + callback_->OnReceiveValue(set_success_);
61701 + event_->Signal();
61705 + callback_->OnReceiveValue(false);
61713 + callback_->OnReceiveValue(true);
61744 + callback_->OnReceiveValue(cookie_line_);
61747 + event_->Signal();
61759 + callback_->OnReceiveValue(cookie_line_);
61762 + event_->Signal();
61794 + callback_->OnReceiveValue(true);
61796 + callback_->OnReceiveValue(false);
61800 + event_->Signal();
61830 + return cookie_manager->IsAcceptCookieAllowed();
61839 + cookie_manager->PutAcceptCookieEnabled(accept);
61848 + return cookie_manager->IsThirdPartyCookieAllowed();
61857 + cookie_manager->PutAcceptThirdPartyCookieEnabled(accept);
61866 + return cookie_manager->IsFileURLSchemeCookiesAllowed();
61876 + cookie_manager->PutAcceptFileURLSchemeCookiesEnabled(allow);
61888 + if (!cookie_manager->VisitUrlCookies(CefString(url), false, visitor)) {
61906 + if (!cookie_manager->VisitUrlCookies(CefString(url), false, visitor)) {
61910 + event->Wait();
61911 + return visitor->ReturnCookieLine();
61930 + if (!cookie_manager->SetCookie(CefString(url), cef_cookie,
61956 + if (!cookie_manager->SetCookie(CefString(url), cef_cookie, callback)) {
61960 + completion->Wait();
61961 + return callback->IsSetSuccess() ? NWEB_OK : NWEB_ERR;
61971 + if (!cookie_manager->VisitAllCookies(visitor)) {
61988 + cookie_manager->VisitAllCookies(visitor);
61989 + completion->Wait();
61990 + return visitor->IsExistCookies();
62001 + if (!cookie_manager->FlushStore(complete)) {
62003 + callback->OnReceiveValue(false);
62018 + if (!cookie_manager->FlushStore(complete)) {
62022 + event->Wait();
62034 + if (!cookie_manager->DeleteCookies(CefString(std::string()),
62053 + if (!cookie_manager->DeleteCookies(CefString(std::string()),
62059 + event->Wait();
62064 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_cookie_manager_delegate.h b/src/ohos_nweb/src/cef_…
62067 --- /dev/null
62069 @@ -0,0 +1,60 @@
62076 + * http://www.apache.org/licenses/LICENSE-2.0
62131 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_data_base_delegate.cc b/src/ohos_nweb/src/cef_dele…
62134 --- /dev/null
62136 @@ -0,0 +1,153 @@
62143 + * http://www.apache.org/licenses/LICENSE-2.0
62172 + return data_base->ExistHttpAuthCredentials();
62180 + data_base->DeleteHttpAuthCredentials();
62190 + data_base->SaveHttpAuthCredentials(host, realm,username, password);
62200 + data_base->GetHttpAuthCredentials(host, realm, method_vector);
62215 + return data_base->ExistPermissionByOrigin(origin, type);
62224 + return data_base->GetPermissionResultByOrigin(origin, type, result);
62237 + data_base->SetPermissionByOrigin(origin, type, result);
62251 + data_base->ClearPermissionByOrigin(origin, type);
62261 + data_base->ClearAllPermission(type);
62272 + data_base->GetOriginsByPermission(type, method_vector);
62290 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_data_base_delegate.h b/src/ohos_nweb/src/cef_deleg…
62293 --- /dev/null
62295 @@ -0,0 +1,63 @@
62302 + * http://www.apache.org/licenses/LICENSE-2.0
62359 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_data_resubmission_callback_impl.cc b/src/ohos_nweb…
62362 --- /dev/null
62364 @@ -0,0 +1,33 @@
62371 + * http://www.apache.org/licenses/LICENSE-2.0
62389 + callback_->Continue();
62395 + callback_->Cancel();
62399 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_data_resubmission_callback_impl.h b/src/ohos_nweb/…
62402 --- /dev/null
62404 @@ -0,0 +1,38 @@
62411 + * http://www.apache.org/licenses/LICENSE-2.0
62444 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_delegate.cc b/src/ohos_nweb/src/cef_delegate/nweb_…
62447 --- /dev/null
62449 @@ -0,0 +1,1087 @@
62456 + * http://www.apache.org/licenses/LICENSE-2.0
62493 + callback_->OnReceiveValue(result.ToString());
62511 + callback_->OnReceiveValue(result.ToString());
62529 + callback_->OnReceiveValue(response);
62552 + history_list_->SetCurrentIndex(index);
62554 + history_list_->AddHistoryItem(entry);
62573 + display_manager_adapter_->UnregisterDisplayListener(display_listener_);
62593 + if (!display_manager_adapter_->RegisterDisplayListener(display_listener_)) {
62599 + display_manager_adapter_->UnregisterDisplayListener(display_listener_);
62605 + display_manager_adapter_->UnregisterDisplayListener(display_listener_);
62613 + display_manager_adapter_->GetDefaultDisplay();
62615 + NotifyScreenInfoChanged(display->GetRotation(), display->GetOrientation());
62616 + SetVirtualPixelRatio(display->GetVirtualPixelRatio());
62625 + display_manager_adapter_->UnregisterDisplayListener(display_listener_);
62628 + handler_delegate_->OnDestroy();
62631 + preference_delegate_->OnDestroy();
62636 + GetBrowser()->GetHost()->DestroyAllWebMessagePorts();
62645 + handler_delegate_->RegisterDownLoadListener(download_listener);
62654 + find_delegate_->SetListener(find_listener);
62662 + find_delegate_->FindAllAsync(GetBrowser().get(),
62672 + find_delegate_->ClearMatches(GetBrowser().get());
62680 + find_delegate_->FindNext(GetBrowser().get(), forward);
62691 + handler_delegate_->RegisterWebAppClientExtensionListener(
62701 + handler_delegate_->RegisterNWebHandler(handler);
62711 + render_handler_->SetInputMethodClient(client);
62717 + render_handler_->RegisterRenderCb(render_update_cb);
62723 + render_handler_->Resize(width, height);
62726 + if (browser != nullptr && browser->GetHost() != nullptr) {
62730 + browser->GetHost()->WasResized();
62737 + event_handler_->OnTouchPress(id, x, y);
62743 + event_handler_->OnTouchRelease(id, x, y);
62749 + event_handler_->OnTouchMove(id, x, y);
62755 + event_handler_->OnTouchCancel();
62762 + retVal = event_handler_->SendKeyEvent(keyCode, keyAction);
62769 + event_handler_->SendMouseWheelEvent(x, y, deltaX, deltaY);
62775 + event_handler_->SendMouseEvent(x, y, button, action, count);
62788 + display_manager_adapter_->GetDefaultDisplay();
62793 + double display_ratio = display->GetVirtualPixelRatio();
62798 + int width = display->GetWidth() / display_ratio;
62799 + int height = display->GetHeight() / display_ratio;
62800 + render_handler_->SetScreenInfo(rotation, orientation, width, height,
62803 + if (browser != nullptr && browser->GetHost() != nullptr) {
62804 + browser->GetHost()->NotifyScreenInfoChanged();
62815 + if (browser != nullptr && browser->GetHost() != nullptr) {
62816 + browser->GetHost()->SetVirtualPixelRatio(ratio);
62837 + browser->GetMainFrame()->LoadURL(CefString(url));
62845 + return GetBrowser()->CanGoBack();
62853 + return GetBrowser()->CanGoForward();
62861 + return GetBrowser()->CanGoBackOrForward(num_steps);
62869 + GetBrowser()->GoBack();
62876 + GetBrowser()->GoForward();
62883 + GetBrowser()->GoBackOrForward(step);
62890 + GetBrowser()->DeleteHistory();
62898 + context->ClearCertificateExceptions(nullptr);
62906 + context->ClearClientAuthenticationCache(nullptr);
62913 + GetBrowser()->Reload();
62920 + GetBrowser()->ReloadOriginalUrl();
62927 + return GetBrowser()->GetHost()->GetOriginalUrl();
62939 + return handler_delegate_->GetFavicon(data, width, height, colorType,
62950 + GetBrowser()->GetHost()->PutNetworkAvailable(avaiable);
62957 + GetBrowser()->SetBrowserUserAgentString(user_agent);
62968 + GetBrowser()->GetHost()->StoreWebArchive(base_name, auto_name,
62979 + if (!preference_delegate_->ZoomingfunctionEnabled()) {
62986 + double curFactor = GetBrowser()->GetHost()->GetZoomLevel();
62991 + GetBrowser()->GetHost()->SetZoomLevel(zoomFactor + curFactor);
63000 + if (!preference_delegate_->ZoomingfunctionEnabled()) {
63007 + double curFactor = GetBrowser()->GetHost()->GetZoomLevel();
63012 + GetBrowser()->GetHost()->SetZoomLevel(zoom_in_factor_ + curFactor);
63021 + if (!preference_delegate_->ZoomingfunctionEnabled()) {
63028 + double curFactor = GetBrowser()->GetHost()->GetZoomLevel();
63033 + GetBrowser()->GetHost()->SetZoomLevel(zoom_out_factor_ + curFactor);
63060 + GetBrowser()->StopLoad();
63067 + GetBrowser()->GetMainFrame()->ExecuteJavaScript(
63068 + code, GetBrowser()->GetMainFrame()->GetURL(), 0);
63080 + GetBrowser()->GetHost()->ExecuteJavaScript(code, JsResultCb);
63087 + GetBrowser()->GetHost()->SetBackgroundColor(color);
63098 + GetBrowser()->GetHost()->SetInitialScale(scale);
63109 + GetBrowser()->GetHost()->SetFocus(false);
63113 + GetBrowser()->GetHost()->WasHidden(true);
63126 + GetBrowser()->GetHost()->WasHidden(false);
63131 + GetBrowser()->GetHost()->SetFocus(true);
63161 + return nweb_app_->CreateBrowser();
63181 + return GetBrowser()->GetHost()->Title();
63190 + GetBrowser()->GetHost()->CreateWebMessagePorts(cefPorts);
63215 + GetBrowser()->GetHost()->PostWebMessage(msgCef, cefPorts, uri);
63226 + GetBrowser()->GetHost()->ClosePort(handleCef);
63239 + GetBrowser()->GetHost()->PostPortMessage(handleCef, dataCef);
63251 + GetBrowser()->GetHost()->SetPortMessageCallback(handleCef, JsResultCb);
63257 + return GetBrowser()->GetMainFrame()->GetURL().ToString();
63269 + GetBrowser()->GetHost()->GetHitData(type, extra_data);
63279 + return GetBrowser()->GetHost()->PageLoadProgress();
63286 + return GetBrowser()->GetHost()->Scale();
63303 + const std::string& key = iter->first;
63304 + const std::string& value = iter->second;
63316 + browser->GetMainFrame()->LoadHeaderUrl(CefString(url), CefString(extra));
63330 + GetBrowser()->GetHost()->LoadWithDataAndBaseUrl(baseUrl, data, mimeType,
63343 + GetBrowser()->GetHost()->LoadWithData(data, mimeType, encoding);
63350 + return handler_delegate_->GetBrowser();
63366 + std::vector<std::string> outUrls = handler_delegate_->GetVisitedHistory();
63371 + GetBrowser()->GetHost()->AddVisitedLinks(urls);
63378 + return render_handler_->ContentHeight();
63391 + GetBrowser()->GetHost()->RegisterArkJSfunction(object_name, method_vector);
63402 + GetBrowser()->GetHost()->UnregisterArkJSfunction(object_name, method_vector);
63411 + handler_delegate_->RegisterNWebJavaScriptCallBack(callback);
63420 + GetBrowser()->GetHost()->SetFocus(true);
63429 + GetBrowser()->GetHost()->SetFocus(false);
63440 + locale = "en-US";
63442 + locale = "zh-CN";
63448 + GetBrowser()->GetHost()->UpdateLocale(locale);
63455 + handler_delegate_->SetNWebId(nweb_id_);
63475 + GetBrowser()->GetHost()->DragTargetDragEnter(render_handler_->GetDragData(), event, DRAG_O…
63480 + GetBrowser()->GetHost()->DragTargetDragLeave();
63483 + GetBrowser()->GetHost()->DragTargetDragOver(event, DRAG_OPERATION_MOVE);
63488 + GetBrowser()->GetHost()->DragTargetDrop(event);
63492 + GetBrowser()->GetHost()->DragSourceEndedAt(event.x, event.y, DRAG_OPERATION_MOVE);
63493 + GetBrowser()->GetHost()->DragSourceSystemDragEnded();
63497 + GetBrowser()->GetHost()->DragSourceSystemDragEnded();
63514 + GetBrowser()->GetMainFrame()->GetImages(GetImagesCb);
63523 + GetBrowser()->GetHost()->RemoveCache(include_disk_files);
63533 + GetBrowser()->GetHost()->GetNavigationEntries(visitor, false);
63534 + return visitor->GetHistoryList();
63537 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_delegate.h b/src/ohos_nweb/src/cef_delegate/nweb_d…
63540 --- /dev/null
63542 @@ -0,0 +1,198 @@
63549 + * http://www.apache.org/licenses/LICENSE-2.0
63717 + float zoom_out_factor_ = -2.0;
63741 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_delegate_ohos.cc b/src/ohos_nweb/src/cef_delegate/…
63744 --- /dev/null
63746 @@ -0,0 +1,20 @@
63753 + * http://www.apache.org/licenses/LICENSE-2.0
63767 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_display_listener.cc b/src/ohos_nweb/src/cef_delega…
63770 --- /dev/null
63772 @@ -0,0 +1,50 @@
63779 + * http://www.apache.org/licenses/LICENSE-2.0
63811 + if (id == display_manager_adapter_->GetDefaultDisplayId()) {
63813 + display_manager_adapter_->GetDefaultDisplay();
63816 + nweb->NotifyScreenInfoChanged(display->GetRotation(), display->GetOrientation());
63824 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_display_listener.h b/src/ohos_nweb/src/cef_delegat…
63827 --- /dev/null
63829 @@ -0,0 +1,40 @@
63836 + * http://www.apache.org/licenses/LICENSE-2.0
63871 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_event_handler.cc b/src/ohos_nweb/src/cef_delegate/…
63874 --- /dev/null
63876 @@ -0,0 +1,156 @@
63883 + * http://www.apache.org/licenses/LICENSE-2.0
63929 + if (browser_ && browser_->GetHost()) {
63930 + browser_->GetHost()->SendTouchEvent(touch_pressed);
63942 + if (browser_ && browser_->GetHost()) {
63943 + browser_->GetHost()->SendTouchEvent(touch_move);
63955 + if (browser_ && browser_->GetHost()) {
63956 + browser_->GetHost()->SendTouchEvent(touch_end);
63963 + if (browser_ && browser_->GetHost()) {
63964 + browser_->GetHost()->SendTouchEvent(touch_cancelled);
63985 + if (browser_ && browser_->GetHost()) {
63986 + browser_->GetHost()->SendKeyEvent(keyEvent);
63991 + if (browser_ && browser_->GetHost()) {
63992 + browser_->GetHost()->SendKeyEvent(keyEvent);
64007 + if (browser_ && browser_->GetHost()) {
64008 + browser_->GetHost()->SendMouseWheelEvent(
64022 + if (browser_ && browser_->GetHost()) {
64024 + browser_->GetHost()->SendMouseClickEvent(mouseEvent, buttonType, false, count);
64026 + browser_->GetHost()->SendMouseClickEvent(mouseEvent, buttonType, true, 1);
64028 + browser_->GetHost()->SendMouseMoveEvent(mouseEvent, false);
64033 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_event_handler.h b/src/ohos_nweb/src/cef_delegate/n…
64036 --- /dev/null
64038 @@ -0,0 +1,50 @@
64045 + * http://www.apache.org/licenses/LICENSE-2.0
64089 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_file_selector_params_impl.cc b/src/ohos_nweb/src/c…
64092 --- /dev/null
64094 @@ -0,0 +1,71 @@
64101 + * http://www.apache.org/licenses/LICENSE-2.0
64157 + callback_->Cancel();
64162 + callback_->Continue(0, file_path_);
64167 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_file_selector_params_impl.h b/src/ohos_nweb/src/ce…
64170 --- /dev/null
64172 @@ -0,0 +1,65 @@
64179 + * http://www.apache.org/licenses/LICENSE-2.0
64239 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_find_delegate.cc b/src/ohos_nweb/src/cef_delegate/…
64242 --- /dev/null
64244 @@ -0,0 +1,143 @@
64251 + * http://www.apache.org/licenses/LICENSE-2.0
64269 + last_match_count_(-1),
64270 + last_active_ordinal_(-1) {}
64283 + browser->GetHost()->StopFinding(false);
64292 + browser->GetHost()->Find(search_string, true /* forward*/,
64316 + browser->GetHost()->Find(last_search_string_, forward /* forward*/,
64324 + browser->GetHost()->StopFinding(true);
64328 + last_match_count_ = -1;
64329 + last_active_ordinal_ = -1;
64338 + browser->GetHost()->StopFinding(true);
64345 + last_match_count_ = -1;
64346 + last_active_ordinal_ = -1;
64352 + // Match count or ordinal values set to -1 refer to received replies.
64353 + if (match_count == -1)
64358 + if (active_ordinal == -1)
64365 + if (!finished && active_ordinal == -1)
64368 + // Safeguard in case of errors to prevent reporting -1 to the API listeners.
64369 + if (match_count == -1) {
64374 + if (active_ordinal == -1) {
64379 + // WebView.FindListener active match ordinals are 0-based while WebKit sends
64380 + // 1-based ordinals. Still we can receive 0 ordinal in case of no results.
64381 + active_ordinal = std::max(active_ordinal - 1, 0);
64384 + listener_->OnFindResultReceived(active_ordinal, match_count, finished);
64388 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_find_delegate.h b/src/ohos_nweb/src/cef_delegate/n…
64391 --- /dev/null
64393 @@ -0,0 +1,76 @@
64400 + * http://www.apache.org/licenses/LICENSE-2.0
64420 +// Handles the ohos find-in-page API requests.
64425 + // Called when receiving a new find-in-page update.
64427 + // FindNext are available. The value provided in active_ordinal is 0-based.
64470 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_full_screen_exit_handler_impl.cc b/src/ohos_nweb/s…
64473 --- /dev/null
64475 @@ -0,0 +1,28 @@
64482 + * http://www.apache.org/licenses/LICENSE-2.0
64499 + if (browser_ && browser_->GetHost()) {
64500 + browser_->GetHost()->ExitFullScreen();
64504 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_full_screen_exit_handler_impl.h b/src/ohos_nweb/sr…
64507 --- /dev/null
64509 @@ -0,0 +1,35 @@
64516 + * http://www.apache.org/licenses/LICENSE-2.0
64545 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.cc b/src/ohos_nweb/src/cef_de…
64548 --- /dev/null
64550 @@ -0,0 +1,37 @@
64557 + * http://www.apache.org/licenses/LICENSE-2.0
64579 + browser_->GetGeolocationPermissions()->Enabled(origin);
64581 + browser_->GetGeolocationPermissions()->Disabled(origin);
64584 + browser_->GetPermissionRequestDelegate()->NotifyGeolocationPermission(allow,
64589 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_geolocation_callback.h b/src/ohos_nweb/src/cef_del…
64592 --- /dev/null
64594 @@ -0,0 +1,37 @@
64601 + * http://www.apache.org/licenses/LICENSE-2.0
64632 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.cc b/src/ohos_nweb/src/cef_delega…
64635 --- /dev/null
64637 @@ -0,0 +1,1641 @@
64644 + * http://www.apache.org/licenses/LICENSE-2.0
64752 + return -1;
64765 + return -1;
64772 + map.emplace(iter->first.ToString(), iter->second.ToString());
64822 + if (iconInfo->image_url)
64823 + delete[] iconInfo->image_url;
64865 + main_browser_->GetHost()->CloseBrowser(true);
64869 + event_handler_->OnDestroy();
64889 + render_handler_->RegisterNWebHandler(handler);
64921 + (*it)->GetHost()->CloseBrowser(force_close);
64982 + const std::string& messageName = message->GetName();
64985 + CefRefPtr<CefListValue> pushMsgArgs = message->GetArgumentList();
64986 + CefString url = pushMsgArgs->GetString(0);
64987 + nweb_handler_->OnRouterPush(url.ToString());
64992 + CefRefPtr<CefListValue> postMsgArgs = message->GetArgumentList();
64993 + CefString postMsg = postMsgArgs->GetString(0);
64994 + nweb_handler_->OnMessage(postMsg.ToString());
65018 + event_handler_->SetBrowser(browser);
65020 + } else if (browser->IsPopup()) {
65026 + preference_delegate_->SetBrowser(main_browser_);
65036 + nweb_handler_->OnWindowExitByJS();
65063 + if ((*bit)->IsSame(browser)) {
65077 + if (!preference_delegate_.get() || !preference_delegate_->IsMultiWindowAccess()) {
65089 + nweb_handler_->OnWindowNewByJS(target_url, true, user_gesture, handler);
65096 + nweb_handler_->OnWindowNewByJS(target_url, false, user_gesture, handler);
65123 + if (preference_delegate_->IsMultiWindowAccess()) {
65132 + nweb_handler_->OnWindowNewByJS(target_url, true, user_gesture, handler);
65133 + NWebImpl* nweb = NWebImpl::FromID(handler->GetNWebHandlerId());
65135 + client = nweb->GetCefClient();
65147 + nweb_handler_->OnWindowNewByJS(target_url, false, user_gesture, handler);
65156 + preference_delegate_->WebPreferencesChanged();
65157 + main_browser_->GetMainFrame()->LoadURL(target_url);
65174 + if (frame == nullptr || !frame->IsMain()) {
65177 + if (browser != nullptr && browser->GetHost() != nullptr) {
65178 + browser->GetHost()->SetFocus(true);
65181 + nweb_handler_->OnPageLoadBegin(frame->GetURL().ToString());
65189 + if (frame == nullptr || !frame->IsMain()) {
65195 + nweb_handler_->OnPageLoadEnd(http_status_code, frame->GetURL().ToString());
65202 + "https://www.iana.org/assignments/http-status-codes/"
65203 + "http-status-codes.xml";
65224 + nweb_handler_->OnPageVisible(url);
65234 + nweb_handler_->OnDataResubmission(handler);
65258 + nweb_handler_->OnPageLoadError(error_code, error_text.ToString(),
65268 + frame->LoadURL(GetDataURI(ss.str(), "text/html"));
65288 + request->GetHeaderMap(cef_request_headers);
65293 + request->GetMethod().ToString(), request_headers,
65294 + request->GetURL().ToString(), has_user_gesture, is_main_frame);
65298 + nweb_handler_->OnResourceLoadError(web_request, error);
65318 + request->GetHeaderMap(cef_request_headers);
65323 + request->GetMethod().ToString(), request_headers,
65324 + request->GetURL().ToString(), has_user_gesture, is_main_frame);
65328 + response->GetMimeType(), response->GetCharset(),
65329 + response->GetStatus(), response->GetStatusText(), request_headers,
65331 + nweb_handler_->OnHttpError(web_request, web_response);
65338 + ReportPageLoadErrorInfo(nweb_id_, error_type, response->GetStatus(),
65339 + std::string(response->GetStatusText()));
65357 + nweb_handler_->OnRefreshAccessedHistory(url.ToString(), isReload);
65375 + return nweb_handler_->OnHandleInterceptUrlLoading(
65376 + request->GetURL().ToString());
65394 + return nweb_handler_->OnSslErrorRequestByJS(js_result, error);
65424 + return nweb_handler_->OnSslSelectCertRequestByJS(
65488 + nweb_handler_->OnRenderExited(reason);
65511 + return nweb_handler_->OnHttpAuthRequestByJS(js_result, host, realm);
65525 + nweb_handler_->OnFullScreenEnter(handler);
65527 + nweb_handler_->OnFullScreenExit();
65541 + if (download_item->IsValid() == false) {
65545 + if (download_item->IsCanceled() == true) {
65550 + callback->Continue("", false);
65553 + download_listener_->OnDownloadStart(
65554 + download_item->GetURL().ToString(),
65555 + browser->GetHost()->DefaultUserAgent(),
65556 + download_item->GetContentDisposition().ToString(),
65557 + download_item->GetMimeType().ToString(),
65558 + download_item->GetTotalBytes());
65573 + if (action == -1) {
65577 + if (keyCode == -1) {
65581 + nwebEvent->keyCode_ = keyCode;
65582 + nwebEvent->action_ = action;
65583 + return nweb_handler_->OnPreKeyEvent(nwebEvent);
65595 + if (action == -1) {
65599 + if (keyCode == -1) {
65603 + nwebEvent->keyCode_ = keyCode;
65604 + nwebEvent->action_ = action;
65605 + return nweb_handler_->OnUnProcessedKeyEvent(nwebEvent);
65620 + nweb_handler_->OnResource(request->GetURL().ToString());
65635 + request->GetHeaderMap(cef_request_headers);
65640 + request->GetMethod().ToString(), request_headers,
65641 + request->GetURL().ToString(), false, frame->IsMain());
65644 + response = nweb_handler_->OnHandleInterceptRequest(NWeb_request);
65659 + nweb_handler_->OnPageTitle(title.ToString());
65670 + nweb_handler_->OnLoadingProgress(new_progress);
65675 + web_app_client_extension_listener_->OnLoadStarted != nullptr &&
65678 + web_app_client_extension_listener_->OnLoadStarted(
65679 + browser != nullptr ? browser->ShouldShowLoadingUI() : false,
65680 + web_app_client_extension_listener_->NWebID);
65700 + nweb_handler_->OnPageIcon(data, width, height,
65749 + web_app_client_extension_listener_->OnReceivedFaviconUrl == nullptr) {
65757 + web_app_client_extension_listener_->OnReceivedFaviconUrl(
65758 + iconInfo, web_app_client_extension_listener_->NWebID);
65766 + nweb_handler_->OnDesktopIconUrl(icon_url.ToString(), precomposed);
65781 + return nweb_handler_->OnConsoleLog(console_message);
65792 + nweb_handler_->OnScaleChanged(old_page_scale_factor, new_page_scale_factor);
65801 + nweb_handler_->OnFocus();
65814 + nweb_handler_->OnGeolocationShow(origin, callback_);
65821 + nweb_handler_->OnGeolocationHide();
65831 + nweb_handler_->OnPermissionRequest(access_request);
65841 + nweb_handler_->OnPermissionRequestCanceled(access_request);
65863 + return nweb_handler_->OnAlertDialogByJS(origin_url, message_text,
65866 + return nweb_handler_->OnConfirmDialogByJS(origin_url, message_text,
65869 + return nweb_handler_->OnPromptDialogByJS(origin_url, message_text,
65887 + return nweb_handler_->OnBeforeUnloadByJS(std::string(), message_text,
65933 + return nweb_handler_->OnFileSelectorShow(file_path_callback, param);
65947 + if (image != nullptr && image->GetWidth() > 0 && image->GetHeight() > 0) {
65951 + image->GetAsBitmap(1, CEF_COLOR_TYPE_BGRA_8888, CEF_ALPHA_TYPE_OPAQUE,
65953 + size_t bitMapSize = bitMap->GetSize();
65959 + bitMap->GetData((void*)data, bitMapSize, 0);
65973 + if (imgRecord->SetImgData(imgData)) {
65990 + if (image != nullptr && image->GetWidth() > 0 && image->GetHeight() > 0) {
65995 + browser->GetHost()->GetImageFromCache(image_cache_src_url_);
66001 + if (image != nullptr && image->GetWidth() > 0 && image->GetHeight() > 0) {
66021 + image_cache_src_url_ = params->GetSourceUrl();
66022 + if (nweb_handler_->RunContextMenu(nweb_param, nweb_callback)) {
66026 + nweb_callback->Cancel();
66038 + (browser->GetHost() != nullptr)) {
66039 + image_cache_src_url_ = params->GetSourceUrl();
66040 + browser->GetHost()->GetImageForContextNode();
66049 + nweb_handler_->OnContextMenuDismissed();
66069 + auto insert_touch_handle = render_handler_->GetTouchHandleState(
66071 + auto begin_touch_handle = render_handler_->GetTouchHandleState(
66073 + auto end_touch_handle = render_handler_->GetTouchHandleState(
66075 + nweb_param->SetTouchHandleState(
66078 + nweb_param->SetTouchHandleState(
66081 + nweb_param->SetTouchHandleState(
66084 + return nweb_handler_->RunQuickMenu(nweb_param, nweb_callback);
66099 + nweb_handler_->OnQuickMenuDismissed();
66113 + find_delegate_->HandleFindReply(identifier, count, activeMatchOrdinal,
66126 + ->IsAcceptCookieAllowed();
66134 + ->IsAcceptCookieAllowed();
66140 + return nweb_handler_->VisitedUrlHistory();
66151 + value->SetInt(argument->GetInt());
66155 + value->SetDouble(argument->GetDouble());
66160 + value->SetBoolean(argument->GetBool());
66164 + value->SetString(argument->GetString().ToString());
66178 + CefRefPtr<CefValue> argument = args->GetValue(i);
66179 + switch (argument->GetType()) {
66227 + NWebValue::Type type = value->GetType();
66230 + result->SetInt(0, value->GetInt());
66233 + result->SetDouble(0, value->GetDouble());
66237 + result->SetBool(0, value->GetBoolean());
66240 + result->SetString(0, value->GetString());
66260 + ParseCefValueTONWebValue(args, args->GetSize());
66266 + nweb_javascript_callback_->GetJavaScriptResult(value_vector, method,
66270 + return ark_result->error_;
66279 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_handler_delegate.h b/src/ohos_nweb/src/cef_delegat…
66282 --- /dev/null
66284 @@ -0,0 +1,459 @@
66291 + * http://www.apache.org/licenses/LICENSE-2.0
66744 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_history_list_impl.cc b/src/ohos_nweb/src/cef_deleg…
66747 --- /dev/null
66749 @@ -0,0 +1,109 @@
66756 + * http://www.apache.org/licenses/LICENSE-2.0
66803 + return (entry_ != nullptr && entry_->IsValid())
66804 + ? entry_->GetOriginalURL().ToString()
66809 + return (entry_ != nullptr && entry_->IsValid())
66810 + ? entry_->GetTitle().ToString()
66815 + return (entry_ != nullptr && entry_->IsValid()) ? entry_->GetURL().ToString()
66824 + if (!entry_ || !entry_->IsValid()) {
66828 + bool result = entry_->GetFavicon(data, color, alpha, width, height);
66860 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_history_list_impl.h b/src/ohos_nweb/src/cef_delega…
66863 --- /dev/null
66865 @@ -0,0 +1,54 @@
66872 + * http://www.apache.org/licenses/LICENSE-2.0
66915 + int32_t current_index_ = -1;
66921 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_input_delegate.cc b/src/ohos_nweb/src/cef_delegate…
66924 --- /dev/null
66926 @@ -0,0 +1,474 @@
66933 + * http://www.apache.org/licenses/LICENSE-2.0
67327 + map = itKeyValue->second;
67334 + return -1;
67338 + return -1;
67340 + return item->second;
67346 + return -1;
67350 + return -1;
67352 + return item->first;
67401 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_input_delegate.h b/src/ohos_nweb/src/cef_delegate/…
67404 --- /dev/null
67406 @@ -0,0 +1,58 @@
67413 + * http://www.apache.org/licenses/LICENSE-2.0
67460 + float mouseWheelRatio_ = -5.0;
67466 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_inputevent_handler.h b/src/ohos_nweb/src/cef_deleg…
67469 --- /dev/null
67471 @@ -0,0 +1,56 @@
67478 + * http://www.apache.org/licenses/LICENSE-2.0
67529 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_inputmethod_client.h b/src/ohos_nweb/src/cef_deleg…
67532 --- /dev/null
67534 @@ -0,0 +1,35 @@
67541 + * http://www.apache.org/licenses/LICENSE-2.0
67571 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.cc b/src/ohos_nweb/src/cef_d…
67574 --- /dev/null
67576 @@ -0,0 +1,42 @@
67583 + * http://www.apache.org/licenses/LICENSE-2.0
67601 + callback_->Continue(true, CefString(std::string()));
67608 + callback_->Continue(true, CefString(message));
67615 + callback_->Continue(false, CefString(std::string()));
67620 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_dialog_result_impl.h b/src/ohos_nweb/src/cef_de…
67623 --- /dev/null
67625 @@ -0,0 +1,37 @@
67632 + * http://www.apache.org/licenses/LICENSE-2.0
67664 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_http_auth_result_impl.cc b/src/ohos_nweb/src/ce…
67667 --- /dev/null
67669 @@ -0,0 +1,42 @@
67676 + * http://www.apache.org/licenses/LICENSE-2.0
67694 + callback_->Continue(CefString(userName), CefString(pwd));
67702 + return callback_->IsHttpAuthInfoSaved();
67709 + callback_->Cancel();
67713 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_http_auth_result_impl.h b/src/ohos_nweb/src/cef…
67716 --- /dev/null
67718 @@ -0,0 +1,36 @@
67725 + * http://www.apache.org/licenses/LICENSE-2.0
67756 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_ssl_error_result_impl.cc b/src/ohos_nweb/src/ce…
67759 --- /dev/null
67761 @@ -0,0 +1,33 @@
67768 + * http://www.apache.org/licenses/LICENSE-2.0
67786 + return callback_->Continue();
67792 + return callback_->Cancel();
67796 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_ssl_error_result_impl.h b/src/ohos_nweb/src/cef…
67799 --- /dev/null
67801 @@ -0,0 +1,35 @@
67808 + * http://www.apache.org/licenses/LICENSE-2.0
67838 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_ssl_select_cert_result_impl.cc b/src/ohos_nweb/…
67841 --- /dev/null
67843 @@ -0,0 +1,41 @@
67850 + * http://www.apache.org/licenses/LICENSE-2.0
67870 + return callback_->Select(CefString(private_key_file), CefString(cert_chain_file));
67876 + return callback_->Cancel();
67882 + return callback_->Ignore();
67886 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_js_ssl_select_cert_result_impl.h b/src/ohos_nweb/s…
67889 --- /dev/null
67891 @@ -0,0 +1,42 @@
67898 + * http://www.apache.org/licenses/LICENSE-2.0
67935 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.cc b/src/ohos_nweb/src/cef_del…
67938 --- /dev/null
67940 @@ -0,0 +1,533 @@
67947 + * http://www.apache.org/licenses/LICENSE-2.0
68007 + this->browser_ = browser;
68018 + browser_->GetHost()->SetWebPreferences(browser_settings);
68092 + if (command_line->HasSwitch(::switches::kForBrowser)) {
68234 + browser_->GetHost()->PutUserAgent(ua);
68267 + LOG(ERROR) << "Put network-blocked false failed, because app missing "
68285 + browser_->GetHost()->SetWebDebuggingAccess(flag);
68343 + std::string ua = browser_->GetHost()->DefaultUserAgent();
68459 + return browser_->GetHost()->GetWebDebuggingAccess();
68474 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_preference_delegate.h b/src/ohos_nweb/src/cef_dele…
68477 --- /dev/null
68479 @@ -0,0 +1,155 @@
68486 + * http://www.apache.org/licenses/LICENSE-2.0
68596 + std::string standard_font_family_name_{"sans-serif"};
68599 + std::string sans_serif_font_family_name_{"sans-serif"};
68606 + std::string default_encoding_{"UTF-8"};
68635 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_render_handler.cc b/src/ohos_nweb/src/cef_delegate…
68638 --- /dev/null
68640 @@ -0,0 +1,357 @@
68647 + * http://www.apache.org/licenses/LICENSE-2.0
68832 + handler->OnScroll(x, y);
68851 + inputmethod_client_->OnTextSelectionChanged(browser, selected_text,
68863 + inputmethod_client_->Attach(browser, show_keyboard);
68865 + inputmethod_client_->HideTextInput();
68928 + handler->OnTouchSelectionChanged(
68941 + if (!drag_data && !drag_data->HasImage()) {
68946 + auto image = drag_data->GetImage();
68954 + auto bitmap = image->GetAsBitmap(1, CEF_COLOR_TYPE_BGRA_8888, CEF_ALPHA_TYPE_OPAQUE, width, heig…
68960 + size_t data_size = bitmap->GetSize();
68966 + size_t read_size = bitmap->GetData(buffer, data_size, 0);
68986 + bool isNeedDrag = handler->OnDragAndDropData(buffer, read_size, opt);
68998 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_render_handler.h b/src/ohos_nweb/src/cef_delegate/…
69001 --- /dev/null
69003 @@ -0,0 +1,119 @@
69010 + * http://www.apache.org/licenses/LICENSE-2.0
69110 + double display_ratio_ = -1.0;
69123 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.cc b/src/ohos_nweb/src/cef_delega…
69126 --- /dev/null
69128 @@ -0,0 +1,177 @@
69135 + * http://www.apache.org/licenses/LICENSE-2.0
69157 + callback_->Continue();
69163 + callback_->Cancel();
69173 + const std::string& key = iter->first;
69174 + const std::string& value = iter->second;
69195 + if (response_->ResponseDataStatus()) {
69198 + data_ = response_->ResponseData();
69204 + response_->PutResponseReadyCallback(nwebCb);
69214 + data_ = response_->ResponseData();
69218 + std::min(bytes_to_read, static_cast<int>(data_.length() - offset_));
69232 + int fd = response_->ResponseFileHandle();
69260 + bytes_read = -1;
69264 + if (response_->ResponseIsFileHandle()) {
69276 + response->SetMimeType(response_->ResponseMimeType());
69277 + response->SetStatus(response_->ResponseStatusCode());
69278 + response->SetStatusText(response_->ResponseStatus());
69279 + response->SetCharset(response_->ResponseEncoding());
69282 + response_->ResponseHeaders();
69284 + response->SetHeaderMap(cef_request_headers);
69286 + if (response_->ResponseIsFileHandle()) {
69287 + response_length = -1;
69298 + int fd = response_->ResponseFileHandle();
69306 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_resource_handler.h b/src/ohos_nweb/src/cef_delegat…
69309 --- /dev/null
69311 @@ -0,0 +1,65 @@
69318 + * http://www.apache.org/licenses/LICENSE-2.0
69377 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_touch_handle_state_impl.cc b/src/ohos_nweb/src/cef…
69380 --- /dev/null
69382 @@ -0,0 +1,59 @@
69389 + * http://www.apache.org/licenses/LICENSE-2.0
69443 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_touch_handle_state_impl.h b/src/ohos_nweb/src/cef_…
69446 --- /dev/null
69448 @@ -0,0 +1,37 @@
69455 + * http://www.apache.org/licenses/LICENSE-2.0
69487 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_web_storage_delegate.cc b/src/ohos_nweb/src/cef_de…
69490 --- /dev/null
69492 @@ -0,0 +1,241 @@
69499 + * http://www.apache.org/licenses/LICENSE-2.0
69531 + event_->Signal();
69534 + callback_->OnReceiveValue(true);
69558 + event_->Signal();
69561 + callback_->OnReceiveValue(results_);
69603 + : event_(event), callback_(callback), nums_(-1) {}
69607 + event_->Signal();
69610 + callback_->OnReceiveValue(nums_);
69639 + web_storage->DeleteAllData();
69651 + web_storage->DeleteOrigin(origin);
69660 + web_storage->GetOrigins(new GetOriginsCallback(nullptr, callback));
69673 + web_storage->GetOrigins(callback);
69674 + completion->Wait();
69675 + origins = callback->GetWebStorageOrigin();
69684 + web_storage->GetOriginQuota(CefString(origin), new GetOriginUsageOrQuotaCallback(nullptr, callba…
69701 + web_storage->GetOriginQuota(CefString(origin), callback);
69702 + completion->Wait();
69703 + return callback->GetUsageOrQuota();
69712 + web_storage->GetOriginUsage(CefString(origin), new GetOriginUsageOrQuotaCallback(nullptr, callba…
69729 + web_storage->GetOriginUsage(CefString(origin), callback);
69730 + completion->Wait();
69731 + return callback->GetUsageOrQuota();
69734 diff --git a/src/ohos_nweb/src/cef_delegate/nweb_web_storage_delegate.h b/src/ohos_nweb/src/cef_del…
69737 --- /dev/null
69739 @@ -0,0 +1,46 @@
69746 + * http://www.apache.org/licenses/LICENSE-2.0
69786 diff --git a/src/ohos_nweb/src/nweb_cookie_manager_delegate_interface.h b/src/ohos_nweb/src/nweb_co…
69789 --- /dev/null
69791 @@ -0,0 +1,53 @@
69798 + * http://www.apache.org/licenses/LICENSE-2.0
69846 diff --git a/src/ohos_nweb/src/nweb_cookie_manager_impl.cc b/src/ohos_nweb/src/nweb_cookie_manager_…
69849 --- /dev/null
69851 @@ -0,0 +1,154 @@
69858 + * http://www.apache.org/licenses/LICENSE-2.0
69893 + return delegate_->IsAcceptCookieAllowed();
69900 + delegate_->PutAcceptCookieEnabled(accept);
69906 + return delegate_->IsThirdPartyCookieAllowed();
69913 + delegate_->PutAcceptThirdPartyCookieEnabled(accept);
69919 + return delegate_->IsFileURLSchemeCookiesAllowed();
69926 + delegate_->PutAcceptFileURLSchemeCookiesEnabled(allow);
69935 + delegate_->SetCookie(url, value, callback);
69943 + return delegate_->SetCookie(url, value);
69952 + delegate_->ReturnCookie(url, callback);
69959 + return delegate_->ReturnCookie(url);
69967 + delegate_->ExistCookies(callback);
69973 + return delegate_->ExistCookies();
69981 + delegate_->Store(callback);
69987 + return delegate_->Store();
69995 + delegate_->DeleteSessionCookies(callback);
70002 + delegate_->DeleteCookieEntirely(callback);
70007 diff --git a/src/ohos_nweb/src/nweb_cookie_manager_impl.h b/src/ohos_nweb/src/nweb_cookie_manager_i…
70010 --- /dev/null
70012 @@ -0,0 +1,59 @@
70019 + * http://www.apache.org/licenses/LICENSE-2.0
70073 diff --git a/src/ohos_nweb/src/nweb_data_base_impl.cc b/src/ohos_nweb/src/nweb_data_base_impl.cc
70076 --- /dev/null
70078 @@ -0,0 +1,124 @@
70085 + * http://www.apache.org/licenses/LICENSE-2.0
70115 + return delegate_->ExistHttpAuthCredentials();
70122 + delegate_->DeleteHttpAuthCredentials();
70129 + return delegate_->SaveHttpAuthCredentials(host, realm, username, password);
70136 + return delegate_->GetHttpAuthCredentials(host, realm);
70144 + return delegate_->ExistPermissionByOrigin(origin, type);
70152 + return delegate_->GetPermissionResultByOrigin(origin, type, result);
70160 + return delegate_->SetPermissionByOrigin(origin, type, result);
70168 + return delegate_->ClearPermissionByOrigin(origin, type);
70176 + delegate_->ClearAllPermission(type);
70183 + return delegate_->GetOriginsByPermission(type);
70190 + return delegate_->ExistFormData();
70197 + return delegate_->ClearFormData();
70203 diff --git a/src/ohos_nweb/src/nweb_data_base_impl.h b/src/ohos_nweb/src/nweb_data_base_impl.h
70206 --- /dev/null
70208 @@ -0,0 +1,62 @@
70215 + * http://www.apache.org/licenses/LICENSE-2.0
70271 diff --git a/src/ohos_nweb/src/nweb_delegate_adapter.cc b/src/ohos_nweb/src/nweb_delegate_adapter.cc
70274 --- /dev/null
70276 @@ -0,0 +1,44 @@
70283 + * http://www.apache.org/licenses/LICENSE-2.0
70309 + if (delegate == nullptr || !delegate->Init(window)) {
70321 diff --git a/src/ohos_nweb/src/nweb_delegate_adapter.h b/src/ohos_nweb/src/nweb_delegate_adapter.h
70324 --- /dev/null
70326 @@ -0,0 +1,33 @@
70333 + * http://www.apache.org/licenses/LICENSE-2.0
70360 diff --git a/src/ohos_nweb/src/nweb_delegate_interface.h b/src/ohos_nweb/src/nweb_delegate_interfac…
70363 --- /dev/null
70365 @@ -0,0 +1,167 @@
70372 + * http://www.apache.org/licenses/LICENSE-2.0
70533 diff --git a/src/ohos_nweb/src/nweb_hilog.h b/src/ohos_nweb/src/nweb_hilog.h
70536 --- /dev/null
70538 @@ -0,0 +1,53 @@
70545 + * http://www.apache.org/licenses/LICENSE-2.0
70592 diff --git a/src/ohos_nweb/src/nweb_impl.cc b/src/ohos_nweb/src/nweb_impl.cc
70595 --- /dev/null
70597 @@ -0,0 +1,826 @@
70604 + * http://www.apache.org/licenses/LICENSE-2.0
70661 + if (!nweb->Init(create_info)) {
70690 + auto it = map->find(nweb_id);
70691 + return it == map->end() ? nullptr : it->second;
70696 + args->clear();
70698 + args->push_back(arg);
70722 + output_handler_->SetNWebId(nweb_id_);
70745 + bool is_close_all = (--g_nweb_count) == 0 ? true : false;
70747 + nweb_delegate_->OnDestroy(is_close_all);
70752 + input_handler_->OnDestroy();
70764 + output_handler_->SetDumpPath(init_args.dump_path);
70767 + output_handler_->SetFrameInfoDump(init_args.frame_info_dump);
70787 + argv[i] = it->c_str();
70791 + reinterpret_cast<void*>(output_handler_->GetNativeWindowFromSurface(
70806 + auto render_update_cb = [output_handler_weak](const char* buffer) -> void {
70808 + output_handler_weak.lock()->OnRenderUpdate(buffer);
70813 + output_handler_->GetWindowInfo(width, height);
70814 + nweb_delegate_->Resize(width, height);
70815 + nweb_delegate_->RegisterRenderCb(render_update_cb);
70818 + nweb_delegate_->SetInputMethodClient(inputmethod_handler_);
70821 + nweb_delegate_->SetNWebId(nweb_id_);
70825 + return nweb_delegate_->IsReady();
70837 + web_engine_args_.emplace_back("--in-process-gpu");
70838 + web_engine_args_.emplace_back("--disable-dev-shm-usage");
70840 + web_engine_args_.emplace_back("--disable-gpu");
70843 + web_engine_args_.emplace_back("--off-screen-frame-rate=70");
70845 + web_engine_args_.emplace_back("--off-screen-frame-rate=65");
70847 + web_engine_args_.emplace_back("--no-unsandboxed-zygote");
70848 + web_engine_args_.emplace_back("--no-zygote");
70849 + web_engine_args_.emplace_back("--enable-features=UseOzonePlatform");
70850 + web_engine_args_.emplace_back("-ozone-platform=headless");
70851 + web_engine_args_.emplace_back("--no-sandbox");
70852 + web_engine_args_.emplace_back("--use-mobile-user-agent");
70853 + web_engine_args_.emplace_back("--enable-gpu-rasterization");
70854 + web_engine_args_.emplace_back("--enable-viewport");
70856 + "--browser-subprocess-path=/system/bin/web_render");
70857 + web_engine_args_.emplace_back("--zygote-cmd-prefix=/system/bin/web_render");
70858 + web_engine_args_.emplace_back("--remote-debugging-port=9222");
70859 + web_engine_args_.emplace_back("--enable-touch-drag-drop");
70871 + web_engine_args_.emplace_back("--enable-multi-renderer-process");
70877 + nweb_delegate_->RegisterDownLoadListener(downloadListener);
70883 + nweb_delegate_->RegisterWebAppClientExtensionListener(
70889 + nweb_delegate_->RegisterNWebHandler(client);
70890 + client->SetNWeb(shared_from_this());
70904 + nweb_delegate_->Resize(width, height);
70905 + output_handler_->Resize(width, height);
70913 + input_handler_->OnTouchPress(id, x, y);
70921 + input_handler_->OnTouchRelease(id, x, y);
70929 + input_handler_->OnTouchMove(id, x, y);
70936 + input_handler_->OnTouchCancel();
70943 + input_handler_->OnNavigateBack();
70950 + return input_handler_->SendKeyEvent(keyCode, keyAction);
70957 + input_handler_->SendMouseWheelEvent(x, y, deltaX, deltaY);
70964 + input_handler_->SendMouseEvent(x, y, button, action, count);
70972 + if (!output_handler_->IsSizeValid()) {
70977 + int result = nweb_delegate_->Load(url);
70978 + output_handler_->StartRenderOutput();
70986 + return nweb_delegate_->IsNavigatebackwardAllowed();
70993 + return nweb_delegate_->IsNavigateForwardAllowed();
71000 + return nweb_delegate_->CanNavigateBackOrForward(numSteps);
71007 + nweb_delegate_->NavigateBack();
71014 + nweb_delegate_->NavigateForward();
71021 + nweb_delegate_->NavigateBackOrForward(step);
71028 + nweb_delegate_->DeleteNavigateHistory();
71036 + nweb_delegate_->ClearSslCache();
71044 + nweb_delegate_->ClearClientAuthenticationCache();
71051 + nweb_delegate_->Reload();
71058 + return nweb_delegate_->Zoom(zoomFactor);
71065 + return nweb_delegate_->ZoomIn();
71072 + return nweb_delegate_->ZoomOut();
71079 + nweb_delegate_->Stop();
71086 + nweb_delegate_->ExecuteJavaScript(code);
71093 + nweb_delegate_->PutBackgroundColor(color);
71100 + nweb_delegate_->InitialScale(scale);
71107 + nweb_delegate_->OnPause();
71111 + inputmethod_handler_->HideTextInput();
71118 + nweb_delegate_->OnContinue();
71125 + return nweb_delegate_->GetPreference();
71132 + return nweb_delegate_->Title();
71141 + nweb_delegate_->CreateWebMessagePorts(ports);
71149 + nweb_delegate_->PostWebMessage(message, ports, targetUri);
71157 + nweb_delegate_->ClosePort(portHandle);
71165 + nweb_delegate_->PostPortMessage(portHandle, data);
71174 + nweb_delegate_->SetPortMessageCallback(portHandle, callback);
71182 + return nweb_delegate_->GetHitTestResult();
71189 + return nweb_delegate_->PageLoadProgress();
71196 + return nweb_delegate_->ContentHeight();
71203 + return nweb_delegate_->Scale();
71211 + return nweb_delegate_->Load(url, additionalHttpHeaders);
71222 + return nweb_delegate_->LoadWithDataAndBaseUrl(baseUrl, data, mimeType,
71232 + return nweb_delegate_->LoadWithData(data, mimeType, encoding);
71241 + return nweb_delegate_->RegisterArkJSfunction(object_name, method_list);
71250 + return nweb_delegate_->UnregisterArkJSfunction(object_name, method_list);
71258 + nweb_delegate_->RegisterNWebJavaScriptCallBack(callback);
71267 + nweb_delegate_->ExecuteJavaScript(code, callback);
71274 + nweb_delegate_->OnFocus();
71281 + nweb_delegate_->OnBlur();
71285 + inputmethod_handler_->HideTextInput();
71293 + nweb_delegate_->ReloadOriginalUrl();
71300 + nweb_delegate_->SetBrowserUserAgentString(user_agent);
71307 + nweb_delegate_->RegisterFindListener(findListener);
71314 + nweb_delegate_->FindAllAsync(search_string);
71321 + nweb_delegate_->ClearMatches();
71328 + nweb_delegate_->FindNext(forward);
71339 + nweb_delegate_->StoreWebArchive(base_name, auto_name, callback);
71351 + nweb_delegate_->SendDragEvent(event);
71358 + return nweb_delegate_->GetUrl();
71365 + nweb_delegate_->UpdateLocale(language, region);
71373 + return nweb_delegate_->GetOriginalUrl();
71382 + return nweb_delegate_->GetFavicon(data, width, height, colorType, alphaType);
71390 + nweb_delegate_->PutNetworkAvailable(available);
71399 + nweb_delegate_->GetImages(callback);
71408 + nweb_delegate_->RemoveCache(include_disk_files);
71416 + return nweb_delegate_->GetHistoryList();
71421 + auto it = map->find(nweb_id);
71422 + return it == map->end() ? nullptr : it->second;
71424 diff --git a/src/ohos_nweb/src/nweb_impl.h b/src/ohos_nweb/src/nweb_impl.h
71427 --- /dev/null
71429 @@ -0,0 +1,165 @@
71436 + * http://www.apache.org/licenses/LICENSE-2.0
71575 + return nweb_delegate_->GetCefClient();
71595 diff --git a/src/ohos_nweb/src/nweb_input_handler.cc b/src/ohos_nweb/src/nweb_input_handler.cc
71598 --- /dev/null
71600 @@ -0,0 +1,141 @@
71607 + * http://www.apache.org/licenses/LICENSE-2.0
71628 + input_handler->Init();
71648 + nweb_delegate_->OnTouchPress(id, x, y);
71664 + nweb_delegate_->OnTouchRelease(id, x, y);
71674 + nweb_delegate_->OnTouchMove(id, x, y);
71683 + nweb_delegate_->OnTouchCancel();
71691 + if (nweb_delegate_->IsNavigatebackwardAllowed()) {
71693 + nweb_delegate_->NavigateBack();
71701 + return nweb_delegate_->SendKeyEvent(keyCode, keyAction);
71708 + nweb_delegate_->SendMouseWheelEvent(x, y, deltaX, deltaY);
71715 + nweb_delegate_->SendMouseEvent(x, y, button, action, count);
71726 + if (start_x < kEdgeWidth && (end_x - start_x) > kTriggerDistance) {
71728 + if (nweb_delegate_->IsNavigatebackwardAllowed()) {
71730 + nweb_delegate_->NavigateBack();
71732 + } else if (start_x > (kScreenWidth - kEdgeWidth) &&
71733 + (start_x - end_x) > kTriggerDistance) {
71735 + if (nweb_delegate_->IsNavigateForwardAllowed()) {
71737 + nweb_delegate_->NavigateForward();
71742 diff --git a/src/ohos_nweb/src/nweb_input_handler.h b/src/ohos_nweb/src/nweb_input_handler.h
71745 --- /dev/null
71747 @@ -0,0 +1,58 @@
71754 + * http://www.apache.org/licenses/LICENSE-2.0
71798 + int32_t last_touch_start_x_ = -1;
71799 + double last_x_ = -1;
71800 + double last_y_ = -1;
71806 diff --git a/src/ohos_nweb/src/nweb_inputmethod_handler.cc b/src/ohos_nweb/src/nweb_inputmethod_han…
71809 --- /dev/null
71811 @@ -0,0 +1,355 @@
71818 + * http://www.apache.org/licenses/LICENSE-2.0
71855 + handler_->InsertText(text);
71859 + handler_->DeleteForward(length);
71863 + handler_->DeleteBackward(length);
71873 + handler_->SetIMEStatus(true);
71875 + handler_->SetIMEStatus(false);
71877 + handler_->SendEnterKeyEvent();
71882 + handler_->SetIMEStatus(status);
71890 + handler_->MoveCursor(direction);
71927 + InputMethodController::GetInstance()->Attach(inputmethod_listener_,
71937 + InputMethodController::GetInstance()->HideTextInput();
71938 + InputMethodController::GetInstance()->Close();
71946 + if (browser_ != nullptr && browser_->GetHost() != nullptr) {
71947 + browser_->GetHost()->ImeFinishComposingText(false);
71962 + if (browser_ != nullptr && browser_->GetHost() != nullptr) {
71965 + browser_->GetHost()->PostTaskToUIThread(insert_task);
71975 + if (browser_ != nullptr && browser_->GetHost() != nullptr) {
71986 + browser_->GetHost()->PostTaskToUIThread(insert_task);
71991 + if (browser_ != nullptr && browser_->GetHost() != nullptr) {
71994 + browser_->GetHost()->PostTaskToUIThread(delete_task);
71999 + if (browser_ != nullptr && browser_->GetHost() != nullptr) {
72012 + browser_->GetHost()->PostTaskToUIThread(delete_task);
72018 + browser_->GetHost()->ImeFinishComposingText(false);
72043 + browser_->GetHost()->ImeSetComposition(CefString(composing_text_), underlines,
72046 + browser_->GetHost()->ImeFinishComposingText(false);
72061 + if (!browser_ || !browser_->GetHost()) {
72068 + browser_->GetHost()->SendKeyEvent(keyEvent);
72070 + browser_->GetHost()->SendKeyEvent(keyEvent);
72073 + browser_->GetHost()->SendKeyEvent(keyEvent);
72084 + if (!browser_ || !browser_->GetHost()) {
72091 + browser_->GetHost()->SendKeyEvent(keyEvent);
72093 + browser_->GetHost()->SendKeyEvent(keyEvent);
72096 + browser_->GetHost()->SendKeyEvent(keyEvent);
72108 + if (browser_ && browser_->GetHost()) {
72109 + browser_->GetHost()->SendKeyEvent(keyEvent);
72113 + if (browser_ && browser_->GetHost()) {
72114 + browser_->GetHost()->SendKeyEvent(keyEvent);
72118 + if (browser_ && browser_->GetHost()) {
72119 + browser_->GetHost()->SendKeyEvent(keyEvent);
72157 + if (browser_ && browser_->GetHost()) {
72158 + browser_->GetHost()->SendKeyEvent(keyEvent);
72162 + if (browser_ && browser_->GetHost()) {
72163 + browser_->GetHost()->SendKeyEvent(keyEvent);
72167 diff --git a/src/ohos_nweb/src/nweb_inputmethod_handler.h b/src/ohos_nweb/src/nweb_inputmethod_hand…
72170 --- /dev/null
72172 @@ -0,0 +1,183 @@
72179 + * http://www.apache.org/licenses/LICENSE-2.0
72356 diff --git a/src/ohos_nweb/src/nweb_output_handler.cc b/src/ohos_nweb/src/nweb_output_handler.cc
72359 --- /dev/null
72361 @@ -0,0 +1,318 @@
72368 + * http://www.apache.org/licenses/LICENSE-2.0
72442 + output_handler->Init(width, height);
72484 + !output_handler_weak.lock()->dump_path_.empty()) {
72486 + std::unique_lock<std::mutex> lk(outputHandler->dump_mtx_);
72487 + outputHandler->dump_cv_.wait(lk);
72490 + std::string full_name = outputHandler->dump_path_ + kFileName;
72491 + if (outputHandler->dump_buf_ == nullptr) {
72494 + helper.DumpToBmp(full_name, outputHandler->dump_buf_.get(),
72495 + outputHandler->width_, outputHandler->height_);
72505 + output_handler_weak.lock()->frame_info_dump_) {
72508 + std::unique_lock<std::mutex> lk(output_handler->frame_stat_mtx_);
72509 + if (output_handler->local_time_base_ !=
72510 + output_handler->local_time_curr_) {
72512 + (output_handler->local_render_count_ - 1) /
72513 + (output_handler->local_time_curr_ -
72514 + output_handler->local_time_base_);
72519 + output_handler->nweb_id_, fps_cur,
72520 + output_handler->render_count_, output_handler->frame_miss_count_);
72521 + std::cout << "NWeb " << output_handler->nweb_id_
72524 + << " frame_total_count=" << output_handler->render_count_
72525 + << " frame_miss_count=" << output_handler->frame_miss_count_
72528 + output_handler->local_render_count_ = 0;
72529 + output_handler->local_time_base_ = 0;
72530 + output_handler->local_time_curr_ = 0;
72618 + *(p_rgb - 3) = 255;
72619 + *(p_rgb - 2) = 255;
72620 + *(p_rgb - 1) = 255;
72626 + char tmp = *(p_rgb - 1);
72627 + *(p_rgb - 1) = *(p_rgb - 3);
72628 + *(p_rgb - 3) = tmp;
72649 + bmp_info_header.bi_height = -height;
72680 diff --git a/src/ohos_nweb/src/nweb_output_handler.h b/src/ohos_nweb/src/nweb_output_handler.h
72683 --- /dev/null
72685 @@ -0,0 +1,98 @@
72692 + * http://www.apache.org/licenses/LICENSE-2.0
72784 diff --git a/src/ohos_nweb/src/nweb_render_main.cc b/src/ohos_nweb/src/nweb_render_main.cc
72787 --- /dev/null
72789 @@ -0,0 +1,45 @@
72796 + * http://www.apache.org/licenses/LICENSE-2.0
72836 diff --git a/src/ohos_nweb/src/nweb_sysevent.gni b/src/ohos_nweb/src/nweb_sysevent.gni
72839 --- /dev/null
72841 @@ -0,0 +1,18 @@
72847 +# http://www.apache.org/licenses/LICENSE-2.0
72860 diff --git a/src/ohos_nweb/src/nweb_url_resource_error_impl.h b/src/ohos_nweb/src/nweb_url_resource…
72863 --- /dev/null
72865 @@ -0,0 +1,36 @@
72872 + * http://www.apache.org/licenses/LICENSE-2.0
72903 diff --git a/src/ohos_nweb/src/nweb_url_resource_request_impl.cc b/src/ohos_nweb/src/nweb_url_resou…
72906 --- /dev/null
72908 @@ -0,0 +1,56 @@
72915 + * http://www.apache.org/licenses/LICENSE-2.0
72965 diff --git a/src/ohos_nweb/src/nweb_url_resource_request_impl.h b/src/ohos_nweb/src/nweb_url_resour…
72968 --- /dev/null
72970 @@ -0,0 +1,48 @@
72977 + * http://www.apache.org/licenses/LICENSE-2.0
73020 diff --git a/src/ohos_nweb/src/nweb_web_storage_delegate_interface.h b/src/ohos_nweb/src/nweb_web_s…
73023 --- /dev/null
73025 @@ -0,0 +1,42 @@
73032 + * http://www.apache.org/licenses/LICENSE-2.0
73068 diff --git a/src/ohos_nweb/src/nweb_web_storage_impl.cc b/src/ohos_nweb/src/nweb_web_storage_impl.cc
73071 --- /dev/null
73073 @@ -0,0 +1,90 @@
73080 + * http://www.apache.org/licenses/LICENSE-2.0
73110 + delegate_->DeleteAllData();
73116 + return delegate_->DeleteOrigin(origin);
73123 + delegate_->GetOrigins(callback);
73130 + delegate_->GetOrigins(origins);
73138 + delegate_->GetOriginQuota(origin, callback);
73144 + return delegate_->GetOriginQuota(origin);
73152 + delegate_->GetOriginUsage(origin, callback);
73158 + return delegate_->GetOriginUsage(origin);
73164 diff --git a/src/ohos_nweb/src/nweb_web_storage_impl.h b/src/ohos_nweb/src/nweb_web_storage_impl.h
73167 --- /dev/null
73169 @@ -0,0 +1,44 @@
73176 + * http://www.apache.org/licenses/LICENSE-2.0
73214 diff --git a/src/ohos_nweb/src/ohos_nweb_main.cc b/src/ohos_nweb/src/ohos_nweb_main.cc
73217 --- /dev/null
73219 @@ -0,0 +1,82 @@
73226 + * http://www.apache.org/licenses/LICENSE-2.0
73253 + return -1;
73258 + return -1;
73267 + return -1;
73272 + return -1;
73281 + return -1;
73285 + for (int i=0; i<argc-1; ++i) {
73288 + argv_ss << argv[argc-1];
73303 diff --git a/src/ohos_nweb/src/sysevent/event_reporter.cc b/src/ohos_nweb/src/sysevent/event_report…
73306 --- /dev/null
73308 @@ -0,0 +1,67 @@
73315 + * http://www.apache.org/licenses/LICENSE-2.0
73376 diff --git a/src/ohos_nweb/src/sysevent/event_reporter.h b/src/ohos_nweb/src/sysevent/event_reporte…
73379 --- /dev/null
73381 @@ -0,0 +1,27 @@
73388 + * http://www.apache.org/licenses/LICENSE-2.0
73409 diff --git a/src/pdf/pdfium/findtext_unittest.cc b/src/pdf/pdfium/findtext_unittest.cc
73411 --- a/src/pdf/pdfium/findtext_unittest.cc
73413 @@ -18,7 +18,8 @@ namespace {
73417 - FindTextTestClient() = default;
73423 @@ -30,7 +31,7 @@ class FindTextTestClient : public TestClient {
73427 - EXPECT_TRUE(case_sensitive);
73432 @@ -50,6 +51,9 @@ class FindTextTestClient : public TestClient {
73442 @@ -57,7 +61,7 @@ class FindTextTestClient : public TestClient {
73446 - FindTextTestClient client;
73451 @@ -76,7 +80,7 @@ TEST_F(FindTextTest, FindText) {
73455 - FindTextTestClient client;
73460 @@ -95,7 +99,7 @@ TEST_F(FindTextTest, FindHyphenatedText) {
73464 - FindTextTestClient client;
73469 @@ -112,7 +116,7 @@ TEST_F(FindTextTest, FindLineBreakText) {
73473 - FindTextTestClient client;
73478 @@ -130,7 +134,7 @@ TEST_F(FindTextTest, FindSimpleQuotationMarkText) {
73482 - FindTextTestClient client;
73487 @@ -149,4 +153,42 @@ TEST_F(FindTextTest, FindFancyQuotationMarkText) {
73488 engine->StartFind(base::UTF16ToUTF8(term), /*case_sensitive=*/true);
73498 + engine->StartFind("world", /*case_sensitive=*/false);
73506 + ASSERT_TRUE(engine->SelectFindResult(/*forward=*/true));
73507 + ASSERT_TRUE(engine->SelectFindResult(/*forward=*/true));
73519 + engine->SetTwoUpView(true);
73526 + ASSERT_TRUE(engine->SelectFindResult(/*forward=*/true));
73530 diff --git a/src/pdf/pdfium/pdfium_engine.cc b/src/pdf/pdfium/pdfium_engine.cc
73532 --- a/src/pdf/pdfium/pdfium_engine.cc
73534 @@ -1981,7 +1981,7 @@ void PDFiumEngine::SearchUsingICU(const std::u16string& term,
73538 - bool first_result = find_results_.empty();
73543 @@ -1998,7 +1998,6 @@ void PDFiumEngine::AddFindResult(const PDFiumRange& result) {
73545 client_->NotifyNumberOfFindResultsChanged(find_results_.size(), false);
73547 - DCHECK(!resume_find_index_);
73551 diff --git a/src/printing/BUILD.gn b/src/printing/BUILD.gn
73553 --- a/src/printing/BUILD.gn
73555 @@ -201,7 +201,7 @@ component("printing") {
73559 - if (is_linux) {
73564 diff --git a/src/sandbox/BUILD.gn b/src/sandbox/BUILD.gn
73566 --- a/src/sandbox/BUILD.gn
73568 @@ -27,7 +27,7 @@ group("sandbox") {
73572 - } else if (is_linux || is_chromeos || is_android) {
73577 diff --git a/src/sandbox/features.gni b/src/sandbox/features.gni
73579 --- a/src/sandbox/features.gni
73581 @@ -6,7 +6,7 @@
73585 -use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
73590 @@ -14,4 +14,4 @@ use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
73592 # As Spectre Variant 4 can be mitigated by site isolation, opt-out SSBD on site
73594 -disable_seccomp_ssbd = use_seccomp_bpf && !is_android
73596 diff --git a/src/sandbox/linux/BUILD.gn b/src/sandbox/linux/BUILD.gn
73598 --- a/src/sandbox/linux/BUILD.gn
73600 @@ -12,9 +12,9 @@ if (is_android) {
73604 - compile_suid_client = is_linux || is_chromeos
73607 - compile_credentials = is_linux || is_chromeos
73612 diff --git a/src/sandbox/linux/services/credentials.h b/src/sandbox/linux/services/credentials.h
73614 --- a/src/sandbox/linux/services/credentials.h
73616 @@ -13,6 +13,10 @@
73627 diff --git a/src/sandbox/policy/BUILD.gn b/src/sandbox/policy/BUILD.gn
73629 --- a/src/sandbox/policy/BUILD.gn
73631 @@ -35,7 +35,7 @@ component("policy") {
73635 - if (is_linux || is_chromeos) {
73640 diff --git a/src/sandbox/policy/mojom/BUILD.gn b/src/sandbox/policy/mojom/BUILD.gn
73642 --- a/src/sandbox/policy/mojom/BUILD.gn
73644 @@ -18,7 +18,7 @@ mojom("mojom") {
73648 - if (is_linux || is_chromeos) {
73653 diff --git a/src/sandbox/policy/sandbox.cc b/src/sandbox/policy/sandbox.cc
73655 --- a/src/sandbox/policy/sandbox.cc
73657 @@ -13,7 +13,7 @@
73661 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73666 @@ -30,7 +30,7 @@
73670 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73675 @@ -95,7 +95,7 @@ bool Sandbox::IsProcessSandboxed() {
73679 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73681 int status = SandboxLinux::GetInstance()->GetStatus();
73684 diff --git a/src/sandbox/policy/sandbox.h b/src/sandbox/policy/sandbox.h
73686 --- a/src/sandbox/policy/sandbox.h
73688 @@ -8,7 +8,7 @@
73692 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73697 @@ -32,7 +32,7 @@ namespace policy {
73701 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73706 diff --git a/src/sandbox/policy/sandbox_type.cc b/src/sandbox/policy/sandbox_type.cc
73708 --- a/src/sandbox/policy/sandbox_type.cc
73710 @@ -70,7 +70,7 @@ bool IsUnsandboxedSandboxType(Sandbox sandbox_type) {
73714 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73719 @@ -156,7 +156,7 @@ void SetCommandLineFlagsForSandboxType(base::CommandLine* command_line,
73723 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73728 @@ -203,7 +203,7 @@ sandbox::mojom::Sandbox SandboxTypeFromCommandLine(
73732 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73737 @@ -291,7 +291,7 @@ std::string StringFromUtilitySandboxType(Sandbox sandbox_type) {
73741 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73746 diff --git a/src/sandbox/policy/switches.cc b/src/sandbox/policy/switches.cc
73748 --- a/src/sandbox/policy/switches.cc
73750 @@ -95,7 +95,7 @@ const char kGpuSandboxFailuresFatal[] = "gpu-sandbox-failures-fatal";
73751 // Meant to be used as a browser-level switch for testing purposes only.
73752 const char kNoSandbox[] = "no-sandbox";
73754 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73758 const char kNoZygoteSandbox[] = "no-zygote-sandbox";
73759 diff --git a/src/sandbox/policy/switches.h b/src/sandbox/policy/switches.h
73761 --- a/src/sandbox/policy/switches.h
73763 @@ -71,7 +71,7 @@ SANDBOX_POLICY_EXPORT extern const char kDisableSetuidSandbox[];
73767 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
73772 diff --git a/src/services/cert_verifier/cert_verifier_creation.cc b/src/services/cert_verifier/cert…
73774 --- a/src/services/cert_verifier/cert_verifier_creation.cc
73776 @@ -121,6 +121,7 @@ scoped_refptr<net::CertVerifyProc> CreateNewDefaultWithoutCaching(
73784 diff --git a/src/services/device/battery/BUILD.gn b/src/services/device/battery/BUILD.gn
73786 --- a/src/services/device/battery/BUILD.gn
73788 @@ -57,6 +57,12 @@ if (!is_android) {
73801 diff --git a/src/services/device/battery/battery_status_manager_ohos.cc b/src/services/device/batte…
73804 --- /dev/null
73806 @@ -0,0 +1,130 @@
73808 +// Use of this source code is governed by a BSD-style license that can be
73832 + batteryClient->RegBatteryEvent([this](WebBatteryInfo& info) {
73833 + this->BatteryChanged(info);
73845 + if (!batteryClient->StartListen()) {
73850 + std::unique_ptr<WebBatteryInfo> batteryInfo = batteryClient->RequestBatteryInfo();
73853 + status.level = batteryInfo->GetLevel();
73854 + status.charging = batteryInfo->IsCharging();
73877 + batteryClient->StopListen();
73912 + observer_->StopListen();
73918 + return observer_->StartListen();
73923 + observer_->StopListen();
73937 diff --git a/src/services/device/geolocation/BUILD.gn b/src/services/device/geolocation/BUILD.gn
73939 --- a/src/services/device/geolocation/BUILD.gn
73941 @@ -64,6 +64,21 @@ source_set("geolocation") {
73963 diff --git a/src/services/device/geolocation/location_arbitrator.cc b/src/services/device/geolocati…
73965 --- a/src/services/device/geolocation/location_arbitrator.cc
73967 @@ -161,7 +161,8 @@ LocationArbitrator::NewNetworkLocationProvider(
73971 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
73977 diff --git a/src/services/device/geolocation/ohos/location_provider_ohos.cc b/src/services/device/g…
73980 --- /dev/null
73982 @@ -0,0 +1,197 @@
73984 +// Use of this source code is governed by a BSD-style license that can be
74019 + locator_callback_->SetUpdateCallback(base::BindRepeating(
74040 + locator_->StopLocating(locator_call_back);
74044 + return locator_callback_->GetPosition();
74054 + position.latitude = location->GetLatitude();
74055 + position.longitude = location->GetLongitude();
74056 + // location->GetTimeStamp() has no value now, so that temporarily passed
74059 + position.altitude = location->GetAltitude();
74060 + position.accuracy = location->GetAccuracy();
74061 + position.heading = location->GetDirection();
74062 + position.speed = location->GetSpeed();
74082 + locator_callback_->OnErrorReport(
74087 + locator_->EnableAbility(true);
74093 + int ret = locator_->StartLocating(requestConfig, locator_call_back, "location.ILocator",
74097 + locator_callback_->OnErrorReport(
74115 + requestConfig->SetPriority(OHOS::Location::PRIORITY_FAST_FIRST_FIX);
74116 + requestConfig->SetScenario(OHOS::Location::SCENE_UNSET);
74117 + requestConfig->SetTimeInterval(1);
74118 + requestConfig->SetDistanceInterval(0);
74119 + requestConfig->SetMaxAccuracy(50);
74120 + requestConfig->SetFixNumber(0);
74136 + return -1;
74180 diff --git a/src/services/device/geolocation/ohos/location_provider_ohos.h b/src/services/device/ge…
74183 --- /dev/null
74185 @@ -0,0 +1,97 @@
74187 +// Use of this source code is governed by a BSD-style license that can be
74283 diff --git a/src/services/device/time_zone_monitor/BUILD.gn b/src/services/device/time_zone_monitor…
74285 --- a/src/services/device/time_zone_monitor/BUILD.gn
74287 @@ -39,7 +39,7 @@ source_set("time_zone_monitor") {
74291 - if (is_linux) {
74296 diff --git a/src/services/device/wake_lock/power_save_blocker/BUILD.gn b/src/services/device/wake_l…
74298 --- a/src/services/device/wake_lock/power_save_blocker/BUILD.gn
74300 @@ -73,6 +73,12 @@ source_set("power_save_blocker") {
74311 # Fuchsia and non-DBus Linux.
74313 diff --git a/src/services/device/wake_lock/power_save_blocker/power_save_blocker_ohos.cc b/src/serv…
74316 --- /dev/null
74318 @@ -0,0 +1,74 @@
74320 +// Use of this source code is governed by a BSD-style license that can be
74355 + lock_ = power_mgr_client_->CreateRunningLock(
74362 + lock_->Lock(0);
74368 + lock_->UnLock();
74382 + delegate_->ApplyBlock();
74388 + delegate_->RemoveBlock();
74393 diff --git a/src/services/resource_coordinator/public/cpp/memory_instrumentation/BUILD.gn b/src/ser…
74395 --- a/src/services/resource_coordinator/public/cpp/memory_instrumentation/BUILD.gn
74397 @@ -29,7 +29,7 @@ component("memory_instrumentation") {
74401 - if (is_android || is_linux || is_chromeos) {
74406 diff --git a/src/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h b/src…
74408 --- a/src/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h
74410 @@ -45,7 +45,8 @@ class COMPONENT_EXPORT(
74414 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
74420 @@ -62,7 +63,8 @@ class COMPONENT_EXPORT(
74424 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
74430 diff --git a/src/services/tracing/public/cpp/tracing_features.cc b/src/services/tracing/public/cpp/…
74432 --- a/src/services/tracing/public/cpp/tracing_features.cc
74434 @@ -23,7 +23,7 @@ namespace features {
74435 // Runs the tracing service as an in-process browser service.
74438 -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMECAST)
74443 diff --git a/src/skia/BUILD.gn b/src/skia/BUILD.gn
74445 --- a/src/skia/BUILD.gn
74447 @@ -114,6 +114,15 @@ config("skia_config") {
74463 @@ -155,7 +164,7 @@ config("skia_library_config") {
74467 - } else if (is_android) {
74472 @@ -173,7 +182,7 @@ config("skia_library_config") {
74476 - if (is_android) {
74481 @@ -263,6 +272,9 @@ component("skia") {
74491 @@ -472,6 +484,19 @@ component("skia") {
74511 @@ -617,6 +642,12 @@ component("skia") {
74518 + configs -= [ "//build/config:ohos_nweb_ex_def_main" ]
74524 diff --git a/src/skia/config/SkUserConfig.h b/src/skia/config/SkUserConfig.h
74526 --- a/src/skia/config/SkUserConfig.h
74528 @@ -161,10 +161,17 @@ SK_API void SkDebugf_FileLine(const char* file,
74534 -#define SK_R32_SHIFT 16
74537 -#define SK_B32_SHIFT 0
74548 diff --git a/src/skia/ext/fontmgr_default_ohos.cc b/src/skia/ext/fontmgr_default_ohos.cc
74551 --- /dev/null
74553 @@ -0,0 +1,16 @@
74555 +// Use of this source code is governed by a BSD-style license that can be
74571 diff --git a/src/sql/database.cc b/src/sql/database.cc
74573 --- a/src/sql/database.cc
74575 @@ -1795,17 +1795,6 @@ int Database::OnSqliteError(int sqlite_error_code,
74579 -bool Database::FullIntegrityCheck(std::vector<std::string>* messages) {
74580 - return IntegrityCheckHelper("PRAGMA integrity_check", messages);
74581 -}
74582 -
74583 -bool Database::QuickIntegrityCheck() {
74584 - std::vector<std::string> messages;
74585 - if (!IntegrityCheckHelper("PRAGMA quick_check", &messages))
74586 - return false;
74587 - return messages.size() == 1 && messages[0] == "ok";
74588 -}
74589 -
74593 @@ -1838,39 +1827,71 @@ std::string Database::GetDiagnosticInfo(int extended_error,
74597 -// TODO(shess): Allow specifying maximum results (default 100 lines).
74598 -bool Database::IntegrityCheckHelper(const char* pragma_sql,
74599 - std::vector<std::string>* messages) {
74601 messages->clear();
74603 - // This has the side effect of setting SQLITE_RecoveryMode, which
74606 - // Failing to set this pragma probably means that the database is
74607 - // beyond recovery.
74608 - static const char kWritableSchemaSql[] = "PRAGMA writable_schema=ON";
74609 - if (!Execute(kWritableSchemaSql))
74614 + messages->push_back("PRAGMA writable_schema=ON failed");
74622 + // handler, which triggers feature-level error handling. However,
74628 + // slightly better if sqlite_prepare_v3() receives a zero-terminated statement
74638 - bool ret = false;
74639 - {
74640 - sql::Statement stmt(GetUniqueStatement(pragma_sql));
74641 -
74642 - // The pragma appears to return all results (up to 100 by default)
74643 - // as a single string. This doesn't appear to be an API contract,
74644 - // it could return separate lines, so loop _and_ split.
74645 - while (stmt.Step()) {
74646 - std::string result(stmt.ColumnString(0));
74647 - *messages = base::SplitString(result, "\n", base::TRIM_WHITESPACE,
74648 - base::SPLIT_WANT_ALL);
74649 - }
74650 - ret = stmt.Succeeded();
74671 - // Best effort to put things back as they were before.
74672 - static const char kNoWritableSchemaSql[] = "PRAGMA writable_schema=OFF";
74673 - std::ignore = Execute(kNoWritableSchemaSql);
74682 + // Best-effort attempt to undo the "PRAGMA writable_schema=ON" executed above.
74685 - return ret;
74690 diff --git a/src/sql/database.h b/src/sql/database.h
74692 --- a/src/sql/database.h
74694 @@ -237,17 +237,19 @@ class COMPONENT_EXPORT(SQL) Database {
74695 // Developer-friendly database ID used in logging output and memory dumps.
74698 - // Run "PRAGMA integrity_check" and post each line of
74699 - // results into |messages|. Returns the success of running the
74700 - // statement - per the SQLite documentation, if no errors are found the
74701 - // call should succeed, and a single value "ok" should be in messages.
74715 - // Runs "PRAGMA quick_check" and, unlike the FullIntegrityCheck method,
74716 - // interprets the results returning true if the the statement executes
74717 - // without error and results in a single "ok" value.
74718 - [[nodiscard]] bool QuickIntegrityCheck();
74719 -
74723 @@ -732,9 +734,6 @@ class COMPONENT_EXPORT(SQL) Database {
74727 - [[nodiscard]] bool IntegrityCheckHelper(const char* pragma_sql,
74728 - std::vector<std::string>* messages);
74729 -
74730 // Release page-cache memory if memory-mapped I/O is enabled and the database
74733 diff --git a/src/sql/database_unittest.cc b/src/sql/database_unittest.cc
74735 --- a/src/sql/database_unittest.cc
74737 @@ -27,6 +27,7 @@
74745 @@ -1293,48 +1294,31 @@ TEST_P(SQLDatabaseTest, AttachDatabaseWithOpenTransaction) {
74746 EXPECT_FALSE(db_->IsSQLValid("SELECT count(*) from other.bar"));
74749 -TEST_P(SQLDatabaseTest, Basic_QuickIntegrityCheck) {
74750 - const char* kCreateSql = "CREATE TABLE foo (id INTEGER PRIMARY KEY, value)";
74751 - ASSERT_TRUE(db_->Execute(kCreateSql));
74752 - EXPECT_TRUE(db_->QuickIntegrityCheck());
74753 - db_->Close();
74754 -
74755 - ASSERT_TRUE(sql::test::CorruptSizeInHeader(db_path_));
74759 + ASSERT_TRUE(db_->Execute(kTableSql));
74760 + ASSERT_TRUE(db_->Execute("CREATE INDEX rows_by_value ON rows(value)"));
74763 - sql::test::ScopedErrorExpecter expecter;
74764 - expecter.ExpectError(SQLITE_CORRUPT);
74765 - ASSERT_TRUE(db_->Open(db_path_));
74766 - EXPECT_FALSE(db_->QuickIntegrityCheck());
74767 - ASSERT_TRUE(expecter.SawExpectedErrors());
74769 + EXPECT_TRUE(db_->FullIntegrityCheck(&messages))
74774 -}
74776 -TEST_P(SQLDatabaseTest, Basic_FullIntegrityCheck) {
74777 - const std::string kOk("ok");
74778 - std::vector<std::string> messages;
74779 -
74780 - const char* kCreateSql = "CREATE TABLE foo (id INTEGER PRIMARY KEY, value)";
74781 - ASSERT_TRUE(db_->Execute(kCreateSql));
74782 - EXPECT_TRUE(db_->FullIntegrityCheck(&messages));
74783 - EXPECT_EQ(1u, messages.size());
74784 - EXPECT_EQ(kOk, messages[0]);
74785 db_->Close();
74786 -
74787 - ASSERT_TRUE(sql::test::CorruptSizeInHeader(db_path_));
74789 + ASSERT_TRUE(db_->Open(db_path_));
74792 - sql::test::ScopedErrorExpecter expecter;
74793 - expecter.ExpectError(SQLITE_CORRUPT);
74794 - ASSERT_TRUE(db_->Open(db_path_));
74795 - EXPECT_TRUE(db_->FullIntegrityCheck(&messages));
74796 - EXPECT_LT(1u, messages.size());
74797 - EXPECT_NE(kOk, messages[0]);
74798 - ASSERT_TRUE(expecter.SawExpectedErrors());
74800 + EXPECT_TRUE(db_->FullIntegrityCheck(&messages))
74805 -
74806 - // TODO(shess): CorruptTableOrIndex could be used to produce a
74807 - // file that would pass the quick check and fail the full check.
74811 @@ -1760,9 +1744,10 @@ TEST_P(SQLDatabaseTest, CheckpointDatabase) {
74815 -TEST_P(SQLDatabaseTest, CorruptSizeInHeaderTest) {
74816 - ASSERT_TRUE(db_->Execute("CREATE TABLE foo (x)"));
74817 - ASSERT_TRUE(db_->Execute("CREATE TABLE bar (x)"));
74821 + db_->Execute("CREATE TABLE rows(i INTEGER PRIMARY KEY NOT NULL)"));
74822 db_->Close();
74825 @@ -1770,14 +1755,59 @@ TEST_P(SQLDatabaseTest, CorruptSizeInHeaderTest) {
74828 ASSERT_TRUE(db_->Open(db_path_));
74829 - EXPECT_FALSE(db_->Execute("INSERT INTO foo values (1)"));
74830 - EXPECT_FALSE(db_->DoesTableExist("foo"));
74831 - EXPECT_FALSE(db_->DoesTableExist("bar"));
74832 - EXPECT_FALSE(db_->Execute("SELECT * FROM foo"));
74839 + db_->Execute("CREATE TABLE rows(i INTEGER PRIMARY KEY NOT NULL)"));
74841 + EXPECT_TRUE(db_->Execute(kSelectSql))
74843 + db_->Close();
74849 + ASSERT_TRUE(db_->Open(db_path_));
74856 + EXPECT_FALSE(db_->Execute(kSelectSql));
74864 + db_->Execute("CREATE TABLE rows(i INTEGER PRIMARY KEY NOT NULL)"));
74865 + ASSERT_TRUE(db_->DoesTableExist("rows"))
74867 + db_->Close();
74873 + ASSERT_TRUE(db_->Open(db_path_));
74880 + EXPECT_FALSE(db_->DoesTableExist("rows"));
74889 diff --git a/src/sql/recovery_unittest.cc b/src/sql/recovery_unittest.cc
74891 --- a/src/sql/recovery_unittest.cc
74893 @@ -15,7 +15,9 @@
74903 @@ -216,169 +218,207 @@ TEST_F(SQLRecoveryTest, VirtualTable) {
74907 -void RecoveryCallback(Database* db,
74908 - const base::FilePath& db_path,
74909 - const char* create_table,
74910 - const char* create_index,
74911 - int* record_error,
74912 - int error,
74913 - Statement* stmt) {
74914 - *record_error = error;
74915 -
74916 - // Clear the error callback to prevent reentrancy.
74917 - db->reset_error_callback();
74918 -
74919 - std::unique_ptr<Recovery> recovery = Recovery::Begin(db, db_path);
74920 - ASSERT_TRUE(recovery.get());
74949 - ASSERT_TRUE(recovery->db()->Execute(create_table));
74950 - ASSERT_TRUE(recovery->db()->Execute(create_index));
74955 - size_t rows = 0;
74956 - ASSERT_TRUE(recovery->AutoRecoverTable("x", &rows));
74966 - ASSERT_TRUE(Recovery::Recovered(std::move(recovery)));
74971 -// Build a database, corrupt it by making an index reference to
74972 -// deleted row, then recover when a query selects that row.
74974 - static const char kCreateTable[] = "CREATE TABLE x (id INTEGER, v INTEGER)";
74975 - static const char kCreateIndex[] = "CREATE UNIQUE INDEX x_id ON x (id)";
74984 - // Insert a bit of data.
74985 - {
74986 - ASSERT_TRUE(db_.BeginTransaction());
74994 - static const char kInsertSql[] = "INSERT INTO x (id, v) VALUES (?, ?)";
74995 - Statement s(db_.GetUniqueStatement(kInsertSql));
74996 - for (int i = 0; i < 10; ++i) {
74997 - s.Reset(true);
74998 - s.BindInt(0, i);
74999 - s.BindInt(1, i);
75000 - EXPECT_FALSE(s.Step());
75001 - EXPECT_TRUE(s.Succeeded());
75002 - }
75003 -
75004 - ASSERT_TRUE(db_.CommitTransaction());
75005 - }
75007 -
75008 - // Delete a row from the table, while leaving the index entry which
75009 - // references it.
75010 - static const char kDeleteSql[] = "DELETE FROM x WHERE id = 0";
75011 - ASSERT_TRUE(sql::test::CorruptTableOrIndex(db_path_, "x_id", kDeleteSql));
75012 -
75017 - db_.set_error_callback(base::BindRepeating(
75018 - &RecoveryCallback, &db_, db_path_, kCreateTable, kCreateIndex, &error));
75019 -
75020 - // This works before the callback is called.
75021 - static const char kTrivialSql[] = "SELECT COUNT(*) FROM sqlite_schema";
75022 - EXPECT_TRUE(db_.IsSQLValid(kTrivialSql));
75023 -
75024 - // TODO(shess): Could this be delete? Anything which fails should work.
75025 - static const char kSelectSql[] = "SELECT v FROM x WHERE id = 0";
75026 - ASSERT_FALSE(db_.Execute(kSelectSql));
75027 - EXPECT_EQ(SQLITE_CORRUPT, error);
75028 -
75029 - // Database handle has been poisoned.
75030 - EXPECT_FALSE(db_.IsSQLValid(kTrivialSql));
75035 + // Recovery::Begin() does not support a pre-existing error callback.
75040 + ASSERT_TRUE(recovery->db()->Execute(kCreateTable));
75041 + ASSERT_TRUE(recovery->db()->Execute(kCreateIndex));
75044 + ASSERT_TRUE(recovery->AutoRecoverTable("rows", &rows));
75067 - // The recovered table should reflect the deletion.
75068 - static const char kSelectAllSql[] = "SELECT v FROM x ORDER BY id";
75069 - EXPECT_EQ("1,2,3,4,5,6,7,8,9",
75070 - ExecuteWithResults(&db_, kSelectAllSql, "|", ","));
75071 -
75072 - // The failing statement should now succeed, with no results.
75073 - EXPECT_EQ("", ExecuteWithResults(&db_, kSelectSql, "|", ","));
75081 -// Build a database, corrupt it by making a table contain a row not
75082 -// referenced by the index, then recover the database.
75084 - static const char kCreateTable[] = "CREATE TABLE x (id INTEGER, v INTEGER)";
75085 - static const char kCreateIndex[] = "CREATE UNIQUE INDEX x_id ON x (id)";
75088 + // clang-format off
75091 + // clang-format on
75098 - // Insert a bit of data.
75099 - {
75100 - ASSERT_TRUE(db_.BeginTransaction());
75110 - static const char kInsertSql[] = "INSERT INTO x (id, v) VALUES (?, ?)";
75111 - Statement s(db_.GetUniqueStatement(kInsertSql));
75112 - for (int i = 0; i < 10; ++i) {
75113 - s.Reset(true);
75114 - s.BindInt(0, i);
75115 - s.BindInt(1, i);
75116 - EXPECT_FALSE(s.Step());
75117 - EXPECT_TRUE(s.Succeeded());
75118 - }
75119 -
75120 - ASSERT_TRUE(db_.CommitTransaction());
75134 - db_.Close();
75136 - // Delete a row from the index while leaving a table entry.
75137 - static const char kDeleteSql[] = "DELETE FROM x WHERE id = 0";
75138 - ASSERT_TRUE(sql::test::CorruptTableOrIndex(db_path_, "x", kDeleteSql));
75150 + ASSERT_TRUE(db_file.SetLength(db_size - kDbPageSize));
75153 - ASSERT_TRUE(Reopen());
75163 - db_.set_error_callback(base::BindRepeating(
75164 - &RecoveryCallback, &db_, db_path_, kCreateTable, kCreateIndex, &error));
75165 -
75166 - // Index shows one less than originally inserted.
75167 - static const char kCountSql[] = "SELECT COUNT (*) FROM x";
75168 - EXPECT_EQ("9", ExecuteWithResult(&db_, kCountSql));
75169 -
75170 - // A full table scan shows all of the original data. Using column [v] to
75171 - // force use of the table rather than the index.
75172 - static const char kDistinctSql[] = "SELECT DISTINCT COUNT (v) FROM x";
75173 - EXPECT_EQ("10", ExecuteWithResult(&db_, kDistinctSql));
75174 -
75175 - // Insert id 0 again. Since it is not in the index, the insert
75176 - // succeeds, but results in a duplicate value in the table.
75177 - static const char kInsertSql[] = "INSERT INTO x (id, v) VALUES (0, 100)";
75178 - ASSERT_TRUE(db_.Execute(kInsertSql));
75179 -
75180 - // Duplication is visible.
75181 - EXPECT_EQ("10", ExecuteWithResult(&db_, kCountSql));
75182 - EXPECT_EQ("11", ExecuteWithResult(&db_, kDistinctSql));
75183 -
75184 - // This works before the callback is called.
75185 - static const char kTrivialSql[] = "SELECT COUNT(*) FROM sqlite_schema";
75186 - EXPECT_TRUE(db_.IsSQLValid(kTrivialSql));
75187 -
75188 - // TODO(shess): Figure out a statement which causes SQLite to notice the
75189 - // corruption. SELECT doesn't see errors because missing index values aren't
75190 - // visible. UPDATE or DELETE against v=0 don't see errors, even though the
75191 - // index item is missing. I suspect SQLite only deletes the key in these
75192 - // cases, but doesn't verify that one or more keys were deleted.
75193 - ASSERT_FALSE(db_.Execute("INSERT INTO x (id, v) VALUES (0, 101)"));
75194 - EXPECT_EQ(SQLITE_CONSTRAINT_UNIQUE, error);
75195 -
75196 - // Database handle has been poisoned.
75197 - EXPECT_FALSE(db_.IsSQLValid(kTrivialSql));
75202 + // Recovery::Begin() does not support a pre-existing error callback.
75207 + ASSERT_TRUE(recovery->db()->Execute(kCreateTable));
75208 + ASSERT_TRUE(recovery->db()->Execute(kCreateIndex));
75211 + ASSERT_TRUE(recovery->AutoRecoverTable("rows", &rows));
75224 - // The recovered table has consistency between the index and the table.
75225 - EXPECT_EQ("10", ExecuteWithResult(&db_, kCountSql));
75226 - EXPECT_EQ("10", ExecuteWithResult(&db_, kDistinctSql));
75227 -
75228 - // Only one of the values is retained.
75229 - static const char kSelectSql[] = "SELECT v FROM x WHERE id = 0";
75230 - const std::string results = ExecuteWithResult(&db_, kSelectSql);
75231 - EXPECT_TRUE(results=="100" || results=="0") << "Actual results: " << results;
75242 @@ -886,26 +926,22 @@ TEST_F(SQLRecoveryTest, RecoverDatabaseDelete) {
75246 - // Create a table with a broken index.
75247 - ASSERT_TRUE(db_.Execute("CREATE TABLE t (id INTEGER PRIMARY KEY, c TEXT)"));
75248 - ASSERT_TRUE(db_.Execute("CREATE UNIQUE INDEX t_id ON t (id)"));
75249 - ASSERT_TRUE(db_.Execute("INSERT INTO t VALUES (1, 'hello world')"));
75250 - ASSERT_TRUE(db_.Execute("INSERT INTO t VALUES (2, 'testing')"));
75251 - ASSERT_TRUE(db_.Execute("INSERT INTO t VALUES (3, 'nope')"));
75252 -
75253 - // Inject corruption into the index.
75254 - db_.Close();
75255 - static const char kDeleteSql[] = "DELETE FROM t WHERE id = 3";
75256 - ASSERT_TRUE(sql::test::CorruptTableOrIndex(db_path_, "t_id", kDeleteSql));
75257 - ASSERT_TRUE(Reopen());
75262 - // id as read from index.
75263 - static const char kSelectIndexIdSql[] = "SELECT id FROM t INDEXED BY t_id";
75264 - EXPECT_EQ("1,2,3", ExecuteWithResults(&db_, kSelectIndexIdSql, "|", ","));
75267 - // id as read from table.
75268 - static const char kSelectTableIdSql[] = "SELECT id FROM t NOT INDEXED";
75269 - EXPECT_EQ("1,2", ExecuteWithResults(&db_, kSelectTableIdSql, "|", ","));
75283 @@ -916,10 +952,19 @@ TEST_F(SQLRecoveryTest, BeginRecoverDatabase) {
75287 - EXPECT_EQ("1,2,3", ExecuteWithResults(&db_, kSelectIndexIdSql, "|", ","));
75288 - EXPECT_EQ("1,2", ExecuteWithResults(&db_, kSelectTableIdSql, "|", ","));
75290 - // Run recovery code, then commit. The failing row is dropped.
75306 @@ -928,8 +973,9 @@ TEST_F(SQLRecoveryTest, BeginRecoverDatabase) {
75310 - EXPECT_EQ("1,2", ExecuteWithResults(&db_, kSelectIndexIdSql, "|", ","));
75311 - EXPECT_EQ("1,2", ExecuteWithResults(&db_, kSelectTableIdSql, "|", ","));
75318 diff --git a/src/sql/test/test_helpers.cc b/src/sql/test/test_helpers.cc
75320 --- a/src/sql/test/test_helpers.cc
75322 @@ -7,20 +7,27 @@
75342 +#include "third_party/abseil-cpp/absl/types/optional.h"
75349 size_t CountSQLItemsOfType(sql::Database* db, const char* type) {
75350 @@ -32,67 +39,113 @@ size_t CountSQLItemsOfType(sql::Database* db, const char* type) {
75354 -// Get page size for the database.
75355 -bool GetPageSize(sql::Database* db, int* page_size) {
75356 - sql::Statement s(db->GetUniqueStatement("PRAGMA page_size"));
75357 - if (!s.Step())
75358 - return false;
75359 - *page_size = s.ColumnInt(0);
75360 - return true;
75361 -}
75362 -
75363 -// Get |name|'s root page number in the database.
75364 -bool GetRootPage(sql::Database* db, const char* name, int* page_number) {
75365 - static const char kPageSql[] =
75366 - "SELECT rootpage FROM sqlite_schema WHERE name = ?";
75367 - sql::Statement s(db->GetUniqueStatement(kPageSql));
75368 - s.BindString(0, name);
75369 - if (!s.Step())
75370 - return false;
75371 - *page_number = s.ColumnInt(0);
75372 - return true;
75373 -}
75374 -
75375 -// Helper for reading a number from the SQLite header.
75376 -// See base/big_endian.h.
75377 -unsigned ReadBigEndian(unsigned char* buf, size_t bytes) {
75378 - unsigned r = buf[0];
75379 - for (size_t i = 1; i < bytes; i++) {
75380 - r <<= 8;
75381 - r |= buf[i];
75382 - }
75383 - return r;
75399 + // because 65536 (64kb) doesn't fit in a 16-bit unsigned integer.
75402 + // The documentation hints at the path for future expansion -- the page_size
75403 + // field may become a litte-endian number that indicates the database page
75407 + // Sanity-check that the page size is valid.
75409 + if (page_size < kMinPageSize || (page_size & (page_size - 1)) != 0)
75415 -// Helper for writing a number to the SQLite header.
75416 -void WriteBigEndian(unsigned val, unsigned char* buf, size_t bytes) {
75417 - for (size_t i = 0; i < bytes; i++) {
75418 - buf[bytes - i - 1] = (val & 0xFF);
75419 - val >>= 8;
75420 - }
75421 +// Read the number of the root page of a B-tree (index/table).
75423 +// Returns a 0-indexed page number, not the raw SQLite page number.
75424 +absl::optional<int> GetRootPage(sql::Database& db,
75427 + db.GetUniqueStatement("SELECT rootpage FROM sqlite_schema WHERE name=?"));
75436 + return sqlite_page_number - 1;
75439 -bool IsWalDatabase(const base::FilePath& db_path) {
75440 - // The SQLite header is documented at:
75441 - // https://www.sqlite.org/fileformat.html#the_database_header
75442 - //
75443 - // Read the entire header.
75444 - constexpr int kHeaderSize = 100;
75450 - base::ReadFile(db_path, reinterpret_cast<char*>(header), sizeof(header));
75462 - DCHECK_LE(header[kReadVersionHeaderOffset], 2)
75468 -} // namespace
75476 + // Sanity-check that the page size is valid.
75477 + if (page_size < kMinPageSize || (page_size & (page_size - 1)) != 0)
75483 + const int64_t page_count = (db_size + page_size * 2 - 1) / page_size;
75505 -namespace sql {
75506 -namespace test {
75511 @@ -119,32 +172,25 @@ bool CorruptSizeInHeader(const base::FilePath& db_path) {
75512 db.Close();
75515 - // See http://www.sqlite.org/fileformat.html#database_header
75516 - const size_t kHeaderSize = 100;
75517 -
75518 - unsigned char header[kHeaderSize];
75519 -
75520 - base::ScopedFILE file(base::OpenFile(db_path, "rb+"));
75521 - if (!file.get())
75522 - return false;
75523 -
75524 - if (0 != fseek(file.get(), 0, SEEK_SET))
75525 - return false;
75526 - if (1u != fread(header, sizeof(header), 1, file.get()))
75532 - int64_t db_size = 0;
75533 - if (!base::GetFileSize(db_path, &db_size))
75538 - CorruptSizeInHeaderMemory(header, db_size);
75539 -
75540 - if (0 != fseek(file.get(), 0, SEEK_SET))
75548 - if (1u != fwrite(header, sizeof(header), 1, file.get()))
75551 -
75552 - return true;
75557 @@ -161,88 +207,29 @@ bool CorruptSizeInHeaderWithLock(const base::FilePath& db_path) {
75561 -void CorruptSizeInHeaderMemory(unsigned char* header, int64_t db_size) {
75562 - const size_t kPageSizeOffset = 16;
75563 - const size_t kFileChangeCountOffset = 24;
75564 - const size_t kPageCountOffset = 28;
75565 - const size_t kVersionValidForOffset = 92; // duplicate kFileChangeCountOffset
75566 -
75567 - const unsigned page_size = ReadBigEndian(header + kPageSizeOffset, 2);
75568 -
75569 - // One larger than the expected size.
75570 - const unsigned page_count =
75571 - static_cast<unsigned>((db_size + page_size) / page_size);
75572 - WriteBigEndian(page_count, header + kPageCountOffset, 4);
75573 -
75574 - // Update change count so outstanding readers know the info changed.
75575 - // Both spots must match for the page count to be considered valid.
75576 - unsigned change_count = ReadBigEndian(header + kFileChangeCountOffset, 4);
75577 - WriteBigEndian(change_count + 1, header + kFileChangeCountOffset, 4);
75578 - WriteBigEndian(change_count + 1, header + kVersionValidForOffset, 4);
75579 -}
75586 -bool CorruptTableOrIndex(const base::FilePath& db_path,
75587 - const char* tree_name,
75588 - const char* update_sql) {
75589 sql::Database db;
75590 if (!db.Open(db_path))
75593 - int page_size = db.page_size();
75594 - if (!GetPageSize(&db, &page_size))
75595 - return false;
75596 -
75597 - int page_number = 0;
75598 - if (!GetRootPage(&db, tree_name, &page_number))
75599 - return false;
75600 -
75601 - // SQLite uses 1-based page numbering.
75602 - const long int page_ofs = (page_number - 1) * page_size;
75603 - std::unique_ptr<char[]> page_buf(new char[page_size]);
75604 -
75605 - // Get the page into page_buf.
75606 - base::ScopedFILE file(base::OpenFile(db_path, "rb+"));
75607 - if (!file.get())
75608 - return false;
75609 - if (0 != fseek(file.get(), page_ofs, SEEK_SET))
75610 - return false;
75611 - if (1u != fread(page_buf.get(), page_size, 1, file.get()))
75612 - return false;
75613 -
75614 - // Require the page to be a leaf node. A multilevel tree would be
75615 - // very hard to restore correctly.
75616 - if (page_buf[0] != 0xD && page_buf[0] != 0xA)
75617 - return false;
75618 -
75619 - // The update has to work, and make changes.
75620 - if (!db.Execute(update_sql))
75621 - return false;
75622 - if (db.GetLastChangeCount() == 0)
75623 - return false;
75624 -
75625 - // Ensure that the database is fully flushed.
75626 + absl::optional<int> page_number = GetRootPage(db, index_name);
75627 db.Close();
75628 -
75629 - // Check that the stored page actually changed. This catches usage
75630 - // errors where |update_sql| is not related to |tree_name|.
75631 - std::unique_ptr<char[]> check_page_buf(new char[page_size]);
75632 - // The on-disk data should have changed.
75633 - if (0 != fflush(file.get()))
75634 - return false;
75635 - if (0 != fseek(file.get(), page_ofs, SEEK_SET))
75636 - return false;
75637 - if (1u != fread(check_page_buf.get(), page_size, 1, file.get()))
75638 - return false;
75639 - if (!memcmp(check_page_buf.get(), page_buf.get(), page_size))
75643 - // Put the original page back.
75644 - if (0 != fseek(file.get(), page_ofs, SEEK_SET))
75645 - return false;
75646 - if (1u != fwrite(page_buf.get(), page_size, 1, file.get()))
75647 - return false;
75651 - return true;
75659 size_t CountSQLTables(sql::Database* db) {
75660 @@ -374,5 +361,4 @@ ColumnInfo ColumnInfo::Create(sql::Database* db,
75664 -} // namespace test
75665 -} // namespace sql
75667 diff --git a/src/sql/test/test_helpers.h b/src/sql/test/test_helpers.h
75669 --- a/src/sql/test/test_helpers.h
75671 @@ -10,7 +10,7 @@
75675 -#include "base/files/file_path.h"
75678 // Collection of test-only convenience functions.
75680 @@ -22,8 +22,7 @@ namespace sql {
75684 -namespace sql {
75685 -namespace test {
75689 // OS-derived size is smaller, the database is considered corrupt.
75690 @@ -39,35 +38,19 @@ namespace test {
75694 -// Common implementation of CorruptSizeInHeader() which operates on loaded
75695 -// memory. Shared between CorruptSizeInHeader() and the the mojo proxy testing
75696 -// code.
75697 -void CorruptSizeInHeaderMemory(unsigned char* header, int64_t db_size);
75698 -
75699 // Call CorruptSizeInHeader() while holding a SQLite-compatible lock
75704 -// Frequently corruption is a result of failure to atomically update
75705 -// pages in different structures. For instance, if an index update
75706 -// takes effect but the corresponding table update does not. This
75707 -// helper restores the prior version of a b-tree root after running an
75708 -// update which changed that b-tree. The named b-tree must exist and
75709 -// must be a leaf node (either index or table). Returns true if the
75710 -// on-disk file is successfully modified, and the restored page
75711 -// differs from the updated page.
75712 -//
75713 -// The resulting database should be possible to open, and many
75714 -// statements should work. SQLITE_CORRUPT will be thrown if a query
75715 -// through the index finds the row missing in the table.
75716 +// Simulates total index corruption by zeroing the root page of an index B-tree.
75718 -// TODO(shess): It would be very helpful to allow a parameter to the
75719 -// sql statement. Perhaps a version with a string parameter would be
75720 -// sufficient, given affinity rules?
75721 -[[nodiscard]] bool CorruptTableOrIndex(const base::FilePath& db_path,
75722 - const char* tree_name,
75723 - const char* update_sql);
75732 [[nodiscard]] size_t CountSQLTables(sql::Database* db);
75733 @@ -149,7 +132,6 @@ struct ColumnInfo {
75737 -} // namespace test
75738 -} // namespace sql
75742 diff --git a/src/storage/browser/database/database_tracker.cc b/src/storage/browser/database/databa…
75744 --- a/src/storage/browser/database/database_tracker.cc
75746 @@ -63,8 +63,14 @@ const base::FilePath::CharType kTemporaryDirectoryPrefix[] =
75750 -OriginInfo::OriginInfo()
75751 - : total_size_(0) {}
75756 +const std::u16string suffixStr = base::UTF8ToUTF16(".db");
75763 @@ -184,14 +190,12 @@ void DatabaseTracker::DatabaseOpened(const std::string& origin_identifier,
75767 - *database_size = SeedOpenDatabaseInfo(origin_identifier,
75768 - database_name,
75773 - *database_size = UpdateOpenDatabaseInfoAndNotify(origin_identifier,
75774 - database_name,
75775 - &database_description);
75781 @@ -343,6 +347,13 @@ base::FilePath DatabaseTracker::GetOriginDirectory(
75792 DCHECK(task_runner_->RunsTasksInCurrentSequence());
75795 @@ -355,6 +366,7 @@ base::FilePath DatabaseTracker::GetFullDBFilePath(
75803 @@ -378,8 +390,7 @@ bool DatabaseTracker::GetAllOriginIdentifiers(
75804 return databases_table_->GetAllOriginIdentifiers(origin_identifiers);
75807 -bool DatabaseTracker::GetAllOriginsInfo(
75808 - std::vector<OriginInfo>* origins_info) {
75810 DCHECK(task_runner_->RunsTasksInCurrentSequence());
75812 DCHECK(origins_info->empty());
75813 @@ -434,7 +445,8 @@ bool DatabaseTracker::DeleteClosedDatabase(
75816 if (databases_table_->GetAllDatabaseDetailsForOriginIdentifier(
75817 - origin_identifier, &details) && details.empty()) {
75823 @@ -465,13 +477,10 @@ bool DatabaseTracker::DeleteOrigin(const std::string& origin_identifier,
75827 - base::CreateTemporaryDirInDir(db_dir_,
75828 - kTemporaryDirectoryPrefix,
75831 - base::FileEnumerator databases(
75832 - origin_dir,
75833 - false,
75834 - base::FileEnumerator::FILES);
75840 @@ -533,11 +542,9 @@ bool DatabaseTracker::LazyInit() {
75841 // If there are left-over directories from failed deletion attempts, clean
75844 - base::FileEnumerator directories(
75845 - db_dir_,
75846 - false,
75847 - base::FileEnumerator::DIRECTORIES,
75848 - kTemporaryDirectoryPattern);
75855 @@ -599,8 +606,8 @@ void DatabaseTracker::InsertOrUpdateDatabaseDetails(
75857 DCHECK(task_runner_->RunsTasksInCurrentSequence());
75859 - if (!databases_table_->GetDatabaseDetails(
75860 - origin_identifier, database_name, &details)) {
75861 + if (!databases_table_->GetDatabaseDetails(origin_identifier, database_name,
75866 @@ -617,7 +624,8 @@ void DatabaseTracker::ClearAllCachedOriginInfo() {
75870 - const std::string& origin_identifier, bool create_if_needed) {
75873 DCHECK(task_runner_->RunsTasksInCurrentSequence());
75876 @@ -663,8 +671,8 @@ DatabaseTracker::CachedOriginInfo* DatabaseTracker::MaybeGetCachedOriginInfo(
75879 DCHECK(task_runner_->RunsTasksInCurrentSequence());
75880 - base::FilePath db_file_name = GetFullDBFilePath(origin_identifier,
75881 - database_name);
75887 @@ -678,7 +686,7 @@ int64_t DatabaseTracker::SeedOpenDatabaseInfo(
75888 DCHECK(task_runner_->RunsTasksInCurrentSequence());
75891 - database_connections_.SetOpenDatabaseSize(origin_id, name, size);
75895 info->SetDatabaseSize(name, size);
75896 @@ -715,8 +723,8 @@ void DatabaseTracker::ScheduleDatabaseForDeletion(
75899 DCHECK(task_runner_->RunsTasksInCurrentSequence());
75900 - DCHECK(database_connections_.IsDatabaseOpened(origin_identifier,
75901 - database_name));
75907 @@ -954,7 +962,6 @@ void DatabaseTracker::ClearSessionOnlyOrigins() {
75911 -
75913 DCHECK(task_runner_->RunsTasksInCurrentSequence());
75915 diff --git a/src/third_party/abseil-cpp/absl/types/optional.h b/src/third_party/abseil-cpp/absl/typ…
75917 --- a/src/third_party/abseil-cpp/absl/types/optional.h
75918 +++ b/src/third_party/abseil-cpp/absl/types/optional.h
75919 @@ -35,7 +35,6 @@
75923 -#include "absl/base/config.h" // TODO(calabrese) IWYU removal?
75927 diff --git a/src/third_party/angle/BUILD.gn b/src/third_party/angle/BUILD.gn
75929 --- a/src/third_party/angle/BUILD.gn
75931 @@ -486,7 +486,7 @@ angle_static_library("angle_gpu_info_util") {
75935 - if (is_linux || is_chromeos) {
75940 diff --git a/src/third_party/angle/gni/angle.gni b/src/third_party/angle/gni/angle.gni
75942 --- a/src/third_party/angle/gni/angle.gni
75944 @@ -27,7 +27,7 @@ if (angle_has_build) {
75948 - if (is_android) {
75953 @@ -104,7 +104,7 @@ declare_args() {
75957 - if (is_android) {
75962 @@ -138,7 +138,8 @@ declare_args() {
75966 - !is_chromeos) || is_android || is_fuchsia || is_ggp || is_mac)
75971 # extensions. Content can be rendered only off-screen.
75972 @@ -146,7 +147,7 @@ declare_args() {
75976 - angle_enable_gl_desktop = !is_android && !is_ios
75981 @@ -168,7 +169,7 @@ declare_args() {
75982 # Currently SwiftShader's Vulkan front-end doesn't build on Android.
75985 - angle_enable_vulkan && !is_android && !is_ggp && is_clang
75990 @@ -185,7 +186,8 @@ declare_args() {
75994 - angle_debug_layers_enabled && (!is_android || ndk_api_level_at_least_26)
75998 # Support using glslang to generate SPIR-V for the time being for the purpose of debugging
75999 # the SPIR-V generation path, but leave it disabled on release. It's still used by the metal
76000 diff --git a/src/third_party/angle/src/common/vulkan/BUILD.gn b/src/third_party/angle/src/common/vu…
76002 --- a/src/third_party/angle/src/common/vulkan/BUILD.gn
76004 @@ -6,7 +6,7 @@ import("//build_overrides/swiftshader.gni")
76008 - angle_use_custom_libvulkan = !is_android && !is_fuchsia && !is_ggp
76013 @@ -110,7 +110,7 @@ if (angle_enable_vulkan) {
76015 … public_deps += [ "//third_party/fuchsia-sdk/sdk/pkg/vulkan_layers:VkLayer_image_pipe_swapchain" ]
76017 - } else if (!is_android && !is_ggp) {
76022 @@ -135,7 +135,7 @@ if (angle_enable_vulkan) {
76026 - if (!is_android) {
76031 diff --git a/src/third_party/angle/src/libANGLE/renderer/gl/BUILD.gn b/src/third_party/angle/src/li…
76033 --- a/src/third_party/angle/src/libANGLE/renderer/gl/BUILD.gn
76035 @@ -125,7 +125,8 @@ if (angle_use_x11) {
76039 -if (is_android || is_linux || is_chromeos) {
76045 @@ -264,7 +265,8 @@ angle_source_set("angle_gl_backend") {
76049 - if (is_android || is_linux || is_chromeos) {
76055 diff --git a/src/third_party/angle/src/libANGLE/renderer/vulkan/ContextVk.h b/src/third_party/angle…
76057 --- a/src/third_party/angle/src/libANGLE/renderer/vulkan/ContextVk.h
76059 @@ -1272,7 +1272,7 @@ ANGLE_INLINE bool UseLineRaster(const ContextVk *contextVk, gl::PrimitiveMode…
76063 - char ANGLE_MESSAGE[100]; \
76066 ANGLE_PERF_WARNING(contextVk->getDebug(), severity, ANGLE_MESSAGE); \
76068 @@ -1283,7 +1283,7 @@ ANGLE_INLINE bool UseLineRaster(const ContextVk *contextVk, gl::PrimitiveMode…
76072 - char ANGLE_MESSAGE[100]; \
76077 diff --git a/src/third_party/angle/src/libGLESv2.gni b/src/third_party/angle/src/libGLESv2.gni
76079 --- a/src/third_party/angle/src/libGLESv2.gni
76081 @@ -87,7 +87,7 @@ xxhash_sources = [
76085 -if (is_linux || is_chromeos || is_android || is_fuchsia) {
76090 diff --git a/src/third_party/angle/src/tests/BUILD.gn b/src/third_party/angle/src/tests/BUILD.gn
76092 --- a/src/third_party/angle/src/tests/BUILD.gn
76094 @@ -12,8 +12,8 @@ declare_args() {
76098 - build_angle_perftests =
76099 - is_win || is_linux || is_chromeos || is_android || is_apple || is_fuchsia
76105 @@ -209,7 +209,8 @@ angle_test("angle_unittests") {
76109 -if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple) {
76115 @@ -298,7 +299,8 @@ if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple) {
76119 -if (is_win || is_linux || is_chromeos || is_android || is_fuchsia || is_apple) {
76125 @@ -377,7 +379,7 @@ angle_perftests_common("angle_perftests_static") {
76129 -if (is_win || is_linux || is_chromeos || is_android || is_apple) {
76134 diff --git a/src/third_party/blink/common/web_preferences/web_preferences.cc b/src/third_party/blin…
76136 --- a/src/third_party/blink/common/web_preferences/web_preferences.cc
76138 @@ -13,6 +13,11 @@
76150 @@ -119,7 +124,7 @@ WebPreferences::WebPreferences()
76154 -#if defined(OS_ANDROID)
76159 @@ -153,13 +158,13 @@ WebPreferences::WebPreferences()
76163 -#if defined(OS_ANDROID) || defined(OS_MAC)
76170 -#if !defined(OS_ANDROID)
76175 @@ -192,6 +197,9 @@ WebPreferences::WebPreferences()
76185 @@ -217,6 +225,28 @@ WebPreferences::WebPreferences()
76198 + display_manager_adapter->GetDefaultDisplay();
76203 + float ratio = display->GetVirtualPixelRatio();
76214 diff --git a/src/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/src/thi…
76216 --- a/src/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
76218 @@ -165,7 +165,7 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
76219 out->double_tap_to_zoom_enabled = data.double_tap_to_zoom_enabled();
76220 out->fullscreen_supported = data.fullscreen_supported();
76221 out->text_autosizing_enabled = data.text_autosizing_enabled();
76222 -#if defined(OS_ANDROID)
76224 out->font_scale_factor = data.font_scale_factor();
76225 out->device_scale_adjustment = data.device_scale_adjustment();
76226 out->force_enable_zoom = data.force_enable_zoom();
76227 @@ -221,6 +221,7 @@ bool StructTraits<blink::mojom::WebPreferencesDataView,
76228 out->always_show_focus = data.always_show_focus();
76229 out->touch_drag_drop_enabled = data.touch_drag_drop_enabled();
76230 out->webxr_immersive_ar_allowed = data.webxr_immersive_ar_allowed();
76231 + out->pinch_smooth_mode = data.pinch_smooth_mode();
76235 diff --git a/src/third_party/blink/public/common/web_preferences/web_preferences.h b/src/third_part…
76237 --- a/src/third_party/blink/public/common/web_preferences/web_preferences.h
76239 @@ -219,7 +219,7 @@ struct BLINK_COMMON_EXPORT WebPreferences {
76243 -#if defined(OS_ANDROID)
76248 @@ -352,6 +352,7 @@ struct BLINK_COMMON_EXPORT WebPreferences {
76249 // By default, WebXR's immersive-ar session creation is allowed, but this can
76256 diff --git a/src/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/s…
76258 --- a/src/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
76260 @@ -546,7 +546,7 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
76264 -#if defined(OS_ANDROID)
76269 @@ -767,6 +767,10 @@ struct BLINK_COMMON_EXPORT StructTraits<blink::mojom::WebPreferencesDataView,
76280 diff --git a/src/third_party/blink/public/mojom/frame/frame.mojom b/src/third_party/blink/public/mo…
76282 --- a/src/third_party/blink/public/mojom/frame/frame.mojom
76284 @@ -76,6 +76,9 @@ import "ui/gfx/range/mojom/range.mojom";
76294 @@ -830,6 +833,11 @@ interface LocalFrame {
76295 // Requests the link-rel calnonical URL. The canonical url could be null if
76305 // Also implemented in Blink, this interface defines frame-specific methods
76306 diff --git a/src/third_party/blink/public/mojom/input/input_handler.mojom b/src/third_party/blink/p…
76308 --- a/src/third_party/blink/public/mojom/input/input_handler.mojom
76310 @@ -424,6 +424,9 @@ interface WidgetInputHandler {
76317 // Sends a non-blocking input event to the render widget. The behaviour
76320 diff --git a/src/third_party/blink/public/mojom/webpreferences/web_preferences.mojom b/src/third_pa…
76322 --- a/src/third_party/blink/public/mojom/webpreferences/web_preferences.mojom
76324 @@ -270,85 +270,85 @@ struct WebPreferences {
76328 - [EnableIf=is_android]
76332 - [EnableIf=is_android]
76336 - [EnableIf=is_android]
76340 - [EnableIf=is_android]
76344 - [EnableIf=is_android]
76348 - [EnableIf=is_android]
76352 - [EnableIf=is_android]
76356 - [EnableIf=is_android]
76360 - [EnableIf=is_android]
76364 - [EnableIf=is_android]
76368 - [EnableIf=is_android]
76372 - [EnableIf=is_android]
76376 - [EnableIf=is_android]
76380 - [EnableIf=is_android]
76384 - [EnableIf=is_android]
76389 // a top-level initial empty document and expect it to persist on navigation.
76390 - [EnableIf=is_android]
76396 - [EnableIf=is_android]
76401 - [EnableIf=is_android]
76407 - [EnableIf=is_android]
76411 - [EnableIf=is_android]
76417 - [EnableIf=is_android]
76424 - [EnableIf=is_android]
76428 - [EnableIf=is_android]
76433 @@ -436,4 +436,5 @@ struct WebPreferences {
76435 // Controls whether WebXR's immersive-ar is allowed.
76439 diff --git a/src/third_party/blink/public/mojom/webshare/webshare.mojom b/src/third_party/blink/pub…
76441 --- a/src/third_party/blink/public/mojom/webshare/webshare.mojom
76443 @@ -5,12 +5,13 @@
76453 - string name;
76458 diff --git a/src/third_party/blink/public/platform/media/video_frame_compositor.h b/src/third_party…
76460 --- a/src/third_party/blink/public/platform/media/video_frame_compositor.h
76462 @@ -71,6 +71,10 @@ class BLINK_PLATFORM_EXPORT VideoFrameCompositor
76473 @@ -122,6 +126,9 @@ class BLINK_PLATFORM_EXPORT VideoFrameCompositor
76483 @@ -256,6 +263,9 @@ class BLINK_PLATFORM_EXPORT VideoFrameCompositor
76493 diff --git a/src/third_party/blink/public/platform/media/web_media_player_impl.h b/src/third_party/…
76495 --- a/src/third_party/blink/public/platform/media/web_media_player_impl.h
76497 @@ -856,7 +856,7 @@ class BLINK_PLATFORM_EXPORT WebMediaPlayerImpl
76501 -#if defined(OS_ANDROID)
76506 diff --git a/src/third_party/blink/renderer/BUILD.gn b/src/third_party/blink/renderer/BUILD.gn
76508 --- a/src/third_party/blink/renderer/BUILD.gn
76510 @@ -49,6 +49,10 @@ config("inside_blink") {
76511 "-Wno-implicit-float-conversion",
76512 "-Wno-implicit-int-conversion",
76516 + cflags += [ "-Wno-invalid-constexpr" ]
76521 @@ -131,7 +135,7 @@ config("config") {
76525 - if (is_clang) {
76527 cflags += [ "-Wglobal-constructors" ]
76530 diff --git a/src/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc b/src/third_party/…
76532 --- a/src/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc
76534 @@ -59,6 +59,9 @@
76544 @@ -536,6 +539,9 @@ ScriptEvaluationResult V8ScriptRunner::CompileAndRunScript(
76554 diff --git a/src/third_party/blink/renderer/config.gni b/src/third_party/blink/renderer/config.gni
76556 --- a/src/third_party/blink/renderer/config.gni
76558 @@ -40,10 +40,11 @@ declare_args() {
76559 blink_symbol_level = -1
76562 - use_low_quality_image_interpolation = is_android
76566 - use_webaudio_ffmpeg = !is_mac && !is_android && !use_webaudio_pffft
76572 diff --git a/src/third_party/blink/renderer/core/BUILD.gn b/src/third_party/blink/renderer/core/BUI…
76574 --- a/src/third_party/blink/renderer/core/BUILD.gn
76576 @@ -72,6 +72,15 @@ import("//third_party/blink/renderer/core/xmlhttprequest/build.gni")
76592 @@ -277,6 +286,9 @@ component("core") {
76602 @@ -1603,6 +1615,12 @@ source_set("unit_tests") {
76609 + configs -= [ "//build/config:ohos_nweb_ex_def_main" ]
76615 diff --git a/src/third_party/blink/renderer/core/css/css_variable_data.cc b/src/third_party/blink/r…
76617 --- a/src/third_party/blink/renderer/core/css/css_variable_data.cc
76619 @@ -4,6 +4,7 @@
76627 @@ -109,6 +110,51 @@ void CSSVariableData::ConsumeAndUpdateTokens(const CSSParserTokenRange& range)…
76679 @@ -120,6 +166,9 @@ CSSVariableData::CSSVariableData(const CSSTokenizedValue& tokenized_value,
76689 diff --git a/src/third_party/blink/renderer/core/css/css_variable_data.h b/src/third_party/blink/re…
76691 --- a/src/third_party/blink/renderer/core/css/css_variable_data.h
76693 @@ -99,11 +99,18 @@ class CORE_EXPORT CSSVariableData : public RefCounted<CSSVariableData> {
76697 - charset_(charset) {}
76713 diff --git a/src/third_party/blink/renderer/core/css/parser/css_tokenizer.h b/src/third_party/blink…
76715 --- a/src/third_party/blink/renderer/core/css/parser/css_tokenizer.h
76717 @@ -33,6 +33,7 @@ class CORE_EXPORT CSSTokenizer {
76725 diff --git a/src/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc b/src/third_pa…
76727 --- a/src/third_party/blink/renderer/core/css/properties/css_parsing_utils.cc
76729 @@ -3328,9 +3328,11 @@ bool ParseBackgroundOrMask(bool important,
76741 diff --git a/src/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/src/thir…
76743 --- a/src/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
76745 @@ -2147,6 +2147,10 @@ StyleBuilderConverter::ConvertRegisteredPropertyVariableData(
76756 diff --git a/src/third_party/blink/renderer/core/dom/document.cc b/src/third_party/blink/renderer/c…
76758 --- a/src/third_party/blink/renderer/core/dom/document.cc
76760 @@ -4089,20 +4089,44 @@ void Document::UpdateBaseURL() {
76764 +// [spec] https://html.spec.whatwg.org/C/#fallback-base-url
76767 + GetFrame() && GetFrame()->IsCrossOriginToParentFrame();
76770 + // We avoid using it when it is cross-origin, to avoid leaking cross-origin.
76778 - // TODO(tkent): Referring to ParentDocument() is not correct. See
76779 - // crbug.com/751329.
76780 - if (Document* parent = ParentDocument())
76784 return parent->BaseURL();
76785 - } else if (urlForBinding().IsAboutBlankURL()) {
76786 - if (!dom_window_ && execution_context_)
76794 + // context's creator base URL is non-null, then return that creator
76798 return execution_context_->BaseURL();
76799 - // TODO(tkent): Referring to ParentDocument() is not correct. See
76800 - // crbug.com/751329.
76801 - if (Document* parent = ParentDocument())
76802 - return parent->BaseURL();
76806 + return same_origin_parent->BaseURL();
76814 diff --git a/src/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc b/src/third…
76816 --- a/src/third_party/blink/renderer/core/editing/commands/clipboard_commands.cc
76818 @@ -52,6 +52,10 @@
76829 @@ -473,6 +477,9 @@ bool ClipboardCommands::ExecutePaste(LocalFrame& frame,
76839 diff --git a/src/third_party/blink/renderer/core/editing/frame_selection.cc b/src/third_party/blink…
76841 --- a/src/third_party/blink/renderer/core/editing/frame_selection.cc
76843 @@ -90,6 +90,15 @@
76859 @@ -1004,6 +1013,16 @@ static String ExtractSelectedText(const FrameSelection& selection,
76868 + element->dataset().SetItem("ohos", "clipboard", exception_state);
76876 diff --git a/src/third_party/blink/renderer/core/exported/web_view_impl.cc b/src/third_party/blink/…
76878 --- a/src/third_party/blink/renderer/core/exported/web_view_impl.cc
76880 @@ -1618,7 +1618,7 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
76882 settings->SetWebAppScope(WebString::FromASCII(prefs.web_app_scope.spec()));
76884 -#if BUILDFLAG(IS_ANDROID)
76886 settings->SetAllowCustomScrollbarInMainFrame(false);
76887 settings->SetAccessibilityFontScaleFactor(prefs.font_scale_factor);
76888 settings->SetDeviceScaleAdjustment(prefs.device_scale_adjustment);
76889 @@ -1811,6 +1811,8 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs,
76894 + web_view_impl->SetPinchSmoothMode(prefs.pinch_smooth_mode);
76898 @@ -2654,6 +2656,22 @@ PageScaleConstraintsSet& WebViewImpl::GetPageScaleConstraintsSet() const {
76899 return GetPage()->GetPageScaleConstraintsSet();
76903 + if (!MainFrame() || !GetPage() || !GetPage()->MainFrame() ||
76904 + !GetPage()->MainFrame()->IsLocalFrame() ||
76905 + !GetPage()->DeprecatedLocalMainFrame()->View()) {
76914 + MainFrameImpl()->FrameWidgetImpl()->SetPinchSmoothMode(isEnable);
76919 if (!MainFrame() || !GetPage() || !GetPage()->MainFrame() ||
76920 !GetPage()->MainFrame()->IsLocalFrame() ||
76921 diff --git a/src/third_party/blink/renderer/core/exported/web_view_impl.h b/src/third_party/blink/r…
76923 --- a/src/third_party/blink/renderer/core/exported/web_view_impl.h
76925 @@ -633,6 +633,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
76933 @@ -862,6 +863,8 @@ class CORE_EXPORT WebViewImpl final : public WebView,
76942 diff --git a/src/third_party/blink/renderer/core/frame/local_dom_window.cc b/src/third_party/blink/…
76944 --- a/src/third_party/blink/renderer/core/frame/local_dom_window.cc
76946 @@ -143,7 +143,9 @@
76950 -
76957 @@ -1597,10 +1599,35 @@ ScriptPromise LocalDOMWindow::getComputedAccessibleNode(
76970 + auto display = display_manager_adapter->GetDefaultDisplay();
76975 + ratio = display->GetVirtualPixelRatio();
76988 return GetFrame()->DevicePixelRatio();
76993 diff --git a/src/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc b/src/third_part…
76995 --- a/src/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc
76997 @@ -1288,6 +1288,78 @@ void LocalFrameMojoHandler::UpdateBrowserControlsState(
77005 + // auto* local_frame = DynamicTo<LocalFrame>(frame_->GetPage()->MainFrame());
77012 + blink::Document* document = frame_->GetDocument();
77015 + // Client()->OnGetImageDataForUrl(url, 0, nullptr);
77020 + DocumentLoader* loader = document->Loader();
77023 + // Client()->OnGetImageDataForUrl(url, 0, nullptr);
77029 + loader->OnGetImageFromCache(url);
77032 + // Client()->OnGetImageDataForUrl(url, 0, nullptr);
77038 + base::WritableSharedMemoryRegion::Create(resource_buffer->size());
77041 + // Client()->OnGetImageDataForUrl(url, 0, nullptr);
77049 + // Client()->OnGetImageDataForUrl(url, 0, nullptr);
77054 + bool finished = resource_buffer->GetBytes(const_cast<void*>(mapping.memory()),
77055 + resource_buffer->size());
77059 + << resource_buffer->size();
77060 + // Client()->OnGetImageDataForUrl(url, 0, nullptr);
77067 + // Client()->OnGetImageDataForUrl(url, resource_buffer->size(), &ro_region);
77068 + std::move(callback).Run(static_cast<uint32_t>(resource_buffer->size()), std::move(ro_region));
77076 diff --git a/src/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h b/src/third_party…
77078 --- a/src/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h
77080 @@ -220,6 +220,10 @@ class LocalFrameMojoHandler
77091 diff --git a/src/third_party/blink/renderer/core/frame/local_frame_view.cc b/src/third_party/blink/…
77093 --- a/src/third_party/blink/renderer/core/frame/local_frame_view.cc
77095 @@ -230,13 +230,47 @@ constexpr int kCommitDelayDefaultInMs = 500; // 30 frames @ 60hz
77110 + display_manager_adapter_->GetDefaultDisplay();
77115 + ratio = display->GetVirtualPixelRatio();
77143 @@ -297,6 +331,9 @@ LocalFrameView::LocalFrameView(LocalFrame& frame, gfx::Rect frame_rect)
77151 if (frame_->Owner() && frame_->Owner()->ScrollbarMode() ==
77153 @@ -800,6 +837,7 @@ void LocalFrameView::PerformLayout() {
77158 LayoutBlock* cb = root->ContainingNGBlock();
77161 @@ -819,7 +857,7 @@ void LocalFrameView::PerformLayout() {
77165 - if (LayoutObject* container = root->Container())
77167 container->SetShouldCheckForPaintInvalidation();
77170 @@ -1373,7 +1411,12 @@ void LocalFrameView::SetLayoutSize(const gfx::Size& size) {
77171 frame_->GetDocument()->Lifecycle().LifecyclePostponed())
77183 diff --git a/src/third_party/blink/renderer/core/frame/local_frame_view.h b/src/third_party/blink/r…
77185 --- a/src/third_party/blink/renderer/core/frame/local_frame_view.h
77187 @@ -58,6 +58,11 @@
77199 @@ -754,6 +759,10 @@ class CORE_EXPORT LocalFrameView final
77210 @@ -1149,6 +1158,12 @@ class CORE_EXPORT LocalFrameView final
77223 diff --git a/src/third_party/blink/renderer/core/frame/web_frame_test.cc b/src/third_party/blink/re…
77225 --- a/src/third_party/blink/renderer/core/frame/web_frame_test.cc
77227 @@ -6528,9 +6528,14 @@ class CompositedSelectionBoundsTest
77231 - ASSERT_TRUE(layer_owner_node_for_start);
77232 - int start_layer_id = LayerIdFromNode(layer_tree_host->root_layer(),
77233 - layer_owner_node_for_start);
77239 + start_layer_id = LayerIdFromNode(layer_tree_host->root_layer(),
77245 @@ -6552,9 +6557,15 @@ class CompositedSelectionBoundsTest
77249 - ASSERT_TRUE(layer_owner_node_for_end);
77250 - int end_layer_id = LayerIdFromNode(layer_tree_host->root_layer(),
77251 - layer_owner_node_for_end);
77257 + end_layer_id = LayerIdFromNode(layer_tree_host->root_layer(),
77264 @@ -6689,6 +6700,12 @@ TEST_F(CompositedSelectionBoundsTest, SVGBasic) {
77277 diff --git a/src/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc b/src/third_party/b…
77279 --- a/src/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
77281 @@ -1471,8 +1471,12 @@ void WebFrameWidgetImpl::UpdateVisualProperties(
77294 @@ -2430,10 +2434,15 @@ WebInputEventResult WebFrameWidgetImpl::HandleInputEvent(
77305 - if (ForMainFrame()) {
77307 GetPage()->GetVisualViewport().StartTrackingPinchStats();
77308 - }
77310 // If a drag-and-drop operation is in progress, ignore input events except
77312 @@ -3880,13 +3889,18 @@ void WebFrameWidgetImpl::NotifyPageScaleFactorChanged(
77317 + widget_base_->LayerTreeHost()->SetPinchSmoothMode(isEnable);
77325 - widget_base_->LayerTreeHost()->SetPageScaleFactorAndLimits(page_scale_factor,
77326 - minimum, maximum);
77327 + if (widget_base_->LayerTreeHost()) {
77328 + widget_base_->LayerTreeHost()->SetPageScaleFactorAndLimits(page_scale_factor, minimum, maximum…
77333 diff --git a/src/third_party/blink/renderer/core/frame/web_frame_widget_impl.h b/src/third_party/bl…
77335 --- a/src/third_party/blink/renderer/core/frame/web_frame_widget_impl.h
77337 @@ -546,6 +546,7 @@ class CORE_EXPORT WebFrameWidgetImpl
77345 diff --git a/src/third_party/blink/renderer/core/html/custom/custom_element_registry.cc b/src/third…
77347 --- a/src/third_party/blink/renderer/core/html/custom/custom_element_registry.cc
77349 @@ -217,8 +217,11 @@ CustomElementDefinition* CustomElementRegistry::DefineInternal(
77350 // 16: when-defined promise processing
77353 - entry->value->Resolve();
77354 + ScriptPromiseResolver* resolver = entry->value;
77358 + resolver->Resolve(definition->GetConstructorForScript());
77362 @@ -299,8 +302,10 @@ ScriptPromise CustomElementRegistry::whenDefined(
77366 - if (definition)
77367 - return ScriptPromise::CastUndefined(script_state);
77370 + definition->GetConstructorForScript());
77374 return it->value->Promise();
77375 diff --git a/src/third_party/blink/renderer/core/layout/build.gni b/src/third_party/blink/renderer/…
77377 --- a/src/third_party/blink/renderer/core/layout/build.gni
77379 @@ -771,7 +771,7 @@ if (is_linux || is_chromeos) {
77383 -if (is_android) {
77388 diff --git a/src/third_party/blink/renderer/core/layout/layout_video.cc b/src/third_party/blink/ren…
77390 --- a/src/third_party/blink/renderer/core/layout/layout_video.cc
77392 @@ -28,6 +28,9 @@
77402 @@ -38,10 +41,17 @@ const float kInitEffectZoom = 1.0f;
77412 -LayoutVideo::~LayoutVideo() = default;
77415 + soc_perf::video_layout_num--;
77421 diff --git a/src/third_party/blink/renderer/core/loader/document_loader.cc b/src/third_party/blink/…
77423 --- a/src/third_party/blink/renderer/core/loader/document_loader.cc
77425 @@ -131,6 +131,12 @@
77438 @@ -2828,6 +2834,72 @@ void DocumentLoader::DisableCodeCacheForTesting() {
77448 + HTMLImageElement* element = To<ImageDocument>(document)->ImageElement();
77454 + ImageResourceContent* content = element->CachedImage();
77460 + blink::Image* image = content->GetImage();
77461 + if (!image || image->IsNull()) {
77466 + return image->Data();
77475 + resource = GetMemoryCache()->ResourceForURL(
77476 + kurl, frame_->GetDocument()->Fetcher()->GetCacheIdentifier(kurl));
77480 + GetMemoryCache()->ResourcesForURL(kurl);
77485 + resources = GetMemoryCache()->ResourcesForURL(kurl);
77492 + if (!resource && frame_ && frame_->GetDocument() &&
77493 + frame_->GetDocument()->IsImageDocument() &&
77494 + frame_->GetDocument()->Url() == url) {
77495 + return GetShareBufferForImageDocument(frame_->GetDocument());
77504 + return resource->ResourceBuffer();
77511 diff --git a/src/third_party/blink/renderer/core/loader/document_loader.h b/src/third_party/blink/r…
77513 --- a/src/third_party/blink/renderer/core/loader/document_loader.h
77515 @@ -371,6 +371,9 @@ class CORE_EXPORT DocumentLoader : public GarbageCollected<DocumentLoader>,
77525 diff --git a/src/third_party/blink/renderer/core/page/context_menu_controller.cc b/src/third_party/…
77527 --- a/src/third_party/blink/renderer/core/page/context_menu_controller.cc
77529 @@ -86,6 +86,14 @@
77544 @@ -134,6 +142,15 @@ template <class enumType>
77560 @@ -430,6 +447,9 @@ bool ContextMenuController::ShowContextMenu(LocalFrame* frame,
77570 @@ -481,6 +501,62 @@ bool ContextMenuController::ShowContextMenu(LocalFrame* frame,
77578 + if (inner_node && inner_node->IsContainerNode() &&
77593 + } else if (node->firstChild() &&
77594 + IsA<HTMLImageElement>(node->firstChild())) {
77595 + img_element = To<HTMLImageElement>(node->firstChild());
77599 + AtomicString img_src = img_element->getAttribute(html_names::kSrcAttr);
77601 + data.src_url = inner_node->GetDocument().CompleteURL(
77611 + const ComputedStyle* style = node->GetComputedStyle();
77612 + if (!style || !style->HasBackgroundImage()) {
77617 + style->BackgroundLayers().GetImage()->ComputedCSSValue(*style, false);
77618 + if (value && value->IsURIValue()) {
77620 + DynamicTo<cssvalue::CSSURIValue>(*value)->ValueForSerialization();
77622 + } else if (value && value->IsImageValue()) {
77623 + background_url = DynamicTo<CSSImageValue>(*value)->Url();
77632 data.title_text = html_element->title().Utf8();
77633 @@ -535,6 +611,14 @@ bool ContextMenuController::ShowContextMenu(LocalFrame* frame,
77635 if (media_element->ShouldShowAllControls())
77640 + result.InnerNode()->GetDocument().CompleteURL(background_url);
77648 diff --git a/src/third_party/blink/renderer/core/page/create_window.cc b/src/third_party/blink/rend…
77650 --- a/src/third_party/blink/renderer/core/page/create_window.cc
77652 @@ -379,9 +379,13 @@ Frame* CreateNewWindow(LocalFrame& opener_frame,
77654 gfx::Rect rect = page->GetChromeClient().CalculateWindowRectWithAdjustment(
77659 page->GetChromeClient().Show(opener_frame.GetLocalFrameToken(),
77666 diff --git a/src/third_party/blink/renderer/core/page/drag_data.cc b/src/third_party/blink/renderer…
77668 --- a/src/third_party/blink/renderer/core/page/drag_data.cc
77670 @@ -131,8 +131,8 @@ DocumentFragment* DragData::AsFragment(LocalFrame* frame) const {
77671 platform_drag_data_->HtmlAndBaseURL(html, base_url);
77672 DCHECK(frame->GetDocument());
77674 - CreateFragmentFromMarkup(*frame->GetDocument(), html, base_url,
77675 - kDisallowScriptingAndPluginContent))
77677 + *frame->GetDocument(), html, 0, html.length(), base_url))
77681 diff --git a/src/third_party/blink/renderer/core/paint/paint_timing.cc b/src/third_party/blink/rend…
77683 --- a/src/third_party/blink/renderer/core/paint/paint_timing.cc
77685 @@ -106,6 +106,7 @@ void PaintTiming::MarkFirstPaint() {
77690 SetFirstPaint(clock_->NowTicks());
77693 @@ -118,6 +119,7 @@ void PaintTiming::MarkFirstContentfulPaint() {
77698 SetFirstContentfulPaint(clock_->NowTicks());
77701 @@ -126,6 +128,7 @@ void PaintTiming::MarkFirstImagePaint() {
77704 first_image_paint_ = clock_->NowTicks();
77709 diff --git a/src/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc b/src/third_par…
77711 --- a/src/third_party/blink/renderer/core/paint/selection_bounds_recorder.cc
77713 @@ -126,6 +126,11 @@ SelectionBoundsRecorder::SelectionBoundsRecorder(
77725 @@ -172,7 +177,7 @@ bool SelectionBoundsRecorder::ShouldRecordSelection(
77729 - if (state == SelectionState::kInside || state == SelectionState::kNone)
77734 diff --git a/src/third_party/blink/renderer/core/testing/data/composited_selection_bounds_large_sel…
77737 --- /dev/null
77739 @@ -0,0 +1,33 @@
77741 + @font-face {
77742 + font-family: ahem;
77746 + font-family: ahem;
77773 diff --git a/src/third_party/blink/renderer/core/testing/data/composited_selection_bounds_large_sel…
77776 --- /dev/null
77778 @@ -0,0 +1,33 @@
77780 + @font-face {
77781 + font-family: ahem;
77785 + font-family: ahem;
77812 diff --git a/src/third_party/blink/renderer/modules/BUILD.gn b/src/third_party/blink/renderer/modul…
77814 --- a/src/third_party/blink/renderer/modules/BUILD.gn
77816 @@ -199,6 +199,12 @@ component("modules") {
77818 configs -= [ "//build/config/compiler:default_symbols" ]
77823 + configs -= [ "//build/config:ohos_nweb_ex_def_main" ]
77829 diff --git a/src/third_party/blink/renderer/modules/breakout_box/frame_queue_transferring_optimizer…
77831 --- a/src/third_party/blink/renderer/modules/breakout_box/frame_queue_transferring_optimizer.cc
77833 @@ -18,10 +18,13 @@ FrameQueueTransferringOptimizer<NativeFrameType>::
77837 - ConnectHostCallback connect_host_callback)
77848 @@ -39,7 +42,8 @@ FrameQueueTransferringOptimizer<NativeFrameType>::PerformInProcessOptimization(
77852 - script_state, host, host_runner_);
77858 diff --git a/src/third_party/blink/renderer/modules/breakout_box/frame_queue_transferring_optimizer…
77860 --- a/src/third_party/blink/renderer/modules/breakout_box/frame_queue_transferring_optimizer.h
77862 @@ -25,13 +25,15 @@ class FrameQueueTransferringOptimizer final
77866 - TransferredFrameQueueUnderlyingSource<NativeFrameType>*)>;
77874 - ConnectHostCallback callback);
77880 @@ -41,6 +43,7 @@ class FrameQueueTransferringOptimizer final
77888 diff --git a/src/third_party/blink/renderer/modules/breakout_box/frame_queue_underlying_source.cc b…
77890 --- a/src/third_party/blink/renderer/modules/breakout_box/frame_queue_underlying_source.cc
77892 @@ -266,15 +266,22 @@ double FrameQueueUnderlyingSource<NativeFrameType>::DesiredSizeForTesting()
77896 - FrameQueueUnderlyingSource<NativeFrameType>* transferred_source) {
77899 DCHECK(realm_task_runner_->RunsTasksInCurrentSequence());
77902 - transferred_source_ = transferred_source;
77916 DCHECK(realm_task_runner_->RunsTasksInCurrentSequence());
77917 diff --git a/src/third_party/blink/renderer/modules/breakout_box/frame_queue_underlying_source.h b/…
77919 --- a/src/third_party/blink/renderer/modules/breakout_box/frame_queue_underlying_source.h
77921 @@ -84,7 +84,13 @@ class FrameQueueUnderlyingSource
77925 - FrameQueueUnderlyingSource<NativeFrameType>* transferred_source);
77936 diff --git a/src/third_party/blink/renderer/modules/breakout_box/media_stream_audio_track_underlyin…
77938 --- a/src/third_party/blink/renderer/modules/breakout_box/media_stream_audio_track_underlying_sourc…
77940 @@ -93,14 +93,17 @@ MediaStreamAudioTrackUnderlyingSource::GetTransferringOptimizer() {
77952 - TransferredAudioDataQueueUnderlyingSource* source) {
77955 - TransferSource(source);
77960 diff --git a/src/third_party/blink/renderer/modules/breakout_box/media_stream_audio_track_underlyin…
77962 --- a/src/third_party/blink/renderer/modules/breakout_box/media_stream_audio_track_underlying_sourc…
77964 @@ -56,7 +56,7 @@ class MODULES_EXPORT MediaStreamAudioTrackUnderlyingSource
77968 - TransferredAudioDataQueueUnderlyingSource* source);
77973 diff --git a/src/third_party/blink/renderer/modules/breakout_box/media_stream_video_track_underlyin…
77975 --- a/src/third_party/blink/renderer/modules/breakout_box/media_stream_video_track_underlying_sourc…
77977 @@ -68,6 +68,9 @@ MediaStreamVideoTrackUnderlyingSource::GetStreamTransferOptimizer() {
77987 @@ -78,9 +81,9 @@ MediaStreamVideoTrackUnderlyingSource::GetIOTaskRunner() {
77991 - TransferredVideoFrameQueueUnderlyingSource* source) {
77994 - TransferSource(source);
77999 diff --git a/src/third_party/blink/renderer/modules/breakout_box/media_stream_video_track_underlyin…
78001 --- a/src/third_party/blink/renderer/modules/breakout_box/media_stream_video_track_underlying_sourc…
78003 @@ -60,8 +60,9 @@ class MODULES_EXPORT MediaStreamVideoTrackUnderlyingSource
78007 - void OnSourceTransferStarted(scoped_refptr<base::SequencedTaskRunner>,
78008 - TransferredVideoFrameQueueUnderlyingSource*);
78015 diff --git a/src/third_party/blink/renderer/modules/breakout_box/transferred_frame_queue_underlying…
78017 --- a/src/third_party/blink/renderer/modules/breakout_box/transferred_frame_queue_underlying_source…
78019 @@ -15,11 +15,14 @@ template <typename NativeFrameType>
78023 - FrameQueueHost* host,
78024 - scoped_refptr<base::SequencedTaskRunner> host_runner)
78030 - host_(host) {}
78037 @@ -44,6 +47,13 @@ void TransferredFrameQueueUnderlyingSource<
78051 diff --git a/src/third_party/blink/renderer/modules/breakout_box/transferred_frame_queue_underlying…
78053 --- a/src/third_party/blink/renderer/modules/breakout_box/transferred_frame_queue_underlying_source…
78055 @@ -19,8 +19,9 @@ class TransferredFrameQueueUnderlyingSource
78059 - FrameQueueHost*,
78060 - scoped_refptr<base::SequencedTaskRunner> host_runner);
78067 @@ -32,11 +33,15 @@ class TransferredFrameQueueUnderlyingSource
78083 diff --git a/src/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.cc b/src…
78085 --- a/src/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.cc
78087 @@ -643,16 +643,20 @@ PeerConnectionTracker::PeerConnectionTracker(
78108 diff --git a/src/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.h b/src/…
78110 --- a/src/third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.h
78112 @@ -14,6 +14,7 @@
78120 @@ -256,6 +257,11 @@ class MODULES_EXPORT PeerConnectionTracker
78125 + visitor->Trace(receiver_);
78132 @@ -324,7 +330,9 @@ class MODULES_EXPORT PeerConnectionTracker
78136 - mojo::Receiver<blink::mojom::blink::PeerConnectionManager> receiver_{this};
78143 diff --git a/src/third_party/blink/renderer/modules/webdatabase/database_tracker.cc b/src/third_par…
78145 --- a/src/third_party/blink/renderer/modules/webdatabase/database_tracker.cc
78147 @@ -50,6 +50,10 @@
78158 @@ -78,9 +82,19 @@ bool DatabaseTracker::CanEstablishDatabase(DatabaseContext* database_context,
78164 + String(Platform::Current()->DatabaseCreateOriginIdentifier(
78169 + return fileName + "/" + name + ".db";
78171 return String(Platform::Current()->DatabaseCreateOriginIdentifier(
78178 diff --git a/src/third_party/blink/renderer/modules/webdatabase/sqlite/sqlite_database.cc b/src/thi…
78180 --- a/src/third_party/blink/renderer/modules/webdatabase/sqlite/sqlite_database.cc
78182 @@ -46,10 +46,14 @@ std::tuple<int, sqlite3*> OpenDatabase(const String& filename) {
78197 diff --git a/src/third_party/blink/renderer/modules/webshare/DEPS b/src/third_party/blink/renderer/…
78200 --- /dev/null
78202 @@ -0,0 +1,3 @@
78207 diff --git a/src/third_party/blink/renderer/modules/webshare/navigator_share.cc b/src/third_party/b…
78209 --- a/src/third_party/blink/renderer/modules/webshare/navigator_share.cc
78211 @@ -7,10 +7,12 @@
78218 #include "third_party/blink/public/mojom/devtools/console_message.mojom-blink.h"
78219 …#include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-blink…
78224 @@ -287,9 +289,20 @@ ScriptPromise NavigatorShare::share(ScriptState* script_state,
78226 files.ReserveInitialCapacity(data->files().size());
78227 for (const blink::Member<blink::File>& file : data->files()) {
78229 + base::SafeBaseName::Create(StringToFilePath(file->name()));
78231 + execution_context->AddConsoleMessage(
78239 total_bytes += file->size();
78240 - files.push_back(mojom::blink::SharedFile::New(file->name(),
78241 - file->GetBlobDataHandle()));
78243 + mojom::blink::SharedFile::New(*name, file->GetBlobDataHandle()));
78247 diff --git a/src/third_party/blink/renderer/modules/webshare/navigator_share_test.cc b/src/third_pa…
78249 --- a/src/third_party/blink/renderer/modules/webshare/navigator_share_test.cc
78251 @@ -9,6 +9,7 @@
78259 @@ -185,7 +186,8 @@ TEST_F(NavigatorShareTest, ShareFile) {
78263 - EXPECT_EQ(mock_share_service().files()[0]->name, file_name);
78264 + EXPECT_EQ(mock_share_service().files()[0]->name.path(),
78266 EXPECT_EQ(mock_share_service().files()[0]->blob->GetType(), content_type);
78267 EXPECT_EQ(mock_share_service().files()[0]->blob->size(),
78269 diff --git a/src/third_party/blink/renderer/platform/BUILD.gn b/src/third_party/blink/renderer/plat…
78271 --- a/src/third_party/blink/renderer/platform/BUILD.gn
78273 @@ -1751,6 +1751,10 @@ component("platform") {
78284 @@ -1827,6 +1831,12 @@ component("platform") {
78286 configs -= [ "//build/config/compiler:default_symbols" ]
78291 + configs -= [ "//build/config:ohos_nweb_ex_def_main" ]
78297 @@ -1902,7 +1912,7 @@ static_library("test_support") {
78301 - if (custom_toolchain == "" && is_clang) {
78306 diff --git a/src/third_party/blink/renderer/platform/fonts/font_cache.cc b/src/third_party/blink/re…
78308 --- a/src/third_party/blink/renderer/platform/fonts/font_cache.cc
78310 @@ -81,13 +81,13 @@ const base::Feature kAsyncFontAccess{"AsyncFontAccess",
78312 const char kColorEmojiLocale[] = "und-Zsye";
78314 -#if defined(OS_ANDROID)
78321 -#if defined(OS_LINUX) || defined(OS_CHROMEOS)
78326 @@ -127,7 +127,8 @@ FontCache::FontCache()
78330 -#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_FUCHSIA)
78336 diff --git a/src/third_party/blink/renderer/platform/fonts/font_cache.h b/src/third_party/blink/ren…
78338 --- a/src/third_party/blink/renderer/platform/fonts/font_cache.h
78340 @@ -114,7 +114,7 @@ typedef HashMap<FallbackListCompositeKey,
78344 -#if defined(OS_ANDROID)
78349 @@ -261,7 +261,7 @@ class PLATFORM_EXPORT FontCache {
78353 -#if defined(OS_ANDROID)
78358 @@ -273,7 +273,7 @@ class PLATFORM_EXPORT FontCache {
78362 -#endif // defined(OS_ANDROID)
78367 @@ -355,7 +355,8 @@ class PLATFORM_EXPORT FontCache {
78371 -#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
78377 @@ -402,7 +403,7 @@ class PLATFORM_EXPORT FontCache {
78381 -#if defined(OS_LINUX) || defined(OS_CHROMEOS)
78386 diff --git a/src/third_party/blink/renderer/platform/fonts/font_platform_data.cc b/src/third_party/…
78388 --- a/src/third_party/blink/renderer/platform/fonts/font_platform_data.cc
78390 @@ -266,7 +266,7 @@ WebFontRenderStyle FontPlatformData::QuerySystemRenderStyle(
78394 -#if !defined(OS_ANDROID) && !defined(OS_FUCHSIA)
78398 if (family.length() && Platform::Current()->GetSandboxSupport()) {
78399 diff --git a/src/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc b/src/third_part…
78401 --- a/src/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc
78403 @@ -60,7 +60,8 @@ AtomicString ToAtomicString(const SkString& str) {
78407 -#if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS)
78413 @@ -235,7 +236,8 @@ sk_sp<SkTypeface> FontCache::CreateTypeface(
78417 -#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN)
78423 diff --git a/src/third_party/blink/renderer/platform/fonts/skia/sktypeface_factory.cc b/src/third_p…
78425 --- a/src/third_party/blink/renderer/platform/fonts/skia/sktypeface_factory.cc
78427 @@ -16,7 +16,7 @@ sk_sp<SkTypeface> SkTypeface_Factory::FromFontConfigInterfaceIdAndTtcIndex(
78431 - !defined(OS_FUCHSIA)
78436 @@ -33,7 +33,7 @@ sk_sp<SkTypeface> SkTypeface_Factory::FromFilenameAndTtcIndex(
78440 - !defined(OS_MAC)
78445 diff --git a/src/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor…
78447 --- a/src/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc
78449 @@ -918,9 +918,24 @@ void PaintArtifactCompositor::UpdateLayerSelection(
78456 - layer_selection);
78475 diff --git a/src/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.…
78477 --- a/src/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.cc
78479 @@ -1020,12 +1020,16 @@ void PaintChunksToCcLayer::UpdateLayerSelection(
78483 - cc::LayerSelection& layer_selection) {
78492 + chunk.layer_selection_data->any_selection_was_painted;
78495 if (chunk.layer_selection_data->start) {
78497 diff --git a/src/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.…
78499 --- a/src/third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.h
78501 @@ -71,7 +71,8 @@ class PLATFORM_EXPORT PaintChunksToCcLayer {
78505 - cc::LayerSelection& layer_selection);
78511 diff --git a/src/third_party/blink/renderer/platform/graphics/paint/layer_selection_data.h b/src/th…
78513 --- a/src/third_party/blink/renderer/platform/graphics/paint/layer_selection_data.h
78515 @@ -22,6 +22,7 @@ namespace blink {
78523 diff --git a/src/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc b/src/third_pa…
78525 --- a/src/third_party/blink/renderer/platform/graphics/paint/paint_chunker.cc
78527 @@ -233,6 +233,15 @@ void PaintChunker::AddSelectionToCurrentChunk(
78533 + DCHECK(!chunks_->IsEmpty());
78535 + auto& chunk = chunks_->back();
78543 diff --git a/src/third_party/blink/renderer/platform/graphics/paint/paint_chunker.h b/src/third_par…
78545 --- a/src/third_party/blink/renderer/platform/graphics/paint/paint_chunker.h
78547 @@ -92,6 +92,7 @@ class PLATFORM_EXPORT PaintChunker final {
78555 diff --git a/src/third_party/blink/renderer/platform/graphics/paint/paint_controller.h b/src/third_…
78557 --- a/src/third_party/blink/renderer/platform/graphics/paint/paint_controller.h
78559 @@ -160,6 +160,9 @@ class PLATFORM_EXPORT PaintController {
78568 return new_paint_artifact_->PaintChunks().size();
78569 diff --git a/src/third_party/blink/renderer/platform/media/video_frame_compositor.cc b/src/third_pa…
78571 --- a/src/third_party/blink/renderer/platform/media/video_frame_compositor.cc
78573 @@ -245,9 +245,20 @@ void VideoFrameCompositor::PaintSingleFrame(
78576 client_->DidReceiveFrame();
78593 DCHECK(task_runner_->BelongsToCurrentThread());
78594 diff --git a/src/third_party/blink/renderer/platform/media/web_media_player_impl.cc b/src/third_par…
78596 --- a/src/third_party/blink/renderer/platform/media/web_media_player_impl.cc
78598 @@ -821,7 +821,7 @@ void WebMediaPlayerImpl::DoLoad(LoadType load_type,
78602 -#if defined(OS_ANDROID)
78605 // (kCorsModeUnspecified) or "use-credentials" (kCorsModeUseCredentials).
78607 @@ -2842,6 +2842,13 @@ std::unique_ptr<media::Renderer> WebMediaPlayerImpl::CreateRenderer(
78614 + renderer_factory_selector_->SetBaseRendererType(
78618 DCHECK(main_task_runner_->BelongsToCurrentThread());
78621 @@ -2855,8 +2862,13 @@ void WebMediaPlayerImpl::StartPipeline() {
78627 - if (demuxer_found_hls_ || renderer_factory_selector_->GetCurrentFactory()
78632 + renderer_factory_selector_->GetCurrentFactory()
78633 ->GetRequiredMediaResourceType() ==
78636 @@ -2875,7 +2887,7 @@ void WebMediaPlayerImpl::StartPipeline() {
78640 -#endif // defined(OS_ANDROID)
78645 diff --git a/src/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/src/third_par…
78647 --- a/src/third_party/blink/renderer/platform/runtime_enabled_features.json5
78649 @@ -1226,7 +1226,7 @@
78653 - status: {"Android": "stable"},
78658 @@ -1405,7 +1405,8 @@
78662 - status: {"Android": "stable"},
78668 @@ -1541,7 +1542,8 @@
78672 - status: {"Android": "stable", "ChromeOS": "stable", "default": "experimental"},
78678 diff --git a/src/third_party/blink/renderer/platform/widget/compositing/render_frame_metadata_obser…
78680 --- a/src/third_party/blink/renderer/platform/widget/compositing/render_frame_metadata_observer_imp…
78682 @@ -167,8 +167,11 @@ bool RenderFrameMetadataObserverImpl::ShouldSendRenderFrameMetadata(
78686 - rfm2.new_vertical_scroll_direction !=
78687 - viz::VerticalScrollDirection::kNull) {
78696 diff --git a/src/third_party/blink/renderer/platform/widget/input/frame_widget_input_handler_impl.c…
78698 --- a/src/third_party/blink/renderer/platform/widget/input/frame_widget_input_handler_impl.cc
78700 @@ -359,6 +359,19 @@ void FrameWidgetInputHandlerImpl::ScrollFocusedEditableNodeIntoRect(
78713 + handler->MoveCaret(point);
78720 @@ -366,6 +379,7 @@ void FrameWidgetInputHandlerImpl::MoveCaret(const gfx::Point& point) {
78721 handler->MoveCaret(point);
78728 diff --git a/src/third_party/blink/renderer/platform/widget/input/widget_input_handler_impl.cc b/sr…
78730 --- a/src/third_party/blink/renderer/platform/widget/input/widget_input_handler_impl.cc
78732 @@ -17,6 +17,9 @@
78742 @@ -147,6 +150,12 @@ void WidgetInputHandlerImpl::DispatchEvent(
78743 input_handler_manager_->DispatchEvent(std::move(event), std::move(callback));
78755 diff --git a/src/third_party/blink/renderer/platform/widget/input/widget_input_handler_impl.h b/src…
78757 --- a/src/third_party/blink/renderer/platform/widget/input/widget_input_handler_impl.h
78759 @@ -61,6 +61,9 @@ class WidgetInputHandlerImpl : public mojom::blink::WidgetInputHandler {
78769 diff --git a/src/third_party/blink/renderer/platform/widget/widget_base.cc b/src/third_party/blink/…
78771 --- a/src/third_party/blink/renderer/platform/widget/widget_base.cc
78773 @@ -287,6 +287,10 @@ void WidgetBase::Shutdown() {
78781 return layer_tree_view_->layer_tree_host();
78784 diff --git a/src/third_party/blink/renderer/platform/wtf/BUILD.gn b/src/third_party/blink/renderer/…
78786 --- a/src/third_party/blink/renderer/platform/wtf/BUILD.gn
78788 @@ -33,6 +33,10 @@ config("wtf_config") {
78794 + cflags = [ "-Wno-invalid-constexpr" ]
78799 diff --git a/src/third_party/blink/renderer/platform/wtf/math_extras.h b/src/third_party/blink/rend…
78801 --- a/src/third_party/blink/renderer/platform/wtf/math_extras.h
78803 @@ -26,6 +26,7 @@
78811 diff --git a/src/third_party/blink/renderer/platform/wtf/stack_util.cc b/src/third_party/blink/rend…
78813 --- a/src/third_party/blink/renderer/platform/wtf/stack_util.cc
78815 @@ -30,7 +30,7 @@ size_t GetUnderestimatedStackSize() {
78819 - defined(OS_FUCHSIA)
78824 @@ -98,7 +98,7 @@ return Threading::ThreadStackSize();
78828 - defined(OS_FUCHSIA)
78833 diff --git a/src/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/src/third_par…
78835 --- a/src/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
78837 @@ -1331,6 +1331,14 @@ _CONFIG = [
78852 diff --git a/src/third_party/blink/web_tests/VirtualTestSuites b/src/third_party/blink/web_tests/Vi…
78854 --- a/src/third_party/blink/web_tests/VirtualTestSuites
78856 @@ -535,6 +535,7 @@
78857 "prefix": "no-auto-wpt-origin-isolation",
78859 "external/wpt/html/browsers/origin/origin-keyed-agent-clusters",
78860 + "external/wpt/html/infrastructure/urls/terminology-0",
78861 "external/wpt/app-history/navigate-event/cross-window"
78863 "args": ["--disable-auto-wpt-origin-isolation"]
78864--git a/src/third_party/blink/web_tests/editing/pasteboard/drag-and-drop-svg-use-sanitize.html b/s…
78867 --- /dev/null
78868 +++ b/src/third_party/blink/web_tests/editing/pasteboard/drag-and-drop-svg-use-sanitize.html
78869 @@ -0,0 +1,47 @@
78874 +<div id="drag-from" draggable=true>Drag from</div>
78875 +<div id="drag-to" contenteditable>Drag to</div>
78891 +const dragFrom = document.getElementById('drag-from');
78897 +const dragTo = document.getElementById('drag-to');
78917--git a/src/third_party/blink/web_tests/external/wpt/css/css-properties-values-api/registered-prop…
78919 --- a/src/third_party/blink/web_tests/external/wpt/css/css-properties-values-api/registered-propert…
78920 …/third_party/blink/web_tests/external/wpt/css/css-properties-values-api/registered-property-comput…
78921 @@ -1,5 +1,5 @@
78922 This is a testharness.js-based test.
78923 -Found 60 tests; 59 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN.
78925 PASS <length> values computed are correctly via var()-reference
78926 PASS <length> values computed are correctly via var()-reference when font-size is inherited
78927 PASS <length> values are computed correctly when font-size is inherited [14em]
78928 @@ -60,5 +60,6 @@ PASS * values are computed correctly [50dpi]
78935--git a/src/third_party/blink/web_tests/external/wpt/css/css-properties-values-api/registered-prop…
78937 --- a/src/third_party/blink/web_tests/external/wpt/css/css-properties-values-api/registered-propert…
78938 … b/src/third_party/blink/web_tests/external/wpt/css/css-properties-values-api/registered-property-
78939 @@ -167,4 +167,6 @@ test_computed_value('<resolution>', '1dppx', '1dppx');
78946--git a/src/third_party/blink/web_tests/external/wpt/custom-elements/when-defined-reentry-crash.ht…
78949 --- /dev/null
78950 +++ b/src/third_party/blink/web_tests/external/wpt/custom-elements/when-defined-reentry-crash.html
78951 @@ -0,0 +1,25 @@
78953 +<meta charset="utf-8">
78954 +<title>Check for crashes when a whenDefined promise resolving re-entries</title>
78956 … rel="help" href="https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-api">
78967 + customElements.whenDefined("custom-a"); // Causes re-entry of main()
78968 + try { customElements.define("custom-a", CustomElement) } catch (e) {}
78969 + customElements.whenDefined("custom-b");
78970 + --depth;
78978--git a/src/third_party/blink/web_tests/external/wpt/html/infrastructure/urls/terminology-0/docume…
78981 --- /dev/null
78982 …eb_tests/external/wpt/html/infrastructure/urls/terminology-0/document-base-url-initiated-grand-par…
78983 @@ -0,0 +1,62 @@
78984 +// META: script=/common/get-host-info.sub.js
79003 + location.hash = "interesting-fragment";
79015 + // Navigate the grand-child toward about:blank.
79025 + // grand-parent.
79034 + "Check the baseURL of an about:blank document same-origin with its parent",
79038 + "Check the baseURL of an about:blank document cross-origin with its parent",
79042 + "Check the baseURL of an about:blank document cross-site with its parent",
79046--git a/src/third_party/blink/web_tests/platform/generic/external/wpt/html/infrastructure/urls/ter…
79049 --- /dev/null
79050 …xternal/wpt/html/infrastructure/urls/terminology-0/document-base-url-initiated-grand-parent.https.…
79051 @@ -0,0 +1,6 @@
79052 +This is a testharness.js-based test.
79053-origin with its parent assert_equals: expected "https://web-platform.test:8444/html/infrastructur…
79054-origin with its parent assert_equals: expected "https://web-platform.test:8444/html/infrastructur…
79055 …s-site with its parent assert_equals: expected "https://web-platform.test:8444/html/infrastructure…
79058 diff --git a/src/third_party/breakpad/BUILD.gn b/src/third_party/breakpad/BUILD.gn
79060 --- a/src/third_party/breakpad/BUILD.gn
79062 @@ -16,7 +16,7 @@ config("tools_config") {
79066 - if (is_android) {
79071 @@ -31,14 +31,14 @@ config("internal_config") {
79075 - if (is_android) {
79083 - if (is_android) {
79088 @@ -486,7 +486,7 @@ if (is_mac) {
79092 -if (is_linux || is_chromeos || is_android) {
79097 diff --git a/src/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/src/…
79099 --- a/src/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
79101 @@ -234,7 +234,7 @@ ExceptionHandler::ExceptionHandler(const MinidumpDescriptor& descriptor,
79105 -#if defined(__ANDROID__)
79110 diff --git a/src/third_party/breakpad/breakpad/src/client/linux/log/log.cc b/src/third_party/breakp…
79112 --- a/src/third_party/breakpad/breakpad/src/client/linux/log/log.cc
79114 @@ -29,7 +29,7 @@
79118 -#if defined(__ANDROID__)
79123 @@ -38,7 +38,7 @@
79127 -#if defined(__ANDROID__)
79132 @@ -74,7 +74,7 @@ int writeToCrashLog(const char* buf) {
79136 -#if defined(__ANDROID__)
79141 diff --git a/src/third_party/breakpad/breakpad/src/client/linux/log/log.h b/src/third_party/breakpa…
79143 --- a/src/third_party/breakpad/breakpad/src/client/linux/log/log.h
79145 @@ -39,7 +39,7 @@ int write(const char* buf, size_t nbytes);
79149 -#if defined(__ANDROID__)
79152 // The logger must be initialized in a non-compromised context.
79154 diff --git a/src/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.c…
79156 --- a/src/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
79158 @@ -198,7 +198,7 @@ class MicrodumpWriter {
79162 -#if defined(__ANDROID__)
79167 diff --git a/src/third_party/crashpad/crashpad/BUILD.gn b/src/third_party/crashpad/crashpad/BUILD.gn
79169 --- a/src/third_party/crashpad/crashpad/BUILD.gn
79171 @@ -41,7 +41,6 @@ if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) {
79172 deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ]
79175 - use_raw_android_executable = true
79179 @@ -56,11 +55,14 @@ if (crashpad_is_in_chromium || crashpad_is_in_fuchsia) {
79194 diff --git a/src/third_party/crashpad/crashpad/build/crashpad_buildconfig.gni b/src/third_party/cra…
79196 --- a/src/third_party/crashpad/crashpad/build/crashpad_buildconfig.gni
79198 @@ -59,7 +59,7 @@ if (crashpad_is_in_chromium) {
79202 - crashpad_is_android = is_android
79207 @@ -81,6 +81,11 @@ if (crashpad_is_in_chromium) {
79219 diff --git a/src/third_party/crashpad/crashpad/client/crashpad_client.h b/src/third_party/crashpad/…
79221 --- a/src/third_party/crashpad/crashpad/client/crashpad_client.h
79223 @@ -33,7 +33,8 @@
79227 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79233 @@ -126,7 +127,7 @@ class CrashpadClient {
79237 - DOXYGEN
79242 @@ -344,7 +345,7 @@ class CrashpadClient {
79246 - DOXYGEN
79251 @@ -749,7 +750,8 @@ class CrashpadClient {
79255 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79261 diff --git a/src/third_party/crashpad/crashpad/client/crashpad_client_linux.cc b/src/third_party/cr…
79263 --- a/src/third_party/crashpad/crashpad/client/crashpad_client_linux.cc
79265 @@ -459,7 +459,8 @@ bool CrashpadClient::StartHandler(
79269 -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79275 diff --git a/src/third_party/crashpad/crashpad/client/crashpad_info.cc b/src/third_party/crashpad/c…
79277 --- a/src/third_party/crashpad/crashpad/client/crashpad_info.cc
79279 @@ -96,7 +96,7 @@ extern "C" int* CRASHPAD_NOTE_REFERENCE;
79283 - BUILDFLAG(IS_FUCHSIA)
79285 // This otherwise-unused reference is used so that any module that
79288 diff --git a/src/third_party/crashpad/crashpad/client/simulate_crash.h b/src/third_party/crashpad/c…
79290 --- a/src/third_party/crashpad/crashpad/client/simulate_crash.h
79292 @@ -23,7 +23,8 @@
79296 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79302 diff --git a/src/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h b/src/third_party/crashpad…
79304 --- a/src/third_party/crashpad/crashpad/compat/linux/sys/ptrace.h
79306 @@ -17,7 +17,9 @@
79316 diff --git a/src/third_party/crashpad/crashpad/handler/handler_main.cc b/src/third_party/crashpad/c…
79318 --- a/src/third_party/crashpad/crashpad/handler/handler_main.cc
79320 @@ -61,7 +61,8 @@
79324 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79330 @@ -98,7 +99,7 @@ namespace crashpad {
79334 - BUILDFLAG(IS_ANDROID)
79339 @@ -163,7 +164,7 @@ void Usage(const base::FilePath& me) {
79340 " --no-rate-limit don't rate limit crash uploads\n"
79341 " --no-upload-gzip don't use gzip compression when uploading\n"
79342 // clang-format on
79343 -#if BUILDFLAG(IS_ANDROID)
79345 // clang-format off
79346 " --no-write-minidump-to-database\n"
79348 @@ -180,7 +181,8 @@ void Usage(const base::FilePath& me) {
79350 // clang-format on
79352 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79355 // clang-format off
79356 " --sanitization-information=SANITIZATION_INFORMATION_ADDRESS\n"
79358 @@ -210,7 +212,7 @@ void Usage(const base::FilePath& me) {
79360 // clang-format on
79362 -#if BUILDFLAG(IS_ANDROID)
79364 // clang-format off
79365 " --write-minidump-to-log write minidump to log\n"
79366 // clang-format on
79367 @@ -234,12 +236,13 @@ struct Options {
79371 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79378 -#if BUILDFLAG(IS_ANDROID)
79383 @@ -322,7 +325,7 @@ class CallMetricsRecordNormalExit {
79387 - BUILDFLAG(IS_ANDROID)
79392 @@ -503,7 +506,7 @@ void MonitorSelf(const Options& options) {
79396 -#if BUILDFLAG(IS_ANDROID)
79401 @@ -584,7 +587,7 @@ int HandlerMain(int argc,
79405 - BUILDFLAG(IS_ANDROID)
79410 @@ -594,7 +597,8 @@ int HandlerMain(int argc,
79414 -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79420 @@ -609,7 +613,7 @@ int HandlerMain(int argc,
79424 -#if BUILDFLAG(IS_ANDROID)
79429 @@ -618,7 +622,8 @@ int HandlerMain(int argc,
79433 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79439 @@ -632,7 +637,7 @@ int HandlerMain(int argc,
79443 -#if BUILDFLAG(IS_ANDROID)
79448 @@ -656,7 +661,8 @@ int HandlerMain(int argc,
79452 -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79455 {"initial-client-fd", required_argument, nullptr, kOptionInitialClientFD},
79458 @@ -680,7 +686,7 @@ int HandlerMain(int argc,
79459 {"no-periodic-tasks", no_argument, nullptr, kOptionNoPeriodicTasks},
79460 {"no-rate-limit", no_argument, nullptr, kOptionNoRateLimit},
79461 {"no-upload-gzip", no_argument, nullptr, kOptionNoUploadGzip},
79462 -#if BUILDFLAG(IS_ANDROID)
79464 {"no-write-minidump-to-database",
79467 @@ -695,7 +701,8 @@ int HandlerMain(int argc,
79471 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79474 {"sanitization-information",
79477 @@ -722,7 +729,7 @@ int HandlerMain(int argc,
79479 {"always-allow-feedback", no_argument, nullptr, kOptionAlwaysAllowFeedback},
79481 -#if BUILDFLAG(IS_ANDROID)
79483 {"write-minidump-to-log", no_argument, nullptr, kOptionWriteMinidumpToLog},
79486 @@ -738,13 +745,14 @@ int HandlerMain(int argc,
79487 options.handshake_fd = -1;
79490 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79498 -#if BUILDFLAG(IS_ANDROID)
79503 @@ -794,7 +802,8 @@ int HandlerMain(int argc,
79507 -#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79512 ToolSupport::UsageHint(me, "failed to parse --initial-client-fd");
79513 @@ -841,7 +850,7 @@ int HandlerMain(int argc,
79517 -#if BUILDFLAG(IS_ANDROID)
79522 @@ -859,7 +868,8 @@ int HandlerMain(int argc,
79526 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79532 @@ -923,7 +933,7 @@ int HandlerMain(int argc,
79536 -#if BUILDFLAG(IS_ANDROID)
79541 @@ -969,7 +979,8 @@ int HandlerMain(int argc,
79542 me, "--initial-client-data and --pipe-name are incompatible");
79545 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79551 @@ -989,7 +1000,7 @@ int HandlerMain(int argc,
79552 me, "--shared-client-connection requires --initial-client-fd");
79555 -#if BUILDFLAG(IS_ANDROID)
79559 "--no_write_minidump_to_database is required to use "
79560 @@ -1068,7 +1079,8 @@ int HandlerMain(int argc,
79561 upload_thread.Get()->Start();
79564 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79570 @@ -1108,7 +1120,7 @@ int HandlerMain(int argc,
79574 -#if BUILDFLAG(IS_ANDROID)
79579 @@ -1119,7 +1131,8 @@ int HandlerMain(int argc,
79583 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79589 @@ -1193,7 +1206,8 @@ int HandlerMain(int argc,
79593 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79599 @@ -1215,7 +1229,8 @@ int HandlerMain(int argc,
79603 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79609 diff --git a/src/third_party/crashpad/crashpad/handler/handler_main.h b/src/third_party/crashpad/cr…
79611 --- a/src/third_party/crashpad/crashpad/handler/handler_main.h
79613 @@ -35,7 +35,7 @@ int HandlerMain(int argc,
79617 -#if BUILDFLAG(IS_ANDROID)
79622 diff --git a/src/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/src/third_pa…
79624 --- a/src/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
79626 @@ -119,6 +119,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
79635 diff --git a/src/third_party/crashpad/crashpad/snapshot/crashpad_types/crashpad_info_reader.cc b/sr…
79637 --- a/src/third_party/crashpad/crashpad/snapshot/crashpad_types/crashpad_info_reader.cc
79639 @@ -22,7 +22,8 @@
79643 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79649 diff --git a/src/third_party/crashpad/crashpad/util/file/file_io.h b/src/third_party/crashpad/crash…
79651 --- a/src/third_party/crashpad/crashpad/util/file/file_io.h
79653 @@ -422,7 +422,7 @@ FileHandle LoggingOpenFileForWrite(const base::FilePath& path,
79657 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79659 //! \brief Opens an in-memory file for input and output.
79662 diff --git a/src/third_party/crashpad/crashpad/util/file/file_io_posix.cc b/src/third_party/crashpa…
79664 --- a/src/third_party/crashpad/crashpad/util/file/file_io_posix.cc
79666 @@ -153,7 +153,7 @@ FileHandle LoggingOpenFileForWrite(const base::FilePath& path,
79670 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79675 diff --git a/src/third_party/crashpad/crashpad/util/file/file_writer.cc b/src/third_party/crashpad/…
79677 --- a/src/third_party/crashpad/crashpad/util/file/file_writer.cc
79679 @@ -171,7 +171,7 @@ bool FileWriter::Open(const base::FilePath& path,
79683 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79688 diff --git a/src/third_party/crashpad/crashpad/util/file/file_writer.h b/src/third_party/crashpad/c…
79690 --- a/src/third_party/crashpad/crashpad/util/file/file_writer.h
79692 @@ -137,7 +137,7 @@ class FileWriter : public FileWriterInterface {
79696 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79701 diff --git a/src/third_party/crashpad/crashpad/util/linux/exception_handler_protocol.cc b/src/third…
79703 --- a/src/third_party/crashpad/crashpad/util/linux/exception_handler_protocol.cc
79705 @@ -21,7 +21,7 @@ namespace crashpad {
79709 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79714 diff --git a/src/third_party/crashpad/crashpad/util/linux/exception_handler_protocol.h b/src/third_…
79716 --- a/src/third_party/crashpad/crashpad/util/linux/exception_handler_protocol.h
79718 @@ -51,7 +51,7 @@ class ExceptionHandlerProtocol {
79722 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79727 diff --git a/src/third_party/crashpad/crashpad/util/linux/thread_info.h b/src/third_party/crashpad/…
79729 --- a/src/third_party/crashpad/crashpad/util/linux/thread_info.h
79731 @@ -274,7 +274,7 @@ union FloatContext {
79735 -#if !defined(__GLIBC__)
79740 diff --git a/src/third_party/crashpad/crashpad/util/misc/address_types.h b/src/third_party/crashpad…
79742 --- a/src/third_party/crashpad/crashpad/util/misc/address_types.h
79744 @@ -25,7 +25,8 @@
79748 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79754 @@ -55,7 +56,8 @@ using VMSize = mach_vm_size_t;
79758 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79764 diff --git a/src/third_party/crashpad/crashpad/util/misc/capture_context.h b/src/third_party/crashp…
79766 --- a/src/third_party/crashpad/crashpad/util/misc/capture_context.h
79768 @@ -21,7 +21,8 @@
79772 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79778 @@ -38,7 +39,7 @@ using NativeCPUContext = arm_unified_thread_state;
79782 - BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
79787 diff --git a/src/third_party/crashpad/crashpad/util/misc/metrics.cc b/src/third_party/crashpad/cras…
79789 --- a/src/third_party/crashpad/crashpad/util/misc/metrics.cc
79791 @@ -29,6 +29,8 @@
79800 diff --git a/src/third_party/crashpad/crashpad/util/misc/time.h b/src/third_party/crashpad/crashpad…
79802 --- a/src/third_party/crashpad/crashpad/util/misc/time.h
79804 @@ -70,7 +70,7 @@ void GetTimeOfDay(timeval* tv);
79808 - DOXYGEN
79813 diff --git a/src/third_party/crashpad/crashpad/util/misc/uuid.cc b/src/third_party/crashpad/crashpa…
79815 --- a/src/third_party/crashpad/crashpad/util/misc/uuid.cc
79817 @@ -101,7 +101,7 @@ bool UUID::InitializeWithNew() {
79821 - BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
79824 // widely-available system library. On Linux and Android, uuid_generate()
79826 diff --git a/src/third_party/crashpad/crashpad/util/net/http_transport_socket.cc b/src/third_party/…
79828 --- a/src/third_party/crashpad/crashpad/util/net/http_transport_socket.cc
79830 @@ -128,7 +128,7 @@ class SSLStream : public Stream {
79834 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
79839 diff --git a/src/third_party/crashpad/crashpad/util/numeric/checked_address_range.cc b/src/third_pa…
79841 --- a/src/third_party/crashpad/crashpad/util/numeric/checked_address_range.cc
79843 @@ -23,7 +23,8 @@
79847 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79853 @@ -131,7 +132,8 @@ std::string CheckedAddressRangeGeneric<ValueType, SizeType>::AsString() const {
79857 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79863 diff --git a/src/third_party/crashpad/crashpad/util/posix/close_multiple.cc b/src/third_party/crash…
79865 --- a/src/third_party/crashpad/crashpad/util/posix/close_multiple.cc
79867 @@ -74,7 +74,8 @@ void CloseNowOrOnExec(int fd, bool ebadf_ok) {
79871 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79877 @@ -134,7 +135,7 @@ void CloseMultipleNowOrOnExec(int fd, int preserve_fd) {
79881 -#if !BUILDFLAG(IS_ANDROID)
79886 @@ -142,7 +143,7 @@ void CloseMultipleNowOrOnExec(int fd, int preserve_fd) {
79890 - BUILDFLAG(IS_ANDROID)) || \
79894 …// https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/include/linux/limit…
79895 @@ -170,7 +171,8 @@ void CloseMultipleNowOrOnExec(int fd, int preserve_fd) {
79899 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79902 // See linux-4.4.27/fs/file.c sysctl_nr_open, referenced by kernel/sys.c
79905 diff --git a/src/third_party/crashpad/crashpad/util/posix/drop_privileges.cc b/src/third_party/cras…
79907 --- a/src/third_party/crashpad/crashpad/util/posix/drop_privileges.cc
79909 @@ -73,7 +73,8 @@ void DropPrivileges() {
79910 CHECK_EQ(setegid(egid), -1);
79913 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79919 diff --git a/src/third_party/crashpad/crashpad/util/posix/process_info.h b/src/third_party/crashpad…
79921 --- a/src/third_party/crashpad/crashpad/util/posix/process_info.h
79923 @@ -32,7 +32,8 @@
79927 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79933 @@ -48,7 +49,7 @@ class ProcessInfo {
79937 - DOXYGEN
79942 @@ -173,7 +174,8 @@ class ProcessInfo {
79946 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79950 // const methods. These are always InitializationState-protected so that
79952 diff --git a/src/third_party/crashpad/crashpad/util/posix/symbolic_constants_posix.cc b/src/third_p…
79954 --- a/src/third_party/crashpad/crashpad/util/posix/symbolic_constants_posix.cc
79956 @@ -66,7 +66,8 @@ constexpr const char* kSignalNames[] = {
79960 -#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79966 @@ -137,7 +138,8 @@ constexpr const char* kSignalNames[] = {
79970 -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
79973 // NSIG is 64 to account for real-time signals.
79976 diff --git a/src/third_party/dav1d/BUILD.gn b/src/third_party/dav1d/BUILD.gn
79978 --- a/src/third_party/dav1d/BUILD.gn
79980 @@ -79,7 +79,7 @@ config("public_dav1d_config") {
79984 - if (!is_android && !is_win) {
79989 diff --git a/src/third_party/dawn/src/common/BUILD.gn b/src/third_party/dawn/src/common/BUILD.gn
79991 --- a/src/third_party/dawn/src/common/BUILD.gn
79993 @@ -177,7 +177,8 @@ config("dawn_internal") {
79997 -if (is_win || is_linux || is_chromeos || is_mac || is_fuchsia || is_android) {
80003 diff --git a/src/third_party/ffmpeg/BUILD.gn b/src/third_party/ffmpeg/BUILD.gn
80005 --- a/src/third_party/ffmpeg/BUILD.gn
80007 @@ -331,7 +331,7 @@ target(link_target_type, "ffmpeg_internal") {
80008 "-L",
80011 - if (!is_android && !is_fuchsia) {
80013 # OS=android requires that both -lz and -lm occur after
80014 # -lc++_shared on the link command line. Android link rules
80015 # already include -lm, and we get -lz as a transitive dependency
80016 diff --git a/src/third_party/ffmpeg/ffmpeg_generated.gni b/src/third_party/ffmpeg/ffmpeg_generated.…
80018 --- a/src/third_party/ffmpeg/ffmpeg_generated.gni
80020 @@ -12,9 +12,9 @@ ffmpeg_c_sources = []
80024 -use_linux_config = is_linux || is_chromeos || is_fuchsia
80027 -if ((is_android && current_cpu == "arm" && arm_use_neon) || (is_android && current_cpu == "arm64")…
80032 @@ -211,7 +211,7 @@ if ((is_mac) || (is_win) || (use_linux_config)) {
80036 -if ((current_cpu == "arm64" && ffmpeg_branding == "Chrome") || (current_cpu == "x64" && ffmpeg_bra…
80041 @@ -349,7 +349,7 @@ if ((current_cpu == "x64" && ffmpeg_branding == "Chrome") || (is_win && current_
80045 -if ((is_android && current_cpu == "arm" && arm_use_neon) || (is_android && current_cpu == "arm64")…
80050 @@ -506,14 +506,14 @@ if ((use_linux_config && current_cpu == "arm" && arm_use_neon) || (use_linux_…
80054 -if ((is_android && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_li…
80062 -if ((is_android && current_cpu == "arm" && arm_use_neon) || (use_linux_config && current_cpu == "a…
80067 @@ -577,7 +577,7 @@ if (use_linux_config && current_cpu == "arm" && arm_use_neon) {
80071 -if ((is_android && current_cpu == "arm" && arm_use_neon && ffmpeg_branding == "Chrome") || (use_li…
80076 diff --git a/src/third_party/ffmpeg/ffmpeg_options.gni b/src/third_party/ffmpeg/ffmpeg_options.gni
80078 --- a/src/third_party/ffmpeg/ffmpeg_options.gni
80080 @@ -71,4 +71,6 @@ if ((is_linux || is_chromeos) && is_msan) {
80083 os_config = "win-msvc"
80087 diff --git a/src/third_party/icu/BUILD.gn b/src/third_party/icu/BUILD.gn
80089 --- a/src/third_party/icu/BUILD.gn
80091 @@ -177,6 +177,11 @@ template("generate_icu_component") {
80097 + configs -= [ "//build/config:ohos_nweb_ex_def_main" ]
80103 @@ -225,6 +230,11 @@ template("generate_icu_component") {
80104 configs -= [ "//build/config/compiler:thin_archive" ]
80109 + configs -= [ "//build/config:ohos_nweb_ex_def_main" ]
80115 diff --git a/src/third_party/libjpeg_turbo/BUILD.gn b/src/third_party/libjpeg_turbo/BUILD.gn
80117 --- a/src/third_party/libjpeg_turbo/BUILD.gn
80119 @@ -128,7 +128,7 @@ if (current_cpu == "x86" || current_cpu == "x64") {
80123 - } else if (is_linux || is_android || is_fuchsia || is_chromeos) {
80128 diff --git a/src/third_party/libsync/src/include/sync/sync.h b/src/third_party/libsync/src/include/…
80130 --- a/src/third_party/libsync/src/include/sync/sync.h
80132 @@ -19,7 +19,17 @@
80150 diff --git a/src/third_party/libwebp/README.chromium b/src/third_party/libwebp/README.chromium
80152 --- a/src/third_party/libwebp/README.chromium
80154 @@ -1,7 +1,7 @@
80158 -Version: v1.2.1
80163 @@ -9,7 +9,7 @@ Security Critical: Yes
80167 - https://chromium.googlesource.com/webm/libwebp/+archive/v1.2.1.tar.gz
80172 diff --git a/src/third_party/libwebp/src/dsp/alpha_processing_neon.c b/src/third_party/libwebp/src/…
80174 --- a/src/third_party/libwebp/src/dsp/alpha_processing_neon.c
80176 @@ -83,7 +83,7 @@ static void ApplyAlphaMultiply_NEON(uint8_t* rgba, int alpha_first,
80180 - uint32_t alpha_mask = 0xffffffffu;
80185 @@ -107,6 +107,7 @@ static int DispatchAlpha_NEON(const uint8_t* WEBP_RESTRICT alpha,
80193 @@ -135,7 +136,7 @@ static void DispatchAlphaToGreen_NEON(const uint8_t* WEBP_RESTRICT alpha,
80197 - uint32_t alpha_mask = 0xffffffffu;
80202 @@ -157,6 +158,7 @@ static int ExtractAlpha_NEON(const uint8_t* WEBP_RESTRICT argb, int argb_stride,
80210 diff --git a/src/third_party/libwebp/src/dsp/lossless_enc_mips32.c b/src/third_party/libwebp/src/ds…
80212 --- a/src/third_party/libwebp/src/dsp/lossless_enc_mips32.c
80214 @@ -347,24 +347,24 @@ static void GetCombinedEntropyUnrefined_MIPS32(const uint32_t X[],
80218 - const uint32_t end = ((size) / 4) * 4;
80225 - for (i = end; i < size; ++i) pout[i] = pa[i] + pb[i];
80226 + for (i = 0; i < size - end; ++i) pout[i] = pa[i] + pb[i];
80231 - const uint32_t end = ((size) / 4) * 4;
80238 - for (i = end; i < size; ++i) pout[i] += pa[i];
80239 + for (i = 0; i < size - end; ++i) pout[i] += pa[i];
80243 diff --git a/src/third_party/libwebp/src/enc/backward_references_cost_enc.c b/src/third_party/libwe…
80245 --- a/src/third_party/libwebp/src/enc/backward_references_cost_enc.c
80247 @@ -577,7 +577,7 @@ static int BackwardReferencesHashChainDistanceOnly(
80251 - (CostManager*)WebPSafeMalloc(1ULL, sizeof(*cost_manager));
80253 int offset_prev = -1, len_prev = -1;
80254 double offset_cost = -1;
80255 int first_offset_is_constant = -1; // initialized with 'impossible' value
80256 diff --git a/src/third_party/libwebp/src/enc/backward_references_enc.c b/src/third_party/libwebp/sr…
80258 --- a/src/third_party/libwebp/src/enc/backward_references_enc.c
80260 @@ -976,15 +976,16 @@ static int GetBackwardReferences(int width, int height,
80264 - if (VP8LBackwardReferencesTraceBackwards(width, height, argb, cache_bits,
80265 - hash_chain_tmp, &refs[i],
80266 - refs_tmp)) {
80267 - double bit_cost_trace;
80268 - VP8LHistogramCreate(histo, refs_tmp, cache_bits);
80269 - bit_cost_trace = VP8LHistogramEstimateBits(histo);
80270 - if (bit_cost_trace < bit_costs_best[i]) {
80271 - BackwardRefsSwap(refs_tmp, &refs[i]);
80272 - }
80286 diff --git a/src/third_party/libwebp/src/enc/vp8l_enc.c b/src/third_party/libwebp/src/enc/vp8l_enc.c
80288 --- a/src/third_party/libwebp/src/enc/vp8l_enc.c
80290 @@ -1912,11 +1912,16 @@ WebPEncodingError VP8LEncodeStream(const WebPConfig* const config,
80301 - if (enc_main == NULL ||
80302 - !EncoderAnalyze(enc_main, crunch_configs, &num_crunch_configs_main,
80305 - !EncoderInit(enc_main) || !VP8LBitWriterInit(&bw_side, 0)) {
80310 diff --git a/src/third_party/libxml/BUILD.gn b/src/third_party/libxml/BUILD.gn
80312 --- a/src/third_party/libxml/BUILD.gn
80314 @@ -4,7 +4,7 @@
80316 # Define an "os_include" variable that points at the OS-specific generated
80318 -if (is_linux || is_chromeos || is_android || is_nacl || is_fuchsia) {
80323 diff --git a/src/third_party/libxslt/BUILD.gn b/src/third_party/libxslt/BUILD.gn
80325 --- a/src/third_party/libxslt/BUILD.gn
80327 @@ -86,7 +86,7 @@ static_library("libxslt") {
80331 - if (is_linux || is_chromeos || is_android || is_fuchsia) {
80336 diff --git a/src/third_party/lss/linux_syscall_support.h b/src/third_party/lss/linux_syscall_suppor…
80338 --- a/src/third_party/lss/linux_syscall_support.h
80340 @@ -89,7 +89,7 @@
80344 - && (defined(__linux) || defined(__ANDROID__))
80349 @@ -4543,7 +4543,7 @@ struct kernel_statfs {
80353 - #if defined(__NR_fstatat64)
80358 diff --git a/src/third_party/openscreen/src/util/simple_fraction.h b/src/third_party/openscreen/src…
80360 --- a/src/third_party/openscreen/src/util/simple_fraction.h
80362 @@ -35,8 +35,8 @@ class SimpleFraction {
80366 - constexpr SimpleFraction& operator=(const SimpleFraction&) = default;
80367 - constexpr SimpleFraction& operator=(SimpleFraction&&) = default;
80373 diff --git a/src/third_party/pdfium/core/fxcrt/cfx_datetime.cpp b/src/third_party/pdfium/core/fxcrt…
80375 --- a/src/third_party/pdfium/core/fxcrt/cfx_datetime.cpp
80377 @@ -11,7 +11,7 @@
80381 - BUILDFLAG(IS_APPLE) || defined(OS_ASMJS)
80386 diff --git a/src/third_party/pdfium/core/fxge/BUILD.gn b/src/third_party/pdfium/core/fxge/BUILD.gn
80388 --- a/src/third_party/pdfium/core/fxge/BUILD.gn
80390 @@ -162,7 +162,7 @@ source_set("fxge") {
80394 - if (is_linux || is_chromeos) {
80399 diff --git a/src/third_party/pdfium/core/fxge/linux/fx_linux_impl.cpp b/src/third_party/pdfium/core…
80401 --- a/src/third_party/pdfium/core/fxge/linux/fx_linux_impl.cpp
80403 @@ -17,7 +17,8 @@
80407 -#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !defined(OS_ASMJS)
80413 diff --git a/src/third_party/perfetto/buildtools/BUILD.gn b/src/third_party/perfetto/buildtools/BUI…
80415 --- a/src/third_party/perfetto/buildtools/BUILD.gn
80417 @@ -74,7 +74,7 @@ config("libunwindstack_config") {
80419 rebase_path("android-core/demangle/include", root_build_dir),
80421 - if (is_android) {
80426 @@ -653,7 +653,7 @@ if (use_custom_libcxx) {
80430 - if (is_android) {
80434 configs -= [
80435 @@ -724,7 +724,7 @@ if (use_custom_libcxx) {
80439 - if ((is_linux || is_android) && using_sanitizer &&
80444 @@ -797,7 +797,7 @@ source_set("benchmark") {
80448 -if (is_linux || is_android) {
80453 @@ -1022,7 +1022,7 @@ source_set("libunwindstack") {
80454 "android-unwinding/libunwindstack/Symbols.cpp",
80455 "android-unwinding/libunwindstack/Unwinder.cpp",
80457 - if (!is_android) {
80460 "android-libbase/liblog_symbols.cpp",
80461 "android-libbase/logging.cpp",
80462 diff --git a/src/third_party/perfetto/include/perfetto/base/build_config.h b/src/third_party/perfet…
80464 --- a/src/third_party/perfetto/include/perfetto/base/build_config.h
80466 @@ -24,9 +24,26 @@
80470 -#if defined(__ANDROID__)
80494 diff --git a/src/third_party/protobuf/src/google/protobuf/stubs/common.cc b/src/third_party/protobu…
80496 --- a/src/third_party/protobuf/src/google/protobuf/stubs/common.cc
80498 @@ -49,7 +49,7 @@
80502 -#if defined(__ANDROID__)
80507 @@ -125,7 +125,7 @@ string VersionString(int version) {
80511 -#if defined(__ANDROID__)
80516 diff --git a/src/third_party/skia/include/gpu/GrDirectContext.h b/src/third_party/skia/include/gpu/…
80518 --- a/src/third_party/skia/include/gpu/GrDirectContext.h
80520 @@ -143,6 +143,9 @@ public:
80530 @@ -860,6 +863,12 @@ private:
80543 diff --git a/src/third_party/skia/src/core/SkTraceEventCommon.h b/src/third_party/skia/src/core/SkT…
80545 --- a/src/third_party/skia/src/core/SkTraceEventCommon.h
80547 @@ -4,6 +4,7 @@
80555 @@ -13,16 +14,19 @@
80559 -// The first two arguments to all TRACE macros are the category and name. Both are strings, and
80560 -// must have application lifetime (statics or literals). The same applies to arg_names, and string
80561 -// argument values. However, you can force a copy of a string argument value with TRACE_STR_COPY:
80562 -// TRACE_EVENT1("category", "name", "arg1", "literal string is only referenced");
80563 -// TRACE_EVENT1("category", "name", "arg1", TRACE_STR_COPY("string will be copied"));
80574 -// can be enabled or disabled by the tracing framework. The trace system will automatically add the
80575 -// process id, thread id, and microsecond timestamp to all events.
80581 // The TRACE_EVENT[0-2] macros trace the duration of entire scopes:
80582 @@ -38,26 +42,31 @@
80586 -// Trace event also supports counters, which is a way to track a quantity as it varies over time.
80587 -// Counters are created with the following macro:
80592 -// Counters are process-specific. The macro itself can be issued from any thread, however.
80593 +// Counters are process-specific. The macro itself can be issued from any
80596 -// Sometimes, you want to track two counters at once. You can do this with two counter macros:
80605 -// The tracing UI will show these counters in a single graph, as a summed area chart.
80613 -#define TRACE_EMPTY do {} while (0)
80620 @@ -79,124 +88,248 @@
80624 -public:
80625 - SkAndroidFrameworkTraceUtil(const char* name) {
80626 - if (CC_UNLIKELY(gEnableAndroidTracing)) {
80627 - ATRACE_BEGIN(name);
80628 - }
80629 - }
80630 - SkAndroidFrameworkTraceUtil(bool, const char* fmt, ...) {
80631 - if (CC_LIKELY((!gEnableAndroidTracing) || (!ATRACE_ENABLED()))) return;
80632 -
80633 - const int BUFFER_SIZE = 256;
80634 - va_list ap;
80635 - char buf[BUFFER_SIZE];
80636 -
80637 - va_start(ap, fmt);
80638 - vsnprintf(buf, BUFFER_SIZE, fmt, ap);
80639 - va_end(ap);
80640 -
80641 - ATRACE_BEGIN(buf);
80647 - ~SkAndroidFrameworkTraceUtil() {
80648 - if (CC_UNLIKELY(gEnableAndroidTracing)) {
80649 - ATRACE_END();
80650 - }
80672 - static void setEnableTracing(bool enableAndroidTracing) {
80673 - gEnableAndroidTracing = enableAndroidTracing;
80674 - }
80679 - static bool getEnableTracing() {
80680 - return gEnableAndroidTracing;
80681 - }
80684 -private:
80685 - static bool gEnableAndroidTracing;
80691 -public:
80692 - SkAndroidFrameworkTraceUtilAlways(const char* fmt, ...) {
80693 - if (!ATRACE_ENABLED()) return;
80694 -
80695 - const int BUFFER_SIZE = 256;
80696 - va_list ap;
80697 - char buf[BUFFER_SIZE];
80698 -
80699 - va_start(ap, fmt);
80700 - vsnprintf(buf, BUFFER_SIZE, fmt, ap);
80701 - va_end(ap);
80702 -
80703 - ATRACE_BEGIN(buf);
80704 - }
80705 - ~SkAndroidFrameworkTraceUtilAlways() {
80706 - ATRACE_END();
80707 - }
80726 -#define ATRACE_ANDROID_FRAMEWORK(fmt, ...) SkAndroidFrameworkTraceUtil __trace(true, fmt, ##__VA_A…
80727 -#define ATRACE_ANDROID_FRAMEWORK_ALWAYS(fmt, ...) SkAndroidFrameworkTraceUtilAlways __trace_always…
80733 -// Records a pair of begin and end events called "name" for the current scope, with 0, 1 or 2
80734 -// associated arguments. In the framework, the arguments are ignored.
80739 - SkAndroidFrameworkTraceUtil __trace(name)
80742 - SkAndroidFrameworkTraceUtilAlways __trace_always(name)
80745 - SkAndroidFrameworkTraceUtil __trace(name)
80746 -#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \
80747 - SkAndroidFrameworkTraceUtil __trace(name)
80753 -// Records a single event called "name" immediately, with 0, 1 or 2 associated arguments. If the
80754 -// category is not enabled, then this does nothing.
80758 - do { SkAndroidFrameworkTraceUtil __trace(name); } while(0)
80764 - do { SkAndroidFrameworkTraceUtil __trace(name); } while(0)
80771 - do { SkAndroidFrameworkTraceUtil __trace(name); } while(0)
80778 -#define TRACE_COUNTER1(category_group, name, value) \
80779 - if (CC_UNLIKELY(SkAndroidFrameworkTraceUtil::getEnableTracing())) { \
80780 - ATRACE_INT(name, value); \
80781 - }
80787 // Records the values of a multi-parted counter called "name" immediately.
80790 -#define TRACE_COUNTER2(category_group, name, value1_name, value1_val, value2_name, value2_val) \
80791 - do { \
80792 - if (CC_UNLIKELY(SkAndroidFrameworkTraceUtil::getEnableTracing())) { \
80793 - ATRACE_INT(name "-" value1_name, value1_val); \
80794 - ATRACE_INT(name "-" value2_name, value2_val); \
80795 - } \
80796 - } while (0)
80801 + ATRACE_INT(name "-" value1_name, value1_val); \
80802 + ATRACE_INT(name "-" value2_name, value2_val); \
80808 -#define TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(category_group, name, id, snapshot) TRACE_EMPTY
80815 -// This is only used for some shader text logging that isn't supported in ATrace anyway.
80868 +// Records the values of a multi-parted counter called "name" immediately.
80870 +// values as a stacked-bar chart.
80923 - do { *ret = false; } while (0)
80933 -#else // !SK_BUILD_FOR_ANDROID_FRAMEWORK && !SK_DISABLE_TRACING
80939 -// Records a pair of begin and end events called "name" for the current scope, with 0, 1 or 2
80940 -// associated arguments. If the category is not enabled, then this does nothing.
80947 @@ -206,11 +339,13 @@ public:
80951 -#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val) \
80952 - INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)
80958 -// Records a single event called "name" immediately, with 0, 1 or 2 associated arguments. If the
80959 -// category is not enabled, then this does nothing.
80965 @@ -242,42 +377,48 @@ public:
80969 -#define TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \
80970 - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
80971 - TRACE_EVENT_PHASE_ASYNC_BEGIN, category, name, id, TRACE_EVENT_FLAG_NONE)
80972 -#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \
80973 - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
80974 - category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
80975 -#define TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \
80976 - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_BEGIN, \
80977 - category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
80978 -
80979 -#define TRACE_EVENT_ASYNC_END0(category, name, id) \
80980 - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
80981 - category, name, id, TRACE_EVENT_FLAG_NONE)
80982 -#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \
80983 - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
80984 - category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
80985 -#define TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, arg2_name, arg2_val) \
80986 - INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_ASYNC_END, \
80987 - category, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, arg2_name, arg2_val)
81016 - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
81017 - TRACE_EVENT_PHASE_CREATE_OBJECT, category_group, name, id, \
81018 - TRACE_EVENT_FLAG_NONE)
81026 - TRACE_EVENT_PHASE_SNAPSHOT_OBJECT, category_group, name, \
81027 - id, TRACE_EVENT_FLAG_NONE, "snapshot", snapshot)
81032 - INTERNAL_TRACE_EVENT_ADD_WITH_ID( \
81033 - TRACE_EVENT_PHASE_DELETE_OBJECT, category_group, name, id, \
81034 - TRACE_EVENT_FLAG_NONE)
81041 @@ -320,7 +461,8 @@ public:
81045 -// Enum reflecting the scope of an INSTANT event. Must fit within TRACE_EVENT_FLAG_SCOPE_MASK.
81051 diff --git a/src/third_party/skia/src/gpu/GrDirectContext.cpp b/src/third_party/skia/src/gpu/GrDire…
81053 --- a/src/third_party/skia/src/gpu/GrDirectContext.cpp
81055 @@ -126,6 +126,12 @@ void GrDirectContext::abandonContext() {
81068 @@ -142,9 +148,6 @@ void GrDirectContext::abandonContext() {
81070 fGpu->disconnect(GrGpu::DisconnectType::kAbandon);
81072 - // Must be after GrResourceCache::abandonAll().
81073 - fMappedBufferManager.reset();
81074 -
81076 fSmallPathAtlasMgr->reset();
81078 diff --git a/src/third_party/skia/src/gpu/GrFinishCallbacks.cpp b/src/third_party/skia/src/gpu/GrFi…
81080 --- a/src/third_party/skia/src/gpu/GrFinishCallbacks.cpp
81082 @@ -35,10 +35,16 @@ void GrFinishCallbacks::check() {
81086 - fCallbacks.front().fCallback(fCallbacks.front().fContext);
81094 - fGpu->deleteFence(fCallbacks.front().fFence);
81095 + fGpu->deleteFence(finishCallback.fFence);
81101 diff --git a/src/third_party/skia/src/ports/skia_ohos/FontConfig_ohos.cpp b/src/third_party/skia/sr…
81104 --- /dev/null
81106 @@ -0,0 +1,1256 @@
81108 +// Use of this source code is governed by a BSD-style license that can be
81171 + * \n Return -1, if there is no any font style set in the system.
81182 + * \n Return -1, if the 'index' is out of range
81186 + if (index < 0 || index >= this->getFamilyCount()) {
81188 + familyName->reset();
81190 + return -1;
81193 + *familyName = genericFamilySet[index]->familyName;
81195 + return genericFamilySet[index]->typefaceSet->size();
81208 + return -1;
81212 + return fallbackSet[styleIndex]->typefaceSet->size();
81216 + return genericFamilySet[styleIndex]->typefaceSet->size();
81219 + return -1;
81239 + const TypefaceSet& tpSet = *(fallbackSet[styleIndex]->typefaceSet.get());
81244 + const TypefaceSet& tpSet = *(genericFamilySet[styleIndex]->typefaceSet.get());
81270 + pSet = fallbackSet[styleIndex]->typefaceSet.get();
81272 + pSet = genericFamilySet[styleIndex]->typefaceSet.get();
81288 + * \n Return -1, if 'familyName' is not found in the system
81308 + return -1;
81329 + const SkFontStyle& fontStyle = typefaceSet[i]->fontStyle();
81359 + widthDiff = dstWidth - srcWidth;
81361 + widthDiff = srcWidth - dstWidth + 5;
81365 + widthDiff = srcWidth - dstWidth;
81367 + widthDiff = dstWidth - srcWidth + 5;
81394 + weightDiff = dstWeight - srcWeight;
81396 + weightDiff = srcWeight - dstWeight + 500;
81400 + weightDiff = srcWeight - dstWeight;
81402 + weightDiff = dstWeight - srcWeight + 500;
81455 + // "fontdir" - optional, the data type should be string
81464 + // "generic", "fallback" - necessary, the data type should be array
81514 + bool isJson = jsonReader->parse(data, data + size, &root, &errs);
81537 + if (i < count - 1) {
81551 + LOGI("[%d] familyName : %s - %d\n", i, genericFamilySet[i]->familyName.c_str(),
81552 + static_cast<int>(genericFamilySet[i]->typefaceSet->size()));
81553 + for (int j = 0; j < genericFamilySet[i]->typefaceSet->size(); j++) {
81554 + if ((*(genericFamilySet[i]->typefaceSet))[j].get()) {
81555 + const FontInfo* font = (*(genericFamilySet[i]->typefaceSet))[j]->getFontInfo();
81576 + LOGI("[%d] family : %s - %d\n", count++, key.c_str(), setIndex.count);
81578 + const TypefaceSet& tpSet = *(fallbackSet[i]->typefaceSet.get());
81579 + LOGI("[%s] - %d\n", fallbackSet[i]->familyName.c_str(), static_cast<int>(tpSet.size())…
81582 + const FontInfo* font = tpSet[j]->getFontInfo();
81584 + this->dumpFont(*font);
81622 + // "family" - necessary, the data type should be String
81630 + // "alias" - necessary, the data type should be Array
81634 + // "adjust", "variation" - optional
81695 + return logErrInfo(ERROR_CONFIG_MISSING_TAG, "generic-alias-name");
81700 + return logErrInfo(ERROR_CONFIG_INVALID_VALUE_TYPE, "generic-alias-weight",
81707 + genericFamily->familyName = SkString(key);
81709 + genericFamily->typefaceSet = std::make_shared<TypefaceSet>();
81712 + genericFamily->typefaceSet = genericFamilySet[index]->typefaceSet;
81714 + genericNames.set(SkString(genericFamily->familyName), genericFamilySet.size());
81732 + int values[2]; // value[0] - to save 'weight', value[1] - to save 'to'
81758 + return logErrInfo(ERROR_CONFIG_MISSING_TAG, "fallback-fallbackFor");
81763 + return logErrInfo(ERROR_CONFIG_INVALID_VALUE_TYPE, "fallback-items",
81772 + text.appendf("fallback-%s#%d", key, i + 1);
81779 + FallbackSetPos setPos = {startPos, (unsigned int)(fallbackSet.size() - startPos)};
81793 + return logErrInfo(ERROR_CONFIG_MISSING_TAG, "fallback-item-lang");
81809 + return logErrInfo(ERROR_CONFIG_MISSING_TAG, "fallback-item-lang");
81812 + return logErrInfo(ERROR_CONFIG_INVALID_VALUE_TYPE, "fallback-item-family",
81849 + fallback->familyName = familyName;
81850 + fallback->langs = lang;
81851 + fallback->typefaceSet = std::make_shared<TypefaceSet>();
81984 + if (info->familyName == font.familyName && info->ttcIndex < count) {
81986 + TypefaceSet* tpSet = this->getTypefaceSet(familyName, specifiedName);
81990 + newFont.index = info->ttcIndex;
81992 + tpSet->push_back(std::move(typeface));
82023 + if (variationSet[i].width != -1) {
82026 + if (variationSet[i].slant != -1) {
82031 + tpSet->push_back(std::move(typeface));
82049 + specifiedName = genericFamilySet[index]->familyName;
82050 + return genericFamilySet[index]->typefaceSet.get();
82054 + return fallbackSet[index]->typefaceSet.get();
82088 + // for adjustMap - update weight
82109 + tpSet->push_back(std::move(typeface));
82134 + if (node->d_type != DT_REG) {
82137 + const char* fname = node->d_name;
82140 + if (len < suffixLen || (strncmp(fname + len - suffixLen, ".ttf", suffixLen) &&
82141 + strncmp(fname + len - suffixLen, ".otf", suffixLen) &&
82142 + strncmp(fname + len - suffixLen, ".ttc", suffixLen) &&
82143 + strncmp(fname + len - suffixLen, ".otc", suffixLen))) {
82150 + if (fontDirSet[i][fontDirSet[i].size() - 1] != '/') {
82171 + if (genericFamilySet[index]->typefaceSet->size() == 0) {
82172 + this->logErrInfo(ERROR_FAMILY_NOT_FOUND, key.c_str());
82174 + sortTypefaceSet(genericFamilySet[index]->typefaceSet);
82179 + buildSubTypefaceSet(genericFamilySet[index]->typefaceSet,
82180 + genericFamilySet[index + i]->typefaceSet,
82181 + genericFamilySet[index + i]->familyName,
82183 + if (genericFamilySet[index + i]->typefaceSet->size() == 0) {
82184 + this->logErrInfo(ERROR_FAMILY_NOT_FOUND,
82185 + genericFamilySet[index + i]->familyName.c_str());
82206 + if (typefaceSet->size() == 0) {
82209 + for (unsigned int i = 0; i < typefaceSet->size(); i++) {
82211 + if (typeface && typeface->fontStyle().weight() == weight) {
82212 + const FontInfo* pFont = typeface->getFontInfo();
82218 + subSet->push_back(std::move(newTypeface));
82229 + if (fallbackSet[i]->typefaceSet->size() == 0) {
82230 + logErrInfo(ERROR_FAMILY_NOT_FOUND, fallbackSet[i]->familyName.c_str());
82232 + sortTypefaceSet(fallbackSet[i]->typefaceSet);
82265 + if (typefaceSet.get() == nullptr || typefaceSet->size() <= 1) {
82270 + for (unsigned int j = 0; j < tpSet.size() - 1; j++) {
82271 + if ((tpSet[j]->fontStyle().weight() > tpSet[j + 1]->fontStyle().weight()) ||
82272 + (tpSet[j]->fontStyle().weight() == tpSet[j + 1]->fontStyle().weight() &&
82273 + tpSet[j]->fontStyle().slant() > tpSet[j + 1]->fontStyle().slant())) {
82363 diff --git a/src/third_party/skia/src/ports/skia_ohos/FontConfig_ohos.h b/src/third_party/skia/src/…
82366 --- /dev/null
82368 @@ -0,0 +1,230 @@
82370 +// Use of this source code is governed by a BSD-style license that can be
82392 + printf("E %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
82394 + printf("I %s:%d - " fmt, __FUNCTION__, __LINE__, ##args)
82396 + printf("W %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
82525 + VariationInfo() : weight(-1), width(-1), slant(-1){}
82599 diff --git a/src/third_party/skia/src/ports/skia_ohos/FontInfo_ohos.h b/src/third_party/skia/src/po…
82602 --- /dev/null
82604 @@ -0,0 +1,147 @@
82606 +// Use of this source code is governed by a BSD-style license that can be
82641 + stream = font.stream->duplicate();
82668 + this->fname.set(fname);
82694 + stream = font.stream->duplicate();
82752 diff --git a/src/third_party/skia/src/ports/skia_ohos/SkFontMgr_ohos.cpp b/src/third_party/skia/src…
82755 --- /dev/null
82757 @@ -0,0 +1,471 @@
82759 +// Use of this source code is governed by a BSD-style license that can be
82774 + familyCount = fontConfig->getFamilyCount();
82795 + fontConfig->getFamilyName(index, familyName);
82809 + if (index < 0 || index >= this->countFamilies()) {
82833 + int index = fontConfig->getStyleIndex(familyName, isFallback);
82834 + if (index == -1) {
82856 + styleIndex = fontConfig->getStyleIndex(familyName, isFallback);
82858 + return SkSafeRef(fontConfig->getTypeface(styleIndex, style, isFallback));
82879 + const FallbackForMap& fallbackForMap = fontConfig->getFallbackForMap();
82880 + const FallbackSet& fallbackSet = fontConfig->getFallbackSet();
82912 + for (unsigned int i = item->index; i < item->index + item->count && i < fallbackSet.si…
82913 + const TypefaceSet& tpSet = *(fallbackSet[i]->typefaceSet.get());
82914 + if (tpSet.size() > 0 && tpSet[0]->unicharToGlyph(character) != 0) {
82946 + const FallbackSet& fallbackSet = fontConfig->getFallbackSet();
82947 + // example bcp47 code : 'zh-Hans' : ('zh' : iso639 code, 'Hans' : iso15924 code)
82953 + tps[i] = -1;
82958 + int ret = compareLangs(fallbackSet[i]->langs, bcp47, bcp47Count, tps);
82959 + if (ret == -1) {
82965 + for (int i = bcp47Count - 1; i >= 0; i--) {
82966 + if (tps[i] == -1) {
82969 + const TypefaceSet& tpSet = *(fallbackSet[tps[i]]->typefaceSet.get());
82970 + if (tpSet.size() > 0 && tpSet[0]->unicharToGlyph(character) != 0) {
82975 + for (int i = totalCount - 1; i >= bcp47Count; i--) {
82976 + if (tps[i] == -1) {
82979 + const TypefaceSet& tpSet = *(fallbackSet[tps[i]]->typefaceSet.get());
82980 + if (tpSet.size() > 0 && tpSet[0]->unicharToGlyph(character) != 0) {
82994 + * \n Return -1, if no language matching happens
83000 + * zh-Hans : ('zh' : iso639 code, 'Hans' : iso15924 code)
83003 + return -1;
83005 + for (int i = bcp47Count - 1; i >= 0; i--) {
83006 + if (tps[i] != -1) {
83009 + if (langs.find(bcp47[i]) != -1) {
83012 + const char* iso15924 = strrchr(bcp47[i], '-');
83017 + int len = iso15924 - 1 - bcp47[i];
83019 + if (langs.find(iso15924) != -1 ||
83020 + (strncmp(bcp47[i], "und", strlen("und")) && langs.find(country.c_str()) != -1)) {
83025 + return -1;
83041 + typeface->getFamilyName(&familyName);
83042 + return this->onMatchFamilyStyle(familyName.c_str(), style);
83060 + return this->makeTypeface(std::move(memoryStream), args, nullptr);
83078 + return this->makeTypeface(std::move(stream), args, nullptr);
83094 + return this->makeTypeface(std::move(stream), args, nullptr);
83117 + return this->makeTypeface(std::move(stream), args, path);
83130 + SkTypeface* typeface = this->onMatchFamilyStyle(familyName, style);
83133 + typeface = this->onMatchFamilyStyle(nullptr, style);
83194 + int ttcIndex = fontData->getIndex();
83195 + int axisCount = fontData->getAxisCount();
83196 + SkStreamAsset* stream = fontData->getStream();
83204 + const SkFixed* axis = fontData->getAxis();
83216 + fontInfo.stream = fontData->detachStream();
83229 diff --git a/src/third_party/skia/src/ports/skia_ohos/SkFontMgr_ohos.h b/src/third_party/skia/src/p…
83232 --- /dev/null
83234 @@ -0,0 +1,67 @@
83238 + * Use of this source code is governed by a BSD-style license that can be
83302 diff --git a/src/third_party/skia/src/ports/skia_ohos/SkFontStyleSet_ohos.cpp b/src/third_party/ski…
83305 --- /dev/null
83307 @@ -0,0 +1,103 @@
83309 +// Use of this source code is governed by a BSD-style license that can be
83317 + * \param isFallback true - the font style is from fallback family
83318 + * \n false - the font style is from generic family
83325 + tpCount = fontConfig_->getTypefaceCount(styleIndex, isFallback);
83344 + if (index < 0 || index >= this->count() || fontConfig_ == nullptr) {
83348 + SkTypeface* typeface = fontConfig_->getTypeface(styleIndex, index, isFallback);
83354 + *style = typeface->fontStyle();
83372 + unsigned int i = typeface->fontStyle().weight() / 100;
83374 + styleName->set(names[i]);
83376 + styleName->reset();
83389 + if (index < 0 || index >= this->count()) {
83393 + return SkSafeRef(fontConfig_->getTypeface(styleIndex, index, isFallback));
83406 + return SkSafeRef(fontConfig_->getTypeface(styleIndex, pattern, isFallback));
83411 diff --git a/src/third_party/skia/src/ports/skia_ohos/SkFontStyleSet_ohos.h b/src/third_party/skia/…
83414 --- /dev/null
83416 @@ -0,0 +1,32 @@
83418 +// Use of this source code is governed by a BSD-style license that can be
83445 + int tpCount = -1; // the typeface count in the font style set
83449 diff --git a/src/third_party/skia/src/ports/skia_ohos/SkTypeface_ohos.cpp b/src/third_party/skia/sr…
83452 --- /dev/null
83454 @@ -0,0 +1,139 @@
83456 +// Use of this source code is governed by a BSD-style license that can be
83494 + *ttcIndex = fontInfo->index;
83496 + if (fontInfo->stream == nullptr) {
83497 + fontInfo->stream = SkStream::MakeFromFile(fontInfo->fname.c_str());
83499 + if (fontInfo->stream) {
83500 + return fontInfo->stream->duplicate();
83515 + if (fontInfo->stream.get() == nullptr) {
83516 + fontInfo->stream = SkStream::MakeFromFile(fontInfo->fname.c_str());
83518 + if (fontInfo->stream.get() == nullptr) {
83521 + return std::make_unique<SkFontData>(fontInfo->stream->duplicate(), fontInfo->index,
83522 + fontInfo->axisSet.axis.data(), fontInfo->axisSet.axis.size());
83537 + descriptor->setFamilyName(familyName.c_str());
83538 + descriptor->setStyle(this->fontStyle());
83554 + *familyName = fontInfo->familyName;
83569 + if (count > 0 && count == fontInfo->axisSet.range.size()) {
83573 + axisDefs.push_back(fontInfo->axisSet.range[i]);
83578 + axisValues, fontInfo->familyName);
83594 diff --git a/src/third_party/skia/src/ports/skia_ohos/SkTypeface_ohos.h b/src/third_party/skia/src/…
83597 --- /dev/null
83599 @@ -0,0 +1,34 @@
83601 +// Use of this source code is governed by a BSD-style license that can be
83634 diff --git a/src/third_party/skia/tests/GrFinishedFlushTest.cpp b/src/third_party/skia/tests/GrFini…
83636 --- a/src/third_party/skia/tests/GrFinishedFlushTest.cpp
83638 @@ -9,10 +9,12 @@
83651 @@ -140,3 +142,71 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FlushFinishedProcTest, reporter, ctxInfo) {
83657 + ((GrDirectContext*)context)->abandonContext();
83688 + mbet->texture(),
83695 + mbet->releaseContext(nullptr, nullptr));
83700 + SkCanvas* canvas = surface->getCanvas();
83701 + canvas->clear(SK_ColorGREEN);
83710 + dContext->flush(flushInfo);
83712 + surface->asyncRescaleAndReadPixels(info,
83721 + dContext->flushAndSubmit(/*syncCpu=*/true);
83723 diff --git a/src/third_party/sqlite/README.chromium b/src/third_party/sqlite/README.chromium
83725 --- a/src/third_party/sqlite/README.chromium
83727 @@ -1,7 +1,7 @@
83730 -Version: 3.37.1
83731 -CPEPrefix: cpe:/a:sqlite:sqlite:3.37.1
83737 diff --git a/src/third_party/sqlite/src/Makefile.in b/src/third_party/sqlite/src/Makefile.in
83739 --- a/src/third_party/sqlite/src/Makefile.in
83741 @@ -180,7 +180,7 @@ LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
83745 - icu.lo insert.lo json1.lo legacy.lo loadext.lo \
83750 @@ -234,6 +234,7 @@ SRC = \
83758 @@ -366,7 +367,6 @@ SRC += \
83762 - $(TOP)/ext/misc/json1.c \
83766 @@ -460,6 +460,7 @@ TESTSRC += \
83774 @@ -502,6 +503,7 @@ TESTSRC2 = \
83782 @@ -608,7 +610,7 @@ TESTOPTS = --verbose=file --output=test-out.txt
83786 -SHELL_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4
83787 +SHELL_OPT = -DSQLITE_ENABLE_FTS4
83788 #SHELL_OPT += -DSQLITE_ENABLE_FTS5
83789 SHELL_OPT += -DSQLITE_ENABLE_RTREE
83790 SHELL_OPT += -DSQLITE_ENABLE_EXPLAIN_COMMENTS
83791 @@ -618,8 +620,8 @@ SHELL_OPT += -DSQLITE_ENABLE_DBPAGE_VTAB
83792 SHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
83793 SHELL_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
83794 SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
83795 -FUZZERSHELL_OPT = -DSQLITE_ENABLE_JSON1
83796 -FUZZCHECK_OPT = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
83798 +FUZZCHECK_OPT = -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
83799 FUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000
83800 FUZZCHECK_OPT += -DSQLITE_PRINTF_PRECISION_LIMIT=1000
83801 FUZZCHECK_OPT += -DSQLITE_ENABLE_FTS4
83802 @@ -629,7 +631,7 @@ FUZZCHECK_OPT += -DSQLITE_ENABLE_RTREE
83803 FUZZCHECK_OPT += -DSQLITE_ENABLE_GEOPOLY
83804 FUZZCHECK_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
83805 FUZZCHECK_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
83806 -FUZZCHECK_SRC = $(TOP)/test/fuzzcheck.c $(TOP)/test/ossfuzz.c
83811 @@ -873,6 +875,9 @@ hash.lo: $(TOP)/src/hash.c $(HDR)
83813 $(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/insert.c
83816 + $(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/json.c
83819 $(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/legacy.c
83821 @@ -1176,9 +1181,6 @@ userauth.lo: $(TOP)/ext/userauth/userauth.c $(HDR) $(EXTHDR)
83823 $(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/session/sqlite3session.c
83825 -json1.lo: $(TOP)/ext/misc/json1.c
83826 - $(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/misc/json1.c
83827 -
83829 $(LTCOMPILE) -DSQLITE_CORE -c $(TOP)/ext/misc/stmt.c
83831 @@ -1511,3 +1513,134 @@ sqlite3.def: $(REAL_LIBOBJ)
83833 $(TCC) -shared -o $@ sqlite3.def \
83834 -Wl,"--strip-all" $(REAL_LIBOBJ)
83844 +fiddle_module_js = $(fiddle_dir)/fiddle-module.js
83847 +#emcc_opt = -O0
83848 +#emcc_opt = -O1
83849 +#emcc_opt = -O2
83850 +#emcc_opt = -O3
83851 +emcc_opt = -Oz
83852 +emcc_flags = $(emcc_opt) -sALLOW_TABLE_GROWTH -sSTRICT_JS \
83853 + -sENVIRONMENT=web -sMODULARIZE \
83854 + -sEXPORTED_RUNTIME_METHODS=@$(fiddle_dir_abs)/EXPORTED_RUNTIME_METHODS \
83855 + -sDYNAMIC_EXECUTION=0 \
83856 + -I. $(SHELL_OPT)
83860 + emcc -o $@ $(emcc_flags) \
83861 + -sEXPORT_NAME=initFiddleModule \
83862 + -sEXPORTED_FUNCTIONS=@$(fiddle_dir_abs)/EXPORTED_FUNCTIONS.fiddle \
83865 + gzip < $(fiddle_dir)/fiddle-module.wasm > $(fiddle_dir)/fiddle-module.wasm.gz
83867 + $(fiddle_dir)/sqlite3-api.js \
83869 + $(fiddle_dir)/EXPORTED_FUNCTIONS.sqlite3-api
83870 + emcc -o $@ $(emcc_flags) \
83871 + -sEXPORT_NAME=initSqlite3Module \
83872 + -sEXPORTED_FUNCTIONS=@$(fiddle_dir_abs)/EXPORTED_FUNCTIONS.sqlite3-api \
83873 + --post-js=$(fiddle_dir)/sqlite3-api.js \
83874 + --no-entry \
83878 + gzip < $(fiddle_dir)/sqlite3-api.js > $(fiddle_dir)/sqlite3-api.js.gz
83881 +$(fiddle_dir)/sqlite3-api.js.gz: $(fiddle_dir)/sqlite3-api.js
83885 + $(fiddle_dir)/fiddle-module.wasm \
83886 + $(fiddle_dir)/fiddle-module.wasm.gz \
83892 + $(fiddle_dir)/sqlite3-api.js.gz
83894 +clean-wasm:
83895 + rm -f $(fiddle_generated) $(sqlite3_wasm_generated)
83896 +clean: clean-wasm
83898 +sqlite3-wasm: $(sqlite3_wasm_js)
83899 +wasm: fiddle sqlite3-wasm
83904 +# https://github.com/emscripten-core/emscripten/blob/main/src/settings.js
83906 +# -sENVIRONMENT=web: elides bootstrap code related to non-web JS
83909 +# non-browser JS environments.
83911 +# -sMODULARIZE: changes how the generated code is structured to avoid
83915 +# -sEXPORT_NAME=jsFunctionName (see -sMODULARIZE)
83917 +# -sEXPORTED_RUNTIME_METHODS=@/absolute/path/to/file: a file
83918 +# containing a list of emscripten-supplied APIs, one per line, which
83921 +# -sEXPORTED_FUNCTIONS=@/absolute/path/to/file: a file containing a
83928 +# -sSTRICT_JS ensures that the emitted JS code includes the 'use
83929 +# strict' option. Note that -sSTRICT is more broadly-scoped and
83932 +# -sALLOW_TABLE_GROWTH is required for (at a minimum) the UDF-binding
83935 +# -sDYNAMIC_EXECUTION=0 disables eval() and the Function constructor.
83940 +# -sWASM_BIGINT is UNTESTED but "should" allow the int64-using C APIs
83945 +# --no-entry: for compiling library code with no main(). If this is
83950 +# --pre-js/--post-js=FILE relative or absolute paths to JS files to
83951 +# prepend/append to the emcc-generated bootstrapping JS. It's
83953 +# requirements) but certain configurations, namely -sMODULARIZE, may
83954 +# require using at least a --pre-js file. They can be used
83957 +# -O0..-O3 and -Oz: optimization levels affect not only C-style
83959 +# gets minified. -O0 compiles _much_ more quickly than -O3 or -Oz,
83961 +# development. -O3 or -Oz are recommended for deployment, but
83962 +# primarily because -Oz will shrink the wasm file notably. JS-side
83966 diff --git a/src/third_party/sqlite/src/Makefile.msc b/src/third_party/sqlite/src/Makefile.msc
83968 --- a/src/third_party/sqlite/src/Makefile.msc
83970 @@ -363,7 +363,6 @@ SQLITE_TCL_DEP =
83971 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1
83972 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1
83973 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1
83974 -OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_JSON1=1
83975 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
83976 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
83977 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1
83978 @@ -580,17 +579,17 @@ RCC = $(RC) -DSQLITE_OS_WIN=1 -I. -I$(TOP) -I$(TOP)\src $(RCOPTS) $(RCCOPTS)
83982 -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcal…
83983 -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdca…
83984 +CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBAC…
83985 +SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBA…
83987 -TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcal…
83988 …S = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -D…
83992 -CORE_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcal…
83993 -SHELL_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdca…
83994 +CORE_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBAC…
83995 +SHELL_CCONV_OPTS = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBA…
83997 -TEST_CCONV_OPTS = -Gz -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcal…
83998 …S = -Gz -guard:cf -DSQLITE_CDECL=__cdecl -DSQLITE_APICALL=__stdcall -DSQLITE_CALLBACK=__stdcall -D…
84002 @@ -1248,7 +1247,7 @@ LIBOBJS0 = vdbe.lo parse.lo alter.lo analyze.lo attach.lo auth.lo \
84006 - icu.lo insert.lo json1.lo legacy.lo loadext.lo \
84011 @@ -1315,6 +1314,7 @@ SRC00 = \
84019 @@ -1445,7 +1445,6 @@ SRC07 = \
84023 - $(TOP)\ext\misc\json1.c \
84027 @@ -1579,6 +1578,7 @@ TESTEXT = \
84035 @@ -1695,9 +1695,9 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1
84039 -MPTESTER_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5
84040 -FUZZERSHELL_COMPILE_OPTS = -DSQLITE_ENABLE_JSON1
84041 -FUZZCHECK_OPTS = -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ -DSQLITE_MAX_MEMO…
84042 +MPTESTER_COMPILE_OPTS = -DSQLITE_ENABLE_FTS5
84044 +FUZZCHECK_OPTS = -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ -DSQLITE_MAX_MEMORY=50000000 -DSQLITE_P…
84045 FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_FTS4
84046 FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_FTS5
84047 FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_RTREE
84048 @@ -1705,7 +1705,7 @@ FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_GEOPOLY
84049 FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_DBSTAT_VTAB
84050 FUZZCHECK_OPTS = $(FUZZCHECK_OPTS) -DSQLITE_ENABLE_BYTECODE_VTAB
84052 -FUZZCHECK_SRC = $(TOP)\test\fuzzcheck.c $(TOP)\test\ossfuzz.c
84055 DBFUZZ_COMPILE_OPTS = -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
84056 KV_COMPILE_OPTS = -DSQLITE_THREADSAFE=0 -DSQLITE_DIRECT_OVERFLOW_READ
84057 @@ -1990,6 +1990,9 @@ hash.lo: $(TOP)\src\hash.c $(HDR)
84059 $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\insert.c
84062 + $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\json.c
84065 $(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\legacy.c
84067 @@ -2298,9 +2301,6 @@ fts3_unicode2.lo: $(TOP)\ext\fts3\fts3_unicode2.c $(HDR) $(EXTHDR)
84069 $(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\fts3\fts3_write.c
84071 -json1.lo: $(TOP)\ext\misc\json1.c $(HDR) $(EXTHDR)
84072 - $(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\misc\json1.c
84073 -
84075 $(LTCOMPILE) $(CORE_COMPILE_OPTS) $(NO_WARN) -DSQLITE_CORE -c $(TOP)\ext\misc\stmt.c
84077 @@ -2392,7 +2392,6 @@ TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_DEFAULT_PAGE_SIZE=1024
84078 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1
84079 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1
84080 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1
84081 -TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_ENABLE_JSON1=1
84082 TESTFIXTURE_FLAGS = $(TESTFIXTURE_FLAGS) -DSQLITE_CKSUMVFS_STATIC=1
84085 diff --git a/src/third_party/sqlite/src/README.md b/src/third_party/sqlite/src/README.md
84087 --- a/src/third_party/sqlite/src/README.md
84089 @@ -1,7 +1,7 @@
84092 -This repository contains the complete source code for the
84093 -[SQLite database engine](https://sqlite.org/). Some test scripts
84099 @@ -15,7 +15,7 @@ The [Fossil repository](https://sqlite.org/src/timeline) contains the urtext.
84101 then you are looking at a mirror. The names of check-ins and
84103 -names for those objects. The offical names for check-ins are
84104 +names for those objects. The official names for check-ins are
84105 found in a footer on the check-in comment for authorized mirrors.
84106 The official check-in name can also be seen in the `manifest.uuid` file
84108 @@ -30,7 +30,7 @@ verify its integrity, there are hints on how to do that in the
84112 - * Lastest trunk check-in as
84113 + * Latest trunk check-in as
84115 [ZIP-archive](https://www.sqlite.org/src/zip/sqlite.zip), or
84116 [SQLite-archive](https://www.sqlite.org/src/sqlar/sqlite.sqlar).
84117 @@ -47,11 +47,11 @@ archives or [SQLite archives](https://sqlite.org/cli.html#sqlar) as follows:
84121 -If you do want to use Fossil to check out the source tree,
84125 [here](https://www.fossil-scm.org/fossil/uv/download.html). Fossil is
84126 -a stand-alone program. To install, simply download or build the single
84127 +a stand-alone program. To install, simply download or build the single
84131 @@ -61,7 +61,7 @@ Then run commands like this:
84135 -update to the lastest version using:
84138 fossil update trunk ;# latest trunk check-in
84140 @@ -136,7 +136,7 @@ the "tclsqlite.c" file which implements the
84144 -Addtional test code is found in other source repositories.
84149 @@ -170,7 +170,7 @@ at just the right spots. Note that comment text in the sqlite3.h file is
84153 -The SQL language parser is **parse.c** which is generate from a grammar in
84158 @@ -180,7 +180,7 @@ generates parse.c.
84162 -file is generated by the scanning the src/vdbe.c source file. The
84167 @@ -237,7 +237,7 @@ prepared statements, the description of
84171 -Years of effort have gone into optimizating SQLite, both
84176 @@ -294,11 +294,11 @@ Key files:
84180 - (and some other test programs too) is build and run when you type
84184 * **ext/misc/json1.c** - This file implements the various JSON functions
84185 - that are build into SQLite.
84190 @@ -307,11 +307,13 @@ describes its purpose and role within the larger system.
84194 -contains either a SHA3-256 hash (for newer files) or a SHA1 hash (for
84195 +contains either a SHA3-256 hash (for newer files) or a SHA1 hash (for
84197 -The SHA3-256 hash of the `manifest`
84198 -file itself is the official name of the version of the source tree that you
84199 -have. The `manifest.uuid` file should contain the SHA3-256 hash of the
84201 +SHA3-256 hash of the `manifest` file itself, possibly with the
84204 +The `manifest.uuid` file should contain the SHA3-256 hash of the
84208 diff --git a/src/third_party/sqlite/src/VERSION b/src/third_party/sqlite/src/VERSION
84210 --- a/src/third_party/sqlite/src/VERSION
84212 @@ -1 +1 @@
84213 -3.37.1
84215 diff --git a/src/third_party/sqlite/src/amalgamation/rename_exports.h b/src/third_party/sqlite/src/…
84217 --- a/src/third_party/sqlite/src/amalgamation/rename_exports.h
84219 @@ -1,4 +1,4 @@
84220 -// Copyright 2018 The Chromium Authors. All rights reserved.
84222 // Use of this source code is governed by a BSD-style license that can be
84225 @@ -7,342 +7,349 @@
84229 -#define sqlite3_activate_cerod chrome_sqlite3_activate_cerod // Lines 6068-6070
84230 -#define sqlite3_aggregate_context chrome_sqlite3_aggregate_context // Line 5629
84231 -#define sqlite3_aggregate_count chrome_sqlite3_aggregate_count // Line 5404
84232 -#define sqlite3_auto_extension chrome_sqlite3_auto_extension // Line 6884
84233 -#define sqlite3_autovacuum_pages chrome_sqlite3_autovacuum_pages // Lines 6476-6481
84234 -#define sqlite3_backup_finish chrome_sqlite3_backup_finish // Line 8918
84235 -#define sqlite3_backup_init chrome_sqlite3_backup_init // Lines 8911-8916
84236 -#define sqlite3_backup_pagecount chrome_sqlite3_backup_pagecount // Line 8920
84237 -#define sqlite3_backup_remaining chrome_sqlite3_backup_remaining // Line 8919
84238 -#define sqlite3_backup_step chrome_sqlite3_backup_step // Line 8917
84239 -#define sqlite3_bind_blob chrome_sqlite3_bind_blob // Line 4510
84240 -#define sqlite3_bind_blob64 chrome_sqlite3_bind_blob64 // Lines 4511-4512
84241 -#define sqlite3_bind_double chrome_sqlite3_bind_double // Line 4513
84242 -#define sqlite3_bind_int chrome_sqlite3_bind_int // Line 4514
84243 -#define sqlite3_bind_int64 chrome_sqlite3_bind_int64 // Line 4515
84244 -#define sqlite3_bind_null chrome_sqlite3_bind_null // Line 4516
84245 -#define sqlite3_bind_parameter_count chrome_sqlite3_bind_parameter_count // Line 4545
84246 -#define sqlite3_bind_parameter_index chrome_sqlite3_bind_parameter_index // Line 4591
84247 -#define sqlite3_bind_parameter_name chrome_sqlite3_bind_parameter_name // Line 4573
84248 -#define sqlite3_bind_pointer chrome_sqlite3_bind_pointer // Line 4522
84249 -#define sqlite3_bind_text chrome_sqlite3_bind_text // Line 4517
84250 -#define sqlite3_bind_text16 chrome_sqlite3_bind_text16 // Line 4518
84251 -#define sqlite3_bind_text64 chrome_sqlite3_bind_text64 // Lines 4519-4520
84252 -#define sqlite3_bind_value chrome_sqlite3_bind_value // Line 4521
84253 -#define sqlite3_bind_zeroblob chrome_sqlite3_bind_zeroblob // Line 4523
84254 -#define sqlite3_bind_zeroblob64 chrome_sqlite3_bind_zeroblob64 // Line 4524
84255 -#define sqlite3_blob_bytes chrome_sqlite3_blob_bytes // Line 7462
84256 -#define sqlite3_blob_close chrome_sqlite3_blob_close // Line 7446
84257 -#define sqlite3_blob_open chrome_sqlite3_blob_open // Lines 7390-7398
84258 -#define sqlite3_blob_read chrome_sqlite3_blob_read // Line 7491
84259 -#define sqlite3_blob_reopen chrome_sqlite3_blob_reopen // Line 7423
84260 -#define sqlite3_blob_write chrome_sqlite3_blob_write // Line 7533
84261 +#define sqlite3_activate_cerod chrome_sqlite3_activate_cerod // Lines 6088-6090
84265 +#define sqlite3_autovacuum_pages chrome_sqlite3_autovacuum_pages // Lines 6518-6523
84267 +#define sqlite3_backup_init chrome_sqlite3_backup_init // Lines 8998-9003
84272 +#define sqlite3_bind_blob64 chrome_sqlite3_bind_blob64 // Lines 4526-4527
84283 +#define sqlite3_bind_text64 chrome_sqlite3_bind_text64 // Lines 4534-4535
84289 +#define sqlite3_blob_open chrome_sqlite3_blob_open // Lines 7464-7472
84295 -#define sqlite3_cancel_auto_extension chrome_sqlite3_cancel_auto_extension // Line 6896
84299 -#define sqlite3_clear_bindings chrome_sqlite3_clear_bindings // Line 4601
84303 -#define sqlite3_collation_needed chrome_sqlite3_collation_needed // Lines 6052-6056
84304 -#define sqlite3_collation_needed16 chrome_sqlite3_collation_needed16 // Lines 6057-6061
84305 -#define sqlite3_column_blob chrome_sqlite3_column_blob // Line 5077
84306 -#define sqlite3_column_bytes chrome_sqlite3_column_bytes // Line 5084
84307 -#define sqlite3_column_bytes16 chrome_sqlite3_column_bytes16 // Line 5085
84308 -#define sqlite3_column_count chrome_sqlite3_column_count // Line 4617
84309 -#define sqlite3_column_database_name chrome_sqlite3_column_database_name // Line 4691
84310 -#define sqlite3_column_database_name16 chrome_sqlite3_column_database_name16 // Line 4692
84311 -#define sqlite3_column_decltype chrome_sqlite3_column_decltype // Line 4728
84312 -#define sqlite3_column_decltype16 chrome_sqlite3_column_decltype16 // Line 4729
84313 -#define sqlite3_column_double chrome_sqlite3_column_double // Line 5078
84314 -#define sqlite3_column_int chrome_sqlite3_column_int // Line 5079
84315 -#define sqlite3_column_int64 chrome_sqlite3_column_int64 // Line 5080
84316 -#define sqlite3_column_name chrome_sqlite3_column_name // Line 4646
84317 -#define sqlite3_column_name16 chrome_sqlite3_column_name16 // Line 4647
84318 -#define sqlite3_column_origin_name chrome_sqlite3_column_origin_name // Line 4695
84319 -#define sqlite3_column_origin_name16 chrome_sqlite3_column_origin_name16 // Line 4696
84320 -#define sqlite3_column_table_name chrome_sqlite3_column_table_name // Line 4693
84321 -#define sqlite3_column_table_name16 chrome_sqlite3_column_table_name16 // Line 4694
84322 -#define sqlite3_column_text chrome_sqlite3_column_text // Line 5081
84323 -#define sqlite3_column_text16 chrome_sqlite3_column_text16 // Line 5082
84324 -#define sqlite3_column_type chrome_sqlite3_column_type // Line 5086
84325 -#define sqlite3_column_value chrome_sqlite3_column_value // Line 5083
84326 -#define sqlite3_commit_hook chrome_sqlite3_commit_hook // Line 6415
84327 +#define sqlite3_collation_needed chrome_sqlite3_collation_needed // Lines 6072-6076
84328 +#define sqlite3_collation_needed16 chrome_sqlite3_collation_needed16 // Lines 6077-6081
84356 -#define sqlite3_context_db_handle chrome_sqlite3_context_db_handle // Line 5656
84357 -#define sqlite3_create_collation chrome_sqlite3_create_collation // Lines 6002-6008
84358 -#define sqlite3_create_collation16 chrome_sqlite3_create_collation16 // Lines 6017-6023
84359 -#define sqlite3_create_collation_v2 chrome_sqlite3_create_collation_v2 // Lines 6009-6016
84361 +#define sqlite3_create_collation chrome_sqlite3_create_collation // Lines 6022-6028
84362 +#define sqlite3_create_collation16 chrome_sqlite3_create_collation16 // Lines 6037-6043
84363 +#define sqlite3_create_collation_v2 chrome_sqlite3_create_collation_v2 // Lines 6029-6036
84364 #define sqlite3_create_filename chrome_sqlite3_create_filename // Lines 3801-3807
84365 -#define sqlite3_create_function chrome_sqlite3_create_function // Lines 5266-5275
84366 -#define sqlite3_create_function16 chrome_sqlite3_create_function16 // Lines 5276-5285
84367 -#define sqlite3_create_function_v2 chrome_sqlite3_create_function_v2 // Lines 5286-5296
84368 -#define sqlite3_create_module chrome_sqlite3_create_module // Lines 7176-7181
84369 -#define sqlite3_create_module_v2 chrome_sqlite3_create_module_v2 // Lines 7182-7188
84370 -#define sqlite3_create_window_function chrome_sqlite3_create_window_function // Lines 5297-5308
84371 -#define sqlite3_data_count chrome_sqlite3_data_count // Line 4834
84372 -#define sqlite3_data_directory chrome_sqlite3_data_directory // Line 6185
84373 +#define sqlite3_create_function chrome_sqlite3_create_function // Lines 5285-5294
84374 +#define sqlite3_create_function16 chrome_sqlite3_create_function16 // Lines 5295-5304
84375 +#define sqlite3_create_function_v2 chrome_sqlite3_create_function_v2 // Lines 5305-5315
84376 +#define sqlite3_create_module chrome_sqlite3_create_module // Lines 7250-7255
84377 +#define sqlite3_create_module_v2 chrome_sqlite3_create_module_v2 // Lines 7256-7262
84378 +#define sqlite3_create_window_function chrome_sqlite3_create_window_function // Lines 5316-5327
84382 -#define sqlite3_db_cacheflush chrome_sqlite3_db_cacheflush // Line 9617
84385 -#define sqlite3_db_filename chrome_sqlite3_db_filename // Line 6289
84386 -#define sqlite3_db_handle chrome_sqlite3_db_handle // Line 6257
84387 -#define sqlite3_db_mutex chrome_sqlite3_db_mutex // Line 7841
84388 -#define sqlite3_db_readonly chrome_sqlite3_db_readonly // Line 6299
84389 -#define sqlite3_db_release_memory chrome_sqlite3_db_release_memory // Line 6608
84390 -#define sqlite3_db_status chrome_sqlite3_db_status // Line 8268
84391 -#define sqlite3_declare_vtab chrome_sqlite3_declare_vtab // Line 7262
84392 -#define sqlite3_deserialize chrome_sqlite3_deserialize // Lines 10027-10034
84393 -#define sqlite3_drop_modules chrome_sqlite3_drop_modules // Lines 7202-7205
84394 -#define sqlite3_enable_load_extension chrome_sqlite3_enable_load_extension // Line 6846
84395 -#define sqlite3_enable_shared_cache chrome_sqlite3_enable_shared_cache // Line 6578
84396 -#define sqlite3_errcode chrome_sqlite3_errcode // Line 3862
84397 -#define sqlite3_errmsg chrome_sqlite3_errmsg // Line 3864
84398 -#define sqlite3_errmsg16 chrome_sqlite3_errmsg16 // Line 3865
84399 -#define sqlite3_errstr chrome_sqlite3_errstr // Line 3866
84408 +#define sqlite3_deserialize chrome_sqlite3_deserialize // Lines 10371-10378
84409 +#define sqlite3_drop_modules chrome_sqlite3_drop_modules // Lines 7276-7279
84417 #define sqlite3_exec chrome_sqlite3_exec // Lines 425-431
84418 -#define sqlite3_expanded_sql chrome_sqlite3_expanded_sql // Line 4231
84419 -#define sqlite3_expired chrome_sqlite3_expired // Line 5405
84420 -#define sqlite3_extended_errcode chrome_sqlite3_extended_errcode // Line 3863
84425 -#define sqlite3_file_control chrome_sqlite3_file_control // Line 7884
84430 -#define sqlite3_finalize chrome_sqlite3_finalize // Line 5114
84435 -#define sqlite3_get_autocommit chrome_sqlite3_get_autocommit // Line 6244
84436 -#define sqlite3_get_auxdata chrome_sqlite3_get_auxdata // Line 5715
84439 #define sqlite3_get_table chrome_sqlite3_get_table // Lines 2835-2842
84440 -#define sqlite3_global_recover chrome_sqlite3_global_recover // Line 5407
84441 -#define sqlite3_hard_heap_limit64 chrome_sqlite3_hard_heap_limit64 // Line 6675
84446 -#define sqlite3_keyword_check chrome_sqlite3_keyword_check // Line 7998
84447 -#define sqlite3_keyword_count chrome_sqlite3_keyword_count // Line 7996
84448 -#define sqlite3_keyword_name chrome_sqlite3_keyword_name // Line 7997
84455 -#define sqlite3_limit chrome_sqlite3_limit // Line 3934
84456 -#define sqlite3_load_extension chrome_sqlite3_load_extension // Lines 6814-6819
84457 -#define sqlite3_log chrome_sqlite3_log // Line 9116
84459 +#define sqlite3_load_extension chrome_sqlite3_load_extension // Lines 6856-6861
84463 -#define sqlite3_memory_alarm chrome_sqlite3_memory_alarm // Lines 5409-5410
84464 +#define sqlite3_memory_alarm chrome_sqlite3_memory_alarm // Lines 5428-5429
84469 -#define sqlite3_mutex_alloc chrome_sqlite3_mutex_alloc // Line 7682
84470 -#define sqlite3_mutex_enter chrome_sqlite3_mutex_enter // Line 7684
84471 -#define sqlite3_mutex_free chrome_sqlite3_mutex_free // Line 7683
84472 -#define sqlite3_mutex_held chrome_sqlite3_mutex_held // Line 7796
84473 -#define sqlite3_mutex_leave chrome_sqlite3_mutex_leave // Line 7686
84474 -#define sqlite3_mutex_notheld chrome_sqlite3_mutex_notheld // Line 7797
84475 -#define sqlite3_mutex_try chrome_sqlite3_mutex_try // Line 7685
84476 -#define sqlite3_next_stmt chrome_sqlite3_next_stmt // Line 6366
84477 -#define sqlite3_normalized_sql chrome_sqlite3_normalized_sql // Line 4233
84487 #define sqlite3_open chrome_sqlite3_open // Lines 3620-3623
84488 #define sqlite3_open16 chrome_sqlite3_open16 // Lines 3624-3627
84489 #define sqlite3_open_v2 chrome_sqlite3_open_v2 // Lines 3628-3633
84492 -#define sqlite3_overload_function chrome_sqlite3_overload_function // Line 7281
84493 -#define sqlite3_prepare chrome_sqlite3_prepare // Lines 4144-4150
84494 -#define sqlite3_prepare16 chrome_sqlite3_prepare16 // Lines 4166-4172
84495 -#define sqlite3_prepare16_v2 chrome_sqlite3_prepare16_v2 // Lines 4173-4179
84496 -#define sqlite3_prepare16_v3 chrome_sqlite3_prepare16_v3 // Lines 4180-4187
84497 -#define sqlite3_prepare_v2 chrome_sqlite3_prepare_v2 // Lines 4151-4157
84498 -#define sqlite3_prepare_v3 chrome_sqlite3_prepare_v3 // Lines 4158-4165
84499 -#define sqlite3_preupdate_blobwrite chrome_sqlite3_preupdate_blobwrite // Line 9729
84500 -#define sqlite3_preupdate_count chrome_sqlite3_preupdate_count // Line 9726
84501 -#define sqlite3_preupdate_depth chrome_sqlite3_preupdate_depth // Line 9727
84502 -#define sqlite3_preupdate_hook chrome_sqlite3_preupdate_hook // Lines 9712-9724
84503 -#define sqlite3_preupdate_new chrome_sqlite3_preupdate_new // Line 9728
84504 -#define sqlite3_preupdate_old chrome_sqlite3_preupdate_old // Line 9725
84506 +#define sqlite3_prepare chrome_sqlite3_prepare // Lines 4153-4159
84507 +#define sqlite3_prepare16 chrome_sqlite3_prepare16 // Lines 4175-4181
84508 +#define sqlite3_prepare16_v2 chrome_sqlite3_prepare16_v2 // Lines 4182-4188
84509 +#define sqlite3_prepare16_v3 chrome_sqlite3_prepare16_v3 // Lines 4189-4196
84510 +#define sqlite3_prepare_v2 chrome_sqlite3_prepare_v2 // Lines 4160-4166
84511 +#define sqlite3_prepare_v3 chrome_sqlite3_prepare_v3 // Lines 4167-4174
84515 +#define sqlite3_preupdate_hook chrome_sqlite3_preupdate_hook // Lines 10056-10068
84518 #define sqlite3_profile chrome_sqlite3_profile // Lines 3220-3221
84523 -#define sqlite3_release_memory chrome_sqlite3_release_memory // Line 6594
84524 -#define sqlite3_reset chrome_sqlite3_reset // Line 5141
84525 -#define sqlite3_reset_auto_extension chrome_sqlite3_reset_auto_extension // Line 6904
84526 -#define sqlite3_result_blob chrome_sqlite3_result_blob // Line 5883
84527 -#define sqlite3_result_blob64 chrome_sqlite3_result_blob64 // Lines 5884-5885
84528 -#define sqlite3_result_double chrome_sqlite3_result_double // Line 5886
84529 -#define sqlite3_result_error chrome_sqlite3_result_error // Line 5887
84530 -#define sqlite3_result_error16 chrome_sqlite3_result_error16 // Line 5888
84531 -#define sqlite3_result_error_code chrome_sqlite3_result_error_code // Line 5891
84532 -#define sqlite3_result_error_nomem chrome_sqlite3_result_error_nomem // Line 5890
84533 -#define sqlite3_result_error_toobig chrome_sqlite3_result_error_toobig // Line 5889
84534 -#define sqlite3_result_int chrome_sqlite3_result_int // Line 5892
84535 -#define sqlite3_result_int64 chrome_sqlite3_result_int64 // Line 5893
84536 -#define sqlite3_result_null chrome_sqlite3_result_null // Line 5894
84537 -#define sqlite3_result_pointer chrome_sqlite3_result_pointer // Line 5902
84538 -#define sqlite3_result_subtype chrome_sqlite3_result_subtype // Line 5919
84539 -#define sqlite3_result_text chrome_sqlite3_result_text // Line 5895
84540 -#define sqlite3_result_text16 chrome_sqlite3_result_text16 // Line 5898
84541 -#define sqlite3_result_text16be chrome_sqlite3_result_text16be // Line 5900
84542 -#define sqlite3_result_text16le chrome_sqlite3_result_text16le // Line 5899
84543 -#define sqlite3_result_text64 chrome_sqlite3_result_text64 // Lines 5896-5897
84544 -#define sqlite3_result_value chrome_sqlite3_result_value // Line 5901
84545 -#define sqlite3_result_zeroblob chrome_sqlite3_result_zeroblob // Line 5903
84546 -#define sqlite3_result_zeroblob64 chrome_sqlite3_result_zeroblob64 // Line 5904
84547 -#define sqlite3_rollback_hook chrome_sqlite3_rollback_hook // Line 6416
84548 -#define sqlite3_rtree_geometry_callback chrome_sqlite3_rtree_geometry_callback // Lines 10114-101…
84549 -#define sqlite3_rtree_query_callback chrome_sqlite3_rtree_query_callback // Lines 10140-10146
84550 -#define sqlite3_serialize chrome_sqlite3_serialize // Lines 9971-9976
84555 +#define sqlite3_result_blob64 chrome_sqlite3_result_blob64 // Lines 5904-5905
84571 +#define sqlite3_result_text64 chrome_sqlite3_result_text64 // Lines 5916-5917
84576 +#define sqlite3_rtree_geometry_callback chrome_sqlite3_rtree_geometry_callback // Lines 10458-104…
84577 +#define sqlite3_rtree_query_callback chrome_sqlite3_rtree_query_callback // Lines 10484-10490
84578 +#define sqlite3_serialize chrome_sqlite3_serialize // Lines 10315-10320
84579 #define sqlite3_set_authorizer chrome_sqlite3_set_authorizer // Lines 3110-3114
84580 -#define sqlite3_set_auxdata chrome_sqlite3_set_auxdata // Line 5716
84584 -#define sqlite3_sleep chrome_sqlite3_sleep // Line 6090
84585 -#define sqlite3_snapshot_cmp chrome_sqlite3_snapshot_cmp // Lines 9905-9908
84586 -#define sqlite3_snapshot_free chrome_sqlite3_snapshot_free // Line 9878
84587 -#define sqlite3_snapshot_get chrome_sqlite3_snapshot_get // Lines 9812-9816
84588 -#define sqlite3_snapshot_open chrome_sqlite3_snapshot_open // Lines 9861-9865
84589 -#define sqlite3_snapshot_recover chrome_sqlite3_snapshot_recover // Line 9933
84591 +#define sqlite3_snapshot_cmp chrome_sqlite3_snapshot_cmp // Lines 10249-10252
84593 +#define sqlite3_snapshot_get chrome_sqlite3_snapshot_get // Lines 10156-10160
84594 +#define sqlite3_snapshot_open chrome_sqlite3_snapshot_open // Lines 10205-10209
84597 -#define sqlite3_soft_heap_limit chrome_sqlite3_soft_heap_limit // Line 6686
84598 -#define sqlite3_soft_heap_limit64 chrome_sqlite3_soft_heap_limit64 // Line 6674
84602 -#define sqlite3_sql chrome_sqlite3_sql // Line 4230
84603 -#define sqlite3_status chrome_sqlite3_status // Line 8158
84604 -#define sqlite3_status64 chrome_sqlite3_status64 // Lines 8159-8164
84605 -#define sqlite3_step chrome_sqlite3_step // Line 4813
84606 -#define sqlite3_stmt_busy chrome_sqlite3_stmt_busy // Line 4312
84607 -#define sqlite3_stmt_isexplain chrome_sqlite3_stmt_isexplain // Line 4291
84608 -#define sqlite3_stmt_readonly chrome_sqlite3_stmt_readonly // Line 4279
84609 -#define sqlite3_stmt_scanstatus chrome_sqlite3_stmt_scanstatus // Lines 9568-9573
84610 -#define sqlite3_stmt_scanstatus_reset chrome_sqlite3_stmt_scanstatus_reset // Line 9584
84611 -#define sqlite3_stmt_status chrome_sqlite3_stmt_status // Line 8421
84612 -#define sqlite3_str_append chrome_sqlite3_str_append // Line 8094
84613 -#define sqlite3_str_appendall chrome_sqlite3_str_appendall // Line 8095
84614 -#define sqlite3_str_appendchar chrome_sqlite3_str_appendchar // Line 8096
84615 -#define sqlite3_str_appendf chrome_sqlite3_str_appendf // Line 8092
84616 -#define sqlite3_str_errcode chrome_sqlite3_str_errcode // Line 8128
84617 -#define sqlite3_str_finish chrome_sqlite3_str_finish // Line 8058
84618 -#define sqlite3_str_length chrome_sqlite3_str_length // Line 8129
84619 -#define sqlite3_str_new chrome_sqlite3_str_new // Line 8043
84620 -#define sqlite3_str_reset chrome_sqlite3_str_reset // Line 8097
84621 -#define sqlite3_str_value chrome_sqlite3_str_value // Line 8130
84622 -#define sqlite3_str_vappendf chrome_sqlite3_str_vappendf // Line 8093
84623 -#define sqlite3_strglob chrome_sqlite3_strglob // Line 9070
84624 -#define sqlite3_stricmp chrome_sqlite3_stricmp // Line 9052
84625 -#define sqlite3_strlike chrome_sqlite3_strlike // Line 9093
84626 -#define sqlite3_strnicmp chrome_sqlite3_strnicmp // Line 9053
84627 -#define sqlite3_system_errno chrome_sqlite3_system_errno // Line 9743
84628 -#define sqlite3_table_column_metadata chrome_sqlite3_table_column_metadata // Lines 6758-6768
84629 -#define sqlite3_temp_directory chrome_sqlite3_temp_directory // Line 6148
84630 -#define sqlite3_test_control chrome_sqlite3_test_control // Line 7903
84631 -#define sqlite3_thread_cleanup chrome_sqlite3_thread_cleanup // Line 5408
84634 +#define sqlite3_status64 chrome_sqlite3_status64 // Lines 8234-8239
84639 +#define sqlite3_stmt_scanstatus chrome_sqlite3_stmt_scanstatus // Lines 9912-9917
84658 +#define sqlite3_table_column_metadata chrome_sqlite3_table_column_metadata // Lines 6800-6810
84665 #define sqlite3_trace chrome_sqlite3_trace // Lines 3218-3219
84666 #define sqlite3_trace_v2 chrome_sqlite3_trace_v2 // Lines 3309-3314
84667 -#define sqlite3_transfer_bindings chrome_sqlite3_transfer_bindings // Line 5406
84668 -#define sqlite3_txn_state chrome_sqlite3_txn_state // Line 6317
84669 -#define sqlite3_unlock_notify chrome_sqlite3_unlock_notify // Lines 9037-9041
84670 -#define sqlite3_update_hook chrome_sqlite3_update_hook // Lines 6533-6537
84673 +#define sqlite3_unlock_notify chrome_sqlite3_unlock_notify // Lines 9124-9128
84674 +#define sqlite3_update_hook chrome_sqlite3_update_hook // Lines 6575-6579
84679 -#define sqlite3_user_data chrome_sqlite3_user_data // Line 5644
84680 -#define sqlite3_value_blob chrome_sqlite3_value_blob // Line 5541
84681 -#define sqlite3_value_bytes chrome_sqlite3_value_bytes // Line 5550
84682 -#define sqlite3_value_bytes16 chrome_sqlite3_value_bytes16 // Line 5551
84683 -#define sqlite3_value_double chrome_sqlite3_value_double // Line 5542
84684 -#define sqlite3_value_dup chrome_sqlite3_value_dup // Line 5583
84685 -#define sqlite3_value_free chrome_sqlite3_value_free // Line 5584
84686 -#define sqlite3_value_frombind chrome_sqlite3_value_frombind // Line 5555
84687 -#define sqlite3_value_int chrome_sqlite3_value_int // Line 5543
84688 -#define sqlite3_value_int64 chrome_sqlite3_value_int64 // Line 5544
84689 -#define sqlite3_value_nochange chrome_sqlite3_value_nochange // Line 5554
84690 -#define sqlite3_value_numeric_type chrome_sqlite3_value_numeric_type // Line 5553
84691 -#define sqlite3_value_pointer chrome_sqlite3_value_pointer // Line 5545
84692 -#define sqlite3_value_subtype chrome_sqlite3_value_subtype // Line 5567
84693 -#define sqlite3_value_text chrome_sqlite3_value_text // Line 5546
84694 -#define sqlite3_value_text16 chrome_sqlite3_value_text16 // Line 5547
84695 -#define sqlite3_value_text16be chrome_sqlite3_value_text16be // Line 5549
84696 -#define sqlite3_value_text16le chrome_sqlite3_value_text16le // Line 5548
84697 -#define sqlite3_value_type chrome_sqlite3_value_type // Line 5552
84718 -#define sqlite3_vfs_find chrome_sqlite3_vfs_find // Line 7564
84719 -#define sqlite3_vfs_register chrome_sqlite3_vfs_register // Line 7565
84720 -#define sqlite3_vfs_unregister chrome_sqlite3_vfs_unregister // Line 7566
84726 -#define sqlite3_vtab_collation chrome_sqlite3_vtab_collation // Line 9463
84727 -#define sqlite3_vtab_config chrome_sqlite3_vtab_config // Line 9344
84728 -#define sqlite3_vtab_nochange chrome_sqlite3_vtab_nochange // Line 9448
84729 -#define sqlite3_vtab_on_conflict chrome_sqlite3_vtab_on_conflict // Line 9422
84730 -#define sqlite3_wal_autocheckpoint chrome_sqlite3_wal_autocheckpoint // Line 9188
84731 -#define sqlite3_wal_checkpoint chrome_sqlite3_wal_checkpoint // Line 9210
84732 -#define sqlite3_wal_checkpoint_v2 chrome_sqlite3_wal_checkpoint_v2 // Lines 9304-9310
84733 -#define sqlite3_wal_hook chrome_sqlite3_wal_hook // Lines 9153-9157
84734 -#define sqlite3_win32_set_directory chrome_sqlite3_win32_set_directory // Lines 6206-6209
84735 -#define sqlite3_win32_set_directory16 chrome_sqlite3_win32_set_directory16 // Line 6211
84736 -#define sqlite3_win32_set_directory8 chrome_sqlite3_win32_set_directory8 // Line 6210
84737 -#define sqlite3changegroup_add chrome_sqlite3changegroup_add // Line 11188
84738 -#define sqlite3changegroup_add_strm chrome_sqlite3changegroup_add_strm // Lines 11850-11853
84739 -#define sqlite3changegroup_delete chrome_sqlite3changegroup_delete // Line 11225
84740 -#define sqlite3changegroup_new chrome_sqlite3changegroup_new // Line 11110
84741 -#define sqlite3changegroup_output chrome_sqlite3changegroup_output // Lines 11215-11219
84742 -#define sqlite3changegroup_output_strm chrome_sqlite3changegroup_output_strm // Lines 11854-11857
84743 -#define sqlite3changeset_apply chrome_sqlite3changeset_apply // Lines 11385-11399
84744 -#define sqlite3changeset_apply_strm chrome_sqlite3changeset_apply_strm // Lines 11783-11797
84745 -#define sqlite3changeset_apply_v2 chrome_sqlite3changeset_apply_v2 // Lines 11400-11416
84746 -#define sqlite3changeset_apply_v2_strm chrome_sqlite3changeset_apply_v2_strm // Lines 11798-11814
84747 -#define sqlite3changeset_concat chrome_sqlite3changeset_concat // Lines 11056-11063
84748 -#define sqlite3changeset_concat_strm chrome_sqlite3changeset_concat_strm // Lines 11815-11822
84749 -#define sqlite3changeset_conflict chrome_sqlite3changeset_conflict // Lines 10942-10946
84750 -#define sqlite3changeset_finalize chrome_sqlite3changeset_finalize // Line 10995
84751 -#define sqlite3changeset_fk_conflicts chrome_sqlite3changeset_fk_conflicts // Lines 10959-10962
84752 -#define sqlite3changeset_invert chrome_sqlite3changeset_invert // Lines 11025-11028
84753 -#define sqlite3changeset_invert_strm chrome_sqlite3changeset_invert_strm // Lines 11823-11828
84754 -#define sqlite3changeset_new chrome_sqlite3changeset_new // Lines 10914-10918
84755 -#define sqlite3changeset_next chrome_sqlite3changeset_next // Line 10781
84756 -#define sqlite3changeset_old chrome_sqlite3changeset_old // Lines 10880-10884
84757 -#define sqlite3changeset_op chrome_sqlite3changeset_op // Lines 10815-10821
84758 -#define sqlite3changeset_pk chrome_sqlite3changeset_pk // Lines 10849-10853
84759 -#define sqlite3changeset_start chrome_sqlite3changeset_start // Lines 10732-10736
84760 -#define sqlite3changeset_start_strm chrome_sqlite3changeset_start_strm // Lines 11829-11833
84761 -#define sqlite3changeset_start_v2 chrome_sqlite3changeset_start_v2 // Lines 10737-10742
84762 -#define sqlite3changeset_start_v2_strm chrome_sqlite3changeset_start_v2_strm // Lines 11834-11839
84763 -#define sqlite3rebaser_configure chrome_sqlite3rebaser_configure // Lines 11658-11661
84764 -#define sqlite3rebaser_create chrome_sqlite3rebaser_create // Line 11647
84765 -#define sqlite3rebaser_delete chrome_sqlite3rebaser_delete // Line 11691
84766 -#define sqlite3rebaser_rebase chrome_sqlite3rebaser_rebase // Lines 11677-11681
84767 -#define sqlite3rebaser_rebase_strm chrome_sqlite3rebaser_rebase_strm // Lines 11858-11864
84768 -#define sqlite3session_attach chrome_sqlite3session_attach // Lines 10415-10418
84769 -#define sqlite3session_changeset chrome_sqlite3session_changeset // Lines 10544-10548
84770 -#define sqlite3session_changeset_size chrome_sqlite3session_changeset_size // Line 10564
84771 -#define sqlite3session_changeset_strm chrome_sqlite3session_changeset_strm // Lines 11840-11844
84772 -#define sqlite3session_config chrome_sqlite3session_config // Line 11899
84773 -#define sqlite3session_create chrome_sqlite3session_create // Lines 10253-10257
84774 -#define sqlite3session_delete chrome_sqlite3session_delete // Line 10272
84775 -#define sqlite3session_diff chrome_sqlite3session_diff // Lines 10623-10628
84776 -#define sqlite3session_enable chrome_sqlite3session_enable // Line 10325
84777 -#define sqlite3session_indirect chrome_sqlite3session_indirect // Line 10355
84778 -#define sqlite3session_isempty chrome_sqlite3session_isempty // Line 10681
84779 -#define sqlite3session_memory_used chrome_sqlite3session_memory_used // Line 10689
84780 -#define sqlite3session_object_config chrome_sqlite3session_object_config // Line 10301
84781 -#define sqlite3session_patchset chrome_sqlite3session_patchset // Lines 10660-10664
84782 -#define sqlite3session_patchset_strm chrome_sqlite3session_patchset_strm // Lines 11845-11849
84783 -#define sqlite3session_table_filter chrome_sqlite3session_table_filter // Lines 10430-10437
84795 +#define sqlite3_wal_checkpoint_v2 chrome_sqlite3_wal_checkpoint_v2 // Lines 9391-9397
84796 +#define sqlite3_wal_hook chrome_sqlite3_wal_hook // Lines 9240-9244
84797 +#define sqlite3_win32_set_directory chrome_sqlite3_win32_set_directory // Lines 6226-6229
84801 +#define sqlite3changegroup_add_strm chrome_sqlite3changegroup_add_strm // Lines 12194-12197
84804 +#define sqlite3changegroup_output chrome_sqlite3changegroup_output // Lines 11559-11563
84805 +#define sqlite3changegroup_output_strm chrome_sqlite3changegroup_output_strm // Lines 12198-12201
84806 +#define sqlite3changeset_apply chrome_sqlite3changeset_apply // Lines 11729-11743
84807 +#define sqlite3changeset_apply_strm chrome_sqlite3changeset_apply_strm // Lines 12127-12141
84808 +#define sqlite3changeset_apply_v2 chrome_sqlite3changeset_apply_v2 // Lines 11744-11760
84809 +#define sqlite3changeset_apply_v2_strm chrome_sqlite3changeset_apply_v2_strm // Lines 12142-12158
84810 +#define sqlite3changeset_concat chrome_sqlite3changeset_concat // Lines 11400-11407
84811 +#define sqlite3changeset_concat_strm chrome_sqlite3changeset_concat_strm // Lines 12159-12166
84812 +#define sqlite3changeset_conflict chrome_sqlite3changeset_conflict // Lines 11286-11290
84814 +#define sqlite3changeset_fk_conflicts chrome_sqlite3changeset_fk_conflicts // Lines 11303-11306
84815 +#define sqlite3changeset_invert chrome_sqlite3changeset_invert // Lines 11369-11372
84816 +#define sqlite3changeset_invert_strm chrome_sqlite3changeset_invert_strm // Lines 12167-12172
84817 +#define sqlite3changeset_new chrome_sqlite3changeset_new // Lines 11258-11262
84819 +#define sqlite3changeset_old chrome_sqlite3changeset_old // Lines 11224-11228
84820 +#define sqlite3changeset_op chrome_sqlite3changeset_op // Lines 11159-11165
84821 +#define sqlite3changeset_pk chrome_sqlite3changeset_pk // Lines 11193-11197
84822 +#define sqlite3changeset_start chrome_sqlite3changeset_start // Lines 11076-11080
84823 +#define sqlite3changeset_start_strm chrome_sqlite3changeset_start_strm // Lines 12173-12177
84824 +#define sqlite3changeset_start_v2 chrome_sqlite3changeset_start_v2 // Lines 11081-11086
84825 +#define sqlite3changeset_start_v2_strm chrome_sqlite3changeset_start_v2_strm // Lines 12178-12183
84826 +#define sqlite3rebaser_configure chrome_sqlite3rebaser_configure // Lines 12002-12005
84829 +#define sqlite3rebaser_rebase chrome_sqlite3rebaser_rebase // Lines 12021-12025
84830 +#define sqlite3rebaser_rebase_strm chrome_sqlite3rebaser_rebase_strm // Lines 12202-12208
84831 +#define sqlite3session_attach chrome_sqlite3session_attach // Lines 10759-10762
84832 +#define sqlite3session_changeset chrome_sqlite3session_changeset // Lines 10888-10892
84834 +#define sqlite3session_changeset_strm chrome_sqlite3session_changeset_strm // Lines 12184-12188
84836 +#define sqlite3session_create chrome_sqlite3session_create // Lines 10597-10601
84838 +#define sqlite3session_diff chrome_sqlite3session_diff // Lines 10967-10972
84844 +#define sqlite3session_patchset chrome_sqlite3session_patchset // Lines 11004-11008
84845 +#define sqlite3session_patchset_strm chrome_sqlite3session_patchset_strm // Lines 12189-12193
84846 +#define sqlite3session_table_filter chrome_sqlite3session_table_filter // Lines 10774-10781
84850 diff --git a/src/third_party/sqlite/src/amalgamation/shell/shell.c b/src/third_party/sqlite/src/ama…
84852 --- a/src/third_party/sqlite/src/amalgamation/shell/shell.c
84854 @@ -41,10 +41,10 @@
84861 -# define INC_STRINGIFY_(f) #f
84862 -# define INC_STRINGIFY(f) INC_STRINGIFY_(f)
84863 -# include INC_STRINGIFY(SQLITE_CUSTOM_INCLUDE)
84868 @@ -247,6 +247,16 @@ static void setTextMode(FILE *file, int isOutput){
84885 @@ -445,15 +455,6 @@ static sqlite3 *globalDb = 0;
84889 -#ifdef SQLITE_DEBUG
84890 -/*
84891 -** Out-of-memory simulator variables
84892 -*/
84893 -static unsigned int oomCounter = 0; /* Simulate OOM when equals 1 */
84894 -static unsigned int oomRepeat = 0; /* Number of OOMs in a row */
84895 -static void*(*defaultMalloc)(int) = 0; /* The low-level malloc routine */
84896 -#endif /* SQLITE_DEBUG */
84897 -
84901 @@ -505,48 +506,12 @@ static void shell_out_of_memory(void){
84905 -#ifdef SQLITE_DEBUG
84906 -/* This routine is called when a simulated OOM occurs. It is broken
84907 -** out as a separate routine to make it easy to set a breakpoint on
84908 -** the OOM
84909 -*/
84910 -void shellOomFault(void){
84911 - if( oomRepeat>0 ){
84912 - oomRepeat--;
84913 - }else{
84914 - oomCounter--;
84915 - }
84916 -}
84917 -#endif /* SQLITE_DEBUG */
84918 -
84919 -#ifdef SQLITE_DEBUG
84920 -/* This routine is a replacement malloc() that is used to simulate
84921 -** Out-Of-Memory (OOM) errors for testing purposes.
84923 +** out-of-memory error.
84925 -static void *oomMalloc(int nByte){
84926 - if( oomCounter ){
84927 - if( oomCounter==1 ){
84928 - shellOomFault();
84929 - return 0;
84930 - }else{
84931 - oomCounter--;
84932 - }
84933 - }
84934 - return defaultMalloc(nByte);
84935 -}
84936 -#endif /* SQLITE_DEBUG */
84937 -
84938 -#ifdef SQLITE_DEBUG
84939 -/* Register the OOM simulator. This must occur before any memory
84940 -** allocations */
84941 -static void registerOomSimulator(void){
84942 - sqlite3_mem_methods mem;
84943 - sqlite3_config(SQLITE_CONFIG_GETMALLOC, &mem);
84944 - defaultMalloc = mem.xMalloc;
84945 - mem.xMalloc = oomMalloc;
84946 - sqlite3_config(SQLITE_CONFIG_MALLOC, &mem);
84950 -#endif
84953 ** Write I/O traces to the following stream.
84954 @@ -703,7 +668,7 @@ static char *local_getline(char *zLine, FILE *in){
84958 - if( zLine==0 ) shell_out_of_memory();
84961 if( fgets(&zLine[n], nLine - n, in)==0 ){
84963 @@ -730,7 +695,7 @@ static char *local_getline(char *zLine, FILE *in){
84967 - if( zLine==0 ) shell_out_of_memory();
84972 @@ -754,6 +719,7 @@ static char *local_getline(char *zLine, FILE *in){
84980 @@ -773,7 +739,7 @@ static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
84984 -
84988 ** Return the value of a hexadecimal digit. Return -1 if the input
84989 @@ -861,7 +827,7 @@ static void freeText(ShellText *p){
84993 -static void appendText(ShellText *p, char const *zAppend, char quote){
84998 @@ -877,7 +843,7 @@ static void appendText(ShellText *p, char const *zAppend, char quote){
84999 if( p->z==0 || p->n+len>=p->nAlloc ){
85000 p->nAlloc = p->nAlloc*2 + len + 20;
85001 p->z = realloc(p->z, p->nAlloc);
85002 - if( p->z==0 ) shell_out_of_memory();
85003 + shell_check_oom(p->z);
85007 @@ -932,6 +898,7 @@ static char *shellFakeSchema(
85012 sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
85015 @@ -948,6 +915,7 @@ static char *shellFakeSchema(
85023 @@ -971,9 +939,11 @@ static void shellModuleSchema(
85027 - const char *zName = (const char*)sqlite3_value_text(apVal[0]);
85028 - char *zFake = shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName);
85036 -1, sqlite3_free);
85037 @@ -1422,6 +1392,117 @@ INT closedir(
85043 +** 2019-01-21
85062 +** This extension is used to implement the --memtrace option of the
85063 +** command-line shell.
85095 + fprintf(memtraceOut, "MEMTRACE: resize %d -> %d bytes\n",
85154 ** 2017-03-08
85155 @@ -1444,7 +1525,7 @@ INT closedir(
85159 -** The sha3_query(Y) function evalutes all queries in the SQL statements of Y
85163 ** The SIZE argument is optional. If omitted, the SHA3-256 hash algorithm
85164 @@ -1861,6 +1942,7 @@ static void SHA3Update(
85170 if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){
85172 @@ -2148,9 +2230,9 @@ int sqlite3_shathree_init(
85176 -/************************* Begin ../ext/misc/fileio.c ******************/
85179 -** 2014-06-13
85180 +** 2020-04-14
85184 @@ -2161,1028 +2243,729 @@ int sqlite3_shathree_init(
85188 -** This SQLite extension implements SQL functions readfile() and
85189 -** writefile(), and eponymous virtual type "fsdir".
85190 -**
85191 -** WRITEFILE(FILE, DATA [, MODE [, MTIME]]):
85192 -**
85193 -** If neither of the optional arguments is present, then this UDF
85194 -** function writes blob DATA to file FILE. If successful, the number
85195 -** of bytes written is returned. If an error occurs, NULL is returned.
85196 -**
85197 -** If the first option argument - MODE - is present, then it must
85198 -** be passed an integer value that corresponds to a POSIX mode
85199 -** value (file type + permissions, as returned in the stat.st_mode
85200 -** field by the stat() system call). Three types of files may
85201 -** be written/created:
85202 -**
85203 -** regular files: (mode & 0170000)==0100000
85204 -** symbolic links: (mode & 0170000)==0120000
85205 -** directories: (mode & 0170000)==0040000
85206 -**
85207 -** For a directory, the DATA is ignored. For a symbolic link, it is
85208 -** interpreted as text and used as the target of the link. For a
85209 -** regular file, it is interpreted as a blob and written into the
85210 -** named file. Regardless of the type of file, its permissions are
85211 -** set to (mode & 0777) before returning.
85212 -**
85213 -** If the optional MTIME argument is present, then it is interpreted
85214 -** as an integer - the number of seconds since the unix epoch. The
85215 -** modification-time of the target file is set to this value before
85216 -** returning.
85217 -**
85218 -** If three or more arguments are passed to this function and an
85219 -** error is encountered, an exception is raised.
85220 -**
85221 -** READFILE(FILE):
85222 -**
85223 -** Read and return the contents of file FILE (type blob) from disk.
85224 -**
85225 -** FSDIR:
85226 -**
85227 -** Used as follows:
85228 -**
85229 -** SELECT * FROM fsdir($path [, $dir]);
85230 -**
85231 -** Parameter $path is an absolute or relative pathname. If the file that it
85232 -** refers to does not exist, it is an error. If the path refers to a regular
85233 -** file or symbolic link, it returns a single row. Or, if the path refers
85234 -** to a directory, it returns one row for the directory, and one row for each
85235 -** file within the hierarchy rooted at $path.
85238 -** Each row has the following columns:
85242 -** name: Path to file or directory (text value).
85243 -** mode: Value of stat.st_mode for directory entry (an integer).
85244 -** mtime: Value of stat.st_mtime for directory entry (an integer).
85245 -** data: For a regular file, a blob containing the file data. For a
85246 -** symlink, a text value containing the text of the link. For a
85247 -** directory, NULL.
85252 -** If a non-NULL value is specified for the optional $dir parameter and
85253 -** $path is a relative path, then $path is interpreted relative to $dir.
85254 -** And the paths returned in the "name" column of the table are also
85255 -** relative to directory $dir.
85260 -** Notes on building this extension for Windows:
85261 -** Unless linked statically with the SQLite library, a preprocessor
85262 -** symbol, FILEIO_WIN32_DLL, must be #define'd to create a stand-alone
85263 -** DLL form of this extension for WIN32. See its use below for details.
85266 +** 64-bit machine integer.
85270 -#include <stdio.h>
85271 -#include <string.h>
85273 -
85274 -#include <sys/types.h>
85275 -#include <sys/stat.h>
85276 -#include <fcntl.h>
85277 -#if !defined(_WIN32) && !defined(WIN32)
85278 -# include <unistd.h>
85279 -# include <dirent.h>
85280 -# include <utime.h>
85281 -# include <sys/time.h>
85282 -#else
85283 -# include "windows.h"
85284 -# include <io.h>
85285 -# include <direct.h>
85286 -/* # include "test_windirent.h" */
85287 -# define dirent DIRENT
85288 -# ifndef chmod
85289 -# define chmod _chmod
85290 -# endif
85291 -# ifndef stat
85292 -# define stat _stat
85293 -# endif
85294 -# define mkdir(path,mode) _mkdir(path)
85295 -# define lstat(path,buf) stat(path,buf)
85296 -#endif
85297 -#include <time.h>
85298 -#include <errno.h>
85299 -
85304 -** Structure of the fsdir() table-valued function
85308 - /* 0 1 2 3 4 5 */
85309 -#define FSDIR_SCHEMA "(name,mode,mtime,data,path HIDDEN,dir HIDDEN)"
85310 -#define FSDIR_COLUMN_NAME 0 /* Name of the file */
85311 -#define FSDIR_COLUMN_MODE 1 /* Access mode */
85312 -#define FSDIR_COLUMN_MTIME 2 /* Last modification time */
85313 -#define FSDIR_COLUMN_DATA 3 /* File content */
85314 -#define FSDIR_COLUMN_PATH 4 /* Path to top of search */
85315 -#define FSDIR_COLUMN_DIR 5 /* Path is relative to this directory */
85316 -
85317 -
85318 -/*
85319 -** Set the result stored by context ctx to a blob containing the
85320 -** contents of file zName. Or, leave the result unchanged (NULL)
85321 -** if the file does not exist or is unreadable.
85322 -**
85323 -** If the file exceeds the SQLite blob size limit, through an
85324 -** SQLITE_TOOBIG error.
85325 -**
85326 -** Throw an SQLITE_IOERR if there are difficulties pulling the file
85327 -** off of disk.
85328 -*/
85329 -static void readFileContents(sqlite3_context *ctx, const char *zName){
85330 - FILE *in;
85331 - sqlite3_int64 nIn;
85332 - void *pBuf;
85333 - sqlite3 *db;
85334 - int mxBlob;
85335 -
85336 - in = fopen(zName, "rb");
85337 - if( in==0 ){
85338 - /* File does not exist or is unreadable. Leave the result set to NULL. */
85339 - return;
85340 - }
85341 - fseek(in, 0, SEEK_END);
85342 - nIn = ftell(in);
85343 - rewind(in);
85344 - db = sqlite3_context_db_handle(ctx);
85345 - mxBlob = sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1);
85346 - if( nIn>mxBlob ){
85347 - sqlite3_result_error_code(ctx, SQLITE_TOOBIG);
85348 - fclose(in);
85349 - return;
85350 - }
85351 - pBuf = sqlite3_malloc64( nIn ? nIn : 1 );
85352 - if( pBuf==0 ){
85353 - sqlite3_result_error_nomem(ctx);
85354 - fclose(in);
85355 - return;
85356 - }
85357 - if( nIn==(sqlite3_int64)fread(pBuf, 1, (size_t)nIn, in) ){
85358 - sqlite3_result_blob64(ctx, pBuf, nIn, sqlite3_free);
85359 - }else{
85360 - sqlite3_result_error_code(ctx, SQLITE_IOERR);
85361 - sqlite3_free(pBuf);
85372 + x = zA[i] - zB[j];
85386 + return -1;
85400 - fclose(in);
85401 + return (nKey1 - i) - (nKey2 - j);
85404 -/*
85405 -** Implementation of the "readfile(X)" SQL function. The entire content
85406 -** of the file named X is read and returned as a BLOB. NULL is returned
85407 -** if the file does not exist or is unreadable.
85408 -*/
85409 -static void readfileFunc(
85410 - sqlite3_context *context,
85411 - int argc,
85412 - sqlite3_value **argv
85413 -){
85414 - const char *zName;
85415 - (void)(argc); /* Unused parameter */
85416 - zName = (const char*)sqlite3_value_text(argv[0]);
85417 - if( zName==0 ) return;
85418 - readFileContents(context, zName);
85419 -}
85422 -/*
85423 -** Set the error message contained in context ctx to the results of
85424 -** vprintf(zFmt, ...).
85425 -*/
85426 -static void ctxErrorMsg(sqlite3_context *ctx, const char *zFmt, ...){
85427 - char *zMsg = 0;
85428 - va_list ap;
85429 - va_start(ap, zFmt);
85430 - zMsg = sqlite3_vmprintf(zFmt, ap);
85431 - sqlite3_result_error(ctx, zMsg, -1);
85432 - sqlite3_free(zMsg);
85433 - va_end(ap);
85436 + sqlite3 *db,
85442 + return sqlite3_create_collation(db, "uint", SQLITE_UTF8, 0, uintCollFunc);
85445 -#if defined(_WIN32)
85449 -** This function is designed to convert a Win32 FILETIME structure into the
85450 -** number of seconds since the Unix Epoch (1970-01-01 00:00:00 UTC).
85451 +** 2020-06-22
85462 +** Routines to implement arbitrary-precision decimal math.
85466 -static sqlite3_uint64 fileTimeToUnixTime(
85467 - LPFILETIME pFileTime
85468 -){
85469 - SYSTEMTIME epochSystemTime;
85470 - ULARGE_INTEGER epochIntervals;
85471 - FILETIME epochFileTime;
85472 - ULARGE_INTEGER fileIntervals;
85473 -
85474 - memset(&epochSystemTime, 0, sizeof(SYSTEMTIME));
85475 - epochSystemTime.wYear = 1970;
85476 - epochSystemTime.wMonth = 1;
85477 - epochSystemTime.wDay = 1;
85478 - SystemTimeToFileTime(&epochSystemTime, &epochFileTime);
85479 - epochIntervals.LowPart = epochFileTime.dwLowDateTime;
85480 - epochIntervals.HighPart = epochFileTime.dwHighDateTime;
85481 -
85482 - fileIntervals.LowPart = pFileTime->dwLowDateTime;
85483 - fileIntervals.HighPart = pFileTime->dwHighDateTime;
85491 - return (fileIntervals.QuadPart - epochIntervals.QuadPart) / 10000000;
85492 -}
85500 -#if defined(FILEIO_WIN32_DLL) && (defined(_WIN32) || defined(WIN32))
85501 -# /* To allow a standalone DLL, use this next replacement function: */
85502 -# undef sqlite3_win32_utf8_to_unicode
85503 -# define sqlite3_win32_utf8_to_unicode utf8_to_utf16
85504 -#
85505 -LPWSTR utf8_to_utf16(const char *z){
85506 - int nAllot = MultiByteToWideChar(CP_UTF8, 0, z, -1, NULL, 0);
85507 - LPWSTR rv = sqlite3_malloc(nAllot * sizeof(WCHAR));
85508 - if( rv!=0 && 0 < MultiByteToWideChar(CP_UTF8, 0, z, -1, rv, nAllot) )
85509 - return rv;
85510 - sqlite3_free(rv);
85511 - return 0;
85512 -}
85513 -#endif
85527 -** This function attempts to normalize the time values found in the stat()
85528 -** buffer to UTC. This is necessary on Win32, where the runtime library
85529 -** appears to return these values as local times.
85532 -static void statTimesToUtc(
85533 - const char *zPath,
85534 - struct stat *pStatBuf
85535 -){
85536 - HANDLE hFindFile;
85537 - WIN32_FIND_DATAW fd;
85538 - LPWSTR zUnicodeName;
85539 - extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
85540 - zUnicodeName = sqlite3_win32_utf8_to_unicode(zPath);
85541 - if( zUnicodeName ){
85542 - memset(&fd, 0, sizeof(WIN32_FIND_DATAW));
85543 - hFindFile = FindFirstFileW(zUnicodeName, &fd);
85544 - if( hFindFile!=NULL ){
85545 - pStatBuf->st_ctime = (time_t)fileTimeToUnixTime(&fd.ftCreationTime);
85546 - pStatBuf->st_atime = (time_t)fileTimeToUnixTime(&fd.ftLastAccessTime);
85547 - pStatBuf->st_mtime = (time_t)fileTimeToUnixTime(&fd.ftLastWriteTime);
85548 - FindClose(hFindFile);
85549 - }
85550 - sqlite3_free(zUnicodeName);
85551 - }
85553 + sqlite3_free(p->a);
85555 -#endif
85558 -** This function is used in place of stat(). On Windows, special handling
85559 -** is required in order for the included time to be returned as UTC. On all
85560 -** other systems, this function simply calls stat().
85563 -static int fileStat(
85564 - const char *zPath,
85565 - struct stat *pStatBuf
85566 -){
85567 -#if defined(_WIN32)
85568 - int rc = stat(zPath, pStatBuf);
85569 - if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
85570 - return rc;
85571 -#else
85572 - return stat(zPath, pStatBuf);
85573 -#endif
85582 -** This function is used in place of lstat(). On Windows, special handling
85583 -** is required in order for the included time to be returned as UTC. On all
85584 -** other systems, this function simply calls lstat().
85588 -static int fileLinkStat(
85589 - const char *zPath,
85590 - struct stat *pStatBuf
85591 -){
85592 -#if defined(_WIN32)
85593 - int rc = lstat(zPath, pStatBuf);
85594 - if( rc==0 ) statTimesToUtc(zPath, pStatBuf);
85595 - return rc;
85596 -#else
85597 - return lstat(zPath, pStatBuf);
85598 -#endif
85599 -}
85600 -
85601 -/*
85602 -** Argument zFile is the name of a file that will be created and/or written
85603 -** by SQL function writefile(). This function ensures that the directory
85604 -** zFile will be written to exists, creating it if required. The permissions
85605 -** for any path components created by this function are set in accordance
85606 -** with the current umask.
85607 -**
85608 -** If an OOM condition is encountered, SQLITE_NOMEM is returned. Otherwise,
85609 -** SQLITE_OK is returned if the directory is successfully created, or
85610 -** SQLITE_ERROR otherwise.
85611 -*/
85612 -static int makeDirectory(
85613 - const char *zFile
85620 - char *zCopy = sqlite3_mprintf("%s", zFile);
85621 - int rc = SQLITE_OK;
85622 -
85623 - if( zCopy==0 ){
85624 - rc = SQLITE_NOMEM;
85631 + p->sign = 0;
85632 + p->oom = 0;
85633 + p->isInit = 1;
85634 + p->isNull = 0;
85635 + p->nDigit = 0;
85636 + p->nFrac = 0;
85641 - int nCopy = (int)strlen(zCopy);
85642 - int i = 1;
85643 -
85644 - while( rc==SQLITE_OK ){
85645 - struct stat sStat;
85646 - int rc2;
85647 -
85648 - for(; zCopy[i]!='/' && i<nCopy; i++);
85649 - if( i==nCopy ) break;
85650 - zCopy[i] = '\0';
85651 -
85652 - rc2 = fileStat(zCopy, &sStat);
85653 - if( rc2!=0 ){
85654 - if( mkdir(zCopy, 0777) ) rc = SQLITE_ERROR;
85655 - }else{
85656 - if( !S_ISDIR(sStat.st_mode) ) rc = SQLITE_ERROR;
85657 - }
85658 - zCopy[i] = '/';
85659 - i++;
85661 + p->a = 0;
85662 + p->isNull = 1;
85665 -
85666 - sqlite3_free(zCopy);
85670 -
85671 - return rc;
85672 -}
85673 -
85674 -/*
85675 -** This function does the work for the writefile() UDF. Refer to
85676 -** header comments at the top of this file for details.
85677 -*/
85678 -static int writeFile(
85679 - sqlite3_context *pCtx, /* Context to return bytes written in */
85680 - const char *zFile, /* File to write */
85681 - sqlite3_value *pData, /* Data to write */
85682 - mode_t mode, /* MODE parameter passed to writefile() */
85683 - sqlite3_int64 mtime /* MTIME parameter (or -1 to not set time) */
85684 -){
85685 -#if !defined(_WIN32) && !defined(WIN32)
85686 - if( S_ISLNK(mode) ){
85687 - const char *zTo = (const char*)sqlite3_value_text(pData);
85688 - if( symlink(zTo, zFile)<0 ) return 1;
85689 - }else
85690 -#endif
85691 - {
85692 - if( S_ISDIR(mode) ){
85693 - if( mkdir(zFile, mode) ){
85694 - /* The mkdir() call to create the directory failed. This might not
85695 - ** be an error though - if there is already a directory at the same
85696 - ** path and either the permissions already match or can be changed
85697 - ** to do so using chmod(), it is not an error. */
85698 - struct stat sStat;
85699 - if( errno!=EEXIST
85700 - || 0!=fileStat(zFile, &sStat)
85701 - || !S_ISDIR(sStat.st_mode)
85702 - || ((sStat.st_mode&0777)!=(mode&0777) && 0!=chmod(zFile, mode&0777))
85703 - ){
85704 - return 1;
85705 - }
85706 + p->a = sqlite3_malloc64( n+1 );
85707 + if( p->a==0 ) goto new_no_mem;
85709 + if( zIn[i]=='-' ){
85710 + p->sign = 1;
85719 + p->a[p->nDigit++] = c - '0';
85721 + p->nFrac = p->nDigit + 1;
85726 + if( zIn[j]=='-' ){
85732 - }else{
85733 - sqlite3_int64 nWrite = 0;
85734 - const char *z;
85735 - int rc = 0;
85736 - FILE *out = fopen(zFile, "wb");
85737 - if( out==0 ) return 1;
85738 - z = (const char*)sqlite3_value_blob(pData);
85739 - if( z ){
85740 - sqlite3_int64 n = fwrite(z, 1, sqlite3_value_bytes(pData), out);
85741 - nWrite = sqlite3_value_bytes(pData);
85742 - if( nWrite!=n ){
85743 - rc = 1;
85746 + iExp = iExp*10 + zIn[j] - '0';
85750 - fclose(out);
85751 - if( rc==0 && mode && chmod(zFile, mode & 0777) ){
85752 - rc = 1;
85753 - }
85754 - if( rc ) return 2;
85755 - sqlite3_result_int64(pCtx, nWrite);
85756 + if( neg ) iExp = -iExp;
85761 -
85762 - if( mtime>=0 ){
85763 -#if defined(_WIN32)
85764 -#if !SQLITE_OS_WINRT
85765 - /* Windows */
85766 - FILETIME lastAccess;
85767 - FILETIME lastWrite;
85768 - SYSTEMTIME currentTime;
85769 - LONGLONG intervals;
85770 - HANDLE hFile;
85771 - LPWSTR zUnicodeName;
85772 - extern LPWSTR sqlite3_win32_utf8_to_unicode(const char*);
85773 -
85774 - GetSystemTime(&currentTime);
85775 - SystemTimeToFileTime(&currentTime, &lastAccess);
85776 - intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
85777 - lastWrite.dwLowDateTime = (DWORD)intervals;
85778 - lastWrite.dwHighDateTime = intervals >> 32;
85779 - zUnicodeName = sqlite3_win32_utf8_to_unicode(zFile);
85780 - if( zUnicodeName==0 ){
85781 - return 1;
85782 + if( p->nFrac ){
85783 + p->nFrac = p->nDigit - (p->nFrac - 1);
85786 + if( p->nFrac>0 ){
85787 + if( iExp<=p->nFrac ){
85788 + p->nFrac -= iExp;
85791 + iExp -= p->nFrac;
85792 + p->nFrac = 0;
85795 - hFile = CreateFileW(
85796 - zUnicodeName, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING,
85797 - FILE_FLAG_BACKUP_SEMANTICS, NULL
85798 - );
85799 - sqlite3_free(zUnicodeName);
85800 - if( hFile!=INVALID_HANDLE_VALUE ){
85801 - BOOL bResult = SetFileTime(hFile, NULL, &lastAccess, &lastWrite);
85802 - CloseHandle(hFile);
85803 - return !bResult;
85804 - }else{
85805 - return 1;
85807 + p->a = sqlite3_realloc64(p->a, p->nDigit + iExp + 1 );
85808 + if( p->a==0 ) goto new_no_mem;
85809 + memset(p->a+p->nDigit, 0, iExp);
85810 + p->nDigit += iExp;
85812 -#endif
85813 -#elif defined(AT_FDCWD) && 0 /* utimensat() is not universally available */
85814 - /* Recent unix */
85815 - struct timespec times[2];
85816 - times[0].tv_nsec = times[1].tv_nsec = 0;
85817 - times[0].tv_sec = time(0);
85818 - times[1].tv_sec = mtime;
85819 - if( utimensat(AT_FDCWD, zFile, times, AT_SYMLINK_NOFOLLOW) ){
85820 - return 1;
85823 + iExp = -iExp;
85824 + nExtra = p->nDigit - p->nFrac - 1;
85827 + p->nFrac += iExp;
85830 + iExp -= nExtra;
85831 + p->nFrac = p->nDigit - 1;
85834 -#else
85835 - /* Legacy unix */
85836 - struct timeval times[2];
85837 - times[0].tv_usec = times[1].tv_usec = 0;
85838 - times[0].tv_sec = time(0);
85839 - times[1].tv_sec = mtime;
85840 - if( utimes(zFile, times) ){
85841 - return 1;
85843 + p->a = sqlite3_realloc64(p->a, p->nDigit + iExp + 1 );
85844 + if( p->a==0 ) goto new_no_mem;
85845 + memmove(p->a+iExp, p->a, p->nDigit);
85846 + memset(p->a, 0, iExp);
85847 + p->nDigit += iExp;
85848 + p->nFrac += iExp;
85850 -#endif
85861 -** Implementation of the "writefile(W,X[,Y[,Z]]])" SQL function.
85862 -** Refer to header comments at the top of this file for details.
85865 -static void writefileFunc(
85866 - sqlite3_context *context,
85867 - int argc,
85868 - sqlite3_value **argv
85869 -){
85870 - const char *zFile;
85871 - mode_t mode = 0;
85872 - int res;
85873 - sqlite3_int64 mtime = -1;
85874 -
85875 - if( argc<2 || argc>4 ){
85876 - sqlite3_result_error(context,
85877 - "wrong number of arguments to function writefile()", -1
85878 - );
85883 + if( p==0 || p->oom ){
85887 -
85888 - zFile = (const char*)sqlite3_value_text(argv[0]);
85889 - if( zFile==0 ) return;
85890 - if( argc>=3 ){
85891 - mode = (mode_t)sqlite3_value_int(argv[2]);
85892 + if( p->isNull ){
85896 - if( argc==4 ){
85897 - mtime = sqlite3_value_int64(argv[3]);
85898 + z = sqlite3_malloc( p->nDigit+4 );
85903 -
85904 - res = writeFile(context, zFile, argv[1], mode, mtime);
85905 - if( res==1 && errno==ENOENT ){
85906 - if( makeDirectory(zFile)==SQLITE_OK ){
85907 - res = writeFile(context, zFile, argv[1], mode, mtime);
85908 - }
85910 + if( p->nDigit==0 || (p->nDigit==1 && p->a[0]==0) ){
85911 + p->sign = 0;
85913 -
85914 - if( argc>2 && res!=0 ){
85915 - if( S_ISLNK(mode) ){
85916 - ctxErrorMsg(context, "failed to create symlink: %s", zFile);
85917 - }else if( S_ISDIR(mode) ){
85918 - ctxErrorMsg(context, "failed to create directory: %s", zFile);
85919 - }else{
85920 - ctxErrorMsg(context, "failed to write file: %s", zFile);
85921 - }
85922 + if( p->sign ){
85923 + z[0] = '-';
85926 + n = p->nDigit - p->nFrac;
85931 + while( n>1 && p->a[j]==0 ){
85933 + n--;
85936 + z[i++] = p->a[j] + '0';
85938 + n--;
85940 + if( p->nFrac ){
85943 + z[i++] = p->a[j] + '0';
85945 + }while( j<p->nDigit );
85952 -** SQL function: lsmode(MODE)
85955 -** Given a numberic st_mode from stat(), convert it into a human-readable
85956 -** text string in the style of "ls -l".
85959 -static void lsModeFunc(
85965 - int i;
85966 - int iMode = sqlite3_value_int(argv[0]);
85967 - char z[16];
85968 - (void)argc;
85969 - if( S_ISLNK(iMode) ){
85970 - z[0] = 'l';
85971 - }else if( S_ISREG(iMode) ){
85972 - z[0] = '-';
85973 - }else if( S_ISDIR(iMode) ){
85974 - z[0] = 'd';
85975 - }else{
85976 - z[0] = '?';
85977 - }
85978 - for(i=0; i<3; i++){
85979 - int m = (iMode >> ((2-i)*3));
85980 - char *a = &z[1 + i*3];
85981 - a[0] = (m & 0x4) ? 'r' : '-';
85982 - a[1] = (m & 0x2) ? 'w' : '-';
85983 - a[2] = (m & 0x1) ? 'x' : '-';
85984 - }
85985 - z[10] = '\0';
85986 - sqlite3_result_text(context, z, -1, SQLITE_TRANSIENT);
85993 -#ifndef SQLITE_OMIT_VIRTUALTABLE
85994 -
85995 -/*
85996 -** Cursor type for recursively iterating through a directory structure.
85997 -*/
85998 -typedef struct fsdir_cursor fsdir_cursor;
85999 -typedef struct FsdirLevel FsdirLevel;
86000 -
86001 -struct FsdirLevel {
86002 - DIR *pDir; /* From opendir() */
86003 - char *zDir; /* Name of directory (nul-terminated) */
86004 -};
86005 -
86006 -struct fsdir_cursor {
86007 - sqlite3_vtab_cursor base; /* Base class - must be first */
86008 -
86009 - int nLvl; /* Number of entries in aLvl[] array */
86010 - int iLvl; /* Index of current entry */
86011 - FsdirLevel *aLvl; /* Hierarchy of directories being traversed */
86012 -
86013 - const char *zBase;
86014 - int nBase;
86015 -
86016 - struct stat sStat; /* Current lstat() results */
86017 - char *zPath; /* Path to current entry */
86018 - sqlite3_int64 iRowid; /* Current rowid */
86019 -};
86020 -
86021 -typedef struct fsdir_tab fsdir_tab;
86022 -struct fsdir_tab {
86023 - sqlite3_vtab base; /* Base class - must be first */
86024 -};
86025 -
86027 -** Construct a new fsdir virtual table object.
86034 +** pA->isNull==0
86036 +** pB->isNull==0
86038 -static int fsdirConnect(
86039 - sqlite3 *db,
86040 - void *pAux,
86041 - int argc, const char *const*argv,
86042 - sqlite3_vtab **ppVtab,
86043 - char **pzErr
86044 -){
86045 - fsdir_tab *pNew = 0;
86046 - int rc;
86047 - (void)pAux;
86048 - (void)argc;
86049 - (void)argv;
86050 - (void)pzErr;
86051 - rc = sqlite3_declare_vtab(db, "CREATE TABLE x" FSDIR_SCHEMA);
86052 - if( rc==SQLITE_OK ){
86053 - pNew = (fsdir_tab*)sqlite3_malloc( sizeof(*pNew) );
86054 - if( pNew==0 ) return SQLITE_NOMEM;
86055 - memset(pNew, 0, sizeof(*pNew));
86056 - sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
86059 + if( pA->sign!=pB->sign ){
86060 + return pA->sign ? -1 : +1;
86062 + if( pA->sign ){
86067 + nASig = pA->nDigit - pA->nFrac;
86068 + nBSig = pB->nDigit - pB->nFrac;
86070 + return nASig - nBSig;
86072 + n = pA->nDigit;
86073 + if( n>pB->nDigit ) n = pB->nDigit;
86074 + rc = memcmp(pA->a, pB->a, n);
86076 + rc = pA->nDigit - pB->nDigit;
86078 - *ppVtab = (sqlite3_vtab*)pNew;
86083 -** This method is the destructor for fsdir vtab objects.
86089 -static int fsdirDisconnect(sqlite3_vtab *pVtab){
86090 - sqlite3_free(pVtab);
86091 - return SQLITE_OK;
86102 + if( pA==0 || pA->isNull ) goto cmp_done;
86104 + if( pB==0 || pB->isNull ) goto cmp_done;
86106 + if( rc<0 ) rc = -1;
86115 -** Constructor for a new fsdir_cursor object.
86119 -static int fsdirOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
86120 - fsdir_cursor *pCur;
86121 - (void)p;
86122 - pCur = sqlite3_malloc( sizeof(*pCur) );
86123 - if( pCur==0 ) return SQLITE_NOMEM;
86124 - memset(pCur, 0, sizeof(*pCur));
86125 - pCur->iLvl = -1;
86126 - *ppCursor = &pCur->base;
86127 - return SQLITE_OK;
86132 + nAddFrac = nFrac - p->nFrac;
86133 + nAddSig = (nDigit - p->nDigit) - nAddFrac;
86135 + p->a = sqlite3_realloc64(p->a, nDigit+1);
86136 + if( p->a==0 ){
86137 + p->oom = 1;
86141 + memmove(p->a+nAddSig, p->a, p->nDigit);
86142 + memset(p->a, 0, nAddSig);
86143 + p->nDigit += nAddSig;
86146 + memset(p->a+p->nDigit, 0, nAddFrac);
86147 + p->nDigit += nAddFrac;
86148 + p->nFrac += nAddFrac;
86153 -** Reset a cursor back to the state it was in when first returned
86154 -** by fsdirOpen().
86159 -static void fsdirResetCursor(fsdir_cursor *pCur){
86160 - int i;
86161 - for(i=0; i<=pCur->iLvl; i++){
86162 - FsdirLevel *pLvl = &pCur->aLvl[i];
86163 - if( pLvl->pDir ) closedir(pLvl->pDir);
86164 - sqlite3_free(pLvl->zDir);
86171 - sqlite3_free(pCur->zPath);
86172 - sqlite3_free(pCur->aLvl);
86173 - pCur->aLvl = 0;
86174 - pCur->zPath = 0;
86175 - pCur->zBase = 0;
86176 - pCur->nBase = 0;
86177 - pCur->nLvl = 0;
86178 - pCur->iLvl = -1;
86179 - pCur->iRowid = 1;
86180 -}
86181 -
86182 -/*
86183 -** Destructor for an fsdir_cursor.
86184 -*/
86185 -static int fsdirClose(sqlite3_vtab_cursor *cur){
86186 - fsdir_cursor *pCur = (fsdir_cursor*)cur;
86187 -
86188 - fsdirResetCursor(pCur);
86189 - sqlite3_free(pCur);
86190 - return SQLITE_OK;
86191 -}
86192 -
86193 -/*
86194 -** Set the error message for the virtual table associated with cursor
86195 -** pCur to the results of vprintf(zFmt, ...).
86196 -*/
86197 -static void fsdirSetErrmsg(fsdir_cursor *pCur, const char *zFmt, ...){
86198 - va_list ap;
86199 - va_start(ap, zFmt);
86200 - pCur->base.pVtab->zErrMsg = sqlite3_vmprintf(zFmt, ap);
86201 - va_end(ap);
86202 -}
86203 -
86204 -
86205 -/*
86206 -** Advance an fsdir_cursor to its next row of output.
86207 -*/
86208 -static int fsdirNext(sqlite3_vtab_cursor *cur){
86209 - fsdir_cursor *pCur = (fsdir_cursor*)cur;
86210 - mode_t m = pCur->sStat.st_mode;
86211 -
86212 - pCur->iRowid++;
86213 - if( S_ISDIR(m) ){
86214 - /* Descend into this directory */
86215 - int iNew = pCur->iLvl + 1;
86216 - FsdirLevel *pLvl;
86217 - if( iNew>=pCur->nLvl ){
86218 - int nNew = iNew+1;
86219 - sqlite3_int64 nByte = nNew*sizeof(FsdirLevel);
86220 - FsdirLevel *aNew = (FsdirLevel*)sqlite3_realloc64(pCur->aLvl, nByte);
86221 - if( aNew==0 ) return SQLITE_NOMEM;
86222 - memset(&aNew[pCur->nLvl], 0, sizeof(FsdirLevel)*(nNew-pCur->nLvl));
86223 - pCur->aLvl = aNew;
86224 - pCur->nLvl = nNew;
86225 - }
86226 - pCur->iLvl = iNew;
86227 - pLvl = &pCur->aLvl[iNew];
86228 -
86229 - pLvl->zDir = pCur->zPath;
86230 - pCur->zPath = 0;
86231 - pLvl->pDir = opendir(pLvl->zDir);
86232 - if( pLvl->pDir==0 ){
86233 - fsdirSetErrmsg(pCur, "cannot read directory: %s", pCur->zPath);
86234 - return SQLITE_ERROR;
86235 - }
86236 + if( pA->oom || pB==0 || pB->oom ){
86237 + pA->oom = 1;
86240 -
86241 - while( pCur->iLvl>=0 ){
86242 - FsdirLevel *pLvl = &pCur->aLvl[pCur->iLvl];
86243 - struct dirent *pEntry = readdir(pLvl->pDir);
86244 - if( pEntry ){
86245 - if( pEntry->d_name[0]=='.' ){
86246 - if( pEntry->d_name[1]=='.' && pEntry->d_name[2]=='\0' ) continue;
86247 - if( pEntry->d_name[1]=='\0' ) continue;
86248 - }
86249 - sqlite3_free(pCur->zPath);
86250 - pCur->zPath = sqlite3_mprintf("%s/%s", pLvl->zDir, pEntry->d_name);
86251 - if( pCur->zPath==0 ) return SQLITE_NOMEM;
86252 - if( fileLinkStat(pCur->zPath, &pCur->sStat) ){
86253 - fsdirSetErrmsg(pCur, "cannot stat file: %s", pCur->zPath);
86254 - return SQLITE_ERROR;
86255 - }
86256 - return SQLITE_OK;
86257 - }
86258 - closedir(pLvl->pDir);
86259 - sqlite3_free(pLvl->zDir);
86260 - pLvl->pDir = 0;
86261 - pLvl->zDir = 0;
86262 - pCur->iLvl--;
86263 + if( pA->isNull || pB->isNull ){
86264 + pA->isNull = 1;
86267 -
86268 - /* EOF */
86269 - sqlite3_free(pCur->zPath);
86270 - pCur->zPath = 0;
86271 - return SQLITE_OK;
86272 -}
86273 -
86274 -/*
86275 -** Return values of columns for the row at which the series_cursor
86276 -** is currently pointing.
86277 -*/
86278 -static int fsdirColumn(
86279 - sqlite3_vtab_cursor *cur, /* The cursor */
86280 - sqlite3_context *ctx, /* First argument to sqlite3_result_...() */
86281 - int i /* Which column to return */
86282 -){
86283 - fsdir_cursor *pCur = (fsdir_cursor*)cur;
86284 - switch( i ){
86285 - case FSDIR_COLUMN_NAME: {
86286 - sqlite3_result_text(ctx, &pCur->zPath[pCur->nBase], -1, SQLITE_TRANSIENT);
86287 - break;
86288 - }
86289 -
86290 - case FSDIR_COLUMN_MODE:
86291 - sqlite3_result_int64(ctx, pCur->sStat.st_mode);
86292 - break;
86293 -
86294 - case FSDIR_COLUMN_MTIME:
86295 - sqlite3_result_int64(ctx, pCur->sStat.st_mtime);
86296 - break;
86297 -
86298 - case FSDIR_COLUMN_DATA: {
86299 - mode_t m = pCur->sStat.st_mode;
86300 - if( S_ISDIR(m) ){
86301 - sqlite3_result_null(ctx);
86302 -#if !defined(_WIN32) && !defined(WIN32)
86303 - }else if( S_ISLNK(m) ){
86304 - char aStatic[64];
86305 - char *aBuf = aStatic;
86306 - sqlite3_int64 nBuf = 64;
86307 - int n;
86308 -
86309 - while( 1 ){
86310 - n = readlink(pCur->zPath, aBuf, nBuf);
86311 - if( n<nBuf ) break;
86312 - if( aBuf!=aStatic ) sqlite3_free(aBuf);
86313 - nBuf = nBuf*2;
86314 - aBuf = sqlite3_malloc64(nBuf);
86315 - if( aBuf==0 ){
86316 - sqlite3_result_error_nomem(ctx);
86317 - return SQLITE_NOMEM;
86318 - }
86319 + nSig = pA->nDigit - pA->nFrac;
86320 + if( nSig && pA->a[0]==0 ) nSig--;
86321 + if( nSig<pB->nDigit-pB->nFrac ){
86322 + nSig = pB->nDigit - pB->nFrac;
86324 + nFrac = pA->nFrac;
86325 + if( nFrac<pB->nFrac ) nFrac = pB->nFrac;
86329 + if( pA->oom || pB->oom ){
86330 + pA->oom = 1;
86332 + if( pA->sign==pB->sign ){
86334 + for(i=nDigit-1; i>=0; i--){
86335 + int x = pA->a[i] + pB->a[i] + carry;
86338 + pA->a[i] = x - 10;
86341 + pA->a[i] = x;
86343 -
86344 - sqlite3_result_text(ctx, aBuf, n, SQLITE_TRANSIENT);
86345 - if( aBuf!=aStatic ) sqlite3_free(aBuf);
86346 -#endif
86351 + rc = memcmp(pA->a, pB->a, nDigit);
86353 + aA = pB->a;
86354 + aB = pA->a;
86355 + pA->sign = !pA->sign;
86357 - readFileContents(ctx, pCur->zPath);
86358 + aA = pA->a;
86359 + aB = pB->a;
86361 + for(i=nDigit-1; i>=0; i--){
86362 + int x = aA[i] - aB[i] - borrow;
86364 + pA->a[i] = x+10;
86367 + pA->a[i] = x;
86371 - }
86372 - case FSDIR_COLUMN_PATH:
86373 - default: {
86374 - /* The FSDIR_COLUMN_PATH and FSDIR_COLUMN_DIR are input parameters.
86375 - ** always return their values as NULL */
86376 - break;
86379 - return SQLITE_OK;
86383 -** Return the rowid for the current row. In this implementation, the
86384 -** first row returned is assigned rowid value 1, and each subsequent
86385 -** row a value 1 more than that of the previous.
86388 -static int fsdirRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
86389 - fsdir_cursor *pCur = (fsdir_cursor*)cur;
86390 - *pRowid = pCur->iRowid;
86391 - return SQLITE_OK;
86413 -/*
86414 -** Return TRUE if the cursor has been moved off of the last
86415 -** row of output.
86416 -*/
86417 -static int fsdirEof(sqlite3_vtab_cursor *cur){
86418 - fsdir_cursor *pCur = (fsdir_cursor*)cur;
86419 - return (pCur->zPath==0);
86420 -}
86423 -** xFilter callback.
86427 -** idxNum==1 PATH parameter only
86428 -** idxNum==2 Both PATH and DIR supplied
86431 -static int fsdirFilter(
86432 - sqlite3_vtab_cursor *cur,
86433 - int idxNum, const char *idxStr,
86434 - int argc, sqlite3_value **argv
86440 - const char *zDir = 0;
86441 - fsdir_cursor *pCur = (fsdir_cursor*)cur;
86442 - (void)idxStr;
86443 - fsdirResetCursor(pCur);
86444 -
86445 - if( idxNum==0 ){
86446 - fsdirSetErrmsg(pCur, "table function fsdir requires an argument");
86447 - return SQLITE_ERROR;
86448 - }
86449 -
86450 - assert( argc==idxNum && (argc==1 || argc==2) );
86451 - zDir = (const char*)sqlite3_value_text(argv[0]);
86452 - if( zDir==0 ){
86453 - fsdirSetErrmsg(pCur, "table function fsdir requires a non-NULL argument");
86454 - return SQLITE_ERROR;
86455 - }
86456 - if( argc==2 ){
86457 - pCur->zBase = (const char*)sqlite3_value_text(argv[1]);
86458 - }
86459 - if( pCur->zBase ){
86460 - pCur->nBase = (int)strlen(pCur->zBase)+1;
86461 - pCur->zPath = sqlite3_mprintf("%s/%s", pCur->zBase, zDir);
86462 - }else{
86463 - pCur->zPath = sqlite3_mprintf("%s", zDir);
86481 + pB->sign = !pB->sign;
86489 - if( pCur->zPath==0 ){
86490 - return SQLITE_NOMEM;
86491 - }
86492 - if( fileLinkStat(pCur->zPath, &pCur->sStat) ){
86493 - fsdirSetErrmsg(pCur, "cannot stat file: %s", pCur->zPath);
86494 - return SQLITE_ERROR;
86510 + if( !p->isInit ){
86511 + p->isInit = 1;
86512 + p->a = sqlite3_malloc(2);
86513 + if( p->a==0 ){
86514 + p->oom = 1;
86516 + p->a[0] = 0;
86518 + p->nDigit = 1;
86519 + p->nFrac = 0;
86521 -
86522 - return SQLITE_OK;
86540 + if( pArg ) pArg->sign = !pArg->sign;
86557 -** SQLite will invoke this method one or more times while planning a query
86558 -** that uses the generate_series virtual table. This routine needs to create
86559 -** a query plan for each invocation and compute an estimated cost for that
86560 -** plan.
86561 -**
86562 -** In this implementation idxNum is used to represent the
86563 -** query plan. idxStr is unused.
86566 -** The query plan is represented by values of idxNum:
86569 -** (1) The path value is supplied by argv[0]
86570 -** (2) Path is in argv[0] and dir is in argv[1]
86576 -static int fsdirBestIndex(
86577 - sqlite3_vtab *tab,
86578 - sqlite3_index_info *pIdxInfo
86584 - int i; /* Loop over constraints */
86585 - int idxPath = -1; /* Index in pIdxInfo->aConstraint of PATH= */
86586 - int idxDir = -1; /* Index in pIdxInfo->aConstraint of DIR= */
86587 - int seenPath = 0; /* True if an unusable PATH= constraint is seen */
86588 - int seenDir = 0; /* True if an unusable DIR= constraint is seen */
86589 - const struct sqlite3_index_constraint *pConstraint;
86590 -
86591 - (void)tab;
86592 - pConstraint = pIdxInfo->aConstraint;
86593 - for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
86594 - if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
86595 - switch( pConstraint->iColumn ){
86596 - case FSDIR_COLUMN_PATH: {
86597 - if( pConstraint->usable ){
86598 - idxPath = i;
86599 - seenPath = 0;
86600 - }else if( idxPath<0 ){
86601 - seenPath = 1;
86602 - }
86603 - break;
86604 - }
86605 - case FSDIR_COLUMN_DIR: {
86606 - if( pConstraint->usable ){
86607 - idxDir = i;
86608 - seenDir = 0;
86609 - }else if( idxDir<0 ){
86610 - seenDir = 1;
86611 - }
86612 - break;
86613 - }
86614 - }
86621 + if( pA==0 || pA->oom || pA->isNull
86622 + || pB==0 || pB->oom || pB->isNull
86626 - if( seenPath || seenDir ){
86627 - /* If input parameters are unusable, disallow this plan */
86628 - return SQLITE_CONSTRAINT;
86629 + acc = sqlite3_malloc64( pA->nDigit + pB->nDigit + 2 );
86634 -
86635 - if( idxPath<0 ){
86636 - pIdxInfo->idxNum = 0;
86637 - /* The pIdxInfo->estimatedCost should have been initialized to a huge
86638 - ** number. Leave it unchanged. */
86639 - pIdxInfo->estimatedRows = 0x7fffffff;
86640 - }else{
86641 - pIdxInfo->aConstraintUsage[idxPath].omit = 1;
86642 - pIdxInfo->aConstraintUsage[idxPath].argvIndex = 1;
86643 - if( idxDir>=0 ){
86644 - pIdxInfo->aConstraintUsage[idxDir].omit = 1;
86645 - pIdxInfo->aConstraintUsage[idxDir].argvIndex = 2;
86646 - pIdxInfo->idxNum = 2;
86647 - pIdxInfo->estimatedCost = 10.0;
86648 - }else{
86649 - pIdxInfo->idxNum = 1;
86650 - pIdxInfo->estimatedCost = 100.0;
86651 + memset(acc, 0, pA->nDigit + pB->nDigit + 2);
86652 + minFrac = pA->nFrac;
86653 + if( pB->nFrac<minFrac ) minFrac = pB->nFrac;
86654 + for(i=pA->nDigit-1; i>=0; i--){
86655 + signed char f = pA->a[i];
86657 + for(j=pB->nDigit-1, k=i+j+3; j>=0; j--, k--){
86658 + x = acc[k] + f*pB->a[j] + carry;
86664 + acc[k-1] += x/10;
86666 + sqlite3_free(pA->a);
86667 + pA->a = acc;
86669 + pA->nDigit += pB->nDigit + 2;
86670 + pA->nFrac += pB->nFrac;
86671 + pA->sign ^= pB->sign;
86672 + while( pA->nFrac>minFrac && pA->a[pA->nDigit-1]==0 ){
86673 + pA->nFrac--;
86674 + pA->nDigit--;
86678 - return SQLITE_OK;
86685 -/*
86686 -** Register the "fsdir" virtual table.
86687 -*/
86688 -static int fsdirRegister(sqlite3 *db){
86689 - static sqlite3_module fsdirModule = {
86690 - 0, /* iVersion */
86691 - 0, /* xCreate */
86692 - fsdirConnect, /* xConnect */
86693 - fsdirBestIndex, /* xBestIndex */
86694 - fsdirDisconnect, /* xDisconnect */
86695 - 0, /* xDestroy */
86696 - fsdirOpen, /* xOpen - open a cursor */
86697 - fsdirClose, /* xClose - close a cursor */
86698 - fsdirFilter, /* xFilter - configure scan constraints */
86699 - fsdirNext, /* xNext - advance a cursor */
86700 - fsdirEof, /* xEof - check for end of scan */
86701 - fsdirColumn, /* xColumn - read data */
86702 - fsdirRowid, /* xRowid - read data */
86703 - 0, /* xUpdate */
86704 - 0, /* xBegin */
86705 - 0, /* xSync */
86706 - 0, /* xCommit */
86707 - 0, /* xRollback */
86708 - 0, /* xFindMethod */
86709 - 0, /* xRename */
86710 - 0, /* xSavepoint */
86711 - 0, /* xRelease */
86712 - 0, /* xRollbackTo */
86713 - 0, /* xShadowName */
86714 - };
86715 -
86716 - int rc = sqlite3_create_module(db, "fsdir", &fsdirModule, 0);
86717 - return rc;
86718 -}
86719 -#else /* SQLITE_OMIT_VIRTUALTABLE */
86720 -# define fsdirRegister(x) SQLITE_OK
86721 -#endif
86722 -
86726 -int sqlite3_fileio_init(
86728 sqlite3 *db,
86733 - SQLITE_EXTENSION_INIT2(pApi);
86747 - rc = sqlite3_create_function(db, "readfile", 1,
86748 - SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
86749 - readfileFunc, 0, 0);
86750 - if( rc==SQLITE_OK ){
86751 - rc = sqlite3_create_function(db, "writefile", -1,
86752 - SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
86753 - writefileFunc, 0, 0);
86758 + rc = sqlite3_create_function(db, aFunc[i].zFuncName, aFunc[i].nArg,
86763 - rc = sqlite3_create_function(db, "lsmode", 1, SQLITE_UTF8, 0,
86764 - lsModeFunc, 0, 0);
86765 + rc = sqlite3_create_window_function(db, "decimal_sum", 1,
86771 - rc = fsdirRegister(db);
86772 + rc = sqlite3_create_collation(db, "decimal", SQLITE_UTF8,
86778 -#if defined(FILEIO_WIN32_DLL) && (defined(_WIN32) || defined(WIN32))
86779 -/* To allow a standalone DLL, make test_windirent.c use the same
86780 - * redefined SQLite API calls as the above extension code does.
86781 - * Just pull in this .c to accomplish this. As a beneficial side
86782 - * effect, this extension becomes a single translation unit. */
86783 -# include "test_windirent.c"
86784 -#endif
86785 -
86786 -/************************* End ../ext/misc/fileio.c ********************/
86787 -/************************* Begin ../ext/misc/completion.c ******************/
86791 -** 2017-07-10
86792 +** 2013-04-17
86796 @@ -3191,502 +2974,294 @@ int sqlite3_fileio_init(
86800 -*************************************************************************
86803 -** This file implements an eponymous virtual table that returns suggested
86804 -** completions for a partial SQL input.
86806 +** and input of IEEE754 Binary64 floating-point numbers.
86808 -** Suggested usage:
86812 -** SELECT DISTINCT candidate COLLATE nocase
86813 -** FROM completion($prefix,$wholeline)
86814 -** ORDER BY 1;
86815 +** In the first form, the value X should be a floating-point number.
86819 -** The two query parameters are optional. $prefix is the text of the
86820 -** current word being typed and that is to be completed. $wholeline is
86821 -** the complete input line, used for context.
86823 +** base-2 exponent of a new floating point number. The function returns
86824 +** a floating-point value equal to Y*pow(2,Z).
86826 -** The raw completion() table might return the same candidate multiple
86827 -** times, for example if the same column name is used to two or more
86828 -** tables. And the candidates are returned in an arbitrary order. Hence,
86829 -** the DISTINCT and ORDER BY are recommended.
86832 -** This virtual table operates at the speed of human typing, and so there
86833 -** is no attempt to make it fast. Even a slow implementation will be much
86834 -** faster than any human can type.
86835 +** ieee754(2.0) -> 'ieee754(2,0)'
86836 +** ieee754(45.25) -> 'ieee754(181,-2)'
86837 +** ieee754(2, 0) -> 2.0
86838 +** ieee754(181, -2) -> 45.25
86840 +** Two additional functions break apart the one-argument ieee754()
86843 +** ieee754_mantissa(45.25) -> 181
86844 +** ieee754_exponent(45.25) -> -2
86848 +** ieee754_from_blob(x'3ff0000000000000') -> 1.0
86849 +** ieee754_to_blob(1.0) -> x'3ff0000000000000'
86851 +** In all single-argument functions, if the argument is an 8-byte blob
86852 +** then that blob is interpreted as a big-endian binary64 value.
86856 +** -----------------------------------------------
86869 +** VALUES(-1,'0.5')
86871 +** SELECT x-1, decimal_mul(v,'0.5') FROM c WHERE x-1>=-1075
86878 +** ---------------^^^^^---- Replace with whatever you want
86898 -#include <ctype.h>
86899 -
86900 -#ifndef SQLITE_OMIT_VIRTUALTABLE
86901 -
86902 -/* completion_vtab is a subclass of sqlite3_vtab which will
86903 -** serve as the underlying representation of a completion virtual table
86904 -*/
86905 -typedef struct completion_vtab completion_vtab;
86906 -struct completion_vtab {
86907 - sqlite3_vtab base; /* Base class - must be first */
86908 - sqlite3 *db; /* Database connection for this completion vtab */
86909 -};
86910 -
86911 -/* completion_cursor is a subclass of sqlite3_vtab_cursor which will
86912 -** serve as the underlying representation of a cursor that scans
86913 -** over rows of the result
86914 -*/
86915 -typedef struct completion_cursor completion_cursor;
86916 -struct completion_cursor {
86917 - sqlite3_vtab_cursor base; /* Base class - must be first */
86918 - sqlite3 *db; /* Database connection for this cursor */
86919 - int nPrefix, nLine; /* Number of bytes in zPrefix and zLine */
86920 - char *zPrefix; /* The prefix for the word we want to complete */
86921 - char *zLine; /* The whole that we want to complete */
86922 - const char *zCurrentRow; /* Current output row */
86923 - int szRow; /* Length of the zCurrentRow string */
86924 - sqlite3_stmt *pStmt; /* Current statement */
86925 - sqlite3_int64 iRowid; /* The rowid */
86926 - int ePhase; /* Current phase */
86927 - int j; /* inter-phase counter */
86928 -};
86930 -/* Values for ePhase:
86931 -*/
86932 -#define COMPLETION_FIRST_PHASE 1
86933 -#define COMPLETION_KEYWORDS 1
86934 -#define COMPLETION_PRAGMAS 2
86935 -#define COMPLETION_FUNCTIONS 3
86936 -#define COMPLETION_COLLATIONS 4
86937 -#define COMPLETION_INDEXES 5
86938 -#define COMPLETION_TRIGGERS 6
86939 -#define COMPLETION_DATABASES 7
86940 -#define COMPLETION_TABLES 8 /* Also VIEWs and TRIGGERs */
86941 -#define COMPLETION_COLUMNS 9
86942 -#define COMPLETION_MODULES 10
86943 -#define COMPLETION_EOF 11
86951 -** The completionConnect() method is invoked to create a new
86952 -** completion_vtab that describes the completion virtual table.
86953 -**
86954 -** Think of this routine as the constructor for completion_vtab objects.
86955 -**
86956 -** All this routine needs to do is:
86957 -**
86958 -** (1) Allocate the completion_vtab object and initialize all fields.
86959 -**
86960 -** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
86961 -** result set of queries against completion will look like.
86964 -static int completionConnect(
86965 - sqlite3 *db,
86966 - void *pAux,
86967 - int argc, const char *const*argv,
86968 - sqlite3_vtab **ppVtab,
86969 - char **pzErr
86975 - completion_vtab *pNew;
86976 - int rc;
86977 -
86978 - (void)(pAux); /* Unused parameter */
86979 - (void)(argc); /* Unused parameter */
86980 - (void)(argv); /* Unused parameter */
86981 - (void)(pzErr); /* Unused parameter */
86982 -
86983 -/* Column numbers */
86984 -#define COMPLETION_COLUMN_CANDIDATE 0 /* Suggested completion of the input */
86985 -#define COMPLETION_COLUMN_PREFIX 1 /* Prefix of the word to be completed */
86986 -#define COMPLETION_COLUMN_WHOLELINE 2 /* Entire line seen so far */
86987 -#define COMPLETION_COLUMN_PHASE 3 /* ePhase - used for debugging only */
86988 -
86989 - sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
86990 - rc = sqlite3_declare_vtab(db,
86991 - "CREATE TABLE x("
86992 - " candidate TEXT,"
86993 - " prefix TEXT HIDDEN,"
86994 - " wholeline TEXT HIDDEN,"
86995 - " phase INT HIDDEN" /* Used for debugging only */
86996 - ")");
86997 - if( rc==SQLITE_OK ){
86998 - pNew = sqlite3_malloc( sizeof(*pNew) );
86999 - *ppVtab = (sqlite3_vtab*)pNew;
87000 - if( pNew==0 ) return SQLITE_NOMEM;
87001 - memset(pNew, 0, sizeof(*pNew));
87002 - pNew->db = db;
87003 - }
87004 - return rc;
87005 -}
87006 -
87007 -/*
87008 -** This method is the destructor for completion_cursor objects.
87009 -*/
87010 -static int completionDisconnect(sqlite3_vtab *pVtab){
87011 - sqlite3_free(pVtab);
87012 - return SQLITE_OK;
87013 -}
87014 -
87015 -/*
87016 -** Constructor for a new completion_cursor object.
87017 -*/
87018 -static int completionOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
87019 - completion_cursor *pCur;
87020 - pCur = sqlite3_malloc( sizeof(*pCur) );
87021 - if( pCur==0 ) return SQLITE_NOMEM;
87022 - memset(pCur, 0, sizeof(*pCur));
87023 - pCur->db = ((completion_vtab*)p)->db;
87024 - *ppCursor = &pCur->base;
87025 - return SQLITE_OK;
87026 -}
87027 -
87028 -/*
87029 -** Reset the completion_cursor.
87030 -*/
87031 -static void completionCursorReset(completion_cursor *pCur){
87032 - sqlite3_free(pCur->zPrefix); pCur->zPrefix = 0; pCur->nPrefix = 0;
87033 - sqlite3_free(pCur->zLine); pCur->zLine = 0; pCur->nLine = 0;
87034 - sqlite3_finalize(pCur->pStmt); pCur->pStmt = 0;
87035 - pCur->j = 0;
87036 -}
87037 -
87038 -/*
87039 -** Destructor for a completion_cursor.
87040 -*/
87041 -static int completionClose(sqlite3_vtab_cursor *cur){
87042 - completionCursorReset((completion_cursor*)cur);
87043 - sqlite3_free(cur);
87044 - return SQLITE_OK;
87045 -}
87046 -
87047 -/*
87048 -** Advance a completion_cursor to its next row of output.
87049 -**
87050 -** The ->ePhase, ->j, and ->pStmt fields of the completion_cursor object
87051 -** record the current state of the scan. This routine sets ->zCurrentRow
87052 -** to the current row of output and then returns. If no more rows remain,
87053 -** then ->ePhase is set to COMPLETION_EOF which will signal the virtual
87054 -** table that has reached the end of its scan.
87055 -**
87056 -** The current implementation just lists potential identifiers and
87057 -** keywords and filters them by zPrefix. Future enhancements should
87058 -** take zLine into account to try to restrict the set of identifiers and
87059 -** keywords based on what would be legal at the current point of input.
87060 -*/
87061 -static int completionNext(sqlite3_vtab_cursor *cur){
87062 - completion_cursor *pCur = (completion_cursor*)cur;
87063 - int eNextPhase = 0; /* Next phase to try if current phase reaches end */
87064 - int iCol = -1; /* If >=0, step pCur->pStmt and use the i-th column */
87065 - pCur->iRowid++;
87066 - while( pCur->ePhase!=COMPLETION_EOF ){
87067 - switch( pCur->ePhase ){
87068 - case COMPLETION_KEYWORDS: {
87069 - if( pCur->j >= sqlite3_keyword_count() ){
87070 - pCur->zCurrentRow = 0;
87071 - pCur->ePhase = COMPLETION_DATABASES;
87072 - }else{
87073 - sqlite3_keyword_name(pCur->j++, &pCur->zCurrentRow, &pCur->szRow);
87074 - }
87075 - iCol = -1;
87076 - break;
87093 - case COMPLETION_DATABASES: {
87094 - if( pCur->pStmt==0 ){
87095 - sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1,
87096 - &pCur->pStmt, 0);
87097 - }
87098 - iCol = 1;
87099 - eNextPhase = COMPLETION_TABLES;
87100 - break;
87107 + r = -r;
87117 + m = a & ((((sqlite3_int64)1)<<52)-1);
87123 - case COMPLETION_TABLES: {
87124 - if( pCur->pStmt==0 ){
87125 - sqlite3_stmt *pS2;
87126 - char *zSql = 0;
87127 - const char *zSep = "";
87128 - sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
87129 - while( sqlite3_step(pS2)==SQLITE_ROW ){
87130 - const char *zDb = (const char*)sqlite3_column_text(pS2, 1);
87131 - zSql = sqlite3_mprintf(
87132 - "%z%s"
87133 - "SELECT name FROM \"%w\".sqlite_schema",
87134 - zSql, zSep, zDb
87135 - );
87136 - if( zSql==0 ) return SQLITE_NOMEM;
87137 - zSep = " UNION ";
87138 - }
87139 - sqlite3_finalize(pS2);
87140 - sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
87141 - sqlite3_free(zSql);
87142 - }
87143 - iCol = 0;
87144 - eNextPhase = COMPLETION_COLUMNS;
87145 - break;
87150 - case COMPLETION_COLUMNS: {
87151 - if( pCur->pStmt==0 ){
87152 - sqlite3_stmt *pS2;
87153 - char *zSql = 0;
87154 - const char *zSep = "";
87155 - sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
87156 - while( sqlite3_step(pS2)==SQLITE_ROW ){
87157 - const char *zDb = (const char*)sqlite3_column_text(pS2, 1);
87158 - zSql = sqlite3_mprintf(
87159 - "%z%s"
87160 - "SELECT pti.name FROM \"%w\".sqlite_schema AS sm"
87161 - " JOIN pragma_table_info(sm.name,%Q) AS pti"
87162 - " WHERE sm.type='table'",
87163 - zSql, zSep, zDb, zDb
87164 - );
87165 - if( zSql==0 ) return SQLITE_NOMEM;
87166 - zSep = " UNION ";
87167 - }
87168 - sqlite3_finalize(pS2);
87169 - sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
87170 - sqlite3_free(zSql);
87171 - }
87172 - iCol = 0;
87173 - eNextPhase = COMPLETION_EOF;
87174 + if( isNeg ) m = -m;
87179 + m, e-1075);
87180 + sqlite3_result_text(context, zResult, -1, SQLITE_TRANSIENT);
87186 + sqlite3_result_int(context, e-1075);
87188 - }
87190 - if( iCol<0 ){
87191 - /* This case is when the phase presets zCurrentRow */
87192 - if( pCur->zCurrentRow==0 ) continue;
87193 - }else{
87194 - if( sqlite3_step(pCur->pStmt)==SQLITE_ROW ){
87195 - /* Extract the next row of content */
87196 - pCur->zCurrentRow = (const char*)sqlite3_column_text(pCur->pStmt, iCol);
87197 - pCur->szRow = sqlite3_column_bytes(pCur->pStmt, iCol);
87205 + /* Limit the range of e. Ticket 22dea1cfdb9151e4 2021-03-02 */
87208 + }else if( e<-10000 ){
87209 + e = -10000;
87214 + m = -m;
87216 + }else if( m==0 && e>-1000 && e<1000 ){
87226 + e--;
87231 + if( 1-e >= 64 ){
87234 - /* When all rows are finished, advance to the next phase */
87235 - sqlite3_finalize(pCur->pStmt);
87236 - pCur->pStmt = 0;
87237 - pCur->ePhase = eNextPhase;
87238 - continue;
87239 + m >>= 1-e;
87245 - if( pCur->nPrefix==0 ) break;
87246 - if( pCur->nPrefix<=pCur->szRow
87247 - && sqlite3_strnicmp(pCur->zPrefix, pCur->zCurrentRow, pCur->nPrefix)==0
87248 - ){
87249 - break;
87250 - }
87251 + a = m & ((((sqlite3_int64)1)<<52)-1);
87257 -
87258 - return SQLITE_OK;
87262 -** Return values of columns for the row at which the completion_cursor
87263 -** is currently pointing.
87266 -static int completionColumn(
87267 - sqlite3_vtab_cursor *cur, /* The cursor */
87268 - sqlite3_context *ctx, /* First argument to sqlite3_result_...() */
87269 - int i /* Which column to return */
87275 - completion_cursor *pCur = (completion_cursor*)cur;
87276 - switch( i ){
87277 - case COMPLETION_COLUMN_CANDIDATE: {
87278 - sqlite3_result_text(ctx, pCur->zCurrentRow, pCur->szRow,SQLITE_TRANSIENT);
87279 - break;
87280 - }
87281 - case COMPLETION_COLUMN_PREFIX: {
87282 - sqlite3_result_text(ctx, pCur->zPrefix, -1, SQLITE_TRANSIENT);
87283 - break;
87284 - }
87285 - case COMPLETION_COLUMN_WHOLELINE: {
87286 - sqlite3_result_text(ctx, pCur->zLine, -1, SQLITE_TRANSIENT);
87287 - break;
87288 - }
87289 - case COMPLETION_COLUMN_PHASE: {
87290 - sqlite3_result_int(ctx, pCur->ePhase);
87291 - break;
87292 - }
87293 - }
87294 - return SQLITE_OK;
87295 -}
87296 -
87297 -/*
87298 -** Return the rowid for the current row. In this implementation, the
87299 -** rowid is the same as the output value.
87300 -*/
87301 -static int completionRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
87302 - completion_cursor *pCur = (completion_cursor*)cur;
87303 - *pRowid = pCur->iRowid;
87304 - return SQLITE_OK;
87305 -}
87306 -
87307 -/*
87308 -** Return TRUE if the cursor has been moved off of the last
87309 -** row of output.
87310 -*/
87311 -static int completionEof(sqlite3_vtab_cursor *cur){
87312 - completion_cursor *pCur = (completion_cursor*)cur;
87313 - return pCur->ePhase >= COMPLETION_EOF;
87314 -}
87315 -
87316 -/*
87317 -** This method is called to "rewind" the completion_cursor object back
87318 -** to the first row of output. This method is always called at least
87319 -** once prior to any call to completionColumn() or completionRowid() or
87320 -** completionEof().
87321 -*/
87322 -static int completionFilter(
87323 - sqlite3_vtab_cursor *pVtabCursor,
87324 - int idxNum, const char *idxStr,
87325 - int argc, sqlite3_value **argv
87326 -){
87327 - completion_cursor *pCur = (completion_cursor *)pVtabCursor;
87328 - int iArg = 0;
87329 - (void)(idxStr); /* Unused parameter */
87330 - (void)(argc); /* Unused parameter */
87331 - completionCursorReset(pCur);
87332 - if( idxNum & 1 ){
87333 - pCur->nPrefix = sqlite3_value_bytes(argv[iArg]);
87334 - if( pCur->nPrefix>0 ){
87335 - pCur->zPrefix = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
87336 - if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
87337 - }
87338 - iArg = 1;
87339 - }
87340 - if( idxNum & 2 ){
87341 - pCur->nLine = sqlite3_value_bytes(argv[iArg]);
87342 - if( pCur->nLine>0 ){
87343 - pCur->zLine = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
87344 - if( pCur->zLine==0 ) return SQLITE_NOMEM;
87345 - }
87346 - }
87347 - if( pCur->zLine!=0 && pCur->zPrefix==0 ){
87348 - int i = pCur->nLine;
87349 - while( i>0 && (isalnum(pCur->zLine[i-1]) || pCur->zLine[i-1]=='_') ){
87350 - i--;
87351 - }
87352 - pCur->nPrefix = pCur->nLine - i;
87353 - if( pCur->nPrefix>0 ){
87354 - pCur->zPrefix = sqlite3_mprintf("%.*s", pCur->nPrefix, pCur->zLine + i);
87355 - if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
87370 - pCur->iRowid = 0;
87371 - pCur->ePhase = COMPLETION_FIRST_PHASE;
87372 - return completionNext(pVtabCursor);
87374 -
87375 -/*
87376 -** SQLite will invoke this method one or more times while planning a query
87377 -** that uses the completion virtual table. This routine needs to create
87378 -** a query plan for each invocation and compute an estimated cost for that
87379 -** plan.
87380 -**
87381 -** There are two hidden parameters that act as arguments to the table-valued
87382 -** function: "prefix" and "wholeline". Bit 0 of idxNum is set if "prefix"
87383 -** is available and bit 1 is set if "wholeline" is available.
87384 -*/
87385 -static int completionBestIndex(
87386 - sqlite3_vtab *tab,
87387 - sqlite3_index_info *pIdxInfo
87393 - int i; /* Loop over constraints */
87394 - int idxNum = 0; /* The query plan bitmask */
87395 - int prefixIdx = -1; /* Index of the start= constraint, or -1 if none */
87396 - int wholelineIdx = -1; /* Index of the stop= constraint, or -1 if none */
87397 - int nArg = 0; /* Number of arguments that completeFilter() expects */
87398 - const struct sqlite3_index_constraint *pConstraint;
87399 -
87400 - (void)(tab); /* Unused parameter */
87401 - pConstraint = pIdxInfo->aConstraint;
87402 - for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
87403 - if( pConstraint->usable==0 ) continue;
87404 - if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
87405 - switch( pConstraint->iColumn ){
87406 - case COMPLETION_COLUMN_PREFIX:
87407 - prefixIdx = i;
87408 - idxNum |= 1;
87409 - break;
87410 - case COMPLETION_COLUMN_WHOLELINE:
87411 - wholelineIdx = i;
87412 - idxNum |= 2;
87413 - break;
87424 + a[sizeof(r)-i] = v&0xff;
87429 - if( prefixIdx>=0 ){
87430 - pIdxInfo->aConstraintUsage[prefixIdx].argvIndex = ++nArg;
87431 - pIdxInfo->aConstraintUsage[prefixIdx].omit = 1;
87432 - }
87433 - if( wholelineIdx>=0 ){
87434 - pIdxInfo->aConstraintUsage[wholelineIdx].argvIndex = ++nArg;
87435 - pIdxInfo->aConstraintUsage[wholelineIdx].omit = 1;
87436 - }
87437 - pIdxInfo->idxNum = idxNum;
87438 - pIdxInfo->estimatedCost = (double)5000 - 1000*nArg;
87439 - pIdxInfo->estimatedRows = 500 - 100*nArg;
87440 - return SQLITE_OK;
87443 -/*
87444 -** This following structure defines all the methods for the
87445 -** completion virtual table.
87446 -*/
87447 -static sqlite3_module completionModule = {
87448 - 0, /* iVersion */
87449 - 0, /* xCreate */
87450 - completionConnect, /* xConnect */
87451 - completionBestIndex, /* xBestIndex */
87452 - completionDisconnect, /* xDisconnect */
87453 - 0, /* xDestroy */
87454 - completionOpen, /* xOpen - open a cursor */
87455 - completionClose, /* xClose - close a cursor */
87456 - completionFilter, /* xFilter - configure scan constraints */
87457 - completionNext, /* xNext - advance a cursor */
87458 - completionEof, /* xEof - check for end of scan */
87459 - completionColumn, /* xColumn - read data */
87460 - completionRowid, /* xRowid - read data */
87461 - 0, /* xUpdate */
87462 - 0, /* xBegin */
87463 - 0, /* xSync */
87464 - 0, /* xCommit */
87465 - 0, /* xRollback */
87466 - 0, /* xFindMethod */
87467 - 0, /* xRename */
87468 - 0, /* xSavepoint */
87469 - 0, /* xRelease */
87470 - 0, /* xRollbackTo */
87471 - 0 /* xShadowName */
87472 -};
87473 -
87474 -#endif /* SQLITE_OMIT_VIRTUALTABLE */
87475 -
87476 -int sqlite3CompletionVtabInit(sqlite3 *db){
87477 - int rc = SQLITE_OK;
87478 -#ifndef SQLITE_OMIT_VIRTUALTABLE
87479 - rc = sqlite3_create_module(db, "completion", &completionModule, 0);
87480 -#endif
87481 - return rc;
87482 -}
87487 -int sqlite3_completion_init(
87489 sqlite3 *db,
87510 - (void)(pzErrMsg); /* Unused parameter */
87511 -#ifndef SQLITE_OMIT_VIRTUALTABLE
87512 - rc = sqlite3CompletionVtabInit(db);
87513 -#endif
87516 + rc = sqlite3_create_function(db, aFunc[i].zFName, aFunc[i].nArg,
87524 -/************************* End ../ext/misc/completion.c ********************/
87525 -/************************* Begin ../ext/misc/appendvfs.c ******************/
87529 -** 2017-10-20
87530 +** 2015-08-18
87534 @@ -3695,673 +3270,1237 @@ int sqlite3_completion_init(
87538 -******************************************************************************
87541 -** This file implements a VFS shim that allows an SQLite database to be
87542 -** appended onto the end of some other file, such as an executable.
87543 +** This file demonstrates how to create a table-valued-function using
87548 -** A special record must appear at the end of the file that identifies the
87549 -** file as an appended database and provides the offset to the first page
87550 -** of the exposed content. (Or, it is the length of the content prefix.)
87551 -** For best performance page 1 should be located at a disk page boundary,
87552 -** though that is not required.
87555 -** When opening a database using this VFS, the connection might treat
87556 -** the file as an ordinary SQLite database, or it might treat it as a
87557 -** database appended onto some other file. The decision is made by
87558 -** applying the following rules in order:
87562 -** (1) An empty file is an ordinary database.
87565 -** (2) If the file ends with the appendvfs trailer string
87566 -** "Start-Of-SQLite3-NNNNNNNN" that file is an appended database.
87569 -** (3) If the file begins with the standard SQLite prefix string
87570 -** "SQLite format 3", that file is an ordinary database.
87573 -** (4) If none of the above apply and the SQLITE_OPEN_CREATE flag is
87574 -** set, then a new database is appended to the already existing file.
87577 -** (5) Otherwise, SQLITE_CANTOPEN is returned.
87580 -** To avoid unnecessary complications with the PENDING_BYTE, the size of
87581 -** the file containing the database is limited to 1GiB. (1073741824 bytes)
87582 -** This VFS will not read or write past the 1GiB mark. This restriction
87583 -** might be lifted in future versions. For now, if you need a larger
87584 -** database, then keep it in a separate file.
87588 -** If the file being opened is a plain database (not an appended one), then
87589 -** this shim is a pass-through into the default underlying VFS. (rule 3)
87590 -**/
87624 +** series are well-defined.
87628 -#include <string.h>
87632 -/* The append mark at the end of the database is:
87642 + sqlite3_vtab_cursor base; /* Base class - must be first */
87655 -** Start-Of-SQLite3-NNNNNNNN
87656 -** 123456789 123456789 12345
87659 -** The NNNNNNNN represents a 64-bit big-endian unsigned integer which is
87660 -** the offset to page 1, and also the length of the prefix content.
87668 -#define APND_MARK_PREFIX "Start-Of-SQLite3-"
87669 -#define APND_MARK_PREFIX_SZ 17
87670 -#define APND_MARK_FOS_SZ 8
87671 -#define APND_MARK_SIZE (APND_MARK_PREFIX_SZ+APND_MARK_FOS_SZ)
87673 + sqlite3 *db,
87692 + rc = sqlite3_declare_vtab(db,
87698 + sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
87704 -** Maximum size of the combined prefix + database + append-mark. This
87705 -** must be less than 0x40000000 to avoid locking issues on Windows.
87708 -#define APND_MAX_SIZE (0x40000000)
87715 -** Try to align the database to an even multiple of APND_ROUNDUP bytes.
87718 -#ifndef APND_ROUNDUP
87719 -#define APND_ROUNDUP 4096
87720 -#endif
87721 -#define APND_ALIGN_MASK ((sqlite3_int64)(APND_ROUNDUP-1))
87722 -#define APND_START_ROUNDUP(fsz) (((fsz)+APND_ALIGN_MASK) & ~APND_ALIGN_MASK)
87729 + *ppCursor = &pCur->base;
87734 -** Forward declaration of objects used by this utility
87737 -typedef struct sqlite3_vfs ApndVfs;
87738 -typedef struct ApndFile ApndFile;
87744 -/* Access to a lower-level VFS that (might) implement dynamic loading,
87745 -** access to randomness, etc.
87746 -*/
87747 -#define ORIGVFS(p) ((sqlite3_vfs*)((p)->pAppData))
87748 -#define ORIGFILE(p) ((sqlite3_file*)(((ApndFile*)(p))+1))
87750 -/* An open appendvfs file
87751 -**
87752 -** An instance of this structure describes the appended database file.
87753 -** A separate sqlite3_file object is always appended. The appended
87754 -** sqlite3_file object (which can be accessed using ORIGFILE()) describes
87755 -** the entire file, including the prefix, the database, and the
87756 -** append-mark.
87757 -**
87758 -** The structure of an AppendVFS database is like this:
87759 -**
87760 -** +-------------+---------+----------+-------------+
87761 -** | prefix-file | padding | database | append-mark |
87762 -** +-------------+---------+----------+-------------+
87763 -** ^ ^
87764 -** | |
87765 -** iPgOne iMark
87766 -**
87767 -**
87768 -** "prefix file" - file onto which the database has been appended.
87769 -** "padding" - zero or more bytes inserted so that "database"
87770 -** starts on an APND_ROUNDUP boundary
87771 -** "database" - The SQLite database file
87772 -** "append-mark" - The 25-byte "Start-Of-SQLite3-NNNNNNNN" that indicates
87773 -** the offset from the start of prefix-file to the start
87774 -** of "database".
87775 -**
87776 -** The size of the database is iMark - iPgOne.
87777 -**
87778 -** The NNNNNNNN in the "Start-Of-SQLite3-NNNNNNNN" suffix is the value
87779 -** of iPgOne stored as a big-ending 64-bit integer.
87780 -**
87781 -** iMark will be the size of the underlying file minus 25 (APND_MARKSIZE).
87782 -** Or, iMark is -1 to indicate that it has not yet been written.
87786 -struct ApndFile {
87787 - sqlite3_file base; /* Subclass. MUST BE FIRST! */
87788 - sqlite3_int64 iPgOne; /* Offset to the start of the database */
87789 - sqlite3_int64 iMark; /* Offset of the append mark. -1 if unwritten */
87790 - /* Always followed by another sqlite3_file that describes the whole file */
87791 -};
87794 + if( pCur->isDesc ){
87795 + pCur->iValue -= pCur->iStep;
87797 + pCur->iValue += pCur->iStep;
87799 + pCur->iRowid++;
87804 -** Methods for ApndFile
87808 -static int apndClose(sqlite3_file*);
87809 -static int apndRead(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
87810 -static int apndWrite(sqlite3_file*,const void*,int iAmt, sqlite3_int64 iOfst);
87811 -static int apndTruncate(sqlite3_file*, sqlite3_int64 size);
87812 -static int apndSync(sqlite3_file*, int flags);
87813 -static int apndFileSize(sqlite3_file*, sqlite3_int64 *pSize);
87814 -static int apndLock(sqlite3_file*, int);
87815 -static int apndUnlock(sqlite3_file*, int);
87816 -static int apndCheckReservedLock(sqlite3_file*, int *pResOut);
87817 -static int apndFileControl(sqlite3_file*, int op, void *pArg);
87818 -static int apndSectorSize(sqlite3_file*);
87819 -static int apndDeviceCharacteristics(sqlite3_file*);
87820 -static int apndShmMap(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
87821 -static int apndShmLock(sqlite3_file*, int offset, int n, int flags);
87822 -static void apndShmBarrier(sqlite3_file*);
87823 -static int apndShmUnmap(sqlite3_file*, int deleteFlag);
87824 -static int apndFetch(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);
87825 -static int apndUnfetch(sqlite3_file*, sqlite3_int64 iOfst, void *p);
87834 + case SERIES_COLUMN_START: x = pCur->mnValue; break;
87835 + case SERIES_COLUMN_STOP: x = pCur->mxValue; break;
87836 + case SERIES_COLUMN_STEP: x = pCur->iStep; break;
87837 + default: x = pCur->iValue; break;
87844 -** Methods for ApndVfs
87849 -static int apndOpen(sqlite3_vfs*, const char *, sqlite3_file*, int , int *);
87850 -static int apndDelete(sqlite3_vfs*, const char *zName, int syncDir);
87851 -static int apndAccess(sqlite3_vfs*, const char *zName, int flags, int *);
87852 -static int apndFullPathname(sqlite3_vfs*, const char *zName, int, char *zOut);
87853 -static void *apndDlOpen(sqlite3_vfs*, const char *zFilename);
87854 -static void apndDlError(sqlite3_vfs*, int nByte, char *zErrMsg);
87855 -static void (*apndDlSym(sqlite3_vfs *pVfs, void *p, const char*zSym))(void);
87856 -static void apndDlClose(sqlite3_vfs*, void*);
87857 -static int apndRandomness(sqlite3_vfs*, int nByte, char *zOut);
87858 -static int apndSleep(sqlite3_vfs*, int microseconds);
87859 -static int apndCurrentTime(sqlite3_vfs*, double*);
87860 -static int apndGetLastError(sqlite3_vfs*, int, char *);
87861 -static int apndCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*);
87862 -static int apndSetSystemCall(sqlite3_vfs*, const char*,sqlite3_syscall_ptr);
87863 -static sqlite3_syscall_ptr apndGetSystemCall(sqlite3_vfs*, const char *z);
87864 -static const char *apndNextSystemCall(sqlite3_vfs*, const char *zName);
87865 -
87866 -static sqlite3_vfs apnd_vfs = {
87867 - 3, /* iVersion (set when registered) */
87868 - 0, /* szOsFile (set when registered) */
87869 - 1024, /* mxPathname */
87870 - 0, /* pNext */
87871 - "apndvfs", /* zName */
87872 - 0, /* pAppData (set when registered) */
87873 - apndOpen, /* xOpen */
87874 - apndDelete, /* xDelete */
87875 - apndAccess, /* xAccess */
87876 - apndFullPathname, /* xFullPathname */
87877 - apndDlOpen, /* xDlOpen */
87878 - apndDlError, /* xDlError */
87879 - apndDlSym, /* xDlSym */
87880 - apndDlClose, /* xDlClose */
87881 - apndRandomness, /* xRandomness */
87882 - apndSleep, /* xSleep */
87883 - apndCurrentTime, /* xCurrentTime */
87884 - apndGetLastError, /* xGetLastError */
87885 - apndCurrentTimeInt64, /* xCurrentTimeInt64 */
87886 - apndSetSystemCall, /* xSetSystemCall */
87887 - apndGetSystemCall, /* xGetSystemCall */
87888 - apndNextSystemCall /* xNextSystemCall */
87889 -};
87890 -
87891 -static const sqlite3_io_methods apnd_io_methods = {
87892 - 3, /* iVersion */
87893 - apndClose, /* xClose */
87894 - apndRead, /* xRead */
87895 - apndWrite, /* xWrite */
87896 - apndTruncate, /* xTruncate */
87897 - apndSync, /* xSync */
87898 - apndFileSize, /* xFileSize */
87899 - apndLock, /* xLock */
87900 - apndUnlock, /* xUnlock */
87901 - apndCheckReservedLock, /* xCheckReservedLock */
87902 - apndFileControl, /* xFileControl */
87903 - apndSectorSize, /* xSectorSize */
87904 - apndDeviceCharacteristics, /* xDeviceCharacteristics */
87905 - apndShmMap, /* xShmMap */
87906 - apndShmLock, /* xShmLock */
87907 - apndShmBarrier, /* xShmBarrier */
87908 - apndShmUnmap, /* xShmUnmap */
87909 - apndFetch, /* xFetch */
87910 - apndUnfetch /* xUnfetch */
87911 -};
87914 + *pRowid = pCur->iRowid;
87919 -** Close an apnd-file.
87923 -static int apndClose(sqlite3_file *pFile){
87924 - pFile = ORIGFILE(pFile);
87925 - return pFile->pMethods->xClose(pFile);
87928 + if( pCur->isDesc ){
87929 + return pCur->iValue < pCur->mnValue;
87931 + return pCur->iValue > pCur->mxValue;
87935 -/*
87936 -** Read data from an apnd-file.
87937 +/* True to cause run-time checking of the start=, stop=, and/or step=
87941 -static int apndRead(
87942 - sqlite3_file *pFile,
87943 - void *zBuf,
87944 - int iAmt,
87945 - sqlite_int64 iOfst
87946 -){
87947 - ApndFile *paf = (ApndFile *)pFile;
87948 - pFile = ORIGFILE(pFile);
87949 - return pFile->pMethods->xRead(pFile, zBuf, iAmt, paf->iPgOne+iOfst);
87950 -}
87956 -** Add the append-mark onto what should become the end of the file.
87957 -* If and only if this succeeds, internal ApndFile.iMark is updated.
87958 -* Parameter iWriteEnd is the appendvfs-relative offset of the new mark.
87980 -static int apndWriteMark(
87981 - ApndFile *paf,
87982 - sqlite3_file *pFile,
87983 - sqlite_int64 iWriteEnd
87989 - sqlite_int64 iPgOne = paf->iPgOne;
87990 - unsigned char a[APND_MARK_SIZE];
87991 - int i = APND_MARK_FOS_SZ;
87992 - int rc;
87993 - assert(pFile == ORIGFILE(paf));
87994 - memcpy(a, APND_MARK_PREFIX, APND_MARK_PREFIX_SZ);
87995 - while( --i >= 0 ){
87996 - a[APND_MARK_PREFIX_SZ+i] = (unsigned char)(iPgOne & 0xff);
87997 - iPgOne >>= 8;
88002 + pCur->mnValue = sqlite3_value_int64(argv[i++]);
88004 + pCur->mnValue = 0;
88006 - iWriteEnd += paf->iPgOne;
88007 - if( SQLITE_OK==(rc = pFile->pMethods->xWrite
88008 - (pFile, a, APND_MARK_SIZE, iWriteEnd)) ){
88009 - paf->iMark = iWriteEnd;
88011 + pCur->mxValue = sqlite3_value_int64(argv[i++]);
88013 + pCur->mxValue = 0xffffffff;
88015 - return rc;
88016 -}
88017 -
88018 -/*
88019 -** Write data to an apnd-file.
88020 -*/
88021 -static int apndWrite(
88022 - sqlite3_file *pFile,
88023 - const void *zBuf,
88024 - int iAmt,
88025 - sqlite_int64 iOfst
88026 -){
88027 - ApndFile *paf = (ApndFile *)pFile;
88028 - sqlite_int64 iWriteEnd = iOfst + iAmt;
88029 - if( iWriteEnd>=APND_MAX_SIZE ) return SQLITE_FULL;
88030 - pFile = ORIGFILE(pFile);
88031 - /* If append-mark is absent or will be overwritten, write it. */
88032 - if( paf->iMark < 0 || paf->iPgOne + iWriteEnd > paf->iMark ){
88033 - int rc = apndWriteMark(paf, pFile, iWriteEnd);
88034 - if( SQLITE_OK!=rc ) return rc;
88036 + pCur->iStep = sqlite3_value_int64(argv[i++]);
88037 + if( pCur->iStep==0 ){
88038 + pCur->iStep = 1;
88039 + }else if( pCur->iStep<0 ){
88040 + pCur->iStep = -pCur->iStep;
88044 + pCur->iStep = 1;
88046 - return pFile->pMethods->xWrite(pFile, zBuf, iAmt, paf->iPgOne+iOfst);
88051 + pCur->mnValue = 1;
88052 + pCur->mxValue = 0;
88057 + pCur->isDesc = 1;
88058 + pCur->iValue = pCur->mxValue;
88059 + if( pCur->iStep>0 ){
88060 + pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep;
88063 + pCur->isDesc = 0;
88064 + pCur->iValue = pCur->mnValue;
88066 + pCur->iRowid = 1;
88071 -** Truncate an apnd-file.
88082 +** (1) start = $value -- constraint exists
88083 +** (2) stop = $value -- constraint exists
88084 +** (4) step = $value -- constraint exists
88087 -static int apndTruncate(sqlite3_file *pFile, sqlite_int64 size){
88088 - ApndFile *paf = (ApndFile *)pFile;
88089 - pFile = ORIGFILE(pFile);
88090 - /* The append mark goes out first so truncate failure does not lose it. */
88091 - if( SQLITE_OK!=apndWriteMark(paf, pFile, size) ) return SQLITE_IOERR;
88092 - /* Truncate underlying file just past append mark */
88093 - return pFile->pMethods->xTruncate(pFile, paf->iMark+APND_MARK_SIZE);
88094 -}
88107 -/*
88108 -** Sync an apnd-file.
88109 -*/
88110 -static int apndSync(sqlite3_file *pFile, int flags){
88111 - pFile = ORIGFILE(pFile);
88112 - return pFile->pMethods->xSync(pFile, flags);
88113 -}
88119 -/*
88120 -** Return the current file-size of an apnd-file.
88121 -** If the append mark is not yet there, the file-size is 0.
88122 -*/
88123 -static int apndFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){
88124 - ApndFile *paf = (ApndFile *)pFile;
88125 - *pSize = ( paf->iMark >= 0 )? (paf->iMark - paf->iPgOne) : 0;
88126 - return SQLITE_OK;
88127 + aIdx[0] = aIdx[1] = aIdx[2] = -1;
88128 + pConstraint = pIdxInfo->aConstraint;
88129 + for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
88132 + if( pConstraint->iColumn<SERIES_COLUMN_START ) continue;
88133 + iCol = pConstraint->iColumn - SERIES_COLUMN_START;
88137 + if( pConstraint->usable==0 ){
88140 + }else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
88147 + pIdxInfo->aConstraintUsage[j].argvIndex = ++nArg;
88148 + pIdxInfo->aConstraintUsage[j].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY;
88153 + ** first argument was omitted. Compile with -DZERO_ARGUMENT_GENERATE_SERIES
88157 + sqlite3_free(pVTab->zErrMsg);
88158 + pVTab->zErrMsg = sqlite3_mprintf(
88172 + pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
88173 + pIdxInfo->estimatedRows = 1000;
88174 + if( pIdxInfo->nOrderBy>=1 && pIdxInfo->aOrderBy[0].iColumn==0 ){
88175 + if( pIdxInfo->aOrderBy[0].desc ){
88180 + pIdxInfo->orderByConsumed = 1;
88186 + pIdxInfo->estimatedRows = 2147483647;
88188 + pIdxInfo->idxNum = idxNum;
88193 -** Lock an apnd-file.
88197 -static int apndLock(sqlite3_file *pFile, int eLock){
88198 - pFile = ORIGFILE(pFile);
88199 - return pFile->pMethods->xLock(pFile, eLock);
88200 -}
88208 + seriesOpen, /* xOpen - open a cursor */
88209 + seriesClose, /* xClose - close a cursor */
88210 + seriesFilter, /* xFilter - configure scan constraints */
88211 + seriesNext, /* xNext - advance a cursor */
88212 + seriesEof, /* xEof - check for end of scan */
88213 + seriesColumn, /* xColumn - read data */
88214 + seriesRowid, /* xRowid - read data */
88228 -/*
88229 -** Unlock an apnd-file.
88230 -*/
88231 -static int apndUnlock(sqlite3_file *pFile, int eLock){
88232 - pFile = ORIGFILE(pFile);
88233 - return pFile->pMethods->xUnlock(pFile, eLock);
88234 -}
88237 -/*
88238 -** Check if another file-handle holds a RESERVED lock on an apnd-file.
88239 -*/
88240 -static int apndCheckReservedLock(sqlite3_file *pFile, int *pResOut){
88241 - pFile = ORIGFILE(pFile);
88242 - return pFile->pMethods->xCheckReservedLock(pFile, pResOut);
88243 -}
88246 -/*
88247 -** File control method. For custom operations on an apnd-file.
88248 -*/
88249 -static int apndFileControl(sqlite3_file *pFile, int op, void *pArg){
88250 - ApndFile *paf = (ApndFile *)pFile;
88251 - int rc;
88252 - pFile = ORIGFILE(pFile);
88253 - if( op==SQLITE_FCNTL_SIZE_HINT ) *(sqlite3_int64*)pArg += paf->iPgOne;
88254 - rc = pFile->pMethods->xFileControl(pFile, op, pArg);
88255 - if( rc==SQLITE_OK && op==SQLITE_FCNTL_VFSNAME ){
88256 - *(char**)pArg = sqlite3_mprintf("apnd(%lld)/%z", paf->iPgOne,*(char**)pArg);
88259 + sqlite3 *db,
88271 + rc = sqlite3_create_module(db, "generate_series", &seriesModule, 0);
88279 -** Return the sector-size in bytes for an apnd-file.
88280 +** 2012-11-13
88292 +** efficient regular-expression matcher for posix extended regular
88314 +** \c C-language escapes for c in afnrtv. ex: \t or \n
88319 +** [a-z] Any single character in the range a-z
88320 +** [^a-z] Any single character not in the range a-z
88322 +** \w Word character. [A-Za-z0-9_]
88323 +** \W Non-word character
88325 +** \D Non-digit
88327 +** \S Non-whitespace character
88333 +** to p copies of X following by q-p copies of X? and that the size of the
88337 -static int apndSectorSize(sqlite3_file *pFile){
88338 - pFile = ORIGFILE(pFile);
88339 - return pFile->pMethods->xSectorSize(pFile);
88340 -}
88347 -** Return the device characteristic flags supported by an apnd-file.
88349 +** this file to prevent name collisions with C-library functions of the
88352 -static int apndDeviceCharacteristics(sqlite3_file *pFile){
88353 - pFile = ORIGFILE(pFile);
88354 - return pFile->pMethods->xDeviceCharacteristics(pFile);
88355 -}
88360 -/* Create a shared memory file mapping */
88361 -static int apndShmMap(
88362 - sqlite3_file *pFile,
88363 - int iPg,
88364 - int pgsz,
88365 - int bExtend,
88366 - void volatile **pp
88367 -){
88368 - pFile = ORIGFILE(pFile);
88369 - return pFile->pMethods->xShmMap(pFile,iPg,pgsz,bExtend,pp);
88370 -}
88371 +/* The end-of-input character */
88374 -/* Perform locking on a shared-memory segment */
88375 -static int apndShmLock(sqlite3_file *pFile, int offset, int n, int flags){
88376 - pFile = ORIGFILE(pFile);
88377 - return pFile->pMethods->xShmLock(pFile,offset,n,flags);
88378 -}
88392 +#define RE_OP_WORD 11 /* Perl word character [A-Za-z0-9_] */
88394 +#define RE_OP_DIGIT 13 /* digit: [0-9] */
88398 +#define RE_OP_BOUNDARY 17 /* Boundary between word and non-word */
88400 -/* Memory barrier operation on shared memory */
88401 -static void apndShmBarrier(sqlite3_file *pFile){
88402 - pFile = ORIGFILE(pFile);
88403 - pFile->pMethods->xShmBarrier(pFile);
88404 -}
88408 -/* Unmap a shared memory segment */
88409 -static int apndShmUnmap(sqlite3_file *pFile, int deleteFlag){
88410 - pFile = ORIGFILE(pFile);
88411 - return pFile->pMethods->xShmUnmap(pFile,deleteFlag);
88450 + for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return;
88451 + pSet->aState[pSet->nState++] = (ReStateNumber)newState;
88454 -/* Fetch a page of a memory-mapped file */
88455 -static int apndFetch(
88456 - sqlite3_file *pFile,
88457 - sqlite3_int64 iOfst,
88458 - int iAmt,
88459 - void **pp
88460 -){
88461 - ApndFile *p = (ApndFile *)pFile;
88462 - if( p->iMark < 0 || iOfst+iAmt > p->iMark ){
88463 - return SQLITE_IOERR; /* Cannot read what is not yet there. */
88471 + if( p->i>=p->mx ) return 0;
88472 + c = p->z[p->i++];
88474 + if( (c&0xe0)==0xc0 && p->i<p->mx && (p->z[p->i]&0xc0)==0x80 ){
88475 + c = (c&0x1f)<<6 | (p->z[p->i++]&0x3f);
88477 + }else if( (c&0xf0)==0xe0 && p->i+1<p->mx && (p->z[p->i]&0xc0)==0x80
88478 + && (p->z[p->i+1]&0xc0)==0x80 ){
88479 + c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f);
88480 + p->i += 2;
88482 + }else if( (c&0xf8)==0xf0 && p->i+3<p->mx && (p->z[p->i]&0xc0)==0x80
88483 + && (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){
88484 + c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6)
88485 + | (p->z[p->i+2]&0x3f);
88486 + p->i += 3;
88492 - pFile = ORIGFILE(pFile);
88493 - return pFile->pMethods->xFetch(pFile, iOfst+p->iPgOne, iAmt, pp);
88498 + if( c>='A' && c<='Z' ) c += 'a' - 'A';
88502 -/* Release a memory-mapped page */
88503 -static int apndUnfetch(sqlite3_file *pFile, sqlite3_int64 iOfst, void *pPage){
88504 - ApndFile *p = (ApndFile *)pFile;
88505 - pFile = ORIGFILE(pFile);
88506 - return pFile->pMethods->xUnfetch(pFile, iOfst+p->iPgOne, pPage);
88507 +/* Return true if c is a perl "word" character: [A-Za-z0-9_] */
88513 -/*
88514 -** Try to read the append-mark off the end of a file. Return the
88515 -** start of the appended database if the append-mark is present.
88516 -** If there is no valid append-mark, return -1;
88517 -**
88518 -** An append-mark is only valid if the NNNNNNNN start-of-database offset
88519 -** indicates that the appended database contains at least one page. The
88520 -** start-of-database value must be a multiple of 512.
88521 -*/
88522 -static sqlite3_int64 apndReadMark(sqlite3_int64 sz, sqlite3_file *pFile){
88523 - int rc, i;
88524 - sqlite3_int64 iMark;
88525 - int msbs = 8 * (APND_MARK_FOS_SZ-1);
88526 - unsigned char a[APND_MARK_SIZE];
88527 +/* Return true if c is a "digit" character: [0-9] */
88532 - if( APND_MARK_SIZE!=(sz & 0x1ff) ) return -1;
88533 - rc = pFile->pMethods->xRead(pFile, a, APND_MARK_SIZE, sz-APND_MARK_SIZE);
88534 - if( rc ) return -1;
88535 - if( memcmp(a, APND_MARK_PREFIX, APND_MARK_PREFIX_SZ)!=0 ) return -1;
88536 - iMark = ((sqlite3_int64)(a[APND_MARK_PREFIX_SZ] & 0x7f)) << msbs;
88537 - for(i=1; i<8; i++){
88538 - msbs -= 8;
88539 - iMark |= (sqlite3_int64)a[APND_MARK_PREFIX_SZ+i]<<msbs;
88540 - }
88541 - if( iMark > (sz - APND_MARK_SIZE - 512) ) return -1;
88542 - if( iMark & 0x1ff ) return -1;
88543 - return iMark;
88549 -static const char apvfsSqliteHdr[] = "SQLite format 3";
88550 -/*
88551 -** Check to see if the file is an appendvfs SQLite database file.
88552 -** Return true iff it is such. Parameter sz is the file's size.
88553 +/* Run a compiled regular expression on the zero-terminated input
88556 -static int apndIsAppendvfsDatabase(sqlite3_int64 sz, sqlite3_file *pFile){
88557 - int rc;
88558 - char zHdr[16];
88559 - sqlite3_int64 iMark = apndReadMark(sz, pFile);
88560 - if( iMark>=0 ){
88561 - /* If file has the correct end-marker, the expected odd size, and the
88562 - ** SQLite DB type marker where the end-marker puts it, then it
88563 - ** is an appendvfs database.
88564 - */
88565 - rc = pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), iMark);
88566 - if( SQLITE_OK==rc
88567 - && memcmp(zHdr, apvfsSqliteHdr, sizeof(zHdr))==0
88568 - && (sz & 0x1ff) == APND_MARK_SIZE
88569 - && sz>=512+APND_MARK_SIZE
88586 + if( pRe->nInit ){
88587 + unsigned char x = pRe->zInit[0];
88588 + while( in.i+pRe->nInit<=in.mx
88590 + strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0)
88592 - return 1; /* It's an appendvfs database */
88595 + if( in.i+pRe->nInit>in.mx ) return 0;
88598 + if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
88602 + pToFree = sqlite3_malloc64( sizeof(ReStateNumber)*2*pRe->nState );
88603 + if( pToFree==0 ) return -1;
88606 + aStateSet[1].aState = &aStateSet[0].aState[pRe->nState];
88608 + pNext->nState = 0;
88610 + while( c!=RE_EOF && pNext->nState>0 ){
88612 + c = pRe->xNextChar(&in);
88615 + iSwap = 1 - iSwap;
88616 + pNext->nState = 0;
88617 + for(i=0; i<pThis->nState; i++){
88618 + int x = pThis->aState[i];
88619 + switch( pRe->aOp[x] ){
88621 + if( pRe->aArg[x]==c ) re_add_state(pNext, x+1);
88662 + re_add_state(pThis, x+pRe->aArg[x]);
88667 + re_add_state(pThis, x+pRe->aArg[x]);
88676 + /* fall-through */ goto re_op_cc_inc;
88680 + int n = pRe->aArg[x];
88683 + if( pRe->aOp[x+j]==RE_OP_CC_VALUE ){
88684 + if( pRe->aArg[x+j]==c ){
88686 + j = -1;
88689 + if( pRe->aArg[x+j]<=c && pRe->aArg[x+j+1]>=c ){
88691 + j = -1;
88697 + if( pRe->aOp[x]==RE_OP_CC_EXC ) hit = !hit;
88704 + for(i=0; i<pNext->nState; i++){
88705 + if( pRe->aOp[pNext->aState[i]]==RE_OP_ACCEPT ){ rc = 1; break; }
88717 + aOp = sqlite3_realloc64(p->aOp, N*sizeof(p->aOp[0]));
88719 + p->aOp = aOp;
88720 + aArg = sqlite3_realloc64(p->aArg, N*sizeof(p->aArg[0]));
88722 + p->aArg = aArg;
88723 + p->nAlloc = N;
88732 + if( p->nAlloc<=p->nState && re_resize(p, p->nAlloc*2) ) return 0;
88733 + for(i=p->nState; i>iBefore; i--){
88734 + p->aOp[i] = p->aOp[i-1];
88735 + p->aArg[i] = p->aArg[i-1];
88737 + p->nState++;
88738 + p->aOp[iBefore] = (char)op;
88739 + p->aArg[iBefore] = arg;
88746 + return re_insert(p, p->nState, op, arg);
88753 + if( p->nState+N>=p->nAlloc && re_resize(p, p->nAlloc*2+N) ) return;
88754 + memcpy(&p->aOp[p->nState], &p->aOp[iStart], N*sizeof(p->aOp[0]));
88755 + memcpy(&p->aArg[p->nState], &p->aArg[iStart], N*sizeof(p->aArg[0]));
88756 + p->nState += N;
88759 +/* Return true if c is a hexadecimal digit character: [0-9a-fA-F]
88765 + c -= '0';
88767 + c -= 'a' - 10;
88769 + c -= 'A' - 10;
88785 + if( p->sIn.i>=p->sIn.mx ) return 0;
88786 + c = p->sIn.z[p->sIn.i];
88787 + if( c=='u' && p->sIn.i+4<p->sIn.mx ){
88788 + const unsigned char *zIn = p->sIn.z + p->sIn.i;
88794 + p->sIn.i += 5;
88798 + if( c=='x' && p->sIn.i+2<p->sIn.mx ){
88799 + const unsigned char *zIn = p->sIn.z + p->sIn.i;
88803 + p->sIn.i += 3;
88810 + p->sIn.i++;
88812 + p->zErr = "unknown \\ escape";
88822 + return p->sIn.i<p->sIn.mx ? p->sIn.z[p->sIn.i] : 0;
88832 + iStart = p->nState;
88836 + iEnd = p->nState;
88837 + re_insert(p, iStart, RE_OP_FORK, iEnd + 2 - iStart);
88839 + p->sIn.i++;
88842 + p->aArg[iGoto] = p->nState - iGoto;
88852 + int iPrev = -1;
88856 + while( (c = p->xNextChar(&p->sIn))!=0 ){
88857 + iStart = p->nState;
88862 + p->sIn.i--;
88869 + p->sIn.i++;
88875 + p->sIn.i++;
88883 + re_insert(p, iPrev, RE_OP_GOTO, p->nState - iPrev + 1);
88884 + re_append(p, RE_OP_FORK, iPrev - p->nState + 1);
88889 + re_append(p, RE_OP_FORK, iPrev - p->nState);
88894 + re_insert(p, iPrev, RE_OP_FORK, p->nState - iPrev+1);
88901 + while( (c=rePeek(p))>='0' && c<='9' ){ m = m*10 + c - '0'; p->sIn.i++; }
88904 + p->sIn.i++;
88906 + while( (c=rePeek(p))>='0' && c<='9' ){ n = n*10 + c-'0'; p->sIn.i++; }
88910 + p->sIn.i++;
88911 + sz = p->nState - iPrev;
88915 + n--;
88924 + re_append(p, RE_OP_FORK, -sz);
88929 + int iFirst = p->nState;
88932 + p->sIn.i++;
88936 + while( (c = p->xNextChar(&p->sIn))!=0 ){
88941 + if( rePeek(p)=='-' ){
88943 + p->sIn.i++;
88944 + c = p->xNextChar(&p->sIn);
88950 + if( rePeek(p)==']' ){ p->sIn.i++; break; }
88953 + p->aArg[iFirst] = p->nState - iFirst;
88968 + p->sIn.i++;
88986 -/*
88987 -** Check to see if the file is an ordinary SQLite database file.
88988 -** Return true iff so. Parameter sz is the file's size.
88993 -static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){
88994 - char zHdr[16];
88995 - if( apndIsAppendvfsDatabase(sz, pFile) /* rule 2 */
88996 - || (sz & 0x1ff) != 0
88997 - || SQLITE_OK!=pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0)
88998 - || memcmp(zHdr, apvfsSqliteHdr, sizeof(zHdr))!=0
88999 - ){
89000 - return 0;
89001 - }else{
89002 - return 1;
89005 + sqlite3_free(pRe->aOp);
89006 + sqlite3_free(pRe->aArg);
89012 -** Open an apnd file handle.
89018 -static int apndOpen(
89019 - sqlite3_vfs *pApndVfs,
89020 - const char *zName,
89021 - sqlite3_file *pFile,
89022 - int flags,
89023 - int *pOutFlags
89024 -){
89025 - ApndFile *pApndFile = (ApndFile*)pFile;
89026 - sqlite3_file *pBaseFile = ORIGFILE(pFile);
89027 - sqlite3_vfs *pBaseVfs = ORIGVFS(pApndVfs);
89028 - int rc;
89029 - sqlite3_int64 sz = 0;
89030 - if( (flags & SQLITE_OPEN_MAIN_DB)==0 ){
89031 - /* The appendvfs is not to be used for transient or temporary databases.
89032 - ** Just use the base VFS open to initialize the given file object and
89033 - ** open the underlying file. (Appendvfs is then unused for this file.)
89034 - */
89035 - return pBaseVfs->xOpen(pBaseVfs, zName, pFile, flags, pOutFlags);
89036 - }
89037 - memset(pApndFile, 0, sizeof(ApndFile));
89038 - pFile->pMethods = &apnd_io_methods;
89039 - pApndFile->iMark = -1; /* Append mark not yet written */
89045 - rc = pBaseVfs->xOpen(pBaseVfs, zName, pBaseFile, flags, pOutFlags);
89046 - if( rc==SQLITE_OK ){
89047 - rc = pBaseFile->pMethods->xFileSize(pBaseFile, &sz);
89048 - if( rc ){
89049 - pBaseFile->pMethods->xClose(pBaseFile);
89050 - }
89056 - if( rc ){
89057 - pFile->pMethods = 0;
89058 - return rc;
89060 + pRe->xNextChar = noCase ? re_next_char_nocase : re_next_char;
89065 - if( apndIsOrdinaryDatabaseFile(sz, pBaseFile) ){
89066 - /* The file being opened appears to be just an ordinary DB. Copy
89067 - ** the base dispatch-table so this instance mimics the base VFS.
89068 - */
89069 - memmove(pApndFile, pBaseFile, pBaseVfs->szOsFile);
89070 - return SQLITE_OK;
89076 - pApndFile->iPgOne = apndReadMark(sz, pFile);
89077 - if( pApndFile->iPgOne>=0 ){
89078 - pApndFile->iMark = sz - APND_MARK_SIZE; /* Append mark found */
89079 - return SQLITE_OK;
89080 + pRe->sIn.z = (unsigned char*)zIn;
89081 + pRe->sIn.i = 0;
89082 + pRe->sIn.mx = (int)strlen(zIn);
89088 - if( (flags & SQLITE_OPEN_CREATE)==0 ){
89089 - pBaseFile->pMethods->xClose(pBaseFile);
89090 - rc = SQLITE_CANTOPEN;
89091 - pFile->pMethods = 0;
89092 + if( rePeek(pRe)=='$' && pRe->sIn.i+1>=pRe->sIn.mx ){
89096 + }else if( pRe->sIn.i>=pRe->sIn.mx ){
89100 - /* Round newly added appendvfs location to #define'd page boundary.
89101 - ** Note that nothing has yet been written to the underlying file.
89102 - ** The append mark will be written along with first content write.
89103 - ** Until then, paf->iMark value indicates it is not yet written.
89104 - */
89105 - pApndFile->iPgOne = APND_START_ROUNDUP(sz);
89109 - return rc;
89110 -}
89112 -/*
89113 -** Delete an apnd file.
89114 -** For an appendvfs, this could mean delete the appendvfs portion,
89115 -** leaving the appendee as it was before it gained an appendvfs.
89116 -** For now, this code deletes the underlying file too.
89117 -*/
89118 -static int apndDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
89119 - return ORIGVFS(pVfs)->xDelete(ORIGVFS(pVfs), zPath, dirSync);
89126 + ** unicode characters beyond plane 0 - those are very rare and this is
89128 + if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
89129 + for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
89130 + unsigned x = pRe->aArg[i];
89132 + pRe->zInit[j++] = (unsigned char)x;
89134 + pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
89135 + pRe->zInit[j++] = 0x80 | (x&0x3f);
89137 + pRe->zInit[j++] = (unsigned char)(0xe0 | (x>>12));
89138 + pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
89139 + pRe->zInit[j++] = 0x80 | (x&0x3f);
89144 + if( j>0 && pRe->zInit[j-1]==0 ) j--;
89145 + pRe->nInit = j;
89147 + return pRe->zErr;
89151 -** All other VFS methods are pass-thrus.
89153 +** the build-in REGEXP operator. The first argument to the function is the
89160 -static int apndAccess(
89161 - sqlite3_vfs *pVfs,
89162 - const char *zPath,
89163 - int flags,
89164 - int *pResOut
89165 -){
89166 - return ORIGVFS(pVfs)->xAccess(ORIGVFS(pVfs), zPath, flags, pResOut);
89167 -}
89168 -static int apndFullPathname(
89169 - sqlite3_vfs *pVfs,
89170 - const char *zPath,
89171 - int nOut,
89172 - char *zOut
89173 -){
89174 - return ORIGVFS(pVfs)->xFullPathname(ORIGVFS(pVfs),zPath,nOut,zOut);
89175 -}
89176 -static void *apndDlOpen(sqlite3_vfs *pVfs, const char *zPath){
89177 - return ORIGVFS(pVfs)->xDlOpen(ORIGVFS(pVfs), zPath);
89178 -}
89179 -static void apndDlError(sqlite3_vfs *pVfs, int nByte, char *zErrMsg){
89180 - ORIGVFS(pVfs)->xDlError(ORIGVFS(pVfs), nByte, zErrMsg);
89181 -}
89182 -static void (*apndDlSym(sqlite3_vfs *pVfs, void *p, const char *zSym))(void){
89183 - return ORIGVFS(pVfs)->xDlSym(ORIGVFS(pVfs), p, zSym);
89184 -}
89185 -static void apndDlClose(sqlite3_vfs *pVfs, void *pHandle){
89186 - ORIGVFS(pVfs)->xDlClose(ORIGVFS(pVfs), pHandle);
89187 -}
89188 -static int apndRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
89189 - return ORIGVFS(pVfs)->xRandomness(ORIGVFS(pVfs), nByte, zBufOut);
89190 -}
89191 -static int apndSleep(sqlite3_vfs *pVfs, int nMicro){
89192 - return ORIGVFS(pVfs)->xSleep(ORIGVFS(pVfs), nMicro);
89193 -}
89194 -static int apndCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
89195 - return ORIGVFS(pVfs)->xCurrentTime(ORIGVFS(pVfs), pTimeOut);
89196 -}
89197 -static int apndGetLastError(sqlite3_vfs *pVfs, int a, char *b){
89198 - return ORIGVFS(pVfs)->xGetLastError(ORIGVFS(pVfs), a, b);
89199 -}
89200 -static int apndCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *p){
89201 - return ORIGVFS(pVfs)->xCurrentTimeInt64(ORIGVFS(pVfs), p);
89202 -}
89203 -static int apndSetSystemCall(
89204 - sqlite3_vfs *pVfs,
89205 - const char *zName,
89206 - sqlite3_syscall_ptr pCall
89207 -){
89208 - return ORIGVFS(pVfs)->xSetSystemCall(ORIGVFS(pVfs),zName,pCall);
89209 -}
89210 -static sqlite3_syscall_ptr apndGetSystemCall(
89211 - sqlite3_vfs *pVfs,
89212 - const char *zName
89218 - return ORIGVFS(pVfs)->xGetSystemCall(ORIGVFS(pVfs),zName);
89219 -}
89220 -static const char *apndNextSystemCall(sqlite3_vfs *pVfs, const char *zName){
89221 - return ORIGVFS(pVfs)->xNextSystemCall(ORIGVFS(pVfs), zName);
89236 + sqlite3_result_error(context, zErr, -1);
89247 + sqlite3_result_int(context, re_match(pRe, zStr, -1));
89254 -
89262 -/*
89263 -** This routine is called when the extension is loaded.
89264 -** Register the new VFS.
89265 -*/
89266 -int sqlite3_appendvfs_init(
89268 sqlite3 *db,
89273 - sqlite3_vfs *pOrig;
89275 - (void)pzErrMsg;
89276 - (void)db;
89277 - pOrig = sqlite3_vfs_find(0);
89278 - if( pOrig==0 ) return SQLITE_ERROR;
89279 - apnd_vfs.iVersion = pOrig->iVersion;
89280 - apnd_vfs.pAppData = pOrig;
89281 - apnd_vfs.szOsFile = pOrig->szOsFile + sizeof(ApndFile);
89282 - rc = sqlite3_vfs_register(&apnd_vfs, 0);
89283 -#ifdef APPENDVFS_TEST
89285 + rc = sqlite3_create_function(db, "regexp", 2,
89289 - rc = sqlite3_auto_extension((void(*)(void))apndvfsRegister);
89290 + /* The regexpi(PATTERN,STRING) function is a case-insensitive version
89292 + rc = sqlite3_create_function(db, "regexpi", 2,
89294 + (void*)db, re_sql_func, 0, 0);
89296 -#endif
89297 - if( rc==SQLITE_OK ) rc = SQLITE_OK_LOAD_PERMANENTLY;
89301 -/************************* End ../ext/misc/appendvfs.c ********************/
89302 -/************************* Begin ../ext/misc/memtrace.c ******************/
89307 -** 2019-01-21
89308 +** 2014-06-13
89312 @@ -4370,1138 +4509,1031 @@ int sqlite3_appendvfs_init(
89316 -*************************************************************************
89317 -**
89318 -** This file implements an extension that uses the SQLITE_CONFIG_MALLOC
89319 -** mechanism to add a tracing layer on top of SQLite. If this extension
89320 -** is registered prior to sqlite3_initialize(), it will cause all memory
89321 -** allocation activities to be logged on standard output, or to some other
89322 -** FILE specified by the initializer.
89323 -**
89324 -** This file needs to be compiled into the application that uses it.
89325 -**
89326 -** This extension is used to implement the --memtrace option of the
89327 -** command-line shell.
89328 -*/
89329 -#include <assert.h>
89330 -#include <string.h>
89331 -#include <stdio.h>
89332 -
89333 -/* The original memory allocation routines */
89334 -static sqlite3_mem_methods memtraceBase;
89335 -static FILE *memtraceOut;
89336 -
89337 -/* Methods that trace memory allocations */
89338 -static void *memtraceMalloc(int n){
89339 - if( memtraceOut ){
89340 - fprintf(memtraceOut, "MEMTRACE: allocate %d bytes\n",
89341 - memtraceBase.xRoundup(n));
89342 - }
89343 - return memtraceBase.xMalloc(n);
89344 -}
89345 -static void memtraceFree(void *p){
89346 - if( p==0 ) return;
89347 - if( memtraceOut ){
89348 - fprintf(memtraceOut, "MEMTRACE: free %d bytes\n", memtraceBase.xSize(p));
89349 - }
89350 - memtraceBase.xFree(p);
89351 -}
89352 -static void *memtraceRealloc(void *p, int n){
89353 - if( p==0 ) return memtraceMalloc(n);
89354 - if( n==0 ){
89355 - memtraceFree(p);
89356 - return 0;
89357 - }
89358 - if( memtraceOut ){
89359 - fprintf(memtraceOut, "MEMTRACE: resize %d -> %d bytes\n",
89360 - memtraceBase.xSize(p), memtraceBase.xRoundup(n));
89361 - }
89362 - return memtraceBase.xRealloc(p, n);
89363 -}
89364 -static int memtraceSize(void *p){
89365 - return memtraceBase.xSize(p);
89366 -}
89367 -static int memtraceRoundup(int n){
89368 - return memtraceBase.xRoundup(n);
89369 -}
89370 -static int memtraceInit(void *p){
89371 - return memtraceBase.xInit(p);
89372 -}
89373 -static void memtraceShutdown(void *p){
89374 - memtraceBase.xShutdown(p);
89375 -}
89376 -
89377 -/* The substitute memory allocator */
89378 -static sqlite3_mem_methods ersaztMethods = {
89379 - memtraceMalloc,
89380 - memtraceFree,
89381 - memtraceRealloc,
89382 - memtraceSize,
89383 - memtraceRoundup,
89384 - memtraceInit,
89385 - memtraceShutdown,
89386 - 0
89387 -};
89388 -
89389 -/* Begin tracing memory allocations to out. */
89390 -int sqlite3MemTraceActivate(FILE *out){
89391 - int rc = SQLITE_OK;
89392 - if( memtraceBase.xMalloc==0 ){
89393 - rc = sqlite3_config(SQLITE_CONFIG_GETMALLOC, &memtraceBase);
89394 - if( rc==SQLITE_OK ){
89395 - rc = sqlite3_config(SQLITE_CONFIG_MALLOC, &ersaztMethods);
89396 - }
89397 - }
89398 - memtraceOut = out;
89399 - return rc;
89400 -}
89401 -
89402 -/* Deactivate memory tracing */
89403 -int sqlite3MemTraceDeactivate(void){
89404 - int rc = SQLITE_OK;
89405 - if( memtraceBase.xMalloc!=0 ){
89406 - rc = sqlite3_config(SQLITE_CONFIG_MALLOC, &memtraceBase);
89407 - if( rc==SQLITE_OK ){
89408 - memset(&memtraceBase, 0, sizeof(memtraceBase));
89409 - }
89410 - }
89411 - memtraceOut = 0;
89412 - return rc;
89413 -}
89414 -
89415 -/************************* End ../ext/misc/memtrace.c ********************/
89416 -/************************* Begin ../ext/misc/uint.c ******************/
89417 -/*
89418 -** 2020-04-14
89421 -** The author disclaims copyright to this source code. In place of
89422 -** a legal notice, here is a blessing:
89426 -** May you do good and not evil.
89427 -** May you find forgiveness for yourself and forgive others.
89428 -** May you share freely, never taking more than you give.
89431 -******************************************************************************
89436 -** This SQLite extension implements the UINT collating sequence.
89437 +** If the first option argument - MODE - is present, then it must
89443 -** UINT works like BINARY for text, except that embedded strings
89444 -** of digits compare in numeric order.
89449 -** * Leading zeros are handled properly, in the sense that
89450 -** they do not mess of the maginitude comparison of embedded
89451 -** strings of digits. "x00123y" is equal to "x123y".
89458 -** * Only unsigned integers are recognized. Plus and minus
89459 -** signs are ignored. Decimal points and exponential notation
89460 -** are ignored.
89462 +** as an integer - the number of seconds since the unix epoch. The
89463 +** modification-time of the target file is set to this value before
89466 -** * Embedded integers can be of arbitrary length. Comparison
89467 -** is *not* limited integers that can be expressed as a
89468 -** 64-bit machine integer.
89469 -*/
89470 -/* #include "sqlite3ext.h" */
89471 -SQLITE_EXTENSION_INIT1
89472 -#include <assert.h>
89473 -#include <string.h>
89474 -#include <ctype.h>
89475 -
89476 -/*
89477 -** Compare text in lexicographic order, except strings of digits
89478 -** compare in numeric order.
89479 -*/
89480 -static int uintCollFunc(
89481 - void *notUsed,
89482 - int nKey1, const void *pKey1,
89483 - int nKey2, const void *pKey2
89484 -){
89485 - const unsigned char *zA = (const unsigned char*)pKey1;
89486 - const unsigned char *zB = (const unsigned char*)pKey2;
89487 - int i=0, j=0, x;
89488 - (void)notUsed;
89489 - while( i<nKey1 && j<nKey2 ){
89490 - x = zA[i] - zB[j];
89491 - if( isdigit(zA[i]) ){
89492 - int k;
89493 - if( !isdigit(zB[j]) ) return x;
89494 - while( i<nKey1 && zA[i]=='0' ){ i++; }
89495 - while( j<nKey2 && zB[j]=='0' ){ j++; }
89496 - k = 0;
89497 - while( i+k<nKey1 && isdigit(zA[i+k])
89498 - && j+k<nKey2 && isdigit(zB[j+k]) ){
89499 - k++;
89500 - }
89501 - if( i+k<nKey1 && isdigit(zA[i+k]) ){
89502 - return +1;
89503 - }else if( j+k<nKey2 && isdigit(zB[j+k]) ){
89504 - return -1;
89505 - }else{
89506 - x = memcmp(zA+i, zB+j, k);
89507 - if( x ) return x;
89508 - i += k;
89509 - j += k;
89510 - }
89511 - }else if( x ){
89512 - return x;
89513 - }else{
89514 - i++;
89515 - j++;
89516 - }
89517 - }
89518 - return (nKey1 - i) - (nKey2 - j);
89519 -}
89520 -
89521 -#ifdef _WIN32
89522 -
89523 -#endif
89524 -int sqlite3_uint_init(
89525 - sqlite3 *db,
89526 - char **pzErrMsg,
89527 - const sqlite3_api_routines *pApi
89528 -){
89529 - SQLITE_EXTENSION_INIT2(pApi);
89530 - (void)pzErrMsg; /* Unused parameter */
89531 - return sqlite3_create_collation(db, "uint", SQLITE_UTF8, 0, uintCollFunc);
89532 -}
89533 -
89534 -/************************* End ../ext/misc/uint.c ********************/
89535 -/************************* Begin ../ext/misc/decimal.c ******************/
89536 -/*
89537 -** 2020-06-22
89541 -** The author disclaims copyright to this source code. In place of
89542 -** a legal notice, here is a blessing:
89545 -** May you do good and not evil.
89546 -** May you find forgiveness for yourself and forgive others.
89547 -** May you share freely, never taking more than you give.
89550 -******************************************************************************
89553 -** Routines to implement arbitrary-precision decimal math.
89556 -** The focus here is on simplicity and correctness, not performance.
89574 +** If a non-NULL value is specified for the optional $dir parameter and
89581 +** symbol, FILEIO_WIN32_DLL, must be #define'd to create a stand-alone
89586 -#include <assert.h>
89589 -#include <ctype.h>
89590 -#include <stdlib.h>
89593 -/* Mark a function parameter as unused, to suppress nuisance compiler
89594 -** warnings. */
89595 -#ifndef UNUSED_PARAMETER
89596 -# define UNUSED_PARAMETER(X) (void)(X)
89624 -/* A decimal object */
89625 -typedef struct Decimal Decimal;
89626 -struct Decimal {
89627 - char sign; /* 0 for positive, 1 for negative */
89628 - char oom; /* True if an OOM is encountered */
89629 - char isNull; /* True if holds a NULL rather than a number */
89630 - char isInit; /* True upon initialization */
89631 - int nDigit; /* Total number of digits */
89632 - int nFrac; /* Number of digits to the right of the decimal point */
89633 - signed char *a; /* Array of digits. Most significant first. */
89634 -};
89635 -
89637 -** Release memory held by a Decimal, but do not free the object itself.
89638 +** Structure of the fsdir() table-valued function
89640 -static void decimal_clear(Decimal *p){
89641 - sqlite3_free(p->a);
89642 -}
89652 -/*
89653 -** Destroy a Decimal object
89654 -*/
89655 -static void decimal_free(Decimal *p){
89656 - if( p ){
89657 - decimal_clear(p);
89658 - sqlite3_free(p);
89659 - }
89660 -}
89663 -** Allocate a new Decimal object. Initialize it to the number given
89664 -** by the input string.
89675 -static Decimal *decimal_new(
89676 - sqlite3_context *pCtx,
89677 - sqlite3_value *pIn,
89678 - int nAlt,
89679 - const unsigned char *zAlt
89680 -){
89681 - Decimal *p;
89682 - int n, i;
89683 - const unsigned char *zIn;
89684 - int iExp = 0;
89685 - p = sqlite3_malloc( sizeof(*p) );
89686 - if( p==0 ) goto new_no_mem;
89687 - p->sign = 0;
89688 - p->oom = 0;
89689 - p->isInit = 1;
89690 - p->isNull = 0;
89691 - p->nDigit = 0;
89692 - p->nFrac = 0;
89693 - if( zAlt ){
89694 - n = nAlt,
89695 - zIn = zAlt;
89696 - }else{
89697 - if( sqlite3_value_type(pIn)==SQLITE_NULL ){
89698 - p->a = 0;
89699 - p->isNull = 1;
89700 - return p;
89701 - }
89702 - n = sqlite3_value_bytes(pIn);
89703 - zIn = sqlite3_value_text(pIn);
89704 - }
89705 - p->a = sqlite3_malloc64( n+1 );
89706 - if( p->a==0 ) goto new_no_mem;
89707 - for(i=0; isspace(zIn[i]); i++){}
89708 - if( zIn[i]=='-' ){
89709 - p->sign = 1;
89710 - i++;
89711 - }else if( zIn[i]=='+' ){
89712 - i++;
89713 - }
89714 - while( i<n && zIn[i]=='0' ) i++;
89715 - while( i<n ){
89716 - char c = zIn[i];
89717 - if( c>='0' && c<='9' ){
89718 - p->a[p->nDigit++] = c - '0';
89719 - }else if( c=='.' ){
89720 - p->nFrac = p->nDigit + 1;
89721 - }else if( c=='e' || c=='E' ){
89722 - int j = i+1;
89723 - int neg = 0;
89724 - if( j>=n ) break;
89725 - if( zIn[j]=='-' ){
89726 - neg = 1;
89727 - j++;
89728 - }else if( zIn[j]=='+' ){
89729 - j++;
89730 - }
89731 - while( j<n && iExp<1000000 ){
89732 - if( zIn[j]>='0' && zIn[j]<='9' ){
89733 - iExp = iExp*10 + zIn[j] - '0';
89734 - }
89735 - j++;
89736 - }
89737 - if( neg ) iExp = -iExp;
89738 - break;
89739 - }
89740 - i++;
89741 - }
89742 - if( p->nFrac ){
89743 - p->nFrac = p->nDigit - (p->nFrac - 1);
89744 - }
89745 - if( iExp>0 ){
89746 - if( p->nFrac>0 ){
89747 - if( iExp<=p->nFrac ){
89748 - p->nFrac -= iExp;
89749 - iExp = 0;
89750 - }else{
89751 - iExp -= p->nFrac;
89752 - p->nFrac = 0;
89753 - }
89754 - }
89755 - if( iExp>0 ){
89756 - p->a = sqlite3_realloc64(p->a, p->nDigit + iExp + 1 );
89757 - if( p->a==0 ) goto new_no_mem;
89758 - memset(p->a+p->nDigit, 0, iExp);
89759 - p->nDigit += iExp;
89760 - }
89761 - }else if( iExp<0 ){
89762 - int nExtra;
89763 - iExp = -iExp;
89764 - nExtra = p->nDigit - p->nFrac - 1;
89765 - if( nExtra ){
89766 - if( nExtra>=iExp ){
89767 - p->nFrac += iExp;
89768 - iExp = 0;
89769 - }else{
89770 - iExp -= nExtra;
89771 - p->nFrac = p->nDigit - 1;
89772 - }
89773 - }
89774 - if( iExp>0 ){
89775 - p->a = sqlite3_realloc64(p->a, p->nDigit + iExp + 1 );
89776 - if( p->a==0 ) goto new_no_mem;
89777 - memmove(p->a+iExp, p->a, p->nDigit);
89778 - memset(p->a, 0, iExp);
89779 - p->nDigit += iExp;
89780 - p->nFrac += iExp;
89781 - }
89782 - }
89783 - return p;
89784 -
89785 -new_no_mem:
89786 - if( pCtx ) sqlite3_result_error_nomem(pCtx);
89787 - sqlite3_free(p);
89788 - return 0;
89789 -}
89794 + sqlite3 *db;
89797 -/*
89798 -** Make the given Decimal the result.
89799 -*/
89800 -static void decimal_result(sqlite3_context *pCtx, Decimal *p){
89801 - char *z;
89802 - int i, j;
89803 - int n;
89804 - if( p==0 || p->oom ){
89805 - sqlite3_result_error_nomem(pCtx);
89811 - if( p->isNull ){
89812 - sqlite3_result_null(pCtx);
89816 + db = sqlite3_context_db_handle(ctx);
89817 + mxBlob = sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1);
89823 - z = sqlite3_malloc( p->nDigit+4 );
89824 - if( z==0 ){
89825 - sqlite3_result_error_nomem(pCtx);
89832 - i = 0;
89833 - if( p->nDigit==0 || (p->nDigit==1 && p->a[0]==0) ){
89834 - p->sign = 0;
89835 - }
89836 - if( p->sign ){
89837 - z[0] = '-';
89838 - i = 1;
89839 - }
89840 - n = p->nDigit - p->nFrac;
89841 - if( n<=0 ){
89842 - z[i++] = '0';
89843 - }
89844 - j = 0;
89845 - while( n>1 && p->a[j]==0 ){
89846 - j++;
89847 - n--;
89848 - }
89849 - while( n>0 ){
89850 - z[i++] = p->a[j] + '0';
89851 - j++;
89852 - n--;
89853 - }
89854 - if( p->nFrac ){
89855 - z[i++] = '.';
89856 - do{
89857 - z[i++] = p->a[j] + '0';
89858 - j++;
89859 - }while( j<p->nDigit );
89866 - z[i] = 0;
89867 - sqlite3_result_text(pCtx, z, i, sqlite3_free);
89872 -** SQL Function: decimal(X)
89873 -**
89874 -** Convert input X into decimal and then back into text
89879 -static void decimalFunc(
89885 - Decimal *p = decimal_new(context, argv[0], 0, 0);
89886 - UNUSED_PARAMETER(argc);
89887 - decimal_result(context, p);
89888 - decimal_free(p);
89897 -** Compare to Decimal objects. Return negative, 0, or positive if the
89898 -** first object is less than, equal to, or greater than the second.
89899 -**
89900 -** Preconditions for this routine:
89901 -**
89902 -** pA!=0
89903 -** pA->isNull==0
89904 -** pB!=0
89905 -** pB->isNull==0
89909 -static int decimal_cmp(const Decimal *pA, const Decimal *pB){
89910 - int nASig, nBSig, rc, n;
89911 - if( pA->sign!=pB->sign ){
89912 - return pA->sign ? -1 : +1;
89913 - }
89914 - if( pA->sign ){
89915 - const Decimal *pTemp = pA;
89916 - pA = pB;
89917 - pB = pTemp;
89918 - }
89919 - nASig = pA->nDigit - pA->nFrac;
89920 - nBSig = pB->nDigit - pB->nFrac;
89921 - if( nASig!=nBSig ){
89922 - return nASig - nBSig;
89923 - }
89924 - n = pA->nDigit;
89925 - if( n>pB->nDigit ) n = pB->nDigit;
89926 - rc = memcmp(pA->a, pB->a, n);
89927 - if( rc==0 ){
89928 - rc = pA->nDigit - pB->nDigit;
89929 - }
89930 - return rc;
89936 + sqlite3_result_error(ctx, zMsg, -1);
89943 -** SQL Function: decimal_cmp(X, Y)
89944 -**
89945 -** Return negative, zero, or positive if X is less then, equal to, or
89946 -** greater than Y.
89948 +** number of seconds since the Unix Epoch (1970-01-01 00:00:00 UTC).
89950 -static void decimalCmpFunc(
89951 - sqlite3_context *context,
89952 - int argc,
89953 - sqlite3_value **argv
89957 - Decimal *pA = 0, *pB = 0;
89958 - int rc;
89964 - UNUSED_PARAMETER(argc);
89965 - pA = decimal_new(context, argv[0], 0, 0);
89966 - if( pA==0 || pA->isNull ) goto cmp_done;
89967 - pB = decimal_new(context, argv[1], 0, 0);
89968 - if( pB==0 || pB->isNull ) goto cmp_done;
89969 - rc = decimal_cmp(pA, pB);
89970 - if( rc<0 ) rc = -1;
89971 - else if( rc>0 ) rc = +1;
89972 - sqlite3_result_int(context, rc);
89973 -cmp_done:
89974 - decimal_free(pA);
89975 - decimal_free(pB);
89984 + fileIntervals.LowPart = pFileTime->dwLowDateTime;
89985 + fileIntervals.HighPart = pFileTime->dwHighDateTime;
89987 + return (fileIntervals.QuadPart - epochIntervals.QuadPart) / 10000000;
89990 -/*
89991 -** Expand the Decimal so that it has a least nDigit digits and nFrac
89992 -** digits to the right of the decimal point.
89993 -*/
89994 -static void decimal_expand(Decimal *p, int nDigit, int nFrac){
89995 - int nAddSig;
89996 - int nAddFrac;
89997 - if( p==0 ) return;
89998 - nAddFrac = nFrac - p->nFrac;
89999 - nAddSig = (nDigit - p->nDigit) - nAddFrac;
90000 - if( nAddFrac==0 && nAddSig==0 ) return;
90001 - p->a = sqlite3_realloc64(p->a, nDigit+1);
90002 - if( p->a==0 ){
90003 - p->oom = 1;
90004 - return;
90005 - }
90006 - if( nAddSig ){
90007 - memmove(p->a+nAddSig, p->a, p->nDigit);
90008 - memset(p->a, 0, nAddSig);
90009 - p->nDigit += nAddSig;
90010 - }
90011 - if( nAddFrac ){
90012 - memset(p->a+p->nDigit, 0, nAddFrac);
90013 - p->nDigit += nAddFrac;
90014 - p->nFrac += nAddFrac;
90015 - }
90023 + int nAllot = MultiByteToWideChar(CP_UTF8, 0, z, -1, NULL, 0);
90025 + if( rv!=0 && 0 < MultiByteToWideChar(CP_UTF8, 0, z, -1, rv, nAllot) )
90033 -** Add the value pB into pA.
90034 -**
90035 -** Both pA and pB might become denormalized by this routine.
90040 -static void decimal_add(Decimal *pA, Decimal *pB){
90041 - int nSig, nFrac, nDigit;
90042 - int i, rc;
90043 - if( pA==0 ){
90044 - return;
90045 - }
90046 - if( pA->oom || pB==0 || pB->oom ){
90047 - pA->oom = 1;
90048 - return;
90049 - }
90050 - if( pA->isNull || pB->isNull ){
90051 - pA->isNull = 1;
90052 - return;
90053 - }
90054 - nSig = pA->nDigit - pA->nFrac;
90055 - if( nSig && pA->a[0]==0 ) nSig--;
90056 - if( nSig<pB->nDigit-pB->nFrac ){
90057 - nSig = pB->nDigit - pB->nFrac;
90058 - }
90059 - nFrac = pA->nFrac;
90060 - if( nFrac<pB->nFrac ) nFrac = pB->nFrac;
90061 - nDigit = nSig + nFrac + 1;
90062 - decimal_expand(pA, nDigit, nFrac);
90063 - decimal_expand(pB, nDigit, nFrac);
90064 - if( pA->oom || pB->oom ){
90065 - pA->oom = 1;
90066 - }else{
90067 - if( pA->sign==pB->sign ){
90068 - int carry = 0;
90069 - for(i=nDigit-1; i>=0; i--){
90070 - int x = pA->a[i] + pB->a[i] + carry;
90071 - if( x>=10 ){
90072 - carry = 1;
90073 - pA->a[i] = x - 10;
90074 - }else{
90075 - carry = 0;
90076 - pA->a[i] = x;
90077 - }
90078 - }
90079 - }else{
90080 - signed char *aA, *aB;
90081 - int borrow = 0;
90082 - rc = memcmp(pA->a, pB->a, nDigit);
90083 - if( rc<0 ){
90084 - aA = pB->a;
90085 - aB = pA->a;
90086 - pA->sign = !pA->sign;
90087 - }else{
90088 - aA = pA->a;
90089 - aB = pB->a;
90090 - }
90091 - for(i=nDigit-1; i>=0; i--){
90092 - int x = aA[i] - aB[i] - borrow;
90093 - if( x<0 ){
90094 - pA->a[i] = x+10;
90095 - borrow = 1;
90096 - }else{
90097 - pA->a[i] = x;
90098 - borrow = 0;
90099 - }
90100 - }
90114 + pStatBuf->st_ctime = (time_t)fileTimeToUnixTime(&fd.ftCreationTime);
90115 + pStatBuf->st_atime = (time_t)fileTimeToUnixTime(&fd.ftLastAccessTime);
90116 + pStatBuf->st_mtime = (time_t)fileTimeToUnixTime(&fd.ftLastWriteTime);
90125 -** Compare text in decimal order.
90130 -static int decimalCollFunc(
90131 - void *notUsed,
90132 - int nKey1, const void *pKey1,
90133 - int nKey2, const void *pKey2
90138 - const unsigned char *zA = (const unsigned char*)pKey1;
90139 - const unsigned char *zB = (const unsigned char*)pKey2;
90140 - Decimal *pA = decimal_new(0, 0, nKey1, zA);
90141 - Decimal *pB = decimal_new(0, 0, nKey2, zB);
90142 - int rc;
90143 - UNUSED_PARAMETER(notUsed);
90144 - if( pA==0 || pB==0 ){
90145 - rc = 0;
90146 - }else{
90147 - rc = decimal_cmp(pA, pB);
90148 - }
90149 - decimal_free(pA);
90150 - decimal_free(pB);
90160 -
90162 -** SQL Function: decimal_add(X, Y)
90163 -** decimal_sub(X, Y)
90164 -**
90165 -** Return the sum or difference of X and Y.
90170 -static void decimalAddFunc(
90171 - sqlite3_context *context,
90172 - int argc,
90173 - sqlite3_value **argv
90178 - Decimal *pA = decimal_new(context, argv[0], 0, 0);
90179 - Decimal *pB = decimal_new(context, argv[1], 0, 0);
90180 - UNUSED_PARAMETER(argc);
90181 - decimal_add(pA, pB);
90182 - decimal_result(context, pA);
90183 - decimal_free(pA);
90184 - decimal_free(pB);
90193 -static void decimalSubFunc(
90194 - sqlite3_context *context,
90195 - int argc,
90196 - sqlite3_value **argv
90212 - Decimal *pA = decimal_new(context, argv[0], 0, 0);
90213 - Decimal *pB = decimal_new(context, argv[1], 0, 0);
90214 - UNUSED_PARAMETER(argc);
90215 - if( pB ){
90216 - pB->sign = !pB->sign;
90217 - decimal_add(pA, pB);
90218 - decimal_result(context, pA);
90248 - decimal_free(pA);
90249 - decimal_free(pB);
90254 -/* Aggregate funcion: decimal_sum(X)
90255 -**
90256 -** Works like sum() except that it uses decimal arithmetic for unlimited
90257 -** precision.
90262 -static void decimalSumStep(
90263 - sqlite3_context *context,
90264 - int argc,
90265 - sqlite3_value **argv
90271 + sqlite3_int64 mtime /* MTIME parameter (or -1 to not set time) */
90273 - Decimal *p;
90274 - Decimal *pArg;
90275 - UNUSED_PARAMETER(argc);
90276 - p = sqlite3_aggregate_context(context, sizeof(*p));
90277 - if( p==0 ) return;
90278 - if( !p->isInit ){
90279 - p->isInit = 1;
90280 - p->a = sqlite3_malloc(2);
90281 - if( p->a==0 ){
90282 - p->oom = 1;
90294 + ** be an error though - if there is already a directory at the same
90307 - p->a[0] = 0;
90328 - p->nDigit = 1;
90329 - p->nFrac = 0;
90331 - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
90332 - pArg = decimal_new(context, argv[0], 0, 0);
90333 - decimal_add(p, pArg);
90334 - decimal_free(pArg);
90393 -static void decimalSumInverse(
90404 - Decimal *p;
90405 - Decimal *pArg;
90406 - UNUSED_PARAMETER(argc);
90407 - p = sqlite3_aggregate_context(context, sizeof(*p));
90408 - if( p==0 ) return;
90409 - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
90410 - pArg = decimal_new(context, argv[0], 0, 0);
90411 - if( pArg ) pArg->sign = !pArg->sign;
90412 - decimal_add(p, pArg);
90413 - decimal_free(pArg);
90414 -}
90415 -static void decimalSumValue(sqlite3_context *context){
90416 - Decimal *p = sqlite3_aggregate_context(context, 0);
90417 - if( p==0 ) return;
90418 - decimal_result(context, p);
90419 -}
90420 -static void decimalSumFinalize(sqlite3_context *context){
90421 - Decimal *p = sqlite3_aggregate_context(context, 0);
90422 - if( p==0 ) return;
90423 - decimal_result(context, p);
90424 - decimal_clear(p);
90428 + sqlite3_int64 mtime = -1;
90432 + "wrong number of arguments to function writefile()", -1
90465 -** SQL Function: decimal_mul(X, Y)
90466 -**
90467 -** Return the product of X and Y.
90470 -** All significant digits after the decimal point are retained.
90471 -** Trailing zeros after the decimal point are omitted as long as
90472 -** the number of digits after the decimal point is no less than
90473 -** either the number of digits in either input.
90474 +** Given a numberic st_mode from stat(), convert it into a human-readable
90475 +** text string in the style of "ls -l".
90477 -static void decimalMulFunc(
90483 - Decimal *pA = decimal_new(context, argv[0], 0, 0);
90484 - Decimal *pB = decimal_new(context, argv[1], 0, 0);
90485 - signed char *acc = 0;
90486 - int i, j, k;
90487 - int minFrac;
90488 - UNUSED_PARAMETER(argc);
90489 - if( pA==0 || pA->oom || pA->isNull
90490 - || pB==0 || pB->oom || pB->isNull
90491 - ){
90492 - goto mul_end;
90493 - }
90494 - acc = sqlite3_malloc64( pA->nDigit + pB->nDigit + 2 );
90495 - if( acc==0 ){
90496 - sqlite3_result_error_nomem(context);
90497 - goto mul_end;
90505 + z[0] = '-';
90511 - memset(acc, 0, pA->nDigit + pB->nDigit + 2);
90512 - minFrac = pA->nFrac;
90513 - if( pB->nFrac<minFrac ) minFrac = pB->nFrac;
90514 - for(i=pA->nDigit-1; i>=0; i--){
90515 - signed char f = pA->a[i];
90516 - int carry = 0, x;
90517 - for(j=pB->nDigit-1, k=i+j+3; j>=0; j--, k--){
90518 - x = acc[k] + f*pB->a[j] + carry;
90519 - acc[k] = x%10;
90520 - carry = x/10;
90521 - }
90522 - x = acc[k] + carry;
90523 - acc[k] = x%10;
90524 - acc[k-1] += x/10;
90526 + int m = (iMode >> ((2-i)*3));
90528 + a[0] = (m & 0x4) ? 'r' : '-';
90529 + a[1] = (m & 0x2) ? 'w' : '-';
90530 + a[2] = (m & 0x1) ? 'x' : '-';
90532 - sqlite3_free(pA->a);
90533 - pA->a = acc;
90534 - acc = 0;
90535 - pA->nDigit += pB->nDigit + 2;
90536 - pA->nFrac += pB->nFrac;
90537 - pA->sign ^= pB->sign;
90538 - while( pA->nFrac>minFrac && pA->a[pA->nDigit-1]==0 ){
90539 - pA->nFrac--;
90540 - pA->nDigit--;
90542 + sqlite3_result_text(context, z, -1, SQLITE_TRANSIENT);
90555 + char *zDir; /* Name of directory (nul-terminated) */
90559 + sqlite3_vtab_cursor base; /* Base class - must be first */
90575 + sqlite3_vtab base; /* Base class - must be first */
90582 + sqlite3 *db,
90594 + rc = sqlite3_declare_vtab(db, "CREATE TABLE x" FSDIR_SCHEMA);
90599 + sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
90601 - decimal_result(context, pA);
90606 -mul_end:
90607 - sqlite3_free(acc);
90608 - decimal_free(pA);
90609 - decimal_free(pB);
90618 -#ifdef _WIN32
90628 + pCur->iLvl = -1;
90629 + *ppCursor = &pCur->base;
90633 -#endif
90634 -int sqlite3_decimal_init(
90635 - sqlite3 *db,
90636 - char **pzErrMsg,
90637 - const sqlite3_api_routines *pApi
90638 -){
90639 - int rc = SQLITE_OK;
90640 - static const struct {
90641 - const char *zFuncName;
90642 - int nArg;
90643 - void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
90644 - } aFunc[] = {
90645 - { "decimal", 1, decimalFunc },
90646 - { "decimal_cmp", 2, decimalCmpFunc },
90647 - { "decimal_add", 2, decimalAddFunc },
90648 - { "decimal_sub", 2, decimalSubFunc },
90649 - { "decimal_mul", 2, decimalMulFunc },
90650 - };
90651 - unsigned int i;
90652 - (void)pzErrMsg; /* Unused parameter */
90659 + for(i=0; i<=pCur->iLvl; i++){
90660 + FsdirLevel *pLvl = &pCur->aLvl[i];
90661 + if( pLvl->pDir ) closedir(pLvl->pDir);
90662 + sqlite3_free(pLvl->zDir);
90664 + sqlite3_free(pCur->zPath);
90665 + sqlite3_free(pCur->aLvl);
90666 + pCur->aLvl = 0;
90667 + pCur->zPath = 0;
90668 + pCur->zBase = 0;
90669 + pCur->nBase = 0;
90670 + pCur->nLvl = 0;
90671 + pCur->iLvl = -1;
90672 + pCur->iRowid = 1;
90675 - SQLITE_EXTENSION_INIT2(pApi);
90682 - for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
90683 - rc = sqlite3_create_function(db, aFunc[i].zFuncName, aFunc[i].nArg,
90684 - SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
90685 - 0, aFunc[i].xFunc, 0, 0);
90686 - }
90687 - if( rc==SQLITE_OK ){
90688 - rc = sqlite3_create_window_function(db, "decimal_sum", 1,
90689 - SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC, 0,
90690 - decimalSumStep, decimalSumFinalize,
90691 - decimalSumValue, decimalSumInverse, 0);
90692 - }
90693 - if( rc==SQLITE_OK ){
90694 - rc = sqlite3_create_collation(db, "decimal", SQLITE_UTF8,
90695 - 0, decimalCollFunc);
90696 - }
90697 - return rc;
90703 -/************************* End ../ext/misc/decimal.c ********************/
90704 -/************************* Begin ../ext/misc/ieee754.c ******************/
90706 -** 2013-04-17
90707 -**
90708 -** The author disclaims copyright to this source code. In place of
90709 -** a legal notice, here is a blessing:
90710 -**
90711 -** May you do good and not evil.
90712 -** May you find forgiveness for yourself and forgive others.
90713 -** May you share freely, never taking more than you give.
90714 -**
90715 -******************************************************************************
90716 -**
90717 -** This SQLite extension implements functions for the exact display
90718 -** and input of IEEE754 Binary64 floating-point numbers.
90719 -**
90720 -** ieee754(X)
90721 -** ieee754(Y,Z)
90722 -**
90723 -** In the first form, the value X should be a floating-point number.
90724 -** The function will return a string of the form 'ieee754(Y,Z)' where
90725 -** Y and Z are integers such that X==Y*pow(2,Z).
90726 -**
90727 -** In the second form, Y and Z are integers which are the mantissa and
90728 -** base-2 exponent of a new floating point number. The function returns
90729 -** a floating-point value equal to Y*pow(2,Z).
90730 -**
90731 -** Examples:
90732 -**
90733 -** ieee754(2.0) -> 'ieee754(2,0)'
90734 -** ieee754(45.25) -> 'ieee754(181,-2)'
90735 -** ieee754(2, 0) -> 2.0
90736 -** ieee754(181, -2) -> 45.25
90737 -**
90738 -** Two additional functions break apart the one-argument ieee754()
90739 -** result into separate integer values:
90740 -**
90741 -** ieee754_mantissa(45.25) -> 181
90742 -** ieee754_exponent(45.25) -> -2
90743 -**
90744 -** These functions convert binary64 numbers into blobs and back again.
90745 -**
90746 -** ieee754_from_blob(x'3ff0000000000000') -> 1.0
90747 -** ieee754_to_blob(1.0) -> x'3ff0000000000000'
90748 -**
90749 -** In all single-argument functions, if the argument is an 8-byte blob
90750 -** then that blob is interpreted as a big-endian binary64 value.
90751 -**
90752 -**
90753 -** EXACT DECIMAL REPRESENTATION OF BINARY64 VALUES
90754 -** -----------------------------------------------
90755 -**
90756 -** This extension in combination with the separate 'decimal' extension
90757 -** can be used to compute the exact decimal representation of binary64
90758 -** values. To begin, first compute a table of exponent values:
90759 -**
90760 -** CREATE TABLE pow2(x INTEGER PRIMARY KEY, v TEXT);
90761 -** WITH RECURSIVE c(x,v) AS (
90762 -** VALUES(0,'1')
90763 -** UNION ALL
90764 -** SELECT x+1, decimal_mul(v,'2') FROM c WHERE x+1<=971
90765 -** ) INSERT INTO pow2(x,v) SELECT x, v FROM c;
90766 -** WITH RECURSIVE c(x,v) AS (
90767 -** VALUES(-1,'0.5')
90768 -** UNION ALL
90769 -** SELECT x-1, decimal_mul(v,'0.5') FROM c WHERE x-1>=-1075
90770 -** ) INSERT INTO pow2(x,v) SELECT x, v FROM c;
90771 -**
90772 -** Then, to compute the exact decimal representation of a floating
90773 -** point value (the value 47.49 is used in the example) do:
90774 -**
90775 -** WITH c(n) AS (VALUES(47.49))
90776 -** ---------------^^^^^---- Replace with whatever you want
90777 -** SELECT decimal_mul(ieee754_mantissa(c.n),pow2.v)
90778 -** FROM pow2, c WHERE pow2.x=ieee754_exponent(c.n);
90779 -**
90780 -** Here is a query to show various boundry values for the binary64
90781 -** number format:
90782 -**
90783 -** WITH c(name,bin) AS (VALUES
90784 -** ('minimum positive value', x'0000000000000001'),
90785 -** ('maximum subnormal value', x'000fffffffffffff'),
90786 -** ('mininum positive nornal value', x'0010000000000000'),
90787 -** ('maximum value', x'7fefffffffffffff'))
90788 -** SELECT c.name, decimal_mul(ieee754_mantissa(c.bin),pow2.v)
90789 -** FROM pow2, c WHERE pow2.x=ieee754_exponent(c.bin);
90790 -**
90794 -/* #include "sqlite3ext.h" */
90795 -SQLITE_EXTENSION_INIT1
90796 -#include <assert.h>
90797 -#include <string.h>
90801 + pCur->base.pVtab->zErrMsg = sqlite3_vmprintf(zFmt, ap);
90805 -/* Mark a function parameter as unused, to suppress nuisance compiler
90806 -** warnings. */
90807 -#ifndef UNUSED_PARAMETER
90808 -# define UNUSED_PARAMETER(X) (void)(X)
90809 -#endif
90812 -** Implementation of the ieee754() function
90815 -static void ieee754func(
90816 - sqlite3_context *context,
90817 - int argc,
90818 - sqlite3_value **argv
90819 -){
90820 - if( argc==1 ){
90821 - sqlite3_int64 m, a;
90822 - double r;
90823 - int e;
90824 - int isNeg;
90825 - char zResult[100];
90826 - assert( sizeof(m)==sizeof(r) );
90827 - if( sqlite3_value_type(argv[0])==SQLITE_BLOB
90828 - && sqlite3_value_bytes(argv[0])==sizeof(r)
90829 - ){
90830 - const unsigned char *x = sqlite3_value_blob(argv[0]);
90831 - unsigned int i;
90832 - sqlite3_uint64 v = 0;
90833 - for(i=0; i<sizeof(r); i++){
90834 - v = (v<<8) | x[i];
90835 - }
90836 - memcpy(&r, &v, sizeof(r));
90837 - }else{
90838 - r = sqlite3_value_double(argv[0]);
90841 + mode_t m = pCur->sStat.st_mode;
90843 + pCur->iRowid++;
90846 + int iNew = pCur->iLvl + 1;
90848 + if( iNew>=pCur->nLvl ){
90851 + FsdirLevel *aNew = (FsdirLevel*)sqlite3_realloc64(pCur->aLvl, nByte);
90853 + memset(&aNew[pCur->nLvl], 0, sizeof(FsdirLevel)*(nNew-pCur->nLvl));
90854 + pCur->aLvl = aNew;
90855 + pCur->nLvl = nNew;
90857 - if( r<0.0 ){
90858 - isNeg = 1;
90859 - r = -r;
90860 - }else{
90861 - isNeg = 0;
90862 + pCur->iLvl = iNew;
90863 + pLvl = &pCur->aLvl[iNew];
90865 + pLvl->zDir = pCur->zPath;
90866 + pCur->zPath = 0;
90867 + pLvl->pDir = opendir(pLvl->zDir);
90868 + if( pLvl->pDir==0 ){
90869 + fsdirSetErrmsg(pCur, "cannot read directory: %s", pCur->zPath);
90872 - memcpy(&a,&r,sizeof(a));
90873 - if( a==0 ){
90874 - e = 0;
90875 - m = 0;
90876 - }else{
90877 - e = a>>52;
90878 - m = a & ((((sqlite3_int64)1)<<52)-1);
90879 - if( e==0 ){
90880 - m <<= 1;
90881 - }else{
90882 - m |= ((sqlite3_int64)1)<<52;
90885 + while( pCur->iLvl>=0 ){
90886 + FsdirLevel *pLvl = &pCur->aLvl[pCur->iLvl];
90887 + struct dirent *pEntry = readdir(pLvl->pDir);
90889 + if( pEntry->d_name[0]=='.' ){
90890 + if( pEntry->d_name[1]=='.' && pEntry->d_name[2]=='\0' ) continue;
90891 + if( pEntry->d_name[1]=='\0' ) continue;
90893 - while( e<1075 && m>0 && (m&1)==0 ){
90894 - m >>= 1;
90895 - e++;
90896 + sqlite3_free(pCur->zPath);
90897 + pCur->zPath = sqlite3_mprintf("%s/%s", pLvl->zDir, pEntry->d_name);
90898 + if( pCur->zPath==0 ) return SQLITE_NOMEM;
90899 + if( fileLinkStat(pCur->zPath, &pCur->sStat) ){
90900 + fsdirSetErrmsg(pCur, "cannot stat file: %s", pCur->zPath);
90903 - if( isNeg ) m = -m;
90904 - }
90905 - switch( *(int*)sqlite3_user_data(context) ){
90906 - case 0:
90907 - sqlite3_snprintf(sizeof(zResult), zResult, "ieee754(%lld,%d)",
90908 - m, e-1075);
90909 - sqlite3_result_text(context, zResult, -1, SQLITE_TRANSIENT);
90910 - break;
90911 - case 1:
90912 - sqlite3_result_int64(context, m);
90913 - break;
90914 - case 2:
90915 - sqlite3_result_int(context, e-1075);
90916 - break;
90919 - }else{
90920 - sqlite3_int64 m, e, a;
90921 - double r;
90922 - int isNeg = 0;
90923 - m = sqlite3_value_int64(argv[0]);
90924 - e = sqlite3_value_int64(argv[1]);
90925 + closedir(pLvl->pDir);
90926 + sqlite3_free(pLvl->zDir);
90927 + pLvl->pDir = 0;
90928 + pLvl->zDir = 0;
90929 + pCur->iLvl--;
90933 + sqlite3_free(pCur->zPath);
90934 + pCur->zPath = 0;
90938 - /* Limit the range of e. Ticket 22dea1cfdb9151e4 2021-03-02 */
90939 - if( e>10000 ){
90940 - e = 10000;
90941 - }else if( e<-10000 ){
90942 - e = -10000;
90955 + sqlite3_result_text(ctx, &pCur->zPath[pCur->nBase], -1, SQLITE_TRANSIENT);
90959 - if( m<0 ){
90960 - isNeg = 1;
90961 - m = -m;
90962 - if( m<0 ) return;
90963 - }else if( m==0 && e>-1000 && e<1000 ){
90964 - sqlite3_result_double(context, 0.0);
90965 - return;
90966 - }
90967 - while( (m>>32)&0xffe00000 ){
90968 - m >>= 1;
90969 - e++;
90970 - }
90971 - while( m!=0 && ((m>>32)&0xfff00000)==0 ){
90972 - m <<= 1;
90973 - e--;
90974 - }
90975 - e += 1075;
90976 - if( e<=0 ){
90977 - /* Subnormal */
90978 - if( 1-e >= 64 ){
90979 - m = 0;
90981 + sqlite3_result_int64(ctx, pCur->sStat.st_mode);
90985 + sqlite3_result_int64(ctx, pCur->sStat.st_mtime);
90989 + mode_t m = pCur->sStat.st_mode;
91000 + n = readlink(pCur->zPath, aBuf, nBuf);
91015 - m >>= 1-e;
91016 + readFileContents(ctx, pCur->zPath);
91018 - e = 0;
91019 - }else if( e>0x7ff ){
91020 - e = 0x7ff;
91022 - a = m & ((((sqlite3_int64)1)<<52)-1);
91023 - a |= e<<52;
91024 - if( isNeg ) a |= ((sqlite3_uint64)1)<<63;
91025 - memcpy(&r, &a, sizeof(r));
91026 - sqlite3_result_double(context, r);
91038 -** Functions to convert between blobs and floats.
91043 -static void ieee754func_from_blob(
91044 - sqlite3_context *context,
91045 - int argc,
91046 - sqlite3_value **argv
91049 + *pRowid = pCur->iRowid;
91059 + return (pCur->zPath==0);
91073 - UNUSED_PARAMETER(argc);
91074 - if( sqlite3_value_type(argv[0])==SQLITE_BLOB
91075 - && sqlite3_value_bytes(argv[0])==sizeof(double)
91076 - ){
91077 - double r;
91078 - const unsigned char *x = sqlite3_value_blob(argv[0]);
91079 - unsigned int i;
91080 - sqlite3_uint64 v = 0;
91081 - for(i=0; i<sizeof(r); i++){
91082 - v = (v<<8) | x[i];
91083 - }
91084 - memcpy(&r, &v, sizeof(r));
91085 - sqlite3_result_double(context, r);
91099 + fsdirSetErrmsg(pCur, "table function fsdir requires a non-NULL argument");
91103 + pCur->zBase = (const char*)sqlite3_value_text(argv[1]);
91105 + if( pCur->zBase ){
91106 + pCur->nBase = (int)strlen(pCur->zBase)+1;
91107 + pCur->zPath = sqlite3_mprintf("%s/%s", pCur->zBase, zDir);
91109 + pCur->zPath = sqlite3_mprintf("%s", zDir);
91112 + if( pCur->zPath==0 ){
91115 + if( fileLinkStat(pCur->zPath, &pCur->sStat) ){
91116 + fsdirSetErrmsg(pCur, "cannot stat file: %s", pCur->zPath);
91122 -static void ieee754func_to_blob(
91123 - sqlite3_context *context,
91124 - int argc,
91125 - sqlite3_value **argv
91145 - UNUSED_PARAMETER(argc);
91146 - if( sqlite3_value_type(argv[0])==SQLITE_FLOAT
91147 - || sqlite3_value_type(argv[0])==SQLITE_INTEGER
91148 - ){
91149 - double r = sqlite3_value_double(argv[0]);
91150 - sqlite3_uint64 v;
91151 - unsigned char a[sizeof(r)];
91152 - unsigned int i;
91153 - memcpy(&v, &r, sizeof(r));
91154 - for(i=1; i<=sizeof(r); i++){
91155 - a[sizeof(r)-i] = v&0xff;
91156 - v >>= 8;
91158 + int idxPath = -1; /* Index in pIdxInfo->aConstraint of PATH= */
91159 + int idxDir = -1; /* Index in pIdxInfo->aConstraint of DIR= */
91165 + pConstraint = pIdxInfo->aConstraint;
91166 + for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
91167 + if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
91168 + switch( pConstraint->iColumn ){
91170 + if( pConstraint->usable ){
91179 + if( pConstraint->usable ){
91195 + pIdxInfo->idxNum = 0;
91196 + /* The pIdxInfo->estimatedCost should have been initialized to a huge
91198 + pIdxInfo->estimatedRows = 0x7fffffff;
91200 + pIdxInfo->aConstraintUsage[idxPath].omit = 1;
91201 + pIdxInfo->aConstraintUsage[idxPath].argvIndex = 1;
91203 + pIdxInfo->aConstraintUsage[idxDir].omit = 1;
91204 + pIdxInfo->aConstraintUsage[idxDir].argvIndex = 2;
91205 + pIdxInfo->idxNum = 2;
91206 + pIdxInfo->estimatedCost = 10.0;
91208 + pIdxInfo->idxNum = 1;
91209 + pIdxInfo->estimatedCost = 100.0;
91211 - sqlite3_result_blob(context, a, sizeof(r), SQLITE_TRANSIENT);
91220 +static int fsdirRegister(sqlite3 *db){
91228 + fsdirOpen, /* xOpen - open a cursor */
91229 + fsdirClose, /* xClose - close a cursor */
91230 + fsdirFilter, /* xFilter - configure scan constraints */
91231 + fsdirNext, /* xNext - advance a cursor */
91232 + fsdirEof, /* xEof - check for end of scan */
91233 + fsdirColumn, /* xColumn - read data */
91234 + fsdirRowid, /* xRowid - read data */
91248 + int rc = sqlite3_create_module(db, "fsdir", &fsdirModule, 0);
91258 -int sqlite3_ieee_init(
91260 sqlite3 *db,
91264 - static const struct {
91265 - char *zFName;
91266 - int nArg;
91267 - int iAux;
91268 - void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
91269 - } aFunc[] = {
91270 - { "ieee754", 1, 0, ieee754func },
91271 - { "ieee754", 2, 0, ieee754func },
91272 - { "ieee754_mantissa", 1, 1, ieee754func },
91273 - { "ieee754_exponent", 1, 2, ieee754func },
91274 - { "ieee754_to_blob", 1, 0, ieee754func_to_blob },
91275 - { "ieee754_from_blob", 1, 0, ieee754func_from_blob },
91276 -
91277 - };
91278 - unsigned int i;
91282 - for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
91283 - rc = sqlite3_create_function(db, aFunc[i].zFName, aFunc[i].nArg,
91284 - SQLITE_UTF8|SQLITE_INNOCUOUS,
91285 - (void*)&aFunc[i].iAux,
91286 - aFunc[i].xFunc, 0, 0);
91287 + rc = sqlite3_create_function(db, "readfile", 1,
91291 + rc = sqlite3_create_function(db, "writefile", -1,
91296 + rc = sqlite3_create_function(db, "lsmode", 1, SQLITE_UTF8, 0,
91300 + rc = fsdirRegister(db);
91305 -/************************* End ../ext/misc/ieee754.c ********************/
91306 -/************************* Begin ../ext/misc/series.c ******************/
91318 -** 2015-08-18
91319 +** 2017-07-10
91323 @@ -5512,203 +5544,327 @@ int sqlite3_ieee_init(
91327 -** This file demonstrates how to create a table-valued-function using
91328 -** a virtual table. This demo implements the generate_series() function
91329 -** which gives similar results to the eponymous function in PostgreSQL.
91330 -** Examples:
91331 -**
91332 -** SELECT * FROM generate_series(0,100,5);
91333 -**
91334 -** The query above returns integers from 0 through 100 counting by steps
91335 -** of 5.
91336 -**
91337 -** SELECT * FROM generate_series(0,100);
91338 -**
91339 -** Integers from 0 through 100 with a step size of 1.
91340 -**
91341 -** SELECT * FROM generate_series(20) LIMIT 10;
91342 -**
91343 -** Integers 20 through 29.
91344 -**
91345 -** HOW IT WORKS
91346 -**
91347 -** The generate_series "function" is really a virtual table with the
91348 -** following schema:
91349 -**
91350 -** CREATE TABLE generate_series(
91351 -** value,
91352 -** start HIDDEN,
91353 -** stop HIDDEN,
91354 -** step HIDDEN
91355 -** );
91359 -** Function arguments in queries against this virtual table are translated
91360 -** into equality constraints against successive hidden columns. In other
91361 -** words, the following pairs of queries are equivalent to each other:
91364 -** SELECT * FROM generate_series(0,100,5);
91365 -** SELECT * FROM generate_series WHERE start=0 AND stop=100 AND step=5;
91370 -** SELECT * FROM generate_series(0,100);
91371 -** SELECT * FROM generate_series WHERE start=0 AND stop=100;
91376 -** SELECT * FROM generate_series(20) LIMIT 10;
91377 -** SELECT * FROM generate_series WHERE start=20 LIMIT 10;
91383 -** The generate_series virtual table implementation leaves the xCreate method
91384 -** set to NULL. This means that it is not possible to do a CREATE VIRTUAL
91385 -** TABLE command with "generate_series" as the USING argument. Instead, there
91386 -** is a single generate_series virtual table that is always available without
91387 -** having to be created first.
91392 -** The xBestIndex method looks for equality constraints against the hidden
91393 -** start, stop, and step columns, and if present, it uses those constraints
91394 -** to bound the sequence of generated values. If the equality constraints
91395 -** are missing, it uses 0 for start, 4294967295 for stop, and 1 for step.
91396 -** xBestIndex returns a small cost when both start and stop are available,
91397 -** and a very large cost if either start or stop are unavailable. This
91398 -** encourages the query planner to order joins such that the bounds of the
91399 -** series are well-defined.
91414 + sqlite3_vtab base; /* Base class - must be first */
91415 + sqlite3 *db; /* Database connection for this completion vtab */
91418 -/* series_cursor is a subclass of sqlite3_vtab_cursor which will
91423 -typedef struct series_cursor series_cursor;
91424 -struct series_cursor {
91427 sqlite3_vtab_cursor base; /* Base class - must be first */
91428 - int isDesc; /* True to count down rather than up */
91429 + sqlite3 *db; /* Database connection for this cursor */
91437 - sqlite3_int64 iValue; /* Current value ("value") */
91438 - sqlite3_int64 mnValue; /* Mimimum value ("start") */
91439 - sqlite3_int64 mxValue; /* Maximum value ("stop") */
91440 - sqlite3_int64 iStep; /* Increment ("step") */
91442 + int j; /* inter-phase counter */
91461 -** The seriesConnect() method is invoked to create a new
91462 -** series_vtab that describes the generate_series virtual table.
91466 -** Think of this routine as the constructor for series_vtab objects.
91471 -** (1) Allocate the series_vtab object and initialize all fields.
91475 -** result set of queries against generate_series will look like.
91478 -static int seriesConnect(
91480 sqlite3 *db,
91481 - void *pUnused,
91482 - int argcUnused, const char *const*argvUnused,
91486 - char **pzErrUnused
91489 - sqlite3_vtab *pNew;
91499 -#define SERIES_COLUMN_VALUE 0
91500 -#define SERIES_COLUMN_START 1
91501 -#define SERIES_COLUMN_STOP 2
91502 -#define SERIES_COLUMN_STEP 3
91506 +#define COMPLETION_COLUMN_PHASE 3 /* ePhase - used for debugging only */
91508 - (void)pUnused;
91509 - (void)argcUnused;
91510 - (void)argvUnused;
91511 - (void)pzErrUnused;
91512 + sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
91513 rc = sqlite3_declare_vtab(db,
91514 - "CREATE TABLE x(value,start hidden,stop hidden,step hidden)");
91522 - pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
91527 - sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
91528 + pNew->db = db;
91534 -** This method is the destructor for series_cursor objects.
91537 -static int seriesDisconnect(sqlite3_vtab *pVtab){
91544 -** Constructor for a new series_cursor object.
91547 -static int seriesOpen(sqlite3_vtab *pUnused, sqlite3_vtab_cursor **ppCursor){
91548 - series_cursor *pCur;
91549 - (void)pUnused;
91555 + pCur->db = ((completion_vtab*)p)->db;
91556 *ppCursor = &pCur->base;
91561 -** Destructor for a series_cursor.
91564 -static int seriesClose(sqlite3_vtab_cursor *cur){
91566 + sqlite3_free(pCur->zPrefix); pCur->zPrefix = 0; pCur->nPrefix = 0;
91567 + sqlite3_free(pCur->zLine); pCur->zLine = 0; pCur->nLine = 0;
91568 + sqlite3_finalize(pCur->pStmt); pCur->pStmt = 0;
91569 + pCur->j = 0;
91581 -
91583 -** Advance a series_cursor to its next row of output.
91586 +** The ->ePhase, ->j, and ->pStmt fields of the completion_cursor object
91587 +** record the current state of the scan. This routine sets ->zCurrentRow
91589 +** then ->ePhase is set to COMPLETION_EOF which will signal the virtual
91597 -static int seriesNext(sqlite3_vtab_cursor *cur){
91598 - series_cursor *pCur = (series_cursor*)cur;
91599 - if( pCur->isDesc ){
91600 - pCur->iValue -= pCur->iStep;
91601 - }else{
91602 - pCur->iValue += pCur->iStep;
91603 - }
91607 + int iCol = -1; /* If >=0, step pCur->pStmt and use the i-th column */
91608 pCur->iRowid++;
91609 + while( pCur->ePhase!=COMPLETION_EOF ){
91610 + switch( pCur->ePhase ){
91612 + if( pCur->j >= sqlite3_keyword_count() ){
91613 + pCur->zCurrentRow = 0;
91614 + pCur->ePhase = COMPLETION_DATABASES;
91616 + sqlite3_keyword_name(pCur->j++, &pCur->zCurrentRow, &pCur->szRow);
91618 + iCol = -1;
91622 + if( pCur->pStmt==0 ){
91623 + sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1,
91624 + &pCur->pStmt, 0);
91631 + if( pCur->pStmt==0 ){
91635 + sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
91647 + sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
91655 + if( pCur->pStmt==0 ){
91659 + sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
91673 + sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
91683 + if( pCur->zCurrentRow==0 ) continue;
91685 + if( sqlite3_step(pCur->pStmt)==SQLITE_ROW ){
91687 + pCur->zCurrentRow = (const char*)sqlite3_column_text(pCur->pStmt, iCol);
91688 + pCur->szRow = sqlite3_column_bytes(pCur->pStmt, iCol);
91691 + sqlite3_finalize(pCur->pStmt);
91692 + pCur->pStmt = 0;
91693 + pCur->ePhase = eNextPhase;
91697 + if( pCur->nPrefix==0 ) break;
91698 + if( pCur->nPrefix<=pCur->szRow
91699 + && sqlite3_strnicmp(pCur->zPrefix, pCur->zCurrentRow, pCur->nPrefix)==0
91709 -** Return values of columns for the row at which the series_cursor
91713 -static int seriesColumn(
91719 - series_cursor *pCur = (series_cursor*)cur;
91720 - sqlite3_int64 x = 0;
91723 - case SERIES_COLUMN_START: x = pCur->mnValue; break;
91724 - case SERIES_COLUMN_STOP: x = pCur->mxValue; break;
91725 - case SERIES_COLUMN_STEP: x = pCur->iStep; break;
91726 - default: x = pCur->iValue; break;
91728 + sqlite3_result_text(ctx, pCur->zCurrentRow, pCur->szRow,SQLITE_TRANSIENT);
91732 + sqlite3_result_text(ctx, pCur->zPrefix, -1, SQLITE_TRANSIENT);
91736 + sqlite3_result_text(ctx, pCur->zLine, -1, SQLITE_TRANSIENT);
91740 + sqlite3_result_int(ctx, pCur->ePhase);
91744 - sqlite3_result_int64(ctx, x);
91749 -** Return the rowid for the current row. In this implementation, the
91750 -** first row returned is assigned rowid value 1, and each subsequent
91751 -** row a value 1 more than that of the previous.
91755 -static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
91756 - series_cursor *pCur = (series_cursor*)cur;
91759 *pRowid = pCur->iRowid;
91762 @@ -5717,213 +5873,127 @@ static int seriesRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
91766 -static int seriesEof(sqlite3_vtab_cursor *cur){
91767 - series_cursor *pCur = (series_cursor*)cur;
91768 - if( pCur->isDesc ){
91769 - return pCur->iValue < pCur->mnValue;
91770 - }else{
91771 - return pCur->iValue > pCur->mxValue;
91772 - }
91775 + return pCur->ePhase >= COMPLETION_EOF;
91778 -/* True to cause run-time checking of the start=, stop=, and/or step=
91779 -** parameters. The only reason to do this is for testing the
91780 -** constraint checking logic for virtual tables in the SQLite core.
91781 -*/
91782 -#ifndef SQLITE_SERIES_CONSTRAINT_VERIFY
91783 -# define SQLITE_SERIES_CONSTRAINT_VERIFY 0
91784 -#endif
91785 -
91787 -** This method is called to "rewind" the series_cursor object back
91790 -** once prior to any call to seriesColumn() or seriesRowid() or
91791 -** seriesEof().
91792 -**
91793 -** The query plan selected by seriesBestIndex is passed in the idxNum
91794 -** parameter. (idxStr is not used in this implementation.) idxNum
91795 -** is a bitmask showing which constraints are available:
91796 -**
91797 -** 1: start=VALUE
91798 -** 2: stop=VALUE
91799 -** 4: step=VALUE
91800 -**
91801 -** Also, if bit 8 is set, that means that the series should be output
91802 -** in descending order rather than in ascending order. If bit 16 is
91803 -** set, then output must appear in ascending order.
91804 -**
91805 -** This routine should initialize the cursor and position it so that it
91806 -** is pointing at the first row, or pointing off the end of the table
91807 -** (so that seriesEof() will return true) if the table is empty.
91811 -static int seriesFilter(
91814 - int idxNum, const char *idxStrUnused,
91818 - series_cursor *pCur = (series_cursor *)pVtabCursor;
91819 - int i = 0;
91820 - (void)idxStrUnused;
91827 - pCur->mnValue = sqlite3_value_int64(argv[i++]);
91828 - }else{
91829 - pCur->mnValue = 0;
91830 - }
91831 - if( idxNum & 2 ){
91832 - pCur->mxValue = sqlite3_value_int64(argv[i++]);
91833 - }else{
91834 - pCur->mxValue = 0xffffffff;
91835 - }
91836 - if( idxNum & 4 ){
91837 - pCur->iStep = sqlite3_value_int64(argv[i++]);
91838 - if( pCur->iStep==0 ){
91839 - pCur->iStep = 1;
91840 - }else if( pCur->iStep<0 ){
91841 - pCur->iStep = -pCur->iStep;
91842 - if( (idxNum & 16)==0 ) idxNum |= 8;
91843 + pCur->nPrefix = sqlite3_value_bytes(argv[iArg]);
91844 + if( pCur->nPrefix>0 ){
91845 + pCur->zPrefix = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
91846 + if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
91848 - }else{
91849 - pCur->iStep = 1;
91852 - for(i=0; i<argc; i++){
91853 - if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
91854 - /* If any of the constraints have a NULL value, then return no rows.
91855 - ** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
91856 - pCur->mnValue = 1;
91857 - pCur->mxValue = 0;
91858 - break;
91860 + pCur->nLine = sqlite3_value_bytes(argv[iArg]);
91861 + if( pCur->nLine>0 ){
91862 + pCur->zLine = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
91863 + if( pCur->zLine==0 ) return SQLITE_NOMEM;
91866 - if( idxNum & 8 ){
91867 - pCur->isDesc = 1;
91868 - pCur->iValue = pCur->mxValue;
91869 - if( pCur->iStep>0 ){
91870 - pCur->iValue -= (pCur->mxValue - pCur->mnValue)%pCur->iStep;
91871 + if( pCur->zLine!=0 && pCur->zPrefix==0 ){
91872 + int i = pCur->nLine;
91873 + while( i>0 && (isalnum(pCur->zLine[i-1]) || pCur->zLine[i-1]=='_') ){
91874 + i--;
91876 + pCur->nPrefix = pCur->nLine - i;
91877 + if( pCur->nPrefix>0 ){
91878 + pCur->zPrefix = sqlite3_mprintf("%.*s", pCur->nPrefix, pCur->zLine + i);
91879 + if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
91881 - }else{
91882 - pCur->isDesc = 0;
91883 - pCur->iValue = pCur->mnValue;
91885 - pCur->iRowid = 1;
91886 - return SQLITE_OK;
91887 + pCur->iRowid = 0;
91888 + pCur->ePhase = COMPLETION_FIRST_PHASE;
91894 -** that uses the generate_series virtual table. This routine needs to create
91899 -** In this implementation idxNum is used to represent the
91900 -** query plan. idxStr is unused.
91901 -**
91902 -** The query plan is represented by bits in idxNum:
91903 -**
91904 -** (1) start = $value -- constraint exists
91905 -** (2) stop = $value -- constraint exists
91906 -** (4) step = $value -- constraint exists
91907 -** (8) output in descending order
91908 +** There are two hidden parameters that act as arguments to the table-valued
91912 -static int seriesBestIndex(
91913 - sqlite3_vtab *pVTab,
91918 - int i, j; /* Loop over constraints */
91921 - int bStartSeen = 0; /* EQ constraint seen on the START column */
91922 - int unusableMask = 0; /* Mask of unusable constraints */
91923 - int nArg = 0; /* Number of arguments that seriesFilter() expects */
91924 - int aIdx[3]; /* Constraints on start, stop, and step */
91925 + int prefixIdx = -1; /* Index of the start= constraint, or -1 if none */
91926 + int wholelineIdx = -1; /* Index of the stop= constraint, or -1 if none */
91930 - /* This implementation assumes that the start, stop, and step columns
91931 - ** are the last three columns in the virtual table. */
91932 - assert( SERIES_COLUMN_STOP == SERIES_COLUMN_START+1 );
91933 - assert( SERIES_COLUMN_STEP == SERIES_COLUMN_START+2 );
91934 -
91935 - aIdx[0] = aIdx[1] = aIdx[2] = -1;
91937 pConstraint = pIdxInfo->aConstraint;
91938 for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
91939 - int iCol; /* 0 for start, 1 for stop, 2 for step */
91940 - int iMask; /* bitmask for those column */
91941 - if( pConstraint->iColumn<SERIES_COLUMN_START ) continue;
91942 - iCol = pConstraint->iColumn - SERIES_COLUMN_START;
91943 - assert( iCol>=0 && iCol<=2 );
91944 - iMask = 1 << iCol;
91945 - if( iCol==0 ) bStartSeen = 1;
91946 - if( pConstraint->usable==0 ){
91947 - unusableMask |= iMask;
91948 - continue;
91949 - }else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
91950 - idxNum |= iMask;
91951 - aIdx[iCol] = i;
91952 - }
91953 - }
91954 - for(i=0; i<3; i++){
91955 - if( (j = aIdx[i])>=0 ){
91956 - pIdxInfo->aConstraintUsage[j].argvIndex = ++nArg;
91957 - pIdxInfo->aConstraintUsage[j].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY;
91958 + if( pConstraint->usable==0 ) continue;
91959 + if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
91960 + switch( pConstraint->iColumn ){
91971 - /* The current generate_column() implementation requires at least one
91972 - ** argument (the START value). Legacy versions assumed START=0 if the
91973 - ** first argument was omitted. Compile with -DZERO_ARGUMENT_GENERATE_SERIES
91974 - ** to obtain the legacy behavior */
91975 -#ifndef ZERO_ARGUMENT_GENERATE_SERIES
91976 - if( !bStartSeen ){
91977 - sqlite3_free(pVTab->zErrMsg);
91978 - pVTab->zErrMsg = sqlite3_mprintf(
91979 - "first argument to \"generate_series()\" missing or unusable");
91980 - return SQLITE_ERROR;
91981 - }
91982 -#endif
91983 - if( (unusableMask & ~idxNum)!=0 ){
91984 - /* The start, stop, and step columns are inputs. Therefore if there
91985 - ** are unusable constraints on any of start, stop, or step then
91986 - ** this plan is unusable */
91987 - return SQLITE_CONSTRAINT;
91989 + pIdxInfo->aConstraintUsage[prefixIdx].argvIndex = ++nArg;
91990 + pIdxInfo->aConstraintUsage[prefixIdx].omit = 1;
91992 - if( (idxNum & 3)==3 ){
91993 - /* Both start= and stop= boundaries are available. This is the
91994 - ** the preferred case */
91995 - pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
91996 - pIdxInfo->estimatedRows = 1000;
91997 - if( pIdxInfo->nOrderBy==1 ){
91998 - if( pIdxInfo->aOrderBy[0].desc ){
91999 - idxNum |= 8;
92000 - }else{
92001 - idxNum |= 16;
92002 - }
92003 - pIdxInfo->orderByConsumed = 1;
92004 - }
92005 - }else{
92006 - /* If either boundary is missing, we have to generate a huge span
92007 - ** of numbers. Make this case very expensive so that the query
92008 - ** planner will work hard to avoid it. */
92009 - pIdxInfo->estimatedRows = 2147483647;
92011 + pIdxInfo->aConstraintUsage[wholelineIdx].argvIndex = ++nArg;
92012 + pIdxInfo->aConstraintUsage[wholelineIdx].omit = 1;
92014 pIdxInfo->idxNum = idxNum;
92015 + pIdxInfo->estimatedCost = (double)5000 - 1000*nArg;
92016 + pIdxInfo->estimatedRows = 500 - 100*nArg;
92022 -** generate_series virtual table.
92025 -static sqlite3_module seriesModule = {
92029 - seriesConnect, /* xConnect */
92030 - seriesBestIndex, /* xBestIndex */
92031 - seriesDisconnect, /* xDisconnect */
92036 - seriesOpen, /* xOpen - open a cursor */
92037 - seriesClose, /* xClose - close a cursor */
92038 - seriesFilter, /* xFilter - configure scan constraints */
92039 - seriesNext, /* xNext - advance a cursor */
92040 - seriesEof, /* xEof - check for end of scan */
92041 - seriesColumn, /* xColumn - read data */
92042 - seriesRowid, /* xRowid - read data */
92043 + completionOpen, /* xOpen - open a cursor */
92044 + completionClose, /* xClose - close a cursor */
92045 + completionFilter, /* xFilter - configure scan constraints */
92046 + completionNext, /* xNext - advance a cursor */
92047 + completionEof, /* xEof - check for end of scan */
92048 + completionColumn, /* xColumn - read data */
92049 + completionRowid, /* xRowid - read data */
92053 @@ -5939,31 +6009,35 @@ static sqlite3_module seriesModule = {
92057 +int sqlite3CompletionVtabInit(sqlite3 *db){
92060 + rc = sqlite3_create_module(db, "completion", &completionModule, 0);
92068 -int sqlite3_series_init(
92070 sqlite3 *db,
92078 - if( sqlite3_libversion_number()<3008012 && pzErrMsg!=0 ){
92079 - *pzErrMsg = sqlite3_mprintf(
92080 - "generate_series() requires SQLite 3.8.12 or later");
92081 - return SQLITE_ERROR;
92082 - }
92083 - rc = sqlite3_create_module(db, "generate_series", &seriesModule, 0);
92084 + rc = sqlite3CompletionVtabInit(db);
92089 -/************************* End ../ext/misc/series.c ********************/
92090 -/************************* Begin ../ext/misc/regexp.c ******************/
92094 -** 2012-11-13
92095 +** 2017-10-20
92099 @@ -5974,767 +6048,669 @@ int sqlite3_series_init(
92103 -** The code in this file implements a compact but reasonably
92104 -** efficient regular-expression matcher for posix extended regular
92105 -** expressions against UTF8 text.
92109 -** This file is an SQLite extension. It registers a single function
92110 -** named "regexp(A,B)" where A is the regular expression and B is the
92111 -** string to be matched. By registering this function, SQLite will also
92112 -** then implement the "B regexp A" operator. Note that with the function
92113 -** the regular expression comes first, but with the operator it comes
92114 -** second.
92121 -** The following regular expression syntax is supported:
92127 -** X* zero or more occurrences of X
92128 -** X+ one or more occurrences of X
92129 -** X? zero or one occurrences of X
92130 -** X{p,q} between p and q occurrences of X
92131 -** (X) match X
92132 -** X|Y X or Y
92133 -** ^X X occurring at the beginning of the string
92134 -** X$ X occurring at the end of the string
92135 -** . Match any single character
92136 -** \c Character c where c is one of \{}()[]|*+?.
92137 -** \c C-language escapes for c in afnrtv. ex: \t or \n
92138 -** \uXXXX Where XXXX is exactly 4 hex digits, unicode value XXXX
92139 -** \xXX Where XX is exactly 2 hex digits, unicode value XX
92140 -** [abc] Any single character from the set abc
92141 -** [^abc] Any single character not in the set abc
92142 -** [a-z] Any single character in the range a-z
92143 -** [^a-z] Any single character not in the range a-z
92144 -** \b Word boundary
92145 -** \w Word character. [A-Za-z0-9_]
92146 -** \W Non-word character
92147 -** \d Digit
92148 -** \D Non-digit
92149 -** \s Whitespace character
92150 -** \S Non-whitespace character
92154 +** "Start-Of-SQLite3-NNNNNNNN" that file is an appended database.
92170 -** A nondeterministic finite automaton (NFA) is used for matching, so the
92171 -** performance is bounded by O(N*M) where N is the size of the regular
92172 -** expression and M is the size of the input string. The matcher never
92173 -** exhibits exponential behavior. Note that the X{p,q} operator expands
92174 -** to p copies of X following by q-p copies of X? and that the size of the
92175 -** regular expression in the O(N*M) performance bound is computed after
92176 -** this expansion.
92177 -*/
92178 -#include <string.h>
92179 -#include <stdlib.h>
92181 +** this shim is a pass-through into the default underlying VFS. (rule 3)
92188 -/*
92189 -** The following #defines change the names of some functions implemented in
92190 -** this file to prevent name collisions with C-library functions of the
92191 -** same name.
92194 +** Start-Of-SQLite3-NNNNNNNN
92197 +** The NNNNNNNN represents a 64-bit big-endian unsigned integer which is
92200 -#define re_match sqlite3re_match
92201 -#define re_compile sqlite3re_compile
92202 -#define re_free sqlite3re_free
92203 -
92204 -/* The end-of-input character */
92205 -#define RE_EOF 0 /* End of input */
92206 +#define APND_MARK_PREFIX "Start-Of-SQLite3-"
92211 -/* The NFA is implemented as sequence of opcodes taken from the following
92212 -** set. Each opcode has a single integer argument.
92214 +** Maximum size of the combined prefix + database + append-mark. This
92217 -#define RE_OP_MATCH 1 /* Match the one character in the argument */
92218 -#define RE_OP_ANY 2 /* Match any one character. (Implements ".") */
92219 -#define RE_OP_ANYSTAR 3 /* Special optimized version of .* */
92220 -#define RE_OP_FORK 4 /* Continue to both next and opcode at iArg */
92221 -#define RE_OP_GOTO 5 /* Jump to opcode at iArg */
92222 -#define RE_OP_ACCEPT 6 /* Halt and indicate a successful match */
92223 -#define RE_OP_CC_INC 7 /* Beginning of a [...] character class */
92224 -#define RE_OP_CC_EXC 8 /* Beginning of a [^...] character class */
92225 -#define RE_OP_CC_VALUE 9 /* Single value in a character class */
92226 -#define RE_OP_CC_RANGE 10 /* Range of values in a character class */
92227 -#define RE_OP_WORD 11 /* Perl word character [A-Za-z0-9_] */
92228 -#define RE_OP_NOTWORD 12 /* Not a perl word character */
92229 -#define RE_OP_DIGIT 13 /* digit: [0-9] */
92230 -#define RE_OP_NOTDIGIT 14 /* Not a digit */
92231 -#define RE_OP_SPACE 15 /* space: [ \t\n\r\v\f] */
92232 -#define RE_OP_NOTSPACE 16 /* Not a digit */
92233 -#define RE_OP_BOUNDARY 17 /* Boundary between word and non-word */
92236 -/* Each opcode is a "state" in the NFA */
92237 -typedef unsigned short ReStateNumber;
92244 +#define APND_ALIGN_MASK ((sqlite3_int64)(APND_ROUNDUP-1))
92247 -/* Because this is an NFA and not a DFA, multiple states can be active at
92248 -** once. An instance of the following object records all active states in
92249 -** the NFA. The implementation is optimized for the common case where the
92250 -** number of actives states is small.
92254 -typedef struct ReStateSet {
92255 - unsigned nState; /* Number of current states */
92256 - ReStateNumber *aState; /* Current states */
92257 -} ReStateSet;
92261 -/* An input string read one character at a time.
92262 +/* Access to a lower-level VFS that (might) implement dynamic loading,
92265 -typedef struct ReInput ReInput;
92266 -struct ReInput {
92267 - const unsigned char *z; /* All text */
92268 - int i; /* Next byte to read */
92269 - int mx; /* EOF when i>=mx */
92270 -};
92271 +#define ORIGVFS(p) ((sqlite3_vfs*)((p)->pAppData))
92274 -/* A compiled NFA (or an NFA that is in the process of being compiled) is
92275 -** an instance of the following object.
92282 +** append-mark.
92286 +** +-------------+---------+----------+-------------+
92287 +** | prefix-file | padding | database | append-mark |
92288 +** +-------------+---------+----------+-------------+
92294 +** "prefix file" - file onto which the database has been appended.
92295 +** "padding" - zero or more bytes inserted so that "database"
92297 +** "database" - The SQLite database file
92298 +** "append-mark" - The 25-byte "Start-Of-SQLite3-NNNNNNNN" that indicates
92299 +** the offset from the start of prefix-file to the start
92302 +** The size of the database is iMark - iPgOne.
92304 +** The NNNNNNNN in the "Start-Of-SQLite3-NNNNNNNN" suffix is the value
92305 +** of iPgOne stored as a big-ending 64-bit integer.
92308 +** Or, iMark is -1 to indicate that it has not yet been written.
92310 -typedef struct ReCompiled ReCompiled;
92311 -struct ReCompiled {
92312 - ReInput sIn; /* Regular expression text */
92313 - const char *zErr; /* Error message to return */
92314 - char *aOp; /* Operators for the virtual machine */
92315 - int *aArg; /* Arguments to each operator */
92316 - unsigned (*xNextChar)(ReInput*); /* Next character function */
92317 - unsigned char zInit[12]; /* Initial text to match */
92318 - int nInit; /* Number of characters in zInit */
92319 - unsigned nState; /* Number of entries in aOp[] and aArg[] */
92320 - unsigned nAlloc; /* Slots allocated for aOp[] and aArg[] */
92324 + sqlite3_int64 iMark; /* Offset of the append mark. -1 if unwritten */
92328 -/* Add a state to the given state set if it is not already there */
92329 -static void re_add_state(ReStateSet *pSet, int newState){
92330 - unsigned i;
92331 - for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return;
92332 - pSet->aState[pSet->nState++] = (ReStateNumber)newState;
92333 -}
92356 -/* Extract the next unicode character from *pzIn and return it. Advance
92357 -** *pzIn to the first byte past the end of the character returned. To
92358 -** be clear: this routine converts utf8 to unicode. This routine is
92359 -** optimized for the common case where the next character is a single byte.
92363 -static unsigned re_next_char(ReInput *p){
92364 - unsigned c;
92365 - if( p->i>=p->mx ) return 0;
92366 - c = p->z[p->i++];
92367 - if( c>=0x80 ){
92368 - if( (c&0xe0)==0xc0 && p->i<p->mx && (p->z[p->i]&0xc0)==0x80 ){
92369 - c = (c&0x1f)<<6 | (p->z[p->i++]&0x3f);
92370 - if( c<0x80 ) c = 0xfffd;
92371 - }else if( (c&0xf0)==0xe0 && p->i+1<p->mx && (p->z[p->i]&0xc0)==0x80
92372 - && (p->z[p->i+1]&0xc0)==0x80 ){
92373 - c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f);
92374 - p->i += 2;
92375 - if( c<=0x7ff || (c>=0xd800 && c<=0xdfff) ) c = 0xfffd;
92376 - }else if( (c&0xf8)==0xf0 && p->i+3<p->mx && (p->z[p->i]&0xc0)==0x80
92377 - && (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){
92378 - c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6)
92379 - | (p->z[p->i+2]&0x3f);
92380 - p->i += 3;
92381 - if( c<=0xffff || c>0x10ffff ) c = 0xfffd;
92382 - }else{
92383 - c = 0xfffd;
92384 - }
92385 - }
92386 - return c;
92387 -}
92388 -static unsigned re_next_char_nocase(ReInput *p){
92389 - unsigned c = re_next_char(p);
92390 - if( c>='A' && c<='Z' ) c += 'a' - 'A';
92391 - return c;
92392 -}
92410 -/* Return true if c is a perl "word" character: [A-Za-z0-9_] */
92411 -static int re_word_char(int c){
92412 - return (c>='0' && c<='9') || (c>='a' && c<='z')
92413 - || (c>='A' && c<='Z') || c=='_';
92414 -}
92462 -/* Return true if c is a "digit" character: [0-9] */
92463 -static int re_digit_char(int c){
92464 - return (c>='0' && c<='9');
92466 +** Close an apnd-file.
92470 + return pFile->pMethods->xClose(pFile);
92473 -/* Return true if c is a perl "space" character: [ \t\r\n\v\f] */
92474 -static int re_space_char(int c){
92475 - return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
92477 +** Read data from an apnd-file.
92487 + return pFile->pMethods->xRead(pFile, zBuf, iAmt, paf->iPgOne+iOfst);
92490 -/* Run a compiled regular expression on the zero-terminated input
92491 -** string zIn[]. Return true on a match and false if there is no match.
92493 +** Add the append-mark onto what should become the end of the file.
92495 +* Parameter iWriteEnd is the appendvfs-relative offset of the new mark.
92497 -static int re_match(ReCompiled *pRe, const unsigned char *zIn, int nIn){
92498 - ReStateSet aStateSet[2], *pThis, *pNext;
92499 - ReStateNumber aSpace[100];
92500 - ReStateNumber *pToFree;
92501 - unsigned int i = 0;
92502 - unsigned int iSwap = 0;
92503 - int c = RE_EOF+1;
92504 - int cPrev = 0;
92505 - int rc = 0;
92506 - ReInput in;
92507 -
92508 - in.z = zIn;
92509 - in.i = 0;
92510 - in.mx = nIn>=0 ? nIn : (int)strlen((char const*)zIn);
92511 -
92512 - /* Look for the initial prefix match, if there is one. */
92513 - if( pRe->nInit ){
92514 - unsigned char x = pRe->zInit[0];
92515 - while( in.i+pRe->nInit<=in.mx
92516 - && (zIn[in.i]!=x ||
92517 - strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0)
92518 - ){
92519 - in.i++;
92520 - }
92521 - if( in.i+pRe->nInit>in.mx ) return 0;
92522 - }
92523 -
92524 - if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
92525 - pToFree = 0;
92526 - aStateSet[0].aState = aSpace;
92527 - }else{
92528 - pToFree = sqlite3_malloc64( sizeof(ReStateNumber)*2*pRe->nState );
92529 - if( pToFree==0 ) return -1;
92530 - aStateSet[0].aState = pToFree;
92531 - }
92532 - aStateSet[1].aState = &aStateSet[0].aState[pRe->nState];
92533 - pNext = &aStateSet[1];
92534 - pNext->nState = 0;
92535 - re_add_state(pNext, 0);
92536 - while( c!=RE_EOF && pNext->nState>0 ){
92537 - cPrev = c;
92538 - c = pRe->xNextChar(&in);
92539 - pThis = pNext;
92540 - pNext = &aStateSet[iSwap];
92541 - iSwap = 1 - iSwap;
92542 - pNext->nState = 0;
92543 - for(i=0; i<pThis->nState; i++){
92544 - int x = pThis->aState[i];
92545 - switch( pRe->aOp[x] ){
92546 - case RE_OP_MATCH: {
92547 - if( pRe->aArg[x]==c ) re_add_state(pNext, x+1);
92548 - break;
92549 - }
92550 - case RE_OP_ANY: {
92551 - if( c!=0 ) re_add_state(pNext, x+1);
92552 - break;
92553 - }
92554 - case RE_OP_WORD: {
92555 - if( re_word_char(c) ) re_add_state(pNext, x+1);
92556 - break;
92557 - }
92558 - case RE_OP_NOTWORD: {
92559 - if( !re_word_char(c) && c!=0 ) re_add_state(pNext, x+1);
92560 - break;
92561 - }
92562 - case RE_OP_DIGIT: {
92563 - if( re_digit_char(c) ) re_add_state(pNext, x+1);
92564 - break;
92565 - }
92566 - case RE_OP_NOTDIGIT: {
92567 - if( !re_digit_char(c) && c!=0 ) re_add_state(pNext, x+1);
92568 - break;
92569 - }
92570 - case RE_OP_SPACE: {
92571 - if( re_space_char(c) ) re_add_state(pNext, x+1);
92572 - break;
92573 - }
92574 - case RE_OP_NOTSPACE: {
92575 - if( !re_space_char(c) && c!=0 ) re_add_state(pNext, x+1);
92576 - break;
92577 - }
92578 - case RE_OP_BOUNDARY: {
92579 - if( re_word_char(c)!=re_word_char(cPrev) ) re_add_state(pThis, x+1);
92580 - break;
92581 - }
92582 - case RE_OP_ANYSTAR: {
92583 - re_add_state(pNext, x);
92584 - re_add_state(pThis, x+1);
92585 - break;
92586 - }
92587 - case RE_OP_FORK: {
92588 - re_add_state(pThis, x+pRe->aArg[x]);
92589 - re_add_state(pThis, x+1);
92590 - break;
92591 - }
92592 - case RE_OP_GOTO: {
92593 - re_add_state(pThis, x+pRe->aArg[x]);
92594 - break;
92595 - }
92596 - case RE_OP_ACCEPT: {
92597 - rc = 1;
92598 - goto re_match_end;
92599 - }
92600 - case RE_OP_CC_EXC: {
92601 - if( c==0 ) break;
92602 - /* fall-through */ goto re_op_cc_inc;
92603 - }
92604 - case RE_OP_CC_INC: re_op_cc_inc: {
92605 - int j = 1;
92606 - int n = pRe->aArg[x];
92607 - int hit = 0;
92608 - for(j=1; j>0 && j<n; j++){
92609 - if( pRe->aOp[x+j]==RE_OP_CC_VALUE ){
92610 - if( pRe->aArg[x+j]==c ){
92611 - hit = 1;
92612 - j = -1;
92613 - }
92614 - }else{
92615 - if( pRe->aArg[x+j]<=c && pRe->aArg[x+j+1]>=c ){
92616 - hit = 1;
92617 - j = -1;
92618 - }else{
92619 - j++;
92620 - }
92621 - }
92622 - }
92623 - if( pRe->aOp[x]==RE_OP_CC_EXC ) hit = !hit;
92624 - if( hit ) re_add_state(pNext, x+n);
92625 - break;
92626 - }
92627 - }
92628 - }
92634 + sqlite_int64 iPgOne = paf->iPgOne;
92640 + while( --i >= 0 ){
92644 - for(i=0; i<pNext->nState; i++){
92645 - if( pRe->aOp[pNext->aState[i]]==RE_OP_ACCEPT ){ rc = 1; break; }
92646 + iWriteEnd += paf->iPgOne;
92647 + if( SQLITE_OK==(rc = pFile->pMethods->xWrite
92649 + paf->iMark = iWriteEnd;
92651 -re_match_end:
92652 - sqlite3_free(pToFree);
92656 -/* Resize the opcode and argument arrays for an RE under construction.
92658 +** Write data to an apnd-file.
92660 -static int re_resize(ReCompiled *p, int N){
92661 - char *aOp;
92662 - int *aArg;
92663 - aOp = sqlite3_realloc64(p->aOp, N*sizeof(p->aOp[0]));
92664 - if( aOp==0 ) return 1;
92665 - p->aOp = aOp;
92666 - aArg = sqlite3_realloc64(p->aArg, N*sizeof(p->aArg[0]));
92667 - if( aArg==0 ) return 1;
92668 - p->aArg = aArg;
92669 - p->nAlloc = N;
92670 - return 0;
92681 + /* If append-mark is absent or will be overwritten, write it. */
92682 + if( paf->iMark < 0 || paf->iPgOne + iWriteEnd > paf->iMark ){
92686 + return pFile->pMethods->xWrite(pFile, zBuf, iAmt, paf->iPgOne+iOfst);
92689 -/* Insert a new opcode and argument into an RE under construction. The
92690 -** insertion point is just prior to existing opcode iBefore.
92692 +** Truncate an apnd-file.
92694 -static int re_insert(ReCompiled *p, int iBefore, int op, int arg){
92695 - int i;
92696 - if( p->nAlloc<=p->nState && re_resize(p, p->nAlloc*2) ) return 0;
92697 - for(i=p->nState; i>iBefore; i--){
92698 - p->aOp[i] = p->aOp[i-1];
92699 - p->aArg[i] = p->aArg[i-1];
92700 - }
92701 - p->nState++;
92702 - p->aOp[iBefore] = (char)op;
92703 - p->aArg[iBefore] = arg;
92704 - return iBefore;
92711 + return pFile->pMethods->xTruncate(pFile, paf->iMark+APND_MARK_SIZE);
92714 -/* Append a new opcode and argument to the end of the RE under construction.
92716 +** Sync an apnd-file.
92718 -static int re_append(ReCompiled *p, int op, int arg){
92719 - return re_insert(p, p->nState, op, arg);
92722 + return pFile->pMethods->xSync(pFile, flags);
92725 -/* Make a copy of N opcodes starting at iStart onto the end of the RE
92726 -** under construction.
92728 +** Return the current file-size of an apnd-file.
92729 +** If the append mark is not yet there, the file-size is 0.
92731 -static void re_copy(ReCompiled *p, int iStart, int N){
92732 - if( p->nState+N>=p->nAlloc && re_resize(p, p->nAlloc*2+N) ) return;
92733 - memcpy(&p->aOp[p->nState], &p->aOp[iStart], N*sizeof(p->aOp[0]));
92734 - memcpy(&p->aArg[p->nState], &p->aArg[iStart], N*sizeof(p->aArg[0]));
92735 - p->nState += N;
92738 + *pSize = ( paf->iMark >= 0 )? (paf->iMark - paf->iPgOne) : 0;
92742 -/* Return true if c is a hexadecimal digit character: [0-9a-fA-F]
92743 -** If c is a hex digit, also set *pV = (*pV)*16 + valueof(c). If
92744 -** c is not a hex digit *pV is unchanged.
92746 +** Lock an apnd-file.
92748 -static int re_hex(int c, int *pV){
92749 - if( c>='0' && c<='9' ){
92750 - c -= '0';
92751 - }else if( c>='a' && c<='f' ){
92752 - c -= 'a' - 10;
92753 - }else if( c>='A' && c<='F' ){
92754 - c -= 'A' - 10;
92755 - }else{
92756 - return 0;
92757 - }
92758 - *pV = (*pV)*16 + (c & 0xff);
92759 - return 1;
92762 + return pFile->pMethods->xLock(pFile, eLock);
92765 -/* A backslash character has been seen, read the next character and
92766 -** return its interpretation.
92768 +** Unlock an apnd-file.
92770 -static unsigned re_esc_char(ReCompiled *p){
92771 - static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]";
92772 - static const char zTrans[] = "\a\f\n\r\t\v";
92773 - int i, v = 0;
92774 - char c;
92775 - if( p->sIn.i>=p->sIn.mx ) return 0;
92776 - c = p->sIn.z[p->sIn.i];
92777 - if( c=='u' && p->sIn.i+4<p->sIn.mx ){
92778 - const unsigned char *zIn = p->sIn.z + p->sIn.i;
92779 - if( re_hex(zIn[1],&v)
92780 - && re_hex(zIn[2],&v)
92781 - && re_hex(zIn[3],&v)
92782 - && re_hex(zIn[4],&v)
92783 - ){
92784 - p->sIn.i += 5;
92785 - return v;
92786 - }
92787 - }
92788 - if( c=='x' && p->sIn.i+2<p->sIn.mx ){
92789 - const unsigned char *zIn = p->sIn.z + p->sIn.i;
92790 - if( re_hex(zIn[1],&v)
92791 - && re_hex(zIn[2],&v)
92792 - ){
92793 - p->sIn.i += 3;
92794 - return v;
92795 - }
92796 - }
92797 - for(i=0; zEsc[i] && zEsc[i]!=c; i++){}
92798 - if( zEsc[i] ){
92799 - if( i<6 ) c = zTrans[i];
92800 - p->sIn.i++;
92801 - }else{
92802 - p->zErr = "unknown \\ escape";
92803 - }
92804 - return c;
92807 + return pFile->pMethods->xUnlock(pFile, eLock);
92810 -/* Forward declaration */
92811 -static const char *re_subcompile_string(ReCompiled*);
92812 -
92813 -/* Peek at the next byte of input */
92814 -static unsigned char rePeek(ReCompiled *p){
92815 - return p->sIn.i<p->sIn.mx ? p->sIn.z[p->sIn.i] : 0;
92817 +** Check if another file-handle holds a RESERVED lock on an apnd-file.
92821 + return pFile->pMethods->xCheckReservedLock(pFile, pResOut);
92824 -/* Compile RE text into a sequence of opcodes. Continue up to the
92825 -** first unmatched ")" character, then return. If an error is found,
92826 -** return a pointer to the error message string.
92828 +** File control method. For custom operations on an apnd-file.
92830 -static const char *re_subcompile_re(ReCompiled *p){
92831 - const char *zErr;
92832 - int iStart, iEnd, iGoto;
92833 - iStart = p->nState;
92834 - zErr = re_subcompile_string(p);
92835 - if( zErr ) return zErr;
92836 - while( rePeek(p)=='|' ){
92837 - iEnd = p->nState;
92838 - re_insert(p, iStart, RE_OP_FORK, iEnd + 2 - iStart);
92839 - iGoto = re_append(p, RE_OP_GOTO, 0);
92840 - p->sIn.i++;
92841 - zErr = re_subcompile_string(p);
92842 - if( zErr ) return zErr;
92843 - p->aArg[iGoto] = p->nState - iGoto;
92848 + if( op==SQLITE_FCNTL_SIZE_HINT ) *(sqlite3_int64*)pArg += paf->iPgOne;
92849 + rc = pFile->pMethods->xFileControl(pFile, op, pArg);
92851 + *(char**)pArg = sqlite3_mprintf("apnd(%lld)/%z", paf->iPgOne,*(char**)pArg);
92853 - return 0;
92856 -
92857 -/* Compile an element of regular expression text (anything that can be
92858 -** an operand to the "|" operator). Return NULL on success or a pointer
92859 -** to the error message if there is a problem.
92860 -*/
92861 -static const char *re_subcompile_string(ReCompiled *p){
92862 - int iPrev = -1;
92863 - int iStart;
92864 - unsigned c;
92865 - const char *zErr;
92866 - while( (c = p->xNextChar(&p->sIn))!=0 ){
92867 - iStart = p->nState;
92868 - switch( c ){
92869 - case '|':
92870 - case '$':
92871 - case ')': {
92872 - p->sIn.i--;
92873 - return 0;
92874 - }
92875 - case '(': {
92876 - zErr = re_subcompile_re(p);
92877 - if( zErr ) return zErr;
92878 - if( rePeek(p)!=')' ) return "unmatched '('";
92879 - p->sIn.i++;
92880 - break;
92881 - }
92882 - case '.': {
92883 - if( rePeek(p)=='*' ){
92884 - re_append(p, RE_OP_ANYSTAR, 0);
92885 - p->sIn.i++;
92886 - }else{
92887 - re_append(p, RE_OP_ANY, 0);
92888 - }
92889 - break;
92890 - }
92891 - case '*': {
92892 - if( iPrev<0 ) return "'*' without operand";
92893 - re_insert(p, iPrev, RE_OP_GOTO, p->nState - iPrev + 1);
92894 - re_append(p, RE_OP_FORK, iPrev - p->nState + 1);
92895 - break;
92896 - }
92897 - case '+': {
92898 - if( iPrev<0 ) return "'+' without operand";
92899 - re_append(p, RE_OP_FORK, iPrev - p->nState);
92900 - break;
92901 - }
92902 - case '?': {
92903 - if( iPrev<0 ) return "'?' without operand";
92904 - re_insert(p, iPrev, RE_OP_FORK, p->nState - iPrev+1);
92905 - break;
92906 - }
92907 - case '{': {
92908 - int m = 0, n = 0;
92909 - int sz, j;
92910 - if( iPrev<0 ) return "'{m,n}' without operand";
92911 - while( (c=rePeek(p))>='0' && c<='9' ){ m = m*10 + c - '0'; p->sIn.i++; }
92912 - n = m;
92913 - if( c==',' ){
92914 - p->sIn.i++;
92915 - n = 0;
92916 - while( (c=rePeek(p))>='0' && c<='9' ){ n = n*10 + c-'0'; p->sIn.i++; }
92917 - }
92918 - if( c!='}' ) return "unmatched '{'";
92919 - if( n>0 && n<m ) return "n less than m in '{m,n}'";
92920 - p->sIn.i++;
92921 - sz = p->nState - iPrev;
92922 - if( m==0 ){
92923 - if( n==0 ) return "both m and n are zero in '{m,n}'";
92924 - re_insert(p, iPrev, RE_OP_FORK, sz+1);
92925 - n--;
92926 - }else{
92927 - for(j=1; j<m; j++) re_copy(p, iPrev, sz);
92928 - }
92929 - for(j=m; j<n; j++){
92930 - re_append(p, RE_OP_FORK, sz+1);
92931 - re_copy(p, iPrev, sz);
92932 - }
92933 - if( n==0 && m>0 ){
92934 - re_append(p, RE_OP_FORK, -sz);
92935 - }
92936 - break;
92937 - }
92938 - case '[': {
92939 - int iFirst = p->nState;
92940 - if( rePeek(p)=='^' ){
92941 - re_append(p, RE_OP_CC_EXC, 0);
92942 - p->sIn.i++;
92943 - }else{
92944 - re_append(p, RE_OP_CC_INC, 0);
92945 - }
92946 - while( (c = p->xNextChar(&p->sIn))!=0 ){
92947 - if( c=='[' && rePeek(p)==':' ){
92948 - return "POSIX character classes not supported";
92949 - }
92950 - if( c=='\\' ) c = re_esc_char(p);
92951 - if( rePeek(p)=='-' ){
92952 - re_append(p, RE_OP_CC_RANGE, c);
92953 - p->sIn.i++;
92954 - c = p->xNextChar(&p->sIn);
92955 - if( c=='\\' ) c = re_esc_char(p);
92956 - re_append(p, RE_OP_CC_RANGE, c);
92957 - }else{
92958 - re_append(p, RE_OP_CC_VALUE, c);
92959 - }
92960 - if( rePeek(p)==']' ){ p->sIn.i++; break; }
92961 - }
92962 - if( c==0 ) return "unclosed '['";
92963 - p->aArg[iFirst] = p->nState - iFirst;
92964 - break;
92965 - }
92966 - case '\\': {
92967 - int specialOp = 0;
92968 - switch( rePeek(p) ){
92969 - case 'b': specialOp = RE_OP_BOUNDARY; break;
92970 - case 'd': specialOp = RE_OP_DIGIT; break;
92971 - case 'D': specialOp = RE_OP_NOTDIGIT; break;
92972 - case 's': specialOp = RE_OP_SPACE; break;
92973 - case 'S': specialOp = RE_OP_NOTSPACE; break;
92974 - case 'w': specialOp = RE_OP_WORD; break;
92975 - case 'W': specialOp = RE_OP_NOTWORD; break;
92976 - }
92977 - if( specialOp ){
92978 - p->sIn.i++;
92979 - re_append(p, specialOp, 0);
92980 - }else{
92981 - c = re_esc_char(p);
92982 - re_append(p, RE_OP_MATCH, c);
92983 - }
92984 - break;
92985 - }
92986 - default: {
92987 - re_append(p, RE_OP_MATCH, c);
92988 - break;
92989 - }
92992 +** Return the sector-size in bytes for an apnd-file.
92996 + return pFile->pMethods->xSectorSize(pFile);
93000 +** Return the device characteristic flags supported by an apnd-file.
93004 + return pFile->pMethods->xDeviceCharacteristics(pFile);
93016 + return pFile->pMethods->xShmMap(pFile,iPg,pgsz,bExtend,pp);
93019 +/* Perform locking on a shared-memory segment */
93022 + return pFile->pMethods->xShmLock(pFile,offset,n,flags);
93028 + pFile->pMethods->xShmBarrier(pFile);
93034 + return pFile->pMethods->xShmUnmap(pFile,deleteFlag);
93037 +/* Fetch a page of a memory-mapped file */
93045 + if( p->iMark < 0 || iOfst+iAmt > p->iMark ){
93049 + return pFile->pMethods->xFetch(pFile, iOfst+p->iPgOne, iAmt, pp);
93052 +/* Release a memory-mapped page */
93056 + return pFile->pMethods->xUnfetch(pFile, iOfst+p->iPgOne, pPage);
93060 +** Try to read the append-mark off the end of a file. Return the
93061 +** start of the appended database if the append-mark is present.
93062 +** If there is no valid append-mark, return -1;
93064 +** An append-mark is only valid if the NNNNNNNN start-of-database offset
93066 +** start-of-database value must be a multiple of 512.
93071 + int msbs = 8 * (APND_MARK_FOS_SZ-1);
93074 + if( APND_MARK_SIZE!=(sz & 0x1ff) ) return -1;
93075 + rc = pFile->pMethods->xRead(pFile, a, APND_MARK_SIZE, sz-APND_MARK_SIZE);
93076 + if( rc ) return -1;
93077 + if( memcmp(a, APND_MARK_PREFIX, APND_MARK_PREFIX_SZ)!=0 ) return -1;
93080 + msbs -= 8;
93083 + if( iMark > (sz - APND_MARK_SIZE - 512) ) return -1;
93084 + if( iMark & 0x1ff ) return -1;
93098 + /* If file has the correct end-marker, the expected odd size, and the
93099 + ** SQLite DB type marker where the end-marker puts it, then it
93102 + rc = pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), iMark);
93110 - iPrev = iStart;
93115 -/* Free and reclaim all the memory used by a previously compiled
93116 -** regular expression. Applications should invoke this routine once
93117 -** for every call to re_compile() to avoid memory leaks.
93122 -static void re_free(ReCompiled *pRe){
93123 - if( pRe ){
93124 - sqlite3_free(pRe->aOp);
93125 - sqlite3_free(pRe->aArg);
93126 - sqlite3_free(pRe);
93131 + || SQLITE_OK!=pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0)
93141 -** Compile a textual regular expression in zIn[] into a compiled regular
93142 -** expression suitable for us by re_match() and return a pointer to the
93143 -** compiled regular expression in *ppRe. Return NULL on success or an
93144 -** error message if something goes wrong.
93147 -static const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
93148 - ReCompiled *pRe;
93149 - const char *zErr;
93150 - int i, j;
93168 + return pBaseVfs->xOpen(pBaseVfs, zName, pFile, flags, pOutFlags);
93171 + pFile->pMethods = &apnd_io_methods;
93172 + pApndFile->iMark = -1; /* Append mark not yet written */
93174 - *ppRe = 0;
93175 - pRe = sqlite3_malloc( sizeof(*pRe) );
93176 - if( pRe==0 ){
93177 - return "out of memory";
93178 + rc = pBaseVfs->xOpen(pBaseVfs, zName, pBaseFile, flags, pOutFlags);
93180 + rc = pBaseFile->pMethods->xFileSize(pBaseFile, &sz);
93182 + pBaseFile->pMethods->xClose(pBaseFile);
93185 - memset(pRe, 0, sizeof(*pRe));
93186 - pRe->xNextChar = noCase ? re_next_char_nocase : re_next_char;
93187 - if( re_resize(pRe, 30) ){
93188 - re_free(pRe);
93189 - return "out of memory";
93191 + pFile->pMethods = 0;
93194 - if( zIn[0]=='^' ){
93195 - zIn++;
93196 - }else{
93197 - re_append(pRe, RE_OP_ANYSTAR, 0);
93199 + /* The file being opened appears to be just an ordinary DB. Copy
93200 + ** the base dispatch-table so this instance mimics the base VFS.
93202 + memmove(pApndFile, pBaseFile, pBaseVfs->szOsFile);
93205 - pRe->sIn.z = (unsigned char*)zIn;
93206 - pRe->sIn.i = 0;
93207 - pRe->sIn.mx = (int)strlen(zIn);
93208 - zErr = re_subcompile_re(pRe);
93209 - if( zErr ){
93210 - re_free(pRe);
93211 - return zErr;
93212 + pApndFile->iPgOne = apndReadMark(sz, pFile);
93213 + if( pApndFile->iPgOne>=0 ){
93214 + pApndFile->iMark = sz - APND_MARK_SIZE; /* Append mark found */
93217 - if( rePeek(pRe)=='$' && pRe->sIn.i+1>=pRe->sIn.mx ){
93218 - re_append(pRe, RE_OP_MATCH, RE_EOF);
93219 - re_append(pRe, RE_OP_ACCEPT, 0);
93220 - *ppRe = pRe;
93221 - }else if( pRe->sIn.i>=pRe->sIn.mx ){
93222 - re_append(pRe, RE_OP_ACCEPT, 0);
93223 - *ppRe = pRe;
93225 + pBaseFile->pMethods->xClose(pBaseFile);
93227 + pFile->pMethods = 0;
93229 - re_free(pRe);
93230 - return "unrecognized character";
93231 - }
93232 -
93233 - /* The following is a performance optimization. If the regex begins with
93234 - ** ".*" (if the input regex lacks an initial "^") and afterwards there are
93235 - ** one or more matching characters, enter those matching characters into
93236 - ** zInit[]. The re_match() routine can then search ahead in the input
93237 - ** string looking for the initial match without having to run the whole
93238 - ** regex engine over the string. Do not worry able trying to match
93239 - ** unicode characters beyond plane 0 - those are very rare and this is
93240 - ** just an optimization. */
93241 - if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
93242 - for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
93243 - unsigned x = pRe->aArg[i];
93244 - if( x<=127 ){
93245 - pRe->zInit[j++] = (unsigned char)x;
93246 - }else if( x<=0xfff ){
93247 - pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
93248 - pRe->zInit[j++] = 0x80 | (x&0x3f);
93249 - }else if( x<=0xffff ){
93250 - pRe->zInit[j++] = (unsigned char)(0xd0 | (x>>12));
93251 - pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
93252 - pRe->zInit[j++] = 0x80 | (x&0x3f);
93253 - }else{
93254 - break;
93255 - }
93256 - }
93257 - if( j>0 && pRe->zInit[j-1]==0 ) j--;
93258 - pRe->nInit = j;
93262 + ** Until then, paf->iMark value indicates it is not yet written.
93264 + pApndFile->iPgOne = APND_START_ROUNDUP(sz);
93266 - return pRe->zErr;
93271 -** Implementation of the regexp() SQL function. This function implements
93272 -** the build-in REGEXP operator. The first argument to the function is the
93273 -** pattern and the second argument is the string. So, the SQL statements:
93274 -**
93275 -** A REGEXP B
93276 -**
93277 -** is implemented as regexp(B,A).
93283 -static void re_sql_func(
93284 - sqlite3_context *context,
93285 - int argc,
93286 - sqlite3_value **argv
93287 -){
93288 - ReCompiled *pRe; /* Compiled regular expression */
93289 - const char *zPattern; /* The regular expression */
93290 - const unsigned char *zStr;/* String being searched */
93291 - const char *zErr; /* Compile error message */
93292 - int setAux = 0; /* True to invoke sqlite3_set_auxdata() */
93293 -
93294 - (void)argc; /* Unused */
93295 - pRe = sqlite3_get_auxdata(context, 0);
93296 - if( pRe==0 ){
93297 - zPattern = (const char*)sqlite3_value_text(argv[0]);
93298 - if( zPattern==0 ) return;
93299 - zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
93300 - if( zErr ){
93301 - re_free(pRe);
93302 - sqlite3_result_error(context, zErr, -1);
93303 - return;
93304 - }
93305 - if( pRe==0 ){
93306 - sqlite3_result_error_nomem(context);
93307 - return;
93308 - }
93309 - setAux = 1;
93310 - }
93311 - zStr = (const unsigned char*)sqlite3_value_text(argv[1]);
93312 - if( zStr!=0 ){
93313 - sqlite3_result_int(context, re_match(pRe, zStr, -1));
93314 - }
93315 - if( setAux ){
93316 - sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
93317 - }
93319 + return ORIGVFS(pVfs)->xDelete(ORIGVFS(pVfs), zPath, dirSync);
93323 -** Invoke this routine to register the regexp() function with the
93324 -** SQLite database connection.
93325 +** All other VFS methods are pass-thrus.
93333 + return ORIGVFS(pVfs)->xAccess(ORIGVFS(pVfs), zPath, flags, pResOut);
93341 + return ORIGVFS(pVfs)->xFullPathname(ORIGVFS(pVfs),zPath,nOut,zOut);
93344 + return ORIGVFS(pVfs)->xDlOpen(ORIGVFS(pVfs), zPath);
93347 + ORIGVFS(pVfs)->xDlError(ORIGVFS(pVfs), nByte, zErrMsg);
93350 + return ORIGVFS(pVfs)->xDlSym(ORIGVFS(pVfs), p, zSym);
93353 + ORIGVFS(pVfs)->xDlClose(ORIGVFS(pVfs), pHandle);
93356 + return ORIGVFS(pVfs)->xRandomness(ORIGVFS(pVfs), nByte, zBufOut);
93359 + return ORIGVFS(pVfs)->xSleep(ORIGVFS(pVfs), nMicro);
93362 + return ORIGVFS(pVfs)->xCurrentTime(ORIGVFS(pVfs), pTimeOut);
93365 + return ORIGVFS(pVfs)->xGetLastError(ORIGVFS(pVfs), a, b);
93368 + return ORIGVFS(pVfs)->xCurrentTimeInt64(ORIGVFS(pVfs), p);
93375 + return ORIGVFS(pVfs)->xSetSystemCall(ORIGVFS(pVfs),zName,pCall);
93381 + return ORIGVFS(pVfs)->xGetSystemCall(ORIGVFS(pVfs),zName);
93384 + return ORIGVFS(pVfs)->xNextSystemCall(ORIGVFS(pVfs), zName);
93391 -int sqlite3_regexp_init(
93397 sqlite3 *db,
93404 - (void)pzErrMsg; /* Unused */
93405 - rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
93406 - 0, re_sql_func, 0, 0);
93408 + (void)db;
93411 + apnd_vfs.iVersion = pOrig->iVersion;
93413 + apnd_vfs.szOsFile = pOrig->szOsFile + sizeof(ApndFile);
93417 - /* The regexpi(PATTERN,STRING) function is a case-insensitive version
93418 - ** of regexp(PATTERN,STRING). */
93419 - rc = sqlite3_create_function(db, "regexpi", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
93420 - (void*)db, re_sql_func, 0, 0);
93428 -/************************* End ../ext/misc/regexp.c ********************/
93434 @@ -8001,9 +7977,14 @@ static int zipfileFilter(
93441 assert( pTab->pFirstEntry==0 );
93447 pCsr->pFreeEntry = pTab->pFirstEntry;
93448 pTab->pFirstEntry = pTab->pLastEntry = 0;
93449 @@ -8677,7 +8658,7 @@ static int zipfileBufferGrow(ZipfileBuffer *pBuf, int nByte){
93453 -void zipfileStep(sqlite3_context *pCtx, int nVal, sqlite3_value **apVal){
93458 @@ -8852,7 +8833,7 @@ void zipfileStep(sqlite3_context *pCtx, int nVal, sqlite3_value **apVal){
93462 -void zipfileFinal(sqlite3_context *pCtx){
93467 @@ -8909,6 +8890,10 @@ static int zipfileRegister(sqlite3 *db){
93477 int rc = sqlite3_create_module(db, "zipfile" , &zipfileModule, 0);
93478 @@ -9941,17 +9926,25 @@ static int idxGetTableInfo(
93482 - int nTab = STRLEN(zTab);
93483 - int nByte = sizeof(IdxTable) + nTab + 1;
93495 rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab);
93505 db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0
93506 @@ -9978,7 +9971,9 @@ static int idxGetTableInfo(
93510 - int nCopy = STRLEN(zCol) + 1;
93514 pNew->aCol[nCol].zName = pCsr;
93515 pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1);
93517 @@ -10130,6 +10125,7 @@ static int idxFindCompatible(
93524 for(pIter=pEq; pIter; pIter=pIter->pLink) pIter->bFlag = 0;
93525 @@ -10412,7 +10408,7 @@ static void idxWriteFree(IdxWrite *pTab){
93529 -int idxFindIndexes(
93534 @@ -10541,6 +10537,7 @@ static int idxProcessOneTrigger(
93535 rc = idxPrintfPrepareStmt(p->db, &pSelect, pzErr, zSql, zTab, zTab);
93539 rc = sqlite3_exec(p->dbv, zCreate, 0, 0, pzErr);
93542 @@ -10643,8 +10640,9 @@ static int idxCreateVtabSchema(sqlite3expert *p, char **pzErrmsg){
93548 - rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg);
93549 + if( zSql ) rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg);
93552 rc = idxGetTableInfo(p->db, zName, &pTab, pzErrmsg);
93553 @@ -10781,6 +10779,7 @@ static void idxRemFunc(
93558 if( nByte>pSlot->nByte ){
93559 char *zNew = (char*)sqlite3_realloc(pSlot->z, nByte*2);
93561 @@ -10792,9 +10791,11 @@ static void idxRemFunc(
93563 pSlot->n = nByte;
93564 if( pSlot->eType==SQLITE_BLOB ){
93565 - memcpy(pSlot->z, sqlite3_value_blob(argv[1]), nByte);
93567 + if( pData ) memcpy(pSlot->z, pData, nByte);
93569 - memcpy(pSlot->z, sqlite3_value_text(argv[1]), nByte);
93571 + memcpy(pSlot->z, pData, nByte);
93575 @@ -11005,6 +11006,7 @@ static int idxPopulateStat1(sqlite3expert *p, char **pzErr){
93580 if( p->iSample<100 && iPrev!=iRowid ){
93581 samplectx.target = (double)p->iSample / 100.0;
93582 samplectx.iTarget = p->iSample;
93583 @@ -11071,14 +11073,14 @@ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){
93585 /* Copy the entire schema of database [db] into [dbm]. */
93587 - sqlite3_stmt *pSql;
93589 rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg,
93595 - rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg);
93596 + if( zSql ) rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg);
93600 @@ -12165,6 +12167,15 @@ struct EQPGraph {
93616 @@ -12183,8 +12194,10 @@ struct ShellState {
93619 u8 bSafeModePersist; /* The long-term value of bSafeMode */
93627 @@ -12237,8 +12250,18 @@ struct ShellState {
93628 char *zNonce; /* Nonce for temporary safe-mode excapes */
93646 @@ -12279,7 +12302,7 @@ struct ShellState {
93648 #define SHFLG_Newlines 0x00000010 /* .dump --newline flag */
93650 -#define SHFLG_Echo 0x00000040 /* .echo or --echo setting */
93651 +#define SHFLG_Echo 0x00000040 /* .echo on/off, or --echo setting */
93655 @@ -12311,6 +12334,8 @@ struct ShellState {
93657 #define MODE_Table 15 /* MySQL-style table formatting */
93658 #define MODE_Box 16 /* Unicode box-drawing characters */
93664 @@ -12329,7 +12354,9 @@ static const char *modeDescr[] = {
93668 - "box"
93675 @@ -12345,6 +12372,12 @@ static const char *modeDescr[] = {
93688 @@ -12829,6 +12862,7 @@ static void output_csv(ShellState *p, const char *z, int bSep){
93690 if( i==0 || strstr(z, p->colSeparator)!=0 ){
93696 @@ -12892,7 +12926,11 @@ static int safeModeAuth(
93708 @@ -13003,7 +13041,7 @@ static void eqp_append(ShellState *p, int iEqpId, int p2, const char *zText…
93709 utf8_printf(p->out, "%d,%d,%s\n", iEqpId, p2, zText);
93712 - if( pNew==0 ) shell_out_of_memory();
93714 pNew->iEqpId = iEqpId;
93715 pNew->iParentId = p2;
93716 memcpy(pNew->zText, zText, nText+1);
93717 @@ -13151,6 +13189,10 @@ static int shell_callback(
93720 switch( p->cMode ){
93728 @@ -13220,6 +13262,7 @@ static int shell_callback(
93736 @@ -13351,6 +13394,7 @@ static int shell_callback(
93737 if( i>0 ) raw_printf(p->out, ",");
93741 utf8_printf(p->out, "%s", z);
93744 @@ -13382,7 +13426,12 @@ static int shell_callback(
93746 raw_printf(p->out, "-1e999");
93748 - sqlite3_snprintf(50,z,"%!.20g", r);
93755 raw_printf(p->out, "%s", z);
93757 }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
93758 @@ -13596,7 +13645,7 @@ static void set_table_name(ShellState *p, const char *zName){
93761 z = p->zDestTable = malloc( n+1 );
93762 - if( z==0 ) shell_out_of_memory();
93767 @@ -13607,6 +13656,47 @@ static void set_table_name(ShellState *p, const char *zName){
93780 +static char *shell_error_context(const char *zSql, sqlite3 *db){
93786 + if( db==0
93788 + || (iOffset = sqlite3_error_offset(db))<0
93793 + iOffset--;
93795 + while( (zSql[0]&0xc0)==0x80 ){ zSql++; iOffset--; }
93800 + while( (zSql[len]&0xc0)==0x80 ) len--;
93805 + zMsg = sqlite3_mprintf("\n %z\n %*s^--- error here", zCode, iOffset, "");
93807 + zMsg = sqlite3_mprintf("\n %z\n %*serror here ---^", zCode, iOffset-14, "");
93815 @@ -13629,8 +13719,10 @@ static int run_table_dump_query(
93817 rc = sqlite3_prepare_v2(p->db, zSelect, -1, &pSelect, 0);
93819 - utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n", rc,
93820 - sqlite3_errmsg(p->db));
93821 + char *zContext = shell_error_context(zSelect, p->db);
93822 + utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n%s", rc,
93823 + sqlite3_errmsg(p->db), zContext);
93825 if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
93828 @@ -13665,12 +13757,25 @@ static int run_table_dump_query(
93831 sqlite3 *db, /* Database to query */
93832 - const char *zWhen, /* Qualifier (format) wrapper */
93833 - int rc /* Error code returned from API */
93838 - if( zWhen==0 )
93839 - zWhen = "%s (%d)";
93840 - return sqlite3_mprintf(zWhen, sqlite3_errmsg(db), rc);
93844 + sqlite3_str_appendf(pStr, "%s, %s", zPhase, sqlite3_errmsg(db));
93848 + zContext = shell_error_context(zSql, db);
93859 @@ -13848,6 +13953,7 @@ static int display_stats(
93862 if( pArg->pStmt ){
93864 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP,
93866 raw_printf(pArg->out, "Fullscan Steps: %d\n", iCur);
93867 @@ -13855,6 +13961,12 @@ static int display_stats(
93868 raw_printf(pArg->out, "Sort Operations: %d\n", iCur);
93869 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset);
93870 raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur);
93871 + iHit = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_HIT, bReset);
93872 + iMiss = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_MISS, bReset);
93874 + raw_printf(pArg->out, "Bloom filter bypass taken: %d/%d\n",
93877 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
93878 raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur);
93879 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset);
93880 @@ -13947,6 +14059,9 @@ static int str_in_array(const char *zStr, const char **azArray){
93885 +** See tag-20220407a in wherecode.c and vdbe.c.
93890 @@ -13961,7 +14076,8 @@ static void explain_data_prepare(ShellState *p, sqlite3_stmt *pSql){
93891 int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */
93892 int iOp; /* Index of operation in p->aiIndent[] */
93894 - const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 };
93900 @@ -14011,15 +14127,15 @@ static void explain_data_prepare(ShellState *p, sqlite3_stmt *pSql){
93903 p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int));
93904 - if( p->aiIndent==0 ) shell_out_of_memory();
93905 + shell_check_oom(p->aiIndent);
93907 - if( abYield==0 ) shell_out_of_memory();
93911 p->aiIndent[iOp] = 0;
93912 p->nIndent = iOp+1;
93914 - if( str_in_array(zOp, azNext) ){
93916 for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
93918 if( str_in_array(zOp, azGoto) && p2op<p->nIndent
93919 @@ -14045,7 +14161,7 @@ static void explain_data_delete(ShellState *p){
93923 -** Disable and restore .wheretrace and .selecttrace settings.
93928 @@ -14189,7 +14305,134 @@ static void print_box_row_separator(
93929 fputs("\n", p->out);
93947 + u8 bWordWrap /* If true, avoid breaking mid-word */
93959 + if( mxWidth<0 ) mxWidth = -mxWidth;
93980 + for(k=i; k>i/2; k--){
93981 + if( isspace(z[k-1]) ) break;
93984 + for(k=i; k>i/2; k--){
93985 + if( isalnum(z[k-1])!=isalnum(z[k]) && (z[k]&0xc0)!=0x80 ) break;
94029 +/* Extract the value of the i-th current column for pStmt as an SQL literal
94063 @@ -14209,12 +14452,21 @@ static void exec_prepared_stmt_columnar(
94079 + int bw = p->cmOpts.bWordWrap;
94081 + const char *zShowNull = p->nullValue;
94085 @@ -14222,25 +14474,20 @@ static void exec_prepared_stmt_columnar(
94089 - if( azData==0 ) shell_out_of_memory();
94090 - for(i=0; i<nColumn; i++){
94091 - azData[i] = strdup(sqlite3_column_name(pStmt,i));
94092 - }
94093 - do{
94094 - if( (nRow+2)*nColumn >= nAlloc ){
94095 - nAlloc *= 2;
94096 - azData = sqlite3_realloc64(azData, nAlloc*sizeof(char*));
94097 - if( azData==0 ) shell_out_of_memory();
94098 - }
94099 - nRow++;
94100 - for(i=0; i<nColumn; i++){
94101 - z = (const char*)sqlite3_column_text(pStmt,i);
94102 - azData[nRow*nColumn + i] = z ? strdup(z) : 0;
94103 - }
94104 - }while( sqlite3_step(pStmt)==SQLITE_ROW );
94109 + if( p->cmOpts.bQuote ){
94116 if( nColumn>p->nWidth ){
94117 p->colWidth = realloc(p->colWidth, (nColumn+1)*2*sizeof(int));
94118 - if( p->colWidth==0 ) shell_out_of_memory();
94119 + shell_check_oom(p->colWidth);
94120 for(i=p->nWidth; i<nColumn; i++) p->colWidth[i] = 0;
94121 p->nWidth = nColumn;
94122 p->actualWidth = &p->colWidth[nColumn];
94123 @@ -14251,10 +14498,58 @@ static void exec_prepared_stmt_columnar(
94124 if( w<0 ) w = -w;
94125 p->actualWidth[i] = w;
94129 + int wx = p->colWidth[i];
94131 + wx = p->cmOpts.iWrap;
94133 + if( wx<0 ) wx = -wx;
94150 + int wx = p->colWidth[i];
94152 + wx = p->cmOpts.iWrap;
94154 + if( wx<0 ) wx = -wx;
94158 + }else if( p->cmOpts.bQuote ){
94170 + abRowDiv[nRow-1] = 0;
94178 - if( z==0 ) z = p->nullValue;
94182 if( n>p->actualWidth[j] ) p->actualWidth[j] = n;
94183 @@ -14333,6 +14628,15 @@ static void exec_prepared_stmt_columnar(
94184 utf8_width_print(p->out, w, z);
94185 if( j==nColumn-1 ){
94186 utf8_printf(p->out, "%s", rowSep);
94187 + if( bMultiLineRowExists && abRowDiv[i/nColumn-1] && i+1<nTotal ){
94188 + if( p->cMode==MODE_Table ){
94190 + }else if( p->cMode==MODE_Box ){
94192 + }else if( p->cMode==MODE_Column ){
94193 + raw_printf(p->out, "\n");
94196 j = -1;
94199 @@ -14349,8 +14653,17 @@ columnar_end:
94200 utf8_printf(p->out, "Interrupt\n");
94203 - for(i=0; i<nData; i++) free(azData[i]);
94218 @@ -14361,6 +14674,7 @@ static void exec_prepared_stmt(
94224 if( pArg->cMode==MODE_Column
94225 || pArg->cMode==MODE_Table
94226 @@ -14393,10 +14707,14 @@ static void exec_prepared_stmt(
94234 - if( x==SQLITE_BLOB && pArg && pArg->cMode==MODE_Insert ){
94237 + && (pArg->cMode==MODE_Insert || pArg->cMode==MODE_Quote)
94242 @@ -14420,6 +14738,11 @@ static void exec_prepared_stmt(
94244 if( pArg->cMode==MODE_Json ){
94245 fputs("]\n", pArg->out);
94246 + }else if( pArg->cMode==MODE_Count ){
94254 @@ -14543,7 +14866,7 @@ static int expertDotCommand(
94256 pState->expert.pExpert = sqlite3_expert_new(pState->db, &zErr);
94257 if( pState->expert.pExpert==0 ){
94258 - raw_printf(stderr, "sqlite3_expert_new: %s\n", zErr);
94263 @@ -14551,6 +14874,7 @@ static int expertDotCommand(
94271 @@ -14592,7 +14916,7 @@ static int shell_exec(
94272 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
94275 - *pzErrMsg = save_err_msg(db, "in prepare, %s (%d)", rc);
94276 + *pzErrMsg = save_err_msg(db, "in prepare", rc, zSql);
94280 @@ -14611,11 +14935,6 @@ static int shell_exec(
94281 pArg->cnt = 0;
94284 - /* echo the sql statement if echo on */
94285 - if( pArg && ShellHasFlag(pArg, SHFLG_Echo) ){
94286 - utf8_printf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
94287 - }
94288 -
94290 if( pArg && pArg->autoEQP && sqlite3_stmt_isexplain(pStmt)==0 ){
94292 @@ -14627,6 +14946,7 @@ static int shell_exec(
94293 sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 1, 0);
94297 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
94300 @@ -14644,6 +14964,7 @@ static int shell_exec(
94301 if( pArg->autoEQP>=AUTOEQP_full ){
94305 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
94307 pArg->cMode = MODE_Explain;
94308 @@ -14706,7 +15027,7 @@ static int shell_exec(
94312 - *pzErrMsg = save_err_msg(db, "stepping, %s (%d)", rc);
94313 + *pzErrMsg = save_err_msg(db, "stepping", rc, 0);
94317 @@ -14756,6 +15077,7 @@ static char **tableColumnList(ShellState *p, const char *zTab){
94322 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
94325 @@ -14763,9 +15085,10 @@ static char **tableColumnList(ShellState *p, const char *zTab){
94326 if( nCol>=nAlloc-2 ){
94329 - if( azCol==0 ) shell_out_of_memory();
94337 @@ -14799,6 +15122,7 @@ static char **tableColumnList(ShellState *p, const char *zTab){
94342 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
94345 @@ -14890,6 +15214,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUs…
94350 utf8_printf(p->out, "%s\n", zIns);
94353 @@ -15008,13 +15333,14 @@ static int run_schema_dump_query(
94357 -** with ".". Subsequent lines are supplimental information.
94364 -#if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
94369 " -c, --create Create a new archive",
94370 @@ -15040,19 +15366,28 @@ static const char *(azHelp[]) = {
94375 ".backup ?DB? FILE Backup DB (default \"main\") to FILE",
94377 " --append Use the appendvfs",
94378 " --async Write to FILE without journal and fsync()",
94394 ".dbinfo ?DB? Show status information about the database",
94398 " --data-only Output only INSERT statements",
94399 @@ -15069,9 +15404,13 @@ static const char *(azHelp[]) = {
94405 " --bom Put a UTF8 byte-order mark on intermediate file",
94408 ".exit ?CODE? Exit this program with return-code CODE",
94413 @@ -15080,11 +15419,13 @@ static const char *(azHelp[]) = {
94414 ".fullschema ?--indent? Show schema and the content of sqlite_stat tables",
94416 ".help ?-all? ?PATTERN? Show help text for PATTERN",
94420 " --ascii Use \\037 and \\036 as column and row separators",
94421 " --csv Use , and \\n as column and row separators",
94422 " --skip N Skip the first N rows of input",
94423 + " --schema S Target table to be S.TABLE",
94424 " -v \"Verbose\" - increase auxiliary output",
94427 @@ -15093,6 +15434,7 @@ static const char *(azHelp[]) = {
94435 @@ -15106,39 +15448,53 @@ static const char *(azHelp[]) = {
94438 " fkey-indexes Find missing foreign key indexes",
94439 -#ifndef SQLITE_OMIT_LOAD_EXTENSION
94445 - ".mode MODE ?TABLE? Set output mode",
94449 - " ascii Columns/rows delimited by 0x1F and 0x1E",
94450 - " box Tables using unicode box-drawing characters",
94451 - " csv Comma-separated values",
94452 - " column Output in columns. (See .width)",
94453 - " html HTML <table> code",
94454 - " insert SQL insert statements for TABLE",
94455 - " json Results in a JSON array",
94456 - " line One value per line",
94457 - " list Values delimited by \"|\"",
94458 - " markdown Markdown table format",
94459 - " quote Escape answers as for SQL",
94460 - " table ASCII-art table",
94461 - " tabs Tab-separated values",
94462 - " tcl TCL list elements",
94463 - ".nonce STRING Disable safe mode for one command if the nonce matches",
94465 + " box Tables using unicode box-drawing characters",
94466 + " csv Comma-separated values",
94474 + " qbox Shorthand for \"box --width 60 --quote\"",
94476 + " table ASCII-art table",
94477 + " tabs Tab-separated values",
94480 + " --wrap N Wrap output lines to no longer than N characters",
94481 + " --wordwrap B Wrap or not at word boundaries per B (on/off)",
94482 + " --ww Shorthand for \"--wordwrap 1\"",
94483 + " --quote Quote output text as SQL literals",
94484 + " --noquote Do not quote output text",
94493 " --bom Put a UTF8 byte-order mark at the beginning",
94494 " -e Send output to the system text editor",
94495 " -x Send output as CSV to a spreadsheet (same as \".excel\")",
94496 -#ifdef SQLITE_DEBUG
94497 - ".oom ?--repeat M? ?N? Simulate an OOM error on the N-th allocation",
94498 -#endif
94504 " --append Use appendvfs to append database to the end of FILE",
94507 " --deserialize Load into memory using sqlite3_deserialize()",
94508 " --hexdb Load the output of \"dbtotxt\" as an in-memory db",
94509 @@ -15148,12 +15504,14 @@ static const char *(azHelp[]) = {
94510 " --nofollow Do not follow symbolic links",
94511 " --readonly Open FILE readonly",
94512 " --zip FILE is a ZIP archive",
94517 " --bom Prefix output with a UTF8 byte-order mark",
94518 " -e Send output to the system text editor",
94519 " -x Send output as CSV to a spreadsheet",
94524 @@ -15170,8 +15528,11 @@ static const char *(azHelp[]) = {
94525 " --reset Reset the count for each input and interrupt",
94530 - ".read FILE Read input from FILE",
94535 ".recover Recover as much data as possible from corrupt db.",
94536 " --freelist-corrupt Assume the freelist is corrupt",
94537 @@ -15180,8 +15541,10 @@ static const char *(azHelp[]) = {
94538 " --no-rowids Do not attempt to recover rowid values",
94542 ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE",
94543 - ".save FILE Write in-memory database into FILE",
94549 @@ -15215,7 +15578,7 @@ static const char *(azHelp[]) = {
94550 " --sha3-384 Use the sha3-384 algorithm",
94551 " --sha3-512 Use the sha3-512 algorithm",
94553 -#ifndef SQLITE_NOHAVE_SYSTEM
94558 @@ -15224,11 +15587,13 @@ static const char *(azHelp[]) = {
94562 -#ifndef SQLITE_NOHAVE_SYSTEM
94568 ".testcase NAME Begin redirecting output to 'testcase-out.txt'",
94573 @@ -15291,6 +15656,7 @@ static int showHelp(FILE *out, const char *zPattern){
94581 @@ -15313,6 +15679,7 @@ static int showHelp(FILE *out, const char *zPattern){
94589 @@ -15501,10 +15868,7 @@ static unsigned char *readHexDb(ShellState *p, int *pnData){
94590 if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error;
94591 n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */
94593 - if( a==0 ){
94594 - utf8_printf(stderr, "Out of memory!\n");
94595 - goto readHexDb_error;
94596 - }
94599 if( pgsz<512 || pgsz>65536 || (pgsz & (pgsz-1))!=0 ){
94601 @@ -15635,7 +15999,7 @@ static void shellEscapeCrnl(
94605 - if( zText[0]=='\'' ){
94610 @@ -15774,20 +16138,24 @@ static void open_db(ShellState *p, int openFlags){
94612 sqlite3_enable_load_extension(p->db, 1);
94614 - sqlite3_fileio_init(p->db, 0, 0);
94615 sqlite3_shathree_init(p->db, 0, 0);
94616 - sqlite3_completion_init(p->db, 0, 0);
94617 sqlite3_uint_init(p->db, 0, 0);
94618 sqlite3_decimal_init(p->db, 0, 0);
94619 sqlite3_regexp_init(p->db, 0, 0);
94620 sqlite3_ieee_init(p->db, 0, 0);
94621 sqlite3_series_init(p->db, 0, 0);
94623 + sqlite3_fileio_init(p->db, 0, 0);
94624 + sqlite3_completion_init(p->db, 0, 0);
94627 sqlite3_dbdata_init(p->db, 0, 0);
94630 - sqlite3_zipfile_init(p->db, 0, 0);
94631 - sqlite3_sqlar_init(p->db, 0, 0);
94632 + if( !p->bSafeModePersist ){
94633 + sqlite3_zipfile_init(p->db, 0, 0);
94634 + sqlite3_sqlar_init(p->db, 0, 0);
94637 sqlite3_create_function(p->db, "shell_add_schema", 3, SQLITE_UTF8, 0,
94639 @@ -15812,6 +16180,7 @@ static void open_db(ShellState *p, int openFlags){
94640 if( p->openMode==SHELL_OPEN_ZIPFILE ){
94644 sqlite3_exec(p->db, zSql, 0, 0, 0);
94647 @@ -15869,11 +16238,13 @@ static char *readline_completion_generator(const char *text, int state){
94652 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
94656 - zRet = strdup((const char*)sqlite3_column_text(pStmt, 0));
94662 @@ -15906,13 +16277,14 @@ static void linenoise_completion(const char *zLine, linenoiseCompletions …
94667 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
94673 - if( iStart+nCompletion < sizeof(zBuf)-1 ){
94674 + if( iStart+nCompletion < sizeof(zBuf)-1 && zCompletion ){
94678 @@ -16147,7 +16519,7 @@ static void import_append_char(ImportCtx *p, int c){
94679 if( p->n+1>=p->nAlloc ){
94680 p->nAlloc += p->nAlloc + 100;
94681 p->z = sqlite3_realloc64(p->z, p->nAlloc);
94682 - if( p->z==0 ) shell_out_of_memory();
94683 + shell_check_oom(p->z);
94685 p->z[p->n++] = (char)c;
94687 @@ -16299,6 +16671,7 @@ static void tryToCloneData(
94692 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
94695 @@ -16308,7 +16681,7 @@ static void tryToCloneData(
94699 - if( zInsert==0 ) shell_out_of_memory();
94704 @@ -16371,6 +16744,7 @@ static void tryToCloneData(
94709 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
94712 @@ -16407,6 +16781,7 @@ static void tryToCloneSchema(
94717 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
94720 @@ -16417,6 +16792,7 @@ static void tryToCloneSchema(
94728 @@ -16434,6 +16810,7 @@ static void tryToCloneSchema(
94733 rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
94736 @@ -16444,6 +16821,7 @@ static void tryToCloneSchema(
94744 @@ -16536,10 +16914,10 @@ static void output_reset(ShellState *p){
94748 -static int db_int(ShellState *p, const char *zSql){
94749 +static int db_int(sqlite3 *db, const char *zSql){
94752 - sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
94753 + sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
94757 @@ -16547,6 +16925,7 @@ static int db_int(ShellState *p, const char *zSql){
94763 ** Convert a 2-byte or 4-byte big-endian integer into a native integer
94765 @@ -16644,7 +17023,7 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){
94769 - int val = db_int(p, zSql);
94770 + int val = db_int(p->db, zSql);
94772 utf8_printf(p->out, "%-20s %d\n", aQuery[i].zName, val);
94774 @@ -16653,6 +17032,8 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){
94775 utf8_printf(p->out, "%-20s %u\n", "data version", iDataVersion);
94783 @@ -16828,9 +17209,7 @@ static void newTempFile(ShellState *p, const char *zSuffix){
94785 p->zTempFile = sqlite3_mprintf("%z.%s", p->zTempFile, zSuffix);
94787 - if( p->zTempFile==0 ){
94788 - shell_out_of_memory();
94789 - }
94790 + shell_check_oom(p->zTempFile);
94794 @@ -17011,14 +17390,14 @@ static int lintFkeyIndexes(
94800 rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
94804 - res = (
94805 - 0==sqlite3_strglob(zGlob, zPlan)
94806 - || 0==sqlite3_strglob(zGlobIPK, zPlan)
94807 - );
94813 @@ -18010,6 +18389,7 @@ static char *shellMPrintf(int *pRc, const char *zFmt, ...){
94821 @@ -18123,6 +18503,7 @@ static RecoverTable *recoverNewTable(
94823 pTab->iPk = sqlite3_column_int(pPkFinder, 0);
94829 @@ -18207,8 +18588,10 @@ static RecoverTable *recoverFindTable(
94833 - pRet = recoverNewTable(pRc, zName, zSql, bIntkey, nCol);
94834 - break;
94842 @@ -18603,6 +18986,224 @@ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){
94848 + * zAutoColumn(zCol, &db, ?) => Maybe init db, add column zCol to it.
94849 + * zAutoColumn(0, &db, ?) => (db!=0) Form columns spec for CREATE TABLE,
94850 + * close db and set it to 0, and return the columns spec, to later
94853 + * (a) The db was not initialized and zCol==0 (There are no columns.)
94854 + * (b) zCol!=0 (Column was added, db initialized as needed.)
94856 + * pointer is non-zero, its referent will be set to a summary of renames
94872 +#ifdef SHELL_COLFIX_DB /* If this is set, the DB can be in a file. */
94874 +#else /* Otherwise, memory is faster/better for the transient DB. */
94906 +SELECT count(DISTINCT (substring(name,1,nlen-chop)||suff) COLLATE NOCASE)\
94914 + nlen-length(rtrim(name, '"AUTOCOLUMN_SEP"0123456789')),\
94922 + WHERE substring(t.name,1,t.nlen-t.chop)=substring(d.name,1,d.nlen-d.chop)\
94980 + ','||iif((cpos-1)%4>0, ' ', x'0a'||' '))\
94983 + SELECT cpos, printf('\"%w\"',printf('%!.*s%s', nlen-chop,name,suff)) AS cname \
94988 + " printf('\"%w\" to \"%w\"',name,printf('%!.*s%s', nlen-chop, name, suff)),"
94996 + /* Add initial or additional column. Init db if necessary. */
95008 + rc = sqlite3_prepare_v2(*pDb, zTabFill, -1, &pStmt, 0);
95010 + rc = sqlite3_bind_text(pStmt, 1, zColNew, -1, 0);
95019 + /* Formulate the columns spec, close the DB, zero *pDb. */
95030 + rc = sqlite3_prepare_v2(*pDb, zRenameRank, -1, &pStmt, 0);
95038 + rc = sqlite3_prepare_v2(*pDb, zCollectVar, -1, &pStmt, 0);
95050 + if( SQLITE_OK==sqlite3_prepare_v2(*pDb, zRenamesDone, -1, &pStmt, 0)
95067 @@ -18672,7 +19273,8 @@ static int do_meta_command(char *zLine, ShellState *p){
95071 -#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB)
95077 @@ -18680,6 +19282,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95085 @@ -18748,6 +19351,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95093 @@ -18778,6 +19382,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95101 @@ -18797,6 +19402,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95109 @@ -18807,6 +19413,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95115 ** Then read the content of the testcase-out.txt file and compare against
95117 @@ -18831,7 +19438,9 @@ static int do_meta_command(char *zLine, ShellState *p){
95127 @@ -18841,6 +19450,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95135 @@ -18902,8 +19512,9 @@ static int do_meta_command(char *zLine, ShellState *p){
95141 - if( azName==0 ){ shell_out_of_memory(); /* Does not return */ }
95146 @@ -18965,11 +19576,11 @@ static int do_meta_command(char *zLine, ShellState *p){
95155 -#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB)
95159 @@ -18982,7 +19593,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95161 int savedShowHeader = p->showHeader;
95162 int savedShellFlags = p->shellFlgs;
95163 - ShellClearFlag(p,
95168 @@ -19128,10 +19739,12 @@ static int do_meta_command(char *zLine, ShellState *p){
95181 @@ -19159,8 +19772,15 @@ static int do_meta_command(char *zLine, ShellState *p){
95185 - open_db(p, 0);
95186 - expertDotCommand(p, azArg, nArg);
95187 + if( p->bSafeMode ){
95199 @@ -19379,8 +19999,10 @@ static int do_meta_command(char *zLine, ShellState *p){
95210 @@ -19389,24 +20011,22 @@ static int do_meta_command(char *zLine, ShellState *p){
95212 int nSep; /* Number of bytes in p->colSeparator[] */
95224 - sCtx.z = sqlite3_malloc64(120);
95225 - if( sCtx.z==0 ){
95226 - import_cleanup(&sCtx);
95227 - shell_out_of_memory();
95228 - }
95229 if( p->mode==MODE_Ascii ){
95237 if( z[0]=='-' && z[1]=='-' ) z++;
95238 @@ -19418,11 +20038,12 @@ static int do_meta_command(char *zLine, ShellState *p){
95240 utf8_printf(p->out, "ERROR: extra argument: \"%s\". Usage:\n", z);
95241 showHelp(p->out, "import");
95242 - rc = 1;
95245 }else if( strcmp(z,"-v")==0 ){
95247 + }else if( strcmp(z,"-schema")==0 && i<nArg-1 ){
95249 }else if( strcmp(z,"-skip")==0 && i<nArg-1 ){
95251 }else if( strcmp(z,"-ascii")==0 ){
95252 @@ -19438,7 +20059,6 @@ static int do_meta_command(char *zLine, ShellState *p){
95254 utf8_printf(p->out, "ERROR: unknown option: \"%s\". Usage:\n", z);
95255 showHelp(p->out, "import");
95256 - rc = 1;
95260 @@ -19446,7 +20066,6 @@ static int do_meta_command(char *zLine, ShellState *p){
95261 utf8_printf(p->out, "ERROR: missing %s argument. Usage:\n",
95263 showHelp(p->out, "import");
95264 - rc = 1;
95268 @@ -19458,21 +20077,18 @@ static int do_meta_command(char *zLine, ShellState *p){
95271 "Error: non-null column separator required for import\n");
95272 - rc = 1;
95276 - raw_printf(stderr,
95278 "Error: multi-character column separators not allowed"
95280 - rc = 1;
95283 nSep = strlen30(p->rowSeparator);
95286 "Error: non-null row separator required for import\n");
95287 - rc = 1;
95290 if( nSep==2 && p->mode==MODE_Csv && strcmp(p->rowSeparator,SEP_CrLf)==0 ){
95291 @@ -19486,7 +20102,6 @@ static int do_meta_command(char *zLine, ShellState *p){
95293 raw_printf(stderr, "Error: multi-character row separators not allowed"
95295 - rc = 1;
95298 sCtx.cColSep = p->colSeparator[0];
95299 @@ -19497,7 +20112,6 @@ static int do_meta_command(char *zLine, ShellState *p){
95303 - rc = 1;
95307 @@ -19510,8 +20124,6 @@ static int do_meta_command(char *zLine, ShellState *p){
95311 - rc = 1;
95312 - import_cleanup(&sCtx);
95316 @@ -19525,11 +20137,22 @@ static int do_meta_command(char *zLine, ShellState *p){
95317 output_c_string(p->out, zSep);
95318 utf8_printf(p->out, "\n");
95326 while( (nSkip--)>0 ){
95329 - zSql = sqlite3_mprintf("SELECT * FROM \"%w\"", zTable);
95330 - if( zSql==0 ){
95341 @@ -19537,43 +20160,51 @@ static int do_meta_command(char *zLine, ShellState *p){
95342 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
95344 if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(p->db))==0 ){
95345 - char *zCreate = sqlite3_mprintf("CREATE TABLE \"%w\"", zTable);
95346 - char cSep = '(';
95352 - zCreate = sqlite3_mprintf("%z%c\n \"%w\" TEXT", zCreate, cSep, sCtx.z);
95353 - cSep = ',';
95357 - if( cSep=='(' ){
95360 + utf8_printf((stdin_is_interactive && p->in==stdin)? p->out : stderr,
95373 - utf8_printf(stderr,"%s: empty file\n", sCtx.zFile);
95377 - zCreate = sqlite3_mprintf("%z\n)", zCreate);
95380 utf8_printf(p->out, "%s\n", zCreate);
95382 rc = sqlite3_exec(p->db, zCreate, 0, 0, 0);
95383 - sqlite3_free(zCreate);
95385 - utf8_printf(stderr, "CREATE TABLE \"%s\"(...) failed: %s\n", zTable,
95386 - sqlite3_errmsg(p->db));
95387 - import_cleanup(&sCtx);
95388 - rc = 1;
95389 - goto meta_command_exit;
95390 + utf8_printf(stderr, "%s failed:\n%s\n", zCreate, sqlite3_errmsg(p->db));
95395 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
95397 - sqlite3_free(zSql);
95400 utf8_printf(stderr,"Error: %s\n", sqlite3_errmsg(p->db));
95401 - import_cleanup(&sCtx);
95402 - rc = 1;
95403 - goto meta_command_exit;
95410 @@ -19583,7 +20214,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95414 - sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable);
95419 @@ -19595,14 +20226,13 @@ static int do_meta_command(char *zLine, ShellState *p){
95420 utf8_printf(p->out, "Insert using: %s\n", zSql);
95422 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
95423 - sqlite3_free(zSql);
95425 utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
95427 - import_cleanup(&sCtx);
95428 - rc = 1;
95429 - goto meta_command_exit;
95434 needCommit = sqlite3_get_autocommit(p->db);
95435 if( needCommit ) sqlite3_exec(p->db, "BEGIN", 0, 0, 0);
95437 @@ -19660,6 +20290,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95438 sCtx.nRow, sCtx.nErr, sCtx.nLine-1);
95445 @@ -19849,7 +20480,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95449 -#ifndef SQLITE_OMIT_LOAD_EXTENSION
95454 @@ -19871,6 +20502,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95462 @@ -19882,73 +20514,139 @@ static int do_meta_command(char *zLine, ShellState *p){
95463 p->pLog = output_file_open(zFile, 0);
95469 - const char *zMode = nArg>=2 ? azArg[1] : "";
95470 - int n2 = strlen30(zMode);
95471 - int c2 = zMode[0];
95472 - if( c2=='l' && n2>2 && strncmp(azArg[1],"lines",n2)==0 ){
95491 + /* Apply defaults for qbox pseudo-mods. If that
95492 + * overwrites already-set values, user was informed of this.
95501 + }else if( z[0]=='-' ){
95504 + " --noquote\n"
95505 + " --quote\n"
95506 + " --wordwrap on/off\n"
95507 + " --wrap N\n"
95508 + " --ww\n");
95518 + if( p->mode==MODE_Column
95519 + || (p->mode>=MODE_Markdown && p->mode<=MODE_Box)
95522 + (p->out,
95523 + "current output mode: %s --wrap %d --wordwrap %s --%squote\n",
95524 + modeDescr[p->mode], p->cmOpts.iWrap,
95525 + p->cmOpts.bWordWrap ? "on" : "off",
95526 + p->cmOpts.bQuote ? "" : "no");
95528 + raw_printf(p->out, "current output mode: %s\n", modeDescr[p->mode]);
95530 + zMode = modeDescr[p->mode];
95534 p->mode = MODE_Line;
95535 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
95536 - }else if( c2=='c' && strncmp(azArg[1],"columns",n2)==0 ){
95538 p->mode = MODE_Column;
95539 if( (p->shellFlgs & SHFLG_HeaderSet)==0 ){
95540 p->showHeader = 1;
95542 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
95543 - }else if( c2=='l' && n2>2 && strncmp(azArg[1],"list",n2)==0 ){
95544 + p->cmOpts = cmOpts;
95546 p->mode = MODE_List;
95547 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Column);
95548 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
95549 - }else if( c2=='h' && strncmp(azArg[1],"html",n2)==0 ){
95551 p->mode = MODE_Html;
95552 - }else if( c2=='t' && strncmp(azArg[1],"tcl",n2)==0 ){
95554 p->mode = MODE_Tcl;
95555 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Space);
95556 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
95557 - }else if( c2=='c' && strncmp(azArg[1],"csv",n2)==0 ){
95559 p->mode = MODE_Csv;
95560 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
95561 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_CrLf);
95562 - }else if( c2=='t' && strncmp(azArg[1],"tabs",n2)==0 ){
95564 p->mode = MODE_List;
95565 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Tab);
95566 - }else if( c2=='i' && strncmp(azArg[1],"insert",n2)==0 ){
95568 p->mode = MODE_Insert;
95569 - set_table_name(p, nArg>=3 ? azArg[2] : "table");
95570 - }else if( c2=='q' && strncmp(azArg[1],"quote",n2)==0 ){
95573 p->mode = MODE_Quote;
95574 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Comma);
95575 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row);
95576 - }else if( c2=='a' && strncmp(azArg[1],"ascii",n2)==0 ){
95578 p->mode = MODE_Ascii;
95579 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Unit);
95580 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Record);
95581 - }else if( c2=='m' && strncmp(azArg[1],"markdown",n2)==0 ){
95583 p->mode = MODE_Markdown;
95584 - }else if( c2=='t' && strncmp(azArg[1],"table",n2)==0 ){
95585 + p->cmOpts = cmOpts;
95587 p->mode = MODE_Table;
95588 - }else if( c2=='b' && strncmp(azArg[1],"box",n2)==0 ){
95589 + p->cmOpts = cmOpts;
95591 p->mode = MODE_Box;
95592 - }else if( c2=='j' && strncmp(azArg[1],"json",n2)==0 ){
95593 + p->cmOpts = cmOpts;
95595 + p->mode = MODE_Count;
95597 + p->mode = MODE_Off;
95599 p->mode = MODE_Json;
95600 - }else if( nArg==1 ){
95601 - raw_printf(p->out, "current output mode: %s\n", modeDescr[p->mode]);
95605 - "quote table tabs tcl\n");
95609 p->cMode = p->mode;
95617 }else if( p->zNonce==0 || strcmp(azArg[1],p->zNonce)!=0 ){
95618 - raw_printf(stderr, "line %d: incorrect nonce: \"%s\"\n", p->lineno, azArg[1]);
95620 + p->lineno, azArg[1]);
95623 p->bSafeMode = 0;
95624 @@ -19956,6 +20654,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95632 @@ -19967,35 +20666,8 @@ static int do_meta_command(char *zLine, ShellState *p){
95636 -#ifdef SQLITE_DEBUG
95637 - if( c=='o' && strcmp(azArg[0],"oom")==0 ){
95638 - int i;
95639 - for(i=1; i<nArg; i++){
95640 - const char *z = azArg[i];
95641 - if( z[0]=='-' && z[1]=='-' ) z++;
95642 - if( strcmp(z,"-repeat")==0 ){
95643 - if( i==nArg-1 ){
95644 - raw_printf(p->out, "missing argument on \"%s\"\n", azArg[i]);
95645 - rc = 1;
95646 - }else{
95647 - oomRepeat = (int)integerValue(azArg[++i]);
95648 - }
95649 - }else if( IsDigit(z[0]) ){
95650 - oomCounter = (int)integerValue(azArg[i]);
95651 - }else{
95652 - raw_printf(p->out, "unknown argument: \"%s\"\n", azArg[i]);
95653 - raw_printf(p->out, "Usage: .oom [--repeat N] [M]\n");
95654 - rc = 1;
95655 - }
95656 - }
95657 - if( rc==0 ){
95658 - raw_printf(p->out, "oomCounter = %d\n", oomCounter);
95659 - raw_printf(p->out, "oomRepeat = %d\n", oomRepeat);
95660 - }
95661 - }else
95662 -#endif /* SQLITE_DEBUG */
95663 -
95669 @@ -20004,6 +20676,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95670 /* Check for command-line arguments */
95677 @@ -20024,16 +20697,18 @@ static int do_meta_command(char *zLine, ShellState *p){
95679 p->szMax = integerValue(azArg[++iName]);
95681 - }else if( z[0]=='-' ){
95684 + if( z[0]=='-' ){
95688 - }else if( zNewFilename ){
95694 - zNewFilename = sqlite3_mprintf("%s", z);
95699 @@ -20049,15 +20724,25 @@ static int do_meta_command(char *zLine, ShellState *p){
95700 p->szMax = 0;
95703 - if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
95704 - if( newFlag && !p->bSafeMode ) shellDeleteFile(zNewFilename);
95705 + if( zFN || p->openMode==SHELL_OPEN_HEXDB ){
95706 + if( newFlag && zFN && !p->bSafeMode ) shellDeleteFile(zFN);
95708 if( p->bSafeMode
95709 && p->openMode!=SHELL_OPEN_HEXDB
95710 - && zNewFilename
95711 - && strcmp(zNewFilename,":memory:")!=0
95715 failIfSafeMode(p, "cannot open disk-based database files in safe mode");
95718 + /* WASM mode has its own sandboxed pseudo-filesystem. */
95726 p->pAuxDb->zDbFilename = zNewFilename;
95728 if( p->db==0 ){
95729 @@ -20074,6 +20759,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95737 @@ -20082,9 +20768,10 @@ static int do_meta_command(char *zLine, ShellState *p){
95741 - int bBOM = 0;
95742 - int bOnce = 0; /* 0: .output, 1: .once, 2: .excel */
95744 + unsigned char zBOM[4]; /* Byte-order mark to using if --bom is present */
95750 @@ -20097,7 +20784,10 @@ static int do_meta_command(char *zLine, ShellState *p){
95751 if( z[0]=='-' ){
95752 if( z[1]=='-' ) z++;
95753 if( strcmp(z,"-bom")==0 ){
95754 - bBOM = 1;
95759 }else if( c!='e' && strcmp(z,"-x")==0 ){
95761 }else if( c!='e' && strcmp(z,"-e")==0 ){
95762 @@ -20111,7 +20801,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95766 - if( zFile[0]=='|' ){
95771 @@ -20124,7 +20814,9 @@ static int do_meta_command(char *zLine, ShellState *p){
95775 - if( zFile==0 ) zFile = sqlite3_mprintf("stdout");
95780 p->outCount = 2;
95782 @@ -20151,6 +20843,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95783 zFile = sqlite3_mprintf("%s", p->zTempFile);
95790 @@ -20163,7 +20856,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95791 p->out = stdout;
95794 - if( bBOM ) fprintf(p->out,"\357\273\277");
95795 + if( zBOM[0] ) fwrite(zBOM, 1, 3, p->out);
95796 sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
95799 @@ -20176,12 +20869,13 @@ static int do_meta_command(char *zLine, ShellState *p){
95800 p->out = stdout;
95803 - if( bBOM ) fprintf(p->out,"\357\273\277");
95804 + if( zBOM[0] ) fwrite(zBOM, 1, 3, p->out);
95805 sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile);
95814 @@ -20247,7 +20941,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95818 - if( zSql==0 ) shell_out_of_memory();
95821 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
95823 @@ -20257,7 +20951,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95827 - if( zSql==0 ) shell_out_of_memory();
95829 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
95832 @@ -20278,7 +20972,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95836 - if( zSql==0 ) shell_out_of_memory();
95838 sqlite3_exec(p->db, zSql, 0, 0, 0);
95841 @@ -20351,10 +21045,13 @@ static int do_meta_command(char *zLine, ShellState *p){
95853 FILE *inSaved = p->in;
95854 int savedLineno = p->lineno;
95855 @@ -20389,7 +21086,9 @@ static int do_meta_command(char *zLine, ShellState *p){
95856 p->in = inSaved;
95857 p->lineno = savedLineno;
95865 @@ -20441,6 +21140,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95873 @@ -20504,6 +21204,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95881 @@ -20555,8 +21256,10 @@ static int do_meta_command(char *zLine, ShellState *p){
95885 - int bGlob = strchr(zName, '*') != 0 || strchr(zName, '?') != 0 ||
95886 - strchr(zName, '[') != 0;
95894 @@ -20594,7 +21297,9 @@ static int do_meta_command(char *zLine, ShellState *p){
95898 - if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){
95905 @@ -20719,7 +21424,8 @@ static int do_meta_command(char *zLine, ShellState *p){
95909 - pSession->azFilter[ii-1] = sqlite3_mprintf("%s", azCmd[ii]);
95910 + char *x = pSession->azFilter[ii-1] = sqlite3_mprintf("%s", azCmd[ii]);
95913 pSession->nFilter = ii-1;
95915 @@ -20791,6 +21497,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95916 sqlite3session_table_filter(pSession->p, session_filter, pSession);
95917 pAuxDb->nSession++;
95918 pSession->zName = sqlite3_mprintf("%s", zName);
95919 + shell_check_oom(pSession->zName);
95923 @@ -20884,11 +21591,12 @@ static int do_meta_command(char *zLine, ShellState *p){
95932 - char *zQuote = sqlite3_mprintf("%q", zSql);
95934 - sqlite3_free(zQuote);
95937 utf8_printf(p->out, "%s\n", zSql);
95938 @@ -21006,6 +21714,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95946 @@ -21046,6 +21755,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95954 @@ -21056,7 +21766,7 @@ static int do_meta_command(char *zLine, ShellState *p){
95958 -#ifndef SQLITE_NOHAVE_SYSTEM
95963 @@ -21069,15 +21779,15 @@ static int do_meta_command(char *zLine, ShellState *p){
95967 - for(i=2; i<nArg; i++){
95972 - x = system(zCmd);
95977 -#endif /* !defined(SQLITE_NOHAVE_SYSTEM) */
95982 @@ -21089,12 +21799,22 @@ static int do_meta_command(char *zLine, ShellState *p){
95985 utf8_printf(p->out, "%12.12s: %s\n","echo",
95986 - azBool[ShellHasFlag(p, SHFLG_Echo)]);
95988 utf8_printf(p->out, "%12.12s: %s\n","eqp", azBool[p->autoEQP&3]);
95989 utf8_printf(p->out, "%12.12s: %s\n","explain",
95990 p->mode==MODE_Explain ? "on" : p->autoExplain ? "auto" : "off");
95991 utf8_printf(p->out,"%12.12s: %s\n","headers", azBool[p->showHeader!=0]);
95992 - utf8_printf(p->out, "%12.12s: %s\n","mode", modeDescr[p->mode]);
95993 + if( p->mode==MODE_Column
95994 + || (p->mode>=MODE_Markdown && p->mode<=MODE_Box)
95997 + (p->out, "%12.12s: %s --wrap %d --wordwrap %s --%squote\n", "mode",
95998 + modeDescr[p->mode], p->cmOpts.iWrap,
95999 + p->cmOpts.bWordWrap ? "on" : "off",
96000 + p->cmOpts.bQuote ? "" : "no");
96002 + utf8_printf(p->out, "%12.12s: %s\n","mode", modeDescr[p->mode]);
96004 utf8_printf(p->out, "%12.12s: ", "nullvalue");
96005 output_c_string(p->out, p->nullValue);
96006 raw_printf(p->out, "\n");
96007 @@ -21209,12 +21929,12 @@ static int do_meta_command(char *zLine, ShellState *p){
96011 - if( azNew==0 ) shell_out_of_memory();
96017 - if( 0==azResult[nRow] ) shell_out_of_memory();
96022 @@ -21247,6 +21967,7 @@ static int do_meta_command(char *zLine, ShellState *p){
96027 /* Begin redirecting output to the file "testcase-out.txt" */
96030 @@ -21260,6 +21981,7 @@ static int do_meta_command(char *zLine, ShellState *p){
96031 sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "?");
96038 @@ -21829,7 +22551,7 @@ static QuickScanState quickscan(char *zLine, QuickScanState qss){
96042 - default: assert(0);
96047 @@ -21850,7 +22572,7 @@ static int line_is_command_terminator(char *zLine){
96051 - return quickscan(zLine,QSS_Start)==QSS_Start;
96056 @@ -21892,19 +22614,30 @@ static int runOneSqlLine(ShellState *p, char *zSql, FILE *in, int startli…
96060 - if( in!=0 || !stdin_is_interactive ){
96061 - sqlite3_snprintf(sizeof(zPrefix), zPrefix,
96062 - "Error: near line %d:", startline);
96067 + zErrorTail = sqlite3_errmsg(p->db);
96075 - sqlite3_snprintf(sizeof(zPrefix), zPrefix, "Error:");
96079 - if( zErrMsg!=0 ){
96080 - utf8_printf(stderr, "%s %s\n", zPrefix, zErrMsg);
96081 - sqlite3_free(zErrMsg);
96082 - zErrMsg = 0;
96087 - utf8_printf(stderr, "%s %s\n", zPrefix, sqlite3_errmsg(p->db));
96096 @@ -21916,6 +22649,42 @@ static int runOneSqlLine(ShellState *p, char *zSql, FILE *in, int startlin…
96101 + if( ShellHasFlag(p, SHFLG_Echo) ) utf8_printf(p->out, "%s\n", zDo);
96125 + if(nZ>0 && '\r'==zBegin[nZ-1]){
96126 + --nZ;
96139 @@ -21937,6 +22706,13 @@ static int process_input(ShellState *p){
96143 + if( p->inputNesting==MAX_INPUT_NESTING ){
96146 + " Check recursion.\n", MAX_INPUT_NESTING, p->lineno);
96149 + ++p->inputNesting;
96150 p->lineno = 0;
96151 while( errCnt==0 || !bail_on_error || (p->in==0 && stdin_is_interactive) ){
96152 fflush(p->out);
96153 @@ -21958,14 +22734,13 @@ static int process_input(ShellState *p){
96157 - if( ShellHasFlag(p, SHFLG_Echo) )
96158 - printf("%s\n", zLine);
96159 /* Just swallow single-line whitespace */
96165 - if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zLine);
96170 @@ -21983,7 +22758,7 @@ static int process_input(ShellState *p){
96171 /* Grow buffer by half-again increments when big. */
96174 - if( zSql==0 ) shell_out_of_memory();
96179 @@ -21998,6 +22773,7 @@ static int process_input(ShellState *p){
96184 errCnt += runOneSqlLine(p, zSql, p->in, startline);
96186 if( p->outCount ){
96187 @@ -22009,16 +22785,19 @@ static int process_input(ShellState *p){
96188 p->bSafeMode = p->bSafeModePersist;
96191 - if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zSql);
96197 - if( nSql && QSS_PLAINDARK(qss) ){
96201 errCnt += runOneSqlLine(p, zSql, p->in, startline);
96205 + --p->inputNesting;
96209 @@ -22115,6 +22894,7 @@ static void process_sqliterc(
96216 p->in = fopen(sqliterc,"rb");
96217 @@ -22151,7 +22931,7 @@ static const char zOptions[] =
96219 " -deserialize open the database using sqlite3_deserialize()\n"
96221 - " -echo print commands before execution\n"
96222 + " -echo print inputs before execution\n"
96223 " -init FILENAME read/process named file\n"
96224 " -[no]header turn headers on or off\n"
96226 @@ -22287,14 +23067,25 @@ static char *cmdline_option_value(int argc, char **argv, int i){
96252 @@ -22310,11 +23101,12 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
96262 -
96263 -#ifdef SQLITE_DEBUG
96264 - registerOomSimulator();
96268 @@ -22356,16 +23148,16 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
96275 - if( argv==0 ) shell_out_of_memory();
96279 - if( z==0 ) shell_out_of_memory();
96283 - if( argv[i]==0 ) shell_out_of_memory();
96288 @@ -22415,7 +23207,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
96292 - if( azCmd==0 ) shell_out_of_memory();
96294 azCmd[nCmd-1] = z;
96297 @@ -22571,7 +23363,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
96307 @@ -22837,6 +23631,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
96312 + /* In WASM mode we have to leave the db state in place so that
96316 if( data.db ){
96317 @@ -22863,5 +23660,136 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
96324 + (unsigned int)(sqlite3_memory_used()-mem_main_enter));
96342 + emcc ... --js-library somefile.js
96376 +** Returns the filename of the given db name, assuming "main" if
96386 +** Closes, unlinks, and reopens the db using its current filename (or
96387 +** the default if the db is currently closed). It is assumed, for
96394 + shellState.pAuxDb->zDbFilename = "/fiddle.sqlite3";
96401 + shellState.db = 0;
96402 + shellState.pAuxDb->zDbFilename = zFilename;
96411 +** emcc ..flags... -sEXPORTED_FUNCTIONS=_fiddle_exec -sEXPORTED_RUNTIME_METHODS=ccall,cwrap
96423 + "-bail",
96424 + "-safe"};
96426 + once = rc ? -1 : 1;
96429 + "SQLite version %s %.19s\n" /*extra-version-info*/,
96437 + if(shellState.db){
96440 + fprintf(stderr,"ERROR initializing db!\n");
96445 + puts("DB init failed. Not executing SQL.");
96454 diff --git a/src/third_party/sqlite/src/amalgamation/sqlite3.c b/src/third_party/sqlite/src/amalgam…
96456 --- a/src/third_party/sqlite/src/amalgamation/sqlite3.c
96458 @@ -1,6 +1,6 @@
96461 -** version 3.37.1. By combining all the individual C code files into this
96466 @@ -452,9 +452,9 @@ extern "C" {
96470 -#define SQLITE_VERSION "3.37.1"
96471 -#define SQLITE_VERSION_NUMBER 3037001
96472 -#define SQLITE_SOURCE_ID "2021-12-30 15:30:28 378629bf2ea546f73eee84063c5358439a12f7300e433f1…
96475 +#define SQLITE_SOURCE_ID "2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41…
96478 ** CAPI3REF: Run-Time Library Version Numbers
96479 @@ -872,7 +872,7 @@ SQLITE_API int sqlite3_exec(
96483 -#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8))
96488 @@ -4130,13 +4130,14 @@ SQLITE_API void sqlite3_free_filename(char*);
96491 ** change the value of the error code. The error-code preserving
96492 -** interfaces are:
96503 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
96504 @@ -4151,6 +4152,13 @@ SQLITE_API void sqlite3_free_filename(char*);
96513 +** SQL, then the sqlite3_error_offset() function returns -1.
96518 @@ -4170,6 +4178,7 @@ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
96522 +SQLITE_API int sqlite3_error_offset(sqlite3 *db);
96526 @@ -4581,6 +4590,10 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
96528 ** read-only no-op if the table already exists, but
96537 @@ -4649,6 +4662,8 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
96540 ** implementation of [application-defined SQL functions] are protected.
96546 @@ -5270,6 +5285,10 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
96547 ** even empty strings, are always zero-terminated. ^The return
96548 ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
96557 @@ -5283,7 +5302,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
96558 ** [application-defined SQL functions] or [virtual tables], not within
96559 ** top-level application code.
96561 -** The these routines may attempt to convert the datatype of the result.
96566 @@ -5308,7 +5327,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
96570 -** <tr><td> BLOB <td> TEXT <td> Add a zero terminator if needed
96575 @@ -5880,7 +5899,8 @@ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
96579 -** memory allocation fails.
96585 @@ -6562,6 +6582,28 @@ SQLITE_API int sqlite3_get_autocommit(sqlite3*);
96594 +** for the N-th database on database connection D, or a NULL pointer of N is
96596 +** the "temp" schema. Larger values of N correspond to various ATTACH-ed
96604 +** remember the string long-term should make their own copy. Applications that
96606 +** threads should mutex-protect calls to this API and should make their own
96609 +SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N);
96614 @@ -7428,24 +7470,56 @@ struct sqlite3_index_info {
96618 -** an operator that is part of a constraint term in the wHERE clause of
96621 -*/
96622 -#define SQLITE_INDEX_CONSTRAINT_EQ 2
96623 -#define SQLITE_INDEX_CONSTRAINT_GT 4
96624 -#define SQLITE_INDEX_CONSTRAINT_LE 8
96625 -#define SQLITE_INDEX_CONSTRAINT_LT 16
96626 -#define SQLITE_INDEX_CONSTRAINT_GE 32
96627 -#define SQLITE_INDEX_CONSTRAINT_MATCH 64
96628 -#define SQLITE_INDEX_CONSTRAINT_LIKE 65
96629 -#define SQLITE_INDEX_CONSTRAINT_GLOB 66
96630 -#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
96631 -#define SQLITE_INDEX_CONSTRAINT_NE 68
96632 -#define SQLITE_INDEX_CONSTRAINT_ISNOT 69
96633 -#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
96634 -#define SQLITE_INDEX_CONSTRAINT_ISNULL 71
96635 -#define SQLITE_INDEX_CONSTRAINT_IS 72
96636 -#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
96638 +** ^The left-hand operand of the operator is given by the corresponding
96639 +** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand
96642 +** operators have no left-hand operand, and so for those operators the
96651 +** The right-hand operands for each constraint might be accessible using
96652 +** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand
96654 +** in the input SQL. If the right-hand operand is another column or an
96658 +** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand
96663 +** the [sqlite3_vtab_collation()] interface. For most real-world virtual
96688 @@ -7474,7 +7548,7 @@ struct sqlite3_index_info {
96692 -** NULL then no new module is create and any existing modules with the
96697 @@ -8250,7 +8324,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
96701 -#define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
96707 @@ -8773,6 +8848,16 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
96716 +** step was bypassed because a Bloom filter returned not-found. The
96724 @@ -8787,6 +8872,8 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
96733 @@ -9755,19 +9842,276 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);
96740 -** method of a [virtual table].
96755 -** The first argument must be the sqlite3_index_info object that is the
96756 -** first parameter to the xBestIndex() method. The second argument must be
96757 -** an index into the aConstraint[] array belonging to the sqlite3_index_info
96758 -** structure passed to xBestIndex. This function returns a pointer to a buffer
96759 -** containing the name of the collation sequence for the corresponding
96760 -** constraint.
96866 +** on the right-hand side of the IN operator.)^ Thus the virtual table
96867 +** only sees a single value from the right-hand side of the IN operator
96871 +** table to see all values on the right-hand of the IN operator all at
96876 +** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero)
96877 +** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint
96879 +** sqlite3_vtab_in() with -1 in the third argument is a mechanism
96880 +** by which the virtual table can ask SQLite if all-at-once processing
96886 +** the IN operator all-at-once, respectively. ^Thus when the third
96887 +** parameter (F) is non-negative, this interface is the mechanism by
96896 +** (non-zero), that means that the constraint is an IN operator
96897 +** that can be processed all-at-once. ^If the constraint is not an IN
96898 +** operator or cannot be processed all-at-once, then the interface returns
96901 +** ^(All-at-once processing of the IN operator is selected if both of the
96905 +** <li><p> The P->aConstraintUsage[N].argvIndex value is set to a positive
96907 +** use the N-th constraint.
96910 +** non-negative had F>=1.
96914 +** the traditional one-at-a-time processing strategy for the IN constraint.
96915 +** ^If both conditions are true, then the argvIndex-th parameter to the
96918 +** [sqlite3_vtab_in_next()] to find all values on the right-hand side
96924 +** CAPI3REF: Find all elements on the right-hand side of an IN constraint.
96934 +** a parameter that was previously selected for all-at-once IN constraint
96937 +** an xFilter argument that was selected for all-at-once IN constraint
96941 +** ^(Use these routines to access all values on the right-hand side
96983 +** J being a 0-based index into P->aConstraint[], then this routine
96984 +** attempts to set *V to the value of the right-hand operand of
96985 +** that constraint if the right-hand operand is known. ^If the
96986 +** right-hand operand is not known, then *V is set to a NULL pointer.
96989 +** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
96995 +** the right-hand operand of a constraint is a literal value in the original
96996 +** SQL statement. If the right-hand operand is an expression or a reference
97001 +** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such
97010 +** "Right-Hand Side".
97017 @@ -12800,6 +13144,11 @@ struct fts5_api {
97028 ** autoconf-based build
97029 @@ -13611,75 +13960,76 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
97033 -#define TK_COLLATE 102
97034 -#define TK_BITNOT 103
97035 -#define TK_ON 104
97036 -#define TK_INDEXED 105
97037 -#define TK_STRING 106
97038 -#define TK_JOIN_KW 107
97039 -#define TK_CONSTRAINT 108
97040 -#define TK_DEFAULT 109
97041 -#define TK_NULL 110
97042 -#define TK_PRIMARY 111
97043 -#define TK_UNIQUE 112
97044 -#define TK_CHECK 113
97045 -#define TK_REFERENCES 114
97046 -#define TK_AUTOINCR 115
97047 -#define TK_INSERT 116
97048 -#define TK_DELETE 117
97049 -#define TK_UPDATE 118
97050 -#define TK_SET 119
97051 -#define TK_DEFERRABLE 120
97052 -#define TK_FOREIGN 121
97053 -#define TK_DROP 122
97054 -#define TK_UNION 123
97055 -#define TK_ALL 124
97056 -#define TK_EXCEPT 125
97057 -#define TK_INTERSECT 126
97058 -#define TK_SELECT 127
97059 -#define TK_VALUES 128
97060 -#define TK_DISTINCT 129
97061 -#define TK_DOT 130
97062 -#define TK_FROM 131
97063 -#define TK_JOIN 132
97064 -#define TK_USING 133
97065 -#define TK_ORDER 134
97066 -#define TK_GROUP 135
97067 -#define TK_HAVING 136
97068 -#define TK_LIMIT 137
97069 -#define TK_WHERE 138
97070 -#define TK_RETURNING 139
97071 -#define TK_INTO 140
97072 -#define TK_NOTHING 141
97073 -#define TK_FLOAT 142
97074 -#define TK_BLOB 143
97075 -#define TK_INTEGER 144
97076 -#define TK_VARIABLE 145
97077 -#define TK_CASE 146
97078 -#define TK_WHEN 147
97079 -#define TK_THEN 148
97080 -#define TK_ELSE 149
97081 -#define TK_INDEX 150
97082 -#define TK_ALTER 151
97083 -#define TK_ADD 152
97084 -#define TK_COLUMN 153
97085 -#define TK_AGG_FUNCTION 154
97086 -#define TK_AGG_COLUMN 155
97087 -#define TK_TRUEFALSE 156
97088 -#define TK_ISNOT 157
97089 -#define TK_FUNCTION 158
97090 -#define TK_UMINUS 159
97091 -#define TK_UPLUS 160
97092 -#define TK_TRUTH 161
97093 -#define TK_REGISTER 162
97094 -#define TK_VECTOR 163
97095 -#define TK_SELECT_COLUMN 164
97096 -#define TK_IF_NULL_ROW 165
97097 -#define TK_ASTERISK 166
97098 -#define TK_SPAN 167
97099 -#define TK_ERROR 168
97100 -#define TK_SPACE 169
97101 -#define TK_ILLEGAL 170
97175 @@ -14029,8 +14379,19 @@ typedef INT16_TYPE LogEst;
97178 ** to force 8-byte alignment on 64-bit architectures.
97183 +** pointers in size, and so it is a no-op on systems where the pointer
97195 @@ -14093,22 +14454,23 @@ typedef INT16_TYPE LogEst;
97199 -** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
97200 -** the Select query generator tracing logic is turned on.
97205 -SQLITE_PRIVATE u32 sqlite3SelectTrace;
97209 - && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_SELECTTRACE))
97210 -# define SELECTTRACE_ENABLED 1
97215 - if(sqlite3SelectTrace&(K)) \
97217 sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
97221 -# define SELECTTRACE_ENABLED 0
97226 @@ -14193,7 +14555,7 @@ struct BusyHandler {
97230 -#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3OomFault)
97235 @@ -14269,6 +14631,7 @@ typedef struct Lookaside Lookaside;
97243 @@ -14321,10 +14684,11 @@ typedef struct With With;
97247 -#define MASKBIT(n) (((Bitmask)1)<<(n))
97248 -#define MASKBIT64(n) (((u64)1)<<(n))
97249 -#define MASKBIT32(n) (((unsigned int)1)<<(n))
97250 -#define ALLBITS ((Bitmask)-1)
97255 +#define ALLBITS ((Bitmask)-1)
97259 @@ -14386,14 +14750,15 @@ typedef struct Pager Pager;
97263 -** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is
97267 ** is devoted to storing a super-journal name - there are no more pages to
97271 -#define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1))
97272 +#define PAGER_SJ_PGNO_COMPUTED(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1))
97273 +#define PAGER_SJ_PGNO(x) ((x)->lckPgno)
97277 @@ -15070,7 +15435,6 @@ struct VdbeOp {
97281 - int (*xAdvance)(BtCursor *, int);
97285 @@ -15121,21 +15485,19 @@ typedef struct VdbeOpList VdbeOpList;
97286 #define P4_COLLSEQ (-2) /* P4 is a pointer to a CollSeq structure */
97287 #define P4_INT32 (-3) /* P4 is a 32-bit signed integer */
97288 #define P4_SUBPROGRAM (-4) /* P4 is a pointer to a SubProgram structure */
97289 -#define P4_ADVANCE (-5) /* P4 is a pointer to BtreeNext() or BtreePrev() */
97290 -#define P4_TABLE (-6) /* P4 is a pointer to a Table structure */
97291 +#define P4_TABLE (-5) /* P4 is a pointer to a Table structure */
97293 -#define P4_FREE_IF_LE (-7)
97294 -#define P4_DYNAMIC (-7) /* Pointer to memory from sqliteMalloc() */
97295 -#define P4_FUNCDEF (-8) /* P4 is a pointer to a FuncDef structure */
97296 -#define P4_KEYINFO (-9) /* P4 is a pointer to a KeyInfo structure */
97297 -#define P4_EXPR (-10) /* P4 is a pointer to an Expr tree */
97298 -#define P4_MEM (-11) /* P4 is a pointer to a Mem* structure */
97299 -#define P4_VTAB (-12) /* P4 is a pointer to an sqlite3_vtab structure */
97300 -#define P4_REAL (-13) /* P4 is a 64-bit floating point value */
97301 -#define P4_INT64 (-14) /* P4 is a 64-bit signed integer */
97302 -#define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */
97303 -#define P4_FUNCCTX (-16) /* P4 is a pointer to an sqlite3_context object */
97304 -#define P4_DYNBLOB (-17) /* Pointer to memory from sqliteMalloc() */
97305 +#define P4_FREE_IF_LE (-6)
97306 +#define P4_DYNAMIC (-6) /* Pointer to memory from sqliteMalloc() */
97307 +#define P4_FUNCDEF (-7) /* P4 is a pointer to a FuncDef structure */
97308 +#define P4_KEYINFO (-8) /* P4 is a pointer to a KeyInfo structure */
97309 +#define P4_EXPR (-9) /* P4 is a pointer to an Expr tree */
97310 +#define P4_MEM (-10) /* P4 is a pointer to a Mem* structure */
97311 +#define P4_VTAB (-11) /* P4 is a pointer to an sqlite3_vtab structure */
97312 +#define P4_REAL (-12) /* P4 is a 64-bit floating point value */
97313 +#define P4_INT64 (-13) /* P4 is a 64-bit signed integer */
97314 +#define P4_INTARRAY (-14) /* P4 is a vector of 32-bit integers */
97315 +#define P4_FUNCCTX (-15) /* P4 is a pointer to an sqlite3_context object */
97319 @@ -15180,42 +15542,42 @@ typedef struct VdbeOpList VdbeOpList;
97323 -#define OP_SorterNext 3 /* jump */
97324 -#define OP_Prev 4 /* jump */
97325 -#define OP_Next 5 /* jump */
97326 -#define OP_Checkpoint 6
97327 -#define OP_JournalMode 7
97328 -#define OP_Vacuum 8
97329 -#define OP_VFilter 9 /* jump, synopsis: iplan=r[P3] zplan='P4' */
97330 -#define OP_VUpdate 10 /* synopsis: data=r[P3@P2] */
97331 -#define OP_Goto 11 /* jump */
97332 -#define OP_Gosub 12 /* jump */
97333 -#define OP_InitCoroutine 13 /* jump */
97334 -#define OP_Yield 14 /* jump */
97335 -#define OP_MustBeInt 15 /* jump */
97350 -#define OP_Jump 17 /* jump */
97351 -#define OP_Once 18 /* jump */
97352 -#define OP_If 19 /* jump */
97353 -#define OP_IfNot 20 /* jump */
97354 -#define OP_IsNullOrType 21 /* jump, synopsis: if typeof(r[P1]) IN (P3,5) goto P2 */
97355 -#define OP_IfNullRow 22 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
97356 -#define OP_SeekLT 23 /* jump, synopsis: key=r[P3@P4] */
97357 -#define OP_SeekLE 24 /* jump, synopsis: key=r[P3@P4] */
97358 -#define OP_SeekGE 25 /* jump, synopsis: key=r[P3@P4] */
97359 -#define OP_SeekGT 26 /* jump, synopsis: key=r[P3@P4] */
97360 -#define OP_IfNotOpen 27 /* jump, synopsis: if( !csr[P1] ) goto P2 */
97361 -#define OP_IfNoHope 28 /* jump, synopsis: key=r[P3@P4] */
97362 -#define OP_NoConflict 29 /* jump, synopsis: key=r[P3@P4] */
97363 -#define OP_NotFound 30 /* jump, synopsis: key=r[P3@P4] */
97364 -#define OP_Found 31 /* jump, synopsis: key=r[P3@P4] */
97365 -#define OP_SeekRowid 32 /* jump, synopsis: intkey=r[P3] */
97366 -#define OP_NotExists 33 /* jump, synopsis: intkey=r[P3] */
97367 -#define OP_Last 34 /* jump */
97368 -#define OP_IfSmaller 35 /* jump */
97369 -#define OP_SorterSort 36 /* jump */
97370 -#define OP_Sort 37 /* jump */
97371 -#define OP_Rewind 38 /* jump */
97397 @@ -15240,35 +15602,35 @@ typedef struct VdbeOpList VdbeOpList;
97398 #define OP_DecrJumpZero 60 /* jump, synopsis: if (--r[P1])==0 goto P2 */
97401 -#define OP_Init 63 /* jump, synopsis: Start at P2 */
97402 -#define OP_PureFunc 64 /* synopsis: r[P3]=func(r[P2@NP]) */
97403 -#define OP_Function 65 /* synopsis: r[P3]=func(r[P2@NP]) */
97404 -#define OP_Return 66
97405 -#define OP_EndCoroutine 67
97406 -#define OP_HaltIfNull 68 /* synopsis: if r[P3]=null halt */
97407 -#define OP_Halt 69
97408 -#define OP_Integer 70 /* synopsis: r[P2]=P1 */
97409 -#define OP_Int64 71 /* synopsis: r[P2]=P4 */
97410 -#define OP_String 72 /* synopsis: r[P2]='P4' (len=P1) */
97411 -#define OP_Null 73 /* synopsis: r[P2..P3]=NULL */
97412 -#define OP_SoftNull 74 /* synopsis: r[P1]=NULL */
97413 -#define OP_Blob 75 /* synopsis: r[P2]=P4 (len=P1) */
97414 -#define OP_Variable 76 /* synopsis: r[P2]=parameter(P1,P4) */
97415 -#define OP_Move 77 /* synopsis: r[P2@P3]=r[P1@P3] */
97416 -#define OP_Copy 78 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
97417 -#define OP_SCopy 79 /* synopsis: r[P2]=r[P1] */
97418 -#define OP_IntCopy 80 /* synopsis: r[P2]=r[P1] */
97419 -#define OP_ChngCntRow 81 /* synopsis: output=r[P1] */
97420 -#define OP_ResultRow 82 /* synopsis: output=r[P1@P2] */
97421 -#define OP_CollSeq 83
97422 -#define OP_AddImm 84 /* synopsis: r[P1]=r[P1]+P2 */
97423 -#define OP_RealAffinity 85
97424 -#define OP_Cast 86 /* synopsis: affinity(r[P1]) */
97425 -#define OP_Permutation 87
97426 -#define OP_Compare 88 /* synopsis: r[P1@P3] <-> r[P2@P3] */
97427 -#define OP_IsTrue 89 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */
97428 -#define OP_ZeroOrNull 90 /* synopsis: r[P2] = 0 OR NULL */
97429 -#define OP_Offset 91 /* synopsis: r[P3] = sqlite_offset(P1) */
97457 +#define OP_Compare 90 /* synopsis: r[P1@P3] <-> r[P2@P3] */
97462 @@ -15279,86 +15641,91 @@ typedef struct VdbeOpList VdbeOpList;
97466 -#define OP_Column 102 /* synopsis: r[P3]=PX */
97467 -#define OP_BitNot 103 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */
97468 -#define OP_TypeCheck 104 /* synopsis: typecheck(r[P1@P2]) */
97469 -#define OP_Affinity 105 /* synopsis: affinity(r[P1@P2]) */
97470 -#define OP_String8 106 /* same as TK_STRING, synopsis: r[P2]='P4' */
97471 -#define OP_MakeRecord 107 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
97472 -#define OP_Count 108 /* synopsis: r[P2]=count() */
97473 -#define OP_ReadCookie 109
97474 -#define OP_SetCookie 110
97475 -#define OP_ReopenIdx 111 /* synopsis: root=P2 iDb=P3 */
97476 -#define OP_OpenRead 112 /* synopsis: root=P2 iDb=P3 */
97477 -#define OP_OpenWrite 113 /* synopsis: root=P2 iDb=P3 */
97478 -#define OP_OpenDup 114
97479 -#define OP_OpenAutoindex 115 /* synopsis: nColumn=P2 */
97480 -#define OP_OpenEphemeral 116 /* synopsis: nColumn=P2 */
97481 -#define OP_SorterOpen 117
97482 -#define OP_SequenceTest 118 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
97483 -#define OP_OpenPseudo 119 /* synopsis: P3 columns in r[P2] */
97484 -#define OP_Close 120
97485 -#define OP_ColumnsUsed 121
97486 -#define OP_SeekScan 122 /* synopsis: Scan-ahead up to P1 rows */
97487 -#define OP_SeekHit 123 /* synopsis: set P2<=seekHit<=P3 */
97488 -#define OP_Sequence 124 /* synopsis: r[P2]=cursor[P1].ctr++ */
97489 -#define OP_NewRowid 125 /* synopsis: r[P2]=rowid */
97490 -#define OP_Insert 126 /* synopsis: intkey=r[P3] data=r[P2] */
97491 -#define OP_RowCell 127
97492 -#define OP_Delete 128
97493 -#define OP_ResetCount 129
97494 -#define OP_SorterCompare 130 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
97495 -#define OP_SorterData 131 /* synopsis: r[P2]=data */
97496 -#define OP_RowData 132 /* synopsis: r[P2]=data */
97497 -#define OP_Rowid 133 /* synopsis: r[P2]=rowid */
97498 -#define OP_NullRow 134
97499 -#define OP_SeekEnd 135
97500 -#define OP_IdxInsert 136 /* synopsis: key=r[P2] */
97501 -#define OP_SorterInsert 137 /* synopsis: key=r[P2] */
97502 -#define OP_IdxDelete 138 /* synopsis: key=r[P2@P3] */
97503 -#define OP_DeferredSeek 139 /* synopsis: Move P3 to P1.rowid if needed */
97504 -#define OP_IdxRowid 140 /* synopsis: r[P2]=rowid */
97505 -#define OP_FinishSeek 141
97506 -#define OP_Real 142 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
97507 -#define OP_Destroy 143
97508 -#define OP_Clear 144
97509 -#define OP_ResetSorter 145
97510 -#define OP_CreateBtree 146 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
97511 -#define OP_SqlExec 147
97512 -#define OP_ParseSchema 148
97513 -#define OP_LoadAnalysis 149
97514 -#define OP_DropTable 150
97515 -#define OP_DropIndex 151
97516 -#define OP_DropTrigger 152
97517 -#define OP_IntegrityCk 153
97518 -#define OP_RowSetAdd 154 /* synopsis: rowset(P1)=r[P2] */
97519 -#define OP_Param 155
97520 -#define OP_FkCounter 156 /* synopsis: fkctr[P1]+=P2 */
97521 -#define OP_MemMax 157 /* synopsis: r[P1]=max(r[P1],r[P2]) */
97522 -#define OP_OffsetLimit 158 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)…
97523 -#define OP_AggInverse 159 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */
97524 -#define OP_AggStep 160 /* synopsis: accum=r[P3] step(r[P2@P5]) */
97525 -#define OP_AggStep1 161 /* synopsis: accum=r[P3] step(r[P2@P5]) */
97526 -#define OP_AggValue 162 /* synopsis: r[P3]=value N=P2 */
97527 -#define OP_AggFinal 163 /* synopsis: accum=r[P1] N=P2 */
97528 -#define OP_Expire 164
97529 -#define OP_CursorLock 165
97530 -#define OP_CursorUnlock 166
97531 -#define OP_TableLock 167 /* synopsis: iDb=P1 root=P2 write=P3 */
97532 -#define OP_VBegin 168
97533 -#define OP_VCreate 169
97534 -#define OP_VDestroy 170
97535 -#define OP_VOpen 171
97536 -#define OP_VColumn 172 /* synopsis: r[P3]=vcolumn(P2) */
97537 -#define OP_VRename 173
97538 -#define OP_Pagecount 174
97539 -#define OP_MaxPgcnt 175
97540 -#define OP_Trace 176
97541 -#define OP_CursorHint 177
97542 -#define OP_ReleaseReg 178 /* synopsis: release r[P1@P2] mask P3 */
97543 -#define OP_Noop 179
97544 -#define OP_Explain 180
97545 -#define OP_Abortable 181
97568 +#define OP_SeekScan 124 /* synopsis: Scan-ahead up to P1 rows */
97604 +#define OP_OffsetLimit 160 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)…
97634 @@ -15371,29 +15738,30 @@ typedef struct VdbeOpList VdbeOpList;
97638 -/* 0 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x10,\
97639 -/* 8 */ 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x03,\
97640 -/* 16 */ 0x12, 0x01, 0x01, 0x03, 0x03, 0x03, 0x01, 0x09,\
97641 -/* 24 */ 0x09, 0x09, 0x09, 0x01, 0x09, 0x09, 0x09, 0x09,\
97642 -/* 32 */ 0x09, 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
97651 -/* 64 */ 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10,\
97652 -/* 72 */ 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10,\
97653 -/* 80 */ 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00,\
97654 -/* 88 */ 0x00, 0x12, 0x1e, 0x20, 0x26, 0x26, 0x26, 0x26,\
97655 -/* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
97656 -/* 104 */ 0x00, 0x00, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,\
97664 -/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
97665 -/* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\
97666 -/* 136 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10, 0x10,\
97667 -/* 144 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
97668 -/* 152 */ 0x00, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a, 0x00,\
97669 -/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
97670 -/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\
97671 -/* 176 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,}
97684 @@ -15401,7 +15769,7 @@ typedef struct VdbeOpList VdbeOpList;
97688 -#define SQLITE_MX_JUMP_OPCODE 63 /* Maximum JUMP opcode */
97693 @@ -15439,8 +15807,10 @@ SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p);
97704 @@ -15485,7 +15855,6 @@ SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Parse*);
97708 -SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*);
97712 @@ -15934,6 +16303,13 @@ SQLITE_PRIVATE int sqlite3PCacheIsDirty(PCache *pCache);
97726 @@ -16462,6 +16838,7 @@ struct sqlite3 {
97727 u32 nSchemaLock; /* Do not reset the schema when non-zero */
97734 @@ -16696,6 +17073,12 @@ struct sqlite3 {
97740 +#define SQLITE_BalancedMerge 0x00200000 /* Balance multi-way merges */
97747 @@ -16798,7 +17181,7 @@ struct FuncDestructor {
97749 ** single query - might change over time */
97750 #define SQLITE_FUNC_TEST 0x4000 /* Built-in testing functions */
97751 -#define SQLITE_FUNC_OFFSET 0x8000 /* Built-in sqlite_offset() function */
97752 +/* 0x8000 -- available for reuse */
97753 #define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */
97756 @@ -16815,6 +17198,7 @@ struct FuncDestructor {
97764 @@ -16869,7 +17253,7 @@ struct FuncDestructor {
97768 -** WFUNCTION(zName, nArg, iArg, xStep, xFinal, xValue, xInverse)
97773 @@ -16896,6 +17280,10 @@ struct FuncDestructor {
97784 @@ -17037,6 +17425,7 @@ struct Column {
97792 @@ -17443,6 +17832,11 @@ struct KeyInfo {
97794 KeyInfo *pKeyInfo; /* Collation and sort-order information */
97804 @@ -17750,7 +18144,10 @@ struct Expr {
97807 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
97808 - int iRightJoinTable; /* If EP_FromJoin, the right table of the join */
97816 @@ -17769,29 +18166,29 @@ struct Expr {
97820 -#define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
97821 -#define EP_Distinct 0x000002 /* Aggregate function with DISTINCT keyword */
97822 -#define EP_HasFunc 0x000004 /* Contains one or more functions of any kind */
97823 -#define EP_FixedCol 0x000008 /* TK_Column with a known fixed value */
97829 -#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
97830 -#define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
97831 -#define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */
97832 -#define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */
97833 -#define EP_Commuted 0x000200 /* Comparison operator has been commuted */
97834 -#define EP_IntValue 0x000400 /* Integer value contained in u.iValue */
97835 -#define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */
97836 -#define EP_Skip 0x001000 /* Operator does not contribute to affinity */
97837 -#define EP_Reduced 0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */
97838 -#define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */
97850 -#define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */
97851 -#define EP_IfNullRow 0x020000 /* The TK_IF_NULL_ROW opcode */
97852 -#define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */
97853 -#define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */
97854 -#define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */
97855 -#define EP_Subquery 0x200000 /* Tree contains a TK_SELECT operator */
97856 - /* 0x400000 // Available */
97867 @@ -17814,8 +18211,8 @@ struct Expr {
97868 #define ExprHasAllProperty(E,P) (((E)->flags&(P))==(P))
97869 #define ExprSetProperty(E,P) (E)->flags|=(P)
97870 #define ExprClearProperty(E,P) (E)->flags&=~(P)
97871 -#define ExprAlwaysTrue(E) (((E)->flags&(EP_FromJoin|EP_IsTrue))==EP_IsTrue)
97872 -#define ExprAlwaysFalse(E) (((E)->flags&(EP_FromJoin|EP_IsFalse))==EP_IsFalse)
97873 +#define ExprAlwaysTrue(E) (((E)->flags&(EP_OuterON|EP_IsTrue))==EP_IsTrue)
97874 +#define ExprAlwaysFalse(E) (((E)->flags&(EP_OuterON|EP_IsFalse))==EP_IsFalse)
97878 @@ -17902,12 +18299,18 @@ struct ExprList {
97882 - u8 sortFlags; /* Mask of KEYINFO_ORDER_* flags */
97883 - unsigned eEName :2; /* Meaning of zEName */
97884 - unsigned done :1; /* A flag to indicate when processing is finished */
97885 - unsigned reusable :1; /* Constant expression is reusable */
97886 - unsigned bSorterRef :1; /* Defer evaluation until after sorting */
97887 - unsigned bNulls: 1; /* True if explicit "NULLS FIRST/LAST" */
97903 @@ -17942,13 +18345,25 @@ struct ExprList {
97904 ** If "a" is the k-th column of table "t", then IdList.a[0].idx==k.
97911 - int idx; /* Index in some Table.aCol[] of a column named zName */
97912 - } *a;
97913 - int nId; /* Number of identifiers on the list */
97916 + Expr *pExpr; /* Expr to implement a USING variable -- NOT USED */
97927 +#define EU4_EXPR 2 /* Uses IdList.a.u4.pExpr -- NOT CURRENTLY USED */
97932 @@ -17976,15 +18391,22 @@ struct SrcItem {
97934 unsigned isTabFunc :1; /* True if table-valued-function syntax */
97935 unsigned isCorrelated :1; /* True if sub-query is correlated */
97937 unsigned viaCoroutine :1; /* Implemented as a co-routine */
97943 + unsigned isOn :1; /* u3.pOn was once valid and non-NULL */
97948 - Expr *pOn; /* The ON clause of a join */
97949 - IdList *pUsing; /* The USING clause of a join */
97957 @@ -17996,6 +18418,15 @@ struct SrcItem {
97973 @@ -18024,14 +18455,15 @@ struct SrcList {
97977 -#define JT_INNER 0x0001 /* Any kind of inner or cross join */
97978 -#define JT_CROSS 0x0002 /* Explicit use of the CROSS keyword */
97979 -#define JT_NATURAL 0x0004 /* True for a "natural" join */
97980 -#define JT_LEFT 0x0008 /* Left outer join */
97981 -#define JT_RIGHT 0x0010 /* Right outer join */
97982 -#define JT_OUTER 0x0020 /* The "OUTER" keyword is present */
97983 -#define JT_ERROR 0x0040 /* unknown or unsupported join type */
97984 -
97997 @@ -18054,7 +18486,7 @@ struct SrcList {
98001 - /* 0x1000 not currently used */
98006 @@ -18250,6 +18682,9 @@ struct Select {
98011 +#define IsNestedFrom(S) ((S)!=0 && ((S)->selFlags&SF_NestedFrom)!=0)
98016 @@ -18461,6 +18896,7 @@ struct Parse {
98024 @@ -18490,6 +18926,8 @@ struct Parse {
98033 @@ -18510,6 +18948,7 @@ struct Parse {
98041 @@ -18544,9 +18983,7 @@ struct Parse {
98045 - TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */
98047 - ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */
98051 @@ -18562,7 +18999,8 @@ struct Parse {
98055 -#define PARSE_HDR_SZ offsetof(Parse,aTempReg) /* Recursive part w/o aColCache*/
98057 +#define PARSE_HDR_SZ (offsetof(Parse,aTempReg)-offsetof(Parse,zErrMsg)) /* Recursive part w/o aCol…
98059 #define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */
98061 @@ -18631,20 +19069,20 @@ struct AuthContext {
98065 - * Each trigger present in the database schema is stored as an instance of
98066 - * struct Trigger.
98067 - *
98068 - * Pointers to instances of struct Trigger are stored in two ways.
98069 - * 1. In the "trigHash" hash table (part of the sqlite3* that represents the
98070 - * database). This allows Trigger structures to be retrieved by name.
98071 - * 2. All triggers associated with a single table form a linked list, using the
98072 - * pNext member of struct Trigger. A pointer to the first element of the
98073 - * linked list is stored as the "pTrigger" member of the associated
98074 - * struct Table.
98075 - *
98076 - * The "step_list" member points to the first element of a linked list
98077 - * containing the SQL statements specified as the trigger program.
98078 - */
98096 @@ -18671,43 +19109,48 @@ struct Trigger {
98100 - * An instance of struct TriggerStep is used to store a single SQL statement
98101 - * that is a part of a trigger-program.
98102 - *
98103 - * Instances of struct TriggerStep are stored in a singly linked list (linked
98104 - * using the "pNext" member) referenced by the "step_list" member of the
98105 - * associated struct Trigger instance. The first element of the linked list is
98106 - * the first step of the trigger-program.
98107 - *
98108 - * The "op" member indicates whether this is a "DELETE", "INSERT", "UPDATE" or
98109 - * "SELECT" statement. The meanings of the other members is determined by the
98110 - * value of "op" as follows:
98111 - *
98112 - * (op == TK_INSERT)
98113 - * orconf -> stores the ON CONFLICT algorithm
98114 - * pSelect -> If this is an INSERT INTO ... SELECT ... statement, then
98115 - * this stores a pointer to the SELECT statement. Otherwise NULL.
98116 - * zTarget -> Dequoted name of the table to insert into.
98117 - * pExprList -> If this is an INSERT INTO ... VALUES ... statement, then
98118 - * this stores values to be inserted. Otherwise NULL.
98119 - * pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
98120 - * statement, then this stores the column-names to be
98121 - * inserted into.
98122 - *
98123 - * (op == TK_DELETE)
98124 - * zTarget -> Dequoted name of the table to delete from.
98125 - * pWhere -> The WHERE clause of the DELETE statement if one is specified.
98126 - * Otherwise NULL.
98127 - *
98128 - * (op == TK_UPDATE)
98129 - * zTarget -> Dequoted name of the table to update.
98130 - * pWhere -> The WHERE clause of the UPDATE statement if one is specified.
98131 - * Otherwise NULL.
98132 - * pExprList -> A list of the columns to update and the expressions to update
98133 - * them to. See sqlite3Update() documentation of "pChanges"
98134 - * argument.
98135 - *
98136 - */
98138 +** that is a part of a trigger-program.
98143 +** the first step of the trigger-program.
98150 +** orconf -> stores the ON CONFLICT algorithm
98151 +** pSelect -> The content to be inserted - either a SELECT statement or
98153 +** zTarget -> Dequoted name of the table to insert into.
98154 +** pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
98155 +** statement, then this stores the column-names to be
98157 +** pUpsert -> The ON CONFLICT clauses for an Upsert
98160 +** zTarget -> Dequoted name of the table to delete from.
98161 +** pWhere -> The WHERE clause of the DELETE statement if one is specified.
98165 +** zTarget -> Dequoted name of the table to update.
98166 +** pWhere -> The WHERE clause of the UPDATE statement if one is specified.
98168 +** pExprList -> A list of the columns to update and the expressions to update
98173 +** pSelect -> The SELECT statement
98176 +** pExprList -> The list of expressions that follow the RETURNING keyword.
98182 @@ -18857,6 +19300,7 @@ struct Sqlite3Config {
98188 u32 szSorterRef; /* Min size in bytes to use sorter-refs */
98190 @@ -19061,7 +19505,7 @@ struct Window {
98194 - FuncDef *pFunc; /* The function */
98199 @@ -19316,19 +19760,54 @@ SQLITE_PRIVATE void *sqlite3TestTextToPtr(const char*);
98251 -
98255 @@ -19337,7 +19816,7 @@ SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*);
98259 -SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*, char **);
98264 @@ -19476,13 +19955,14 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(Parse*, SrcList*, int, int);
98268 - Token*, Select*, Expr*, IdList*);
98273 -SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*);
98281 @@ -19498,10 +19978,12 @@ SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, i…
98289 -SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int);
98295 @@ -19580,6 +20062,7 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
98303 @@ -19616,9 +20099,14 @@ SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,const Select*,int);
98318 @@ -19672,7 +20160,8 @@ SQLITE_PRIVATE SrcList *sqlite3TriggerStepSrc(Parse*, TriggerStep*);
98322 -SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int);
98328 @@ -19708,14 +20197,8 @@ SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
98332 -#ifndef SQLITE_OMIT_VIRTUALTABLE
98334 -#endif
98335 -#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
98336 - defined(SQLITE_ENABLE_STAT4) || \
98337 - defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
98339 -#endif
98343 @@ -19902,17 +20385,20 @@ SQLITE_PRIVATE int sqlite3CreateFunc(sqlite3 *, const char *, int, int, v…
98347 -SQLITE_PRIVATE void sqlite3OomFault(sqlite3*);
98350 SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int);
98365 @@ -20017,11 +20503,17 @@ SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3*, int, const char *, cha…
98378 -SQLITE_PRIVATE void sqlite3ParserReset(Parse*);
98384 @@ -20080,6 +20572,7 @@ SQLITE_PRIVATE void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*…
98392 @@ -20087,6 +20580,7 @@ SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *);
98400 @@ -20452,6 +20946,14 @@ SQLITE_API extern int sqlite3_open_file_count;
98415 @@ -20500,9 +21002,6 @@ SQLITE_API extern int sqlite3_open_file_count;
98419 -/*
98420 -** BEGIN CODE GENERATED BY tool/mkctime.tcl
98421 -*/
98425 @@ -20711,9 +21210,6 @@ static const char * const sqlite3azCompileOpt[] = {
98429 -#ifdef SQLITE_ENABLE_JSON1
98430 - "ENABLE_JSON1",
98431 -#endif
98435 @@ -20759,9 +21255,6 @@ static const char * const sqlite3azCompileOpt[] = {
98439 -#ifdef SQLITE_ENABLE_SELECTTRACE
98440 - "ENABLE_SELECTTRACE",
98441 -#endif
98445 @@ -20783,6 +21276,9 @@ static const char * const sqlite3azCompileOpt[] = {
98455 @@ -21037,6 +21533,9 @@ static const char * const sqlite3azCompileOpt[] = {
98465 @@ -21225,10 +21724,8 @@ static const char * const sqlite3azCompileOpt[] = {
98469 -/*
98470 -** END CODE GENERATED BY tool/mkctime.tcl
98471 -*/
98472 -};
98478 @@ -21527,9 +22024,13 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = {
98492 @@ -21584,7 +22085,7 @@ SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000;
98496 -SQLITE_PRIVATE u32 sqlite3SelectTrace = 0;
98501 @@ -21740,7 +22241,7 @@ typedef struct AuxData AuxData;
98505 - i8 iDb; /* Index of cursor database in db->aDb[] (or -1) */
98506 + i8 iDb; /* Index of cursor database in db->aDb[] */
98510 @@ -21751,11 +22252,13 @@ struct VdbeCursor {
98512 Bool useRandomRowid:1; /* Generate new record numbers semi-randomly */
98514 - Bool hasBeenDuped:1; /* This cursor was source or target of OP_OpenDup */
98517 - Btree *pBtx; /* Separate file holding temporary table */
98523 - u32 *aAltMap; /* Mapping from table to index column numbers */
98527 @@ -21797,6 +22300,11 @@ struct VdbeCursor {
98531 +/* Return true if P is a null-only cursor
98534 + ((P)->eCurType==CURTYPE_PSEUDO && (P)->nullRow && (P)->seekResult==0)
98539 @@ -21871,16 +22379,16 @@ struct sqlite3_value {
98548 - int n; /* Number of characters in string value, excluding '\0' */
98549 - char *z; /* String or BLOB value */
98551 - char *zMalloc; /* Space to hold MEM_Str or MEM_Blob if szMalloc>0 */
98552 + sqlite3 *db; /* The associated database connection */
98555 - sqlite3 *db; /* The associated database connection */
98557 void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */
98560 @@ -21892,11 +22400,43 @@ struct sqlite3_value {
98564 -#define MEMCELLSIZE offsetof(Mem,zMalloc)
98565 +#define MEMCELLSIZE offsetof(Mem,db)
98567 -/* One or more of the following flags are set to indicate the validOK
98574 +** UPDATE no-change flag set
98580 +** * MEM_Null|MEM_Cleared Special SQL NULL that compares non-equal
98584 +** length Mem.n. Zero-terminated if
98606 @@ -21907,6 +22447,7 @@ struct sqlite3_value {
98614 @@ -21914,28 +22455,24 @@ struct sqlite3_value {
98622 -#define MEM_Undefined 0x0080 /* Value is undefined */
98625 -#define MEM_TypeMask 0xc1bf /* Mask of type bits */
98626 -
98632 -/* Whenever Mem contains a valid string or blob representation, one of
98633 -** the following flags must be set to determine the memory management
98634 -** policy for Mem.z. The MEM_Term flag tells us whether or not the
98635 -** string is \000 or \u0000 terminated
98639 -#define MEM_Term 0x0200 /* String in Mem.z is zero terminated */
98640 -#define MEM_Dyn 0x0400 /* Need to call Mem.xDel() on Mem.z */
98641 -#define MEM_Static 0x0800 /* Mem.z points to a static string */
98642 -#define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */
98643 -#define MEM_Agg 0x2000 /* Mem.z points to an agg function context */
98644 -#define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */
98645 -#define MEM_Subtype 0x8000 /* Mem.eSubtype is valid */
98646 -#ifdef SQLITE_OMIT_INCRBLOB
98647 - #undef MEM_Zero
98648 - #define MEM_Zero 0x0000
98649 -#endif
98655 /* Return TRUE if Mem X contains dynamically allocated content - anything
98657 @@ -21957,11 +22494,15 @@ struct sqlite3_value {
98658 && (X)->n==0 && (X)->u.nZero==0)
98661 -** Return true if a memory cell is not marked as invalid. This macro
98670 -#define memIsValid(M) ((M)->flags & MEM_Undefined)==0
98671 +#define memIsValid(M) ((M)->flags & MEM_AffMask)!=0
98675 @@ -21999,6 +22540,7 @@ struct sqlite3_context {
98683 @@ -22047,7 +22589,6 @@ struct Vdbe {
98684 Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
98687 - u32 iVdbeMagic; /* Magic number defining state of the SQL statement */
98691 @@ -22085,17 +22626,16 @@ struct Vdbe {
98695 - u8 doingRerun; /* True if rerunning after an auto-reprepare */
98699 bft changeCntOn:1; /* True to update the change-counter */
98700 - bft runOnlyOnce:1; /* Automatically expire on reset */
98704 yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
98706 - u32 aCounter[7]; /* Counters used by sqlite3_stmt_status() */
98711 @@ -22116,13 +22656,12 @@ struct Vdbe {
98715 -** The following are allowed values for Vdbe.magic
98718 -#define VDBE_MAGIC_INIT 0x16bceaa5 /* Building a VDBE program */
98719 -#define VDBE_MAGIC_RUN 0x2df20da3 /* VDBE is ready to execute */
98720 -#define VDBE_MAGIC_HALT 0x319c2973 /* VDBE has completed execution */
98721 -#define VDBE_MAGIC_RESET 0x48fa9f76 /* Reset and ready to run again */
98722 -#define VDBE_MAGIC_DEAD 0x5606c3c8 /* The VDBE has been deallocated */
98730 @@ -22145,19 +22684,50 @@ struct PreUpdate {
98737 +** set of values on the right-hand side of an IN constraint.
98753 +** single-byte varint.
98768 -SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor**, u32*);
98772 -SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
98773 -SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
98784 @@ -22203,7 +22773,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem*);
98788 -SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*);
98793 @@ -22214,6 +22784,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemCast(Mem*,u8,u8);
98801 @@ -22616,8 +23187,7 @@ SQLITE_API int sqlite3_db_status(
98803 db->pnBytesFreed = &nByte;
98804 for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){
98805 - sqlite3VdbeClearObject(db, pVdbe);
98806 - sqlite3DbFree(db, pVdbe);
98809 db->pnBytesFreed = 0;
98811 @@ -23181,8 +23751,10 @@ static void clearYMD_HMS_TZ(DateTime *p){
98813 ** non-zero on any kind of error.
98815 -** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this
98816 -** routine will always fail.
98817 +** If the sqlite3GlobalConfig.bLocaltimeFault variable is non-zero then this
98820 +** invoked in place of the OS-defined localtime() function.
98822 ** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C
98824 @@ -23198,14 +23770,30 @@ static int osLocaltime(time_t *t, struct tm *pTm){
98828 - if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0;
98846 - if( sqlite3GlobalConfig.bLocaltimeFault ) return 1;
98857 @@ -23220,67 +23808,56 @@ static int osLocaltime(time_t *t, struct tm *pTm){
98861 -** Compute the difference (in milliseconds) between localtime and UTC
98862 -** (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs,
98863 -** return this value and set *pRc to SQLITE_OK.
98864 -**
98865 -** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value
98866 -** is undefined in this case.
98869 -static sqlite3_int64 localtimeOffset(
98870 - DateTime *p, /* Date at which to calculate offset */
98871 - sqlite3_context *pCtx, /* Write error here if one occurs */
98872 - int *pRc /* OUT: Error code. SQLITE_OK or ERROR */
98877 - DateTime x, y;
98885 - x = *p;
98886 - computeYMD_HMS(&x);
98887 - if( x.Y<1971 || x.Y>=2038 ){
98889 + if( p->iJD<2108667600*(i64)100000 /* 1970-01-01 */
98890 + || p->iJD>2130141456*(i64)100000 /* 2038-01-18 */
98892 /* EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only
98897 - x.Y = 2000;
98898 - x.M = 1;
98899 - x.D = 1;
98900 - x.h = 0;
98901 - x.m = 0;
98902 - x.s = 0.0;
98903 - } else {
98904 - int s = (int)(x.s + 0.5);
98905 - x.s = s;
98908 + iYearDiff = (2000 + x.Y%4) - x.Y;
98912 + t = (time_t)(x.iJD/1000 - 21086676*(i64)10000);
98915 + t = (time_t)(p->iJD/1000 - 21086676*(i64)10000);
98917 - x.tz = 0;
98918 - x.validJD = 0;
98919 - computeJD(&x);
98920 - t = (time_t)(x.iJD/1000 - 21086676*(i64)10000);
98922 sqlite3_result_error(pCtx, "local time unavailable", -1);
98923 - *pRc = SQLITE_ERROR;
98924 - return 0;
98927 - y.Y = sLocal.tm_year + 1900;
98928 - y.M = sLocal.tm_mon + 1;
98929 - y.D = sLocal.tm_mday;
98930 - y.h = sLocal.tm_hour;
98931 - y.m = sLocal.tm_min;
98932 - y.s = sLocal.tm_sec;
98933 - y.validYMD = 1;
98934 - y.validHMS = 1;
98935 - y.validJD = 0;
98936 - y.rawS = 0;
98937 - y.validTZ = 0;
98938 - y.isError = 0;
98939 - computeJD(&y);
98940 - *pRc = SQLITE_OK;
98941 - return y.iJD - x.iJD;
98942 + p->Y = sLocal.tm_year + 1900 - iYearDiff;
98943 + p->M = sLocal.tm_mon + 1;
98944 + p->D = sLocal.tm_mday;
98945 + p->h = sLocal.tm_hour;
98946 + p->m = sLocal.tm_min;
98947 + p->s = sLocal.tm_sec + (p->iJD%1000)*0.001;
98948 + p->validYMD = 1;
98949 + p->validHMS = 1;
98950 + p->validJD = 0;
98951 + p->rawS = 0;
98952 + p->validTZ = 0;
98953 + p->isError = 0;
98958 @@ -23293,18 +23870,17 @@ static sqlite3_int64 localtimeOffset(
98962 - u8 eType; /* Transformation type code */
98963 - u8 nName; /* Length of th name */
98964 - char *zName; /* Name of the transformation */
98965 - double rLimit; /* Maximum NNN value for this transform */
98966 - double rXform; /* Constant used for this transform */
98972 - { 0, 6, "second", 464269060800.0, 1000.0 },
98973 - { 0, 6, "minute", 7737817680.0, 60000.0 },
98974 - { 0, 4, "hour", 128963628.0, 3600000.0 },
98975 - { 0, 3, "day", 5373485.0, 86400000.0 },
98976 - { 1, 5, "month", 176546.0, 2592000000.0 },
98977 - { 2, 4, "year", 14713.0, 31536000000.0 },
98987 @@ -23335,11 +23911,55 @@ static int parseModifier(
98991 - DateTime *p /* The date/time value to be modified */
99006 + if( idx>1 ) return 1; /* IMP: R-33611-57934 */
99007 + if( !p->rawS || p->validJD ){
99009 + p->rawS = 0;
99010 + }else if( p->s>=-21086676*(i64)10000 /* -4713-11-24 12:00:00 */
99011 + && p->s<=(25340230*(i64)10000)+799 /* 9999-12-31 23:59:59 */
99013 + r = p->s*1000.0 + 210866760000000.0;
99015 + p->iJD = (sqlite3_int64)(r + 0.5);
99016 + p->validJD = 1;
99017 + p->rawS = 0;
99027 + ** Always interpret the prior number as a julian-day value. If this
99033 + if( idx>1 ) return 1; /* IMP: R-31176-64601 */
99034 + if( p->validJD && p->rawS ){
99036 + p->rawS = 0;
99044 @@ -23348,9 +23968,7 @@ static int parseModifier(
99048 - computeJD(p);
99049 - p->iJD += localtimeOffset(p, pCtx, &rc);
99050 - clearYMD_HMS_TZ(p);
99055 @@ -23363,6 +23981,7 @@ static int parseModifier(
99058 if( sqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){
99059 + if( idx>1 ) return 1; /* IMP: R-49255-55373 */
99060 r = p->s*1000.0 + 210866760000000.0;
99063 @@ -23375,18 +23994,31 @@ static int parseModifier(
99066 if( p->tzSet==0 ){
99067 - sqlite3_int64 c1;
99074 - c1 = localtimeOffset(p, pCtx, &rc);
99075 - if( rc==SQLITE_OK ){
99076 - p->iJD -= c1;
99077 - clearYMD_HMS_TZ(p);
99078 - p->iJD += c1 - localtimeOffset(p, pCtx, &rc);
99079 - }
99080 + iGuess = iOrigJD = p->iJD;
99085 + iGuess -= iErr;
99091 + iErr = new.iJD - iOrigJD;
99094 + p->iJD = iGuess;
99095 + p->validJD = 1;
99096 p->tzSet = 1;
99097 - }else{
99098 - rc = SQLITE_OK;
99104 @@ -23502,9 +24134,10 @@ static int parseModifier(
99106 && r>-aXformType[i].rLimit && r<aXformType[i].rLimit
99108 - switch( aXformType[i].eType ){
99109 - case 1: { /* Special processing to add months */
99115 p->M += (int)r;
99116 x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
99117 @@ -23514,8 +24147,9 @@ static int parseModifier(
99118 r -= (int)r;
99121 - case 2: { /* Special processing to add years */
99126 p->Y += y;
99127 p->validJD = 0;
99128 @@ -23524,7 +24158,7 @@ static int parseModifier(
99132 - p->iJD += (sqlite3_int64)(r*aXformType[i].rXform + rRounder);
99133 + p->iJD += (sqlite3_int64)(r*1000.0*aXformType[i].rXform + rRounder);
99137 @@ -23574,7 +24208,7 @@ static int isDate(
99141 - if( z==0 || parseModifier(context, (char*)z, n, p) ) return 1;
99145 if( p->isError || !validJulianDay(p->iJD) ) return 1;
99146 @@ -23604,6 +24238,24 @@ static void juliandayFunc(
99154 +** the unix epoch of 1970-01-01 00:00:00 GMT.
99164 + sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000);
99171 @@ -23616,11 +24268,38 @@ static void datetimeFunc(
99175 - char zBuf[100];
99179 - sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d %02d:%02d:%02d",
99180 - x.Y, x.M, x.D, x.h, x.m, (int)(x.s));
99181 - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
99183 + if( Y<0 ) Y = -Y;
99188 + zBuf[5] = '-';
99191 + zBuf[8] = '-';
99206 + zBuf[0] = '-';
99214 @@ -23636,10 +24315,20 @@ static void timeFunc(
99218 - char zBuf[100];
99222 - sqlite3_snprintf(sizeof(zBuf), zBuf, "%02d:%02d:%02d", x.h, x.m, (int)x.s);
99223 - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
99238 @@ -23655,10 +24344,28 @@ static void dateFunc(
99242 - char zBuf[100];
99246 - sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d", x.Y, x.M, x.D);
99247 - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
99249 + if( Y<0 ) Y = -Y;
99254 + zBuf[5] = '-';
99257 + zBuf[8] = '-';
99262 + zBuf[0] = '-';
99270 @@ -23880,6 +24587,7 @@ SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){
99273 PURE_DATE(julianday, -1, 0, 0, juliandayFunc ),
99274 + PURE_DATE(unixepoch, -1, 0, 0, unixepochFunc ),
99275 PURE_DATE(date, -1, 0, 0, dateFunc ),
99276 PURE_DATE(time, -1, 0, 0, timeFunc ),
99277 PURE_DATE(datetime, -1, 0, 0, datetimeFunc ),
99278 @@ -26434,8 +27142,13 @@ static void *memsys5Realloc(void *pPrior, int nBytes){
99282 - if( n > 0x40000000 ) return 0;
99283 - for(iFullSz=mem5.szAtom; iFullSz<n; iFullSz *= 2);
99294 @@ -28816,8 +29529,9 @@ SQLITE_PRIVATE char *sqlite3DbSpanDup(sqlite3 *db, const char *zStart, cons…
99297 SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){
99298 + char *z = sqlite3DbStrDup(db, zNew);
99299 sqlite3DbFree(db, *pz);
99300 - *pz = sqlite3DbStrDup(db, zNew);
99305 @@ -28825,8 +29539,15 @@ SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *z…
99306 ** has happened. This routine will set db->mallocFailed, and also
99312 +** return sqlite3OomFault(db);
99317 -SQLITE_PRIVATE void sqlite3OomFault(sqlite3 *db){
99318 +SQLITE_PRIVATE void *sqlite3OomFault(sqlite3 *db){
99319 if( db->mallocFailed==0 && db->bBenignMalloc==0 ){
99320 db->mallocFailed = 1;
99321 if( db->nVdbeExec>0 ){
99322 @@ -28834,9 +29555,16 @@ SQLITE_PRIVATE void sqlite3OomFault(sqlite3 *db){
99325 if( db->pParse ){
99327 + sqlite3ErrorMsg(db->pParse, "out of memory");
99328 db->pParse->rc = SQLITE_NOMEM_BKPT;
99329 + for(pParse=db->pParse->pOuterParse; pParse; pParse = pParse->pOuterParse){
99330 + pParse->nErr++;
99331 + pParse->rc = SQLITE_NOMEM;
99339 @@ -29699,8 +30427,8 @@ SQLITE_API void sqlite3_str_vappendf(
99343 - int i, j, k, n, isnull;
99344 - int needQuote;
99350 @@ -29745,12 +30473,22 @@ SQLITE_API void sqlite3_str_vappendf(
99354 - Token *pToken;
99355 if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return;
99356 - pToken = va_arg(ap, Token*);
99357 - assert( bArgList==0 );
99358 - if( pToken && pToken->n ){
99359 - sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n);
99364 + sqlite3_str_appendall(pAccum, (const char*)pExpr->u.zToken);
99365 + sqlite3RecordErrorOffsetOfExpr(pAccum->db, pExpr);
99371 + if( pToken && pToken->n ){
99372 + sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n);
99373 + sqlite3RecordErrorByteOffset(pAccum->db, pToken->z);
99378 @@ -29770,8 +30508,14 @@ SQLITE_API void sqlite3_str_vappendf(
99379 sqlite3_str_appendall(pAccum, pItem->zName);
99380 }else if( pItem->zAlias ){
99381 sqlite3_str_appendall(pAccum, pItem->zAlias);
99382 - }else if( ALWAYS(pItem->pSelect) ){
99383 - sqlite3_str_appendf(pAccum, "SUBQUERY %u", pItem->pSelect->selId);
99385 + Select *pSel = pItem->pSelect;
99387 + if( pSel->selFlags & SF_NestedFrom ){
99388 + sqlite3_str_appendf(pAccum, "(join-%u)", pSel->selId);
99390 + sqlite3_str_appendf(pAccum, "(subquery-%u)", pSel->selId);
99395 @@ -29805,6 +30549,44 @@ SQLITE_API void sqlite3_str_vappendf(
99402 +** associated with an error. If db does not already have an error
99404 +** z and set the error byte offset in db.
99406 +SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){
99411 + if( NEVER(db==0) ) return;
99412 + if( db->errByteOffset!=(-2) ) return;
99413 + pParse = db->pParse;
99415 + zText =pParse->zTail;
99419 + db->errByteOffset = (int)(z-zText);
99427 +SQLITE_PRIVATE void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExpr){
99429 + && (ExprHasProperty(pExpr,EP_OuterON|EP_InnerON) || pExpr->w.iOfst<=0)
99431 + pExpr = pExpr->pLeft;
99434 + db->errByteOffset = pExpr->w.iOfst;
99440 @@ -29812,7 +30594,7 @@ SQLITE_API void sqlite3_str_vappendf(
99444 -static int sqlite3StrAccumEnlarge(StrAccum *p, int N){
99447 assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */
99448 if( p->accError ){
99449 @@ -30258,40 +31040,44 @@ SQLITE_API void sqlite3_str_appendf(StrAccum *p, const char *zFormat, ...…
99453 -static TreeView *sqlite3TreeViewPush(TreeView *p, u8 moreToFollow){
99457 - p = sqlite3_malloc64( sizeof(*p) );
99458 - if( p==0 ) return 0;
99463 p->iLevel++;
99466 - if( p->iLevel<sizeof(p->bLine) ) p->bLine[p->iLevel] = moreToFollow;
99467 - return p;
99468 + if( p->iLevel<(int)sizeof(p->bLine) ) p->bLine[p->iLevel] = moreToFollow;
99474 -static void sqlite3TreeViewPop(TreeView *p){
99478 p->iLevel--;
99479 - if( p->iLevel<0 ) sqlite3_free(p);
99480 + if( p->iLevel<0 ){
99490 -static void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){
99495 - char zBuf[500];
99499 - for(i=0; i<p->iLevel && i<sizeof(p->bLine)-1; i++){
99500 + for(i=0; i<p->iLevel && i<(int)sizeof(p->bLine)-1; i++){
99501 sqlite3_str_append(&acc, p->bLine[i] ? "| " : " ", 4);
99503 sqlite3_str_append(&acc, p->bLine[i] ? "|-- " : "'-- ", 4);
99504 @@ -30312,10 +31098,57 @@ static void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){
99508 - p = sqlite3TreeViewPush(p, moreFollows);
99527 + int colMoreToFollow = i<(nCol - 1);
99542 + printf(" X-%s", z);
99550 + if( flg & COLFLAG_NOEXPAND ) printf(" NO-EXPAND");
99561 ** Generate a human-readable description of a WITH clause.
99563 @@ -30329,7 +31162,7 @@ SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWith,…
99566 if( pWith->nCte>0 ){
99567 - pView = sqlite3TreeViewPush(pView, 1);
99569 for(i=0; i<pWith->nCte; i++){
99572 @@ -30345,6 +31178,10 @@ SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWith…
99576 + if( pCte->eM10d!=M10d_Any ){
99578 + pCte->eM10d==M10d_No ? "NOT " : "");
99580 if( pCte->pUse ){
99581 sqlite3_str_appendf(&x, " (pUse=0x%p, nUse=%d)", pCte->pUse,
99582 pCte->pUse->nUse);
99583 @@ -30352,9 +31189,9 @@ SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWith,…
99585 sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1);
99586 sqlite3TreeViewSelect(pView, pCte->pSelect, 0);
99587 - sqlite3TreeViewPop(pView);
99590 - sqlite3TreeViewPop(pView);
99595 @@ -30363,10 +31200,12 @@ SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWit…
99600 for(i=0; i<pSrc->nSrc; i++){
99601 const SrcItem *pItem = &pSrc->a[i];
99603 - char zLine[100];
99608 sqlite3_str_appendf(&x, "{%d:*} %!S", pItem->iCursor, pItem);
99609 @@ -30374,26 +31213,48 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList…
99611 pItem->pTab->zName, pItem->pTab->nCol, pItem->pTab, pItem->colUsed);
99613 - if( pItem->fg.jointype & JT_LEFT ){
99614 + if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))==(JT_LEFT|JT_RIGHT) ){
99615 + sqlite3_str_appendf(&x, " FULL-OUTER-JOIN");
99616 + }else if( pItem->fg.jointype & JT_LEFT ){
99617 sqlite3_str_appendf(&x, " LEFT-JOIN");
99618 + }else if( pItem->fg.jointype & JT_RIGHT ){
99619 + sqlite3_str_appendf(&x, " RIGHT-JOIN");
99620 }else if( pItem->fg.jointype & JT_CROSS ){
99621 sqlite3_str_appendf(&x, " CROSS-JOIN");
99623 + if( pItem->fg.jointype & JT_LTORJ ){
99626 if( pItem->fg.fromDDL ){
99629 if( pItem->fg.isCte ){
99630 sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
99632 + if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){
99636 sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
99638 + if( pItem->pSelect ) n++;
99639 + if( pItem->fg.isTabFunc ) n++;
99640 + if( pItem->fg.isUsing ) n++;
99641 + if( pItem->fg.isUsing ){
99642 + sqlite3TreeViewIdList(pView, pItem->u3.pUsing, (--n)>0, "USING");
99644 if( pItem->pSelect ){
99645 - sqlite3TreeViewSelect(pView, pItem->pSelect, 0);
99646 + if( pItem->pTab ){
99647 + Table *pTab = pItem->pTab;
99648 + sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1);
99650 + assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem->pSelect) );
99651 + sqlite3TreeViewSelect(pView, pItem->pSelect, (--n)>0);
99653 if( pItem->fg.isTabFunc ){
99654 sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
99656 - sqlite3TreeViewPop(pView);
99661 @@ -30407,11 +31268,11 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *…
99662 sqlite3TreeViewLine(pView, "nil-SELECT");
99665 - pView = sqlite3TreeViewPush(pView, moreToFollow);
99667 if( p->pWith ){
99668 sqlite3TreeViewWith(pView, p->pWith, 1);
99670 - sqlite3TreeViewPush(pView, 1);
99674 if( p->selFlags & SF_WhereBegin ){
99675 @@ -30425,7 +31286,7 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p,…
99676 (int)p->nSelectRow
99679 - if( cnt++ ) sqlite3TreeViewPop(pView);
99681 if( p->pPrior ){
99684 @@ -30448,24 +31309,24 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *…
99686 if( p->pWin ){
99688 - pView = sqlite3TreeViewPush(pView, (n--)>0);
99689 + sqlite3TreeViewPush(&pView, (n--)>0);
99690 sqlite3TreeViewLine(pView, "window-functions");
99691 for(pX=p->pWin; pX; pX=pX->pNextWin){
99692 sqlite3TreeViewWinFunc(pView, pX, pX->pNextWin!=0);
99694 - sqlite3TreeViewPop(pView);
99698 if( p->pSrc && p->pSrc->nSrc ){
99699 - pView = sqlite3TreeViewPush(pView, (n--)>0);
99700 + sqlite3TreeViewPush(&pView, (n--)>0);
99702 sqlite3TreeViewSrcList(pView, p->pSrc);
99703 - sqlite3TreeViewPop(pView);
99706 if( p->pWhere ){
99707 sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
99708 sqlite3TreeViewExpr(pView, p->pWhere, 0);
99709 - sqlite3TreeViewPop(pView);
99712 if( p->pGroupBy ){
99713 sqlite3TreeViewExprList(pView, p->pGroupBy, (n--)>0, "GROUPBY");
99714 @@ -30473,7 +31334,7 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p,…
99715 if( p->pHaving ){
99716 sqlite3TreeViewItem(pView, "HAVING", (n--)>0);
99717 sqlite3TreeViewExpr(pView, p->pHaving, 0);
99718 - sqlite3TreeViewPop(pView);
99722 if( p->pWinDefn ){
99723 @@ -30482,7 +31343,7 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p,…
99724 for(pX=p->pWinDefn; pX; pX=pX->pNextWin){
99725 sqlite3TreeViewWindow(pView, pX, pX->pNextWin!=0);
99727 - sqlite3TreeViewPop(pView);
99731 if( p->pOrderBy ){
99732 @@ -30494,9 +31355,9 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p,…
99733 if( p->pLimit->pRight ){
99734 sqlite3TreeViewItem(pView, "OFFSET", (n--)>0);
99735 sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0);
99736 - sqlite3TreeViewPop(pView);
99739 - sqlite3TreeViewPop(pView);
99742 if( p->pPrior ){
99744 @@ -30509,7 +31370,7 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p,…
99746 p = p->pPrior;
99748 - sqlite3TreeViewPop(pView);
99753 @@ -30525,24 +31386,24 @@ SQLITE_PRIVATE void sqlite3TreeViewBound(
99757 - sqlite3TreeViewPop(pView);
99763 - sqlite3TreeViewPop(pView);
99770 - sqlite3TreeViewPop(pView);
99777 - sqlite3TreeViewPop(pView);
99782 @@ -30555,12 +31416,13 @@ SQLITE_PRIVATE void sqlite3TreeViewBound(
99787 if( pWin->pFilter ){
99789 sqlite3TreeViewExpr(pView, pWin->pFilter, 0);
99790 - sqlite3TreeViewPop(pView);
99793 - pView = sqlite3TreeViewPush(pView, more);
99795 if( pWin->zName ){
99796 sqlite3TreeViewLine(pView, "OVER %s (%p)", pWin->zName, pWin);
99798 @@ -30571,9 +31433,9 @@ SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pW…
99799 if( pWin->eFrmType ) nElement++;
99800 if( pWin->eExclude ) nElement++;
99801 if( pWin->zBase ){
99802 - sqlite3TreeViewPush(pView, (--nElement)>0);
99803 + sqlite3TreeViewPush(&pView, (--nElement)>0);
99804 sqlite3TreeViewLine(pView, "window: %s", pWin->zBase);
99805 - sqlite3TreeViewPop(pView);
99808 if( pWin->pPartition ){
99809 sqlite3TreeViewExprList(pView, pWin->pPartition, nElement>0,"PARTITION-BY");
99810 @@ -30591,7 +31453,7 @@ SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pW…
99811 sqlite3TreeViewItem(pView, zBuf, (--nElement)>0);
99812 sqlite3TreeViewBound(pView, pWin->eStart, pWin->pStart, 1);
99813 sqlite3TreeViewBound(pView, pWin->eEnd, pWin->pEnd, 0);
99814 - sqlite3TreeViewPop(pView);
99817 if( pWin->eExclude ){
99819 @@ -30606,11 +31468,11 @@ SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *…
99823 - sqlite3TreeViewPush(pView, 0);
99826 - sqlite3TreeViewPop(pView);
99829 - sqlite3TreeViewPop(pView);
99834 @@ -30619,11 +31481,12 @@ SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *…
99835 ** Generate a human-readable explanation for a Window Function object
99838 - pView = sqlite3TreeViewPush(pView, more);
99842 - pWin->pFunc->zName, pWin->pFunc->nArg);
99843 + pWin->pWFunc->zName, pWin->pWFunc->nArg);
99845 - sqlite3TreeViewPop(pView);
99850 @@ -30634,10 +31497,10 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExp…
99854 - pView = sqlite3TreeViewPush(pView, moreToFollow);
99858 - sqlite3TreeViewPop(pView);
99862 if( pExpr->flags || pExpr->affExpr || pExpr->vvaFlags ){
99863 @@ -30645,8 +31508,11 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr…
99866 pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n');
99867 - if( ExprHasProperty(pExpr, EP_FromJoin) ){
99868 - sqlite3_str_appendf(&x, " iRJT=%d", pExpr->iRightJoinTable);
99870 + sqlite3_str_appendf(&x, " outer.iJoin=%d", pExpr->w.iJoin);
99873 + sqlite3_str_appendf(&x, " inner.iJoin=%d", pExpr->w.iJoin);
99877 @@ -30870,7 +31736,17 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr…
99881 - sqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags);
99884 + sqlite3_str_appendf(pStr, "IN flags=0x%x", pExpr->flags);
99885 + if( pExpr->iTable ) sqlite3_str_appendf(pStr, " iTable=%d",pExpr->iTable);
99888 + pExpr->y.sub.regReturn, pExpr->y.sub.iAddr);
99893 sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
99895 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
99896 @@ -30994,7 +31870,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr,…
99898 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
99900 - sqlite3TreeViewPop(pView);
99905 @@ -31016,13 +31892,25 @@ SQLITE_PRIVATE void sqlite3TreeViewBareExprList(
99906 int j = pList->a[i].u.x.iOrderByCol;
99907 char *zName = pList->a[i].zEName;
99908 int moreToFollow = i<pList->nExpr - 1;
99909 - if( pList->a[i].eEName!=ENAME_NAME ) zName = 0;
99911 - sqlite3TreeViewPush(pView, moreToFollow);
99916 - fprintf(stdout, "AS %s ", zName);
99917 + switch( pList->a[i].fg.eEName ){
99922 + fprintf(stdout, "TABLE-ALIAS-NAME(\"%s\") ", zName);
99923 + if( pList->a[i].fg.bUsed ) fprintf(stdout, "(used) ");
99924 + if( pList->a[i].fg.bUsingTerm ) fprintf(stdout, "(USING-term) ");
99925 + if( pList->a[i].fg.bNoExpand ) fprintf(stdout, "(NoExpand) ");
99934 @@ -31032,7 +31920,7 @@ SQLITE_PRIVATE void sqlite3TreeViewBareExprList(
99936 sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow);
99938 - sqlite3TreeViewPop(pView);
99943 @@ -31043,11 +31931,378 @@ SQLITE_PRIVATE void sqlite3TreeViewExprList(
99947 - pView = sqlite3TreeViewPush(pView, moreToFollow);
99950 - sqlite3TreeViewPop(pView);
99955 +** Generate a human-readable explanation of an id-list.
99968 + for(i=0; i<pList->nId; i++){
99969 + char *zName = pList->a[i].zName;
99970 + int moreToFollow = i<pList->nId - 1;
99974 + if( pList->eU4==EU4_NONE ){
99976 + }else if( pList->eU4==EU4_IDX ){
99977 + fprintf(stdout, "%s (%d)\n", zName, pList->a[i].u4.idx);
99979 + assert( pList->eU4==EU4_EXPR );
99980 + if( pList->a[i].u4.pExpr==0 ){
99984 + sqlite3TreeViewPush(&pView, i<pList->nId-1);
99985 + sqlite3TreeViewExpr(pView, pList->a[i].u4.pExpr, 0);
100005 +** Generate a human-readable explanation of a list of Upsert objects
100016 + sqlite3TreeViewPush(&pView, pUpsert->pNextUpsert!=0 || moreToFollow);
100018 + pUpsert->isDoUpdate ? "UPDATE" : "NOTHING");
100019 + n = (pUpsert->pUpsertSet!=0) + (pUpsert->pUpsertWhere!=0);
100020 + sqlite3TreeViewExprList(pView, pUpsert->pUpsertTarget, (n--)>0, "TARGET");
100021 + sqlite3TreeViewExprList(pView, pUpsert->pUpsertSet, (n--)>0, "SET");
100022 + if( pUpsert->pUpsertWhere ){
100023 + sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
100024 + sqlite3TreeViewExpr(pView, pUpsert->pUpsertWhere, 0);
100028 + pUpsert = pUpsert->pNextUpsert;
100035 +** Generate a human-readable diagram of the data structure that go
100057 + sqlite3TreeViewPush(&pView, (--n)>0);
100062 + sqlite3TreeViewPush(&pView, (--n)>0);
100068 + sqlite3TreeViewPush(&pView, (--n)>0);
100074 + sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY");
100077 + sqlite3TreeViewPush(&pView, (--n)>0);
100083 + sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
100091 +** Generate a human-readable diagram of the data structure that go
100124 + sqlite3TreeViewPush(&pView, (--n)>0);
100129 + sqlite3TreeViewPush(&pView, (--n)>0);
100135 + sqlite3TreeViewIdList(pView, pColumnList, (--n)>0, "COLUMNS");
100138 + sqlite3TreeViewPush(&pView, (--n)>0);
100139 + sqlite3TreeViewLine(pView, "DATA-SOURCE");
100144 + sqlite3TreeViewExprList(pView, pExprList, (--n)>0, "VALUES");
100147 + sqlite3TreeViewPush(&pView, (--n)>0);
100153 + sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
100161 +** Generate a human-readable diagram of the data structure that go
100196 + sqlite3TreeViewPush(&pView, (--n)>0);
100201 + sqlite3TreeViewPush(&pView, (--n)>0);
100207 + sqlite3TreeViewExprList(pView, pChanges, (--n)>0, "SET");
100210 + sqlite3TreeViewPush(&pView, (--n)>0);
100216 + sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY");
100219 + sqlite3TreeViewPush(&pView, (--n)>0);
100225 + sqlite3TreeViewPush(&pView, (--n)>0);
100231 + sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
100239 +** Show a human-readable graph of a TriggerStep
100250 + moreToFollow || (showFullList && pStep->pNext!=0));
100252 + if( cnt++ && pStep->pNext==0 ){
100256 + sqlite3TreeViewLine(pView, "%s", pStep->zSpan ? pStep->zSpan : "RETURNING");
100257 + }while( showFullList && (pStep = pStep->pNext)!=0 );
100262 +** Show a human-readable graph of a Trigger
100273 + moreToFollow || (showFullList && pTrigger->pNext!=0));
100275 + if( cnt++ && pTrigger->pNext==0 ){
100279 + sqlite3TreeViewLine(pView, "TRIGGER %s", pTrigger->zName);
100281 + sqlite3TreeViewTriggerStep(pView, pTrigger->step_list, 0, 1);
100283 + }while( showFullList && (pTrigger = pTrigger->pNext)!=0 );
100290 +** These simplified versions of the tree-view routines omit unnecessary
100324 @@ -32128,7 +33383,11 @@ static SQLITE_NOINLINE void sqlite3ErrorFinish(sqlite3 *db, int err_code){
100325 SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
100326 assert( db!=0 );
100327 db->errCode = err_code;
100328 - if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
100329 + if( err_code || db->pErr ){
100330 + sqlite3ErrorFinish(db, err_code);
100332 + db->errByteOffset = -1;
100337 @@ -32138,6 +33397,7 @@ SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
100338 SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
100339 assert( db!=0 );
100340 db->errCode = SQLITE_OK;
100341 + db->errByteOffset = -1;
100342 if( db->pErr ) sqlite3ValueSetNull(db->pErr);
100345 @@ -32158,17 +33418,8 @@ SQLITE_PRIVATE void sqlite3SystemError(sqlite3 *db, int rc){
100346 ** handle "db". The error code is set to "err_code".
100349 -** error string in the style of the printf functions: The following
100350 -** format characters are allowed:
100351 -**
100352 -** %s Insert a string
100353 -** %z A string that should be freed after use
100354 -** %d Insert an integer
100355 -** %T Insert a token
100356 -** %S Insert the first element of a SrcList
100357 -**
100358 -** zFormat and any string tokens that follow it are assumed to be
100359 -** encoded in UTF-8.
100361 +** assumed to be encoded in UTF-8.
100363 ** To clear the most recent error for sqlite handle "db", sqlite3Error
100365 @@ -32192,13 +33443,6 @@ SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const c…
100368 ** Add an error message to pParse->zErrMsg and increment pParse->nErr.
100369 -** The following formatting characters are allowed:
100370 -**
100371 -** %s Insert a string
100372 -** %z A string that should be freed after use
100373 -** %d Insert an integer
100374 -** %T Insert a token
100375 -** %S Insert the first element of a SrcList
100379 @@ -32211,11 +33455,19 @@ SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, .…
100382 sqlite3 *db = pParse->db;
100383 + assert( db!=0 );
100384 + assert( db->pParse==pParse || db->pParse->pToplevel==pParse );
100385 + db->errByteOffset = -2;
100387 zMsg = sqlite3VMPrintf(db, zFormat, ap);
100389 + if( db->errByteOffset<-1 ) db->errByteOffset = -1;
100390 if( db->suppressErr ){
100391 sqlite3DbFree(db, zMsg);
100392 + if( db->mallocFailed ){
100393 + pParse->nErr++;
100394 + pParse->rc = SQLITE_NOMEM;
100397 pParse->nErr++;
100398 sqlite3DbFree(db, pParse->zErrMsg);
100399 @@ -33597,7 +34849,6 @@ SQLITE_PRIVATE LogEst sqlite3LogEst(u64 x){
100400 return a[x&7] + y - 10;
100403 -#ifndef SQLITE_OMIT_VIRTUALTABLE
100407 @@ -33612,16 +34863,9 @@ SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){
100408 e = (a>>52) - 1022;
100411 -#endif /* SQLITE_OMIT_VIRTUALTABLE */
100413 -#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
100414 - defined(SQLITE_ENABLE_STAT4) || \
100415 - defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
100418 -**
100419 -** Note that this routine is only used when one or more of various
100420 -** non-standard compile-time options is enabled.
100424 @@ -33629,17 +34873,9 @@ SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){
100426 if( n>=5 ) n -= 2;
100427 else if( n>=1 ) n -= 1;
100428 -#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \
100429 - defined(SQLITE_EXPLAIN_ESTIMATED_ROWS)
100431 -#else
100432 - /* If only SQLITE_ENABLE_STAT4 is on, then the largest input
100433 - ** possible to this routine is 310, resulting in a maximum x of 31 */
100434 - assert( x<=60 );
100435 -#endif
100436 return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x);
100438 -#endif /* defined SCANSTAT or STAT4 or ESTIMATED_ROWS */
100442 @@ -34033,42 +35269,42 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
100446 - /* 3 */ "SorterNext" OpHelp(""),
100447 - /* 4 */ "Prev" OpHelp(""),
100448 - /* 5 */ "Next" OpHelp(""),
100449 - /* 6 */ "Checkpoint" OpHelp(""),
100450 - /* 7 */ "JournalMode" OpHelp(""),
100451 - /* 8 */ "Vacuum" OpHelp(""),
100452 - /* 9 */ "VFilter" OpHelp("iplan=r[P3] zplan='P4'"),
100453 - /* 10 */ "VUpdate" OpHelp("data=r[P3@P2]"),
100454 - /* 11 */ "Goto" OpHelp(""),
100455 - /* 12 */ "Gosub" OpHelp(""),
100456 - /* 13 */ "InitCoroutine" OpHelp(""),
100457 - /* 14 */ "Yield" OpHelp(""),
100458 - /* 15 */ "MustBeInt" OpHelp(""),
100473 - /* 17 */ "Jump" OpHelp(""),
100474 - /* 18 */ "Once" OpHelp(""),
100475 - /* 19 */ "If" OpHelp(""),
100476 - /* 20 */ "IfNot" OpHelp(""),
100477 - /* 21 */ "IsNullOrType" OpHelp("if typeof(r[P1]) IN (P3,5) goto P2"),
100478 - /* 22 */ "IfNullRow" OpHelp("if P1.nullRow then r[P3]=NULL, goto P2"),
100479 - /* 23 */ "SeekLT" OpHelp("key=r[P3@P4]"),
100480 - /* 24 */ "SeekLE" OpHelp("key=r[P3@P4]"),
100481 - /* 25 */ "SeekGE" OpHelp("key=r[P3@P4]"),
100482 - /* 26 */ "SeekGT" OpHelp("key=r[P3@P4]"),
100483 - /* 27 */ "IfNotOpen" OpHelp("if( !csr[P1] ) goto P2"),
100484 - /* 28 */ "IfNoHope" OpHelp("key=r[P3@P4]"),
100485 - /* 29 */ "NoConflict" OpHelp("key=r[P3@P4]"),
100486 - /* 30 */ "NotFound" OpHelp("key=r[P3@P4]"),
100487 - /* 31 */ "Found" OpHelp("key=r[P3@P4]"),
100488 - /* 32 */ "SeekRowid" OpHelp("intkey=r[P3]"),
100489 - /* 33 */ "NotExists" OpHelp("intkey=r[P3]"),
100490 - /* 34 */ "Last" OpHelp(""),
100491 - /* 35 */ "IfSmaller" OpHelp(""),
100492 - /* 36 */ "SorterSort" OpHelp(""),
100493 - /* 37 */ "Sort" OpHelp(""),
100494 - /* 38 */ "Rewind" OpHelp(""),
100520 @@ -34093,35 +35329,35 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
100521 /* 60 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
100524 - /* 63 */ "Init" OpHelp("Start at P2"),
100525 - /* 64 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"),
100526 - /* 65 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"),
100527 - /* 66 */ "Return" OpHelp(""),
100528 - /* 67 */ "EndCoroutine" OpHelp(""),
100529 - /* 68 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
100530 - /* 69 */ "Halt" OpHelp(""),
100531 - /* 70 */ "Integer" OpHelp("r[P2]=P1"),
100532 - /* 71 */ "Int64" OpHelp("r[P2]=P4"),
100533 - /* 72 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
100534 - /* 73 */ "Null" OpHelp("r[P2..P3]=NULL"),
100535 - /* 74 */ "SoftNull" OpHelp("r[P1]=NULL"),
100536 - /* 75 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
100537 - /* 76 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
100538 - /* 77 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
100539 - /* 78 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
100540 - /* 79 */ "SCopy" OpHelp("r[P2]=r[P1]"),
100541 - /* 80 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
100542 - /* 81 */ "ChngCntRow" OpHelp("output=r[P1]"),
100543 - /* 82 */ "ResultRow" OpHelp("output=r[P1@P2]"),
100544 - /* 83 */ "CollSeq" OpHelp(""),
100545 - /* 84 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
100546 - /* 85 */ "RealAffinity" OpHelp(""),
100547 - /* 86 */ "Cast" OpHelp("affinity(r[P1])"),
100548 - /* 87 */ "Permutation" OpHelp(""),
100549 - /* 88 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
100550 - /* 89 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"),
100551 - /* 90 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"),
100552 - /* 91 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"),
100580 + /* 90 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
100585 @@ -34132,86 +35368,91 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
100589 - /* 102 */ "Column" OpHelp("r[P3]=PX"),
100590 - /* 103 */ "BitNot" OpHelp("r[P2]= ~r[P1]"),
100591 - /* 104 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"),
100592 - /* 105 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
100593 - /* 106 */ "String8" OpHelp("r[P2]='P4'"),
100594 - /* 107 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
100595 - /* 108 */ "Count" OpHelp("r[P2]=count()"),
100596 - /* 109 */ "ReadCookie" OpHelp(""),
100597 - /* 110 */ "SetCookie" OpHelp(""),
100598 - /* 111 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
100599 - /* 112 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
100600 - /* 113 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
100601 - /* 114 */ "OpenDup" OpHelp(""),
100602 - /* 115 */ "OpenAutoindex" OpHelp("nColumn=P2"),
100603 - /* 116 */ "OpenEphemeral" OpHelp("nColumn=P2"),
100604 - /* 117 */ "SorterOpen" OpHelp(""),
100605 - /* 118 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
100606 - /* 119 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
100607 - /* 120 */ "Close" OpHelp(""),
100608 - /* 121 */ "ColumnsUsed" OpHelp(""),
100609 - /* 122 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
100610 - /* 123 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
100611 - /* 124 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
100612 - /* 125 */ "NewRowid" OpHelp("r[P2]=rowid"),
100613 - /* 126 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
100614 - /* 127 */ "RowCell" OpHelp(""),
100615 - /* 128 */ "Delete" OpHelp(""),
100616 - /* 129 */ "ResetCount" OpHelp(""),
100617 - /* 130 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
100618 - /* 131 */ "SorterData" OpHelp("r[P2]=data"),
100619 - /* 132 */ "RowData" OpHelp("r[P2]=data"),
100620 - /* 133 */ "Rowid" OpHelp("r[P2]=rowid"),
100621 - /* 134 */ "NullRow" OpHelp(""),
100622 - /* 135 */ "SeekEnd" OpHelp(""),
100623 - /* 136 */ "IdxInsert" OpHelp("key=r[P2]"),
100624 - /* 137 */ "SorterInsert" OpHelp("key=r[P2]"),
100625 - /* 138 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
100626 - /* 139 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
100627 - /* 140 */ "IdxRowid" OpHelp("r[P2]=rowid"),
100628 - /* 141 */ "FinishSeek" OpHelp(""),
100629 - /* 142 */ "Real" OpHelp("r[P2]=P4"),
100630 - /* 143 */ "Destroy" OpHelp(""),
100631 - /* 144 */ "Clear" OpHelp(""),
100632 - /* 145 */ "ResetSorter" OpHelp(""),
100633 - /* 146 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
100634 - /* 147 */ "SqlExec" OpHelp(""),
100635 - /* 148 */ "ParseSchema" OpHelp(""),
100636 - /* 149 */ "LoadAnalysis" OpHelp(""),
100637 - /* 150 */ "DropTable" OpHelp(""),
100638 - /* 151 */ "DropIndex" OpHelp(""),
100639 - /* 152 */ "DropTrigger" OpHelp(""),
100640 - /* 153 */ "IntegrityCk" OpHelp(""),
100641 - /* 154 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
100642 - /* 155 */ "Param" OpHelp(""),
100643 - /* 156 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
100644 - /* 157 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
100645 - /* 158 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"…
100646 - /* 159 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
100647 - /* 160 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
100648 - /* 161 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
100649 - /* 162 */ "AggValue" OpHelp("r[P3]=value N=P2"),
100650 - /* 163 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
100651 - /* 164 */ "Expire" OpHelp(""),
100652 - /* 165 */ "CursorLock" OpHelp(""),
100653 - /* 166 */ "CursorUnlock" OpHelp(""),
100654 - /* 167 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
100655 - /* 168 */ "VBegin" OpHelp(""),
100656 - /* 169 */ "VCreate" OpHelp(""),
100657 - /* 170 */ "VDestroy" OpHelp(""),
100658 - /* 171 */ "VOpen" OpHelp(""),
100659 - /* 172 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
100660 - /* 173 */ "VRename" OpHelp(""),
100661 - /* 174 */ "Pagecount" OpHelp(""),
100662 - /* 175 */ "MaxPgcnt" OpHelp(""),
100663 - /* 176 */ "Trace" OpHelp(""),
100664 - /* 177 */ "CursorHint" OpHelp(""),
100665 - /* 178 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
100666 - /* 179 */ "Noop" OpHelp(""),
100667 - /* 180 */ "Explain" OpHelp(""),
100668 - /* 181 */ "Abortable" OpHelp(""),
100691 + /* 124 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
100727 + /* 160 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"…
100757 @@ -39131,11 +40372,17 @@ static int unixShmLock(
100761 - unixShm *p = pDbFd->pShm; /* The shared memory being locked */
100762 - unixShmNode *pShmNode = p->pShmNode; /* The underlying file iNode */
100767 - int *aLock = pShmNode->aLock;
100770 + p = pDbFd->pShm;
100772 + pShmNode = p->pShmNode;
100774 + aLock = pShmNode->aLock;
100776 assert( pShmNode==pDbFd->pInode->pShmNode );
100777 assert( pShmNode->pInode==pDbFd->pInode );
100778 @@ -40070,6 +41317,7 @@ static const char *unixTempFileDir(void){
100784 /* It's odd to simulate an io-error here, but really this is just
100785 ** using the io-error infrastructure to test that SQLite handles this
100786 @@ -40078,18 +41326,26 @@ static int unixGetTempname(int nBuf, char *zBuf){
100792 - if( zDir==0 ) return SQLITE_IOERR_GETTEMPPATH;
100793 - do{
100794 - u64 r;
100795 - sqlite3_randomness(sizeof(r), &r);
100796 - assert( nBuf>2 );
100797 - zBuf[nBuf-2] = 0;
100798 - sqlite3_snprintf(nBuf, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX"%llx%c",
100799 - zDir, r, 0);
100800 - if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ) return SQLITE_ERROR;
100801 - }while( osAccess(zBuf,0)==0 );
100802 - return SQLITE_OK;
100810 + zBuf[nBuf-2] = 0;
100813 + if( zBuf[nBuf-2]!=0 || (iLimit++)>10 ){
100824 @@ -40232,20 +41488,23 @@ static int findCreateFileMode(
100830 + ** a '-' character. However in 8+3 filename mode, or if a corrupt
100831 + ** rollback journal specifies a super-journal with a goofy name, then
100832 + ** the '-' might be missing or the '-' might be the first character in
100835 nDb = sqlite3Strlen30(zPath) - 1;
100836 - while( zPath[nDb]!='-' ){
100837 - /* In normal operation, the journal file name will always contain
100838 - ** a '-' character. However in 8+3 filename mode, or if a corrupt
100839 - ** rollback journal specifies a super-journal with a goofy name, then
100840 - ** the '-' might be missing. */
100841 - if( nDb==0 || zPath[nDb]=='.' ) return SQLITE_OK;
100843 + if( zPath[nDb]=='-' ){
100849 nDb--;
100851 - memcpy(zDb, zPath, nDb);
100852 - zDb[nDb] = '\0';
100853 -
100854 - rc = getFileMode(zDb, pMode, pUid, pGid);
100858 @@ -40635,86 +41894,99 @@ static int unixAccess(
100862 -** If the last component of the pathname in z[0]..z[j-1] is something
100863 -** other than ".." then back it out and return true. If the last
100864 -** component is empty or if it is ".." then return false.
100867 -static int unixBackupDir(const char *z, int *pJ){
100868 - int j = *pJ;
100869 - int i;
100870 - if( j<=0 ) return 0;
100871 - for(i=j-1; i>0 && z[i-1]!='/'; i--){}
100872 - if( i==0 ) return 0;
100873 - if( z[i]=='.' && i==j-2 && z[i+1]=='.' ) return 0;
100874 - *pJ = i-1;
100875 - return 1;
100876 -}
100879 + int rc; /* Non-zero following any error */
100890 -** Convert a relative pathname into a full pathname. Also
100891 -** simplify the pathname as follows:
100892 -**
100893 -** Remove all instances of /./
100894 -** Remove all isntances of /X/../ for any X
100897 -static int mkFullPathname(
100898 - const char *zPath, /* Input path */
100899 - char *zOut, /* Output buffer */
100900 - int nOut /* Allocated size of buffer zOut */
100903 + const char *zName, /* Name to append to pPath. Not zero-terminated */
100906 - int nPath = sqlite3Strlen30(zPath);
100907 - int iOff = 0;
100908 - int i, j;
100909 - if( zPath[0]!='/' ){
100910 - if( osGetcwd(zOut, nOut-2)==0 ){
100911 - return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath);
100917 + if( pPath->nUsed<=1 ){
100918 + pPath->rc = SQLITE_ERROR;
100921 + assert( pPath->zOut[0]=='/' );
100922 + while( pPath->zOut[--pPath->nUsed]!='/' ){}
100925 - iOff = sqlite3Strlen30(zOut);
100926 - zOut[iOff++] = '/';
100927 - }
100928 - if( (iOff+nPath+1)>nOut ){
100929 - /* SQLite assumes that xFullPathname() nul-terminates the output buffer
100930 - ** even if it returns an error. */
100931 - zOut[iOff] = '\0';
100932 - return SQLITE_CANTOPEN_BKPT;
100934 - sqlite3_snprintf(nOut-iOff, &zOut[iOff], "%s", zPath);
100935 -
100936 - /* Remove duplicate '/' characters. Except, two // at the beginning
100937 - ** of a pathname is allowed since this is important on windows. */
100938 - for(i=j=1; zOut[i]; i++){
100939 - zOut[j++] = zOut[i];
100940 - while( zOut[i]=='/' && zOut[i+1]=='/' ) i++;
100941 + if( pPath->nUsed + nName + 2 >= pPath->nOut ){
100942 + pPath->rc = SQLITE_ERROR;
100945 - zOut[j] = 0;
100946 -
100947 - assert( zOut[0]=='/' );
100948 - for(i=j=0; zOut[i]; i++){
100949 - if( zOut[i]=='/' ){
100950 - /* Skip over internal "/." directory components */
100951 - if( zOut[i+1]=='.' && zOut[i+2]=='/' ){
100952 - i += 1;
100953 - continue;
100954 + pPath->zOut[pPath->nUsed++] = '/';
100955 + memcpy(&pPath->zOut[pPath->nUsed], zName, nName);
100956 + pPath->nUsed += nName;
100958 + if( pPath->rc==SQLITE_OK ){
100961 + pPath->zOut[pPath->nUsed] = 0;
100962 + zIn = pPath->zOut;
100965 + pPath->rc = unixLogError(SQLITE_CANTOPEN_BKPT, "lstat", zIn);
100967 -
100968 - /* If this is a "/.." directory component then back out the
100969 - ** previous term of the directory if it is something other than "..".
100970 - */
100971 - if( zOut[i+1]=='.'
100972 - && zOut[i+2]=='.'
100973 - && zOut[i+3]=='/'
100974 - && unixBackupDir(zOut, &j)
100975 - ){
100976 - i += 2;
100977 - continue;
100981 + if( pPath->nSymlink++ > SQLITE_MAX_SYMLINK ){
100982 + pPath->rc = SQLITE_CANTOPEN_BKPT;
100985 + got = osReadlink(zIn, zLnk, sizeof(zLnk)-2);
100986 + if( got<=0 || got>=(ssize_t)sizeof(zLnk)-2 ){
100987 + pPath->rc = unixLogError(SQLITE_CANTOPEN_BKPT, "readlink", zIn);
100992 + pPath->nUsed = 0;
100994 + pPath->nUsed -= nName + 1;
100998 - if( ALWAYS(j>=0) ) zOut[j] = zOut[i];
100999 - j++;
101001 - if( NEVER(j==0) ) zOut[j++] = '/';
101002 - zOut[j] = 0;
101003 - return SQLITE_OK;
101012 + const char *zPath /* Path to append to pPath. Is zero-terminated */
101019 + appendOnePathElement(pPath, &zPath[j], i-j);
101026 @@ -40732,86 +42004,27 @@ static int unixFullPathname(
101030 -#if !defined(HAVE_READLINK) || !defined(HAVE_LSTAT)
101031 - return mkFullPathname(zPath, zOut, nOut);
101032 -#else
101033 - int rc = SQLITE_OK;
101034 - int nByte;
101035 - int nLink = 0; /* Number of symbolic links followed so far */
101036 - const char *zIn = zPath; /* Input path for each iteration of loop */
101037 - char *zDel = 0;
101038 -
101039 - assert( pVfs->mxPathname==MAX_PATHNAME );
101042 -
101043 - /* It's odd to simulate an io-error here, but really this is just
101044 - ** using the io-error infrastructure to test that SQLite handles this
101045 - ** function failing. This function could fail if, for example, the
101046 - ** current working directory has been unlinked.
101047 - */
101048 - SimulateIOError( return SQLITE_ERROR );
101049 -
101050 - do {
101051 -
101052 - /* Call stat() on path zIn. Set bLink to true if the path is a symbolic
101053 - ** link, or false otherwise. */
101054 - int bLink = 0;
101055 - struct stat buf;
101056 - if( osLstat(zIn, &buf)!=0 ){
101057 - if( errno!=ENOENT ){
101058 - rc = unixLogError(SQLITE_CANTOPEN_BKPT, "lstat", zIn);
101059 - }
101060 - }else{
101061 - bLink = S_ISLNK(buf.st_mode);
101062 - }
101063 -
101064 - if( bLink ){
101065 - nLink++;
101066 - if( zDel==0 ){
101067 - zDel = sqlite3_malloc(nOut);
101068 - if( zDel==0 ) rc = SQLITE_NOMEM_BKPT;
101069 - }else if( nLink>=SQLITE_MAX_SYMLINKS ){
101070 - rc = SQLITE_CANTOPEN_BKPT;
101071 - }
101072 -
101073 - if( rc==SQLITE_OK ){
101074 - nByte = osReadlink(zIn, zDel, nOut-1);
101075 - if( nByte<0 ){
101076 - rc = unixLogError(SQLITE_CANTOPEN_BKPT, "readlink", zIn);
101077 - }else{
101078 - if( zDel[0]!='/' ){
101079 - int n;
101080 - for(n = sqlite3Strlen30(zIn); n>0 && zIn[n-1]!='/'; n--);
101081 - if( nByte+n+1>nOut ){
101082 - rc = SQLITE_CANTOPEN_BKPT;
101083 - }else{
101084 - memmove(&zDel[n], zDel, nByte+1);
101085 - memcpy(zDel, zIn, n);
101086 - nByte += n;
101087 - }
101088 - }
101089 - zDel[nByte] = '\0';
101090 - }
101091 - }
101092 -
101093 - zIn = zDel;
101094 - }
101095 -
101096 - assert( rc!=SQLITE_OK || zIn!=zOut || zIn[0]=='/' );
101097 - if( rc==SQLITE_OK && zIn!=zOut ){
101098 - rc = mkFullPathname(zIn, zOut, nOut);
101106 + if( osGetcwd(zPwd, sizeof(zPwd)-2)==0 ){
101109 - if( bLink==0 ) break;
101110 - zIn = zOut;
101111 - }while( rc==SQLITE_OK );
101112 -
101113 - sqlite3_free(zDel);
101114 - if( rc==SQLITE_OK && nLink ) rc = SQLITE_OK_SYMLINK;
101115 - return rc;
101116 -#endif /* HAVE_READLINK && HAVE_LSTAT */
101126 -
101130 @@ -44271,10 +45484,12 @@ SQLITE_API int sqlite3_win32_set_directory8(
101136 - int rc = sqlite3_initialize();
101144 @@ -44289,14 +45504,19 @@ SQLITE_API int sqlite3_win32_set_directory8(
101148 - return SQLITE_NOMEM_BKPT;
101155 - return SQLITE_OK;
101160 - return SQLITE_ERROR;
101167 @@ -46423,10 +47643,14 @@ static int winShmLock(
101169 winShm *p = pDbFd->pShm; /* The shared memory being locked */
101171 - winShmNode *pShmNode = p->pShmNode;
101177 + pShmNode = p->pShmNode;
101183 @@ -47066,6 +48290,18 @@ static int winMakeEndInDirSep(int nBuf, char *zBuf){
101202 @@ -47102,20 +48338,23 @@ static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
101204 nDir = nMax - (nPre + 15);
101206 - if( sqlite3_temp_directory ){
101210 if( !winIsDirSep(sqlite3_temp_directory[nDirLen-1]) ){
101216 OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n"));
101227 @@ -47904,7 +49143,7 @@ static BOOL winIsVerbatimPathname(
101228 ** pathname into zOut[]. zOut[] will be at least pVfs->mxPathname
101231 -static int winFullPathname(
101236 @@ -48083,6 +49322,19 @@ static int winFullPathname(
101256 @@ -50427,14 +51679,24 @@ SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *pCache){
101259 PCache *pCache = p->pCache;
101261 assert( p->nRef>0 );
101264 pcacheTrace(("%p.MOVE %d -> %d\n",pCache,p->pgno,newPgno));
101265 + pOther = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, newPgno, 0);
101267 + PgHdr *pXPage = (PgHdr*)pOther->pExtra;
101268 + assert( pXPage->nRef==0 );
101269 + pXPage->nRef++;
101270 + pCache->nRefSum++;
101273 sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno);
101274 p->pgno = newPgno;
101275 if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){
101281 @@ -51816,23 +53078,26 @@ static void pcache1Rekey(
101285 - unsigned int h;
101287 assert( pPage->iKey==iOld );
101288 assert( pPage->pCache==pCache );
101291 pcache1EnterMutex(pCache->pGroup);
101293 - h = iOld%pCache->nHash;
101294 - pp = &pCache->apHash[h];
101296 + hOld = iOld%pCache->nHash;
101297 + pp = &pCache->apHash[hOld];
101299 pp = &(*pp)->pNext;
101301 *pp = pPage->pNext;
101303 - h = iNew%pCache->nHash;
101305 + hNew = iNew%pCache->nHash;
101306 pPage->iKey = iNew;
101307 - pPage->pNext = pCache->apHash[h];
101308 - pCache->apHash[h] = pPage;
101309 + pPage->pNext = pCache->apHash[hNew];
101310 + pCache->apHash[hNew] = pPage;
101311 if( iNew>pCache->iMaxKey ){
101312 pCache->iMaxKey = iNew;
101314 @@ -53325,6 +54590,7 @@ struct Pager {
101322 @@ -54311,7 +55577,7 @@ static int readJournalHdr(
101326 -** + 4 bytes: PAGER_MJ_PGNO.
101328 ** + N bytes: super-journal filename in utf-8.
101329 ** + 4 bytes: N (length of super-journal name in bytes, no nul-terminator).
101330 ** + 4 bytes: super-journal name checksum.
101331 @@ -54359,7 +55625,7 @@ static int writeSuperJournal(Pager *pPager, const char *zSuper){
101332 /* Write the super-journal data to the end of the journal file. If
101335 - if( (0 != (rc = write32bits(pPager->jfd, iHdrOff, PAGER_MJ_PGNO(pPager))))
101336 + if( (0 != (rc = write32bits(pPager->jfd, iHdrOff, PAGER_SJ_PGNO(pPager))))
101337 || (0 != (rc = sqlite3OsWrite(pPager->jfd, zSuper, nSuper, iHdrOff+4)))
101338 || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nSuper, nSuper)))
101339 || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nSuper+4, cksum)))
101340 @@ -54869,7 +56135,7 @@ static u32 pager_cksum(Pager *pPager, const u8 *aData){
101344 -** * If the record page-number is illegal (0 or PAGER_MJ_PGNO), or
101345 +** * If the record page-number is illegal (0 or PAGER_SJ_PGNO), or
101349 @@ -54929,7 +56195,7 @@ static int pager_playback_one_page(
101353 - if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
101358 @@ -55266,6 +56532,7 @@ static int pager_truncate(Pager *pPager, Pgno nPage){
101360 testcase( (newSize-szPage) == currentSize );
101361 testcase( (newSize-szPage) > currentSize );
101362 + sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &newSize);
101363 rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, newSize-szPage);
101366 @@ -55488,6 +56755,9 @@ static int pager_playback(Pager *pPager, int isHot){
101369 pPager->dbSize = mxPg;
101370 + if( pPager->mxPgno<mxPg ){
101371 + pPager->mxPgno = mxPg;
101376 @@ -56384,6 +57654,7 @@ SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, i…
101377 pPager->pTmpSpace = pNew;
101378 pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize);
101379 pPager->pageSize = pageSize;
101380 + pPager->lckPgno = (Pgno)(PENDING_BYTE/pageSize) + 1;
101384 @@ -56544,8 +57815,7 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){
101388 -** be necessary to write the current content out to the sub-journal
101389 -** (as determined by function subjRequiresPage()).
101390 +** be necessary to write the current content out to the sub-journal.
101394 @@ -56560,8 +57830,16 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){
101398 + Pager *pPager = pPg->pPager;
101399 assert( pPg->flags&PGHDR_DIRTY );
101400 - assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize );
101401 + if( pPg->pgno>pPager->dbSize ){ /* if (a) is false */
101402 + Pgno pgno = pPg->pgno;
101404 + for(i=0; i<pPg->pPager->nSavepoint; i++){
101405 + PagerSavepoint *p = &pPager->aSavepoint[i];
101406 + assert( p->nOrig<pgno || sqlite3BitvecTestNotNull(p->pInSavepoint,pgno) );
101411 sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb);
101412 @@ -56583,7 +57861,6 @@ static void assertTruncateConstraint(Pager *pPager){
101415 assert( pPager->dbSize>=nPage || CORRUPT_DB );
101416 - testcase( pPager->dbSize<nPage );
101417 assert( pPager->eState>=PAGER_WRITER_CACHEMOD );
101418 pPager->dbSize = nPage;
101420 @@ -57902,7 +59179,7 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){
101421 ** may mean that the pager was in the error-state when this
101424 - if( !isOpen(pPager->jfd) ){
101425 + if( !isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
101426 sqlite3_vfs * const pVfs = pPager->pVfs;
101429 @@ -58147,7 +59424,7 @@ static int getPageNormal(
101430 if( pPg->pPager && !noContent ){
101433 - assert( pgno!=PAGER_MJ_PGNO(pPager) );
101435 pPager->aStat[PAGER_STAT_HIT]++;
101438 @@ -58158,7 +59435,7 @@ static int getPageNormal(
101442 - if( pgno==PAGER_MJ_PGNO(pPager) ){
101447 @@ -58304,6 +59581,7 @@ SQLITE_PRIVATE int sqlite3PagerGet(
101452 return pPager->xGet(pPager, pgno, ppPage, flags);
101455 @@ -58452,6 +59730,7 @@ static int pager_open_journal(Pager *pPager){
101457 sqlite3BitvecDestroy(pPager->pInJournal);
101458 pPager->pInJournal = 0;
101459 + pPager->journalOff = 0;
101461 assert( pPager->eState==PAGER_WRITER_LOCKED );
101462 pPager->eState = PAGER_WRITER_CACHEMOD;
101463 @@ -58556,7 +59835,7 @@ static SQLITE_NOINLINE int pagerAddPageToRollbackJournal(PgHdr *pPg){
101467 - assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
101468 + assert( pPg->pgno!=PAGER_SJ_PGNO(pPager) );
101470 assert( pPager->journalHdr<=pPager->journalOff );
101471 pData2 = pPg->pData;
101472 @@ -58735,7 +60014,7 @@ static SQLITE_NOINLINE int pagerWriteLargeSector(PgHdr *pPg){
101475 if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){
101476 - if( pg!=PAGER_MJ_PGNO(pPager) ){
101481 @@ -59213,7 +60492,7 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(
101484 if( pPager->dbSize>pPager->dbFileSize ){
101485 - Pgno nNew = pPager->dbSize - (pPager->dbSize==PAGER_MJ_PGNO(pPager));
101486 + Pgno nNew = pPager->dbSize - (pPager->dbSize==PAGER_SJ_PGNO(pPager));
101487 assert( pPager->eState==PAGER_WRITER_DBMOD );
101490 @@ -59909,12 +61188,12 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
101491 u8 eOld = pPager->journalMode; /* Prior journalmode */
101494 - assert( eMode==PAGER_JOURNALMODE_DELETE
101495 - || eMode==PAGER_JOURNALMODE_TRUNCATE
101496 - || eMode==PAGER_JOURNALMODE_PERSIST
101497 - || eMode==PAGER_JOURNALMODE_OFF
101498 - || eMode==PAGER_JOURNALMODE_WAL
101499 - || eMode==PAGER_JOURNALMODE_MEMORY );
101509 @@ -59951,7 +61230,6 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
101511 assert( isOpen(pPager->fd) || pPager->exclusiveMode );
101512 if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){
101513 -
101517 @@ -60008,7 +61286,7 @@ SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){
101520 if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0;
101521 - if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0;
101522 + if( isOpen(pPager->jfd) && pPager->journalOff>0 ) return 0;
101526 @@ -60063,6 +61341,18 @@ SQLITE_PRIVATE int sqlite3PagerCheckpoint(
101530 + if( pPager->pWal==0 && pPager->journalMode==PAGER_JOURNALMODE_WAL ){
101540 + sqlite3_exec(db, "PRAGMA table_list",0,0,0);
101542 if( pPager->pWal ){
101543 rc = sqlite3WalCheckpoint(pPager->pWal, db, eMode,
101544 (eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler),
101545 @@ -62962,7 +64252,9 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){
101549 - szFrame = pWal->hdr.szPage + WAL_FRAME_HDRSIZE;
101550 + assert( (pWal->szPage & (pWal->szPage-1))==0 );
101551 + assert( pWal->szPage>=512 && pWal->szPage<=65536 );
101552 + szFrame = pWal->szPage + WAL_FRAME_HDRSIZE;
101556 @@ -62976,7 +64268,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){
101558 aSaveCksum[0] = pWal->hdr.aFrameCksum[0];
101559 aSaveCksum[1] = pWal->hdr.aFrameCksum[1];
101560 - for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->hdr.szPage);
101561 + for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->szPage);
101565 @@ -64827,7 +66119,9 @@ struct MemPage {
101569 - u8 *aDataEnd; /* One byte past the end of usable data */
101570 + u8 *aDataEnd; /* One byte past the end of the entire page - not just
101572 + ** corruption-induced buffer overflow. */
101576 @@ -65132,7 +66426,7 @@ struct BtCursor {
101580 -# define PENDING_BYTE_PAGE(pBt) PAGER_MJ_PGNO(pBt)
101581 +#define PENDING_BYTE_PAGE(pBt) ((Pgno)((PENDING_BYTE/((pBt)->pageSize))+1))
101584 ** These macros define the location of the pointer-map entry for a
101585 @@ -65773,7 +67067,7 @@ static int hasSharedCacheTableLock(
101587 for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){
101589 - if( pIdx->tnum==(int)iRoot ){
101590 + if( pIdx->tnum==iRoot ){
101594 @@ -66366,7 +67660,7 @@ SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *pCur){
101598 -** record and then call BtreeMovetoUnpacked() to do the work.
101603 @@ -66784,18 +68078,32 @@ static void btreeParseCellPtr(
101605 ** pIter += getVarint(pIter, (u64*)&pInfo->nKey);
101607 - ** The code is inlined to avoid a function call.
101609 + ** This routine is a high-runner.
101613 - u8 *pEnd = &pIter[7];
101614 - iKey &= 0x7f;
101615 - while(1){
101616 - iKey = (iKey<<7) | (*++pIter & 0x7f);
101617 - if( (*pIter)<0x80 ) break;
101618 - if( pIter>=pEnd ){
101619 - iKey = (iKey<<8) | *++pIter;
101620 - break;
101645 @@ -66805,7 +68113,7 @@ static void btreeParseCellPtr(
101646 pInfo->nPayload = nPayload;
101647 pInfo->pPayload = pIter;
101648 testcase( nPayload==pPage->maxLocal );
101649 - testcase( nPayload==pPage->maxLocal+1 );
101650 + testcase( nPayload==(u32)pPage->maxLocal+1 );
101651 if( nPayload<=pPage->maxLocal ){
101654 @@ -66842,7 +68150,7 @@ static void btreeParseCellPtrIndex(
101655 pInfo->nPayload = nPayload;
101656 pInfo->pPayload = pIter;
101657 testcase( nPayload==pPage->maxLocal );
101658 - testcase( nPayload==pPage->maxLocal+1 );
101659 + testcase( nPayload==(u32)pPage->maxLocal+1 );
101660 if( nPayload<=pPage->maxLocal ){
101663 @@ -66872,6 +68180,7 @@ static void btreeParseCell(
101671 @@ -66897,15 +68206,8 @@ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
101675 - if( pPage->intKey ){
101676 - /* pIter now points at the 64-bit integer key value, a variable length
101677 - ** integer. The following block moves pIter to point at the first byte
101678 - ** past the end of the key value. */
101679 - pEnd = &pIter[9];
101680 - while( (*pIter++)&0x80 && pIter<pEnd );
101681 - }
101682 testcase( nSize==pPage->maxLocal );
101683 - testcase( nSize==pPage->maxLocal+1 );
101684 + testcase( nSize==(u32)pPage->maxLocal+1 );
101685 if( nSize<=pPage->maxLocal ){
101686 nSize += (u32)(pIter - pCell);
101688 @@ -66913,7 +68215,7 @@ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
101689 int minLocal = pPage->minLocal;
101690 nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
101691 testcase( nSize==pPage->maxLocal );
101692 - testcase( nSize==pPage->maxLocal+1 );
101693 + testcase( nSize==(u32)pPage->maxLocal+1 );
101694 if( nSize>pPage->maxLocal ){
101697 @@ -66943,6 +68245,58 @@ static u16 cellSizePtrNoPayload(MemPage *pPage, u8 *pCell){
101698 assert( debuginfo.nSize==(u16)(pIter - pCell) || CORRUPT_DB );
101699 return (u16)(pIter - pCell);
101712 + pPage->xParseCell(pPage, pCell, &debuginfo);
101724 + /* pIter now points at the 64-bit integer key value, a variable length
101735 + testcase( nSize==pPage->maxLocal );
101736 + testcase( nSize==(u32)pPage->maxLocal+1 );
101737 + if( nSize<=pPage->maxLocal ){
101738 + nSize += (u32)(pIter - pCell);
101741 + int minLocal = pPage->minLocal;
101742 + nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
101743 + testcase( nSize==pPage->maxLocal );
101744 + testcase( nSize==(u32)pPage->maxLocal+1 );
101745 + if( nSize>pPage->maxLocal ){
101748 + nSize += 4 + (u16)(pIter - pCell);
101756 @@ -66956,7 +68310,7 @@ static u16 cellSize(MemPage *pPage, int iCell){
101760 -** of pPage. (pSrc and pPager are often the same.) If pCell contains a
101762 ** pointer to an overflow page, insert an entry into the pointer-map for
101765 @@ -67047,7 +68401,7 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){
101767 memmove(&data[iFree+sz+sz2], &data[iFree+sz], iFree2-(iFree+sz));
101769 - }else if( NEVER(iFree+sz>usableSize) ){
101774 @@ -67131,7 +68485,8 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
101775 const int hdr = pPg->hdrOffset; /* Offset to page header */
101776 u8 * const aData = pPg->aData; /* Page data */
101778 - int pc = get2byte(&aData[iAddr]); /* Address of a free slot */
101782 int maxPC = pPg->pBt->usableSize - nByte; /* Max address for a usable slot */
101784 @@ -67141,7 +68496,8 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
101785 /* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each
101786 ** freeblock form a big-endian integer which is the size of the freeblock
101787 ** in bytes, including the 4-byte header. */
101788 - size = get2byte(&aData[pc+2]);
101791 if( (x = size - nByte)>=0 ){
101794 @@ -67154,6 +68510,8 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
101803 @@ -67166,7 +68524,8 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
101807 - pc = get2byte(&aData[pc]);
101813 @@ -67200,6 +68559,7 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
101814 u8 * const data = pPage->aData; /* Local cache of pPage->aData */
101820 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
101821 @@ -67218,7 +68578,8 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
101823 ** However, that integer is too large to be stored in a 2-byte unsigned
101825 - top = get2byte(&data[hdr+5]);
101828 assert( top<=(int)pPage->pBt->usableSize ); /* by btreeComputeFreeSpace() */
101830 if( top==0 && pPage->pBt->usableSize==65536 ){
101831 @@ -67300,6 +68661,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
101834 unsigned char *data = pPage->aData; /* Page content */
101837 assert( pPage->pBt!=0 );
101838 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
101839 @@ -67327,7 +68689,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
101840 if( iFreeBlk>pPage->pBt->usableSize-4 ){ /* TH3: corrupt081.100 */
101843 - assert( iFreeBlk>iPtr || iFreeBlk==0 );
101848 @@ -67362,7 +68724,8 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
101850 data[hdr+7] -= nFrag;
101852 - x = get2byte(&data[hdr+5]);
101858 @@ -67406,7 +68769,6 @@ static int decodeFlags(MemPage *pPage, int flagByte){
101859 pPage->leaf = (u8)(flagByte>>3); assert( PTF_LEAF == 1<<3 );
101861 pPage->childPtrSize = 4-4*pPage->leaf;
101862 - pPage->xCellSize = cellSizePtr;
101863 pBt = pPage->pBt;
101865 /* EVIDENCE-OF: R-07291-35328 A value of 5 (0x05) means the page is an
101866 @@ -67418,6 +68780,7 @@ static int decodeFlags(MemPage *pPage, int flagByte){
101867 pPage->intKey = 1;
101868 if( pPage->leaf ){
101869 pPage->intKeyLeaf = 1;
101870 + pPage->xCellSize = cellSizePtrTableLeaf;
101871 pPage->xParseCell = btreeParseCellPtr;
101873 pPage->intKeyLeaf = 0;
101874 @@ -67435,12 +68798,17 @@ static int decodeFlags(MemPage *pPage, int flagByte){
101876 pPage->intKey = 0;
101877 pPage->intKeyLeaf = 0;
101878 + pPage->xCellSize = cellSizePtr;
101879 pPage->xParseCell = btreeParseCellPtrIndex;
101880 pPage->maxLocal = pBt->maxLocal;
101881 pPage->minLocal = pBt->minLocal;
101883 /* EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is
101885 + pPage->intKey = 0;
101886 + pPage->intKeyLeaf = 0;
101887 + pPage->xCellSize = cellSizePtr;
101888 + pPage->xParseCell = btreeParseCellPtrIndex;
101891 pPage->max1bytePayload = pBt->max1bytePayload;
101892 @@ -67598,7 +68966,7 @@ static int btreeInitPage(MemPage *pPage){
101893 pPage->nOverflow = 0;
101894 pPage->cellOffset = pPage->hdrOffset + 8 + pPage->childPtrSize;
101895 pPage->aCellIdx = data + pPage->childPtrSize + 8;
101896 - pPage->aDataEnd = pPage->aData + pBt->usableSize;
101897 + pPage->aDataEnd = pPage->aData + pBt->pageSize;
101898 pPage->aDataOfst = pPage->aData + pPage->childPtrSize;
101899 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
101901 @@ -67633,7 +69001,7 @@ static void zeroPage(MemPage *pPage, int flags){
101902 u8 hdr = pPage->hdrOffset;
101905 - assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );
101906 + assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno || CORRUPT_DB );
101907 assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
101908 assert( sqlite3PagerGetData(pPage->pDbPage) == data );
101909 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
101910 @@ -67649,7 +69017,7 @@ static void zeroPage(MemPage *pPage, int flags){
101911 pPage->nFree = (u16)(pBt->usableSize - first);
101913 pPage->cellOffset = first;
101914 - pPage->aDataEnd = &data[pBt->usableSize];
101915 + pPage->aDataEnd = &data[pBt->pageSize];
101916 pPage->aCellIdx = &data[first];
101917 pPage->aDataOfst = &data[pPage->childPtrSize];
101918 pPage->nOverflow = 0;
101919 @@ -67775,7 +69143,7 @@ static int getAndInitPage(
101923 - assert( (*ppPage)->pgno==pgno );
101924 + assert( (*ppPage)->pgno==pgno || CORRUPT_DB );
101925 assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) );
101928 @@ -67794,7 +69162,9 @@ getAndInitPage_error1:
101929 pCur->pPage = pCur->apPage[pCur->iPage];
101932 - assert( pgno!=0 || rc==SQLITE_CORRUPT );
101939 @@ -68252,30 +69622,38 @@ static int removeFromSharingList(BtShared *pBt){
101940 ** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child
101943 -static void allocateTempSpace(BtShared *pBt){
101944 - if( !pBt->pTmpSpace ){
101945 - pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
101946 -
101947 - /* One of the uses of pBt->pTmpSpace is to format cells before
101948 - ** inserting them into a leaf page (function fillInCell()). If
101949 - ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes
101950 - ** by the various routines that manipulate binary cells. Which
101951 - ** can mean that fillInCell() only initializes the first 2 or 3
101952 - ** bytes of pTmpSpace, but that the first 4 bytes are copied from
101953 - ** it into a database page. This is not actually a problem, but it
101954 - ** does cause a valgrind error when the 1 or 2 bytes of unitialized
101955 - ** data is passed to system call write(). So to avoid this error,
101956 - ** zero the first 4 bytes of temp space here.
101957 - **
101958 - ** Also: Provide four bytes of initialized space before the
101959 - ** beginning of pTmpSpace as an area available to prepend the
101960 - ** left-child pointer to the beginning of a cell.
101961 - */
101962 - if( pBt->pTmpSpace ){
101963 - memset(pBt->pTmpSpace, 0, 8);
101964 - pBt->pTmpSpace += 4;
101965 - }
101968 + assert( pBt->pTmpSpace==0 );
101971 + assert( pBt->pCursor!=0 && (pBt->pCursor->curFlags & BTCF_WriteFlag)!=0 );
101972 + pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
101973 + if( pBt->pTmpSpace==0 ){
101974 + BtCursor *pCur = pBt->pCursor;
101975 + pBt->pCursor = pCur->pNext; /* Unlink the cursor */
101980 + /* One of the uses of pBt->pTmpSpace is to format cells before
101993 + ** left-child pointer to the beginning of a cell.
101995 + memset(pBt->pTmpSpace, 0, 8);
101996 + pBt->pTmpSpace += 4;
102001 @@ -68772,9 +70150,13 @@ static int lockBtree(BtShared *pBt){
102002 pageSize-usableSize);
102005 - if( sqlite3WritableSchema(pBt->db)==0 && nPage>nPageFile ){
102006 - rc = SQLITE_CORRUPT_BKPT;
102007 - goto page1_init_failed;
102009 + if( sqlite3WritableSchema(pBt->db)==0 ){
102016 /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to
102018 @@ -69404,12 +70786,17 @@ static int incrVacuumStep(BtShared *pBt, Pgno nFin, Pgno iLastPg, int bCo…
102036 @@ -69804,7 +71191,7 @@ static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){
102037 int nPage = get4byte(&pPage1->aData[28]);
102039 if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
102040 - testcase( pBt->nPage!=nPage );
102041 + testcase( pBt->nPage!=(u32)nPage );
102042 pBt->nPage = nPage;
102045 @@ -70016,10 +71403,6 @@ static int btreeCursor(
102046 assert( pBt->pPage1 && pBt->pPage1->aData );
102047 assert( wrFlag==0 || (pBt->btsFlags & BTS_READ_ONLY)==0 );
102049 - if( wrFlag ){
102050 - allocateTempSpace(pBt);
102051 - if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT;
102052 - }
102056 @@ -70036,19 +71419,25 @@ static int btreeCursor(
102057 pCur->pKeyInfo = pKeyInfo;
102058 pCur->pBtree = p;
102059 pCur->pBt = pBt;
102060 - pCur->curFlags = wrFlag ? BTCF_WriteFlag : 0;
102061 - pCur->curPagerFlags = wrFlag ? 0 : PAGER_GET_READONLY;
102062 + pCur->curFlags = 0;
102065 for(pX=pBt->pCursor; pX; pX=pX->pNext){
102066 if( pX->pgnoRoot==iTable ){
102067 pX->curFlags |= BTCF_Multiple;
102068 - pCur->curFlags |= BTCF_Multiple;
102069 + pCur->curFlags = BTCF_Multiple;
102072 + pCur->eState = CURSOR_INVALID;
102073 pCur->pNext = pBt->pCursor;
102074 pBt->pCursor = pCur;
102075 - pCur->eState = CURSOR_INVALID;
102077 + pCur->curFlags |= BTCF_WriteFlag;
102078 + pCur->curPagerFlags = 0;
102079 + if( pBt->pTmpSpace==0 ) return allocateTempSpace(pBt);
102081 + pCur->curPagerFlags = PAGER_GET_READONLY;
102086 @@ -70823,7 +72212,7 @@ static int moveToRoot(BtCursor *pCur){
102087 while( --pCur->iPage ){
102088 releasePageNotNull(pCur->apPage[pCur->iPage]);
102090 - pCur->pPage = pCur->apPage[0];
102091 + pRoot = pCur->pPage = pCur->apPage[0];
102094 }else if( pCur->pgnoRoot==0 ){
102095 @@ -70848,7 +72237,7 @@ static int moveToRoot(BtCursor *pCur){
102096 pCur->curIntKey = pCur->pPage->intKey;
102098 pRoot = pCur->pPage;
102099 - assert( pRoot->pgno==pCur->pgnoRoot );
102100 + assert( pRoot->pgno==pCur->pgnoRoot || CORRUPT_DB );
102102 /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor
102103 ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is
102104 @@ -70870,7 +72259,6 @@ skip_init:
102105 pCur->info.nSize = 0;
102106 pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl);
102108 - pRoot = pCur->pPage;
102109 if( pRoot->nCell>0 ){
102110 pCur->eState = CURSOR_VALID;
102111 }else if( !pRoot->leaf ){
102112 @@ -71111,7 +72499,6 @@ SQLITE_PRIVATE int sqlite3BtreeTableMoveto(
102113 upr = pPage->nCell-1;
102115 idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */
102116 - pCur->ix = (u16)idx;
102120 @@ -71171,6 +72558,69 @@ moveto_table_finish:
102125 +** Compare the "idx"-th cell on the page the cursor pCur is currently
102146 + MemPage *pPage = pCur->pPage;
102152 + if( nCell<=pPage->max1bytePayload ){
102153 + /* This branch runs if the record-size field of the cell is a
102155 + ** b-tree page. */
102156 + testcase( pCell+nCell+1==pPage->aDataEnd );
102159 + && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal
102161 + /* The record-size field is a 2 byte varint and the record
102162 + ** fits entirely on the main b-tree page. */
102163 + testcase( pCell+nCell+2==pPage->aDataEnd );
102174 +** Return true (non-zero) if pCur is current pointing to the last
102179 + assert( pCur->eState==CURSOR_VALID );
102180 + for(i=0; i<pCur->iPage; i++){
102181 + MemPage *pPage = pCur->apPage[i];
102182 + if( pCur->aiIdx[i]<pPage->nCell ) return 0;
102190 @@ -71221,6 +72671,43 @@ SQLITE_PRIVATE int sqlite3BtreeIndexMoveto(
102191 || pIdxKey->default_rc==-1
102206 + if( pCur->eState==CURSOR_VALID
102207 + && pCur->pPage->leaf
102211 + if( pCur->ix==pCur->pPage->nCell-1
102212 + && (c = indexCellCompare(pCur, pCur->ix, pIdxKey, xRecordCompare))<=0
102213 + && pIdxKey->errCode==SQLITE_OK
102218 + if( pCur->iPage>0
102220 + && pIdxKey->errCode==SQLITE_OK
102222 + pCur->curFlags &= ~BTCF_ValidOvfl;
102223 + if( !pCur->pPage->isInit ){
102228 + pIdxKey->errCode = SQLITE_OK;
102234 @@ -71230,12 +72717,14 @@ SQLITE_PRIVATE int sqlite3BtreeIndexMoveto(
102240 assert( pCur->pPage );
102241 assert( pCur->pPage->isInit );
102242 assert( pCur->eState==CURSOR_VALID );
102243 assert( pCur->pPage->nCell > 0 );
102244 - assert( pCur->iPage==0 || pCur->apPage[0]->intKey==pCur->curIntKey );
102245 - assert( pCur->curIntKey || pIdxKey );
102246 + assert( pCur->curIntKey==0 );
102251 @@ -71249,11 +72738,10 @@ SQLITE_PRIVATE int sqlite3BtreeIndexMoveto(
102252 ** be the right kind (index or table) of b-tree page. Otherwise
102254 assert( pPage->nCell>0 );
102255 - assert( pPage->intKey==(pIdxKey==0) );
102256 + assert( pPage->intKey==0 );
102258 upr = pPage->nCell-1;
102260 - pCur->ix = (u16)idx;
102264 @@ -71342,7 +72830,7 @@ SQLITE_PRIVATE int sqlite3BtreeIndexMoveto(
102265 assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) );
102266 assert( pPage->isInit );
102267 if( pPage->leaf ){
102268 - assert( pCur->ix<pCur->pPage->nCell );
102269 + assert( pCur->ix<pCur->pPage->nCell || CORRUPT_DB );
102270 pCur->ix = (u16)idx;
102273 @@ -71945,7 +73433,7 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){
102275 assert( !pMemPage || pMemPage->pgno==iPage );
102277 - if( NEVER(iPage<2) || iPage>pBt->nPage ){
102278 + if( iPage<2 || iPage>pBt->nPage ){
102282 @@ -72369,16 +73857,24 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
102286 - assert( idx>=0 && idx<pPage->nCell );
102288 + assert( idx<pPage->nCell );
102290 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
102291 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
102292 assert( pPage->nFree>=0 );
102293 data = pPage->aData;
102294 ptr = &pPage->aCellIdx[2*idx];
102295 + assert( pPage->pBt->usableSize > (u32)(ptr-data) );
102297 hdr = pPage->hdrOffset;
102298 - testcase( pc==get2byte(&data[hdr+5]) );
102300 + if( pc<hdr+pPage->nCell*2 ){
102306 testcase( pc+sz==pPage->pBt->usableSize );
102307 if( pc+sz > pPage->pBt->usableSize ){
102309 @@ -72670,7 +74166,7 @@ static int rebuildPage(
102313 - if( NEVER(j>(u32)usableSize) ){ j = 0; }
102315 memcpy(&pTmp[j], &aData[j], usableSize - j);
102317 for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
102318 @@ -72901,7 +74397,7 @@ static int editPage(
102322 - if( NEVER(pData>pPg->aDataEnd) ) goto editpage_fail;
102323 + if( pData>pPg->aDataEnd ) goto editpage_fail;
102327 @@ -73261,8 +74757,6 @@ static int balance_nonroot(
102331 - Pgno aPgOrder[NB+2]; /* Copy of aPgno[] used for sorting pages */
102332 - u16 aPgFlags[NB+2]; /* flags field of new pages before shuffling */
102336 @@ -73686,42 +75180,39 @@ static int balance_nonroot(
102340 - ** An O(n^2) insertion sort algorithm is used, but since n is never more
102341 - ** than (NB+2) (a small constant), that should not be a problem.
102349 - aPgOrder[i] = aPgno[i] = apNew[i]->pgno;
102350 - aPgFlags[i] = apNew[i]->pDbPage->flags;
102351 - for(j=0; j<i; j++){
102352 - if( NEVER(aPgno[j]==aPgno[i]) ){
102353 - /* This branch is taken if the set of sibling pages somehow contains
102354 - ** duplicate entries. This can happen if the database is corrupt.
102355 - ** It would be simpler to detect this as part of the loop below, but
102356 - ** we do the detection here in order to avoid populating the pager
102357 - ** cache with two separate objects associated with the same
102358 - ** page number. */
102359 - assert( CORRUPT_DB );
102360 - rc = SQLITE_CORRUPT_BKPT;
102361 - goto balance_cleanup;
102362 - }
102363 - }
102364 + aPgno[i] = apNew[i]->pgno;
102365 + assert( apNew[i]->pDbPage->flags & PGHDR_WRITEABLE );
102366 + assert( apNew[i]->pDbPage->flags & PGHDR_DIRTY );
102368 - for(i=0; i<nNew; i++){
102369 - int iBest = 0; /* aPgno[] index of page number to use */
102370 - for(j=1; j<nNew; j++){
102371 - if( aPgOrder[j]<aPgOrder[iBest] ) iBest = j;
102372 + for(i=0; i<nNew-1; i++){
102375 + if( apNew[j]->pgno < apNew[iB]->pgno ) iB = j;
102377 - pgno = aPgOrder[iBest];
102378 - aPgOrder[iBest] = 0xffffffff;
102379 - if( iBest!=i ){
102380 - if( iBest>i ){
102381 - sqlite3PagerRekey(apNew[iBest]->pDbPage, pBt->nPage+iBest+1, 0);
102382 - }
102383 - sqlite3PagerRekey(apNew[i]->pDbPage, pgno, aPgFlags[iBest]);
102384 - apNew[i]->pgno = pgno;
102392 + Pgno pgnoA = apNew[i]->pgno;
102393 + Pgno pgnoB = apNew[iB]->pgno;
102394 + Pgno pgnoTemp = (PENDING_BYTE/pBt->pageSize)+1;
102395 + u16 fgA = apNew[i]->pDbPage->flags;
102396 + u16 fgB = apNew[iB]->pDbPage->flags;
102397 + sqlite3PagerRekey(apNew[i]->pDbPage, pgnoTemp, fgB);
102398 + sqlite3PagerRekey(apNew[iB]->pDbPage, pgnoA, fgA);
102399 + sqlite3PagerRekey(apNew[i]->pDbPage, pgnoB, fgB);
102400 + apNew[i]->pgno = pgnoB;
102401 + apNew[iB]->pgno = pgnoA;
102405 @@ -73858,7 +75349,7 @@ static int balance_nonroot(
102407 assert( sz<=pBt->maxLocal+23 );
102408 assert( iOvflSpace <= (int)pBt->pageSize );
102409 - for(k=0; b.ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
102414 @@ -74109,7 +75600,6 @@ static int anotherValidCursor(BtCursor *pCur){
102418 - const int nMin = pCur->pBt->usableSize * 2 / 3;
102422 @@ -74121,7 +75611,11 @@ static int balance(BtCursor *pCur){
102423 MemPage *pPage = pCur->pPage;
102425 if( NEVER(pPage->nFree<0) && btreeComputeFreeSpace(pPage) ) break;
102426 - if( pPage->nOverflow==0 && pPage->nFree<=nMin ){
102427 + if( pPage->nOverflow==0 && pPage->nFree*3<=(int)pCur->pBt->usableSize*2 ){
102433 }else if( (iPage = pCur->iPage)==0 ){
102434 if( pPage->nOverflow && (rc = anotherValidCursor(pCur))==SQLITE_OK ){
102435 @@ -74341,7 +75835,7 @@ static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){
102438 ** If the seekResult parameter is non-zero, then a successful call to
102439 -** MovetoUnpacked() to seek cursor pCur to (pKey,nKey) has already
102444 @@ -74359,7 +75853,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
102448 - int seekResult /* Result of prior MovetoUnpacked() call */
102452 int loc = seekResult; /* -1: before desired location +1: after */
102453 @@ -74374,24 +75868,6 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
102455 assert( (flags & BTREE_PREFORMAT)==0 || seekResult || pCur->pKeyInfo==0 );
102457 - if( pCur->eState==CURSOR_FAULT ){
102458 - assert( pCur->skipNext!=SQLITE_OK );
102459 - return pCur->skipNext;
102460 - }
102461 -
102462 - assert( cursorOwnsBtShared(pCur) );
102463 - assert( (pCur->curFlags & BTCF_WriteFlag)!=0
102464 - && pBt->inTransaction==TRANS_WRITE
102465 - && (pBt->btsFlags & BTS_READ_ONLY)==0 );
102466 - assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );
102467 -
102468 - /* Assert that the caller has been consistent. If this cursor was opened
102469 - ** expecting an index b-tree, then the caller should be inserting blob
102470 - ** keys with no associated data. If the cursor was opened expecting an
102471 - ** intkey table, the caller should be inserting integer keys with a
102472 - ** blob of associated data. */
102473 - assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) );
102474 -
102477 ** In some cases, the call to btreeMoveto() below is a no-op. For
102478 @@ -74416,6 +75892,29 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
102485 + if( pCur->eState>=CURSOR_REQUIRESEEK ){
102486 + testcase( pCur->eState==CURSOR_REQUIRESEEK );
102487 + testcase( pCur->eState==CURSOR_FAULT );
102493 + assert( (pCur->curFlags & BTCF_WriteFlag)!=0
102494 + && pBt->inTransaction==TRANS_WRITE
102495 + && (pBt->btsFlags & BTS_READ_ONLY)==0 );
102496 + assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );
102499 + ** expecting an index b-tree, then the caller should be inserting blob
102503 + assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) );
102505 if( pCur->pKeyInfo==0 ){
102506 assert( pX->pKey==0 );
102507 /* If this is an insert into a table b-tree, invalidate any incrblob
102508 @@ -74504,14 +76003,14 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
102511 assert( pCur->eState==CURSOR_VALID
102512 - || (pCur->eState==CURSOR_INVALID && loc)
102513 - || CORRUPT_DB );
102514 + || (pCur->eState==CURSOR_INVALID && loc) );
102516 pPage = pCur->pPage;
102517 assert( pPage->intKey || pX->nKey>=0 || (flags & BTREE_PREFORMAT) );
102518 assert( pPage->leaf || !pPage->intKey );
102519 if( pPage->nFree<0 ){
102520 if( NEVER(pCur->eState>CURSOR_INVALID) ){
102521 + /* ^^^^^--- due to the moveToRoot() call above */
102525 @@ -74522,7 +76021,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
102527 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
102529 - assert( pPage->isInit );
102530 + assert( pPage->isInit || CORRUPT_DB );
102531 newCell = pBt->pTmpSpace;
102534 @@ -74673,7 +76172,11 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc…
102538 - aOut += putVarint32(aOut, pSrc->info.nPayload);
102539 + if( pSrc->info.nPayload<0x80 ){
102540 + *(aOut++) = pSrc->info.nPayload;
102542 + aOut += sqlite3PutVarint(aOut, pSrc->info.nPayload);
102544 if( pDest->pKeyInfo==0 ) aOut += putVarint(aOut, iKey);
102545 nIn = pSrc->info.nLocal;
102546 aIn = pSrc->info.pPayload;
102547 @@ -74777,14 +76280,13 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSr…
102549 Btree *p = pCur->pBtree;
102550 BtShared *pBt = p->pBt;
102551 - int rc; /* Return code */
102552 - MemPage *pPage; /* Page to delete cell from */
102553 - unsigned char *pCell; /* Pointer to cell to delete */
102554 - int iCellIdx; /* Index of cell to delete */
102555 - int iCellDepth; /* Depth of node containing pCell */
102556 - CellInfo info; /* Size of the cell being deleted */
102557 - int bSkipnext = 0; /* Leaf cursor in SKIPNEXT state */
102558 - u8 bPreserve = flags & BTREE_SAVEPOSITION; /* Keep cursor valid */
102568 assert( pBt->inTransaction==TRANS_WRITE );
102569 @@ -74793,31 +76295,49 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
102570 assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );
102571 assert( !hasReadConflicts(p, pCur->pgnoRoot) );
102573 - if( pCur->eState==CURSOR_REQUIRESEEK ){
102574 - rc = btreeRestoreCursorPosition(pCur);
102575 - assert( rc!=SQLITE_OK || CORRUPT_DB || pCur->eState==CURSOR_VALID );
102576 - if( rc || pCur->eState!=CURSOR_VALID ) return rc;
102577 + if( pCur->eState!=CURSOR_VALID ){
102578 + if( pCur->eState>=CURSOR_REQUIRESEEK ){
102580 + assert( rc!=SQLITE_OK || CORRUPT_DB || pCur->eState==CURSOR_VALID );
102581 + if( rc || pCur->eState!=CURSOR_VALID ) return rc;
102586 - assert( CORRUPT_DB || pCur->eState==CURSOR_VALID );
102587 + assert( pCur->eState==CURSOR_VALID );
102589 iCellDepth = pCur->iPage;
102590 iCellIdx = pCur->ix;
102591 pPage = pCur->pPage;
102592 + if( pPage->nCell<=iCellIdx ){
102596 - if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ) return SQLITE_CORRUPT;
102597 + if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){
102601 - /* If the bPreserve flag is set to true, then the cursor position must
102604 ** will cause a b-tree rebalance, then this is done by saving the cursor
102608 - ** Or, if the current delete will not cause a rebalance, then the cursor
102611 - ** before or after the deleted entry. In this case set bSkipnext to true. */
102622 if( !pPage->leaf
102623 - || (pPage->nFree+cellSizePtr(pPage,pCell)+2)>(int)(pBt->usableSize*2/3)
102624 + || (pPage->nFree+pPage->xCellSize(pPage,pCell)+2) >
102625 + (int)(pBt->usableSize*2/3)
102626 || pPage->nCell==1 /* See dbfuzz001.test for a test case */
102628 /* A b-tree rebalance will be required after deleting this entry.
102629 @@ -74825,7 +76345,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
102633 - bSkipnext = 1;
102638 @@ -74913,7 +76433,15 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
102642 - rc = balance(pCur);
102643 + assert( pCur->pPage->nOverflow==0 );
102644 + assert( pCur->pPage->nFree>=0 );
102645 + if( pCur->pPage->nFree*3<=(int)pCur->pBt->usableSize*2 ){
102647 + ** then balance() will always be a no-op. No need to invoke it. */
102652 if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){
102653 releasePageNotNull(pCur->pPage);
102654 pCur->iPage--;
102655 @@ -74925,8 +76453,8 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
102659 - if( bSkipnext ){
102660 - assert( bPreserve && (pCur->iPage==iCellDepth || CORRUPT_DB) );
102662 + assert( (pCur->iPage==iCellDepth || CORRUPT_DB) );
102663 assert( pPage==pCur->pPage || CORRUPT_DB );
102664 assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );
102665 pCur->eState = CURSOR_SKIPNEXT;
102666 @@ -75136,7 +76664,7 @@ static int clearDatabasePage(
102669 if( (pBt->openFlags & BTREE_SINGLE)==0
102670 - && sqlite3PagerPageRefcount(pPage->pDbPage)!=1
102671 + && sqlite3PagerPageRefcount(pPage->pDbPage) != (1 + (pgno==1))
102675 @@ -76516,14 +78044,13 @@ static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
102679 - memset(&sParse, 0, sizeof(sParse));
102680 - sParse.db = pDb;
102687 - sqlite3ParserReset(&sParse);
102692 @@ -77409,7 +78936,11 @@ SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
102696 - if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
102697 + if( !(pMem->flags&MEM_Str) ){
102698 + pMem->enc = desiredEnc;
102701 + if( pMem->enc==desiredEnc ){
102704 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
102705 @@ -77658,9 +79189,10 @@ SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
102709 + assert( pMem->db!=0 );
102710 assert( pFunc->xFinalize!=0 );
102711 assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );
102712 - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
102713 + assert( sqlite3_mutex_held(pMem->db->mutex) );
102717 @@ -77668,6 +79200,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
102721 + ctx.enc = ENC(t.db);
102722 pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */
102723 assert( (pMem->flags & MEM_Dyn)==0 );
102724 if( pMem->szMalloc>0 ) sqlite3DbFreeNN(pMem->db, pMem->zMalloc);
102725 @@ -77689,12 +79222,14 @@ SQLITE_PRIVATE int sqlite3VdbeMemAggValue(Mem *pAccum, Mem *pOut, FuncDef…
102727 assert( pFunc->xValue!=0 );
102728 assert( (pAccum->flags & MEM_Null)!=0 || pFunc==pAccum->u.pDef );
102729 - assert( pAccum->db==0 || sqlite3_mutex_held(pAccum->db->mutex) );
102730 + assert( pAccum->db!=0 );
102731 + assert( sqlite3_mutex_held(pAccum->db->mutex) );
102737 + ctx.enc = ENC(pAccum->db);
102738 pFunc->xValue(&ctx);
102741 @@ -77760,6 +79295,14 @@ SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){
102750 + if( p->szMalloc ) vdbeMemClear(p);
102754 ** Convert a 64-bit IEEE double into a 64-bit signed integer.
102755 ** If the double is out of range of a 64-bit signed integer then
102756 @@ -77801,12 +79344,12 @@ static SQLITE_NOINLINE i64 doubleToInt64(double r){
102760 -static SQLITE_NOINLINE i64 memIntValue(Mem *pMem){
102763 sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc);
102766 -SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
102770 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
102771 @@ -78121,6 +79664,7 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetPointer(
102774 assert( pMem->flags==MEM_Null );
102776 pMem->u.zPType = zPType ? zPType : "";
102777 pMem->z = pPtr;
102778 pMem->flags = MEM_Null|MEM_Dyn|MEM_Subtype|MEM_Term;
102779 @@ -78303,6 +79847,13 @@ SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){
102789 +** non-negative for blobs.
102793 @@ -78313,11 +79864,12 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
102795 i64 nByte = n; /* New value for pMem->n */
102797 - u16 flags = 0; /* New value for pMem->flags */
102798 + u16 flags; /* New value for pMem->flags */
102801 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
102807 @@ -78330,7 +79882,6 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
102811 - flags = (enc==0?MEM_Blob:MEM_Str);
102815 @@ -78338,7 +79889,23 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
102819 - flags |= MEM_Term;
102830 + sqlite3DbFree(pMem->db, (void*)z);
102836 + return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
102840 @@ -78350,9 +79917,6 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
102844 - if( nByte>iLimit ){
102845 - return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
102846 - }
102850 @@ -78374,16 +79938,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
102852 pMem->n = (int)(nByte & 0x7fffffff);
102853 pMem->flags = flags;
102854 - if( enc ){
102855 - pMem->enc = enc;
102856 -#ifdef SQLITE_ENABLE_SESSION
102857 - }else if( pMem->db==0 ){
102858 - pMem->enc = SQLITE_UTF8;
102859 -#endif
102860 - }else{
102861 - assert( pMem->db!=0 );
102862 - pMem->enc = ENC(pMem->db);
102863 - }
102864 + pMem->enc = enc;
102868 @@ -78391,9 +79946,6 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
102872 - if( nByte>iLimit ){
102873 - return sqlite3ErrorToParser(pMem->db, SQLITE_TOOBIG);
102874 - }
102878 @@ -78671,10 +80223,12 @@ static int valueFromFunction(
102882 - assert( pCtx->pParse->rc==SQLITE_OK );
102883 + testcase( pCtx->pParse->rc==SQLITE_ERROR );
102884 + testcase( pCtx->pParse->rc==SQLITE_OK );
102888 + ctx.enc = ENC(db);
102889 pFunc->xSFunc(&ctx, nVal, apVal);
102892 @@ -78735,11 +80289,7 @@ static int valueFromExpr(
102895 while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft;
102896 -#if defined(SQLITE_ENABLE_STAT4)
102897 if( op==TK_REGISTER ) op = pExpr->op2;
102898 -#else
102899 - if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;
102900 -#endif
102904 @@ -78754,8 +80304,8 @@ static int valueFromExpr(
102905 rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
102908 - sqlite3VdbeMemCast(*ppVal, aff, SQLITE_UTF8);
102909 - sqlite3ValueApplyAffinity(*ppVal, affinity, SQLITE_UTF8);
102915 @@ -78854,7 +80404,7 @@ static int valueFromExpr(
102919 - if( pCtx==0 || pCtx->pParse->nErr==0 )
102920 + if( pCtx==0 || NEVER(pCtx->pParse->nErr==0) )
102922 sqlite3OomFault(db);
102923 sqlite3DbFree(db, zVal);
102924 @@ -79189,7 +80739,7 @@ SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
102925 p->pNext = db->pVdbe;
102926 p->pPrev = 0;
102927 db->pVdbe = p;
102928 - p->iVdbeMagic = VDBE_MAGIC_INIT;
102929 + assert( p->eVdbeState==VDBE_INIT_STATE );
102930 p->pParse = pParse;
102931 pParse->pVdbe = p;
102932 assert( pParse->aLabel==0 );
102933 @@ -79334,7 +80884,7 @@ static int growOpArray(Vdbe *v, int nOp){
102937 - assert( nOp<=(1024/sizeof(Op)) );
102939 assert( nNew>=(v->nOpAlloc+nOp) );
102940 pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));
102942 @@ -79390,7 +80940,7 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p…
102945 i = p->nOp;
102946 - assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
102947 + assert( p->eVdbeState==VDBE_INIT_STATE );
102949 if( p->nOpAlloc<=i ){
102951 @@ -79535,6 +81085,7 @@ SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall(
102959 @@ -79722,7 +81273,7 @@ static SQLITE_NOINLINE void resizeResolveLabel(Parse *p, Vdbe *v, int j){
102961 Parse *p = v->pParse;
102963 - assert( v->iVdbeMagic==VDBE_MAGIC_INIT );
102964 + assert( v->eVdbeState==VDBE_INIT_STATE );
102965 assert( j<-p->nLabel );
102968 @@ -79742,14 +81293,20 @@ SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){
102972 - p->runOnlyOnce = 1;
102977 -** Mark the VDBE as one that can only be run multiple times.
102981 - p->runOnlyOnce = 0;
102983 + for(i=1; ALWAYS(i<p->nOp); i++){
102984 + if( ALWAYS(p->aOp[i].opcode==OP_Expire) ){
102985 + p->aOp[1].opcode = OP_Noop;
102992 @@ -79853,6 +81410,8 @@ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
103001 @@ -79862,6 +81421,7 @@ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
103007 && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort))
103009 @@ -79936,7 +81496,7 @@ SQLITE_PRIVATE void sqlite3VdbeAssertAbortable(Vdbe *p){
103013 -** (4) Initialize the p4.xAdvance pointer on opcodes that use it.
103018 @@ -79982,25 +81542,6 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
103019 p->bIsReader = 1;
103022 - case OP_Next:
103023 - case OP_SorterNext: {
103024 - pOp->p4.xAdvance = sqlite3BtreeNext;
103025 - pOp->p4type = P4_ADVANCE;
103026 - /* The code generator never codes any of these opcodes as a jump
103027 - ** to a label. They are always coded as a jump backwards to a
103028 - ** known address */
103029 - assert( pOp->p2>=0 );
103030 - break;
103031 - }
103032 - case OP_Prev: {
103033 - pOp->p4.xAdvance = sqlite3BtreePrevious;
103034 - pOp->p4type = P4_ADVANCE;
103035 - /* The code generator never codes any of these opcodes as a jump
103036 - ** to a label. They are always coded as a jump backwards to a
103037 - ** known address */
103038 - assert( pOp->p2>=0 );
103039 - break;
103040 - }
103043 if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
103044 @@ -80036,18 +81577,104 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
103045 if( pOp==p->aOp ) break;
103046 pOp--;
103048 - sqlite3DbFree(p->db, pParse->aLabel);
103049 - pParse->aLabel = 0;
103051 + sqlite3DbFreeNN(p->db, pParse->aLabel);
103052 + pParse->aLabel = 0;
103054 pParse->nLabel = 0;
103056 assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );
103081 + Vdbe *v, /* The byte-code program under construction */
103091 + pParse = v->pParse;
103093 + if( pParse->nErr ) return;
103095 + assert( iLast<v->nOp );
103096 + pOp = &v->aOp[iFirst];
103098 + if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 ){
103099 + int iDest = pOp->p2; /* Jump destination */
103101 + if( pOp->opcode==OP_Gosub ) continue;
103105 + if( j>=-pParse->nLabel || pParse->aLabel[j]<0 ){
103108 + iDest = pParse->aLabel[j];
103112 + for(; j<v->nOp; j++){
103113 + VdbeOp *pX = &v->aOp[j];
103114 + if( pX->opcode==OP_Return ){
103115 + if( pX->p1==iRetReg ) break;
103118 + if( pX->opcode==OP_Noop ) continue;
103119 + if( pX->opcode==OP_Explain ) continue;
103147 - assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
103148 + assert( p->eVdbeState==VDBE_INIT_STATE );
103149 return p->nOp;
103152 @@ -80132,7 +81759,7 @@ SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(
103156 - assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
103157 + assert( p->eVdbeState==VDBE_INIT_STATE );
103158 if( p->nOp + nOp > p->nOpAlloc && growOpArray(p, nOp) ){
103161 @@ -80284,7 +81911,6 @@ static void freeP4(sqlite3 *db, int p4type, void *p4){
103165 - case P4_DYNBLOB:
103167 sqlite3DbFree(db, p4);
103169 @@ -80324,13 +81950,16 @@ static void freeP4(sqlite3 *db, int p4type, void *p4){
103172 static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){
103175 - Op *pOp;
103176 - for(pOp=&aOp[nOp-1]; pOp>=aOp; pOp--){
103177 + Op *pOp = &aOp[nOp-1];
103179 if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p);
103181 sqlite3DbFree(db, pOp->zComment);
103184 + pOp--;
103186 sqlite3DbFreeNN(db, aOp);
103188 @@ -80392,7 +82021,7 @@ SQLITE_PRIVATE void sqlite3VdbeReleaseRegisters(
103192 - if( N==0 ) return;
103193 + if( N==0 || OptimizationDisabled(pParse->db, SQLITE_ReleaseReg) ) return;
103194 assert( pParse->pVdbe );
103196 assert( iFirst+N-1<=pParse->nMem );
103197 @@ -80456,7 +82085,7 @@ SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4,…
103198 sqlite3 *db;
103200 db = p->db;
103201 - assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
103202 + assert( p->eVdbeState==VDBE_INIT_STATE );
103203 assert( p->aOp!=0 || db->mallocFailed );
103204 if( db->mallocFailed ){
103205 if( n!=P4_VTAB ) freeP4(db, n, (void*)*(char**)&zP4);
103206 @@ -80532,8 +82161,7 @@ SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){
103209 assert( p->nOp>0 || p->aOp==0 );
103210 - assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->db->mallocFailed
103211 - || p->pParse->nErr>0 );
103212 + assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->pParse->nErr>0 );
103213 if( p->nOp ){
103214 assert( p->aOp );
103215 sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment);
103216 @@ -80585,7 +82213,7 @@ SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
103220 - assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
103221 + assert( p->eVdbeState==VDBE_INIT_STATE );
103223 addr = p->nOp - 1;
103225 @@ -80652,8 +82280,11 @@ SQLITE_PRIVATE char *sqlite3VdbeDisplayComment(
103229 - sqlite3_str_appendall(&x, pOp->zComment);
103230 - seenCom = 1;
103231 + if( pOp->zComment && pOp->zComment[0] ){
103232 + sqlite3_str_appendall(&x, pOp->zComment);
103239 @@ -80882,10 +82513,6 @@ SQLITE_PRIVATE char *sqlite3VdbeDisplayP4(sqlite3 *db, Op *pOp){
103243 - case P4_DYNBLOB:
103244 - case P4_ADVANCE: {
103245 - break;
103246 - }
103248 zP4 = pOp->p4.pTab->zName;
103250 @@ -81017,21 +82644,40 @@ SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){
103255 +** This is a high-runner, so only those fields that really do need to
103261 +** Mem.db = db
103267 static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
103268 - while( (N--)>0 ){
103269 - p->db = db;
103270 - p->flags = flags;
103271 - p->szMalloc = 0;
103274 + p->flags = flags;
103275 + p->db = db;
103276 + p->szMalloc = 0;
103278 - p->pScopyFrom = 0;
103279 + p->pScopyFrom = 0;
103281 - p++;
103283 + }while( (--N)>0 );
103288 -** Release an array of N Mem elements
103298 @@ -81064,12 +82710,17 @@ static void releaseMemArray(Mem *p, int N){
103299 if( p->flags&(MEM_Agg|MEM_Dyn) ){
103300 testcase( (p->flags & MEM_Dyn)!=0 && p->xDel==sqlite3VdbeFrameMemDel );
103302 + p->flags = MEM_Undefined;
103303 }else if( p->szMalloc ){
103304 sqlite3DbFreeNN(db, p->zMalloc);
103305 p->szMalloc = 0;
103306 + p->flags = MEM_Undefined;
103308 -
103309 - p->flags = MEM_Undefined;
103312 + p->flags = MEM_Undefined;
103318 @@ -81228,7 +82879,7 @@ SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame *p){
103319 VdbeCursor **apCsr = (VdbeCursor **)&aMem[p->nChildMem];
103321 for(i=0; i<p->nChildCsr; i++){
103322 - sqlite3VdbeFreeCursor(p->v, apCsr[i]);
103323 + if( apCsr[i] ) sqlite3VdbeFreeCursorNN(p->v, apCsr[i]);
103325 releaseMemArray(aMem, p->nChildMem);
103326 sqlite3VdbeDeleteAuxData(p->v->db, &p->pAuxData, -1, 0);
103327 @@ -81267,7 +82918,7 @@ SQLITE_PRIVATE int sqlite3VdbeList(
103330 assert( p->explain );
103331 - assert( p->iVdbeMagic==VDBE_MAGIC_RUN );
103332 + assert( p->eVdbeState==VDBE_RUN_STATE );
103333 assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );
103336 @@ -81422,11 +83073,11 @@ struct ReusableSpace {
103340 - sqlite3_int64 nByte /* Bytes of memory needed */
103343 assert( EIGHT_BYTE_ALIGNMENT(p->pSpace) );
103345 - nByte = ROUND8(nByte);
103347 if( nByte <= p->nFree ){
103348 p->nFree -= nByte;
103349 pBuf = &p->pSpace[p->nFree];
103350 @@ -81447,14 +83098,15 @@ SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
103354 - assert( p->iVdbeMagic==VDBE_MAGIC_INIT || p->iVdbeMagic==VDBE_MAGIC_RESET );
103355 + assert( p->eVdbeState==VDBE_INIT_STATE
103356 + || p->eVdbeState==VDBE_READY_STATE
103357 + || p->eVdbeState==VDBE_HALT_STATE );
103361 assert( p->nOp>0 );
103363 - /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */
103364 - p->iVdbeMagic = VDBE_MAGIC_RUN;
103365 + p->eVdbeState = VDBE_READY_STATE;
103368 for(i=0; i<p->nMem; i++){
103369 @@ -81510,7 +83162,7 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady(
103371 assert( p->nOp>0 );
103373 - assert( p->iVdbeMagic==VDBE_MAGIC_INIT );
103374 + assert( p->eVdbeState==VDBE_INIT_STATE );
103375 assert( pParse==p->pParse );
103376 p->pVList = pParse->pVList;
103377 pParse->pVList = 0;
103378 @@ -81533,7 +83185,7 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady(
103382 - n = ROUND8(sizeof(Op)*p->nOp); /* Bytes of opcode memory used */
103383 + n = ROUND8P(sizeof(Op)*p->nOp); /* Bytes of opcode memory used */
103384 x.pSpace = &((u8*)p->aOp)[n]; /* Unused opcode memory */
103386 x.nFree = ROUNDDOWN8(pParse->szOpAlloc - n); /* Bytes of unused memory */
103387 @@ -81621,11 +83273,9 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady(
103391 - if( pCx==0 ){
103392 - return;
103393 - }
103394 - assert( pCx->pBtx==0 || pCx->eCurType==CURTYPE_BTREE );
103395 - assert( pCx->pBtx==0 || pCx->isEphemeral );
103399 switch( pCx->eCurType ){
103401 sqlite3VdbeSorterClose(p->db, pCx);
103402 @@ -81653,14 +83303,12 @@ SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
103406 - if( p->apCsr ){
103407 - int i;
103408 - for(i=0; i<p->nCursor; i++){
103409 - VdbeCursor *pC = p->apCsr[i];
103410 - if( pC ){
103411 - sqlite3VdbeFreeCursor(p, pC);
103412 - p->apCsr[i] = 0;
103413 - }
103415 + for(i=0; i<p->nCursor; i++){
103416 + VdbeCursor *pC = p->apCsr[i];
103419 + p->apCsr[i] = 0;
103423 @@ -81709,9 +83357,7 @@ static void closeAllCursors(Vdbe *p){
103425 assert( p->nFrame==0 );
103427 - if( p->aMem ){
103428 - releaseMemArray(p->aMem, p->nMem);
103429 - }
103430 + releaseMemArray(p->aMem, p->nMem);
103431 while( p->pDelFrame ){
103432 VdbeFrame *pDel = p->pDelFrame;
103433 p->pDelFrame = pDel->pParent;
103434 @@ -82151,7 +83797,8 @@ SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){
103435 p->rc = SQLITE_CONSTRAINT_FOREIGNKEY;
103436 p->errorAction = OE_Abort;
103438 - return SQLITE_ERROR;
103439 + if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)==0 ) return SQLITE_ERROR;
103444 @@ -82190,9 +83837,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
103448 - if( p->iVdbeMagic!=VDBE_MAGIC_RUN ){
103449 - return SQLITE_OK;
103450 - }
103451 + assert( p->eVdbeState==VDBE_RUN_STATE );
103452 if( db->mallocFailed ){
103453 p->rc = SQLITE_NOMEM_BKPT;
103455 @@ -82201,7 +83846,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
103459 - if( p->pc>=0 && p->bIsReader ){
103460 + if( p->bIsReader ){
103461 int mrc; /* Primary error code from p->rc */
103464 @@ -82349,15 +83994,13 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
103468 - if( p->pc>=0 ){
103469 - db->nVdbeActive--;
103470 - if( !p->readOnly ) db->nVdbeWrite--;
103471 - if( p->bIsReader ) db->nVdbeRead--;
103472 - assert( db->nVdbeActive>=db->nVdbeRead );
103473 - assert( db->nVdbeRead>=db->nVdbeWrite );
103474 - assert( db->nVdbeWrite>=0 );
103475 - }
103476 - p->iVdbeMagic = VDBE_MAGIC_HALT;
103477 + db->nVdbeActive--;
103478 + if( !p->readOnly ) db->nVdbeWrite--;
103479 + if( p->bIsReader ) db->nVdbeRead--;
103480 + assert( db->nVdbeActive>=db->nVdbeRead );
103481 + assert( db->nVdbeRead>=db->nVdbeWrite );
103482 + assert( db->nVdbeWrite>=0 );
103483 + p->eVdbeState = VDBE_HALT_STATE;
103484 checkActiveVdbeCnt(db);
103485 if( db->mallocFailed ){
103486 p->rc = SQLITE_NOMEM_BKPT;
103487 @@ -82406,6 +84049,7 @@ SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){
103488 sqlite3ValueSetNull(db->pErr);
103490 db->errCode = rc;
103491 + db->errByteOffset = -1;
103495 @@ -82438,8 +84082,8 @@ static void vdbeInvokeSqllog(Vdbe *v){
103499 -** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to
103500 -** VDBE_MAGIC_INIT.
103506 @@ -82453,7 +84097,7 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
103510 - sqlite3VdbeHalt(p);
103511 + if( p->eVdbeState==VDBE_RUN_STATE ) sqlite3VdbeHalt(p);
103515 @@ -82467,13 +84111,6 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
103517 db->errCode = p->rc;
103519 - if( p->runOnlyOnce ) p->expired = 1;
103520 - }else if( p->rc && p->expired ){
103521 - /* The expired flag was set on the VDBE before the first call
103522 - ** to sqlite3_step(). For consistency (since sqlite3_step() was
103523 - ** called), set the database error in this case as well.
103524 - */
103525 - sqlite3ErrorWithMsg(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg);
103529 @@ -82530,7 +84167,6 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
103533 - p->iVdbeMagic = VDBE_MAGIC_RESET;
103534 return p->rc & db->errMask;
103537 @@ -82540,7 +84176,10 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
103541 - if( p->iVdbeMagic==VDBE_MAGIC_RUN || p->iVdbeMagic==VDBE_MAGIC_HALT ){
103545 + if( p->eVdbeState>=VDBE_READY_STATE ){
103547 assert( (rc & p->db->errMask)==rc );
103549 @@ -82592,22 +84231,24 @@ SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, i…
103553 -SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
103554 +static void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
103556 assert( p->db==0 || p->db==db );
103557 - releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
103558 + if( p->aColName ){
103559 + releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
103560 + sqlite3DbFreeNN(db, p->aColName);
103562 for(pSub=p->pProgram; pSub; pSub=pNext){
103563 pNext = pSub->pNext;
103564 vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
103565 sqlite3DbFree(db, pSub);
103567 - if( p->iVdbeMagic!=VDBE_MAGIC_INIT ){
103568 + if( p->eVdbeState!=VDBE_INIT_STATE ){
103569 releaseMemArray(p->aVar, p->nVar);
103570 - sqlite3DbFree(db, p->pVList);
103571 - sqlite3DbFree(db, p->pFree);
103572 + if( p->pVList ) sqlite3DbFreeNN(db, p->pVList);
103573 + if( p->pFree ) sqlite3DbFreeNN(db, p->pFree);
103575 vdbeFreeOpArray(db, p->aOp, p->nOp);
103576 - sqlite3DbFree(db, p->aColName);
103577 sqlite3DbFree(db, p->zSql);
103579 sqlite3DbFree(db, p->zNormSql);
103580 @@ -82640,17 +84281,17 @@ SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){
103581 db = p->db;
103582 assert( sqlite3_mutex_held(db->mutex) );
103583 sqlite3VdbeClearObject(db, p);
103584 - if( p->pPrev ){
103585 - p->pPrev->pNext = p->pNext;
103586 - }else{
103587 - assert( db->pVdbe==p );
103588 - db->pVdbe = p->pNext;
103589 - }
103590 - if( p->pNext ){
103591 - p->pNext->pPrev = p->pPrev;
103592 + if( db->pnBytesFreed==0 ){
103593 + if( p->pPrev ){
103594 + p->pPrev->pNext = p->pNext;
103596 + assert( db->pVdbe==p );
103597 + db->pVdbe = p->pNext;
103599 + if( p->pNext ){
103600 + p->pNext->pPrev = p->pPrev;
103603 - p->iVdbeMagic = VDBE_MAGIC_DEAD;
103604 - p->db = 0;
103605 sqlite3DbFreeNN(db, p);
103608 @@ -82685,7 +84326,7 @@ SQLITE_PRIVATE int SQLITE_NOINLINE sqlite3VdbeFinishMoveto(VdbeCursor *p){
103612 -static int SQLITE_NOINLINE handleMovedCursor(VdbeCursor *p){
103615 assert( p->eCurType==CURTYPE_BTREE );
103616 assert( p->uc.pCursor!=0 );
103617 @@ -82701,41 +84342,9 @@ static int SQLITE_NOINLINE handleMovedCursor(VdbeCursor *p){
103621 - assert( p->eCurType==CURTYPE_BTREE );
103622 + assert( p->eCurType==CURTYPE_BTREE || IsNullCursor(p) );
103623 if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){
103624 - return handleMovedCursor(p);
103625 - }
103626 - return SQLITE_OK;
103627 -}
103628 -
103629 -/*
103630 -** Make sure the cursor p is ready to read or write the row to which it
103631 -** was last positioned. Return an error code if an OOM fault or I/O error
103632 -** prevents us from positioning the cursor to its correct position.
103633 -**
103634 -** If a MoveTo operation is pending on the given cursor, then do that
103635 -** MoveTo now. If no move is pending, check to see if the row has been
103636 -** deleted out from under the cursor and if it has, mark the row as
103637 -** a NULL row.
103638 -**
103639 -** If the cursor is already pointing to the correct row and that row has
103640 -** not been deleted out from under the cursor, then this routine is a no-op.
103641 -*/
103642 -SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, u32 *piCol){
103643 - VdbeCursor *p = *pp;
103644 - assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO );
103645 - if( p->deferredMoveto ){
103646 - u32 iMap;
103647 - assert( !p->isEphemeral );
103648 - if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 && !p->nullRow ){
103649 - *pp = p->pAltCursor;
103650 - *piCol = iMap - 1;
103651 - return SQLITE_OK;
103652 - }
103653 - return sqlite3VdbeFinishMoveto(p);
103654 - }
103655 - if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){
103656 - return handleMovedCursor(p);
103661 @@ -82746,7 +84355,7 @@ SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, u32 *piCol){
103665 -** sqlite3VdbeSerialPut()
103666 +** sqlite3VdbeSerialPut() <--- in-lined into OP_MakeRecord as of 2022-04-02
103670 @@ -82858,7 +84467,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format, u32 *p…
103674 -static const u8 sqlite3SmallTypeSizes[] = {
103679 @@ -82927,7 +84536,7 @@ SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8 serial_type){
103683 -static u64 floatSwap(u64 in){
103688 @@ -82940,59 +84549,8 @@ static u64 floatSwap(u64 in){
103692 -# define swapMixedEndianFloat(X) X = floatSwap(X)
103693 -#else
103694 -# define swapMixedEndianFloat(X)
103695 -#endif
103696 -
103697 -/*
103698 -** Write the serialized data blob for the value stored in pMem into
103699 -** buf. It is assumed that the caller has allocated sufficient space.
103700 -** Return the number of bytes written.
103701 -**
103702 -** nBuf is the amount of space left in buf[]. The caller is responsible
103703 -** for allocating enough space to buf[] to hold the entire field, exclusive
103704 -** of the pMem->u.nZero bytes for a MEM_Zero value.
103705 -**
103706 -** Return the number of bytes actually written into buf[]. The number
103707 -** of bytes in the zero-filled tail is included in the return value only
103708 -** if those bytes were zeroed in buf[].
103709 -*/
103710 -SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){
103711 - u32 len;
103712 -
103713 - /* Integer and Real */
103714 - if( serial_type<=7 && serial_type>0 ){
103715 - u64 v;
103716 - u32 i;
103717 - if( serial_type==7 ){
103718 - assert( sizeof(v)==sizeof(pMem->u.r) );
103719 - memcpy(&v, &pMem->u.r, sizeof(v));
103720 - swapMixedEndianFloat(v);
103721 - }else{
103722 - v = pMem->u.i;
103723 - }
103724 - len = i = sqlite3SmallTypeSizes[serial_type];
103725 - assert( i>0 );
103726 - do{
103727 - buf[--i] = (u8)(v&0xFF);
103728 - v >>= 8;
103729 - }while( i );
103730 - return len;
103731 - }
103734 - /* String or blob */
103735 - if( serial_type>=12 ){
103736 - assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.nZero:0)
103737 - == (int)sqlite3VdbeSerialTypeLen(serial_type) );
103738 - len = pMem->n;
103739 - if( len>0 ) memcpy(buf, pMem->z, len);
103740 - return len;
103741 - }
103742 -
103743 - /* NULL or constants 0 or 1 */
103744 - return 0;
103745 -}
103748 ** big-endian integer. Return the equivalent native integer
103749 @@ -83005,14 +84563,14 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_ty…
103753 -** and store the result in pMem. Return the number of bytes read.
103761 -static u32 serialGet(
103766 @@ -83046,9 +84604,8 @@ static u32 serialGet(
103767 memcpy(&pMem->u.r, &x, sizeof(x));
103768 pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real;
103770 - return 8;
103772 -SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
103777 @@ -83059,13 +84616,13 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
103778 pMem->flags = MEM_Null|MEM_Zero;
103779 pMem->n = 0;
103780 pMem->u.nZero = 0;
103781 - break;
103786 /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */
103787 pMem->flags = MEM_Null;
103788 - break;
103792 /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement
103793 @@ -83073,7 +84630,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
103794 pMem->u.i = ONE_BYTE_INT(buf);
103795 pMem->flags = MEM_Int;
103796 testcase( pMem->u.i<0 );
103797 - return 1;
103800 case 2: { /* 2-byte signed integer */
103801 /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit
103802 @@ -83081,7 +84638,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
103803 pMem->u.i = TWO_BYTE_INT(buf);
103804 pMem->flags = MEM_Int;
103805 testcase( pMem->u.i<0 );
103806 - return 2;
103809 case 3: { /* 3-byte signed integer */
103810 /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit
103811 @@ -83089,7 +84646,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
103812 pMem->u.i = THREE_BYTE_INT(buf);
103813 pMem->flags = MEM_Int;
103814 testcase( pMem->u.i<0 );
103815 - return 3;
103818 case 4: { /* 4-byte signed integer */
103819 /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit
103820 @@ -83101,7 +84658,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
103822 pMem->flags = MEM_Int;
103823 testcase( pMem->u.i<0 );
103824 - return 4;
103827 case 5: { /* 6-byte signed integer */
103828 /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit
103829 @@ -83109,13 +84666,14 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
103830 pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf);
103831 pMem->flags = MEM_Int;
103832 testcase( pMem->u.i<0 );
103833 - return 6;
103836 case 6: /* 8-byte signed integer */
103840 - return serialGet(buf,serial_type,pMem);
103846 @@ -83123,7 +84681,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
103847 /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */
103848 pMem->u.i = serial_type-8;
103849 pMem->flags = MEM_Int;
103850 - return 0;
103854 /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in
103855 @@ -83134,10 +84692,10 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
103856 pMem->z = (char *)buf;
103857 pMem->n = (serial_type-12)/2;
103858 pMem->flags = aFlag[serial_type&1];
103859 - return pMem->n;
103863 - return 0;
103868 @@ -83158,10 +84716,10 @@ SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
103872 - nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nKeyField+1);
103873 + nByte = ROUND8P(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nKeyField+1);
103874 p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);
103876 - p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
103877 + p->aMem = (Mem*)&((char*)p)[ROUND8P(sizeof(UnpackedRecord))];
103878 assert( pKeyInfo->aSortFlags!=0 );
103879 p->pKeyInfo = pKeyInfo;
103880 p->nField = pKeyInfo->nKeyField + 1;
103881 @@ -83200,7 +84758,8 @@ SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
103882 /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */
103883 pMem->szMalloc = 0;
103884 pMem->z = 0;
103885 - d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
103889 if( (++u)>=p->nField ) break;
103891 @@ -83284,7 +84843,8 @@ static int vdbeRecordCompareDebug(
103895 - d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);
103901 @@ -83395,8 +84955,8 @@ static int vdbeCompareMemString(
103903 rc = pColl->xCmp(pColl->pUser, c1.n, v1, c2.n, v2);
103905 - sqlite3VdbeMemRelease(&c1);
103906 - sqlite3VdbeMemRelease(&c2);
103912 @@ -83657,14 +85217,22 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip(
103916 - u32 s1;
103917 - idx1 = 1 + getVarint32(&aKey1[1], s1);
103929 - idx1 = getVarint32(aKey1, szHdr1);
103938 @@ -83920,7 +85488,8 @@ static int vdbeRecordCompareInt(
103942 - v = pPKey2->aMem[0].u.i;
103943 + assert( pPKey2->u.i == pPKey2->aMem[0].u.i );
103944 + v = pPKey2->u.i;
103946 res = pPKey2->r1;
103948 @@ -83955,12 +85524,18 @@ static int vdbeRecordCompareString(
103951 assert( pPKey2->aMem[0].flags & MEM_Str );
103952 + assert( pPKey2->aMem[0].n == pPKey2->n );
103953 + assert( pPKey2->aMem[0].z == pPKey2->u.z );
103954 vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
103955 - serial_type = (u8)(aKey1[1]);
103956 - if( serial_type >= 0x80 ){
103957 - sqlite3GetVarint32(&aKey1[1], (u32*)&serial_type);
103958 - }
103968 res = pPKey2->r1; /* (pKey1/nKey1) is a number or a null */
103970 res = pPKey2->r2; /* (pKey1/nKey1) is a blob */
103971 @@ -83974,15 +85549,15 @@ static int vdbeRecordCompareString(
103972 pPKey2->errCode = (u8)SQLITE_CORRUPT_BKPT;
103975 - nCmp = MIN( pPKey2->aMem[0].n, nStr );
103976 - res = memcmp(&aKey1[szHdr], pPKey2->aMem[0].z, nCmp);
103977 + nCmp = MIN( pPKey2->n, nStr );
103978 + res = memcmp(&aKey1[szHdr], pPKey2->u.z, nCmp);
103981 res = pPKey2->r2;
103983 res = pPKey2->r1;
103985 - res = nStr - pPKey2->aMem[0].n;
103986 + res = nStr - pPKey2->n;
103988 if( pPKey2->nField>1 ){
103990 @@ -84037,6 +85612,7 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){
103991 p->r2 = 1;
103994 + p->u.i = p->aMem[0].u.i;
103998 @@ -84046,6 +85622,8 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){
103999 && p->pKeyInfo->aColl[0]==0
104002 + p->u.z = p->aMem[0].z;
104003 + p->n = p->aMem[0].n;
104007 @@ -84088,7 +85666,7 @@ SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *ro…
104011 - testcase( szHdr==m.n );
104016 @@ -84118,14 +85696,14 @@ SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *…
104018 sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);
104020 - sqlite3VdbeMemRelease(&m);
104028 - sqlite3VdbeMemRelease(&m);
104033 @@ -84167,7 +85745,7 @@ SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(
104037 - sqlite3VdbeMemRelease(&m);
104042 @@ -84334,7 +85912,7 @@ static void vdbeFreeUnpacked(sqlite3 *db, int nField, UnpackedRecord *p){
104045 Mem *pMem = &p->aMem[i];
104046 - if( pMem->zMalloc ) sqlite3VdbeMemRelease(pMem);
104047 + if( pMem->zMalloc ) sqlite3VdbeMemReleaseMalloc(pMem);
104049 sqlite3DbFreeNN(db, p);
104051 @@ -84761,6 +86339,9 @@ SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value *pOrig){
104055 + }else if( pNew->flags & MEM_Null ){
104057 + pNew->flags &= ~(MEM_Term|MEM_Subtype);
104061 @@ -84791,7 +86372,8 @@ static void setResultStrOrError(
104065 - int rc = sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel);
104066 + Mem *pOut = pCtx->pOut;
104071 @@ -84801,6 +86383,11 @@ static void setResultStrOrError(
104077 + sqlite3VdbeChangeEncoding(pOut, pCtx->enc);
104083 @@ -84944,17 +86531,22 @@ SQLITE_API void sqlite3_result_text16le(
104087 + Mem *pOut = pCtx->pOut;
104088 assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
104089 - sqlite3VdbeMemCopy(pCtx->pOut, pValue);
104091 + sqlite3VdbeChangeEncoding(pOut, pCtx->enc);
104097 - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
104098 - sqlite3VdbeMemSetZeroBlob(pCtx->pOut, n);
104102 Mem *pOut = pCtx->pOut;
104103 assert( sqlite3_mutex_held(pOut->db->mutex) );
104104 if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){
104109 @@ -84970,8 +86562,8 @@ SQLITE_API void sqlite3_result_error_code(sqlite3_context *pCtx, int errCod…
104110 if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode;
104112 if( pCtx->pOut->flags & MEM_Null ){
104113 - sqlite3VdbeMemSetStr(pCtx->pOut, sqlite3ErrStr(errCode), -1,
104114 - SQLITE_UTF8, SQLITE_STATIC);
104115 + setResultStrOrError(pCtx, sqlite3ErrStr(errCode), -1, SQLITE_UTF8,
104120 @@ -85045,80 +86637,83 @@ static int sqlite3Step(Vdbe *p){
104124 - if( p->iVdbeMagic!=VDBE_MAGIC_RUN ){
104125 - /* We used to require that sqlite3_reset() be called before retrying
104126 - ** sqlite3_step() after any error or after SQLITE_DONE. But beginning
104127 - ** with version 3.7.0, we changed this so that sqlite3_reset() would
104128 - ** be called automatically instead of throwing the SQLITE_MISUSE error.
104129 - ** This "automatic-reset" change is not technically an incompatibility,
104130 - ** since any application that receives an SQLITE_MISUSE is broken by
104131 - ** definition.
104132 - **
104133 - ** Nevertheless, some published applications that were originally written
104134 - ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE
104135 - ** returns, and those were broken by the automatic-reset change. As a
104136 - ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the
104137 - ** legacy behavior of returning SQLITE_MISUSE for cases where the
104138 - ** previous sqlite3_step() returned something other than a SQLITE_LOCKED
104139 - ** or SQLITE_BUSY error.
104140 - */
104141 -#ifdef SQLITE_OMIT_AUTORESET
104142 - if( (rc = p->rc&0xff)==SQLITE_BUSY || rc==SQLITE_LOCKED ){
104143 - sqlite3_reset((sqlite3_stmt*)p);
104144 - }else{
104145 - return SQLITE_MISUSE_BKPT;
104146 - }
104147 -#else
104148 - sqlite3_reset((sqlite3_stmt*)p);
104149 -#endif
104150 - }
104151 -
104152 - /* Check that malloc() has not failed. If it has, return early. */
104153 db = p->db;
104154 - if( db->mallocFailed ){
104155 - p->rc = SQLITE_NOMEM;
104156 - return SQLITE_NOMEM_BKPT;
104157 - }
104158 + if( p->eVdbeState!=VDBE_RUN_STATE ){
104160 + if( p->eVdbeState==VDBE_READY_STATE ){
104161 + if( p->expired ){
104162 + p->rc = SQLITE_SCHEMA;
104164 + if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
104166 + ** error has occurred, then return the error code in p->rc to the
104175 - if( p->pc<0 && p->expired ){
104176 - p->rc = SQLITE_SCHEMA;
104177 - rc = SQLITE_ERROR;
104178 - if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 ){
104179 - /* If this statement was prepared using saved SQL and an
104180 - ** error has occurred, then return the error code in p->rc to the
104181 - ** caller. Set the error code in the database handle to the same value.
104186 - rc = sqlite3VdbeTransferError(p);
104187 - }
104188 - goto end_of_step;
104189 - }
104190 - if( p->pc<0 ){
104191 - /* If there are no other statements currently running, then
104192 - ** reset the interrupt flag. This prevents a call to sqlite3_interrupt
104193 - ** from interrupting a statement that has not yet started.
104194 - */
104195 - if( db->nVdbeActive==0 ){
104196 - AtomicStore(&db->u1.isInterrupted, 0);
104197 - }
104198 + if( db->nVdbeActive==0 ){
104199 + AtomicStore(&db->u1.isInterrupted, 0);
104202 - assert( db->nVdbeWrite>0 || db->autoCommit==0
104203 - || (db->nDeferredCons==0 && db->nDeferredImmCons==0)
104204 - );
104205 + assert( db->nVdbeWrite>0 || db->autoCommit==0
104206 + || (db->nDeferredCons==0 && db->nDeferredImmCons==0)
104210 - if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0
104211 - && !db->init.busy && p->zSql ){
104212 - sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);
104213 - }else{
104214 - assert( p->startTime==0 );
104215 - }
104216 + if( (db->mTrace & (SQLITE_TRACE_PROFILE|SQLITE_TRACE_XPROFILE))!=0
104217 + && !db->init.busy && p->zSql ){
104218 + sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime);
104220 + assert( p->startTime==0 );
104224 - db->nVdbeActive++;
104225 - if( p->readOnly==0 ) db->nVdbeWrite++;
104226 - if( p->bIsReader ) db->nVdbeRead++;
104227 - p->pc = 0;
104228 + db->nVdbeActive++;
104229 + if( p->readOnly==0 ) db->nVdbeWrite++;
104230 + if( p->bIsReader ) db->nVdbeRead++;
104231 + p->pc = 0;
104232 + p->eVdbeState = VDBE_RUN_STATE;
104235 + if( ALWAYS(p->eVdbeState==VDBE_HALT_STATE) ){
104240 + ** This "automatic-reset" change is not technically an incompatibility,
104246 + ** returns, and those were broken by the automatic-reset change. As a
104247 + ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the
104253 + if( (rc = p->rc&0xff)==SQLITE_BUSY || rc==SQLITE_LOCKED ){
104261 + assert( p->eVdbeState==VDBE_READY_STATE );
104267 p->rcApp = SQLITE_OK;
104269 @@ -85133,7 +86728,12 @@ static int sqlite3Step(Vdbe *p){
104270 db->nVdbeExec--;
104273 - if( rc!=SQLITE_ROW ){
104275 + assert( p->rc==SQLITE_OK );
104276 + assert( db->mallocFailed==0 );
104277 + db->errCode = SQLITE_ROW;
104282 checkProfileCallback(db, p);
104283 @@ -85185,7 +86785,6 @@ SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){
104285 db = v->db;
104286 sqlite3_mutex_enter(db->mutex);
104287 - v->doingRerun = 0;
104290 int savedPc = v->pc;
104291 @@ -85211,7 +86810,13 @@ SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){
104295 - if( savedPc>=0 ) v->doingRerun = 1;
104300 + ** SQLITE_SCHEMA. tag-20220401a */
104301 + v->minWriteFileFormat = 254;
104303 assert( v->expired==0 );
104305 sqlite3_mutex_leave(db->mutex);
104306 @@ -85262,6 +86867,70 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context *p){
104307 return sqlite3_value_nochange(p->pOut);
104327 + rc = sqlite3BtreeNext(pRhs->pCsr, 0);
104330 + rc = sqlite3BtreeFirst(pRhs->pCsr, &dummy);
104331 + assert( rc==SQLITE_OK || sqlite3BtreeEof(pRhs->pCsr) );
104332 + if( sqlite3BtreeEof(pRhs->pCsr) ) rc = SQLITE_DONE;
104338 + sz = sqlite3BtreePayloadSize(pRhs->pCsr);
104339 + rc = sqlite3VdbeMemFromBtreeZeroOffset(pRhs->pCsr,(int)sz,&sMem);
104343 + sqlite3_value *pOut = pRhs->pOut;
104346 + pOut->enc = ENC(pOut->db);
104347 + if( (pOut->flags & MEM_Ephem)!=0 && sqlite3VdbeMemMakeWriteable(pOut) ){
104377 @@ -85456,15 +87125,15 @@ static const Mem *columnNullValue(void){
104386 - /* .n = */ (int)0,
104387 - /* .z = */ (char*)0,
104388 - /* .zMalloc = */ (char*)0,
104389 + /* .db = */ (sqlite3*)0,
104392 - /* .db = */ (sqlite3*)0,
104397 @@ -85761,7 +87430,7 @@ static int vdbeUnbind(Vdbe *p, int i){
104400 sqlite3_mutex_enter(p->db->mutex);
104401 - if( p->iVdbeMagic!=VDBE_MAGIC_RUN || p->pc>=0 ){
104402 + if( p->eVdbeState!=VDBE_READY_STATE ){
104403 sqlite3Error(p->db, SQLITE_MISUSE);
104404 sqlite3_mutex_leave(p->db->mutex);
104406 @@ -85946,7 +87615,10 @@ SQLITE_API int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite…
104410 - rc = sqlite3_bind_double(pStmt, i, pValue->u.r);
104411 + assert( pValue->flags & (MEM_Real|MEM_IntReal) );
104413 + (pValue->flags & MEM_Real) ? pValue->u.r : (double)pValue->u.i
104418 @@ -86111,7 +87783,7 @@ SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt){
104422 - return v!=0 && v->iVdbeMagic==VDBE_MAGIC_RUN && v->pc>=0;
104423 + return v!=0 && v->eVdbeState==VDBE_RUN_STATE;
104427 @@ -86157,8 +87829,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFl…
104428 sqlite3_mutex_enter(db->mutex);
104430 db->pnBytesFreed = (int*)&v;
104431 - sqlite3VdbeClearObject(db, pVdbe);
104432 - sqlite3DbFree(db, pVdbe);
104434 db->pnBytesFreed = 0;
104435 sqlite3_mutex_leave(db->mutex);
104437 @@ -86926,7 +88597,6 @@ static VdbeCursor *allocateCursor(
104441 - int iDb, /* Database the cursor belongs to, or -1 */
104445 @@ -86952,12 +88622,12 @@ static VdbeCursor *allocateCursor(
104449 - ROUND8(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField +
104453 assert( iCur>=0 && iCur<p->nCursor );
104454 if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/
104455 - sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);
104456 + sqlite3VdbeFreeCursorNN(p, p->apCsr[iCur]);
104457 p->apCsr[iCur] = 0;
104460 @@ -86983,12 +88653,11 @@ static VdbeCursor *allocateCursor(
104461 p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc;
104463 pCx->eCurType = eCurType;
104464 - pCx->iDb = iDb;
104465 pCx->nField = nField;
104466 pCx->aOffset = &pCx->aType[nField];
104468 pCx->uc.pCursor = (BtCursor*)
104469 - &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
104470 + &pMem->z[ROUND8P(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
104471 sqlite3BtreeCursorZero(pCx->uc.pCursor);
104474 @@ -87356,6 +89025,29 @@ static Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){
104479 +** Compute a bloom filter hash using pOp->p4.i registers from aMem[] beginning
104480 +** with pOp->p3. Return the hash.
104486 + assert( pOp->p4type==P4_INT32 );
104487 + for(i=pOp->p3, mx=i+pOp->p4.i; i<mx; i++){
104489 + if( p->flags & (MEM_Int|MEM_IntReal) ){
104490 + h += p->u.i;
104491 + }else if( p->flags & MEM_Real ){
104493 + }else if( p->flags & (MEM_Str|MEM_Blob) ){
104494 + h += p->n;
104495 + if( p->flags & MEM_Zero ) h += p->u.nZero;
104504 @@ -87404,7 +89096,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec(
104508 - assert( p->iVdbeMagic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */
104509 + assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */
104512 if( db->xProgress ){
104513 @@ -87647,24 +89339,39 @@ case OP_Gosub: { /* jump */
104514 pIn1->flags = MEM_Int;
104515 pIn1->u.i = (int)(pOp-aOp);
104516 REGISTER_TRACE(pOp->p1, pIn1);
104517 -
104518 - /* Most jump operations do a goto to this spot in order to update
104519 - ** the pOp pointer. */
104520 -jump_to_p2:
104521 - pOp = &aOp[pOp->p2 - 1];
104522 - break;
104526 -/* Opcode: Return P1 * * * *
104529 -** Jump to the next instruction after the address in register P1. After
104530 -** the jump, register P1 becomes undefined.
104536 +** OP_Return becomes a no-op. If P3 is 0, then register P1 must hold an
104543 +** P2 is not used by the byte-code engine. However, if P2 is positive
104548 +** value is a byte-code indentation hint. See tag-20220407a in
104552 pIn1 = &aMem[pOp->p1];
104553 - assert( pIn1->flags==MEM_Int );
104554 - pOp = &aOp[pIn1->u.i];
104555 - pIn1->flags = MEM_Undefined;
104556 + if( pIn1->flags & MEM_Int ){
104557 + if( pOp->p3 ){ VdbeBranchTaken(1, 2); }
104558 + pOp = &aOp[pIn1->u.i];
104559 + }else if( ALWAYS(pOp->p3) ){
104565 @@ -87687,7 +89394,14 @@ case OP_InitCoroutine: { /* jump */
104567 pOut->u.i = pOp->p3 - 1;
104568 pOut->flags = MEM_Int;
104569 - if( pOp->p2 ) goto jump_to_p2;
104570 + if( pOp->p2==0 ) break;
104575 + assert( pOp->p2>0 ); /* There are never any jumps to instruction 0 */
104576 + assert( pOp->p2<p->nOp ); /* Jumps must be in range */
104577 + pOp = &aOp[pOp->p2 - 1];
104581 @@ -87789,11 +89503,10 @@ case OP_Halt: {
104585 - pcx = (int)(pOp - aOp);
104587 if( pOp->p2==OE_Abort ){ sqlite3VdbeAssertAbortable(p); }
104589 - if( pOp->p1==SQLITE_OK && p->pFrame ){
104590 + if( p->pFrame && pOp->p1==SQLITE_OK ){
104591 /* Halt the sub-program. Return control to the parent frame. */
104592 pFrame = p->pFrame;
104593 p->pFrame = pFrame->pParent;
104594 @@ -87815,7 +89528,6 @@ case OP_Halt: {
104596 p->rc = pOp->p1;
104597 p->errorAction = (u8)pOp->p2;
104598 - p->pc = pcx;
104599 assert( pOp->p5<=4 );
104600 if( p->rc ){
104601 if( pOp->p5 ){
104602 @@ -87832,6 +89544,7 @@ case OP_Halt: {
104604 sqlite3VdbeError(p, "%s", pOp->p4.z);
104606 + pcx = (int)(pOp - aOp);
104607 sqlite3_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg);
104610 @@ -87957,6 +89670,28 @@ case OP_String: { /* out2 */
104617 +** Mark the beginning of a subroutine that can be entered in-line
104621 +** If the subroutine is entered in-line, then the OP_Return will simply
104627 +** a no-op that simply falls through to the next instruction (assuming that
104629 +** entered in-line, then the OP_Return will cause in-line execution to
104639 @@ -87969,6 +89704,7 @@ case OP_String: { /* out2 */
104647 @@ -88010,12 +89746,18 @@ case OP_SoftNull: {
104651 -** blob in register P2.
104653 +** a zero-filled blob that is P1 bytes long in P2.
104656 assert( pOp->p1 <= SQLITE_MAX_LENGTH );
104658 - sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);
104659 + if( pOp->p4.z==0 ){
104660 + sqlite3VdbeMemSetZeroBlob(pOut, pOp->p1);
104663 + sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);
104665 pOut->enc = encoding;
104668 @@ -88093,11 +89835,16 @@ case OP_Move: {
104672 -/* Opcode: Copy P1 P2 P3 * *
104686 @@ -88112,6 +89859,9 @@ case OP_Copy: {
104690 + if( (pOut->flags & MEM_Subtype)!=0 && (pOp->p5 & 0x0002)!=0 ){
104691 + pOut->flags &= ~MEM_Subtype;
104694 pOut->pScopyFrom = 0;
104696 @@ -88164,24 +89914,22 @@ case OP_IntCopy: { /* out2 */
104700 -/* Opcode: ChngCntRow P1 P2 * * *
104701 -** Synopsis: output=r[P1]
104704 -** Output value in register P1 as the chance count for a DML statement,
104705 -** due to the "PRAGMA count_changes=ON" setting. Or, if there was a
104706 -** foreign key error in the statement, trigger the error now.
104709 +** constraint violations, this is a no-op.
104711 -** This opcode is a variant of OP_ResultRow that checks the foreign key
104712 -** immediate constraint count and throws an error if the count is
104713 -** non-zero. The P2 opcode must be 1.
104719 -case OP_ChngCntRow: {
104720 - assert( pOp->p2==1 );
104725 - /* Fall through to the next case, OP_ResultRow */
104726 - /* no break */ deliberate_fall_through
104731 @@ -88194,45 +89942,32 @@ case OP_ChngCntRow: {
104735 - Mem *pMem;
104736 - int i;
104737 assert( p->nResColumn==pOp->p2 );
104738 assert( pOp->p1>0 || CORRUPT_DB );
104739 assert( pOp->p1+pOp->p2<=(p->nMem+1 - p->nCursor)+1 );
104741 - /* Invalidate all ephemeral cursor row caches */
104742 p->cacheCtr = (p->cacheCtr + 2)|1;
104743 -
104744 - /* Make sure the results of the current row are \000 terminated
104745 - ** and have an assigned type. The results are de-ephemeralized as
104746 - ** a side effect.
104747 - */
104748 - pMem = p->pResultSet = &aMem[pOp->p1];
104749 - for(i=0; i<pOp->p2; i++){
104750 - assert( memIsValid(&pMem[i]) );
104751 - Deephemeralize(&pMem[i]);
104752 - assert( (pMem[i].flags & MEM_Ephem)==0
104753 - || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 );
104754 - sqlite3VdbeMemNulTerminate(&pMem[i]);
104755 - REGISTER_TRACE(pOp->p1+i, &pMem[i]);
104756 + p->pResultSet = &aMem[pOp->p1];
104758 - /* The registers in the result will not be used again when the
104759 - ** prepared statement restarts. This is because sqlite3_column()
104760 - ** APIs might have caused type conversions of made other changes to
104761 - ** the register values. Therefore, we can go ahead and break any
104762 - ** OP_SCopy dependencies. */
104763 - pMem[i].pScopyFrom = 0;
104764 -#endif
104766 + Mem *pMem = p->pResultSet;
104768 + for(i=0; i<pOp->p2; i++){
104770 + REGISTER_TRACE(pOp->p1+i, &pMem[i]);
104780 if( db->mallocFailed ) goto no_mem;
104781 -
104782 if( db->mTrace & SQLITE_TRACE_ROW ){
104783 db->trace.xV2(SQLITE_TRACE_ROW, db->pTraceArg, p, 0);
104785 -
104786 -
104787 - /* Return SQLITE_ROW
104788 - */
104789 p->pc = (int)(pOp - aOp) + 1;
104792 @@ -88287,7 +90022,7 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
104793 if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
104796 - if( sqlite3VdbeMemGrow(pOut, (int)nByte+3, pOut==pIn2) ){
104801 @@ -88299,9 +90034,9 @@ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
104802 memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n);
104803 assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) );
104804 pIn1->flags = flags1;
104806 pOut->z[nByte]=0;
104807 pOut->z[nByte+1] = 0;
104808 - pOut->z[nByte+2] = 0;
104809 pOut->flags |= MEM_Term;
104810 pOut->n = (int)nByte;
104811 pOut->enc = encoding;
104812 @@ -88746,23 +90481,23 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
104813 assert( (pOp->p5 & SQLITE_AFF_MASK)!=SQLITE_AFF_TEXT || CORRUPT_DB );
104815 if( pIn3->u.i > pIn1->u.i ){
104816 - iCompare = +1;
104817 if( sqlite3aGTb[pOp->opcode] ){
104818 VdbeBranchTaken(1, (pOp->p5 & SQLITE_NULLEQ)?2:3);
104822 }else if( pIn3->u.i < pIn1->u.i ){
104823 - iCompare = -1;
104824 if( sqlite3aLTb[pOp->opcode] ){
104825 VdbeBranchTaken(1, (pOp->p5 & SQLITE_NULLEQ)?2:3);
104828 + iCompare = -1;
104830 - iCompare = 0;
104831 if( sqlite3aEQb[pOp->opcode] ){
104832 VdbeBranchTaken(1, (pOp->p5 & SQLITE_NULLEQ)?2:3);
104837 VdbeBranchTaken(0, (pOp->p5 & SQLITE_NULLEQ)?2:3);
104839 @@ -88789,11 +90524,11 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
104843 - iCompare = 1; /* Operands are not equal */
104845 if( pOp->p5 & SQLITE_JUMPIFNULL ){
104852 @@ -88819,7 +90554,7 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
104854 testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );
104855 flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);
104856 - if( NEVER(pIn1==pIn3) ) flags3 = flags1 | MEM_Str;
104860 testcase( pIn3->flags & MEM_Int );
104861 @@ -88899,9 +90634,8 @@ case OP_ElseEq: { /* same as TK_ESCAPE, jump */
104865 -** The permutation is only valid until the next OP_Compare that has
104866 -** the OPFLAG_PERMUTE bit set in P5. Typically the OP_Permutation should
104867 -** occur immediately prior to the OP_Compare.
104873 @@ -88933,6 +90667,8 @@ case OP_Permutation: {
104882 @@ -88991,6 +90727,7 @@ case OP_Compare: {
104890 @@ -88999,8 +90736,11 @@ case OP_Compare: {
104898 + assert( pOp>aOp && pOp[-1].opcode==OP_Compare );
104900 VdbeBranchTaken(0,4); pOp = &aOp[pOp->p1 - 1];
104902 @@ -89287,17 +91027,25 @@ case OP_Offset: { /* out3 */
104903 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
104904 pC = p->apCsr[pOp->p1];
104905 pOut = &p->aMem[pOp->p3];
104906 - if( NEVER(pC==0) || pC->eCurType!=CURTYPE_BTREE ){
104907 + if( pC==0 || pC->eCurType!=CURTYPE_BTREE ){
104910 - sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor));
104911 + if( pC->deferredMoveto ){
104915 + if( sqlite3BtreeEof(pC->uc.pCursor) ){
104918 + sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor));
104926 -** Synopsis: r[P3]=PX
104931 @@ -89319,7 +91067,7 @@ case OP_Offset: { /* out3 */
104935 - BtCursor *pCrsr; /* The BTree cursor */
104936 + BtCursor *pCrsr; /* The B-Tree cursor corresponding to pC */
104937 u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */
104940 @@ -89333,43 +91081,53 @@ case OP_Column: {
104943 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
104944 + assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
104945 pC = p->apCsr[pOp->p1];
104946 - assert( pC!=0 );
104947 p2 = (u32)pOp->p2;
104949 - /* If the cursor cache is stale (meaning it is not currently point at
104950 - ** the correct row) then bring it up-to-date by doing the necessary
104951 - ** B-Tree seek. */
104952 - rc = sqlite3VdbeCursorMoveto(&pC, &p2);
104953 - if( rc ) goto abort_due_to_error;
104954 -
104955 - assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
104956 - pDest = &aMem[pOp->p3];
104957 - memAboutToChange(p, pDest);
104960 - assert( p2<(u32)pC->nField );
104961 + assert( p2<(u32)pC->nField
104962 + || (pC->eCurType==CURTYPE_PSEUDO && pC->seekResult==0) );
104963 aOffset = pC->aOffset;
104964 + assert( aOffset==pC->aType+pC->nField );
104965 assert( pC->eCurType!=CURTYPE_VTAB );
104966 assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow );
104967 assert( pC->eCurType!=CURTYPE_SORTER );
104969 if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/
104970 if( pC->nullRow ){
104971 - if( pC->eCurType==CURTYPE_PSEUDO ){
104972 + if( pC->eCurType==CURTYPE_PSEUDO && pC->seekResult>0 ){
104973 /* For the special case of as pseudo-cursor, the seekResult field
104975 - assert( pC->seekResult>0 );
104976 pReg = &aMem[pC->seekResult];
104977 assert( pReg->flags & MEM_Blob );
104979 pC->payloadSize = pC->szRow = pReg->n;
104980 pC->aRow = (u8*)pReg->z;
104982 + pDest = &aMem[pOp->p3];
104988 pCrsr = pC->uc.pCursor;
104989 + if( pC->deferredMoveto ){
104991 + assert( !pC->isEphemeral );
104992 + if( pC->ub.aAltMap && (iMap = pC->ub.aAltMap[1+p2])>0 ){
104993 + pC = pC->pAltCursor;
104994 + p2 = iMap - 1;
105004 assert( pC->eCurType==CURTYPE_BTREE );
105007 @@ -89377,15 +91135,15 @@ case OP_Column: {
105008 pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &pC->szRow);
105009 assert( pC->szRow<=pC->payloadSize );
105010 assert( pC->szRow<=65536 ); /* Maximum page size is 64KiB */
105011 - if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){
105012 - goto too_big;
105013 - }
105015 pC->cacheStatus = p->cacheCtr;
105016 - pC->iHdrOffset = getVarint32(pC->aRow, aOffset[0]);
105017 + if( (aOffset[0] = pC->aRow[0])<0x80 ){
105018 + pC->iHdrOffset = 1;
105020 + pC->iHdrOffset = sqlite3GetVarint32(pC->aRow, aOffset);
105022 pC->nHdrParsed = 0;
105024 -
105025 if( pC->szRow<aOffset[0] ){ /*OPTIMIZATION-IF-FALSE*/
105026 /* pC->aRow does not have to hold the entire row, but it does at least
105027 ** need to cover the header of the record. If pC->aRow does not contain
105028 @@ -89425,6 +91183,10 @@ case OP_Column: {
105032 + }else if( sqlite3BtreeCursorHasMoved(pC->uc.pCursor) ){
105039 @@ -89493,6 +91255,8 @@ case OP_Column: {
105042 if( pC->nHdrParsed<=p2 ){
105043 + pDest = &aMem[pOp->p3];
105045 if( pOp->p4type==P4_MEM ){
105046 sqlite3VdbeMemShallowCopy(pDest, pOp->p4.pMem, MEM_Static);
105048 @@ -89510,6 +91274,8 @@ case OP_Column: {
105050 assert( p2<pC->nHdrParsed );
105052 + pDest = &aMem[pOp->p3];
105057 @@ -89530,6 +91296,7 @@ case OP_Column: {
105058 pDest->n = len = (t-12)/2;
105059 pDest->enc = encoding;
105060 if( pDest->szMalloc < len+2 ){
105061 + if( len>db->aLimit[SQLITE_LIMIT_LENGTH] ) goto too_big;
105062 pDest->flags = MEM_Null;
105065 @@ -89562,6 +91329,7 @@ case OP_Column: {
105069 + if( len>db->aLimit[SQLITE_LIMIT_LENGTH] ) goto too_big;
105070 rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, aOffset[p2], len, pDest);
105072 sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);
105073 @@ -89644,6 +91412,8 @@ case OP_TypeCheck: {
105077 + testcase( (pIn1->flags & (MEM_Real|MEM_IntReal))==MEM_Real );
105078 + testcase( (pIn1->flags & (MEM_Real|MEM_IntReal))==MEM_IntReal );
105079 if( pIn1->flags & MEM_Int ){
105082 @@ -89661,7 +91431,7 @@ case OP_TypeCheck: {
105083 pIn1->flags |= MEM_Real;
105084 pIn1->flags &= ~MEM_Int;
105086 - }else if( (pIn1->flags & MEM_Real)==0 ){
105087 + }else if( (pIn1->flags & (MEM_Real|MEM_IntReal))==0 ){
105091 @@ -89772,7 +91542,6 @@ case OP_MakeRecord: {
105095 - int file_format; /* File format to use for encoding */
105099 @@ -89801,7 +91570,6 @@ case OP_MakeRecord: {
105101 nField = pOp->p2;
105102 pLast = &pData0[nField-1];
105103 - file_format = p->minWriteFileFormat;
105106 assert( pOp->p3<pOp->p1 || pOp->p3>=pOp->p1+pOp->p2 );
105107 @@ -89900,10 +91668,10 @@ case OP_MakeRecord: {
105111 - testcase( uu==2147483647 ); testcase( uu==2147483648 );
105115 - if( (i&1)==i && file_format>=4 ){
105116 + if( (i&1)==i && p->minWriteFileFormat>=4 ){
105117 pRec->uTemp = 8+(u32)uu;
105120 @@ -90008,18 +91776,60 @@ case OP_MakeRecord: {
105124 - zHdr += putVarint32(zHdr, nHdr);
105132 - do{
105133 + while( 1 /*exit-by-break*/ ){
105134 serial_type = pRec->uTemp;
105135 /* EVIDENCE-OF: R-06529-47362 Following the size varint are one or more
105136 - ** additional varints, one per column. */
105137 - zHdr += putVarint32(zHdr, serial_type); /* serial type */
105138 - /* EVIDENCE-OF: R-64536-51728 The values for each column in the record
105140 + ** EVIDENCE-OF: R-64536-51728 The values for each column in the record
105142 - zPayload += sqlite3VdbeSerialPut(zPayload, pRec, serial_type); /* content */
105143 - }while( (++pRec)<=pLast );
105152 + assert( sizeof(v)==sizeof(pRec->u.r) );
105153 + memcpy(&v, &pRec->u.r, sizeof(v));
105156 + v = pRec->u.i;
105160 + while( 1 /*exit-by-break*/ ){
105161 + zPayload[--i] = (u8)(v&0xFF);
105169 + if( serial_type>=14 && pRec->n>0 ){
105170 + assert( pRec->z!=0 );
105171 + memcpy(zPayload, pRec->z, pRec->n);
105172 + zPayload += pRec->n;
105176 + if( pRec->n ){
105177 + assert( pRec->z!=0 );
105178 + memcpy(zPayload, pRec->z, pRec->n);
105179 + zPayload += pRec->n;
105185 assert( nHdr==(int)(zHdr - (u8*)pOut->z) );
105186 assert( nByte==(int)(zPayload - (u8*)pOut->z) );
105188 @@ -90028,7 +91838,7 @@ case OP_MakeRecord: {
105192 -/* Opcode: Count P1 P2 p3 * *
105197 @@ -90238,7 +92048,10 @@ case OP_Savepoint: {
105201 -
105202 + if( p->eVdbeState==VDBE_HALT_STATE ){
105209 @@ -90342,6 +92155,7 @@ case OP_AutoCommit: {
105213 + Db *pDb;
105216 assert( p->bIsReader );
105217 @@ -90361,7 +92175,8 @@ case OP_Transaction: {
105221 - pBt = db->aDb[pOp->p1].pBt;
105222 + pDb = &db->aDb[pOp->p1];
105223 + pBt = pDb->pBt;
105226 rc = sqlite3BtreeBeginTrans(pBt, pOp->p2, &iMeta);
105227 @@ -90402,8 +92217,7 @@ case OP_Transaction: {
105228 assert( pOp->p5==0 || pOp->p4type==P4_INT32 );
105230 && pOp->p5
105231 - && (iMeta!=pOp->p3
105232 - || db->aDb[pOp->p1].pSchema->iGeneration!=pOp->p4.i)
105233 + && (iMeta!=pOp->p3 || pDb->pSchema->iGeneration!=pOp->p4.i)
105236 ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema
105237 @@ -90430,6 +92244,11 @@ case OP_Transaction: {
105239 p->expired = 1;
105245 + p->changeCntOn = 0;
105249 @@ -90496,8 +92315,9 @@ case OP_SetCookie: {
105250 rc = sqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, pOp->p3);
105251 if( pOp->p2==BTREE_SCHEMA_VERSION ){
105253 - pDb->pSchema->schema_cookie = pOp->p3 - pOp->p5;
105254 + *(u32*)&pDb->pSchema->schema_cookie = *(u32*)&pOp->p3 - pOp->p5;
105255 db->mDbFlags |= DBFLAG_SchemaChange;
105256 + sqlite3FkClearTriggerCache(db, pOp->p1);
105257 }else if( pOp->p2==BTREE_FILE_FORMAT ){
105259 pDb->pSchema->file_format = pOp->p3;
105260 @@ -90675,8 +92495,9 @@ case OP_OpenWrite:
105261 assert( pOp->p1>=0 );
105264 - pCur = allocateCursor(p, pOp->p1, nField, iDb, CURTYPE_BTREE);
105265 + pCur = allocateCursor(p, pOp->p1, nField, CURTYPE_BTREE);
105267 + pCur->iDb = iDb;
105268 pCur->nullRow = 1;
105269 pCur->isOrdered = 1;
105270 pCur->pgnoRoot = p2;
105271 @@ -90718,7 +92539,7 @@ case OP_OpenDup: {
105273 assert( pOrig->isEphemeral ); /* Only ephemeral cursors can be duplicated */
105275 - pCx = allocateCursor(p, pOp->p1, pOrig->nField, -1, CURTYPE_BTREE);
105276 + pCx = allocateCursor(p, pOp->p1, pOrig->nField, CURTYPE_BTREE);
105278 pCx->nullRow = 1;
105279 pCx->isEphemeral = 1;
105280 @@ -90726,10 +92547,10 @@ case OP_OpenDup: {
105281 pCx->isTable = pOrig->isTable;
105282 pCx->pgnoRoot = pOrig->pgnoRoot;
105283 pCx->isOrdered = pOrig->isOrdered;
105284 - pCx->pBtx = pOrig->pBtx;
105285 - pCx->hasBeenDuped = 1;
105286 - pOrig->hasBeenDuped = 1;
105287 - rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
105288 + pCx->ub.pBtx = pOrig->ub.pBtx;
105289 + pCx->noReuse = 1;
105290 + pOrig->noReuse = 1;
105291 + rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR,
105292 pCx->pKeyInfo, pCx->uc.pCursor);
105295 @@ -90795,23 +92616,23 @@ case OP_OpenEphemeral: {
105296 aMem[pOp->p3].z = "";
105298 pCx = p->apCsr[pOp->p1];
105299 - if( pCx && !pCx->hasBeenDuped && ALWAYS(pOp->p2<=pCx->nField) ){
105300 + if( pCx && !pCx->noReuse && ALWAYS(pOp->p2<=pCx->nField) ){
105304 assert( pCx->isEphemeral );
105305 pCx->seqCount = 0;
105306 pCx->cacheStatus = CACHE_STALE;
105307 - rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0);
105308 + rc = sqlite3BtreeClearTable(pCx->ub.pBtx, pCx->pgnoRoot, 0);
105310 - pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE);
105311 + pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_BTREE);
105313 pCx->isEphemeral = 1;
105314 - rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx,
105315 + rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->ub.pBtx,
105316 BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5,
105319 - rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0);
105320 + rc = sqlite3BtreeBeginTrans(pCx->ub.pBtx, 1, 0);
105324 @@ -90820,26 +92641,26 @@ case OP_OpenEphemeral: {
105326 if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
105327 assert( pOp->p4type==P4_KEYINFO );
105328 - rc = sqlite3BtreeCreateTable(pCx->pBtx, &pCx->pgnoRoot,
105329 + rc = sqlite3BtreeCreateTable(pCx->ub.pBtx, &pCx->pgnoRoot,
105330 BTREE_BLOBKEY | pOp->p5);
105332 assert( pCx->pgnoRoot==SCHEMA_ROOT+1 );
105333 assert( pKeyInfo->db==db );
105334 assert( pKeyInfo->enc==ENC(db) );
105335 - rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR,
105336 + rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR,
105337 pKeyInfo, pCx->uc.pCursor);
105339 pCx->isTable = 0;
105341 pCx->pgnoRoot = SCHEMA_ROOT;
105342 - rc = sqlite3BtreeCursor(pCx->pBtx, SCHEMA_ROOT, BTREE_WRCSR,
105343 + rc = sqlite3BtreeCursor(pCx->ub.pBtx, SCHEMA_ROOT, BTREE_WRCSR,
105344 0, pCx->uc.pCursor);
105345 pCx->isTable = 1;
105348 pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);
105350 - sqlite3BtreeClose(pCx->pBtx);
105351 + sqlite3BtreeClose(pCx->ub.pBtx);
105355 @@ -90863,7 +92684,7 @@ case OP_SorterOpen: {
105357 assert( pOp->p1>=0 );
105358 assert( pOp->p2>=0 );
105359 - pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_SORTER);
105360 + pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_SORTER);
105362 pCx->pKeyInfo = pOp->p4.pKeyInfo;
105363 assert( pCx->pKeyInfo->db==db );
105364 @@ -90912,7 +92733,7 @@ case OP_OpenPseudo: {
105366 assert( pOp->p1>=0 );
105367 assert( pOp->p3>=0 );
105368 - pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, CURTYPE_PSEUDO);
105369 + pCx = allocateCursor(p, pOp->p1, pOp->p3, CURTYPE_PSEUDO);
105371 pCx->nullRow = 1;
105372 pCx->seekResult = pOp->p2;
105373 @@ -91544,11 +93365,8 @@ case OP_NoConflict: /* jump, in3 */
105377 - int takeJump;
105380 - int res;
105381 - UnpackedRecord *pFree;
105385 @@ -91563,14 +93381,15 @@ case OP_Found: { /* jump, in3 */
105387 pC->seekOp = pOp->opcode;
105389 - pIn3 = &aMem[pOp->p3];
105390 + r.aMem = &aMem[pOp->p3];
105391 assert( pC->eCurType==CURTYPE_BTREE );
105392 assert( pC->uc.pCursor!=0 );
105393 assert( pC->isTable==0 );
105394 - if( pOp->p4.i>0 ){
105395 + r.nField = (u16)pOp->p4.i;
105398 r.pKeyInfo = pC->pKeyInfo;
105399 - r.nField = (u16)pOp->p4.i;
105400 - r.aMem = pIn3;
105405 @@ -91578,37 +93397,25 @@ case OP_Found: { /* jump, in3 */
105406 if( ii ) REGISTER_TRACE(pOp->p3+ii, &r.aMem[ii]);
105409 - pIdxKey = &r;
105410 - pFree = 0;
105411 + rc = sqlite3BtreeIndexMoveto(pC->uc.pCursor, &r, &pC->seekResult);
105413 - assert( pIn3->flags & MEM_Blob );
105414 - rc = ExpandBlob(pIn3);
105416 + assert( r.aMem->flags & MEM_Blob );
105417 + assert( pOp->opcode!=OP_NoConflict );
105421 - pFree = pIdxKey = sqlite3VdbeAllocUnpackedRecord(pC->pKeyInfo);
105422 + pIdxKey = sqlite3VdbeAllocUnpackedRecord(pC->pKeyInfo);
105424 - sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey);
105425 - }
105426 - pIdxKey->default_rc = 0;
105427 - takeJump = 0;
105428 - if( pOp->opcode==OP_NoConflict ){
105429 - /* For the OP_NoConflict opcode, take the jump if any of the
105430 - ** input fields are NULL, since any key with a NULL will not
105431 - ** conflict */
105432 - for(ii=0; ii<pIdxKey->nField; ii++){
105433 - if( pIdxKey->aMem[ii].flags & MEM_Null ){
105434 - takeJump = 1;
105435 - break;
105436 - }
105437 - }
105438 + sqlite3VdbeRecordUnpack(pC->pKeyInfo, r.aMem->n, r.aMem->z, pIdxKey);
105439 + pIdxKey->default_rc = 0;
105440 + rc = sqlite3BtreeIndexMoveto(pC->uc.pCursor, pIdxKey, &pC->seekResult);
105441 + sqlite3DbFreeNN(db, pIdxKey);
105443 - rc = sqlite3BtreeIndexMoveto(pC->uc.pCursor, pIdxKey, &res);
105444 - if( pFree ) sqlite3DbFreeNN(db, pFree);
105448 - pC->seekResult = res;
105449 - alreadyExists = (res==0);
105450 + alreadyExists = (pC->seekResult==0);
105451 pC->nullRow = 1-alreadyExists;
105452 pC->deferredMoveto = 0;
105453 pC->cacheStatus = CACHE_STALE;
105454 @@ -91616,9 +93423,25 @@ case OP_Found: { /* jump, in3 */
105458 - VdbeBranchTaken(takeJump||alreadyExists==0,2);
105459 - if( takeJump || !alreadyExists ) goto jump_to_p2;
105460 - if( pOp->opcode==OP_IfNoHope ) pC->seekHit = pOp->p4.i;
105465 + if( pOp->opcode==OP_NoConflict ){
105477 + if( pOp->opcode==OP_IfNoHope ){
105478 + pC->seekHit = pOp->p4.i;
105483 @@ -92309,7 +94132,7 @@ case OP_RowData: {
105487 -** Synopsis: r[P2]=rowid
105492 @@ -92364,13 +94187,25 @@ case OP_Rowid: { /* out2 */
105498 +** pseudo-cursor that always returns NULL for every column.
105503 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
105504 pC = p->apCsr[pOp->p1];
105505 - assert( pC!=0 );
105508 + ** pseudo-cursor that always gives null rows. */
105509 + pC = allocateCursor(p, pOp->p1, 1, CURTYPE_PSEUDO);
105511 + pC->seekResult = 0;
105512 + pC->isTable = 1;
105513 + pC->noReuse = 1;
105514 + pC->uc.pCursor = sqlite3BtreeFakeValidCursor();
105516 pC->nullRow = 1;
105517 pC->cacheStatus = CACHE_STALE;
105518 if( pC->eCurType==CURTYPE_BTREE ){
105519 @@ -92543,7 +94378,7 @@ case OP_Rewind: { /* jump */
105523 -/* Opcode: Next P1 P2 P3 P4 P5
105528 @@ -92562,15 +94397,12 @@ case OP_Rewind: { /* jump */
105532 -** P4 is always of type P4_ADVANCE. The function pointer points to
105533 -** sqlite3BtreeNext().
105534 -**
105536 ** number P5-1 in the prepared statement is incremented.
105540 -/* Opcode: Prev P1 P2 P3 P4 P5
105545 @@ -92590,9 +94422,6 @@ case OP_Rewind: { /* jump */
105549 -** P4 is always of type P4_ADVANCE. The function pointer points to
105550 -** sqlite3BtreePrevious().
105551 -**
105553 ** number P5-1 in the prepared statement is incremented.
105555 @@ -92610,30 +94439,33 @@ case OP_SorterNext: { /* jump */
105557 rc = sqlite3VdbeSorterNext(db, pC);
105561 -case OP_Next: /* jump */
105562 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
105563 assert( pOp->p5<ArraySize(p->aCounter) );
105564 pC = p->apCsr[pOp->p1];
105566 assert( pC->deferredMoveto==0 );
105567 assert( pC->eCurType==CURTYPE_BTREE );
105568 - assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext );
105569 - assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==sqlite3BtreePrevious );
105570 + assert( pC->seekOp==OP_SeekLT || pC->seekOp==OP_SeekLE
105571 + || pC->seekOp==OP_Last || pC->seekOp==OP_IfNoHope
105572 + || pC->seekOp==OP_NullRow);
105573 + rc = sqlite3BtreePrevious(pC->uc.pCursor, pOp->p3);
105576 - /* The Next opcode is only used after SeekGT, SeekGE, Rewind, and Found.
105577 - ** The Prev opcode is only used after SeekLT, SeekLE, and Last. */
105578 - assert( pOp->opcode!=OP_Next
105579 - || pC->seekOp==OP_SeekGT || pC->seekOp==OP_SeekGE
105581 + assert( pOp->p1>=0 && pOp->p1<p->nCursor );
105582 + assert( pOp->p5<ArraySize(p->aCounter) );
105583 + pC = p->apCsr[pOp->p1];
105585 + assert( pC->deferredMoveto==0 );
105586 + assert( pC->eCurType==CURTYPE_BTREE );
105587 + assert( pC->seekOp==OP_SeekGT || pC->seekOp==OP_SeekGE
105588 || pC->seekOp==OP_Rewind || pC->seekOp==OP_Found
105589 || pC->seekOp==OP_NullRow|| pC->seekOp==OP_SeekRowid
105590 || pC->seekOp==OP_IfNoHope);
105591 - assert( pOp->opcode!=OP_Prev
105592 - || pC->seekOp==OP_SeekLT || pC->seekOp==OP_SeekLE
105593 - || pC->seekOp==OP_Last || pC->seekOp==OP_IfNoHope
105594 - || pC->seekOp==OP_NullRow);
105595 + rc = sqlite3BtreeNext(pC->uc.pCursor, pOp->p3);
105597 - rc = pOp->p4.xAdvance(pC->uc.pCursor, pOp->p3);
105599 pC->cacheStatus = CACHE_STALE;
105601 @@ -92820,9 +94652,9 @@ case OP_IdxRowid: { /* out2 */
105602 assert( pOp->p1>=0 && pOp->p1<p->nCursor );
105603 pC = p->apCsr[pOp->p1];
105605 - assert( pC->eCurType==CURTYPE_BTREE );
105606 + assert( pC->eCurType==CURTYPE_BTREE || IsNullCursor(pC) );
105607 assert( pC->uc.pCursor!=0 );
105608 - assert( pC->isTable==0 );
105609 + assert( pC->isTable==0 || IsNullCursor(pC) );
105610 assert( pC->deferredMoveto==0 );
105611 assert( !pC->nullRow || pOp->opcode==OP_IdxRowid );
105613 @@ -92851,10 +94683,11 @@ case OP_IdxRowid: { /* out2 */
105614 pTabCur->nullRow = 0;
105615 pTabCur->movetoTarget = rowid;
105616 pTabCur->deferredMoveto = 1;
105617 + pTabCur->cacheStatus = CACHE_STALE;
105618 assert( pOp->p4type==P4_INTARRAY || pOp->p4.ai==0 );
105619 - pTabCur->aAltMap = pOp->p4.ai;
105620 - assert( !pC->isEphemeral );
105621 assert( !pTabCur->isEphemeral );
105622 + pTabCur->ub.aAltMap = pOp->p4.ai;
105623 + assert( !pC->isEphemeral );
105624 pTabCur->pAltCursor = pC;
105627 @@ -92985,7 +94818,7 @@ case OP_IdxGE: { /* jump */
105631 - sqlite3VdbeMemRelease(&m);
105636 @@ -93866,6 +95699,7 @@ case OP_AggStep: {
105637 pCtx->pVdbe = p;
105638 pCtx->skipFlag = 0;
105639 pCtx->isError = 0;
105640 + pCtx->enc = encoding;
105641 pCtx->argc = n;
105642 pOp->p4type = P4_FUNCCTX;
105643 pOp->p4.pCtx = pCtx;
105644 @@ -93995,9 +95829,6 @@ case OP_AggFinal: {
105648 - if( sqlite3VdbeMemTooBig(pMem) ){
105649 - goto too_big;
105650 - }
105654 @@ -94376,7 +96207,7 @@ case OP_VOpen: {
105655 pVCur->pVtab = pVtab;
105658 - pCur = allocateCursor(p, pOp->p1, 0, -1, CURTYPE_VTAB);
105659 + pCur = allocateCursor(p, pOp->p1, 0, CURTYPE_VTAB);
105661 pCur->uc.pVCur = pVCur;
105662 pVtab->nRef++;
105663 @@ -94389,6 +96220,34 @@ case OP_VOpen: {
105682 + pC = p->apCsr[pOp->p1];
105685 + pRhs->pCsr = pC->uc.pCursor;
105686 + pRhs->pOut = &aMem[pOp->p3];
105688 + pOut->flags = MEM_Null;
105698 @@ -94477,7 +96336,6 @@ case OP_VColumn: {
105700 VdbeCursor *pCur = p->apCsr[pOp->p1];
105702 - assert( pCur->eCurType==CURTYPE_VTAB );
105703 assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
105704 pDest = &aMem[pOp->p3];
105706 @@ -94485,11 +96343,13 @@ case OP_VColumn: {
105710 + assert( pCur->eCurType==CURTYPE_VTAB );
105711 pVtab = pCur->uc.pVCur->pVtab;
105712 pModule = pVtab->pModule;
105713 assert( pModule->xColumn );
105717 assert( pOp->p5==OPFLAG_NOCHNG || pOp->p5==0 );
105718 if( pOp->p5 & OPFLAG_NOCHNG ){
105720 @@ -94508,9 +96368,6 @@ case OP_VColumn: {
105721 REGISTER_TRACE(pOp->p3, pDest);
105724 - if( sqlite3VdbeMemTooBig(pDest) ){
105725 - goto too_big;
105726 - }
105730 @@ -94777,6 +96634,7 @@ case OP_Function: { /* group */
105731 if( pCtx->pOut != pOut ){
105732 pCtx->pVdbe = p;
105733 pCtx->pOut = pOut;
105734 + pCtx->enc = encoding;
105735 for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
105737 assert( pCtx->pVdbe==p );
105738 @@ -94803,17 +96661,98 @@ case OP_Function: { /* group */
105742 - /* Copy the result of the function into register P3 */
105743 - if( pOut->flags & (MEM_Str|MEM_Blob) ){
105744 - sqlite3VdbeChangeEncoding(pOut, encoding);
105745 - if( sqlite3VdbeMemTooBig(pOut) ) goto too_big;
105746 - }
105747 + assert( (pOut->flags&MEM_Str)==0
105748 + || pOut->enc==encoding
105749 + || db->mallocFailed );
105752 REGISTER_TRACE(pOp->p3, pOut);
105763 + pIn1 = &aMem[pOp->p1];
105764 + pIn1->flags &= ~MEM_Subtype;
105777 + assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );
105778 + pIn1 = &aMem[pOp->p1];
105779 + assert( pIn1->flags & MEM_Blob );
105780 + assert( pIn1->n>0 );
105783 + if( db->flags&SQLITE_VdbeTrace ){
105785 + for(ii=pOp->p3; ii<pOp->p3+pOp->p4.i; ii++){
105788 + printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n));
105791 + h %= pIn1->n;
105792 + pIn1->z[h/8] |= 1<<(h&7);
105808 +** false positive - if the jump is taken when it should fall through.
105813 + assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );
105814 + pIn1 = &aMem[pOp->p1];
105815 + assert( (pIn1->flags & MEM_Blob)!=0 );
105816 + assert( pIn1->n >= 1 );
105819 + if( db->flags&SQLITE_VdbeTrace ){
105821 + for(ii=pOp->p3; ii<pOp->p3+pOp->p4.i; ii++){
105824 + printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n));
105827 + h %= pIn1->n;
105828 + if( (pIn1->z[h/8] & (1<<(h&7)))==0 ){
105830 + p->aCounter[SQLITE_STMTSTATUS_FILTER_HIT]++;
105833 + p->aCounter[SQLITE_STMTSTATUS_FILTER_MISS]++;
105842 @@ -94862,7 +96801,7 @@ case OP_Init: { /* jump */
105845 if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0
105846 - && !p->doingRerun
105847 + && p->minWriteFileFormat!=254 /* tag-20220401a */
105848 && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
105851 @@ -95091,7 +97030,7 @@ abort_due_to_error:
105854 (int)(pOp - aOp), p->zSql, p->zErrMsg);
105855 - sqlite3VdbeHalt(p);
105856 + if( p->eVdbeState==VDBE_RUN_STATE ) sqlite3VdbeHalt(p);
105857 if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db);
105858 if( rc==SQLITE_CORRUPT && db->autoCommit==0 ){
105859 db->flags |= SQLITE_CorruptRdOnly;
105860 @@ -95304,10 +97243,9 @@ SQLITE_API int sqlite3_blob_open(
105861 sqlite3_mutex_enter(db->mutex);
105863 pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob));
105864 - do {
105865 - memset(&sParse, 0, sizeof(Parse));
105867 + sqlite3ParseObjectInit(&sParse,db);
105869 - sParse.db = db;
105870 sqlite3DbFree(db, zErr);
105873 @@ -95484,7 +97422,9 @@ SQLITE_API int sqlite3_blob_open(
105877 - } while( (++nAttempt)<SQLITE_MAX_SCHEMA_RETRY && rc==SQLITE_SCHEMA );
105883 if( rc==SQLITE_OK && db->mallocFailed==0 ){
105884 @@ -95495,7 +97435,7 @@ blob_open_out:
105886 sqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr);
105887 sqlite3DbFree(db, zErr);
105888 - sqlite3ParserReset(&sParse);
105890 rc = sqlite3ApiExit(db, rc);
105891 sqlite3_mutex_leave(db->mutex);
105893 @@ -96630,7 +98570,8 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit(
105897 - assert( pCsr->pKeyInfo && pCsr->pBtx==0 );
105898 + assert( pCsr->pKeyInfo );
105899 + assert( !pCsr->isEphemeral );
105900 assert( pCsr->eCurType==CURTYPE_SORTER );
105901 szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*);
105903 @@ -99043,6 +100984,9 @@ static int memjrnlCreateFile(MemJournal *p){
105913 @@ -99073,22 +101017,20 @@ static int memjrnlWrite(
105914 ** the in-memory journal is being used by a connection using the
105915 ** atomic-write optimization. In this case the first 28 bytes of the
105917 - assert( iOfst==p->endpoint.iOffset || iOfst==0 );
105918 -#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
105919 - || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
105920 + assert( iOfst<=p->endpoint.iOffset );
105921 + if( iOfst>0 && iOfst!=p->endpoint.iOffset ){
105924 if( iOfst==0 && p->pFirst ){
105925 assert( p->nChunkSize>iAmt );
105926 memcpy((u8*)p->pFirst->zChunk, zBuf, iAmt);
105927 - }else
105928 -#else
105929 - assert( iOfst>0 || p->pFirst==0 );
105930 -#endif
105931 - {
105934 FileChunk *pChunk = p->endpoint.pChunk;
105935 int iChunkOffset = (int)(p->endpoint.iOffset%p->nChunkSize);
105936 int iSpace = MIN(nWrite, p->nChunkSize - iChunkOffset);
105941 FileChunk *pNew = sqlite3_malloc(fileChunkSize(p->nChunkSize));
105942 @@ -99103,10 +101045,11 @@ static int memjrnlWrite(
105943 assert( !p->pFirst );
105944 p->pFirst = pNew;
105946 - p->endpoint.pChunk = pNew;
105947 + pChunk = p->endpoint.pChunk = pNew;
105950 - memcpy((u8*)p->endpoint.pChunk->zChunk + iChunkOffset, zWrite, iSpace);
105952 + memcpy((u8*)pChunk->zChunk + iChunkOffset, zWrite, iSpace);
105954 nWrite -= iSpace;
105955 p->endpoint.iOffset += iSpace;
105956 @@ -99130,7 +101073,7 @@ static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){
105957 p->pFirst = 0;
105959 i64 iOff = p->nChunkSize;
105960 - for(pIter=p->pFirst; ALWAYS(pIter) && iOff<=size; pIter=pIter->pNext){
105961 + for(pIter=p->pFirst; ALWAYS(pIter) && iOff<size; pIter=pIter->pNext){
105962 iOff += p->nChunkSize;
105965 @@ -99649,51 +101592,24 @@ static void resolveAlias(
105966 sqlite3ExprDelete(db, pDup);
105971 if( pExpr->op==TK_COLLATE ){
105973 pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken);
105975 -
105976 - /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This
105977 - ** prevents ExprDelete() from deleting the Expr structure itself,
105978 - ** allowing it to be repopulated by the memcpy() on the following line.
105979 - ** The pExpr->u.zToken might point into memory that will be freed by the
105980 - ** sqlite3DbFree(db, pDup) on the last line of this block, so be sure to
105981 - ** make a copy of the token before doing the sqlite3DbFree().
105982 - */
105983 - ExprSetProperty(pExpr, EP_Static);
105984 - sqlite3ExprDelete(db, pExpr);
105985 - memcpy(pExpr, pDup, sizeof(*pExpr));
105986 - if( !ExprHasProperty(pExpr, EP_IntValue) && pExpr->u.zToken!=0 ){
105987 - assert( (pExpr->flags & (EP_Reduced|EP_TokenOnly))==0 );
105988 - pExpr->u.zToken = sqlite3DbStrDup(db, pExpr->u.zToken);
105989 - pExpr->flags |= EP_MemToken;
105990 - }
105995 if( ALWAYS(pExpr->y.pWin!=0) ){
105996 pExpr->y.pWin->pOwner = pExpr;
105999 - sqlite3DbFree(db, pDup);
106000 - }
106001 -}
106002 -
106003 -
106004 -/*
106005 -** Return TRUE if the name zCol occurs anywhere in the USING clause.
106006 -**
106007 -** Return FALSE if the USING clause is NULL or if it does not contain
106008 -** zCol.
106009 -*/
106010 -static int nameInUsingClause(IdList *pUsing, const char *zCol){
106011 - if( pUsing ){
106012 - int k;
106013 - for(k=0; k<pUsing->nId; k++){
106014 - if( sqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ) return 1;
106015 - }
106020 - return 0;
106024 @@ -99711,7 +101627,7 @@ SQLITE_PRIVATE int sqlite3MatchEName(
106028 - if( pItem->eEName!=ENAME_TAB ) return 0;
106029 + if( pItem->fg.eEName!=ENAME_TAB ) return 0;
106030 zSpan = pItem->zEName;
106033 @@ -99772,6 +101688,29 @@ SQLITE_PRIVATE Bitmask sqlite3ExprColUsed(Expr *pExpr){
106049 + Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLUMN, 0, 0);
106051 + pNew->iTable = pMatch->iCursor;
106052 + pNew->iColumn = iColumn;
106053 + pNew->y.pTab = pMatch->pTab;
106054 + assert( (pMatch->fg.jointype & (JT_LEFT|JT_LTORJ))!=0 );
106063 @@ -99817,11 +101756,13 @@ static int lookupName(
106066 int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */
106067 - Table *pTab = 0; /* Table hold the row */
106077 /* Initialize the node to no-match */
106078 @@ -99870,25 +101811,65 @@ static int lookupName(
106079 pTab = pItem->pTab;
106080 assert( pTab!=0 && pTab->zName!=0 );
106081 assert( pTab->nCol>0 || pParse->nErr );
106082 - if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){
106083 + assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem->pSelect) );
106084 + if( pItem->fg.isNestedFrom ){
106089 + ** This pItem -------------^
106092 + assert( pItem->pSelect!=0 );
106093 pEList = pItem->pSelect->pEList;
106095 + assert( pEList->nExpr==pTab->nCol );
106096 for(j=0; j<pEList->nExpr; j++){
106097 - if( sqlite3MatchEName(&pEList->a[j], zCol, zTab, zDb) ){
106098 - cnt++;
106099 - cntTab = 2;
106100 - pMatch = pItem;
106101 - pExpr->iColumn = j;
106102 - hit = 1;
106103 + if( !sqlite3MatchEName(&pEList->a[j], zCol, zTab, zDb) ){
106107 + if( pItem->fg.isUsing==0
106108 + || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0
106113 + sqlite3ExprListDelete(db, pFJMatch);
106116 + if( (pItem->fg.jointype & JT_RIGHT)==0 ){
106117 + /* An INNER or LEFT JOIN. Use the left-most table */
106120 + if( (pItem->fg.jointype & JT_LEFT)==0 ){
106121 + /* A RIGHT JOIN. Use the right-most table */
106123 + sqlite3ExprListDelete(db, pFJMatch);
106127 + extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn);
106133 + pExpr->iColumn = j;
106134 + pEList->a[j].fg.bUsed = 1;
106136 + if( pEList->a[j].fg.bUsingTerm ) break;
106140 - if( zDb && pTab->pSchema!=pSchema ){
106141 - continue;
106142 - }
106145 - const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
106148 + if( pTab->pSchema!=pSchema ) continue;
106151 + zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName;
106155 @@ -99903,18 +101884,37 @@ static int lookupName(
106156 if( pCol->hName==hCol
106157 && sqlite3StrICmp(pCol->zCnName, zCol)==0
106159 - /* If there has been exactly one prior match and this match
106160 - ** is for the right-hand table of a NATURAL JOIN or is in a
106161 - ** USING clause, then skip this match.
106162 - */
106163 - if( cnt==1 ){
106164 - if( pItem->fg.jointype & JT_NATURAL ) continue;
106165 - if( nameInUsingClause(pItem->pUsing, zCol) ) continue;
106167 + if( pItem->fg.isUsing==0
106168 + || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0
106173 + sqlite3ExprListDelete(db, pFJMatch);
106176 + if( (pItem->fg.jointype & JT_RIGHT)==0 ){
106177 + /* An INNER or LEFT JOIN. Use the left-most table */
106180 + if( (pItem->fg.jointype & JT_LEFT)==0 ){
106181 + /* A RIGHT JOIN. Use the right-most table */
106183 + sqlite3ExprListDelete(db, pFJMatch);
106187 + extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn);
106192 /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
106193 pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j;
106194 + if( pItem->fg.isNestedFrom ){
106200 @@ -99927,9 +101927,7 @@ static int lookupName(
106201 pExpr->iTable = pMatch->iCursor;
106203 pExpr->y.pTab = pMatch->pTab;
106204 - /* RIGHT JOIN not (yet) supported */
106205 - assert( (pMatch->fg.jointype & JT_RIGHT)==0 );
106206 - if( (pMatch->fg.jointype & JT_LEFT)!=0 ){
106207 + if( (pMatch->fg.jointype & (JT_LEFT|JT_LTORJ))!=0 ){
106210 pSchema = pExpr->y.pTab->pSchema;
106211 @@ -100016,6 +102014,7 @@ static int lookupName(
106212 pExpr->y.pTab = pTab;
106213 if( pParse->bReturning ){
106215 + pExpr->op2 = TK_COLUMN;
106216 pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable +
106219 @@ -100082,7 +102081,7 @@ static int lookupName(
106221 for(j=0; j<pEList->nExpr; j++){
106222 char *zAs = pEList->a[j].zEName;
106223 - if( pEList->a[j].eEName==ENAME_NAME
106224 + if( pEList->a[j].fg.eEName==ENAME_NAME
106228 @@ -100169,11 +102168,37 @@ static int lookupName(
106232 - ** cnt==0 means there was not match. cnt>1 means there were two or
106233 - ** more matches. Either way, we have an error.
106245 + if( pFJMatch->nExpr==cnt-1 ){
106249 + sqlite3ExprDelete(db, pExpr->pLeft);
106250 + pExpr->pLeft = 0;
106251 + sqlite3ExprDelete(db, pExpr->pRight);
106252 + pExpr->pRight = 0;
106254 + extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn);
106255 + pExpr->op = TK_FUNCTION;
106256 + pExpr->u.zToken = "coalesce";
106257 + pExpr->x.pList = pFJMatch;
106261 + sqlite3ExprListDelete(db, pFJMatch);
106268 @@ -100182,9 +102207,20 @@ static int lookupName(
106272 + sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr);
106273 pParse->checkSchema = 1;
106274 pTopNC->nNcErr++;
106280 + sqlite3ExprDelete(db, pExpr->pLeft);
106281 + pExpr->pLeft = 0;
106282 + sqlite3ExprDelete(db, pExpr->pRight);
106283 + pExpr->pRight = 0;
106289 @@ -100204,16 +102240,7 @@ static int lookupName(
106290 pMatch->colUsed |= sqlite3ExprColUsed(pExpr);
106293 - /* Clean up and return
106294 - */
106295 - if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
106296 - sqlite3ExprDelete(db, pExpr->pLeft);
106297 - pExpr->pLeft = 0;
106298 - sqlite3ExprDelete(db, pExpr->pRight);
106299 - pExpr->pRight = 0;
106300 - }
106301 pExpr->op = eNewExprOp;
106302 - ExprSetProperty(pExpr, EP_Leaf);
106306 @@ -100290,7 +102317,8 @@ static void notValidImpl(
106310 - Expr *pExpr /* Invalidate this expression on error */
106315 if( pNC->ncFlags & NC_IdxExpr ) zIn = "index expressions";
106316 @@ -100302,10 +102330,11 @@ static void notValidImpl(
106319 if( pExpr ) pExpr->op = TK_NULL;
106320 + sqlite3RecordErrorOffsetOfExpr(pParse->db, pError);
106322 -#define sqlite3ResolveNotValid(P,N,M,X,E) \
106325 - if( ((N)->ncFlags & (X))!=0 ) notValidImpl(P,N,M,E);
106326 + if( ((N)->ncFlags & (X))!=0 ) notValidImpl(P,N,M,E,R);
106330 @@ -100396,7 +102425,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106332 sqlite3WalkExpr(pWalker, pExpr->pLeft);
106333 if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){
106334 - testcase( ExprHasProperty(pExpr, EP_FromJoin) );
106337 if( pExpr->op==TK_NOTNULL ){
106338 pExpr->u.zToken = "true";
106339 @@ -100440,7 +102469,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106340 testcase( pNC->ncFlags & NC_IdxExpr );
106341 testcase( pNC->ncFlags & NC_GenCol );
106343 - NC_IdxExpr|NC_GenCol, 0);
106345 pRight = pExpr->pRight;
106346 if( pRight->op==TK_ID ){
106348 @@ -100471,7 +102500,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106352 - int nId; /* Number of characters in function name */
106355 u8 enc = ENC(pParse->db); /* The database encoding */
106356 @@ -100481,7 +102509,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106359 zId = pExpr->u.zToken;
106360 - nId = sqlite3Strlen30(zId);
106361 pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0);
106363 pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0);
106364 @@ -100498,8 +102525,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106365 pExpr->iTable = exprProbability(pList->a[1].pExpr);
106366 if( pExpr->iTable<0 ){
106368 - "second argument to likelihood() must be a "
106369 - "constant between 0.0 and 1.0");
106372 pNC->nNcErr++;
106375 @@ -100520,8 +102547,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106376 int auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0);
106379 - sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
106380 - pDef->zName);
106383 pNC->nNcErr++;
106385 pExpr->op = TK_NULL;
106386 @@ -100544,7 +102571,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106389 sqlite3ResolveNotValid(pParse, pNC, "non-deterministic functions",
106390 - NC_IdxExpr|NC_PartIdx|NC_GenCol, 0);
106394 pExpr->op2 = pNC->ncFlags & NC_SelfRef;
106395 @@ -100557,7 +102584,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106396 /* Internal-use-only functions are disallowed unless the
106398 ** the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control has be
106399 - ** used to activate internal functionsn for testing purposes */
106404 @@ -100576,7 +102603,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106406 if( pDef && pDef->xValue==0 && pWin ){
106408 - "%.*s() may not be used as a window function", nId, zId
106411 pNC->nNcErr++;
106413 @@ -100590,13 +102617,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106417 - sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()",zType,nId,zId);
106419 pNC->nNcErr++;
106423 if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){
106424 - sqlite3ErrorMsg(pParse,"misuse of aggregate function %.*s()",nId,zId);
106426 pNC->nNcErr++;
106429 @@ -100606,18 +102633,18 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106430 && pParse->explain==0
106433 - sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId);
106435 pNC->nNcErr++;
106437 - sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()",
106438 - nId, zId);
106441 pNC->nNcErr++;
106446 - "FILTER may not be used with non-aggregate %.*s()",
106447 - nId, zId
106448 + "FILTER may not be used with non-aggregate %#T()",
106451 pNC->nNcErr++;
106453 @@ -100702,7 +102729,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106454 testcase( pNC->ncFlags & NC_IdxExpr );
106455 testcase( pNC->ncFlags & NC_GenCol );
106456 if( pNC->ncFlags & NC_SelfRef ){
106457 - notValidImpl(pParse, pNC, "subqueries", pExpr);
106460 sqlite3WalkSelect(pWalker, pExpr->x.pSelect);
106462 @@ -100720,7 +102747,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106463 testcase( pNC->ncFlags & NC_IdxExpr );
106464 testcase( pNC->ncFlags & NC_GenCol );
106466 - NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol, pExpr);
106471 @@ -100772,11 +102799,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
106472 testcase( pExpr->op==TK_ISNOT );
106473 testcase( pExpr->op==TK_BETWEEN );
106475 + sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr);
106480 - return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue;
106481 + assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 );
106482 + return pParse->nErr ? WRC_Abort : WRC_Continue;
106486 @@ -100805,7 +102834,7 @@ static int resolveAsName(
106488 zCol = pE->u.zToken;
106489 for(i=0; i<pEList->nExpr; i++){
106490 - if( pEList->a[i].eEName==ENAME_NAME
106491 + if( pEList->a[i].fg.eEName==ENAME_NAME
106492 && sqlite3_stricmp(pEList->a[i].zEName, zCol)==0
106495 @@ -100884,11 +102913,13 @@ static void resolveOutOfRangeError(
106498 int i, /* The index (1-based) of the term out of range */
106499 - int mx /* Largest permissible value of i */
106504 "%r %s BY term out of range - should be "
106506 + sqlite3RecordErrorOffsetOfExpr(pParse->db, pError);
106510 @@ -100924,7 +102955,7 @@ static int resolveCompoundOrderBy(
106513 for(i=0; i<pOrderBy->nExpr; i++){
106514 - pOrderBy->a[i].done = 0;
106515 + pOrderBy->a[i].fg.done = 0;
106517 pSelect->pNext = 0;
106518 while( pSelect->pPrior ){
106519 @@ -100939,12 +102970,12 @@ static int resolveCompoundOrderBy(
106520 for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
106521 int iCol = -1;
106523 - if( pItem->done ) continue;
106524 + if( pItem->fg.done ) continue;
106525 pE = sqlite3ExprSkipCollateAndLikely(pItem->pExpr);
106528 if( iCol<=0 || iCol>pEList->nExpr ){
106529 - resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr);
106530 + resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr, pE);
106534 @@ -100992,7 +103023,7 @@ static int resolveCompoundOrderBy(
106535 sqlite3ExprDelete(db, pE);
106536 pItem->u.x.iOrderByCol = (u16)iCol;
106538 - pItem->done = 1;
106539 + pItem->fg.done = 1;
106543 @@ -101000,7 +103031,7 @@ static int resolveCompoundOrderBy(
106544 pSelect = pSelect->pNext;
106546 for(i=0; i<pOrderBy->nExpr; i++){
106547 - if( pOrderBy->a[i].done==0 ){
106548 + if( pOrderBy->a[i].fg.done==0 ){
106552 @@ -101040,7 +103071,7 @@ SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(
106553 for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
106554 if( pItem->u.x.iOrderByCol ){
106555 if( pItem->u.x.iOrderByCol>pEList->nExpr ){
106556 - resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr);
106557 + resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr, 0);
106560 resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,0);
106561 @@ -101132,7 +103163,7 @@ static int resolveOrderGroupBy(
106563 ** order-by term to a copy of the result-set expression */
106565 - resolveOutOfRangeError(pParse, zType, i+1, nResult);
106569 pItem->u.x.iOrderByCol = (u16)iCol;
106570 @@ -101190,7 +103221,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
106572 if( (p->selFlags & SF_Expanded)==0 ){
106574 - return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune;
106575 + return pParse->nErr ? WRC_Abort : WRC_Prune;
106578 isCompound = p->pPrior!=0;
106579 @@ -101238,7 +103269,8 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
106580 if( pItem->zName ) pParse->zAuthContext = pItem->zName;
106581 sqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC);
106582 pParse->zAuthContext = zSavedContext;
106583 - if( pParse->nErr || db->mallocFailed ) return WRC_Abort;
106584 + if( pParse->nErr ) return WRC_Abort;
106585 + assert( db->mallocFailed==0 );
106588 ** expressions in the sub-select were resolved, the sub-select
106589 @@ -101289,8 +103321,8 @@ static int resolveSelectStep(Walker *pWalker, Select *p){
106590 sNC.uNC.pEList = p->pEList;
106592 if( p->pHaving ){
106593 - if( !pGroupBy ){
106594 - sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING");
106595 + if( (p->selFlags & SF_Aggregate)==0 ){
106596 + sqlite3ErrorMsg(pParse, "HAVING clause on a non-aggregate query");
106599 if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort;
106600 @@ -102384,9 +104416,8 @@ static void heightOfSelect(const Select *pSelect, int *pnHeight){
106604 - int nHeight = 0;
106605 - heightOfExpr(p->pLeft, &nHeight);
106606 - heightOfExpr(p->pRight, &nHeight);
106607 + int nHeight = p->pLeft ? p->pLeft->nHeight : 0;
106608 + if( p->pRight && p->pRight->nHeight>nHeight ) nHeight = p->pRight->nHeight;
106610 heightOfSelect(p->x.pSelect, &nHeight);
106611 }else if( p->x.pList ){
106612 @@ -102685,6 +104716,8 @@ SQLITE_PRIVATE Expr *sqlite3ExprFunction(
106613 sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */
106617 + pNew->w.iOfst = (int)(pToken->z - pParse->zTail);
106619 && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG]
106620 && !pParse->nested
106621 @@ -102728,7 +104761,7 @@ SQLITE_PRIVATE void sqlite3ExprFunctionUsable(
106625 - sqlite3ErrorMsg(pParse, "unsafe use of %s()", pDef->zName);
106630 @@ -102784,6 +104817,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr…
106631 if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
106633 db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
106634 + sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr);
106638 @@ -102811,6 +104845,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr…
106639 pExpr->iColumn = x;
106640 if( x>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
106642 + sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr);
106646 @@ -102862,6 +104897,18 @@ SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){
106647 if( p ) sqlite3ExprDeleteNN(db, p);
106653 +SQLITE_PRIVATE void sqlite3ClearOnOrUsing(sqlite3 *db, OnOrUsing *p){
106656 + }else if( p->pOn ){
106657 + sqlite3ExprDeleteNN(db, p->pOn);
106658 + }else if( p->pUsing ){
106659 + sqlite3IdListDelete(db, p->pUsing);
106665 @@ -102948,7 +104995,7 @@ static int dupedExprStructSize(const Expr *p, int flags){
106669 - assert( !ExprHasProperty(p, EP_FromJoin) );
106673 if( p->pLeft || p->x.pList ){
106674 @@ -103128,6 +105175,7 @@ SQLITE_PRIVATE With *sqlite3WithDup(sqlite3 *db, With *p){
106675 pRet->a[i].pSelect = sqlite3SelectDup(db, p->a[i].pSelect, 0);
106676 pRet->a[i].pCols = sqlite3ExprListDup(db, p->a[i].pCols, 0);
106677 pRet->a[i].zName = sqlite3DbStrDup(db, p->a[i].zName);
106678 + pRet->a[i].eM10d = p->a[i].eM10d;
106682 @@ -103228,11 +105276,8 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, const ExprList …
106685 pItem->zEName = sqlite3DbStrDup(db, pOldItem->zEName);
106686 - pItem->sortFlags = pOldItem->sortFlags;
106687 - pItem->eEName = pOldItem->eEName;
106688 - pItem->done = 0;
106689 - pItem->bNulls = pOldItem->bNulls;
106690 - pItem->bSorterRef = pOldItem->bSorterRef;
106691 + pItem->fg = pOldItem->fg;
106692 + pItem->fg.done = 0;
106693 pItem->u = pOldItem->u;
106696 @@ -103284,8 +105329,12 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, const SrcList *p,…
106697 pTab->nTabRef++;
106699 pNewItem->pSelect = sqlite3SelectDup(db, pOldItem->pSelect, flags);
106700 - pNewItem->pOn = sqlite3ExprDup(db, pOldItem->pOn, flags);
106701 - pNewItem->pUsing = sqlite3IdListDup(db, pOldItem->pUsing);
106702 + if( pOldItem->fg.isUsing ){
106703 + assert( pNewItem->fg.isUsing );
106704 + pNewItem->u3.pUsing = sqlite3IdListDup(db, pOldItem->u3.pUsing);
106706 + pNewItem->u3.pOn = sqlite3ExprDup(db, pOldItem->u3.pOn, flags);
106708 pNewItem->colUsed = pOldItem->colUsed;
106711 @@ -103295,22 +105344,16 @@ SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, const IdList *p){
106713 assert( db!=0 );
106715 - pNew = sqlite3DbMallocRawNN(db, sizeof(*pNew) );
106716 + assert( p->eU4!=EU4_EXPR );
106717 + pNew = sqlite3DbMallocRawNN(db, sizeof(*pNew)+(p->nId-1)*sizeof(p->a[0]) );
106719 pNew->nId = p->nId;
106720 - pNew->a = sqlite3DbMallocRawNN(db, p->nId*sizeof(p->a[0]) );
106721 - if( pNew->a==0 ){
106722 - sqlite3DbFreeNN(db, pNew);
106723 - return 0;
106724 - }
106725 - /* Note that because the size of the allocation for p->a[] is not
106726 - ** necessarily a power of two, sqlite3IdListAppend() may not be called
106727 - ** on the duplicate created by this function. */
106728 + pNew->eU4 = p->eU4;
106729 for(i=0; i<p->nId; i++){
106730 struct IdList_item *pNewItem = &pNew->a[i];
106731 - struct IdList_item *pOldItem = &p->a[i];
106732 + const struct IdList_item *pOldItem = &p->a[i];
106733 pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
106734 - pNewItem->idx = pOldItem->idx;
106735 + pNewItem->u4 = pOldItem->u4;
106739 @@ -103534,16 +105577,16 @@ SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList *p, int iSortO…
106742 pItem = &p->a[p->nExpr-1];
106743 - assert( pItem->bNulls==0 );
106744 + assert( pItem->fg.bNulls==0 );
106748 - pItem->sortFlags = (u8)iSortOrder;
106749 + pItem->fg.sortFlags = (u8)iSortOrder;
106752 - pItem->bNulls = 1;
106753 + pItem->fg.bNulls = 1;
106755 - pItem->sortFlags |= KEYINFO_ORDER_BIGNULL;
106756 + pItem->fg.sortFlags |= KEYINFO_ORDER_BIGNULL;
106760 @@ -103569,7 +105612,7 @@ SQLITE_PRIVATE void sqlite3ExprListSetName(
106761 assert( pList->nExpr>0 );
106762 pItem = &pList->a[pList->nExpr-1];
106763 assert( pItem->zEName==0 );
106764 - assert( pItem->eEName==ENAME_NAME );
106765 + assert( pItem->fg.eEName==ENAME_NAME );
106766 pItem->zEName = sqlite3DbStrNDup(pParse->db, pName->z, pName->n);
106768 /* If dequote==0, then pName->z does not point to part of a DDL
106769 @@ -103604,7 +105647,7 @@ SQLITE_PRIVATE void sqlite3ExprListSetSpan(
106770 assert( pList->nExpr>0 );
106771 if( pItem->zEName==0 ){
106772 pItem->zEName = sqlite3DbSpanDup(db, zStart, zEnd);
106773 - pItem->eEName = ENAME_SPAN;
106774 + pItem->fg.eEName = ENAME_SPAN;
106778 @@ -103776,9 +105819,9 @@ SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){
106781 /* If pWalker->eCode is 2 then any term of the expression that comes from
106782 - ** the ON or USING clauses of a left join disqualifies the expression
106785 - if( pWalker->eCode==2 && ExprHasProperty(pExpr, EP_FromJoin) ){
106786 + if( pWalker->eCode==2 && ExprHasProperty(pExpr, EP_OuterON) ){
106787 pWalker->eCode = 0;
106790 @@ -103897,6 +105940,42 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
106802 +** (1) pExpr cannot refer to any table other than pSrc->iCursor.
106804 +** (2) pExpr cannot use subqueries or non-deterministic functions.
106818 + if( pSrc->fg.jointype & JT_LTORJ ){
106821 + if( pSrc->fg.jointype & JT_LEFT ){
106823 + if( pExpr->w.iJoin!=pSrc->iCursor ) return 0; /* rule (4b) */
106827 + return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */
106833 @@ -104224,7 +106303,7 @@ static int sqlite3InRhsIsConstant(Expr *pIn){
106836 ** A cursor is opened on the b-tree object that is the RHS of the IN operator
106837 -** and pX->iTable is set to the index of that cursor.
106840 ** The returned value of this function indicates the b-tree type, as follows:
106842 @@ -104244,7 +106323,10 @@ static int sqlite3InRhsIsConstant(Expr *pIn){
106845 ** pX->iTable made to point to the ephemeral table instead of an
106846 -** existing table.
106849 +** will be set on pX and the pX->y.sub fields will be set to show where
106854 @@ -104305,12 +106387,13 @@ SQLITE_PRIVATE int sqlite3FindInIndex(
106858 - int iTab = pParse->nTab++; /* Cursor of the RHS table */
106863 assert( pX->op==TK_IN );
106865 + iTab = pParse->nTab++;
106869 @@ -104418,8 +106501,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex(
106873 - assert( pReq!=0 || pRhs->iColumn==XN_ROWID
106874 - || pParse->nErr || db->mallocFailed );
106875 + assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr );
106877 if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
106878 assert( pIdx->azColl[j] );
106879 @@ -104477,6 +106559,8 @@ SQLITE_PRIVATE int sqlite3FindInIndex(
106881 && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2)
106883 + pParse->nTab--; /* Back out the allocation of the unused cursor */
106884 + iTab = -1; /* Cursor is not allocated */
106888 @@ -104643,6 +106727,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
106890 sqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn,
106891 pExpr->y.sub.iAddr);
106892 + assert( iTab!=pExpr->iTable );
106893 sqlite3VdbeAddOp2(v, OP_OpenDup, iTab, pExpr->iTable);
106896 @@ -104654,8 +106739,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
106898 pExpr->y.sub.regReturn = ++pParse->nMem;
106899 pExpr->y.sub.iAddr =
106900 - sqlite3VdbeAddOp2(v, OP_Integer, 0, pExpr->y.sub.regReturn) + 1;
106901 - VdbeComment((v, "return address"));
106902 + sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pExpr->y.sub.regReturn) + 1;
106906 @@ -104757,6 +106841,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
106910 + sqlite3VdbeChangeToNoop(v, addrOnce-1);
106914 @@ -104777,8 +106862,11 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN(
106918 - sqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn);
106919 - sqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, sqlite3VdbeCurrentAddr(v)-1);
106920 + assert( sqlite3VdbeGetOp(v,pExpr->y.sub.iAddr-1)->opcode==OP_BeginSubrtn
106921 + || pParse->nErr );
106922 + sqlite3VdbeAddOp3(v, OP_Return, pExpr->y.sub.regReturn,
106923 + pExpr->y.sub.iAddr, 1);
106928 @@ -104832,9 +106920,7 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
106930 pExpr->y.sub.regReturn = ++pParse->nMem;
106931 pExpr->y.sub.iAddr =
106932 - sqlite3VdbeAddOp2(v, OP_Integer, 0, pExpr->y.sub.regReturn) + 1;
106933 - VdbeComment((v, "return address"));
106934 -
106935 + sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pExpr->y.sub.regReturn) + 1;
106939 @@ -104895,10 +106981,8 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
106941 pSel->iLimit = 0;
106943 - if( pParse->nErr ){
106944 - pExpr->op2 = pExpr->op;
106945 - pExpr->op = TK_ERROR;
106946 - }
106947 + pExpr->op2 = pExpr->op;
106948 + pExpr->op = TK_ERROR;
106951 pExpr->iTable = rReg = dest.iSDParm;
106952 @@ -104909,8 +106993,11 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
106956 - sqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn);
106957 - sqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, sqlite3VdbeCurrentAddr(v)-1);
106958 + assert( sqlite3VdbeGetOp(v,pExpr->y.sub.iAddr-1)->opcode==OP_BeginSubrtn
106959 + || pParse->nErr );
106960 + sqlite3VdbeAddOp3(v, OP_Return, pExpr->y.sub.regReturn,
106961 + pExpr->y.sub.iAddr, 1);
106966 @@ -105115,10 +107202,9 @@ static void sqlite3ExprCodeIN(
106970 - if( pParse->nErr ) goto sqlite3ExprCodeIN_finished;
106972 Expr *p = sqlite3VectorFieldSubexpr(pExpr->pLeft, i);
106973 - if( pParse->db->mallocFailed ) goto sqlite3ExprCodeIN_oom_error;
106974 + if( pParse->nErr ) goto sqlite3ExprCodeIN_oom_error;
106978 @@ -105256,11 +107342,12 @@ static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iM…
106982 - sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z);
106983 + sqlite3ErrorMsg(pParse, "oversized integer: %s%#T", negFlag?"-":"",pExpr);
106987 - sqlite3ErrorMsg(pParse, "hex literal too big: %s%s", negFlag?"-":"",z);
106989 + negFlag?"-":"",pExpr);
106993 @@ -105344,6 +107431,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(
106995 if( iCol<0 || iCol==pTab->iPKey ){
106997 + VdbeComment((v, "%s.rowid", pTab->zName));
107001 @@ -105514,7 +107602,17 @@ static int exprCodeInlineFunction(
107005 -
107008 + Expr *pArg = pFarg->a[0].pExpr;
107009 + if( pArg->op==TK_COLUMN && pArg->iTable>=0 ){
107010 + sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target);
107018 /* The UNLIKELY() function is a no-op. The result is the value
107020 @@ -105936,7 +108034,7 @@ expr_code_doover:
107021 || NEVER(pExpr->iAgg>=pInfo->nFunc)
107024 - sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken);
107027 return pInfo->aFunc[pExpr->iAgg].iMem;
107029 @@ -105977,7 +108075,7 @@ expr_code_doover:
107032 if( pDef==0 || pDef->xFinalize!=0 ){
107033 - sqlite3ErrorMsg(pParse, "unknown function: %s()", zId);
107037 if( pDef->funcFlags & SQLITE_FUNC_INLINE ){
107038 @@ -106053,20 +108151,8 @@ expr_code_doover:
107039 if( !pColl ) pColl = db->pDfltColl;
107042 -#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
107043 - if( (pDef->funcFlags & SQLITE_FUNC_OFFSET)!=0 && ALWAYS(pFarg!=0) ){
107044 - Expr *pArg = pFarg->a[0].pExpr;
107045 - if( pArg->op==TK_COLUMN ){
107046 - sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target);
107047 - }else{
107048 - sqlite3VdbeAddOp2(v, OP_Null, 0, target);
107049 - }
107050 - }else
107051 -#endif
107052 - {
107053 - sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg,
107054 - pDef, pExpr->op2);
107055 - }
107057 + pDef, pExpr->op2);
107061 @@ -106096,16 +108182,18 @@ expr_code_doover:
107065 - if( pExpr->pLeft->iTable==0 ){
107066 - pExpr->pLeft->iTable = sqlite3CodeSubselect(pParse, pExpr->pLeft);
107067 + Expr *pLeft = pExpr->pLeft;
107068 + if( pLeft->iTable==0 || pParse->withinRJSubrtn > pLeft->op2 ){
107069 + pLeft->iTable = sqlite3CodeSubselect(pParse, pLeft);
107070 + pLeft->op2 = pParse->withinRJSubrtn;
107072 - assert( pExpr->pLeft->op==TK_SELECT || pExpr->pLeft->op==TK_ERROR );
107073 - n = sqlite3ExprVectorSize(pExpr->pLeft);
107074 + assert( pLeft->op==TK_SELECT || pLeft->op==TK_ERROR );
107076 if( pExpr->iTable!=n ){
107078 pExpr->iTable, n);
107080 - return pExpr->pLeft->iTable + pExpr->iColumn;
107081 + return pLeft->iTable + pExpr->iColumn;
107085 @@ -106136,8 +108224,24 @@ expr_code_doover:
107091 + && ALWAYS(pExpr->pLeft)
107092 + && pExpr->pLeft->op==TK_FUNCTION
107094 + inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
107102 + pExpr = pExpr->pLeft;
107103 + goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
107107 - case TK_COLLATE:
107109 pExpr = pExpr->pLeft;
107110 goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. OSSFuzz. */
107111 @@ -106378,7 +108482,9 @@ SQLITE_PRIVATE int sqlite3ExprCodeRunJustOnce(
107114 for(pItem=p->a, i=p->nExpr; i>0; pItem++, i--){
107115 - if( pItem->reusable && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 ){
107116 + if( pItem->fg.reusable
107117 + && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0
107119 return pItem->u.iConstExprReg;
107122 @@ -106401,7 +108507,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeRunJustOnce(
107125 struct ExprList_item *pItem = &p->a[p->nExpr-1];
107126 - pItem->reusable = regDest<0;
107127 + pItem->fg.reusable = regDest<0;
107128 if( regDest<0 ) regDest = ++pParse->nMem;
107129 pItem->u.iConstExprReg = regDest;
107131 @@ -106535,7 +108641,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeExprList(
107132 for(pItem=pList->a, i=0; i<n; i++, pItem++){
107133 Expr *pExpr = pItem->pExpr;
107135 - if( pItem->bSorterRef ){
107136 + if( pItem->fg.bSorterRef ){
107137 i--;
107138 n--;
107140 @@ -106629,8 +108735,8 @@ static void exprCodeBetween(
107144 - ** have to reuse the EP_FromJoin bit. Bummer. */
107145 - pDel->flags |= EP_FromJoin;
107147 + pDel->flags |= EP_OuterON;
107151 @@ -107160,7 +109266,7 @@ SQLITE_PRIVATE int sqlite3ExprListCompare(const ExprList *pA, const ExprL…
107153 Expr *pExprA = pA->a[i].pExpr;
107154 Expr *pExprB = pB->a[i].pExpr;
107155 - if( pA->a[i].sortFlags!=pB->a[i].sortFlags ) return 1;
107156 + if( pA->a[i].fg.sortFlags!=pB->a[i].fg.sortFlags ) return 1;
107160 @@ -107315,7 +109421,7 @@ SQLITE_PRIVATE int sqlite3ExprImpliesExpr(
107162 testcase( pExpr->op==TK_AGG_COLUMN );
107163 testcase( pExpr->op==TK_AGG_FUNCTION );
107164 - if( ExprHasProperty(pExpr, EP_FromJoin) ) return WRC_Prune;
107166 switch( pExpr->op ){
107169 @@ -107412,8 +109518,8 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){
107173 -** Terms of p that are marked with EP_FromJoin (and hence that come from
107174 -** the ON or USING clauses of LEFT JOINS) are excluded from the analysis.
107180 @@ -108293,7 +110399,9 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pCo…
107183 db = pParse->db;
107184 - if( pParse->nErr || db->mallocFailed ) return;
107185 + assert( db->pParse==pParse );
107186 + if( pParse->nErr ) return;
107187 + assert( db->mallocFailed==0 );
107188 pNew = pParse->pNewTable;
107191 @@ -108419,7 +110527,7 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pCo…
107195 - " FROM pragma_quick_check(\"%w\",\"%w\")"
107200 @@ -108598,7 +110706,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn(
107201 if( 0==sqlite3StrICmp(pTab->aCol[iCol].zCnName, zOld) ) break;
107203 if( iCol==pTab->nCol ){
107204 - sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zOld);
107209 @@ -108704,7 +110812,9 @@ struct RenameCtx {
107213 - if( pParse->nErr==0 && pParse->db->mallocFailed==0 ){
107214 + assert( pParse==pParse->db->pParse );
107215 + assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 );
107216 + if( pParse->nErr==0 ){
107219 for(p=pParse->pRename; p; p=p->pNext){
107220 @@ -108823,11 +110933,10 @@ static void unmapColumnIdlistNames(
107224 - if( pIdList ){
107225 - int ii;
107226 - for(ii=0; ii<pIdList->nId; ii++){
107227 - sqlite3RenameTokenRemap(pParse, 0, (const void*)pIdList->a[ii].zName);
107228 - }
107231 + for(ii=0; ii<pIdList->nId; ii++){
107232 + sqlite3RenameTokenRemap(pParse, 0, (const void*)pIdList->a[ii].zName);
107236 @@ -108846,7 +110955,7 @@ static int renameUnmapSelectCb(Walker *pWalker, Select *p){
107237 if( ALWAYS(p->pEList) ){
107238 ExprList *pList = p->pEList;
107239 for(i=0; i<pList->nExpr; i++){
107240 - if( pList->a[i].zEName && pList->a[i].eEName==ENAME_NAME ){
107241 + if( pList->a[i].zEName && pList->a[i].fg.eEName==ENAME_NAME ){
107242 sqlite3RenameTokenRemap(pParse, 0, (void*)pList->a[i].zEName);
107245 @@ -108855,8 +110964,11 @@ static int renameUnmapSelectCb(Walker *pWalker, Select *p){
107246 SrcList *pSrc = p->pSrc;
107247 for(i=0; i<pSrc->nSrc; i++){
107248 sqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName);
107249 - sqlite3WalkExpr(pWalker, pSrc->a[i].pOn);
107250 - unmapColumnIdlistNames(pParse, pSrc->a[i].pUsing);
107251 + if( pSrc->a[i].fg.isUsing==0 ){
107252 + sqlite3WalkExpr(pWalker, pSrc->a[i].u3.pOn);
107254 + unmapColumnIdlistNames(pParse, pSrc->a[i].u3.pUsing);
107259 @@ -108892,7 +111004,7 @@ SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse *pParse, ExprList *p…
107262 for(i=0; i<pEList->nExpr; i++){
107263 - if( ALWAYS(pEList->a[i].eEName==ENAME_NAME) ){
107264 + if( ALWAYS(pEList->a[i].fg.eEName==ENAME_NAME) ){
107265 sqlite3RenameTokenRemap(pParse, 0, (void*)pEList->a[i].zEName);
107268 @@ -109026,12 +111138,12 @@ static void renameColumnParseError(
107272 - zErr = sqlite3_mprintf("error in %s %s%s%s: %s",
107273 + zErr = sqlite3MPrintf(pParse->db, "error in %s %s%s%s: %s",
107275 pParse->zErrMsg
107277 sqlite3_result_error(pCtx, zErr, -1);
107278 - sqlite3_free(zErr);
107279 + sqlite3DbFree(pParse->db, zErr);
107283 @@ -109050,7 +111162,7 @@ static void renameColumnElistNames(
107285 for(i=0; i<pEList->nExpr; i++){
107286 const char *zName = pEList->a[i].zEName;
107287 - if( ALWAYS(pEList->a[i].eEName==ENAME_NAME)
107288 + if( ALWAYS(pEList->a[i].fg.eEName==ENAME_NAME)
107292 @@ -109095,24 +111207,22 @@ static int renameParseSql(
107296 - char *zErr = 0;
107298 + sqlite3ParseObjectInit(p, db);
107305 db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb);
107306 -
107307 - /* Parse the SQL statement passed as the first argument. If no error
107308 - ** occurs and the parse does not result in a new table, index or
107309 - ** trigger object, the database must be corrupt. */
107310 - memset(p, 0, sizeof(Parse));
107311 p->eParseMode = PARSE_MODE_RENAME;
107312 p->db = db;
107313 p->nQueryLoop = 1;
107314 - rc = zSql ? sqlite3RunParser(p, zSql, &zErr) : SQLITE_NOMEM;
107315 - assert( p->zErrMsg==0 );
107316 - assert( rc!=SQLITE_OK || zErr==0 );
107317 - p->zErrMsg = zErr;
107319 if( db->mallocFailed ) rc = SQLITE_NOMEM;
107321 - && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0
107322 + && NEVER(p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0)
107326 @@ -109282,27 +111392,33 @@ static int renameResolveTrigger(Parse *pParse){
107327 if( rc==SQLITE_OK && pStep->zTarget ){
107330 - int i;
107331 - for(i=0; i<pSrc->nSrc && rc==SQLITE_OK; i++){
107332 - SrcItem *p = &pSrc->a[i];
107333 - p->iCursor = pParse->nTab++;
107334 - if( p->pSelect ){
107335 - sqlite3SelectPrep(pParse, p->pSelect, 0);
107336 - sqlite3ExpandSubquery(pParse, p);
107337 - assert( i>0 );
107338 - assert( pStep->pFrom->a[i-1].pSelect );
107339 - sqlite3SelectPrep(pParse, pStep->pFrom->a[i-1].pSelect, 0);
107340 - }else{
107341 - p->pTab = sqlite3LocateTableItem(pParse, 0, p);
107342 - if( p->pTab==0 ){
107343 - rc = SQLITE_ERROR;
107344 - }else{
107345 - p->pTab->nTabRef++;
107346 - rc = sqlite3ViewGetColumnNames(pParse, p->pTab);
107348 + pParse, pStep->pExprList, pSrc, 0, 0, 0, 0, 0, 0
107351 + pStep->pExprList = 0;
107356 + rc = pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
107357 + assert( pStep->pExprList==0 || pStep->pExprList==pSel->pEList );
107358 + assert( pSrc==pSel->pSrc );
107359 + if( pStep->pExprList ) pSel->pEList = 0;
107360 + pSel->pSrc = 0;
107361 + sqlite3SelectDelete(db, pSel);
107363 + if( pStep->pFrom ){
107365 + for(i=0; i<pStep->pFrom->nSrc && rc==SQLITE_OK; i++){
107366 + SrcItem *p = &pStep->pFrom->a[i];
107367 + if( p->pSelect ){
107368 + sqlite3SelectPrep(pParse, p->pSelect, 0);
107372 - if( rc==SQLITE_OK && db->mallocFailed ){
107374 + if( db->mallocFailed ){
107378 @@ -109390,13 +111506,13 @@ static void renameParseCleanup(Parse *pParse){
107379 sqlite3DeleteTrigger(db, pParse->pNewTrigger);
107380 sqlite3DbFree(db, pParse->zErrMsg);
107381 renameTokenFree(db, pParse->pRename);
107382 - sqlite3ParserReset(pParse);
107389 -** sqlite_rename_column(zSql, iCol, bQuote, zNew, zTable, zOld)
107390 +** sqlite_rename_column(SQL,TYPE,OBJ,DB,TABLE,COL,NEWNAME,QUOTE,TEMP)
107394 @@ -109414,7 +111530,8 @@ static void renameParseCleanup(Parse *pParse){
107398 -** not reachable from ordinary SQL passed into sqlite3_prepare().
107404 @@ -109563,7 +111680,9 @@ static void renameColumnFunc(
107408 - if( sParse.zErrMsg ){
107409 + if( rc==SQLITE_ERROR && sqlite3WritableSchema(db) ){
107415 @@ -109751,6 +111870,15 @@ static void renameTableFunc(
107416 if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){
107417 renameTokenFind(&sParse, &sCtx, pStep->zTarget);
107419 + if( pStep->pFrom ){
107421 + for(i=0; i<pStep->pFrom->nSrc; i++){
107422 + SrcItem *pItem = &pStep->pFrom->a[i];
107423 + if( 0==sqlite3_stricmp(pItem->zName, zOld) ){
107424 + renameTokenFind(&sParse, &sCtx, pItem->zName);
107431 @@ -109762,7 +111890,9 @@ static void renameTableFunc(
107435 - if( sParse.zErrMsg ){
107436 + if( rc==SQLITE_ERROR && sqlite3WritableSchema(db) ){
107442 @@ -109787,10 +111917,10 @@ static int renameQuotefixExprCb(Walker *pWalker, Expr *pExpr){
107446 -/*
107447 -** The implementation of an SQL scalar function that rewrites DDL statements
107448 -** so that any string literals that use double-quotes are modified so that
107449 -** they use single quotes.
107450 +/* SQL function: sqlite_rename_quotefix(DB,SQL)
107453 +** double-quotes use single quotes instead.
107457 @@ -109809,6 +111939,10 @@ static int renameQuotefixExprCb(Walker *pWalker, Expr *pExpr){
107468 @@ -109883,7 +112017,11 @@ static void renameQuotefixFunc(
107469 renameTokenFree(db, sCtx.pList);
107472 - sqlite3_result_error_code(context, rc);
107473 + if( sqlite3WritableSchema(db) && rc==SQLITE_ERROR ){
107481 @@ -109895,7 +112033,8 @@ static void renameQuotefixFunc(
107482 sqlite3BtreeLeaveAll(db);
107485 -/*
107486 +/* Function: sqlite_rename_test(DB,SQL,TYPE,NAME,ISTEMP,WHEN,DQS)
107491 @@ -109910,11 +112049,13 @@ static void renameQuotefixFunc(
107495 -** Unless it finds an error, this function normally returns NULL. However, it
107496 -** returns integer value 1 if:
107499 -** * the SQL argument creates a trigger, and
107500 -** * the table that the trigger is attached to is in database zDb.
107509 @@ -109959,12 +112100,16 @@ static void renameTableTest(
107511 int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema);
107512 int i2 = sqlite3FindDbName(db, zDb);
107513 - if( i1==i2 ) sqlite3_result_int(context, 1);
107522 - if( rc!=SQLITE_OK && zWhen ){
107523 + if( rc!=SQLITE_OK && zWhen && !sqlite3WritableSchema(db) ){
107528 @@ -110080,7 +112225,7 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, …
107532 - sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zCol);
107537 @@ -110104,6 +112249,12 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc,…
107538 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
107540 zDb = db->aDb[iDb].zDbSName;
107543 + if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, zCol) ){
107550 @@ -111051,9 +113202,14 @@ static void statGet(
107554 - ** rows, then each estimate is computed as:
107557 ** I = (K+D-1)/D
107566 @@ -111064,6 +113220,7 @@ static void statGet(
107567 for(i=0; i<p->nKeyCol; i++){
107568 u64 nDistinct = p->current.anDLt[i] + 1;
107569 u64 iVal = (p->nRow + nDistinct - 1) / nDistinct;
107570 + if( iVal==2 && p->nRow*10 <= nDistinct*11 ) iVal = 1;
107572 assert( p->current.anEq[i] );
107574 @@ -111227,7 +113384,7 @@ static void analyzeOneTable(
107575 memcpy(pStat1->zName, "sqlite_stat1", 13);
107576 pStat1->nCol = 3;
107577 pStat1->iPKey = -1;
107578 - sqlite3VdbeAddOp4(pParse->pVdbe, OP_Noop, 0, 0, 0,(char*)pStat1,P4_DYNBLOB);
107579 + sqlite3VdbeAddOp4(pParse->pVdbe, OP_Noop, 0, 0, 0,(char*)pStat1,P4_DYNAMIC);
107583 @@ -112491,7 +114648,7 @@ static void codeAttach(
107587 - if( pAuthArg ){
107590 if( pAuthArg->op==TK_STRING ){
107592 @@ -112617,7 +114774,11 @@ static int fixSelectCb(Walker *p, Select *pSelect){
107593 pItem->fg.fromDDL = 1;
107596 - if( sqlite3WalkExpr(&pFix->w, pList->a[i].pOn) ) return WRC_Abort;
107597 + if( pList->a[i].fg.isUsing==0
107598 + && sqlite3WalkExpr(&pFix->w, pList->a[i].u3.pOn)
107604 if( pSelect->pWith ){
107605 @@ -113152,11 +115313,13 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
107607 assert( pParse->pToplevel==0 );
107608 db = pParse->db;
107609 + assert( db->pParse==pParse );
107610 if( pParse->nested ) return;
107611 - if( db->mallocFailed || pParse->nErr ){
107612 - if( pParse->rc==SQLITE_OK ) pParse->rc = SQLITE_ERROR;
107613 + if( pParse->nErr ){
107614 + if( db->mallocFailed ) pParse->rc = SQLITE_NOMEM;
107617 + assert( db->mallocFailed==0 );
107621 @@ -113179,9 +115342,8 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
107625 - if( pReturning->nRetCol==0 ){
107626 - assert( CORRUPT_DB );
107627 - }else{
107628 + if( pReturning->nRetCol ){
107631 sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur);
107633 @@ -113220,7 +115382,9 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
107635 assert( sqlite3VdbeGetOp(v, 0)->opcode==OP_Init );
107637 - for(iDb=0; iDb<db->nDb; iDb++){
107638 + assert( db->nDb>0 );
107642 if( DbMaskTest(pParse->cookieMask, iDb)==0 ) continue;
107644 @@ -113235,7 +115399,7 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
107645 if( db->init.busy==0 ) sqlite3VdbeChangeP5(v, 1);
107647 "usesStmtJournal=%d", pParse->mayAbort && pParse->isMultiWrite));
107648 - }
107649 + }while( ++iDb<db->nDb );
107651 for(i=0; i<pParse->nVtabLock; i++){
107652 char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]);
107653 @@ -113274,9 +115438,7 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
107655 if( pParse->bReturning ){
107656 Returning *pRet = pParse->u1.pReturning;
107657 - if( pRet->nRetCol==0 ){
107658 - assert( CORRUPT_DB );
107659 - }else{
107660 + if( pRet->nRetCol ){
107661 sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol);
107664 @@ -113288,7 +115450,9 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
107668 - if( v && pParse->nErr==0 && !db->mallocFailed ){
107669 + assert( v!=0 || pParse->nErr );
107670 + assert( db->mallocFailed==0 || pParse->nErr );
107671 + if( pParse->nErr==0 ){
107674 assert( pParse->pAinc==0 || pParse->nTab>0 );
107675 @@ -113315,7 +115479,6 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
107679 - char *zErrMsg = 0;
107680 sqlite3 *db = pParse->db;
107681 u32 savedDbFlags = db->mDbFlags;
107683 @@ -113337,9 +115500,8 @@ SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat…
107686 db->mDbFlags |= DBFLAG_PreferBuiltin;
107687 - sqlite3RunParser(pParse, zSql, &zErrMsg);
107689 db->mDbFlags = savedDbFlags;
107690 - sqlite3DbFree(db, zErrMsg);
107691 sqlite3DbFree(db, zSql);
107693 pParse->nested--;
107694 @@ -114299,7 +116461,8 @@ SQLITE_PRIVATE void sqlite3StartTable(
107695 pTable = sqlite3FindTable(db, zName, zDb);
107698 - sqlite3ErrorMsg(pParse, "table %T already exists", pName);
107702 assert( !db->init.busy || CORRUPT_DB );
107704 @@ -114895,7 +117058,7 @@ SQLITE_PRIVATE void sqlite3AddPrimaryKey(
107705 pTab->keyConf = (u8)onError;
107707 pTab->tabFlags |= autoInc*TF_Autoincrement;
107708 - if( pList ) pParse->iPkSortOrder = pList->a[0].sortFlags;
107709 + if( pList ) pParse->iPkSortOrder = pList->a[0].fg.sortFlags;
107713 @@ -115389,15 +117552,16 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
107715 sqlite3RenameTokenRemap(pParse, pList->a[0].pExpr, &pTab->iPKey);
107717 - pList->a[0].sortFlags = pParse->iPkSortOrder;
107718 + pList->a[0].fg.sortFlags = pParse->iPkSortOrder;
107719 assert( pParse->pNewTable==pTab );
107720 pTab->iPKey = -1;
107721 sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0,
107723 - if( db->mallocFailed || pParse->nErr ){
107724 + if( pParse->nErr ){
107725 pTab->tabFlags &= ~TF_WithoutRowid;
107728 + assert( db->mallocFailed==0 );
107730 assert( pPk->nKeyCol==1 );
107732 @@ -115828,6 +117992,11 @@ SQLITE_PRIVATE void sqlite3EndTable(
107737 + pParse->rc = SQLITE_ERROR;
107738 + pParse->nErr++;
107741 regYield = ++pParse->nMem;
107742 regRec = ++pParse->nMem;
107743 regRowid = ++pParse->nMem;
107744 @@ -116054,7 +118223,6 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable…
107748 - int n; /* Temporarily holds the number of cursors assigned */
107749 sqlite3 *db = pParse->db; /* Database connection for malloc errors */
107752 @@ -116112,8 +118280,9 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable…
107753 pSel = sqlite3SelectDup(db, pTable->u.view.pSelect, 0);
107755 u8 eParseMode = pParse->eParseMode;
107756 + int nTab = pParse->nTab;
107757 + int nSelect = pParse->nSelect;
107758 pParse->eParseMode = PARSE_MODE_NORMAL;
107759 - n = pParse->nTab;
107760 sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
107761 pTable->nCol = -1;
107763 @@ -116125,7 +118294,8 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable…
107767 - pParse->nTab = n;
107768 + pParse->nTab = nTab;
107769 + pParse->nSelect = nSelect;
107771 pTable->nCol = 0;
107773 @@ -116138,10 +118308,10 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTab…
107775 sqlite3ColumnsFromExprList(pParse, pTable->pCheck,
107776 &pTable->nCol, &pTable->aCol);
107777 - if( db->mallocFailed==0
107778 - && pParse->nErr==0
107779 + if( pParse->nErr==0
107780 && pTable->nCol==pSel->pEList->nExpr
107782 + assert( db->mallocFailed==0 );
107786 @@ -116760,7 +118930,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootP…
107787 tnum = pIndex->tnum;
107790 - assert( pKey!=0 || db->mallocFailed || pParse->nErr );
107791 + assert( pKey!=0 || pParse->nErr );
107794 iSorter = pParse->nTab++;
107795 @@ -116870,8 +119040,8 @@ SQLITE_PRIVATE int sqlite3HasExplicitNulls(Parse *pParse, ExprList *pList…
107798 for(i=0; i<pList->nExpr; i++){
107799 - if( pList->a[i].bNulls ){
107800 - u8 sf = pList->a[i].sortFlags;
107801 + if( pList->a[i].fg.bNulls ){
107802 + u8 sf = pList->a[i].fg.sortFlags;
107806 @@ -116924,9 +119094,11 @@ SQLITE_PRIVATE void sqlite3CreateIndex(
107810 - if( db->mallocFailed || pParse->nErr>0 ){
107811 + assert( db->pParse==pParse );
107812 + if( pParse->nErr ){
107815 + assert( db->mallocFailed==0 );
107819 @@ -116990,7 +119162,6 @@ SQLITE_PRIVATE void sqlite3CreateIndex(
107820 pDb = &db->aDb[iDb];
107823 - assert( pParse->nErr==0 );
107824 if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0
107825 && db->init.busy==0
107827 @@ -117223,7 +119394,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex(
107830 pIndex->azColl[i] = zColl;
107831 - requestedSortOrder = pListItem->sortFlags & sortOrderMask;
107832 + requestedSortOrder = pListItem->fg.sortFlags & sortOrderMask;
107833 pIndex->aSortOrder[i] = (u8)requestedSortOrder;
107836 @@ -117414,13 +119585,13 @@ SQLITE_PRIVATE void sqlite3CreateIndex(
107840 - "INSERT INTO %Q." LEGACY_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);",
107841 - db->aDb[iDb].zDbSName,
107842 - pIndex->zName,
107843 - pTab->zName,
107844 - iMem,
107845 - zStmt
107846 - );
107848 + db->aDb[iDb].zDbSName,
107849 + pIndex->zName,
107850 + pTab->zName,
107854 sqlite3DbFree(db, zStmt);
107857 @@ -117554,10 +119725,10 @@ SQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int…
107858 sqlite3 *db = pParse->db;
107861 - assert( pParse->nErr==0 ); /* Never called with prior errors */
107862 if( db->mallocFailed ){
107865 + assert( pParse->nErr==0 ); /* Never called with prior non-OOM errors */
107866 assert( pName->nSrc==1 );
107869 @@ -117666,18 +119837,17 @@ SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse *pParse, IdList *pList…
107871 pList = sqlite3DbMallocZero(db, sizeof(IdList) );
107875 + pNew = sqlite3DbRealloc(db, pList,
107876 + sizeof(IdList) + pList->nId*sizeof(pList->a));
107878 + sqlite3IdListDelete(db, pList);
107883 - pList->a = sqlite3ArrayAllocate(
107884 - db,
107885 - pList->a,
107886 - sizeof(pList->a[0]),
107887 - &pList->nId,
107888 - &i
107889 - );
107890 - if( i<0 ){
107891 - sqlite3IdListDelete(db, pList);
107892 - return 0;
107893 - }
107894 + i = pList->nId++;
107895 pList->a[i].zName = sqlite3NameFromToken(db, pToken);
107896 if( IN_RENAME_OBJECT && pList->a[i].zName ){
107897 sqlite3RenameTokenMap(pParse, (void*)pList->a[i].zName, pToken);
107898 @@ -117691,10 +119861,10 @@ SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse *pParse, IdList *pList…
107899 SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){
107902 + assert( pList->eU4!=EU4_EXPR ); /* EU4_EXPR mode is not currently used */
107903 for(i=0; i<pList->nId; i++){
107904 sqlite3DbFree(db, pList->a[i].zName);
107906 - sqlite3DbFree(db, pList->a);
107907 sqlite3DbFreeNN(db, pList);
107910 @@ -117704,7 +119874,7 @@ SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){
107914 - if( pList==0 ) return -1;
107916 for(i=0; i<pList->nId; i++){
107917 if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i;
107919 @@ -117907,8 +120077,11 @@ SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){
107920 if( pItem->fg.isTabFunc ) sqlite3ExprListDelete(db, pItem->u1.pFuncArg);
107921 sqlite3DeleteTable(db, pItem->pTab);
107922 if( pItem->pSelect ) sqlite3SelectDelete(db, pItem->pSelect);
107923 - if( pItem->pOn ) sqlite3ExprDelete(db, pItem->pOn);
107924 - if( pItem->pUsing ) sqlite3IdListDelete(db, pItem->pUsing);
107925 + if( pItem->fg.isUsing ){
107926 + sqlite3IdListDelete(db, pItem->u3.pUsing);
107927 + }else if( pItem->u3.pOn ){
107928 + sqlite3ExprDelete(db, pItem->u3.pOn);
107931 sqlite3DbFreeNN(db, pList);
107933 @@ -117936,14 +120109,13 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(
107935 Token *pAlias, /* The right-hand side of the AS subexpression */
107937 - Expr *pOn, /* The ON clause of a join */
107938 - IdList *pUsing /* The USING clause of a join */
107942 sqlite3 *db = pParse->db;
107943 - if( !p && (pOn || pUsing) ){
107944 + if( !p && pOnUsing!=0 && (pOnUsing->pOn || pOnUsing->pUsing) ){
107946 - (pOn ? "ON" : "USING")
107947 + (pOnUsing->pOn ? "ON" : "USING")
107951 @@ -117963,15 +120135,27 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(
107952 if( pAlias->n ){
107953 pItem->zAlias = sqlite3NameFromToken(db, pAlias);
107955 - pItem->pSelect = pSubquery;
107956 - pItem->pOn = pOn;
107957 - pItem->pUsing = pUsing;
107959 + pItem->pSelect = pSubquery;
107960 + if( pSubquery->selFlags & SF_NestedFrom ){
107961 + pItem->fg.isNestedFrom = 1;
107964 + assert( pOnUsing==0 || pOnUsing->pOn==0 || pOnUsing->pUsing==0 );
107965 + assert( pItem->fg.isUsing==0 );
107967 + pItem->u3.pOn = 0;
107968 + }else if( pOnUsing->pUsing ){
107969 + pItem->fg.isUsing = 1;
107970 + pItem->u3.pUsing = pOnUsing->pUsing;
107972 + pItem->u3.pOn = pOnUsing->pOn;
107976 - append_from_error:
107979 - sqlite3ExprDelete(db, pOn);
107980 - sqlite3IdListDelete(db, pUsing);
107981 + sqlite3ClearOnOrUsing(db, pOnUsing);
107982 sqlite3SelectDelete(db, pSubquery);
107985 @@ -118016,6 +120200,7 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendList(Parse *pParse, SrcList *…
107987 memcpy(&p1->a[1], p2->a, p2->nSrc*sizeof(SrcItem));
107988 sqlite3DbFree(pParse->db, p2);
107989 + p1->a[0].fg.jointype |= (JT_LTORJ & p1->a[1].fg.jointype);
107993 @@ -118052,14 +120237,34 @@ SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, E…
107995 ** in p->a[0] and p->a[1], respectively. The parser initially stores the
108000 +** * All tables to the left of the right-most RIGHT JOIN are tagged with
108005 -SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList *p){
108006 - if( p ){
108007 - int i;
108008 - for(i=p->nSrc-1; i>0; i--){
108009 - p->a[i].fg.jointype = p->a[i-1].fg.jointype;
108010 - }
108013 + if( p && p->nSrc>1 ){
108014 + int i = p->nSrc-1;
108017 + allFlags |= p->a[i].fg.jointype = p->a[i-1].fg.jointype;
108018 + }while( (--i)>0 );
108019 p->a[0].fg.jointype = 0;
108024 + for(i=p->nSrc-1; ALWAYS(i>0) && (p->a[i].fg.jointype&JT_RIGHT)==0; i--){}
108025 + i--;
108028 + p->a[i].fg.jointype |= JT_LTORJ;
108029 + }while( (--i)>=0 );
108034 @@ -118998,7 +121203,6 @@ SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(
108038 - assert( zName[0]>='a' && zName[0]<='z' );
108042 @@ -119225,6 +121429,16 @@ SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
108046 +/* Generate byte-code that will report the number of rows modified
108056 /* Return true if table pTab is read-only.
108058 ** A table is read-only if any of the following are true:
108059 @@ -119299,8 +121513,8 @@ SQLITE_PRIVATE void sqlite3MaterializeView(
108060 assert( pFrom->nSrc==1 );
108061 pFrom->a[0].zName = sqlite3DbStrDup(db, pView->zName);
108062 pFrom->a[0].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zDbSName);
108063 - assert( pFrom->a[0].pOn==0 );
108064 - assert( pFrom->a[0].pUsing==0 );
108065 + assert( pFrom->a[0].fg.isUsing==0 );
108066 + assert( pFrom->a[0].u3.pOn==0 );
108070 @@ -119464,12 +121678,13 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
108073 db = pParse->db;
108074 - if( pParse->nErr || db->mallocFailed ){
108075 + assert( db->pParse==pParse );
108076 + if( pParse->nErr ){
108079 + assert( db->mallocFailed==0 );
108080 assert( pTabList->nSrc==1 );
108082 -
108086 @@ -119494,6 +121709,14 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
108093 + sqlite3TreeViewDelete(pParse->pWith, pTabList, pWhere,
108101 @@ -119647,7 +121870,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
108102 ** ONEPASS_SINGLE: One-pass approach - at most one row deleted.
108103 ** ONEPASS_MULTI: One-pass approach - any number of rows may be deleted.
108105 - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1);
108110 @@ -119800,9 +122023,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
108114 - sqlite3VdbeAddOp2(v, OP_ChngCntRow, memCnt, 1);
108115 - sqlite3VdbeSetNumCols(v, 1);
108116 - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC);
108121 @@ -120253,6 +122474,18 @@ static void typeofFunc(
108122 sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC);
108140 @@ -120414,7 +122647,7 @@ endInstrOOM:
108144 -** Implementation of the printf() function.
108149 @@ -121183,39 +123416,42 @@ static const char hexdigits[] = {
108153 -** Implementation of the QUOTE() function. This function takes a single
108154 -** argument. If the argument is numeric, the return value is the same as
108155 -** the argument. If the argument is NULL, the return value is the string
108156 -** "NULL". Otherwise, the argument is enclosed in single quotes with
108157 -** single-quote escapes.
108161 -static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
108162 - assert( argc==1 );
108163 - UNUSED_PARAMETER(argc);
108164 - switch( sqlite3_value_type(argv[0]) ){
108169 + assert( pStr!=0 && pStr->nChar==0 );
108174 - char zBuf[50];
108175 - r1 = sqlite3_value_double(argv[0]);
108176 - sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1);
108177 - sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8);
108178 - if( r1!=r2 ){
108179 - sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1);
108185 + sqlite3AtoF(zVal, &r2, pStr->nChar, SQLITE_UTF8);
108191 - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
108195 - sqlite3_result_value(context, argv[0]);
108200 - char *zText = 0;
108201 - char const *zBlob = sqlite3_value_blob(argv[0]);
108202 - int nBlob = sqlite3_value_bytes(argv[0]);
108203 - assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */
108204 - zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4);
108205 - if( zText ){
108210 + if( pStr->accError==0 ){
108211 + char *zText = pStr->zText;
108215 @@ -121225,42 +123461,48 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value…
108219 - sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT);
108220 - sqlite3_free(zText);
108221 + pStr->nChar = nBlob*2 + 3;
108226 - int i,j;
108227 - u64 n;
108228 - const unsigned char *zArg = sqlite3_value_text(argv[0]);
108229 - char *z;
108230 -
108231 - if( zArg==0 ) return;
108232 - for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; }
108233 - z = contextMalloc(context, ((i64)i)+((i64)n)+3);
108234 - if( z ){
108235 - z[0] = '\'';
108236 - for(i=0, j=1; zArg[i]; i++){
108237 - z[j++] = zArg[i];
108238 - if( zArg[i]=='\'' ){
108239 - z[j++] = '\'';
108240 - }
108241 - }
108242 - z[j++] = '\'';
108243 - z[j] = 0;
108244 - sqlite3_result_text(context, z, j, sqlite3_free);
108245 - }
108251 - assert( sqlite3_value_type(argv[0])==SQLITE_NULL );
108252 - sqlite3_result_text(context, "NULL", 4, SQLITE_STATIC);
108265 +** Strings are surrounded by single-quotes with escapes on interior quotes
108272 + sqlite3 *db = sqlite3_context_db_handle(context);
108275 + sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]);
108286 ** The unicode() function. Return the integer unicode code-point value
108288 @@ -122233,11 +124475,11 @@ static void logFunc(
108292 - ans *= 1.0/M_LN10;
108297 - ans *= 1.0/M_LN2;
108302 @@ -122376,8 +124618,7 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){
108306 - FUNCTION2(sqlite_offset, 1, 0, 0, noopFunc, SQLITE_FUNC_OFFSET|
108307 - SQLITE_FUNC_TYPEOF),
108312 @@ -122394,9 +124635,11 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){
108319 FUNCTION(printf, -1, 0, 0, printfFunc ),
108320 + FUNCTION(format, -1, 0, 0, printfFunc ),
108322 FUNCTION(char, -1, 0, 0, charFunc ),
108324 @@ -122495,6 +124738,7 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){
108331 #if 0 /* Enable to print out how the built-in functions are hashed */
108332 @@ -122909,7 +125153,6 @@ static void fkLookupParent(
108334 int nCol = pFKey->nCol;
108336 - int regRec = sqlite3GetTempReg(pParse);
108338 sqlite3VdbeAddOp3(v, OP_OpenRead, iCur, pIdx->tnum, iDb);
108340 @@ -122949,11 +125192,10 @@ static void fkLookupParent(
108344 - sqlite3VdbeAddOp4(v, OP_MakeRecord, regTemp, nCol, regRec,
108346 sqlite3IndexAffinityStr(pParse->db,pIdx), nCol);
108347 - sqlite3VdbeAddOp4Int(v, OP_Found, iCur, iOk, regRec, 0); VdbeCoverage(v);
108348 -
108349 - sqlite3ReleaseTempReg(pParse, regRec);
108355 @@ -123055,14 +125297,10 @@ static Expr *exprTableColumn(
108357 ** --------------------------------------------------------------------------
108359 -** Or, if the ON (UPDATE|DELETE) action is RESTRICT,
108360 -** throw a "FOREIGN KEY constraint failed" exception.
108365 -** Or, if the ON (UPDATE|DELETE) action is RESTRICT,
108366 -** throw a "FOREIGN KEY constraint failed" exception.
108370 @@ -123170,7 +125408,7 @@ static void fkScanChildren(
108373 if( pParse->nErr==0 ){
108374 - pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0);
108376 sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);
108379 @@ -123221,6 +125459,25 @@ static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){
108388 +SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3 *db, int iDb){
108390 + Hash *pHash = &db->aDb[iDb].pSchema->tblHash;
108395 + for(pFKey=pTab->u.tab.pFKey; pFKey; pFKey=pFKey->pNextFrom){
108396 + fkTriggerDelete(db, pFKey->apTrigger[0]); pFKey->apTrigger[0] = 0;
108397 + fkTriggerDelete(db, pFKey->apTrigger[1]); pFKey->apTrigger[1] = 0;
108405 @@ -123691,9 +125948,9 @@ SQLITE_PRIVATE int sqlite3FkRequired(
108409 -** If the action is "NO ACTION" or "RESTRICT", then a NULL pointer is
108410 -** returned (these actions require no special handling by the triggers
108411 -** sub-system, code for them is created by fkScanChildren()).
108413 +** require no special handling by the triggers sub-system, code for them is
108418 @@ -123822,18 +126079,23 @@ static Trigger *fkActionTrigger(
108422 + int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
108429 + tDb.z = db->aDb[iDb].zDbSName;
108432 pRaise = sqlite3Expr(db, TK_RAISE, "FOREIGN KEY constraint failed");
108434 pRaise->affExpr = OE_Abort;
108438 - sqlite3SrcListAppend(pParse, 0, &tFrom, 0),
108443 @@ -124021,7 +126283,7 @@ SQLITE_PRIVATE void sqlite3OpenTable(
108447 - assert( pPk->tnum==pTab->tnum );
108448 + assert( pPk->tnum==pTab->tnum || CORRUPT_DB );
108449 sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb);
108451 VdbeComment((v, "%s", pTab->zName));
108452 @@ -124159,7 +126421,7 @@ SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){
108455 for(i=j=0; i<pTab->nCol; i++){
108456 - assert( pTab->aCol[i].affinity!=0 );
108457 + assert( pTab->aCol[i].affinity!=0 || sqlite3VdbeParser(v)->nErr>0 );
108458 if( (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ){
108459 zColAff[j++] = pTab->aCol[i].affinity;
108461 @@ -124693,9 +126955,11 @@ SQLITE_PRIVATE void sqlite3Insert(
108464 db = pParse->db;
108465 - if( pParse->nErr || db->mallocFailed ){
108466 + assert( db->pParse==pParse );
108467 + if( pParse->nErr ){
108470 + assert( db->mallocFailed==0 );
108474 @@ -124741,6 +127005,14 @@ SQLITE_PRIVATE void sqlite3Insert(
108481 + sqlite3TreeViewInsert(pParse->pWith, pTabList, pColumn, pSelect, pList,
108487 ** ViewGetColumnNames() is a no-op if pTab is not a view.
108489 @@ -124771,7 +127043,11 @@ SQLITE_PRIVATE void sqlite3Insert(
108493 - if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){
108502 @@ -124815,13 +127091,15 @@ SQLITE_PRIVATE void sqlite3Insert(
108504 bIdListInOrder = (pTab->tabFlags & (TF_OOOHidden|TF_HasStored))==0;
108506 + assert( pColumn->eU4!=EU4_EXPR );
108507 + pColumn->eU4 = EU4_IDX;
108508 for(i=0; i<pColumn->nId; i++){
108509 - pColumn->a[i].idx = -1;
108510 + pColumn->a[i].u4.idx = -1;
108512 for(i=0; i<pColumn->nId; i++){
108513 for(j=0; j<pTab->nCol; j++){
108514 if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zCnName)==0 ){
108515 - pColumn->a[i].idx = j;
108516 + pColumn->a[i].u4.idx = j;
108518 if( j==pTab->iPKey ){
108520 @@ -124871,7 +127149,9 @@ SQLITE_PRIVATE void sqlite3Insert(
108521 dest.nSdst = pTab->nCol;
108524 - if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup;
108525 + assert( db->pParse==pParse );
108526 + if( rc || pParse->nErr ) goto insert_cleanup;
108527 + assert( db->mallocFailed==0 );
108529 sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */
108530 assert( pSelect->pEList );
108531 @@ -125121,7 +127401,8 @@ SQLITE_PRIVATE void sqlite3Insert(
108535 - for(j=0; j<pColumn->nId && pColumn->a[j].idx!=i; j++){}
108536 + assert( pColumn->eU4==EU4_IDX );
108537 + for(j=0; j<pColumn->nId && pColumn->a[j].u4.idx!=i; j++){}
108538 if( j>=pColumn->nId ){
108541 @@ -125360,9 +127641,7 @@ insert_end:
108545 - sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1);
108546 - sqlite3VdbeSetNumCols(v, 1);
108547 - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC);
108552 @@ -126254,7 +128533,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
108556 - ** different from the old.
108561 @@ -126527,7 +128806,6 @@ SQLITE_PRIVATE void sqlite3CompleteInsertion(
108565 - assert( pParse->nested==0 );
108569 @@ -126743,18 +129021,13 @@ static int xferOptimization(
108573 - if( pSelect==0 ){
108574 - return 0; /* Must be of the form INSERT INTO ... SELECT ... */
108575 - }
108577 if( pParse->pWith || pSelect->pWith ){
108583 - if( sqlite3TriggerList(pParse, pDest) ){
108584 - return 0; /* tab1 must not have triggers */
108585 - }
108589 @@ -127617,6 +129890,19 @@ struct sqlite3_api_routines {
108609 @@ -127928,6 +130214,19 @@ typedef int (*sqlite3_loadext_entry)(
108610 #define sqlite3_total_changes64 sqlite3_api->total_changes64
108612 #define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages
108614 +#define sqlite3_error_offset sqlite3_api->error_offset
108615 +#define sqlite3_vtab_rhs_value sqlite3_api->vtab_rhs_value
108616 +#define sqlite3_vtab_distinct sqlite3_api->vtab_distinct
108617 +#define sqlite3_vtab_in sqlite3_api->vtab_in
108618 +#define sqlite3_vtab_in_first sqlite3_api->vtab_in_first
108619 +#define sqlite3_vtab_in_next sqlite3_api->vtab_in_next
108622 +#define sqlite3_deserialize sqlite3_api->deserialize
108623 +#define sqlite3_serialize sqlite3_api->serialize
108625 +#define sqlite3_db_name sqlite3_api->db_name
108629 @@ -128417,6 +130716,30 @@ static const sqlite3_api_routines sqlite3Apis = {
108660 @@ -129087,7 +131410,7 @@ static const PragmaName aPragmaName[] = {
108664 - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
108669 @@ -129775,15 +132098,16 @@ static void pragmaFunclistLine(
108670 int isBuiltin, /* True if this is a built-in function */
108681 for(; p; p=p->pNext){
108683 - static const u32 mask =
108684 - SQLITE_DETERMINISTIC |
108685 - SQLITE_DIRECTONLY |
108686 - SQLITE_SUBTYPE |
108687 - SQLITE_INNOCUOUS |
108688 - SQLITE_FUNC_INTERNAL
108689 - ;
108693 @@ -130275,7 +132599,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
108697 - int iLimit, addr;
108702 @@ -130432,6 +132756,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
108710 @@ -130441,6 +132766,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
108711 rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);
108718 @@ -130458,6 +132784,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
108726 @@ -130476,6 +132803,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
108734 @@ -130485,6 +132813,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
108735 rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);
108742 @@ -130496,6 +132825,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
108750 @@ -130718,6 +133048,10 @@ SQLITE_PRIVATE void sqlite3Pragma(
108752 sqlite3DbFree(db, zSql);
108754 + if( db->mallocFailed ){
108755 + sqlite3ErrorMsg(db->pParse, "out of memory");
108756 + db->pParse->rc = SQLITE_NOMEM_BKPT;
108758 pHash = &db->aDb[ii].pSchema->tblHash;
108761 @@ -130959,7 +133293,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
108765 - int regKey; /* Register to hold key for checking the FK */
108769 @@ -130967,7 +133300,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
108771 regResult = pParse->nMem+1;
108772 pParse->nMem += 4;
108773 - regKey = ++pParse->nMem;
108774 regRow = ++pParse->nMem;
108775 k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);
108777 @@ -131034,9 +133366,9 @@ SQLITE_PRIVATE void sqlite3Pragma(
108781 - sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, pFK->nCol, regKey,
108782 + sqlite3VdbeAddOp4(v, OP_Affinity, regRow, pFK->nCol, 0,
108783 sqlite3IndexAffinityStr(db,pIdx), pFK->nCol);
108784 - sqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regKey, 0);
108785 + sqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regRow, pFK->nCol);
108789 @@ -132575,7 +134907,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, …
108790 sqlite3ResetAllSchemasOfConnection(db);
108791 pDb = &db->aDb[iDb];
108793 - if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){
108794 + if( rc==SQLITE_OK || ((db->flags&SQLITE_NoSchemaError) && rc!=SQLITE_NOMEM)){
108798 @@ -132754,8 +135086,14 @@ SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
108802 -SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
108804 sqlite3 *db = pParse->db;
108805 + assert( db!=0 );
108806 + assert( db->pParse==pParse );
108807 + assert( pParse->nested==0 );
108809 + sqlite3DbFree(db, pParse->aTableLock);
108811 while( pParse->pCleanup ){
108812 ParseCleanup *pCleanup = pParse->pCleanup;
108813 pParse->pCleanup = pCleanup->pNext;
108814 @@ -132766,11 +135104,12 @@ SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
108815 if( pParse->pConstExpr ){
108816 sqlite3ExprListDelete(db, pParse->pConstExpr);
108818 - if( db ){
108819 - assert( db->lookaside.bDisable >= pParse->disableLookaside );
108820 - db->lookaside.bDisable -= pParse->disableLookaside;
108821 - db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue;
108822 - }
108823 + assert( db->lookaside.bDisable >= pParse->disableLookaside );
108824 + db->lookaside.bDisable -= pParse->disableLookaside;
108825 + db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue;
108826 + assert( pParse->db->pParse==pParse );
108827 + db->pParse = pParse->pOuterParse;
108828 + pParse->db = 0;
108829 pParse->disableLookaside = 0;
108832 @@ -132783,7 +135122,7 @@ SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
108835 ** common cleanups, we save a single NULL-pointer comparison in
108836 -** sqlite3ParserReset(), which reduces the total CPU cycle count.
108841 @@ -132823,6 +135162,33 @@ SQLITE_PRIVATE void *sqlite3ParserAddCleanup(
108847 +** into database connection db.
108854 +SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse *pParse, sqlite3 *db){
108857 + assert( db->pParse!=pParse );
108858 + pParse->pOuterParse = db->pParse;
108859 + db->pParse = pParse;
108860 + pParse->db = db;
108861 + if( db->mallocFailed ) sqlite3ErrorMsg(pParse, "out of memory");
108873 ** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
108875 @@ -132835,16 +135201,19 @@ static int sqlite3Prepare(
108879 - char *zErrMsg = 0; /* Error message */
108884 - memset(&sParse, 0, PARSE_HDR_SZ);
108885 + /* sqlite3ParseObjectInit(&sParse, db); // inlined for performance */
108888 + sParse.pOuterParse = db->pParse;
108889 + db->pParse = &sParse;
108890 + sParse.db = db;
108893 - /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */
108894 + if( db->mallocFailed ) sqlite3ErrorMsg(&sParse, "out of memory");
108895 assert( sqlite3_mutex_held(db->mutex) );
108897 /* For a long-term use prepared statement avoid the use of
108898 @@ -132897,7 +135266,6 @@ static int sqlite3Prepare(
108900 sqlite3VtabUnlockList(db);
108902 - sParse.db = db;
108903 if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){
108905 int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
108906 @@ -132910,14 +135278,14 @@ static int sqlite3Prepare(
108908 zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
108910 - sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg);
108912 sParse.zTail = &zSql[sParse.zTail-zSqlCopy];
108913 sqlite3DbFree(db, zSqlCopy);
108918 - sqlite3RunParser(&sParse, zSql, &zErrMsg);
108923 @@ -132933,7 +135301,7 @@ static int sqlite3Prepare(
108927 - if( sParse.checkSchema ){
108928 + if( sParse.checkSchema && db->init.busy==0 ){
108932 @@ -132941,14 +135309,14 @@ static int sqlite3Prepare(
108936 - if( zErrMsg ){
108937 - sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
108938 - sqlite3DbFree(db, zErrMsg);
108940 + sqlite3ErrorWithMsg(db, rc, "%s", sParse.zErrMsg);
108941 + sqlite3DbFree(db, sParse.zErrMsg);
108943 sqlite3Error(db, rc);
108946 - assert( zErrMsg==0 );
108950 sqlite3ErrorClear(db);
108951 @@ -132964,7 +135332,7 @@ static int sqlite3Prepare(
108955 - sqlite3ParserReset(&sParse);
108960 @@ -132995,7 +135363,7 @@ static int sqlite3LockAndPrepare(
108961 rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
108963 if( rc==SQLITE_OK || db->mallocFailed ) break;
108964 - }while( rc==SQLITE_ERROR_RETRY
108966 || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
108967 sqlite3BtreeLeaveAll(db);
108968 rc = sqlite3ApiExit(db, rc);
108969 @@ -133236,7 +135604,7 @@ SQLITE_API int sqlite3_prepare16_v3(
108973 - u8 isTnct; /* True if the DISTINCT keyword is present */
108978 @@ -133419,6 +135787,52 @@ static Select *findRightmost(Select *p){
108987 +** ------- ----- ----- ------------
108988 +** CROSS - - JT_CROSS
108989 +** INNER - - JT_INNER
108990 +** LEFT - - JT_LEFT|JT_OUTER
108991 +** LEFT OUTER - JT_LEFT|JT_OUTER
108992 +** RIGHT - - JT_RIGHT|JT_OUTER
108993 +** RIGHT OUTER - JT_RIGHT|JT_OUTER
108994 +** FULL - - JT_LEFT|JT_RIGHT|JT_OUTER
108995 +** FULL OUTER - JT_LEFT|JT_RIGHT|JT_OUTER
108996 +** NATURAL INNER - JT_NATURAL|JT_INNER
108997 +** NATURAL LEFT - JT_NATURAL|JT_LEFT|JT_OUTER
108999 +** NATURAL RIGHT - JT_NATURAL|JT_RIGHT|JT_OUTER
109001 +** NATURAL FULL - JT_NATURAL|JT_LEFT|JT_RIGHT
109005 +** of other non-standard and in many cases non-sensical join types.
109010 +** INNER CROSS JOIN -> same as JOIN
109011 +** NATURAL CROSS JOIN -> same as NATURAL JOIN
109012 +** OUTER LEFT JOIN -> same as LEFT JOIN
109013 +** LEFT NATURAL JOIN -> same as NATURAL LEFT JOIN
109014 +** LEFT RIGHT JOIN -> same as FULL JOIN
109015 +** RIGHT OUTER FULL JOIN -> same as FULL JOIN
109016 +** CROSS CROSS CROSS JOIN -> same as JOIN
109031 @@ -133431,13 +135845,13 @@ SQLITE_PRIVATE int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB,…
109035 - /* natural */ { 0, 7, JT_NATURAL },
109036 - /* left */ { 6, 4, JT_LEFT|JT_OUTER },
109037 - /* outer */ { 10, 5, JT_OUTER },
109038 - /* right */ { 14, 5, JT_RIGHT|JT_OUTER },
109039 - /* full */ { 19, 4, JT_LEFT|JT_RIGHT|JT_OUTER },
109040 - /* inner */ { 23, 5, JT_INNER },
109041 - /* cross */ { 28, 5, JT_INNER|JT_CROSS },
109052 @@ -133460,18 +135874,15 @@ SQLITE_PRIVATE int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB,…
109056 - (jointype & JT_ERROR)!=0
109060 - const char *zSp = " ";
109061 - assert( pB!=0 );
109062 - if( pC==0 ){ zSp++; }
109063 - sqlite3ErrorMsg(pParse, "unknown or unsupported join type: "
109064 - "%T %T%s%T", pA, pB, zSp, pC);
109065 - jointype = JT_INNER;
109066 - }else if( (jointype & JT_OUTER)!=0
109067 - && (jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ){
109068 - sqlite3ErrorMsg(pParse,
109069 - "RIGHT and FULL OUTER JOINs are not currently supported");
109079 @@ -133492,8 +135903,25 @@ SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol){
109083 -** Search the first N tables in pSrc, from left to right, looking for a
109084 -** table that has a column named zCol.
109089 + assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem->pSelect) );
109090 + if( pItem->fg.isNestedFrom ){
109092 + assert( pItem->pSelect!=0 );
109093 + pResults = pItem->pSelect->pEList;
109095 + assert( iCol>=0 && iCol<pResults->nExpr );
109096 + pResults->a[iCol].fg.bUsed = 1;
109102 +** table that has a column named zCol. The search is left-to-right.
109107 @@ -133502,22 +135930,27 @@ SQLITE_PRIVATE int sqlite3ColumnIndex(Table *pTab, const char *zCol){
109111 - int N, /* Number of tables in pSrc->a[] to search */
109112 + int iStart, /* First member of pSrc->a[] to check */
109113 + int iEnd, /* Last member of pSrc->a[] to check */
109115 int *piTab, /* Write index of pSrc->a[] here */
109116 int *piCol, /* Write index of pSrc->a[*piTab].pTab->aCol[] here */
109117 - int bIgnoreHidden /* True to ignore hidden columns */
109123 + assert( iEnd<pSrc->nSrc );
109126 - for(i=0; i<N; i++){
109129 iCol = sqlite3ColumnIndex(pSrc->a[i].pTab, zCol);
109131 && (bIgnoreHidden==0 || IsHiddenColumn(&pSrc->a[i].pTab->aCol[iCol])==0)
109134 + sqlite3SrcItemColumnUsed(&pSrc->a[i], iCol);
109138 @@ -133528,66 +135961,19 @@ static int tableAndColumnIndex(
109142 -** This function is used to add terms implied by JOIN syntax to the
109143 -** WHERE clause expression of a SELECT statement. The new term, which
109144 -** is ANDed with the existing WHERE clause, is of the form:
109145 -**
109146 -** (tab1.col1 = tab2.col2)
109147 -**
109148 -** where tab1 is the iSrc'th table in SrcList pSrc and tab2 is the
109149 -** (iSrc+1)'th. Column col1 is column iColLeft of tab1, and col2 is
109150 -** column iColRight of tab2.
109151 -*/
109152 -static void addWhereTerm(
109153 - Parse *pParse, /* Parsing context */
109154 - SrcList *pSrc, /* List of tables in FROM clause */
109155 - int iLeft, /* Index of first table to join in pSrc */
109156 - int iColLeft, /* Index of column in first table */
109157 - int iRight, /* Index of second table in pSrc */
109158 - int iColRight, /* Index of column in second table */
109159 - int isOuterJoin, /* True if this is an OUTER join */
109160 - Expr **ppWhere /* IN/OUT: The WHERE clause to add to */
109161 -){
109162 - sqlite3 *db = pParse->db;
109163 - Expr *pE1;
109164 - Expr *pE2;
109165 - Expr *pEq;
109166 -
109167 - assert( iLeft<iRight );
109168 - assert( pSrc->nSrc>iRight );
109169 - assert( pSrc->a[iLeft].pTab );
109170 - assert( pSrc->a[iRight].pTab );
109171 -
109172 - pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iColLeft);
109173 - pE2 = sqlite3CreateColumnExpr(db, pSrc, iRight, iColRight);
109174 -
109175 - pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2);
109176 - assert( pE2!=0 || pEq==0 ); /* Due to db->mallocFailed test
109177 - ** in sqlite3DbMallocRawNN() called from
109178 - ** sqlite3PExpr(). */
109179 - if( pEq && isOuterJoin ){
109180 - ExprSetProperty(pEq, EP_FromJoin);
109181 - assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) );
109182 - ExprSetVVAProperty(pEq, EP_NoReduce);
109183 - pEq->iRightJoinTable = pE2->iTable;
109184 - }
109185 - *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq);
109186 -}
109187 -
109188 -/*
109189 -** Set the EP_FromJoin property on all terms of the given expression.
109190 -** And set the Expr.iRightJoinTable to iTable for every term in the
109195 -** The EP_FromJoin property is used on terms of an expression to tell
109196 -** the LEFT OUTER JOIN processing logic that this term is part of the
109204 -** The Expr.iRightJoinTable tells the WHERE clause processing that the
109205 -** expression depends on table iRightJoinTable even if that table is not
109211 @@ -133600,39 +135986,48 @@ static void addWhereTerm(
109215 -SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){
109219 - ExprSetProperty(p, EP_FromJoin);
109223 - p->iRightJoinTable = iTable;
109224 + p->w.iJoin = iTable;
109225 if( p->op==TK_FUNCTION ){
109227 if( p->x.pList ){
109229 for(i=0; i<p->x.pList->nExpr; i++){
109230 - sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable);
109231 + sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable, joinFlag);
109235 - sqlite3SetJoinExpr(p->pLeft, iTable);
109236 + sqlite3SetJoinExpr(p->pLeft, iTable, joinFlag);
109237 p = p->pRight;
109241 -/* Undo the work of sqlite3SetJoinExpr(). In the expression p, convert every
109242 -** term that is marked with EP_FromJoin and iRightJoinTable==iTable into
109243 -** an ordinary term that omits the EP_FromJoin mark.
109252 -** This happens when a LEFT JOIN is simplified into an ordinary JOIN.
109259 -static void unsetJoinExpr(Expr *p, int iTable){
109262 - if( ExprHasProperty(p, EP_FromJoin)
109263 - && (iTable<0 || p->iRightJoinTable==iTable) ){
109264 - ExprClearProperty(p, EP_FromJoin);
109265 + if( iTable<0 || (ExprHasProperty(p, EP_OuterON) && p->w.iJoin==iTable) ){
109269 - if( p->op==TK_COLUMN && p->iTable==iTable ){
109270 + if( p->op==TK_COLUMN && p->iTable==iTable && !nullable ){
109273 if( p->op==TK_FUNCTION ){
109274 @@ -133640,30 +136035,37 @@ static void unsetJoinExpr(Expr *p, int iTable){
109275 if( p->x.pList ){
109277 for(i=0; i<p->x.pList->nExpr; i++){
109278 - unsetJoinExpr(p->x.pList->a[i].pExpr, iTable);
109279 + unsetJoinExpr(p->x.pList->a[i].pExpr, iTable, nullable);
109283 - unsetJoinExpr(p->pLeft, iTable);
109284 + unsetJoinExpr(p->pLeft, iTable, nullable);
109285 p = p->pRight;
109291 -** ON and USING clauses are converted into extra terms of the WHERE clause.
109292 -** NATURAL joins also create extra WHERE clause terms.
109304 ** The left most table is the first entry in Select.pSrc. The right-most
109306 -** the left. Thus entry 0 contains the join operator for the join between
109309 -** also attached to the left entry.
109314 -static int sqliteProcessJoin(Parse *pParse, Select *p){
109319 @@ -133674,49 +136076,41 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){
109321 for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
109322 Table *pRightTab = pRight->pTab;
109323 - int isOuter;
109326 if( NEVER(pLeft->pTab==0 || pRightTab==0) ) continue;
109327 - isOuter = (pRight->fg.jointype & JT_OUTER)!=0;
109328 + joinType = (pRight->fg.jointype & JT_OUTER)!=0 ? EP_OuterON : EP_InnerON;
109330 - /* When the NATURAL keyword is present, add WHERE clause terms for
109331 - ** every column that the two tables have in common.
109335 if( pRight->fg.jointype & JT_NATURAL ){
109336 - if( pRight->pOn || pRight->pUsing ){
109338 + if( pRight->fg.isUsing || pRight->u3.pOn ){
109343 for(j=0; j<pRightTab->nCol; j++){
109345 - int iLeft; /* Matching left table */
109346 - int iLeftCol; /* Matching column in the left table */
109348 if( IsHiddenColumn(&pRightTab->aCol[j]) ) continue;
109349 zName = pRightTab->aCol[j].zCnName;
109350 - if( tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol, 1) ){
109351 - addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, j,
109352 - isOuter, &p->pWhere);
109356 + assert( pUsing->nId>0 );
109357 + assert( pUsing->a[pUsing->nId-1].zName==0 );
109358 + pUsing->a[pUsing->nId-1].zName = sqlite3DbStrDup(pParse->db, zName);
109362 - }
109363 -
109364 - /* Disallow both ON and USING clauses in the same join
109365 - */
109366 - if( pRight->pOn && pRight->pUsing ){
109367 - sqlite3ErrorMsg(pParse, "cannot have both ON and USING "
109368 - "clauses in the same join");
109369 - return 1;
109370 - }
109371 -
109372 - /* Add the ON clause to the end of the WHERE clause, connected by
109373 - ** an AND operator.
109374 - */
109375 - if( pRight->pOn ){
109376 - if( isOuter ) sqlite3SetJoinExpr(pRight->pOn, pRight->iCursor);
109377 - p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->pOn);
109378 - pRight->pOn = 0;
109380 + pRight->fg.isUsing = 1;
109381 + pRight->fg.isSynthUsing = 1;
109382 + pRight->u3.pUsing = pUsing;
109384 + if( pParse->nErr ) return 1;
109388 @@ -133726,27 +136120,88 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){
109392 - if( pRight->pUsing ){
109393 - IdList *pList = pRight->pUsing;
109394 + if( pRight->fg.isUsing ){
109395 + IdList *pList = pRight->u3.pUsing;
109396 + sqlite3 *db = pParse->db;
109398 for(j=0; j<pList->nId; j++){
109407 zName = pList->a[j].zName;
109410 - || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol, 0)
109412 + pRight->fg.isSynthUsing)==0
109414 sqlite3ErrorMsg(pParse, "cannot join using column %s - column "
109418 - addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, iRightCol,
109419 - isOuter, &p->pWhere);
109420 + pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iLeftCol);
109421 + sqlite3SrcItemColumnUsed(&pSrc->a[iLeft], iLeftCol);
109422 + if( (pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
109425 + ** contains the zName column, then this branch is a no-op.
109432 + ** non-USING references to zName on the left of an INNER or LEFT
109439 + pRight->fg.isSynthUsing)!=0 ){
109440 + if( pSrc->a[iLeft].fg.isUsing==0
109441 + || sqlite3IdListIndex(pSrc->a[iLeft].u3.pUsing, zName)<0
109448 + pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iLeftCol);
109449 + sqlite3SrcItemColumnUsed(&pSrc->a[iLeft], iLeftCol);
109456 + pE2 = sqlite3CreateColumnExpr(db, pSrc, i+1, iRightCol);
109464 + pEq->w.iJoin = pE2->iTable;
109466 + p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pEq);
109473 + else if( pRight->u3.pOn ){
109474 + sqlite3SetJoinExpr(pRight->u3.pOn, pRight->iCursor, joinType);
109475 + p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->u3.pOn);
109476 + pRight->u3.pOn = 0;
109477 + pRight->fg.isOn = 1;
109482 @@ -134135,7 +136590,7 @@ static void fixDistinctOpenEph(
109486 -** The ExprList_item.bSorterRef flag is set for each expression in pEList
109488 ** for which the sorter-reference optimization should be enabled.
109489 ** Additionally, the pSort->aDefer[] array is populated with entries
109491 @@ -134195,7 +136650,7 @@ static void selectExprDefer(
109495 - pItem->bSorterRef = 1;
109496 + pItem->fg.bSorterRef = 1;
109500 @@ -134326,7 +136781,7 @@ static void selectInnerLoop(
109501 for(i=0; i<pEList->nExpr; i++){
109502 if( pEList->a[i].u.x.iOrderByCol>0
109504 - || pEList->a[i].bSorterRef
109505 + || pEList->a[i].fg.bSorterRef
109508 nResultCol--;
109509 @@ -134619,7 +137074,7 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){
109510 p->nRef = 1;
109513 - sqlite3OomFault(db);
109514 + return (KeyInfo*)sqlite3OomFault(db);
109518 @@ -134688,7 +137143,7 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoFromExprList(
109520 for(i=iStart, pItem=pList->a+iStart; i<nExpr; i++, pItem++){
109521 pInfo->aColl[i-iStart] = sqlite3ExprNNCollSeq(pParse, pItem->pExpr);
109522 - pInfo->aSortFlags[i-iStart] = pItem->sortFlags;
109523 + pInfo->aSortFlags[i-iStart] = pItem->fg.sortFlags;
109527 @@ -134790,6 +137245,9 @@ static void generateSortTail(
109529 iTab = pSort->iECursor;
109531 + if( eDest==SRT_Mem && p->iOffset ){
109532 + sqlite3VdbeAddOp2(v, OP_Null, 0, pDest->iSdst);
109535 regRow = pDest->iSdst;
109537 @@ -134813,7 +137271,7 @@ static void generateSortTail(
109541 - codeOffset(v, p->iOffset, addrContinue);
109542 + assert( p->iLimit==0 && p->iOffset==0 );
109546 @@ -134821,10 +137279,13 @@ static void generateSortTail(
109547 codeOffset(v, p->iOffset, addrContinue);
109550 + if( p->iOffset>0 ){
109551 + sqlite3VdbeAddOp2(v, OP_AddImm, p->iLimit, -1);
109554 for(i=0, iCol=nKey+bSeq-1; i<nColumn; i++){
109556 - if( aOutEx[i].bSorterRef ) continue;
109561 @@ -134861,7 +137322,7 @@ static void generateSortTail(
109563 for(i=nColumn-1; i>=0; i--){
109565 - if( aOutEx[i].bSorterRef ){
109570 @@ -135227,7 +137688,7 @@ SQLITE_PRIVATE void sqlite3GenerateColumnNames(
109571 assert( p->op!=TK_AGG_COLUMN ); /* Agg processing has not run yet */
109572 assert( p->op!=TK_COLUMN
109573 || (ExprUseYTab(p) && p->y.pTab!=0) ); /* Covering idx not yet coded */
109574 - if( pEList->a[i].zEName && pEList->a[i].eEName==ENAME_NAME ){
109575 + if( pEList->a[i].zEName && pEList->a[i].fg.eEName==ENAME_NAME ){
109577 char *zName = pEList->a[i].zEName;
109579 @@ -135312,22 +137773,25 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
109582 for(i=0, pCol=aCol; i<nCol && !db->mallocFailed; i++, pCol++){
109583 + struct ExprList_item *pX = &pEList->a[i];
109587 - if( (zName = pEList->a[i].zEName)!=0 && pEList->a[i].eEName==ENAME_NAME ){
109588 + if( (zName = pX->zEName)!=0 && pX->fg.eEName==ENAME_NAME ){
109591 - Expr *pColExpr = sqlite3ExprSkipCollateAndLikely(pEList->a[i].pExpr);
109592 + Expr *pColExpr = sqlite3ExprSkipCollateAndLikely(pX->pExpr);
109593 while( ALWAYS(pColExpr!=0) && pColExpr->op==TK_DOT ){
109594 pColExpr = pColExpr->pRight;
109597 if( pColExpr->op==TK_COLUMN
109599 - && (pTab = pColExpr->y.pTab)!=0
109600 + && ALWAYS( pColExpr->y.pTab!=0 )
109603 int iCol = pColExpr->iColumn;
109604 + pTab = pColExpr->y.pTab;
109605 if( iCol<0 ) iCol = pTab->iPKey;
109606 zName = iCol>=0 ? pTab->aCol[iCol].zCnName : "rowid";
109607 }else if( pColExpr->op==TK_ID ){
109608 @@ -135335,7 +137799,7 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
109609 zName = pColExpr->u.zToken;
109612 - zName = pEList->a[i].zEName;
109613 + assert( zName==pX->zEName ); /* pointer comparison intended */
109617 @@ -135348,7 +137812,10 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
109621 - while( zName && sqlite3HashFind(&ht, zName)!=0 ){
109623 + if( pCollide->fg.bUsingTerm ){
109624 + pCol->colFlags |= COLFLAG_NOEXPAND;
109628 for(j=nName-1; j>0 && sqlite3Isdigit(zName[j]); j--){}
109629 @@ -135359,8 +137826,11 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
109631 pCol->zCnName = zName;
109632 pCol->hName = sqlite3StrIHash(zName);
109633 + if( pX->fg.bNoExpand ){
109634 + pCol->colFlags |= COLFLAG_NOEXPAND;
109637 - if( zName && sqlite3HashInsert(&ht, zName, pCol)==pCol ){
109639 sqlite3OomFault(db);
109642 @@ -135617,7 +138087,7 @@ static KeyInfo *multiSelectOrderByKeyInfo(Parse *pParse, Select *p, int n…
109645 pRet->aColl[i] = pColl;
109646 - pRet->aSortFlags[i] = pOrderBy->a[i].sortFlags;
109647 + pRet->aSortFlags[i] = pOrderBy->a[i].fg.sortFlags;
109651 @@ -135835,7 +138305,7 @@ static int multiSelectOrderBy(
109655 -** Since the limit is exactly 1, we only need to evalutes the left-most VALUES.
109656 +** Since the limit is exactly 1, we only need to evaluate the left-most VALUES.
109660 @@ -136511,6 +138981,8 @@ static int multiSelectOrderBy(
109664 + Select *pSplit; /* Left-most SELECT in the right-hand group */
109669 @@ -136556,8 +139028,7 @@ static int multiSelectOrderBy(
109672 op = p->op;
109673 - pPrior = p->pPrior;
109674 - assert( pPrior->pOrderBy==0 );
109675 + assert( p->pPrior->pOrderBy==0 );
109676 pOrderBy = p->pOrderBy;
109678 nOrderBy = pOrderBy->nExpr;
109679 @@ -136607,11 +139078,6 @@ static int multiSelectOrderBy(
109683 - /* Reattach the ORDER BY clause to the query.
109684 - */
109685 - p->pOrderBy = pOrderBy;
109686 - pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0);
109687 -
109691 @@ -136636,12 +139102,30 @@ static int multiSelectOrderBy(
109695 - p->pPrior = 0;
109698 + && OptimizationEnabled(db, SQLITE_BalancedMerge)
109700 + for(pSplit=p; pSplit->pPrior!=0 && pSplit->op==op; pSplit=pSplit->pPrior){
109702 + assert( pSplit->pPrior->pNext==pSplit );
109709 + for(i=2; i<nSelect; i+=2){ pSplit = pSplit->pPrior; }
109711 + pPrior = pSplit->pPrior;
109713 + pSplit->pPrior = 0;
109714 pPrior->pNext = 0;
109715 + assert( p->pOrderBy == pOrderBy );
109716 + assert( pOrderBy!=0 || db->mallocFailed );
109717 + pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0);
109718 sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER");
109719 - if( pPrior->pPrior==0 ){
109720 - sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER");
109721 - }
109722 + sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER");
109726 @@ -136790,14 +139274,14 @@ static int multiSelectOrderBy(
109730 - /* Reassembly the compound query so that it will be freed correctly
109733 - if( p->pPrior ){
109734 - sqlite3SelectDelete(db, p->pPrior);
109735 + if( pSplit->pPrior ){
109737 + (void(*)(sqlite3*,void*))sqlite3SelectDelete, pSplit->pPrior);
109739 - p->pPrior = pPrior;
109740 - pPrior->pNext = p;
109741 -
109742 + pSplit->pPrior = pPrior;
109743 + pPrior->pNext = pSplit;
109744 sqlite3ExprListDelete(db, pPrior->pOrderBy);
109745 pPrior->pOrderBy = 0;
109747 @@ -136815,12 +139299,40 @@ static int multiSelectOrderBy(
109755 +** position in the parent that NULL-able due to an OUTER JOIN. Either the
109778 +** when processing a non-matched row of the left.
109784 - int isLeftJoin; /* Add TK_IF_NULL_ROW opcodes on each replacement */
109789 @@ -136846,10 +139358,11 @@ static Expr *substExpr(
109793 - if( ExprHasProperty(pExpr, EP_FromJoin)
109794 - && pExpr->iRightJoinTable==pSubst->iTable
109796 + && pExpr->w.iJoin==pSubst->iTable
109798 - pExpr->iRightJoinTable = pSubst->iNewTable;
109800 + pExpr->w.iJoin = pSubst->iNewTable;
109802 if( pExpr->op==TK_COLUMN
109803 && pExpr->iTable==pSubst->iTable
109804 @@ -136870,7 +139383,7 @@ static Expr *substExpr(
109805 sqlite3VectorErrorMsg(pSubst->pParse, pCopy);
109807 sqlite3 *db = pSubst->pParse->db;
109808 - if( pSubst->isLeftJoin && pCopy->op!=TK_COLUMN ){
109809 + if( pSubst->isOuterJoin && pCopy->op!=TK_COLUMN ){
109813 @@ -136884,14 +139397,20 @@ static Expr *substExpr(
109814 sqlite3ExprDelete(db, pNew);
109817 - if( pSubst->isLeftJoin ){
109818 + if( pSubst->isOuterJoin ){
109821 - if( ExprHasProperty(pExpr,EP_FromJoin) ){
109822 - sqlite3SetJoinExpr(pNew, pExpr->iRightJoinTable);
109824 + sqlite3SetJoinExpr(pNew, pExpr->w.iJoin,
109825 + pExpr->flags & (EP_OuterON|EP_InnerON));
109827 sqlite3ExprDelete(db, pExpr);
109829 + if( pExpr->op==TK_TRUEFALSE ){
109830 + pExpr->u.iValue = sqlite3ExprTruthValue(pExpr);
109831 + pExpr->op = TK_INTEGER;
109836 ** just as it did when it was a column of a view or sub-query. */
109837 @@ -137052,8 +139571,8 @@ static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){
109839 renumberCursorDoMapping(pWalker, &pExpr->iTable);
109841 - if( ExprHasProperty(pExpr, EP_FromJoin) ){
109842 - renumberCursorDoMapping(pWalker, &pExpr->iRightJoinTable);
109844 + renumberCursorDoMapping(pWalker, &pExpr->w.iJoin);
109848 @@ -137138,6 +139657,7 @@ static void renumberCursors(
109856 @@ -137189,6 +139709,9 @@ static void renumberCursors(
109864 ** The parent and sub-query may contain WHERE clauses. Subject to
109866 @@ -137236,6 +139759,23 @@ static void renumberCursors(
109882 +** (29) Either the subquery is not the right-hand operand of a join with an
109883 +** ON or USING clause nor the right-hand operand of a NATURAL JOIN, or
109884 +** the right-most table within the FROM clause of the subquery
109889 ** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query
109890 @@ -137261,7 +139801,7 @@ static int flattenSubquery(
109893 int iNewParent = -1;/* Replacement table for iParent */
109894 - int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */
109899 @@ -137334,26 +139874,64 @@ static int flattenSubquery(
109903 - if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){
109904 - isLeftJoin = 1;
109905 - if( pSubSrc->nSrc>1 /* (3a) */
109906 - || isAgg /* (3b) */
109907 - || IsVirtual(pSubSrc->a[0].pTab) /* (3c) */
109908 - || (p->selFlags & SF_Distinct)!=0 /* (3d) */
109909 + if( (pSubitem->fg.jointype & (JT_OUTER|JT_LTORJ))!=0 ){
109910 + if( pSubSrc->nSrc>1 /* (3a) */
109912 + || IsVirtual(pSubSrc->a[0].pTab) /* (3b) */
109913 + || (p->selFlags & SF_Distinct)!=0 /* (3d) */
109914 + || (pSubitem->fg.jointype & JT_RIGHT)!=0 /* (26) */
109922 - /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for
109923 + /* Setting isOuterJoin to -1 causes OP_IfNullRow opcodes to be generated for
109925 ** though they are not necessary. This will stress-test the OP_IfNullRow
109927 - isLeftJoin = -1;
109928 + isOuterJoin = -1;
109932 + assert( pSubSrc->nSrc>0 ); /* True by restriction (7) */
109933 + if( iFrom>0 && (pSubSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
109936 + if( pSubitem->fg.isCte && pSubitem->u2.pCteUse->eM10d==M10d_Yes ){
109947 + ** (29a) The right-most entry in the FROM clause of the subquery
109957 + if( pSubSrc->nSrc>=2
109958 + && (pSubSrc->a[pSubSrc->nSrc-1].fg.jointype & JT_OUTER)!=0
109960 + if( (pSubitem->fg.jointype & JT_NATURAL)!=0
109961 + || pSubitem->fg.isUsing
109962 + || NEVER(pSubitem->u3.pOn!=0) /* ON clause already shifted into WHERE */
109963 + || pSubitem->fg.isOn
109969 /* Restriction (17): If the sub-query is a compound SELECT, then it must
109972 @@ -137363,7 +139941,7 @@ static int flattenSubquery(
109973 if( pSub->pOrderBy ){
109976 - if( isAgg || (p->selFlags & SF_Distinct)!=0 || isLeftJoin>0 ){
109977 + if( isAgg || (p->selFlags & SF_Distinct)!=0 || isOuterJoin>0 ){
109980 for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){
109981 @@ -137381,6 +139959,12 @@ static int flattenSubquery(
109985 + if( iFrom>0 && (pSub1->pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
109987 + ** omitted on left-hand tables of the right join that is being
109991 testcase( pSub1->pSrc->nSrc>1 );
109994 @@ -137397,6 +139981,7 @@ static int flattenSubquery(
109996 if( pSrc->nSrc>1 ){
109997 if( pParse->nSelect>500 ) return 0;
109998 + if( OptimizationDisabled(db, SQLITE_FlttnUnionAll) ) return 0;
109999 aCsrMap = sqlite3DbMallocZero(db, ((i64)pParse->nTab+1)*sizeof(int));
110000 if( aCsrMap ) aCsrMap[0] = pParse->nTab;
110002 @@ -137421,7 +140006,7 @@ static int flattenSubquery(
110003 pSubitem->zName = 0;
110004 pSubitem->zAlias = 0;
110005 pSubitem->pSelect = 0;
110006 - assert( pSubitem->pOn==0 );
110007 + assert( pSubitem->fg.isUsing!=0 || pSubitem->u3.pOn==0 );
110009 /* If the sub-query is a compound SELECT statement, then (by restrictions
110011 @@ -137531,6 +140116,7 @@ static int flattenSubquery(
110012 for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
110015 + u8 ltorj = pSrc->a[iFrom].fg.jointype & JT_LTORJ;
110017 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
110018 nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
110019 @@ -137565,13 +140151,16 @@ static int flattenSubquery(
110023 - sqlite3IdListDelete(db, pSrc->a[i+iFrom].pUsing);
110024 - assert( pSrc->a[i+iFrom].fg.isTabFunc==0 );
110025 - pSrc->a[i+iFrom] = pSubSrc->a[i];
110026 + SrcItem *pItem = &pSrc->a[i+iFrom];
110027 + if( pItem->fg.isUsing ) sqlite3IdListDelete(db, pItem->u3.pUsing);
110028 + assert( pItem->fg.isTabFunc==0 );
110029 + *pItem = pSubSrc->a[i];
110030 + pItem->fg.jointype |= ltorj;
110031 iNewParent = pSubSrc->a[i].iCursor;
110032 memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));
110034 - pSrc->a[iFrom].fg.jointype = jointype;
110035 + pSrc->a[iFrom].fg.jointype &= JT_LTORJ;
110036 + pSrc->a[iFrom].fg.jointype |= jointype | ltorj;
110040 @@ -137606,8 +140195,8 @@ static int flattenSubquery(
110042 pWhere = pSub->pWhere;
110043 pSub->pWhere = 0;
110044 - if( isLeftJoin>0 ){
110045 - sqlite3SetJoinExpr(pWhere, iNewParent);
110050 if( pParent->pWhere ){
110051 @@ -137621,7 +140210,7 @@ static int flattenSubquery(
110055 - x.isLeftJoin = isLeftJoin;
110057 x.pEList = pSub->pEList;
110060 @@ -137656,8 +140245,8 @@ static int flattenSubquery(
110062 sqlite3SelectDelete(db, pSub1);
110064 -#if SELECTTRACE_ENABLED
110065 - if( sqlite3SelectTrace & 0x100 ){
110071 @@ -137678,6 +140267,8 @@ struct WhereConst {
110080 @@ -137740,7 +140331,11 @@ static void constInsert(
110084 - if( ExprHasProperty(pExpr, EP_FromJoin) ) return;
110085 + if( ExprHasProperty(pExpr, pConst->mExcludeOn) ){
110090 if( pExpr->op==TK_AND ){
110091 findConstInWhere(pConst, pExpr->pRight);
110092 findConstInWhere(pConst, pExpr->pLeft);
110093 @@ -137776,9 +140371,10 @@ static int propagateConstantExprRewriteOne(
110095 if( pConst->pOomFault[0] ) return WRC_Prune;
110096 if( pExpr->op!=TK_COLUMN ) return WRC_Continue;
110097 - if( ExprHasProperty(pExpr, EP_FixedCol|EP_FromJoin) ){
110098 + if( ExprHasProperty(pExpr, EP_FixedCol|pConst->mExcludeOn) ){
110100 - testcase( ExprHasProperty(pExpr, EP_FromJoin) );
110105 for(i=0; i<pConst->nConst; i++){
110106 @@ -137902,6 +140498,17 @@ static int propagateConstants(
110110 + if( ALWAYS(p->pSrc!=0)
110111 + && p->pSrc->nSrc>0
110112 + && (p->pSrc->a[0].fg.jointype & JT_LTORJ)!=0
110121 findConstInWhere(&x, p->pWhere);
110124 @@ -138021,13 +140628,13 @@ static int pushDownWhereTerms(
110128 - int iCursor, /* Cursor number of the subquery */
110129 - int isLeftJoin /* True if pSubq is the right term of a LEFT JOIN */
110135 if( pSubq->selFlags & (SF_Recursive|SF_MultiPart) ) return 0;
110136 + if( pSrc->fg.jointype & (JT_LTORJ|JT_RIGHT) ) return 0;
110139 if( pSubq->pPrior ){
110140 @@ -138057,30 +140664,35 @@ static int pushDownWhereTerms(
110143 while( pWhere->op==TK_AND ){
110144 - nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight,
110145 - iCursor, isLeftJoin);
110146 + nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, pSrc);
110147 pWhere = pWhere->pLeft;
110152 - && (ExprHasProperty(pWhere,EP_FromJoin)==0
110153 - || pWhere->iRightJoinTable!=iCursor)
110155 + || pWhere->w.iJoin!=iCursor)
110159 - if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){
110161 + && pWhere->w.iJoin!=iCursor
110165 - if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
110170 pSubq->selFlags |= SF_PushDown;
110173 pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
110174 - unsetJoinExpr(pNew, -1);
110175 + unsetJoinExpr(pNew, -1, 1);
110177 - x.iTable = iCursor;
110178 - x.iNewTable = iCursor;
110179 - x.isLeftJoin = 0;
110180 + x.iTable = pSrc->iCursor;
110181 + x.iNewTable = pSrc->iCursor;
110183 x.pEList = pSubq->pEList;
110186 @@ -138153,7 +140765,7 @@ static u8 minMaxQuery(sqlite3 *db, Expr *pFunc, ExprList **ppMinMax){
110188 *ppMinMax = pOrderBy = sqlite3ExprListDup(db, pEList, 0);
110189 assert( pOrderBy!=0 || db->mallocFailed );
110190 - if( pOrderBy ) pOrderBy->a[0].sortFlags = sortFlags;
110191 + if( pOrderBy ) pOrderBy->a[0].fg.sortFlags = sortFlags;
110195 @@ -138185,6 +140797,7 @@ static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){
110196 || p->pSrc->nSrc!=1
110197 || p->pSrc->a[0].pSelect
110198 || pAggInfo->nFunc!=1
110199 + || p->pHaving
110203 @@ -138289,7 +140902,7 @@ static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){
110204 pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );
110207 - pNewSrc = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0);
110211 p->pSrc = pNewSrc;
110212 @@ -138622,7 +141235,7 @@ SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, SrcItem *pFrom){
110213 if( pFrom->zAlias ){
110214 pTab->zName = sqlite3DbStrDup(pParse->db, pFrom->zAlias);
110216 - pTab->zName = sqlite3MPrintf(pParse->db, "subquery_%u", pSel->selId);
110217 + pTab->zName = sqlite3MPrintf(pParse->db, "%!S", pFrom);
110219 while( pSel->pPrior ){ pSel = pSel->pPrior; }
110220 sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
110221 @@ -138634,11 +141247,35 @@ SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, SrcItem *pFrom){
110223 pTab->tabFlags |= TF_Ephemeral; /* Legacy compatibility mode */
110225 + return pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
110229 - return pParse->nErr ? SQLITE_ERROR : SQLITE_OK;
110245 + N--;
110247 + if( pBase->fg.isUsing==0 ) continue;
110248 + if( NEVER(pBase->u3.pUsing==0) ) continue;
110249 + if( sqlite3IdListIndex(pBase->u3.pUsing, zName)>=0 ) return 1;
110258 @@ -138787,7 +141424,8 @@ static int selectExpander(Walker *pWalker, Select *p){
110262 - if( pParse->nErr || db->mallocFailed || sqliteProcessJoin(pParse, p) ){
110263 + assert( db->mallocFailed==0 || pParse->nErr!=0 );
110264 + if( pParse->nErr || sqlite3ProcessJoin(pParse, p) ){
110268 @@ -138835,7 +141473,7 @@ static int selectExpander(Walker *pWalker, Select *p){
110271 pNew->a[pNew->nExpr-1].zEName = a[k].zEName;
110272 - pNew->a[pNew->nExpr-1].eEName = a[k].eEName;
110273 + pNew->a[pNew->nExpr-1].fg.eEName = a[k].fg.eEName;
110277 @@ -138850,32 +141488,60 @@ static int selectExpander(Walker *pWalker, Select *p){
110278 zTName = pE->pLeft->u.zToken;
110280 for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
110281 - Table *pTab = pFrom->pTab;
110282 - Select *pSub = pFrom->pSelect;
110283 - char *zTabName = pFrom->zAlias;
110284 - const char *zSchemaName = 0;
110285 - int iDb;
110286 - if( zTabName==0 ){
110287 + Table *pTab = pFrom->pTab; /* Table for this data source */
110288 + ExprList *pNestedFrom; /* Result-set of a nested FROM clause */
110294 + if( (zTabName = pFrom->zAlias)==0 ){
110295 zTabName = pTab->zName;
110297 if( db->mallocFailed ) break;
110298 - if( pSub==0 || (pSub->selFlags & SF_NestedFrom)==0 ){
110299 - pSub = 0;
110300 + assert( (int)pFrom->fg.isNestedFrom == IsNestedFrom(pFrom->pSelect) );
110301 + if( pFrom->fg.isNestedFrom ){
110302 + assert( pFrom->pSelect!=0 );
110303 + pNestedFrom = pFrom->pSelect->pEList;
110305 + assert( pNestedFrom->nExpr==pTab->nCol );
110311 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
110312 zSchemaName = iDb>=0 ? db->aDb[iDb].zDbSName : "*";
110314 + if( i+1<pTabList->nSrc
110320 + for(ii=0; ii<pUsing->nId; ii++){
110321 + const char *zUName = pUsing->a[ii].zName;
110322 + pRight = sqlite3Expr(db, TK_ID, zUName);
110325 + struct ExprList_item *pX = &pNew->a[pNew->nExpr-1];
110326 + assert( pX->zEName==0 );
110327 + pX->zEName = sqlite3MPrintf(db,"..%s", zUName);
110328 + pX->fg.eEName = ENAME_TAB;
110329 + pX->fg.bUsingTerm = 1;
110335 for(j=0; j<pTab->nCol; j++){
110336 char *zName = pTab->aCol[j].zCnName;
110337 - char *zColname; /* The computed column name */
110338 - char *zToFree; /* Malloced string that needs to be freed */
110339 - Token sColname; /* Computed column name as a token */
110343 - if( zTName && pSub
110344 - && sqlite3MatchEName(&pSub->pEList->a[j], 0, zTName, 0)==0
110347 + && sqlite3MatchEName(&pNestedFrom->a[j], 0, zTName, 0)==0
110351 @@ -138889,26 +141555,32 @@ static int selectExpander(Walker *pWalker, Select *p){
110355 + if( (pTab->aCol[j].colFlags & COLFLAG_NOEXPAND)!=0
110363 - if( i>0 && zTName==0 ){
110364 - if( (pFrom->fg.jointype & JT_NATURAL)!=0
110365 - && tableAndColumnIndex(pTabList, i, zName, 0, 0, 1)
110367 + if( pFrom->fg.isUsing
110368 + && sqlite3IdListIndex(pFrom->u3.pUsing, zName)>=0
110370 - /* In a NATURAL join, omit the join columns from the
110371 - ** table to the right of the join */
110372 - continue;
110373 - }
110374 - if( sqlite3IdListIndex(pFrom->pUsing, zName)>=0 ){
110380 pRight = sqlite3Expr(db, TK_ID, zName);
110381 - zColname = zName;
110382 - zToFree = 0;
110383 - if( longNames || pTabList->nSrc>1 || IN_RENAME_OBJECT ){
110384 + if( (pTabList->nSrc>1
110385 + && ( (pFrom->fg.jointype & JT_LTORJ)==0
110387 + || !inAnyUsingClause(zName,pFrom,pTabList->nSrc-i-1)
110393 pLeft = sqlite3Expr(db, TK_ID, zTabName);
110395 @@ -138919,31 +141591,39 @@ static int selectExpander(Walker *pWalker, Select *p){
110396 pLeft = sqlite3Expr(db, TK_ID, zSchemaName);
110399 - if( longNames ){
110400 - zColname = sqlite3MPrintf(db, "%s.%s", zTabName, zName);
110401 - zToFree = zColname;
110402 - }
110407 -
110408 - sqlite3TokenInit(&sColname, zColname);
110409 - sqlite3ExprListSetName(pParse, pNew, &sColname, 0);
110410 - if( pNew && (p->selFlags & SF_NestedFrom)!=0 && !IN_RENAME_OBJECT ){
110411 - struct ExprList_item *pX = &pNew->a[pNew->nExpr-1];
110412 - sqlite3DbFree(db, pX->zEName);
110413 - if( pSub ){
110414 - pX->zEName = sqlite3DbStrDup(db, pSub->pEList->a[j].zEName);
110418 + pX = &pNew->a[pNew->nExpr-1];
110419 + assert( pX->zEName==0 );
110422 + pX->zEName = sqlite3DbStrDup(db, pNestedFrom->a[j].zEName);
110423 testcase( pX->zEName==0 );
110425 pX->zEName = sqlite3MPrintf(db, "%s.%s.%s",
110426 - zSchemaName, zTabName, zColname);
110428 testcase( pX->zEName==0 );
110430 - pX->eEName = ENAME_TAB;
110431 + pX->fg.eEName = ENAME_TAB;
110432 + if( (pFrom->fg.isUsing
110433 + && sqlite3IdListIndex(pFrom->u3.pUsing, zName)>=0)
110435 + || (pTab->aCol[j].colFlags & COLFLAG_NOEXPAND)!=0
110437 + pX->fg.bNoExpand = 1;
110440 + pX->zEName = sqlite3MPrintf(db, "%s.%s", zTabName, zName);
110441 + pX->fg.eEName = ENAME_NAME;
110443 + pX->zEName = sqlite3DbStrDup(db, zName);
110444 + pX->fg.eEName = ENAME_NAME;
110446 - sqlite3DbFree(db, zToFree);
110450 @@ -138967,6 +141647,12 @@ static int selectExpander(Walker *pWalker, Select *p){
110451 p->selFlags |= SF_ComplexResult;
110456 + SELECTTRACE(0x100,pParse,p,("After result-set wildcard expansion:\n"));
110463 @@ -139088,12 +141774,13 @@ SQLITE_PRIVATE void sqlite3SelectPrep(
110466 assert( p!=0 || pParse->db->mallocFailed );
110467 + assert( pParse->db->pParse==pParse );
110468 if( pParse->db->mallocFailed ) return;
110469 if( p->selFlags & SF_HasTypeInfo ) return;
110471 - if( pParse->nErr || pParse->db->mallocFailed ) return;
110472 + if( pParse->nErr ) return;
110474 - if( pParse->nErr || pParse->db->mallocFailed ) return;
110475 + if( pParse->nErr ) return;
110479 @@ -139110,8 +141797,10 @@ static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){
110482 int nReg = pAggInfo->nFunc + pAggInfo->nColumn;
110483 + assert( pParse->db->pParse==pParse );
110484 + assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 );
110486 - if( pParse->nErr || pParse->db->mallocFailed ) return;
110487 + if( pParse->nErr ) return;
110491 @@ -139354,8 +142043,8 @@ static void havingToWhere(Parse *pParse, Select *p){
110494 sqlite3WalkExpr(&sWalker, p->pHaving);
110495 -#if SELECTTRACE_ENABLED
110496 - if( sWalker.eCode && (sqlite3SelectTrace & 0x100)!=0 ){
110502 @@ -139487,8 +142176,8 @@ static int countOfViewOptimization(Parse *pParse, Select *p){
110503 p->pEList->a[0].pExpr = pExpr;
110504 p->selFlags &= ~SF_Aggregate;
110506 -#if SELECTTRACE_ENABLED
110507 - if( sqlite3SelectTrace & 0x400 ){
110510 SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
110513 @@ -139497,6 +142186,29 @@ static int countOfViewOptimization(Parse *pParse, Select *p){
110518 +** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
110524 + for(i=0; i<pSrc->nSrc; i++){
110525 + SrcItem *p1 = &pSrc->a[i];
110527 + if( p0->pTab==p1->pTab && 0==sqlite3_stricmp(p0->zAlias, p1->zAlias) ){
110530 + if( p1->pSelect
110531 + && (p1->pSelect->selFlags & SF_NestedFrom)!=0
110532 + && sameSrcAlias(p0, p1->pSelect->pSrc)
110543 @@ -139534,15 +142246,21 @@ SQLITE_PRIVATE int sqlite3Select(
110546 db = pParse->db;
110547 + assert( pParse==db->pParse );
110549 - if( p==0 || db->mallocFailed || pParse->nErr ){
110550 + if( p==0 || pParse->nErr ){
110553 + assert( db->mallocFailed==0 );
110555 -#if SELECTTRACE_ENABLED
110557 SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
110558 - if( sqlite3SelectTrace & 0x100 ){
110559 - sqlite3TreeViewSelect(0, p, 0);
110569 @@ -139556,9 +142274,9 @@ SQLITE_PRIVATE int sqlite3Select(
110570 pDest->eDest==SRT_DistQueue || pDest->eDest==SRT_DistFifo );
110572 if( p->pOrderBy ){
110573 -#if SELECTTRACE_ENABLED
110576 - if( sqlite3SelectTrace & 0x100 ){
110578 sqlite3TreeViewExprList(0, p->pOrderBy, 0, "ORDERBY");
110581 @@ -139572,12 +142290,13 @@ SQLITE_PRIVATE int sqlite3Select(
110582 p->selFlags |= SF_NoopOrderBy;
110585 - if( pParse->nErr || db->mallocFailed ){
110586 + if( pParse->nErr ){
110589 + assert( db->mallocFailed==0 );
110590 assert( p->pEList!=0 );
110591 -#if SELECTTRACE_ENABLED
110592 - if( sqlite3SelectTrace & 0x104 ){
110598 @@ -139594,15 +142313,12 @@ SQLITE_PRIVATE int sqlite3Select(
110600 if( p->selFlags & SF_UFSrcCheck ){
110601 SrcItem *p0 = &p->pSrc->a[0];
110602 - for(i=1; i<p->pSrc->nSrc; i++){
110603 - SrcItem *p1 = &p->pSrc->a[i];
110604 - if( p0->pTab==p1->pTab && 0==sqlite3_stricmp(p0->zAlias, p1->zAlias) ){
110605 - sqlite3ErrorMsg(pParse,
110606 - "target object/alias may not appear in FROM clause: %s",
110607 - p0->zAlias ? p0->zAlias : p0->pTab->zName
110608 - );
110609 - goto select_end;
110610 - }
110611 + if( sameSrcAlias(p0, p->pSrc) ){
110614 + p0->zAlias ? p0->zAlias : p0->pTab->zName
110620 @@ -139618,11 +142334,11 @@ SQLITE_PRIVATE int sqlite3Select(
110624 - assert( db->mallocFailed || pParse->nErr>0 );
110625 + assert( pParse->nErr );
110628 -#if SELECTTRACE_ENABLED
110629 - if( p->pWin && (sqlite3SelectTrace & 0x108)!=0 ){
110631 + if( p->pWin && (sqlite3TreeTrace & 0x108)!=0 ){
110635 @@ -139650,14 +142366,16 @@ SQLITE_PRIVATE int sqlite3Select(
110639 - if( (pItem->fg.jointype & JT_LEFT)!=0
110640 + if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))==JT_LEFT
110641 && sqlite3ExprImpliesNonNullRow(p->pWhere, pItem->iCursor)
110642 && OptimizationEnabled(db, SQLITE_SimplifyJoin)
110645 ("LEFT-JOIN simplifies to JOIN on term %d\n",i));
110646 pItem->fg.jointype &= ~(JT_LEFT|JT_OUTER);
110647 - unsetJoinExpr(p->pWhere, pItem->iCursor);
110648 + assert( pItem->iCursor>=0 );
110649 + unsetJoinExpr(p->pWhere, pItem->iCursor,
110650 + pTabList->a[0].fg.jointype & JT_LTORJ);
110654 @@ -139710,7 +142428,9 @@ SQLITE_PRIVATE int sqlite3Select(
110657 ("omit superfluous ORDER BY on %r FROM-clause subquery\n",i+1));
110658 - sqlite3ExprListDelete(db, pSub->pOrderBy);
110661 + pSub->pOrderBy);
110662 pSub->pOrderBy = 0;
110665 @@ -139736,7 +142456,7 @@ SQLITE_PRIVATE int sqlite3Select(
110667 && (p->selFlags & SF_ComplexResult)!=0
110668 && (pTabList->nSrc==1
110669 - || (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0)
110670 + || (pTabList->a[1].fg.jointype&(JT_OUTER|JT_CROSS))!=0)
110674 @@ -139760,9 +142480,9 @@ SQLITE_PRIVATE int sqlite3Select(
110676 if( p->pPrior ){
110678 -#if SELECTTRACE_ENABLED
110680 SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
110681 - if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
110686 @@ -139781,8 +142501,8 @@ SQLITE_PRIVATE int sqlite3Select(
110687 && OptimizationEnabled(db, SQLITE_PropagateConst)
110690 -#if SELECTTRACE_ENABLED
110691 - if( sqlite3SelectTrace & 0x100 ){
110697 @@ -139858,11 +142578,10 @@ SQLITE_PRIVATE int sqlite3Select(
110698 if( OptimizationEnabled(db, SQLITE_PushDown)
110699 && (pItem->fg.isCte==0
110700 || (pItem->u2.pCteUse->eM10d!=M10d_Yes && pItem->u2.pCteUse->nUse<2))
110701 - && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
110702 - (pItem->fg.jointype & JT_OUTER)!=0)
110703 + && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem)
110705 -#if SELECTTRACE_ENABLED
110706 - if( sqlite3SelectTrace & 0x100 ){
110710 ("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
110712 @@ -139878,18 +142597,19 @@ SQLITE_PRIVATE int sqlite3Select(
110716 - ** The subquery is implemented as a co-routine if:
110717 + ** The subquery is implemented as a co-routine if all of the following are
110723 - **
110724 - ** TODO: Are there other reasons beside (1) and (2) to use a co-routine
110725 - ** implementation?
110729 && (pTabList->nSrc==1
110730 - || (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0) /* (1) */
110731 - && (pItem->fg.isCte==0 || pItem->u2.pCteUse->eM10d!=M10d_Yes) /* (2) */
110732 + || (pTabList->a[1].fg.jointype&(JT_OUTER|JT_CROSS))!=0) /* (1) */
110733 + && (pItem->fg.isCte==0 || pItem->u2.pCteUse->eM10d!=M10d_Yes) /* (2) */
110734 + && (pTabList->a[0].fg.jointype & JT_LTORJ)==0 /* (3) */
110736 /* Implement a co-routine that will return a single row of the result
110738 @@ -139935,11 +142655,11 @@ SQLITE_PRIVATE int sqlite3Select(
110742 - int retAddr;
110744 pItem->regReturn = ++pParse->nMem;
110745 - topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn);
110747 pItem->addrFillSub = topAddr+1;
110748 + pItem->fg.isMaterialized = 1;
110749 if( pItem->fg.isCorrelated==0 ){
110752 @@ -139954,9 +142674,9 @@ SQLITE_PRIVATE int sqlite3Select(
110754 pItem->pTab->nRowLogEst = pSub->nSelectRow;
110756 - retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn);
110757 + sqlite3VdbeAddOp2(v, OP_Return, pItem->regReturn, topAddr+1);
110759 - sqlite3VdbeChangeP1(v, topAddr, retAddr);
110762 if( pItem->fg.isCte && pItem->fg.isCorrelated==0 ){
110763 CteUse *pCteUse = pItem->u2.pCteUse;
110764 @@ -139980,8 +142700,8 @@ SQLITE_PRIVATE int sqlite3Select(
110765 pHaving = p->pHaving;
110766 sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0;
110768 -#if SELECTTRACE_ENABLED
110769 - if( sqlite3SelectTrace & 0x400 ){
110772 SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
110775 @@ -140015,9 +142735,10 @@ SQLITE_PRIVATE int sqlite3Select(
110781 -#if SELECTTRACE_ENABLED
110782 - if( sqlite3SelectTrace & 0x400 ){
110788 @@ -140050,6 +142771,18 @@ SQLITE_PRIVATE int sqlite3Select(
110790 if( pDest->eDest==SRT_EphemTab ){
110791 sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pDest->iSDParm, pEList->nExpr);
110792 + if( p->selFlags & SF_NestedFrom ){
110793 + /* Delete or NULL-out result columns that will never be used */
110795 + for(ii=pEList->nExpr-1; ii>0 && pEList->a[ii].fg.bUsed==0; ii--){
110796 + sqlite3ExprDelete(db, pEList->a[ii].pExpr);
110797 + sqlite3DbFree(db, pEList->a[ii].zEName);
110798 + pEList->nExpr--;
110800 + for(ii=0; ii<pEList->nExpr; ii++){
110801 + if( pEList->a[ii].fg.bUsed==0 ) pEList->a[ii].pExpr->op = TK_NULL;
110807 @@ -140094,7 +142827,7 @@ SQLITE_PRIVATE int sqlite3Select(
110811 - p->pEList, wctrlFlags, p->nSelectRow);
110812 + p->pEList, p, wctrlFlags, p->nSelectRow);
110814 if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){
110815 p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo);
110816 @@ -140199,8 +142932,9 @@ SQLITE_PRIVATE int sqlite3Select(
110819 for(ii=0; ii<pGroupBy->nExpr; ii++){
110820 - u8 sortFlags = sSort.pOrderBy->a[ii].sortFlags & KEYINFO_ORDER_DESC;
110821 - pGroupBy->a[ii].sortFlags = sortFlags;
110823 + sortFlags = sSort.pOrderBy->a[ii].fg.sortFlags & KEYINFO_ORDER_DESC;
110824 + pGroupBy->a[ii].fg.sortFlags = sortFlags;
110826 if( sqlite3ExprListCompare(pGroupBy, sSort.pOrderBy, -1)==0 ){
110828 @@ -140269,8 +143003,8 @@ SQLITE_PRIVATE int sqlite3Select(
110830 pAggInfo->mxReg = pParse->nMem;
110831 if( db->mallocFailed ) goto select_end;
110832 -#if SELECTTRACE_ENABLED
110833 - if( sqlite3SelectTrace & 0x400 ){
110839 @@ -140358,7 +143092,8 @@ SQLITE_PRIVATE int sqlite3Select(
110843 - WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0) | distFlag, 0
110848 sqlite3ExprListDelete(db, pDistinct);
110849 @@ -140540,7 +143275,7 @@ SQLITE_PRIVATE int sqlite3Select(
110853 - if( eDist!=WHERE_DISTINCT_NOOP ){
110855 struct AggInfo_func *pF = &pAggInfo->aFunc[0];
110856 fixDistinctOpenEph(pParse, eDist, pF->iDistinct, pF->iDistAddr);
110858 @@ -140656,7 +143391,7 @@ SQLITE_PRIVATE int sqlite3Select(
110862 - pDistinct, minMaxFlag|distFlag, 0);
110867 @@ -140664,8 +143399,10 @@ SQLITE_PRIVATE int sqlite3Select(
110871 - struct AggInfo_func *pF = &pAggInfo->aFunc[0];
110872 - fixDistinctOpenEph(pParse, eDist, pF->iDistinct, pF->iDistAddr);
110873 + struct AggInfo_func *pF = pAggInfo->aFunc;
110875 + fixDistinctOpenEph(pParse, eDist, pF->iDistinct, pF->iDistAddr);
110880 @@ -140713,7 +143450,7 @@ SQLITE_PRIVATE int sqlite3Select(
110883 assert( db->mallocFailed==0 || db->mallocFailed==1 );
110884 - pParse->nErr += db->mallocFailed;
110885 + assert( db->mallocFailed==0 || pParse->nErr!=0 );
110886 sqlite3ExprListDelete(db, pMinMaxOrderBy);
110888 if( pAggInfo && !db->mallocFailed ){
110889 @@ -140732,9 +143469,9 @@ select_end:
110893 -#if SELECTTRACE_ENABLED
110896 - if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
110901 @@ -140999,9 +143736,7 @@ SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){
110905 - if( pParse->disableTriggers ){
110906 - return 0;
110907 - }
110908 + assert( pParse->disableTriggers==0 );
110909 pTmpSchema = pParse->db->aDb[1].pSchema;
110910 p = sqliteHashFirst(&pTmpSchema->trigHash);
110911 pList = pTab->pTrigger;
110912 @@ -141014,11 +143749,10 @@ SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){
110914 pTrig->pNext = pList;
110916 - }else if( pTrig->op==TK_RETURNING
110917 + }else if( pTrig->op==TK_RETURNING ){
110919 - && pParse->db->pVtabCtx==0
110920 + assert( pParse->db->pVtabCtx==0 );
110922 - ){
110923 assert( pParse->bReturning );
110924 assert( &(pParse->u1.pReturning->retTrig) == pTrig );
110925 pTrig->table = pTab->zName;
110926 @@ -141301,6 +144035,23 @@ SQLITE_PRIVATE void sqlite3FinishTrigger(
110931 + ** are read-only, and the trigger makes a change to a shadow table,
110932 + ** then raise an error - do not allow the trigger to be created. */
110933 + if( sqlite3ReadOnlyShadowTables(db) ){
110935 + for(pStep=pTrig->step_list; pStep; pStep=pStep->pNext){
110936 + if( pStep->zTarget!=0
110937 + && sqlite3ShadowTableName(db, pStep->zTarget)
110941 + pTrig->zName, pStep->zTarget);
110950 @@ -141393,6 +144144,7 @@ static TriggerStep *triggerStepAllocate(
110951 sqlite3 *db = pParse->db;
110954 + if( pParse->nErr ) return 0;
110955 pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1);
110958 @@ -141463,7 +144215,7 @@ SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(
110962 - SrcList *pFrom,
110963 + SrcList *pFrom, /* FROM clause for an UPDATE-FROM, or NULL */
110967 @@ -141676,13 +144428,22 @@ static int checkColumnOverlap(IdList *pIdList, ExprList *pEList){
110974 +static int tempTriggersExist(sqlite3 *db){
110975 + if( NEVER(db->aDb[1].pSchema==0) ) return 0;
110976 + if( sqliteHashFirst(&db->aDb[1].pSchema->trigHash)==0 ) return 0;
110986 -SQLITE_PRIVATE Trigger *sqlite3TriggersExist(
110991 @@ -141745,6 +144506,22 @@ exit_triggers_exist:
111003 + if( (pTab->pTrigger==0 && !tempTriggersExist(pParse->db))
111004 + || pParse->disableTriggers
111013 ** Convert the pStep->zTarget string into a SrcList and return a pointer
111014 @@ -141774,6 +144551,14 @@ SQLITE_PRIVATE SrcList *sqlite3TriggerStepSrc(
111016 if( pStep->pFrom ){
111017 SrcList *pDup = sqlite3SrcListDup(db, pStep->pFrom, 0);
111018 + if( pDup && pDup->nSrc>1 && !IN_RENAME_OBJECT ){
111029 @@ -141829,7 +144614,7 @@ static ExprList *sqlite3ExpandReturning(
111030 if( !db->mallocFailed ){
111031 struct ExprList_item *pItem = &pNew->a[pNew->nExpr-1];
111032 pItem->zEName = sqlite3DbStrDup(db, pTab->aCol[jj].zCnName);
111033 - pItem->eEName = ENAME_NAME;
111034 + pItem->fg.eEName = ENAME_NAME;
111038 @@ -141838,7 +144623,7 @@ static ExprList *sqlite3ExpandReturning(
111039 if( !db->mallocFailed && ALWAYS(pList->a[i].zEName!=0) ){
111040 struct ExprList_item *pItem = &pNew->a[pNew->nExpr-1];
111041 pItem->zEName = sqlite3DbStrDup(db, pList->a[i].zEName);
111042 - pItem->eEName = pList->a[i].eEName;
111043 + pItem->fg.eEName = pList->a[i].fg.eEName;
111047 @@ -141865,6 +144650,7 @@ static void codeReturningTrigger(
111050 assert( pParse->bReturning );
111051 + assert( db->pParse==pParse );
111052 pReturning = pParse->u1.pReturning;
111053 assert( pTrigger == &(pReturning->retTrig) );
111055 @@ -141875,12 +144661,13 @@ static void codeReturningTrigger(
111057 sFrom.a[0].iCursor = -1;
111059 - if( db->mallocFailed==0 && pParse->nErr==0 ){
111060 + if( pParse->nErr==0 ){
111061 + assert( db->mallocFailed==0 );
111064 sqlite3ExprListDelete(db, sSelect.pEList);
111065 pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab);
111066 - if( pNew ){
111067 + if( !db->mallocFailed ){
111070 if( pReturning->nRetCol==0 ){
111071 @@ -141892,7 +144679,9 @@ static void codeReturningTrigger(
111073 pParse->eTriggerOp = pTrigger->op;
111074 pParse->pTriggerTab = pTab;
111075 - if( sqlite3ResolveExprListNames(&sNC, pNew)==SQLITE_OK ){
111077 + && ALWAYS(!db->mallocFailed)
111080 int nCol = pNew->nExpr;
111081 int reg = pParse->nMem+1;
111082 @@ -141900,16 +144689,20 @@ static void codeReturningTrigger(
111083 pReturning->iRetReg = reg;
111085 Expr *pCol = pNew->a[i].pExpr;
111086 + assert( pCol!=0 ); /* Due to !db->mallocFailed ~9 lines above */
111093 sqlite3VdbeAddOp2(v, OP_NewRowid, pReturning->iRetCur, reg+i+1);
111094 sqlite3VdbeAddOp3(v, OP_Insert, pReturning->iRetCur, reg+i, reg+i+1);
111096 - sqlite3ExprListDelete(db, pNew);
111097 - pParse->eTriggerOp = 0;
111098 - pParse->pTriggerTab = 0;
111100 + sqlite3ExprListDelete(db, pNew);
111101 + pParse->eTriggerOp = 0;
111102 + pParse->pTriggerTab = 0;
111106 @@ -142051,8 +144844,8 @@ static TriggerPrg *codeRowTrigger(
111108 NameContext sNC; /* Name context for sub-vdbe */
111109 SubProgram *pProgram = 0; /* Sub-vdbe for trigger program */
111110 - Parse *pSubParse; /* Parse context for sub-vdbe */
111112 + Parse sSubParse; /* Parse context for sub-vdbe */
111114 assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) );
111115 assert( pTop->pVdbe );
111116 @@ -142074,19 +144867,17 @@ static TriggerPrg *codeRowTrigger(
111119 ** trigger sub-program. */
111120 - pSubParse = sqlite3StackAllocZero(db, sizeof(Parse));
111121 - if( !pSubParse ) return 0;
111122 + sqlite3ParseObjectInit(&sSubParse, db);
111124 - sNC.pParse = pSubParse;
111125 - pSubParse->db = db;
111126 - pSubParse->pTriggerTab = pTab;
111127 - pSubParse->pToplevel = pTop;
111128 - pSubParse->zAuthContext = pTrigger->zName;
111129 - pSubParse->eTriggerOp = pTrigger->op;
111130 - pSubParse->nQueryLoop = pParse->nQueryLoop;
111131 - pSubParse->disableVtab = pParse->disableVtab;
111132 -
111133 - v = sqlite3GetVdbe(pSubParse);
111137 + sSubParse.zAuthContext = pTrigger->zName;
111138 + sSubParse.eTriggerOp = pTrigger->op;
111139 + sSubParse.nQueryLoop = pParse->nQueryLoop;
111140 + sSubParse.disableVtab = pParse->disableVtab;
111145 pTrigger->zName, onErrorText(orconf),
111146 @@ -142112,14 +144903,14 @@ static TriggerPrg *codeRowTrigger(
111147 if( db->mallocFailed==0
111150 - iEndTrigger = sqlite3VdbeMakeLabel(pSubParse);
111151 - sqlite3ExprIfFalse(pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL);
111155 sqlite3ExprDelete(db, pWhen);
111158 /* Code the trigger program into the sub-vdbe. */
111159 - codeTriggerProgram(pSubParse, pTrigger->step_list, orconf);
111160 + codeTriggerProgram(&sSubParse, pTrigger->step_list, orconf);
111162 /* Insert an OP_Halt at the end of the sub-program. */
111164 @@ -142127,23 +144918,24 @@ static TriggerPrg *codeRowTrigger(
111167 VdbeComment((v, "End: %s.%s", pTrigger->zName, onErrorText(orconf)));
111170 - transferParseError(pParse, pSubParse);
111171 - if( db->mallocFailed==0 && pParse->nErr==0 ){
111172 + if( pParse->nErr==0 ){
111173 + assert( db->mallocFailed==0 );
111174 pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg);
111176 - pProgram->nMem = pSubParse->nMem;
111177 - pProgram->nCsr = pSubParse->nTab;
111178 + pProgram->nMem = sSubParse.nMem;
111179 + pProgram->nCsr = sSubParse.nTab;
111180 pProgram->token = (void *)pTrigger;
111181 - pPrg->aColmask[0] = pSubParse->oldmask;
111182 - pPrg->aColmask[1] = pSubParse->newmask;
111183 + pPrg->aColmask[0] = sSubParse.oldmask;
111184 + pPrg->aColmask[1] = sSubParse.newmask;
111190 - assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg );
111191 - sqlite3ParserReset(pSubParse);
111192 - sqlite3StackFree(db, pSubParse);
111193 -
111199 @@ -142176,6 +144968,7 @@ static TriggerPrg *getRowTrigger(
111203 + pParse->db->errByteOffset = -1;
111207 @@ -142198,7 +144991,7 @@ SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(
111211 - assert( pPrg || pParse->nErr || pParse->db->mallocFailed );
111212 + assert( pPrg || pParse->nErr );
111215 ** is a pointer to the sub-vdbe containing the trigger program. */
111216 @@ -142716,9 +145509,11 @@ SQLITE_PRIVATE void sqlite3Update(
111219 db = pParse->db;
111220 - if( pParse->nErr || db->mallocFailed ){
111221 + assert( db->pParse==pParse );
111222 + if( pParse->nErr ){
111225 + assert( db->mallocFailed==0 );
111229 @@ -142743,6 +145538,14 @@ SQLITE_PRIVATE void sqlite3Update(
111236 + sqlite3TreeViewUpdate(pParse->pWith, pTabList, pChanges, pWhere,
111242 ** in the change-list. Otherwise, set it to 0. There cannot be a FROM
111244 @@ -143090,7 +145893,7 @@ SQLITE_PRIVATE void sqlite3Update(
111245 if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){
111248 - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags,iIdxCur);
111252 /* A one-pass strategy that might update more than one row may not
111253 @@ -143387,7 +146190,7 @@ SQLITE_PRIVATE void sqlite3Update(
111257 - VdbeCoverageNeverTaken(v);
111262 @@ -143490,9 +146293,7 @@ SQLITE_PRIVATE void sqlite3Update(
111266 - sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1);
111267 - sqlite3VdbeSetNumCols(v, 1);
111268 - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC);
111273 @@ -143614,7 +146415,9 @@ static void updateVirtualTable(
111274 regRowid = ++pParse->nMem;
111277 - pWInfo = sqlite3WhereBegin(pParse, pSrc,pWhere,0,0,WHERE_ONEPASS_DESIRED,0);
111284 @@ -144393,6 +147196,7 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum(
111292 @@ -145241,7 +148045,6 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable…
111296 - char *zErr = 0;
111300 @@ -145260,9 +148063,9 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable…
111301 pTab = pCtx->pTab;
111304 - memset(&sParse, 0, sizeof(sParse));
111305 + sqlite3ParseObjectInit(&sParse, db);
111307 - sParse.db = db;
111310 ** schema. Nevertheless, defend against that (turn off db->init.busy)
111312 @@ -145270,11 +148073,12 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTab…
111313 initBusy = db->init.busy;
111314 db->init.busy = 0;
111316 - if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr)
111317 - && sParse.pNewTable
111318 - && !db->mallocFailed
111321 + && ALWAYS(!db->mallocFailed)
111325 if( !pTab->aCol ){
111328 @@ -145304,8 +148108,9 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable…
111330 pCtx->bDeclared = 1;
111332 - sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr);
111333 - sqlite3DbFree(db, zErr);
111334 + sqlite3ErrorWithMsg(db, SQLITE_ERROR,
111336 + sqlite3DbFree(db, sParse.zErrMsg);
111340 @@ -145314,7 +148119,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable…
111343 sqlite3DeleteTable(db, sParse.pNewTable);
111344 - sqlite3ParserReset(&sParse);
111346 db->init.busy = initBusy;
111349 @@ -145834,6 +148639,28 @@ typedef struct WhereLoopBuilder WhereLoopBuilder;
111378 @@ -145866,6 +148693,8 @@ struct WhereLevel {
111387 @@ -145924,10 +148753,12 @@ struct WhereLoop {
111391 - u8 needFree; /* True if sqlite3_free(idxStr) is needed */
111401 @@ -146071,7 +148902,7 @@ struct WhereTerm {
111405 -#define TERM_OR_OK 0x0040 /* Used during OR-clause processing */
111406 +#define TERM_OK 0x0040 /* Used during OR-clause processing */
111410 @@ -146084,6 +148915,7 @@ struct WhereTerm {
111414 +#define TERM_SLICE 0x8000 /* One slice of a row-value/vector comparison */
111418 @@ -146094,11 +148926,11 @@ struct WhereScan {
111422 + int k; /* Resume scanning at this->pWC->a[this->k] */
111427 - unsigned char iEquiv; /* Next unused slot in aiCur[] and aiColumn[] */
111428 - u32 opMask; /* Acceptable operators */
111429 - int k; /* Resume scanning at this->pWC->a[this->k] */
111431 i16 aiColumn[11]; /* Corresponding column number in the eq-class */
111433 @@ -146122,6 +148954,7 @@ struct WhereClause {
111437 + int nBase; /* Number of terms through the last non-Virtual */
111441 @@ -146179,11 +149012,6 @@ struct WhereMaskSet {
111445 -/*
111446 -** Initialize a WhereMaskSet object
111447 -*/
111448 -#define initMaskSet(P) (P)->n=0
111449 -
111453 @@ -146191,7 +149019,6 @@ struct WhereMaskSet {
111457 - ExprList *pOrderBy; /* ORDER BY clause */
111461 @@ -146259,6 +149086,9 @@ struct WhereInfo {
111471 @@ -146278,6 +149108,7 @@ struct WhereInfo {
111479 @@ -146303,6 +149134,8 @@ SQLITE_PRIVATE WhereTerm *sqlite3WhereFindTerm(
111488 @@ -146312,8 +149145,14 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
111503 @@ -146333,11 +149172,17 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
111521 @@ -146374,8 +149219,9 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, SrcItem*, WhereClause…
111522 #define WO_AND 0x0400 /* Two or more AND-connected terms */
111525 +#define WO_ROWVAL 0x2000 /* A row-value term */
111527 -#define WO_ALL 0x1fff /* Mask of all possible WO_* values */
111529 #define WO_SINGLE 0x01ff /* Mask of all non-compound WO_* values */
111532 @@ -146406,6 +149252,9 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, SrcItem*, WhereClause…
111534 #define WHERE_IN_SEEKSCAN 0x00100000 /* Seek-scan optimization for IN */
111536 +#define WHERE_BLOOMFILTER 0x00400000 /* Consider using a Bloom-filter */
111542 @@ -146568,19 +149417,27 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
111546 - const char *zRangeOp;
111549 + const Table *pTab = pItem->pTab;
111550 + const char *zRowid = pTab->iPKey>=0 ? pTab->aCol[pTab->iPKey].zCnName:
111557 - zRangeOp = "=";
111560 - zRangeOp = ">? AND rowid<";
111564 - zRangeOp = ">";
111568 - zRangeOp = "<";
111571 - sqlite3_str_appendf(&str,
111572 - " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp);
111577 @@ -146588,6 +149445,9 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
111578 pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr);
111581 + if( pItem->fg.jointype & JT_LEFT ){
111582 + sqlite3_str_appendf(&str, " LEFT-JOIN");
111585 if( pLoop->nOut>=10 ){
111587 @@ -146603,6 +149463,56 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
111597 +** required and this routine is a no-op.
111608 + SrcItem *pItem = &pWInfo->pTabList->a[pLevel->iFrom];
111609 + Vdbe *v = pParse->pVdbe; /* VM being constructed */
111610 + sqlite3 *db = pParse->db; /* Database handle */
111617 + sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH);
111620 + pLoop = pLevel->pWLoop;
111621 + if( pLoop->wsFlags & WHERE_IPK ){
111622 + const Table *pTab = pItem->pTab;
111623 + if( pTab->iPKey>=0 ){
111624 + sqlite3_str_appendf(&str, "%s=?", pTab->aCol[pTab->iPKey].zCnName);
111629 + for(i=pLoop->nSkip; i<pLoop->u.btree.nEq; i++){
111630 + const char *z = explainIndexColumnName(pLoop->u.btree.pIndex, i);
111631 + if( i>pLoop->nSkip ) sqlite3_str_append(&str, " AND ", 5);
111638 + pParse->addrExplain, 0, zMsg,P4_DYNAMIC);
111644 @@ -146681,7 +149591,7 @@ static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
111647 while( (pTerm->wtFlags & TERM_CODED)==0
111648 - && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
111649 + && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_OuterON))
111650 && (pLevel->notReady & pTerm->prereqAll)==0
111652 if( nLoop && (pTerm->wtFlags & TERM_LIKE)!=0 ){
111653 @@ -146942,16 +149852,22 @@ static int codeEqualityTerm(
111654 if( !ExprUseXSelect(pX) || pX->x.pSelect->pEList->nExpr==1 ){
111657 - sqlite3 *db = pParse->db;
111658 - pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
111659 -
111660 - if( !db->mallocFailed ){
111661 - aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
111662 + Expr *pExpr = pTerm->pExpr;
111663 + if( pExpr->iTable==0 || !ExprHasProperty(pExpr, EP_Subrtn) ){
111664 + sqlite3 *db = pParse->db;
111666 + if( !db->mallocFailed ){
111667 + aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
111669 + pExpr->iTable = iTab;
111671 + sqlite3ExprDelete(db, pX);
111673 + int n = sqlite3ExprVectorSize(pX->pLeft);
111674 + aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*MAX(nEq,n));
111676 - pTerm->pExpr->iTable = iTab;
111678 - sqlite3ExprDelete(db, pX);
111679 - pX = pTerm->pExpr;
111684 @@ -146974,8 +149890,9 @@ static int codeEqualityTerm(
111685 i = pLevel->u.in.nIn;
111686 pLevel->u.in.nIn += nEq;
111687 pLevel->u.in.aInLoop =
111688 - sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop,
111689 - sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
111690 + sqlite3WhereRealloc(pTerm->pWC->pWInfo,
111691 + pLevel->u.in.aInLoop,
111692 + sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn);
111693 pIn = pLevel->u.in.aInLoop;
111696 @@ -147126,6 +150043,7 @@ static int codeAllEqualityTerms(
111698 VdbeComment((v, "begin skip-scan on %s", pIdx->zName));
111700 + assert( pLevel->addrSkip==0 );
111701 pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLT:OP_SeekGT),
111704 @@ -147158,6 +150076,9 @@ static int codeAllEqualityTerms(
111710 + pTerm = pLoop->aLTerm[j];
111711 if( pTerm->eOperator & WO_IN ){
111712 if( pTerm->pExpr->flags & EP_xIsSelect ){
111714 @@ -147172,7 +150093,8 @@ static int codeAllEqualityTerms(
111715 sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk);
111718 - if( pParse->db->mallocFailed==0 && pParse->nErr==0 ){
111719 + if( pParse->nErr==0 ){
111720 + assert( pParse->db->mallocFailed==0 );
111724 @@ -147362,7 +150284,7 @@ static void codeCursorHint(
111727 pWC = &pWInfo->sWC;
111728 - for(i=0; i<pWC->nTerm; i++){
111729 + for(i=0; i<pWC->nBase; i++){
111730 pTerm = &pWC->a[i];
111731 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
111732 if( pTerm->prereqAll & pLevel->notReady ) continue;
111733 @@ -147391,8 +150313,8 @@ static void codeCursorHint(
111735 if( pTabItem->fg.jointype & JT_LEFT ){
111736 Expr *pExpr = pTerm->pExpr;
111737 - if( !ExprHasProperty(pExpr, EP_FromJoin)
111738 - || pExpr->iRightJoinTable!=pTabItem->iCursor
111740 + || pExpr->w.iJoin!=pTabItem->iCursor
111744 @@ -147400,7 +150322,7 @@ static void codeCursorHint(
111748 - if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) continue;
111749 + if( ExprHasProperty(pTerm->pExpr, EP_OuterON) ) continue;
111752 /* All terms in pWLoop->aLTerm[] except pEndRange are used to initialize
111753 @@ -147448,13 +150370,21 @@ static void codeCursorHint(
111759 ** However, if the scan currently being coded is a branch of an OR-loop and
111760 -** the statement currently being coded is a SELECT, then P3 of OP_DeferredSeek
111761 -** is set to iIdxCur and P4 is set to point to an array of integers
111762 -** containing one entry for each column of the table cursor iCur is open
111763 -** on. For each table column, if the column is the i'th column of the
111764 -** index, then the corresponding array entry is set to (i+1). If the column
111765 -** does not appear in the index at all, the array entry is set to 0.
111781 @@ -147470,7 +150400,7 @@ static void codeDeferredSeek(
111783 pWInfo->bDeferredSeek = 1;
111785 - if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)
111786 + if( (pWInfo->wctrlFlags & (WHERE_OR_SUBCLAUSE|WHERE_RIGHT_JOIN))
111787 && DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask)
111790 @@ -147564,12 +150494,12 @@ static void preserveExpr(IdxExprTrans *pTrans, Expr *pExpr){
111792 IdxExprTrans *pX = p->u.pIdxTrans;
111793 if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){
111796 pExpr->affExpr = sqlite3ExprAffinity(pExpr);
111797 pExpr->op = TK_COLUMN;
111798 pExpr->iTable = pX->iIdxCur;
111799 pExpr->iColumn = pX->iIdxCol;
111800 - testcase( ExprHasProperty(pExpr, EP_Skip) );
111803 pExpr->y.pTab = 0;
111804 @@ -147693,6 +150623,68 @@ static void whereApplyPartialIndexConstraints(
111813 +** inner-loop Bloom filters, then evaluate those filters now, before the
111819 +** WhereLevel.regFilter set. If an inner-loop Bloom filter is checked,
111826 + int iLevel, /* Which level of pWInfo->a[] should be coded */
111830 + while( ++iLevel < pWInfo->nLevel ){
111831 + WhereLevel *pLevel = &pWInfo->a[iLevel];
111832 + WhereLoop *pLoop = pLevel->pWLoop;
111833 + if( pLevel->regFilter==0 ) continue;
111834 + if( pLevel->pWLoop->nSkip ) continue;
111835 + /* ,--- Because sqlite3ConstructBloomFilter() has will not have set
111836 + ** vvvvv--' pLevel->regFilter if this were true. */
111837 + if( NEVER(pLoop->prereq & notReady) ) continue;
111838 + assert( pLevel->addrBrk==0 );
111839 + pLevel->addrBrk = addrNxt;
111840 + if( pLoop->wsFlags & WHERE_IPK ){
111841 + WhereTerm *pTerm = pLoop->aLTerm[0];
111844 + assert( pTerm->pExpr!=0 );
111845 + testcase( pTerm->wtFlags & TERM_VIRTUAL );
111848 + sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter,
111850 + VdbeCoverage(pParse->pVdbe);
111852 + u16 nEq = pLoop->u.btree.nEq;
111856 + assert( pLoop->wsFlags & WHERE_INDEXED );
111857 + assert( (pLoop->wsFlags & WHERE_COLUMN_IN)==0 );
111860 + sqlite3DbFree(pParse->db, zStartAff);
111861 + sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter,
111863 + VdbeCoverage(pParse->pVdbe);
111865 + pLevel->regFilter = 0;
111866 + pLevel->addrBrk = 0;
111871 ** Generate code for the start of the iLevel-th loop in the WHERE clause
111873 @@ -147763,7 +150755,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
111877 - assert( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)
111878 + assert( (pWInfo->wctrlFlags & (WHERE_OR_SUBCLAUSE|WHERE_RIGHT_JOIN))
111879 || pLevel->iFrom>0 || (pTabItem[0].fg.jointype & JT_LEFT)==0
111881 if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){
111882 @@ -147774,7 +150766,10 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
111886 - for(j=iLevel; j>0 && pWInfo->a[j].iLeftJoin==0; j--){}
111887 + for(j=iLevel; j>0; j--){
111888 + if( pWInfo->a[j].iLeftJoin ) break;
111889 + if( pWInfo->a[j].pRJ ) break;
111891 addrHalt = pWInfo->a[j].addrBrk;
111893 /* Special case of a FROM clause subquery implemented as a co-routine */
111894 @@ -147795,7 +150790,6 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
111897 int nConstraint = pLoop->nLTerm;
111898 - int iIn; /* Counter for IN constraints */
111901 addrNotFound = pLevel->addrBrk;
111902 @@ -147804,11 +150798,27 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
111903 pTerm = pLoop->aLTerm[j];
111905 if( pTerm->eOperator & WO_IN ){
111906 - codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget);
111907 - addrNotFound = pLevel->addrNxt;
111908 + if( SMASKBIT32(j) & pLoop->u.vtab.mHandleIn ){
111909 + int iTab = pParse->nTab++;
111910 + int iCache = ++pParse->nMem;
111911 + sqlite3CodeRhsOfIN(pParse, pTerm->pExpr, iTab);
111915 + addrNotFound = pLevel->addrNxt;
111918 Expr *pRight = pTerm->pExpr->pRight;
111920 + if( pTerm->eMatchOp==SQLITE_INDEX_CONSTRAINT_OFFSET
111921 + && pLoop->u.vtab.bOmitOffset
111923 + assert( pTerm->eOperator==WO_AUX );
111924 + assert( pWInfo->pLimit!=0 );
111925 + assert( pWInfo->pLimit->iOffset>0 );
111926 + sqlite3VdbeAddOp2(v, OP_Integer, 0, pWInfo->pLimit->iOffset);
111931 sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg);
111932 @@ -147825,44 +150835,54 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
111933 pLevel->op = pWInfo->eOnePass ? OP_Noop : OP_VNext;
111934 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
111935 assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 );
111936 - if( pLoop->wsFlags & WHERE_IN_ABLE ){
111937 - iIn = pLevel->u.in.nIn;
111938 - }else{
111939 - iIn = 0;
111940 - }
111941 - for(j=nConstraint-1; j>=0; j--){
111944 pTerm = pLoop->aLTerm[j];
111945 - if( (pTerm->eOperator & WO_IN)!=0 ) iIn--;
111946 if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){
111948 - }else if( (pTerm->eOperator & WO_IN)!=0
111949 - && sqlite3ExprVectorSize(pTerm->pExpr->pLeft)==1
111952 + if( (pTerm->eOperator & WO_IN)!=0
111953 + && (SMASKBIT32(j) & pLoop->u.vtab.mHandleIn)==0
111954 + && !db->mallocFailed
111959 + int iIn; /* IN loop corresponding to the j-th constraint */
111964 - ** encoding of the value in the register, so it *must* be reloaded. */
111965 - assert( pLevel->u.in.aInLoop!=0 || db->mallocFailed );
111966 - if( !db->mallocFailed ){
111967 - assert( iIn>=0 && iIn<pLevel->u.in.nIn );
111970 + for(iIn=0; ALWAYS(iIn<pLevel->u.in.nIn); iIn++){
111971 pOp = sqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[iIn].addrInTop);
111972 - assert( pOp->opcode==OP_Column || pOp->opcode==OP_Rowid );
111973 - assert( pOp->opcode!=OP_Column || pOp->p3==iReg+j+2 );
111974 - assert( pOp->opcode!=OP_Rowid || pOp->p2==iReg+j+2 );
111975 - testcase( pOp->opcode==OP_Rowid );
111976 - sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3);
111977 + if( (pOp->opcode==OP_Column && pOp->p3==iReg+j+2)
111978 + || (pOp->opcode==OP_Rowid && pOp->p2==iReg+j+2)
111980 + testcase( pOp->opcode==OP_Rowid );
111981 + sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3);
111987 - ** the IN constraint is not satisfied */
111991 - assert( pCompare!=0 || db->mallocFailed );
111992 - if( pCompare ){
111993 - pCompare->pLeft = pTerm->pExpr->pLeft;
111994 + if( !db->mallocFailed ){
111995 + int iFld = pTerm->u.x.iField;
111996 + Expr *pLeft = pTerm->pExpr->pLeft;
111999 + assert( pLeft->op==TK_VECTOR );
112001 + assert( iFld<=pLeft->x.pList->nExpr );
112002 + pCompare->pLeft = pLeft->x.pList->a[iFld-1].pExpr;
112004 + pCompare->pLeft = pLeft;
112006 pCompare->pRight = pRight = sqlite3Expr(db, TK_REGISTER, 0);
112008 pRight->iTable = iReg+j+2;
112009 @@ -147871,11 +150891,11 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112012 pCompare->pLeft = 0;
112013 - sqlite3ExprDelete(db, pCompare);
112015 + sqlite3ExprDelete(db, pCompare);
112018 - assert( iIn==0 || db->mallocFailed );
112022 ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems
112023 @@ -147903,6 +150923,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112026 addrNxt = pLevel->addrNxt;
112027 + if( pLevel->regFilter ){
112028 + sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt,
112035 pLevel->op = OP_Noop;
112036 @@ -148228,6 +151254,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112038 VdbeComment((v, "NULL-scan pass ctr"));
112040 + if( pLevel->regFilter ){
112041 + sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt,
112049 @@ -148364,7 +151396,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112052 omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0
112053 - && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0;
112054 + && (pWInfo->wctrlFlags & (WHERE_OR_SUBCLAUSE|WHERE_RIGHT_JOIN))==0;
112057 }else if( HasRowid(pIdx->pTable) ){
112058 @@ -148398,7 +151430,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112062 - if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){
112063 + if( (pWInfo->wctrlFlags & (WHERE_OR_SUBCLAUSE|WHERE_RIGHT_JOIN))==0 ){
112067 @@ -148417,7 +151449,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112069 ** The OR-optimization doesn't work for the right hand table of
112071 - assert( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 );
112072 + assert( (pWInfo->wctrlFlags & (WHERE_OR_SUBCLAUSE|WHERE_RIGHT_JOIN))==0 );
112076 @@ -148555,7 +151587,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112080 - ** Then for every term xN, evaluate as the subexpression: xN AND z
112085 @@ -148567,6 +151599,20 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112090 + ** 2022-02-04: Do not push down slices of a row-value comparison.
112092 + ** the initialization of the right-hand operand of the vector comparison
112096 + ** 2022-03-03: Do not push down expressions that involve subqueries.
112097 + ** The subquery might get coded as a subroutine. Any table-references
112098 + ** in the subquery might be resolved to index-references for the index on
112101 + ** index-references will not work. tag-20220303a
112104 if( pWC->nTerm>1 ){
112106 @@ -148575,9 +151621,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112107 if( &pWC->a[iTerm] == pTerm ) continue;
112108 testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL );
112109 testcase( pWC->a[iTerm].wtFlags & TERM_CODED );
112110 - if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue;
112111 + testcase( pWC->a[iTerm].wtFlags & TERM_SLICE );
112112 + if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED|TERM_SLICE))!=0 ){
112115 if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue;
112116 - testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO );
112117 + if( ExprHasProperty(pExpr, EP_Subquery) ) continue; /* tag-20220303a */
112118 pExpr = sqlite3ExprDup(db, pExpr, 0);
112121 @@ -148604,7 +151653,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112125 - && !ExprHasProperty(pOrExpr, EP_FromJoin)
112128 pDelete = pOrExpr = sqlite3ExprDup(db, pOrExpr, 0);
112129 if( db->mallocFailed ){
112130 @@ -148618,9 +151667,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112133 WHERETRACE(0xffff, ("Subplan for OR-clause:\n"));
112134 - pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0,
112137 - assert( pSubWInfo || pParse->nErr || db->mallocFailed );
112138 + assert( pSubWInfo || pParse->nErr );
112142 @@ -148742,6 +151791,14 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112143 sqlite3VdbeGoto(v, pLevel->addrBrk);
112148 + ** loop. The byte-code formatter will use that P2 value as a hint to
112150 + ** See tag-20220407a in vdbe.c and shell.c */
112151 + assert( pLevel->op==OP_Return );
112152 + pLevel->p2 = sqlite3VdbeCurrentAddr(v);
112154 if( pWInfo->nLevel>1 ){ sqlite3StackFree(db, pOrTab); }
112157 @@ -148804,10 +151861,22 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112159 pE = pTerm->pExpr;
112161 - if( (pTabItem->fg.jointype&JT_LEFT) && !ExprHasProperty(pE,EP_FromJoin) ){
112162 - continue;
112163 + if( pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){
112166 + ** join processing. tag-20220513a */
112168 + }else if( (pTabItem->fg.jointype & JT_LEFT)==JT_LEFT
112172 + Bitmask m = sqlite3WhereGetMask(&pWInfo->sMaskSet, pE->w.iJoin);
112173 + if( m & pLevel->notReady ){
112179 -
112180 if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
112183 @@ -148859,14 +151928,14 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112187 - for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
112188 + for(pTerm=pWC->a, j=pWC->nBase; j>0; j--, pTerm++){
112191 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
112192 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) continue;
112193 if( (pTerm->eOperator & WO_EQUIV)==0 ) continue;
112194 if( pTerm->leftCursor!=iCur ) continue;
112195 - if( pTabItem->fg.jointype & JT_LEFT ) continue;
112196 + if( pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ) continue;
112197 pE = pTerm->pExpr;
112200 @@ -148874,7 +151943,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112201 sqlite3WhereTermPrint(pTerm, pWC->nTerm-j);
112204 - assert( !ExprHasProperty(pE, EP_FromJoin) );
112206 assert( (pTerm->prereqRight & pLevel->notReady)!=0 );
112207 assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
112208 pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.x.leftColumn, notReady,
112209 @@ -148897,6 +151966,47 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112210 pAlt->wtFlags |= TERM_CODED;
112216 + if( pLevel->pRJ ){
112221 + WhereRightJoin *pRJ = pLevel->pRJ;
112223 + /* pTab is the right-hand table of the RIGHT JOIN. Generate code that
112228 + pTab = pWInfo->pTabList->a[pLevel->iFrom].pTab;
112231 + sqlite3ExprCodeGetColumnOfTable(v, pTab, pLevel->iTabCur, -1, r+1);
112236 + nPk = pPk->nKeyCol;
112239 + int iCol = pPk->aiColumn[iPk];
112243 + jmp1 = sqlite3VdbeAddOp4Int(v, OP_Found, pRJ->iMatch, 0, r+1, nPk);
112245 + VdbeComment((v, "match against %s", pTab->zName));
112247 + sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pRJ->iMatch, r, r+1, nPk);
112248 + sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pRJ->regBloom, 0, r+1, nPk);
112257 @@ -148904,7 +152014,31 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112258 pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
112259 sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
112261 - for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){
112262 + if( pLevel->pRJ==0 ){
112267 + if( pLevel->pRJ ){
112270 + ** be in-line with the rest of the code. But at the end, a separate
112274 + WhereRightJoin *pRJ = pLevel->pRJ;
112275 + sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pRJ->regReturn);
112276 + pRJ->addrSubrtn = sqlite3VdbeCurrentAddr(v);
112277 + assert( pParse->withinRJSubrtn < 255 );
112278 + pParse->withinRJSubrtn++;
112283 + ** appropriate WHERE clause constraint checks. tag-20220513a.
112286 + for(pTerm=pWC->a, j=0; j<pWC->nBase; j++, pTerm++){
112287 testcase( pTerm->wtFlags & TERM_VIRTUAL );
112288 testcase( pTerm->wtFlags & TERM_CODED );
112289 if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
112290 @@ -148912,6 +152046,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112291 assert( pWInfo->untestedTerms );
112294 + if( pTabItem->fg.jointype & JT_LTORJ ) continue;
112295 assert( pTerm->pExpr );
112296 sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
112297 pTerm->wtFlags |= TERM_CODED;
112298 @@ -148932,6 +152067,96 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
112299 return pLevel->notReady;
112303 +** Generate the code for the loop that finds all non-matched terms
112311 + Parse *pParse = pWInfo->pParse;
112312 + Vdbe *v = pParse->pVdbe;
112313 + WhereRightJoin *pRJ = pLevel->pRJ;
112315 + WhereClause *pWC = &pWInfo->sWC;
112317 + WhereLoop *pLoop = pLevel->pWLoop;
112318 + SrcItem *pTabItem = &pWInfo->pTabList->a[pLevel->iFrom];
112323 + ExplainQueryPlan((pParse, 1, "RIGHT-JOIN %s", pTabItem->pTab->zName));
112324 + sqlite3VdbeNoJumpsOutsideSubrtn(v, pRJ->addrSubrtn, pRJ->endSubrtn,
112325 + pRJ->regReturn);
112328 + mAll |= pWInfo->a[k].pWLoop->maskSelf;
112329 + sqlite3VdbeAddOp1(v, OP_NullRow, pWInfo->a[k].iTabCur);
112330 + iIdxCur = pWInfo->a[k].iIdxCur;
112335 + if( (pTabItem->fg.jointype & JT_LTORJ)==0 ){
112336 + mAll |= pLoop->maskSelf;
112337 + for(k=0; k<pWC->nTerm; k++){
112338 + WhereTerm *pTerm = &pWC->a[k];
112339 + if( (pTerm->wtFlags & (TERM_VIRTUAL|TERM_SLICE))!=0
112340 + && pTerm->eOperator!=WO_ROWVAL
112344 + if( pTerm->prereqAll & ~mAll ) continue;
112345 + if( ExprHasProperty(pTerm->pExpr, EP_OuterON|EP_InnerON) ) continue;
112347 + sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
112354 + assert( pParse->withinRJSubrtn < 100 );
112355 + pParse->withinRJSubrtn++;
112359 + int iCur = pLevel->iTabCur;
112360 + int r = ++pParse->nMem;
112364 + Table *pTab = pTabItem->pTab;
112366 + sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, -1, r);
112371 + nPk = pPk->nKeyCol;
112372 + pParse->nMem += nPk - 1;
112374 + int iCol = pPk->aiColumn[iPk];
112378 + jmp = sqlite3VdbeAddOp4Int(v, OP_Filter, pRJ->regBloom, 0, r, nPk);
112380 + sqlite3VdbeAddOp4Int(v, OP_Found, pRJ->iMatch, addrCont, r, nPk);
112383 + sqlite3VdbeAddOp2(v, OP_Gosub, pRJ->regReturn, pRJ->addrSubrtn);
112386 + sqlite3ExprDelete(pParse->db, pSubWhere);
112388 + assert( pParse->withinRJSubrtn>0 );
112389 + pParse->withinRJSubrtn--;
112395 @@ -149000,7 +152225,7 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){
112396 if( pWC->nTerm>=pWC->nSlot ){
112397 WhereTerm *pOld = pWC->a;
112398 sqlite3 *db = pWC->pWInfo->pParse->db;
112399 - pWC->a = sqlite3DbMallocRawNN(db, sizeof(pWC->a[0])*pWC->nSlot*2 );
112400 + pWC->a = sqlite3WhereMalloc(pWC->pWInfo, sizeof(pWC->a[0])*pWC->nSlot*2 );
112401 if( pWC->a==0 ){
112403 sqlite3ExprDelete(db, p);
112404 @@ -149009,12 +152234,10 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){
112407 memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm);
112408 - if( pOld!=pWC->aStatic ){
112409 - sqlite3DbFree(db, pOld);
112410 - }
112411 - pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]);
112412 + pWC->nSlot = pWC->nSlot*2;
112414 pTerm = &pWC->a[idx = pWC->nTerm++];
112415 + if( (wtFlags & TERM_VIRTUAL)==0 ) pWC->nBase = pWC->nTerm;
112417 pTerm->truthProb = sqlite3LogEst(p->iTable) - 270;
112419 @@ -149357,7 +152580,7 @@ static int isAuxiliaryVtabOperator(
112421 assert( pVtab->pModule!=0 );
112423 - pMod = (sqlite3_module *)pVtab->pModule;
112424 + pMod = (sqlite3_module *)pVtab->pModule;
112425 if( pMod->xFindFunction!=0 ){
112426 i = pMod->xFindFunction(pVtab,2, pExpr->u.zToken, &xNotUsed, &pNotUsed);
112428 @@ -149399,9 +152622,9 @@ static int isAuxiliaryVtabOperator(
112432 - if( pDerived ){
112433 - pDerived->flags |= pBase->flags & EP_FromJoin;
112434 - pDerived->iRightJoinTable = pBase->iRightJoinTable;
112436 + pDerived->flags |= pBase->flags & (EP_OuterON|EP_InnerON);
112437 + pDerived->w.iJoin = pBase->w.iJoin;
112441 @@ -149731,7 +152954,7 @@ static void exprAnalyzeOrTerm(
112442 pOrTerm = pOrWc->a;
112443 for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){
112444 assert( pOrTerm->eOperator & WO_EQ );
112445 - pOrTerm->wtFlags &= ~TERM_OR_OK;
112446 + pOrTerm->wtFlags &= ~TERM_OK;
112447 if( pOrTerm->leftCursor==iCursor ){
112448 /* This is the 2-bit case and we are on the second iteration and
112450 @@ -149772,7 +152995,7 @@ static void exprAnalyzeOrTerm(
112451 assert( pOrTerm->eOperator & WO_EQ );
112452 assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 );
112453 if( pOrTerm->leftCursor!=iCursor ){
112454 - pOrTerm->wtFlags &= ~TERM_OR_OK;
112455 + pOrTerm->wtFlags &= ~TERM_OK;
112456 }else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR
112457 && sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1)
112459 @@ -149788,7 +153011,7 @@ static void exprAnalyzeOrTerm(
112463 - pOrTerm->wtFlags |= TERM_OR_OK;
112464 + pOrTerm->wtFlags |= TERM_OK;
112468 @@ -149805,7 +153028,7 @@ static void exprAnalyzeOrTerm(
112471 for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){
112472 - if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue;
112473 + if( (pOrTerm->wtFlags & TERM_OK)==0 ) continue;
112474 assert( pOrTerm->eOperator & WO_EQ );
112475 assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 );
112476 assert( pOrTerm->leftCursor==iCursor );
112477 @@ -149855,7 +153078,7 @@ static int termIsEquivalence(Parse *pParse, Expr *pExpr){
112479 if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0;
112480 if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0;
112481 - if( ExprHasProperty(pExpr, EP_FromJoin) ) return 0;
112483 aff1 = sqlite3ExprAffinity(pExpr->pLeft);
112484 aff2 = sqlite3ExprAffinity(pExpr->pRight);
112486 @@ -149886,7 +153109,9 @@ static Bitmask exprSelectUsage(WhereMaskSet *pMaskSet, Select *pS){
112488 for(i=0; i<pSrc->nSrc; i++){
112489 mask |= exprSelectUsage(pMaskSet, pSrc->a[i].pSelect);
112490 - mask |= sqlite3WhereExprUsage(pMaskSet, pSrc->a[i].pOn);
112491 + if( pSrc->a[i].fg.isUsing==0 ){
112492 + mask |= sqlite3WhereExprUsage(pMaskSet, pSrc->a[i].u3.pOn);
112494 if( pSrc->a[i].fg.isTabFunc ){
112495 mask |= sqlite3WhereExprListUsage(pMaskSet, pSrc->a[i].u1.pFuncArg);
112497 @@ -150006,10 +153231,13 @@ static void exprAnalyze(
112498 if( db->mallocFailed ){
112501 + assert( pWC->nTerm > idxTerm );
112502 pTerm = &pWC->a[idxTerm];
112503 pMaskSet = &pWInfo->sMaskSet;
112504 pExpr = pTerm->pExpr;
112506 assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE );
112507 + pMaskSet->bVarSelect = 0;
112508 prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft);
112509 op = pExpr->op;
112511 @@ -150020,22 +153248,50 @@ static void exprAnalyze(
112513 pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList);
112515 - }else if( op==TK_ISNULL ){
112516 - pTerm->prereqRight = 0;
112517 + prereqAll = prereqLeft | pTerm->prereqRight;
112519 pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight);
112520 + if( pExpr->pLeft==0
112522 + || pExpr->x.pList!=0
112526 + prereqAll = prereqLeft | pTerm->prereqRight;
112529 - pMaskSet->bVarSelect = 0;
112530 - prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr);
112531 if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT;
112532 - if( ExprHasProperty(pExpr, EP_FromJoin) ){
112533 - Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable);
112534 - prereqAll |= x;
112535 - extraRight = x-1; /* ON clause terms may not be used with an index
112536 - ** on left table of a LEFT JOIN. Ticket #3015 */
112537 - if( (prereqAll>>1)>=x ){
112538 - sqlite3ErrorMsg(pParse, "ON clause references tables to its right");
112539 - return;
112550 + Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->w.iJoin);
112553 + extraRight = x-1; /* ON clause terms may not be used with an index
112566 + if( ALWAYS(pSrc->nSrc>0) && (pSrc->a[0].fg.jointype & JT_LTORJ)!=0 ){
112573 pTerm->prereqAll = prereqAll;
112574 @@ -150103,7 +153359,7 @@ static void exprAnalyze(
112575 pNew->eOperator = (operatorMask(pDup->op) + eExtraOp) & opMask;
112578 - && !ExprHasProperty(pExpr,EP_FromJoin)
112583 @@ -150174,7 +153430,7 @@ static void exprAnalyze(
112584 else if( pExpr->op==TK_NOTNULL ){
112585 if( pExpr->pLeft->op==TK_COLUMN
112586 && pExpr->pLeft->iColumn>=0
112587 - && !ExprHasProperty(pExpr, EP_FromJoin)
112591 Expr *pLeft = pExpr->pLeft;
112592 @@ -150297,7 +153553,10 @@ static void exprAnalyze(
112596 - ** is not a sub-select. */
112597 + ** is not a sub-select.
112599 + ** tag-20220128a
112601 if( (pExpr->op==TK_EQ || pExpr->op==TK_IS)
112602 && (nLeft = sqlite3ExprVectorSize(pExpr->pLeft))>1
112603 && sqlite3ExprVectorSize(pExpr->pRight)==nLeft
112604 @@ -150314,12 +153573,12 @@ static void exprAnalyze(
112606 pNew = sqlite3PExpr(pParse, pExpr->op, pLeft, pRight);
112608 - idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC);
112612 pTerm = &pWC->a[idxTerm];
112613 pTerm->wtFlags |= TERM_CODED|TERM_VIRTUAL; /* Disable the original */
112614 - pTerm->eOperator = 0;
112615 + pTerm->eOperator = WO_ROWVAL;
112618 /* If there is a vector IN term - e.g. "(a, b) IN (SELECT ...)" - create
112619 @@ -150344,7 +153603,7 @@ static void exprAnalyze(
112621 for(i=0; i<sqlite3ExprVectorSize(pExpr->pLeft); i++){
112623 - idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL);
112625 pWC->a[idxNew].u.x.iField = i+1;
112628 @@ -150375,9 +153634,9 @@ static void exprAnalyze(
112631 0, sqlite3ExprDup(db, pRight, 0));
112632 - if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){
112633 - ExprSetProperty(pNewExpr, EP_FromJoin);
112634 - pNewExpr->iRightJoinTable = pExpr->iRightJoinTable;
112637 + pNewExpr->w.iJoin = pExpr->w.iJoin;
112641 @@ -150440,6 +153699,113 @@ SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause *pWC, Expr *pExpr, u8…
112648 +** where-clause passed as the first argument. The value for the term
112663 + Parse *pParse = pWC->pWInfo->pParse;
112664 + sqlite3 *db = pParse->db;
112669 + Expr *pVal = sqlite3Expr(db, TK_INTEGER, 0);
112672 + pVal->u.iValue = iVal;
112675 + Expr *pVal = sqlite3Expr(db, TK_REGISTER, 0);
112677 + pVal->iTable = iReg;
112684 + pTerm = &pWC->a[idx];
112685 + pTerm->leftCursor = iCsr;
112686 + pTerm->eOperator = WO_AUX;
112687 + pTerm->eMatchOp = eMatchOp;
112710 + assert( p==0 || (p->pGroupBy==0 && (p->selFlags & SF_Aggregate)==0) );
112711 + if( (p && p->pLimit) /* 1 */
112712 + && (p->selFlags & (SF_Distinct|SF_Aggregate))==0 /* 2 */
112713 + && (p->pSrc->nSrc==1 && IsVirtual(p->pSrc->a[0].pTab)) /* 3 */
112715 + ExprList *pOrderBy = p->pOrderBy;
112716 + int iCsr = p->pSrc->a[0].iCursor;
112720 + for(ii=0; ii<pWC->nTerm; ii++){
112721 + if( pWC->a[ii].wtFlags & TERM_CODED ){
112723 + ** other, subsequent terms. It can be ignored. See tag-20220128a */
112724 + assert( pWC->a[ii].wtFlags & TERM_VIRTUAL );
112725 + assert( pWC->a[ii].eOperator==WO_ROWVAL );
112728 + if( pWC->a[ii].leftCursor!=iCsr ) return;
112733 + for(ii=0; ii<pOrderBy->nExpr; ii++){
112734 + Expr *pExpr = pOrderBy->a[ii].pExpr;
112735 + if( pExpr->op!=TK_COLUMN ) return;
112736 + if( pExpr->iTable!=iCsr ) return;
112737 + if( pOrderBy->a[ii].fg.sortFlags & KEYINFO_ORDER_BIGNULL ) return;
112741 + /* All conditions are met. Add the terms to the where-clause object. */
112742 + assert( p->pLimit->op==TK_LIMIT );
112743 + whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft,
112745 + if( p->iOffset>0 ){
112746 + whereAddLimitExpr(pWC, p->iOffset, p->pLimit->pRight,
112755 @@ -150451,6 +153817,7 @@ SQLITE_PRIVATE void sqlite3WhereClauseInit(
112756 pWC->hasOr = 0;
112757 pWC->pOuter = 0;
112758 pWC->nTerm = 0;
112759 + pWC->nBase = 0;
112760 pWC->nSlot = ArraySize(pWC->aStatic);
112761 pWC->a = pWC->aStatic;
112763 @@ -150461,22 +153828,36 @@ SQLITE_PRIVATE void sqlite3WhereClauseInit(
112767 - int i;
112768 - WhereTerm *a;
112769 sqlite3 *db = pWC->pWInfo->pParse->db;
112770 - for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){
112771 - if( a->wtFlags & TERM_DYNAMIC ){
112772 - sqlite3ExprDelete(db, a->pExpr);
112773 + assert( pWC->nTerm>=pWC->nBase );
112774 + if( pWC->nTerm>0 ){
112775 + WhereTerm *a = pWC->a;
112776 + WhereTerm *aLast = &pWC->a[pWC->nTerm-1];
112779 + /* Verify that every term past pWC->nBase is virtual */
112780 + for(i=pWC->nBase; i<pWC->nTerm; i++){
112781 + assert( (pWC->a[i].wtFlags & TERM_VIRTUAL)!=0 );
112783 - if( a->wtFlags & TERM_ORINFO ){
112784 - whereOrInfoDelete(db, a->u.pOrInfo);
112785 - }else if( a->wtFlags & TERM_ANDINFO ){
112786 - whereAndInfoDelete(db, a->u.pAndInfo);
112789 + assert( a->eMatchOp==0 || a->eOperator==WO_AUX );
112790 + if( a->wtFlags & TERM_DYNAMIC ){
112791 + sqlite3ExprDelete(db, a->pExpr);
112793 + if( a->wtFlags & (TERM_ORINFO|TERM_ANDINFO) ){
112794 + if( a->wtFlags & TERM_ORINFO ){
112795 + assert( (a->wtFlags & TERM_ANDINFO)==0 );
112796 + whereOrInfoDelete(db, a->u.pOrInfo);
112798 + assert( (a->wtFlags & TERM_ANDINFO)!=0 );
112799 + whereAndInfoDelete(db, a->u.pAndInfo);
112806 - if( pWC->a!=pWC->aStatic ){
112807 - sqlite3DbFree(db, pWC->a);
112808 - }
112812 @@ -150484,15 +153865,38 @@ SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){
112817 +** sqlite3WhereExprUsage(MaskSet, Expr) ->
112822 +** sqlite3WhereExprUsageNN(MaskSet, Expr) ->
112827 +** sqlite3WhereExprListUsage(MaskSet, ExprList) ->
112833 +** sqlite3WhereExprUsageFull(MaskSet, ExprList) ->
112840 +** "no-inline" function to avoid the stack push overhead in the
112843 -SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){
112849 - if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
112850 - return sqlite3WhereGetMask(pMaskSet, p->iTable);
112851 - }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
112852 - assert( p->op!=TK_IF_NULL_ROW );
112853 - return 0;
112854 - }
112855 mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0;
112856 if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft);
112857 if( p->pRight ){
112858 @@ -150514,6 +153918,15 @@ SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, E…
112863 + if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){
112864 + return sqlite3WhereGetMask(pMaskSet, p->iTable);
112866 + assert( p->op!=TK_IF_NULL_ROW );
112874 @@ -150571,6 +153984,7 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(
112876 for(j=k=0; j<pArgs->nExpr; j++){
112879 while( k<pTab->nCol && (pTab->aCol[k].colFlags & COLFLAG_HIDDEN)==0 ){k++;}
112880 if( k>=pTab->nCol ){
112881 sqlite3ErrorMsg(pParse, "too many arguments on %s() - max %d",
112882 @@ -150583,12 +153997,16 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(
112883 pColRef->iColumn = k++;
112885 pColRef->y.pTab = pTab;
112886 + pItem->colUsed |= sqlite3ExprColUsed(pColRef);
112888 sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
112890 - if( pItem->fg.jointype & JT_LEFT ){
112891 - sqlite3SetJoinExpr(pTerm, pItem->iCursor);
112892 + if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ) ){
112897 + sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
112901 @@ -150627,8 +154045,14 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(
112905 - WhereClause *pWC; /* The Where clause being analyzed */
112906 - Parse *pParse; /* The parsing context */
112918 @@ -150693,7 +154117,7 @@ SQLITE_PRIVATE int sqlite3WhereOrderByLimitOptLabel(WhereInfo *pWInfo){
112920 pInner = &pWInfo->a[pWInfo->nLevel-1];
112921 assert( pInner->addrNxt!=0 );
112922 - return pInner->addrNxt;
112923 + return pInner->pRJ ? pWInfo->iContinue : pInner->addrNxt;
112927 @@ -150831,7 +154255,12 @@ whereOrInsert_done:
112930 assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 );
112931 - for(i=0; i<pMaskSet->n; i++){
112932 + assert( pMaskSet->n>0 || pMaskSet->ix[0]<0 );
112933 + assert( iCursor>=-1 );
112934 + if( pMaskSet->ix[0]==iCursor ){
112937 + for(i=1; i<pMaskSet->n; i++){
112938 if( pMaskSet->ix[i]==iCursor ){
112941 @@ -150839,6 +154268,30 @@ SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int i…
112949 + pBlock = sqlite3DbMallocRawNN(pWInfo->pParse->db, nByte+sizeof(*pBlock));
112951 + pBlock->pNext = pWInfo->pMemToFree;
112952 + pBlock->sz = nByte;
112953 + pWInfo->pMemToFree = pBlock;
112962 + pOldBlk--;
112963 + assert( pOldBlk->sz<nByte );
112964 + memcpy(pNew, pOld, pOldBlk->sz);
112972 @@ -150892,7 +154345,7 @@ static WhereTerm *whereScanNext(WhereScan *pScan){
112974 || sqlite3ExprCompareSkip(pTerm->pExpr->pLeft,
112975 pScan->pIdxExpr,iCur)==0)
112976 - && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
112977 + && (pScan->iEquiv<=1 || !ExprHasProperty(pTerm->pExpr, EP_OuterON))
112979 if( (pTerm->eOperator & WO_EQUIV)!=0
112980 && pScan->nEquiv<ArraySize(pScan->aiCur)
112981 @@ -151016,16 +154469,16 @@ static WhereTerm *whereScanInit(
112984 iColumn = pIdx->aiColumn[j];
112985 - if( iColumn==XN_EXPR ){
112986 - pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr;
112987 - pScan->zCollName = pIdx->azColl[j];
112988 - pScan->aiColumn[0] = XN_EXPR;
112989 - return whereScanInitIndexExpr(pScan);
112990 - }else if( iColumn==pIdx->pTable->iPKey ){
112991 + if( iColumn==pIdx->pTable->iPKey ){
112994 pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity;
112995 pScan->zCollName = pIdx->azColl[j];
112997 + pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr;
112998 + pScan->zCollName = pIdx->azColl[j];
112999 + pScan->aiColumn[0] = XN_EXPR;
113004 @@ -151244,6 +154697,7 @@ static void translateColumnToCopy(
113005 pOp->p1 = pOp->p2 + iRegister;
113006 pOp->p2 = pOp->p3;
113007 pOp->p3 = 0;
113008 + pOp->p5 = 2; /* Cause the MEM_Subtype flag to be cleared */
113009 }else if( pOp->opcode==OP_Rowid ){
113010 pOp->opcode = OP_Sequence;
113011 pOp->p1 = iAutoidxCur;
113012 @@ -151268,12 +154722,14 @@ static void whereTraceIndexInfoInputs(sqlite3_index_info *p){
113015 for(i=0; i<p->nConstraint; i++){
113016 - sqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n",
113020 p->aConstraint[i].iColumn,
113021 p->aConstraint[i].iTermOffset,
113022 p->aConstraint[i].op,
113023 - p->aConstraint[i].usable);
113024 + p->aConstraint[i].usable,
113027 for(i=0; i<p->nOrderBy; i++){
113029 @@ -151309,21 +154765,24 @@ static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){
113033 - WhereTerm *pTerm, /* WHERE clause term to check */
113034 - SrcItem *pSrc, /* Table we are trying to access */
113035 - Bitmask notReady /* Tables in outer loops of the join */
113041 if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
113042 if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;
113043 - if( (pSrc->fg.jointype & JT_LEFT)
113044 - && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
113045 - && (pTerm->eOperator & WO_IS)
113046 - ){
113047 - /* Cannot use an IS term from the WHERE clause as an index driver for
113048 - ** the RHS of a LEFT JOIN. Such a term can only be used if it is from
113049 - ** the ON clause. */
113050 - return 0;
113051 + assert( (pSrc->fg.jointype & JT_RIGHT)==0 );
113052 + if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0 ){
113053 + testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LEFT );
113054 + testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LTORJ );
113055 + testcase( ExprHasProperty(pTerm->pExpr, EP_OuterON) )
113056 + testcase( ExprHasProperty(pTerm->pExpr, EP_InnerON) );
113057 + if( !ExprHasProperty(pTerm->pExpr, EP_OuterON|EP_InnerON)
113058 + || pTerm->pExpr->w.iJoin != pSrc->iCursor
113060 + return 0; /* See tag-20191211-001 */
113063 if( (pTerm->prereqRight & notReady)!=0 ) return 0;
113064 assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
113065 @@ -151342,11 +154801,11 @@ static int termCanDriveIndex(
113069 -static void constructAutomaticIndex(
113072 - WhereClause *pWC, /* The WHERE clause */
113073 - SrcItem *pSrc, /* The FROM clause term to get the next index */
113074 - Bitmask notReady, /* Mask of cursors that are not available */
113081 @@ -151388,13 +154847,12 @@ static void constructAutomaticIndex(
113083 for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
113084 Expr *pExpr = pTerm->pExpr;
113085 - assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
113086 - || pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
113087 - || pLoop->prereq!=0 ); /* table of a LEFT JOIN */
113088 - if( pLoop->prereq==0
113089 - && (pTerm->wtFlags & TERM_VIRTUAL)==0
113090 - && !ExprHasProperty(pExpr, EP_FromJoin)
113091 - && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
113095 + if( (pTerm->wtFlags & TERM_VIRTUAL)==0
113099 sqlite3ExprDup(pParse->db, pExpr, 0));
113101 @@ -151501,6 +154959,10 @@ static void constructAutomaticIndex(
113102 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
113104 VdbeComment((v, "for %s", pTable->zName));
113105 + if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
113106 + pLevel->regFilter = ++pParse->nMem;
113107 + sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
113111 pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
113112 @@ -151523,6 +154985,10 @@ static void constructAutomaticIndex(
113114 pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
113116 + if( pLevel->regFilter ){
113117 + sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0,
113118 + regBase, pLoop->u.btree.nEq);
113120 sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
113123 @@ -151549,22 +155015,149 @@ end_auto_index_create:
113140 +** and skip the subsequence B-Tree seek if the Bloom filter indicates that
113149 + int iLevel, /* Index in pWInfo->a[] that is pLevel */
113158 + Parse *pParse = pWInfo->pParse; /* Parsing context */
113159 + Vdbe *v = pParse->pVdbe; /* VDBE under construction */
113160 + WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */
113165 + assert( pLoop->wsFlags & WHERE_BLOOMFILTER );
113174 + iCur = pLevel->iTabCur;
113175 + pLevel->regFilter = ++pParse->nMem;
113178 + ** to zero-filled blob of at least 80K bits, but maybe more if the
113180 + ** measure the size of the table at run-time using OP_Count with
113185 + pItem = &pWInfo->pTabList->a[pLevel->iFrom];
113187 + pTab = pItem->pTab;
113189 + sz = sqlite3LogEstToInt(pTab->nRowLogEst);
113195 + sqlite3VdbeAddOp2(v, OP_Blob, (int)sz, pLevel->regFilter);
113198 + pWCEnd = &pWInfo->sWC.a[pWInfo->sWC.nTerm];
113199 + for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
113200 + Expr *pExpr = pTerm->pExpr;
113201 + if( (pTerm->wtFlags & TERM_VIRTUAL)==0
113204 + sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
113207 + if( pLoop->wsFlags & WHERE_IPK ){
113210 + sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, 1);
113213 + Index *pIdx = pLoop->u.btree.pIndex;
113214 + int n = pLoop->u.btree.nEq;
113218 + int iCol = pIdx->aiColumn[jj];
113219 + assert( pIdx->pTable==pItem->pTab );
113220 + sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj);
113222 + sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n);
113226 + sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1);
113229 + pLoop->wsFlags &= ~WHERE_BLOOMFILTER;
113230 + if( OptimizationDisabled(pParse->db, SQLITE_BloomPulldown) ) break;
113231 + while( ++iLevel < pWInfo->nLevel ){
113233 + pLevel = &pWInfo->a[iLevel];
113234 + pTabItem = &pWInfo->pTabList->a[pLevel->iFrom];
113235 + if( pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ) ) continue;
113236 + pLoop = pLevel->pWLoop;
113238 + if( pLoop->prereq & notReady ) continue;
113239 + if( (pLoop->wsFlags & (WHERE_BLOOMFILTER|WHERE_COLUMN_IN))
113242 + /* This is a candidate for bloom-filter pull-down (early evaluation).
113249 + }while( iLevel < pWInfo->nLevel );
113258 -** by passing the pointer returned by this function to sqlite3_free().
113262 - Parse *pParse, /* The parsing context */
113267 - ExprList *pOrderBy, /* The ORDER BY clause */
113272 + Parse *pParse = pWInfo->pParse;
113276 @@ -151573,10 +155166,21 @@ static sqlite3_index_info *allocateIndexInfo(
113282 + ExprList *pOrderBy = pWInfo->pOrderBy;
113285 + pTab = pSrc->pTab;
113289 - /* Count the number of possible WHERE clause constraints referring
113290 - ** to this virtual table */
113295 for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
113296 + pTerm->wtFlags &= ~TERM_OK;
113297 if( pTerm->leftCursor != pSrc->iCursor ) continue;
113298 if( pTerm->prereqRight & mUnusable ) continue;
113299 assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );
113300 @@ -151586,9 +155190,29 @@ static sqlite3_index_info *allocateIndexInfo(
113301 testcase( pTerm->eOperator & WO_ALL );
113302 if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
113303 if( pTerm->wtFlags & TERM_VNULL ) continue;
113305 assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
113306 - assert( pTerm->u.x.leftColumn>=(-1) );
113307 + assert( pTerm->u.x.leftColumn>=XN_ROWID );
113308 + assert( pTerm->u.x.leftColumn<pTab->nCol );
113310 + /* tag-20191211-002: WHERE-clause constraints are not useful to the
113311 + ** right-hand table of a LEFT JOIN nor to the either table of a
113312 + ** RIGHT JOIN. See tag-20191211-001 for the
113314 + if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0 ){
113315 + testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LEFT );
113316 + testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_RIGHT );
113317 + testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LTORJ );
113318 + testcase( ExprHasProperty(pTerm->pExpr, EP_OuterON) );
113319 + testcase( ExprHasProperty(pTerm->pExpr, EP_InnerON) );
113320 + if( !ExprHasProperty(pTerm->pExpr, EP_OuterON|EP_InnerON)
113321 + || pTerm->pExpr->w.iJoin != pSrc->iCursor
113327 + pTerm->wtFlags |= TERM_OK;
113331 @@ -151600,11 +155224,49 @@ static sqlite3_index_info *allocateIndexInfo(
113332 int n = pOrderBy->nExpr;
113334 Expr *pExpr = pOrderBy->a[i].pExpr;
113335 - if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break;
113336 - if( pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL ) break;
113345 + if( pOrderBy->a[i].fg.sortFlags & KEYINFO_ORDER_BIGNULL ) break;
113347 + /* First case - a direct column references without a COLLATE operator */
113348 + if( pExpr->op==TK_COLUMN && pExpr->iTable==pSrc->iCursor ){
113349 + assert( pExpr->iColumn>=XN_ROWID && pExpr->iColumn<pTab->nCol );
113353 + /* 2nd case - a column reference with a COLLATE operator. Only match
113355 + if( pExpr->op==TK_COLLATE
113356 + && (pE2 = pExpr->pLeft)->op==TK_COLUMN
113357 + && pE2->iTable==pSrc->iCursor
113361 + assert( pExpr->u.zToken!=0 );
113362 + assert( pE2->iColumn>=XN_ROWID && pE2->iColumn<pTab->nCol );
113363 + pExpr->iColumn = pE2->iColumn;
113364 + if( pE2->iColumn<0 ) continue; /* Collseq does not matter for rowid */
113365 + zColl = sqlite3ColumnColl(&pTab->aCol[pE2->iColumn]);
113367 + if( sqlite3_stricmp(pExpr->u.zToken, zColl)==0 ) continue;
113373 - if( i==n){
113376 + if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) ){
113377 + eDistinct = 2 + ((pWInfo->wctrlFlags & WHERE_SORTBYGROUP)!=0);
113378 + }else if( pWInfo->wctrlFlags & WHERE_GROUPBY ){
113384 @@ -151612,47 +155274,35 @@ static sqlite3_index_info *allocateIndexInfo(
113386 pIdxInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo)
113388 - + sizeof(*pIdxOrderBy)*nOrderBy + sizeof(*pHidden) );
113396 - pIdxCons = (struct sqlite3_index_constraint*)&pHidden[1];
113397 + pIdxCons = (struct sqlite3_index_constraint*)&pHidden->aRhs[nTerm];
113400 - pIdxInfo->nOrderBy = nOrderBy;
113401 pIdxInfo->aConstraint = pIdxCons;
113402 pIdxInfo->aOrderBy = pIdxOrderBy;
113403 pIdxInfo->aConstraintUsage = pUsage;
113404 pHidden->pWC = pWC;
113405 pHidden->pParse = pParse;
113406 + pHidden->eDistinct = eDistinct;
113407 + pHidden->mIn = 0;
113408 for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
113410 - if( pTerm->leftCursor != pSrc->iCursor ) continue;
113411 - if( pTerm->prereqRight & mUnusable ) continue;
113412 - assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );
113413 - testcase( pTerm->eOperator & WO_IN );
113414 - testcase( pTerm->eOperator & WO_IS );
113415 - testcase( pTerm->eOperator & WO_ISNULL );
113416 - testcase( pTerm->eOperator & WO_ALL );
113417 - if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
113418 - if( pTerm->wtFlags & TERM_VNULL ) continue;
113419 -
113420 - /* tag-20191211-002: WHERE-clause constraints are not useful to the
113421 - ** right-hand table of a LEFT JOIN. See tag-20191211-001 for the
113422 - ** equivalent restriction for ordinary tables. */
113423 - if( (pSrc->fg.jointype & JT_LEFT)!=0
113424 - && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
113425 - ){
113426 - continue;
113427 - }
113428 - assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
113429 - assert( pTerm->u.x.leftColumn>=(-1) );
113430 + if( (pTerm->wtFlags & TERM_OK)==0 ) continue;
113431 pIdxCons[j].iColumn = pTerm->u.x.leftColumn;
113433 op = pTerm->eOperator & WO_ALL;
113434 - if( op==WO_IN ) op = WO_EQ;
113436 + if( (pTerm->wtFlags & TERM_SLICE)==0 ){
113437 + pHidden->mIn |= SMASKBIT32(j);
113442 pIdxCons[j].op = pTerm->eMatchOp;
113444 @@ -151685,17 +155335,42 @@ static sqlite3_index_info *allocateIndexInfo(
113449 pIdxInfo->nConstraint = j;
113450 - for(i=0; i<nOrderBy; i++){
113452 Expr *pExpr = pOrderBy->a[i].pExpr;
113453 - pIdxOrderBy[i].iColumn = pExpr->iColumn;
113454 - pIdxOrderBy[i].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC;
113456 + assert( pExpr->op==TK_COLUMN
113457 + || (pExpr->op==TK_COLLATE && pExpr->pLeft->op==TK_COLUMN
113458 + && pExpr->iColumn==pExpr->pLeft->iColumn) );
113459 + pIdxOrderBy[j].iColumn = pExpr->iColumn;
113460 + pIdxOrderBy[j].desc = pOrderBy->a[i].fg.sortFlags & KEYINFO_ORDER_DESC;
113463 + pIdxInfo->nOrderBy = j;
113473 +static void freeIndexInfo(sqlite3 *db, sqlite3_index_info *pIdxInfo){
113478 + assert( pHidden->pParse!=0 );
113479 + assert( pHidden->pParse->db==db );
113480 + for(i=0; i<pIdxInfo->nConstraint; i++){
113481 + sqlite3ValueFree(pHidden->aRhs[i]); /* IMP: R-14553-25174 */
113482 + pHidden->aRhs[i] = 0;
113484 + sqlite3DbFree(db, pIdxInfo);
113490 @@ -151717,7 +155392,9 @@ static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *…
113494 + pParse->db->nSchemaLock++;
113495 rc = pVtab->pModule->xBestIndex(pVtab, p);
113496 + pParse->db->nSchemaLock--;
113500 @@ -151771,7 +155448,7 @@ static int whereKeyStats(
113503 assert( pIdx->nSample>0 );
113504 - assert( pRec->nField>0 && pRec->nField<=pIdx->nSampleCol );
113505 + assert( pRec->nField>0 );
113509 @@ -151817,7 +155494,7 @@ static int whereKeyStats(
113513 - nField = pRec->nField;
113514 + nField = MIN(pRec->nField, pIdx->nSample);
113516 iSample = pIdx->nSample * nField;
113518 @@ -152408,7 +156085,7 @@ SQLITE_PRIVATE void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){
113520 if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V';
113521 if( pTerm->eOperator & WO_EQUIV ) zType[1] = 'E';
113522 - if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L';
113523 + if( ExprHasProperty(pTerm->pExpr, EP_OuterON) ) zType[2] = 'L';
113524 if( pTerm->wtFlags & TERM_CODED ) zType[3] = 'C';
113525 if( pTerm->eOperator & WO_SINGLE ){
113526 assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 );
113527 @@ -152491,9 +156168,9 @@ SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){
113530 if( p->wsFlags & WHERE_SKIPSCAN ){
113531 - sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->nSkip);
113532 + sqlite3DebugPrintf(" f %06x %d-%d", p->wsFlags, p->nLTerm,p->nSkip);
113534 - sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm);
113535 + sqlite3DebugPrintf(" f %06x N %d", p->wsFlags, p->nLTerm);
113537 sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
113538 if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){
113539 @@ -152589,15 +156266,7 @@ static void whereLoopDelete(sqlite3 *db, WhereLoop *p){
113542 static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
113543 - int i;
113545 - for(i=0; i<pWInfo->nLevel; i++){
113546 - WhereLevel *pLevel = &pWInfo->a[i];
113547 - if( pLevel->pWLoop && (pLevel->pWLoop->wsFlags & WHERE_IN_ABLE)!=0 ){
113548 - assert( (pLevel->pWLoop->wsFlags & WHERE_MULTI_OR)==0 );
113549 - sqlite3DbFree(db, pLevel->u.in.aInLoop);
113550 - }
113551 - }
113552 sqlite3WhereClauseClear(&pWInfo->sWC);
113553 while( pWInfo->pLoops ){
113554 WhereLoop *p = pWInfo->pLoops;
113555 @@ -152605,6 +156274,11 @@ static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
113556 whereLoopDelete(db, p);
113558 assert( pWInfo->pExprMods==0 );
113559 + while( pWInfo->pMemToFree ){
113560 + WhereMemBlock *pNext = pWInfo->pMemToFree->pNext;
113561 + sqlite3DbFreeNN(db, pWInfo->pMemToFree);
113562 + pWInfo->pMemToFree = pNext;
113564 sqlite3DbFreeNN(db, pWInfo);
113567 @@ -152953,11 +156627,11 @@ static void whereLoopOutputAdjust(
113568 LogEst iReduce = 0; /* pLoop->nOut should not exceed nRow-iReduce */
113570 assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 );
113571 - for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){
113572 + for(i=pWC->nBase, pTerm=pWC->a; i>0; i--, pTerm++){
113574 - if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break;
113575 - if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
113576 if( (pTerm->prereqAll & notAllowed)!=0 ) continue;
113577 + if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue;
113578 + if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) continue;
113579 for(j=pLoop->nLTerm-1; j>=0; j--){
113580 pX = pLoop->aLTerm[j];
113582 @@ -152965,6 +156639,23 @@ static void whereLoopOutputAdjust(
113583 if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break;
113586 + if( pLoop->maskSelf==pTerm->prereqAll ){
113590 + ** "self-culling".
113592 + ** 2022-03-24: Self-culling only applies if either the extra terms
113593 + ** are straight comparison operators that are non-true with NULL
113596 + if( (pTerm->eOperator & 0x3f)!=0
113597 + || (pWC->pWInfo->pTabList->a[pLoop->iTab].fg.jointype
113600 + pLoop->wsFlags |= WHERE_SELFCULL;
113603 if( pTerm->truthProb<=0 ){
113606 @@ -152992,7 +156683,9 @@ static void whereLoopOutputAdjust(
113610 - if( pLoop->nOut > nRow-iReduce ) pLoop->nOut = nRow - iReduce;
113611 + if( pLoop->nOut > nRow-iReduce ){
113612 + pLoop->nOut = nRow - iReduce;
113617 @@ -153165,12 +156858,29 @@ static int whereLoopAddBtreeIndex(
113618 if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
113620 /* tag-20191211-001: Do not allow constraints from the WHERE clause to
113621 - ** be used by the right table of a LEFT JOIN. Only constraints in the
113622 - ** ON clause are allowed. See tag-20191211-002 for the vtab equivalent. */
113623 - if( (pSrc->fg.jointype & JT_LEFT)!=0
113624 - && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
113625 - ){
113626 - continue;
113629 + ** See tag-20191211-002 for the vtab equivalent.
113631 + ** 2022-06-06: See https://sqlite.org/forum/forumpost/206d99a16dd9212f
113634 + ** not-NULL condition on the left table of the RIGHT JOIN.
113636 + ** 2022-06-10: The same condition applies to termCanDriveIndex() above.
113639 + if( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0 ){
113640 + testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LEFT );
113641 + testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_RIGHT );
113642 + testcase( (pSrc->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))==JT_LTORJ );
113643 + testcase( ExprHasProperty(pTerm->pExpr, EP_OuterON) )
113644 + testcase( ExprHasProperty(pTerm->pExpr, EP_InnerON) );
113645 + if( !ExprHasProperty(pTerm->pExpr, EP_OuterON|EP_InnerON)
113646 + || pTerm->pExpr->w.iJoin != pSrc->iCursor
113652 if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){
113653 @@ -153522,23 +157232,26 @@ static int indexMightHelpWithOrderBy(
113657 - int isLeft, /* True if iTab is the right table of a LEFT JOIN */
113664 - Parse *pParse = pWC->pWInfo->pParse;
113668 + pParse = pWC->pWInfo->pParse;
113669 while( pWhere->op==TK_AND ){
113670 - if( !whereUsablePartialIndex(iTab,isLeft,pWC,pWhere->pLeft) ) return 0;
113671 + if( !whereUsablePartialIndex(iTab,jointype,pWC,pWhere->pLeft) ) return 0;
113672 pWhere = pWhere->pRight;
113674 if( pParse->db->flags & SQLITE_EnableQPSG ) pParse = 0;
113675 for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
113677 pExpr = pTerm->pExpr;
113678 - if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab)
113679 - && (isLeft==0 || ExprHasProperty(pExpr, EP_FromJoin))
113680 + if( (!ExprHasProperty(pExpr, EP_OuterON) || pExpr->w.iJoin==iTab)
113683 && (pTerm->wtFlags & TERM_VNULL)==0
113685 @@ -153647,13 +157360,14 @@ static int whereLoopAddBtree(
113688 if( !pBuilder->pOrSet /* Not part of an OR optimization */
113689 - && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0
113690 + && (pWInfo->wctrlFlags & (WHERE_RIGHT_JOIN|WHERE_OR_SUBCLAUSE))==0
113691 && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0
113692 && !pSrc->fg.isIndexedBy /* Has no INDEXED BY clause */
113693 && !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */
113695 && !pSrc->fg.isCorrelated /* Not a correlated subquery */
113696 && !pSrc->fg.isRecursive /* Not a recursive common table expression. */
113697 + && (pSrc->fg.jointype & JT_RIGHT)==0 /* Not the right tab of a RIGHT JOIN */
113699 /* Generate auto-index WhereLoops */
113701 @@ -153703,9 +157417,8 @@ static int whereLoopAddBtree(
113703 pProbe=(pSrc->fg.isIndexedBy ? 0 : pProbe->pNext), iSortIdx++
113705 - int isLeft = (pSrc->fg.jointype & JT_OUTER)!=0;
113706 if( pProbe->pPartIdxWhere!=0
113707 - && !whereUsablePartialIndex(pSrc->iCursor, isLeft, pWC,
113708 + && !whereUsablePartialIndex(pSrc->iCursor, pSrc->fg.jointype, pWC,
113709 pProbe->pPartIdxWhere)
113711 testcase( pNew->iTab!=pSrc->iCursor ); /* See ticket [98d973b8f5] */
113712 @@ -153813,7 +157526,14 @@ static int whereLoopAddBtree(
113714 ApplyCostMultiplier(pNew->rRun, pTab->costMult);
113716 - rc = whereLoopInsert(pBuilder, pNew);
113717 + if( (pSrc->fg.jointype & JT_RIGHT)!=0 && pProbe->aColExpr ){
113718 + /* Do not do an SCAN of a index-on-expression in a RIGHT JOIN
113720 + ** positioned to the correct row during the right-join no-match
113725 pNew->nOut = rSize;
113728 @@ -153839,6 +157559,15 @@ static int whereLoopAddBtree(
113736 + assert( pTerm->eOperator==WO_AUX || pTerm->eMatchOp==0 );
113737 + return pTerm->eMatchOp>=SQLITE_INDEX_CONSTRAINT_LIMIT
113738 + && pTerm->eMatchOp<=SQLITE_INDEX_CONSTRAINT_OFFSET;
113743 ** be used by the virtual table identified by pBuilder->pNew->iTab. This
113744 @@ -153866,9 +157595,11 @@ static int whereLoopAddVirtualOne(
113748 - int *pbIn /* OUT: True if plan uses an IN(...) op */
113752 WhereClause *pWC = pBuilder->pWC;
113755 struct sqlite3_index_constraint_usage *pUsage = pIdxInfo->aConstraintUsage;
113757 @@ -153891,6 +157622,7 @@ static int whereLoopAddVirtualOne(
113758 pIdxCons->usable = 0;
113759 if( (pTerm->prereqRight & mUsable)==pTerm->prereqRight
113760 && (pTerm->eOperator & mExclude)==0
113763 pIdxCons->usable = 1;
113765 @@ -153906,6 +157638,7 @@ static int whereLoopAddVirtualOne(
113766 pIdxInfo->estimatedRows = 25;
113767 pIdxInfo->idxFlags = 0;
113768 pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed;
113769 + pHidden->mHandleIn = 0;
113772 rc = vtabBestIndex(pParse, pSrc->pTab, pIdxInfo);
113773 @@ -153923,8 +157656,8 @@ static int whereLoopAddVirtualOne(
113775 mxTerm = -1;
113776 assert( pNew->nLSlot>=nConstraint );
113777 - for(i=0; i<nConstraint; i++) pNew->aLTerm[i] = 0;
113778 - pNew->u.vtab.omitMask = 0;
113779 + memset(pNew->aLTerm, 0, sizeof(pNew->aLTerm[0])*nConstraint );
113780 + memset(&pNew->u.vtab, 0, sizeof(pNew->u.vtab));
113781 pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
113784 @@ -153958,8 +157691,13 @@ static int whereLoopAddVirtualOne(
113788 + if( pTerm->eMatchOp==SQLITE_INDEX_CONSTRAINT_OFFSET ){
113789 + pNew->u.vtab.bOmitOffset = 1;
113792 - if( (pTerm->eOperator & WO_IN)!=0 ){
113793 + if( SMASKBIT32(i) & pHidden->mHandleIn ){
113794 + pNew->u.vtab.mHandleIn |= MASKBIT32(iTerm);
113795 + }else if( (pTerm->eOperator & WO_IN)!=0 ){
113799 @@ -153969,6 +157707,22 @@ static int whereLoopAddVirtualOne(
113800 pIdxInfo->idxFlags &= ~SQLITE_INDEX_SCAN_UNIQUE;
113811 + if( pIdxInfo->needToFreeIdxStr ){
113812 + sqlite3_free(pIdxInfo->idxStr);
113813 + pIdxInfo->idxStr = 0;
113814 + pIdxInfo->needToFreeIdxStr = 0;
113822 @@ -154013,11 +157767,19 @@ static int whereLoopAddVirtualOne(
113826 -** If this function is invoked from within an xBestIndex() callback, it
113827 -** returns a pointer to a buffer containing the name of the collation
113828 -** sequence associated with element iCons of the sqlite3_index_info.aConstraint
113829 -** array. Or, if iCons is out of range or there is no active xBestIndex
113830 -** call, return NULL.
113847 @@ -154034,6 +157796,97 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxIn…
113859 + if( m & pHidden->mIn ){
113861 + pHidden->mHandleIn &= ~m;
113863 + pHidden->mHandleIn |= m;
113874 +** on the right-hand-side of constraint iCons.
113884 + if( iCons<0 || iCons>=pIdxInfo->nConstraint ){
113885 + rc = SQLITE_MISUSE; /* EV: R-30545-25046 */
113887 + if( pH->aRhs[iCons]==0 ){
113888 + WhereTerm *pTerm = &pH->pWC->a[pIdxInfo->aConstraint[iCons].iTermOffset];
113890 + pH->pParse->db, pTerm->pExpr->pRight, ENC(pH->pParse->db),
113891 + SQLITE_AFF_BLOB, &pH->aRhs[iCons]
113895 + pVal = pH->aRhs[iCons];
113899 + if( rc==SQLITE_OK && pVal==0 ){ /* IMP: R-19933-32160 */
113900 + rc = SQLITE_NOTFOUND; /* IMP: R-36424-56542 */
113911 + assert( pHidden->eDistinct>=0 && pHidden->eDistinct<=3 );
113912 + return pHidden->eDistinct;
113920 +** prepared is read-only, then just start read transactions on all
113924 +** This is used by the (built-in) sqlite_dbpage virtual table.
113928 + Parse *pParse = pHidden->pParse;
113929 + int nDb = pParse->db->nDb;
113934 + if( pParse->writeMask ){
113944 ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table.
113945 @@ -154075,6 +157928,7 @@ static int whereLoopAddVirtual(
113952 pWInfo = pBuilder->pWInfo;
113953 @@ -154083,8 +157937,7 @@ static int whereLoopAddVirtual(
113954 pNew = pBuilder->pNew;
113955 pSrc = &pWInfo->pTabList->a[pNew->iTab];
113956 assert( IsVirtual(pSrc->pTab) );
113957 - p = allocateIndexInfo(pParse, pWC, mUnusable, pSrc, pBuilder->pOrderBy,
113958 - &mNoOmit);
113961 pNew->rSetup = 0;
113962 pNew->wsFlags = WHERE_VIRTUALTABLE;
113963 @@ -154092,14 +157945,22 @@ static int whereLoopAddVirtual(
113964 pNew->u.vtab.needFree = 0;
113965 nConstraint = p->nConstraint;
113966 if( whereLoopResize(pParse->db, pNew, nConstraint) ){
113967 - sqlite3DbFree(pParse->db, p);
113968 + freeIndexInfo(pParse->db, p);
113973 WHERETRACE(0x800, ("BEGIN %s.addVirtual()\n", pSrc->pTab->zName));
113975 - rc = whereLoopAddVirtualOne(pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn);
113988 @@ -154117,7 +157978,7 @@ static int whereLoopAddVirtual(
113992 - pBuilder, mPrereq, ALLBITS, WO_IN, p, mNoOmit, &bIn);
113995 mBestNoIn = pNew->prereq & ~mPrereq;
113997 @@ -154144,7 +158005,7 @@ static int whereLoopAddVirtual(
114001 - pBuilder, mPrereq, mNext|mPrereq, 0, p, mNoOmit, &bIn);
114003 if( pNew->prereq==mPrereq ){
114006 @@ -154157,7 +158018,7 @@ static int whereLoopAddVirtual(
114010 - pBuilder, mPrereq, mPrereq, 0, p, mNoOmit, &bIn);
114015 @@ -154167,12 +158028,12 @@ static int whereLoopAddVirtual(
114019 - pBuilder, mPrereq, mPrereq, WO_IN, p, mNoOmit, &bIn);
114024 if( p->needToFreeIdxStr ) sqlite3_free(p->idxStr);
114025 - sqlite3DbFreeNN(pParse->db, p);
114026 + freeIndexInfo(pParse->db, p);
114027 WHERETRACE(0x800, ("END %s.addVirtual(), rc=%d\n", pSrc->pTab->zName, rc));
114030 @@ -154205,6 +158066,9 @@ static int whereLoopAddOr(
114031 pItem = pWInfo->pTabList->a + pNew->iTab;
114032 iCur = pItem->iCursor;
114034 + /* The multi-index OR optimization does not work for RIGHT and FULL JOIN */
114035 + if( pItem->fg.jointype & JT_RIGHT ) return SQLITE_OK;
114037 for(pTerm=pWC->a; pTerm<pWCEnd && rc==SQLITE_OK; pTerm++){
114038 if( (pTerm->eOperator & WO_OR)!=0
114039 && (pTerm->u.pOrInfo->indexable & pNew->maskSelf)!=0
114040 @@ -154216,7 +158080,6 @@ static int whereLoopAddOr(
114044 - sSubBuild.pOrderBy = 0;
114047 WHERETRACE(0x200, ("Begin processing OR-clause %p\n", pTerm));
114048 @@ -154228,6 +158091,7 @@ static int whereLoopAddOr(
114056 @@ -154318,8 +158182,11 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){
114057 SrcItem *pEnd = &pTabList->a[pWInfo->nLevel];
114058 sqlite3 *db = pWInfo->pParse->db;
114066 pNew = pBuilder->pNew;
114068 @@ -154329,18 +158196,30 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){
114069 pNew->iTab = iTab;
114070 pBuilder->iPlanLimit += SQLITE_QUERY_PLANNER_LIMIT_INCR;
114071 pNew->maskSelf = sqlite3WhereGetMask(&pWInfo->sMaskSet, pItem->iCursor);
114072 - if( (pItem->fg.jointype & (JT_LEFT|JT_CROSS))!=0 ){
114073 - /* This condition is true when pItem is the FROM clause term on the
114074 - ** right-hand-side of a LEFT or CROSS JOIN. */
114075 - mPrereq = mPrior;
114076 - }else{
114078 + || (pItem->fg.jointype & (JT_OUTER|JT_CROSS|JT_LTORJ))!=0
114086 + ** prevent FROM-clause terms from moving from the right side of
114090 + if( pItem->fg.jointype & JT_LTORJ ) hasRightJoin = 1;
114092 + bFirstPastRJ = (pItem->fg.jointype & JT_RIGHT)!=0;
114097 if( IsVirtual(pItem->pTab) ){
114100 - if( mUnusable || (p->fg.jointype & (JT_LEFT|JT_CROSS)) ){
114101 + if( mUnusable || (p->fg.jointype & (JT_OUTER|JT_CROSS)) ){
114102 mUnusable |= sqlite3WhereGetMask(&pWInfo->sMaskSet, p->iCursor);
114105 @@ -154465,7 +158344,9 @@ static i8 wherePathSatisfiesOrderBy(
114108 if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){
114109 - if( pLoop->u.vtab.isOrdered && (wctrlFlags & WHERE_DISTINCTBY)==0 ){
114110 + if( pLoop->u.vtab.isOrdered
114116 @@ -154643,16 +158524,18 @@ static i8 wherePathSatisfiesOrderBy(
114120 - if( (rev ^ revIdx)!=(pOrderBy->a[i].sortFlags&KEYINFO_ORDER_DESC) ){
114122 + != (pOrderBy->a[i].fg.sortFlags&KEYINFO_ORDER_DESC)
114127 - rev = revIdx ^ (pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC);
114128 + rev = revIdx ^ (pOrderBy->a[i].fg.sortFlags & KEYINFO_ORDER_DESC);
114133 - if( isMatch && (pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL) ){
114134 + if( isMatch && (pOrderBy->a[i].fg.sortFlags & KEYINFO_ORDER_BIGNULL) ){
114135 if( j==pLoop->u.btree.nEq ){
114136 pLoop->wsFlags |= WHERE_BIGNULL_SORT;
114138 @@ -154732,7 +158615,7 @@ static i8 wherePathSatisfiesOrderBy(
114139 ** SELECT * FROM t1 GROUP BY y,x ORDER BY y,x; -- IsSorted()==0
114142 - assert( pWInfo->wctrlFlags & WHERE_GROUPBY );
114143 + assert( pWInfo->wctrlFlags & (WHERE_GROUPBY|WHERE_DISTINCTBY) );
114144 assert( pWInfo->wctrlFlags & WHERE_SORTBYGROUP );
114145 return pWInfo->sorted;
114147 @@ -155133,12 +159016,12 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
114149 pWInfo->bOrderedInnerLoop = 0;
114150 if( pWInfo->pOrderBy ){
114151 + pWInfo->nOBSat = pFrom->isOrdered;
114152 if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){
114153 if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){
114154 pWInfo->eDistinct = WHERE_DISTINCT_ORDERED;
114157 - pWInfo->nOBSat = pFrom->isOrdered;
114158 pWInfo->revMask = pFrom->revLoop;
114159 if( pWInfo->nOBSat<=0 ){
114160 pWInfo->nOBSat = 0;
114161 @@ -155217,7 +159100,11 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){
114162 pItem = pWInfo->pTabList->a;
114163 pTab = pItem->pTab;
114165 - if( pItem->fg.isIndexedBy ) return 0;
114166 + if( pItem->fg.isIndexedBy || pItem->fg.notIndexed ){
114167 + testcase( pItem->fg.isIndexedBy );
114168 + testcase( pItem->fg.notIndexed );
114171 iCur = pItem->iCursor;
114172 pWC = &pWInfo->sWC;
114173 pLoop = pBuilder->pNew;
114174 @@ -155335,6 +159222,150 @@ static void showAllWhereLoops(WhereInfo *pWInfo, WhereClause *pWC){
114215 + assert( pWInfo->nLevel>=2 );
114216 + assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_OmitNoopJoin) );
114220 + assert( pWInfo->pResultSet!=0 );
114221 + assert( 0==(pWInfo->wctrlFlags & WHERE_AGG_DISTINCT) );
114223 + tabUsed = sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pResultSet);
114224 + if( pWInfo->pOrderBy ){
114225 + tabUsed |= sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pOrderBy);
114227 + for(i=pWInfo->nLevel-1; i>=1; i--){
114231 + pLoop = pWInfo->a[i].pWLoop;
114232 + pItem = &pWInfo->pTabList->a[pLoop->iTab];
114233 + if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ) continue;
114234 + if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)==0
114235 + && (pLoop->wsFlags & WHERE_ONEROW)==0
114239 + if( (tabUsed & pLoop->maskSelf)!=0 ) continue;
114240 + pEnd = pWInfo->sWC.a + pWInfo->sWC.nTerm;
114241 + for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
114242 + if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
114243 + if( !ExprHasProperty(pTerm->pExpr, EP_OuterON)
114244 + || pTerm->pExpr->w.iJoin!=pItem->iCursor
114251 + WHERETRACE(0xffff, ("-> drop loop %c not used\n", pLoop->cId));
114252 + notReady &= ~pLoop->maskSelf;
114253 + for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){
114254 + if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
114255 + pTerm->wtFlags |= TERM_CODED;
114258 + if( i!=pWInfo->nLevel-1 ){
114259 + int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel);
114260 + memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte);
114262 + pWInfo->nLevel--;
114263 + assert( pWInfo->nLevel>0 );
114277 +** (3) Bloom-filter processing is not disabled. (Checked by the
114292 + assert( pWInfo->nLevel>=2 );
114293 + assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) );
114294 + nSearch = pWInfo->a[0].pWLoop->nOut;
114295 + for(i=1; i<pWInfo->nLevel; i++){
114296 + WhereLoop *pLoop = pWInfo->a[i].pWLoop;
114298 + if( (pLoop->wsFlags & reqFlags)==reqFlags
114299 + /* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */
114300 + && ALWAYS((pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0)
114302 + SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab];
114303 + Table *pTab = pItem->pTab;
114304 + pTab->tabFlags |= TF_StatsUsed;
114305 + if( nSearch > pTab->nRowLogEst
114306 + && (pTab->tabFlags & TF_HasStat1)!=0
114308 + testcase( pItem->fg.jointype & JT_LEFT );
114309 + pLoop->wsFlags |= WHERE_BLOOMFILTER;
114310 + pLoop->wsFlags &= ~WHERE_IDX_ONLY;
114312 + "-> use Bloom-filter on loop %c because there are ~%.1e "
114314 + pLoop->cId, (double)sqlite3LogEstToInt(nSearch), pTab->zName,
114315 + (double)sqlite3LogEstToInt(pTab->nRowLogEst)));
114318 + nSearch += pLoop->nOut;
114325 @@ -155429,6 +159460,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114333 @@ -155463,13 +159495,6 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114335 testcase( pOrderBy && pOrderBy->nExpr==BMS-1 );
114336 if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0;
114337 - sWLB.pOrderBy = pOrderBy;
114338 -
114339 - /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via
114340 - ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */
114341 - if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){
114342 - wctrlFlags &= ~WHERE_WANT_DISTINCT;
114343 - }
114347 @@ -155494,7 +159519,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114348 ** field (type Bitmask) it must be aligned on an 8-byte boundary on
114351 - nByteWInfo = ROUND8(sizeof(WhereInfo)+(nTabList-1)*sizeof(WhereLevel));
114352 + nByteWInfo = ROUND8P(sizeof(WhereInfo)+(nTabList-1)*sizeof(WhereLevel));
114353 pWInfo = sqlite3DbMallocRawNN(db, nByteWInfo + sizeof(WhereLoop));
114354 if( db->mallocFailed ){
114355 sqlite3DbFree(db, pWInfo);
114356 @@ -155512,11 +159537,18 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114357 pWInfo->wctrlFlags = wctrlFlags;
114358 pWInfo->iLimit = iAuxArg;
114359 pWInfo->savedNQueryLoop = pParse->nQueryLoop;
114361 + pWInfo->pLimit = pLimit;
114363 memset(&pWInfo->nOBSat, 0,
114364 offsetof(WhereInfo,sWC) - offsetof(WhereInfo,nOBSat));
114365 memset(&pWInfo->a[0], 0, sizeof(WhereLoop)+nTabList*sizeof(WhereLevel));
114366 assert( pWInfo->eOnePass==ONEPASS_OFF ); /* ONEPASS defaults to OFF */
114367 pMaskSet = &pWInfo->sMaskSet;
114368 + pMaskSet->n = 0;
114369 + pMaskSet->ix[0] = -99; /* Initialize ix[0] to a value that can never be
114371 + ** test for pMaskSet->n==0 in sqlite3WhereGetMask() */
114373 sWLB.pWC = &pWInfo->sWC;
114375 @@ -155529,7 +159561,6 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114379 - initMaskSet(pMaskSet);
114380 sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo);
114381 sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND);
114383 @@ -155537,7 +159568,9 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114386 if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr;
114387 - if( wctrlFlags & WHERE_WANT_DISTINCT ){
114389 + && OptimizationEnabled(db, SQLITE_DistinctOpt)
114391 pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
114394 @@ -155575,7 +159608,8 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114397 sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
114398 - if( db->mallocFailed ) goto whereBeginError;
114399 + sqlite3WhereAddLimit(&pWInfo->sWC, pLimit);
114400 + if( pParse->nErr ) goto whereBeginError;
114404 @@ -155588,7 +159622,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114405 ** FROM ... WHERE random()>0; -- eval random() once per row
114406 ** FROM ... WHERE (SELECT random())>0; -- eval random() once overall
114408 - for(ii=0; ii<sWLB.pWC->nTerm; ii++){
114409 + for(ii=0; ii<sWLB.pWC->nBase; ii++){
114410 WhereTerm *pT = &sWLB.pWC->a[ii];
114411 if( pT->wtFlags & TERM_VIRTUAL ) continue;
114412 if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){
114413 @@ -155598,7 +159632,12 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114417 - if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
114418 + if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){
114422 + pWInfo->wctrlFlags &= ~WHERE_WANT_DISTINCT;
114423 + }else if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
114425 pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
114427 @@ -155669,9 +159708,10 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114428 if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){
114429 pWInfo->revMask = ALLBITS;
114431 - if( pParse->nErr || db->mallocFailed ){
114432 + if( pParse->nErr ){
114435 + assert( db->mallocFailed==0 );
114438 sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut);
114439 @@ -155699,34 +159739,15 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114443 - /* Attempt to omit tables from the join that do not affect the result.
114444 - ** For a table to not affect the result, the following must be true:
114445 - **
114446 - ** 1) The query must not be an aggregate.
114447 - ** 2) The table must be the RHS of a LEFT JOIN.
114448 - ** 3) Either the query must be DISTINCT, or else the ON or USING clause
114449 - ** must contain a constraint that limits the scan of the table to
114450 - ** at most a single row.
114451 - ** 4) The table must not be referenced by any part of the query apart
114452 - ** from its own USING or ON clause.
114453 - **
114454 - ** For example, given:
114455 - **
114456 - ** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1);
114457 - ** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2);
114458 - ** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3);
114459 - **
114460 - ** then table t2 can be omitted from the following:
114464 - ** SELECT v1, v3 FROM t1
114465 - ** LEFT JOIN t2 ON (t1.ipk=t2.ipk)
114466 - ** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
114467 - **
114468 - ** or from:
114469 - **
114470 - ** SELECT DISTINCT v1, v3 FROM t1
114471 - ** LEFT JOIN t2
114472 - ** LEFT JOIN t3 ON (t1.ipk=t3.ipk)
114473 + ** This query optimization is factored out into a separate "no-inline"
114476 + ** some C-compiler optimizers from in-lining the
114478 + ** in-line sqlite3WhereCodeOneLoopStart() for performance reasons.
114481 if( pWInfo->nLevel>=2
114482 @@ -155734,49 +159755,20 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114484 && OptimizationEnabled(db, SQLITE_OmitNoopJoin)
114486 - int i;
114487 - Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pResultSet);
114488 - if( sWLB.pOrderBy ){
114489 - tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy);
114490 - }
114491 - for(i=pWInfo->nLevel-1; i>=1; i--){
114492 - WhereTerm *pTerm, *pEnd;
114493 - SrcItem *pItem;
114494 - pLoop = pWInfo->a[i].pWLoop;
114495 - pItem = &pWInfo->pTabList->a[pLoop->iTab];
114496 - if( (pItem->fg.jointype & JT_LEFT)==0 ) continue;
114497 - if( (wctrlFlags & WHERE_WANT_DISTINCT)==0
114498 - && (pLoop->wsFlags & WHERE_ONEROW)==0
114499 - ){
114500 - continue;
114501 - }
114502 - if( (tabUsed & pLoop->maskSelf)!=0 ) continue;
114503 - pEnd = sWLB.pWC->a + sWLB.pWC->nTerm;
114504 - for(pTerm=sWLB.pWC->a; pTerm<pEnd; pTerm++){
114505 - if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
114506 - if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
114507 - || pTerm->pExpr->iRightJoinTable!=pItem->iCursor
114508 - ){
114509 - break;
114510 - }
114511 - }
114512 - }
114513 - if( pTerm<pEnd ) continue;
114514 - WHERETRACE(0xffff, ("-> drop loop %c not used\n", pLoop->cId));
114515 - notReady &= ~pLoop->maskSelf;
114516 - for(pTerm=sWLB.pWC->a; pTerm<pEnd; pTerm++){
114517 - if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){
114518 - pTerm->wtFlags |= TERM_CODED;
114519 - }
114520 - }
114521 - if( i!=pWInfo->nLevel-1 ){
114522 - int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel);
114523 - memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte);
114524 - }
114525 - pWInfo->nLevel--;
114526 - nTabList--;
114527 - }
114529 + nTabList = pWInfo->nLevel;
114536 + if( pWInfo->nLevel>=2
114537 + && OptimizationEnabled(db, SQLITE_BloomFilter)
114544 sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n");
114545 @@ -155849,8 +159841,10 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114549 - if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0
114550 - && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){
114551 + if( ((pLoop->wsFlags & WHERE_IDX_ONLY)==0
114553 + || (pTabItem->fg.jointype & (JT_LTORJ|JT_RIGHT))!=0
114556 if( pWInfo->eOnePass!=ONEPASS_OFF ){
114558 @@ -155863,6 +159857,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114559 if( pWInfo->eOnePass==ONEPASS_OFF
114560 && pTab->nCol<BMS
114561 && (pTab->tabFlags & (TF_HasGenerated|TF_WithoutRowid))==0
114562 + && (pLoop->wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))==0
114566 @@ -155918,6 +159913,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114567 iIndexCur = pParse->nTab++;
114569 pLevel->iIdxCur = iIndexCur;
114571 assert( pIx->pSchema==pTab->pSchema );
114574 @@ -155951,6 +159947,37 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114578 + if( (pTabItem->fg.jointype & JT_RIGHT)!=0
114579 + && (pLevel->pRJ = sqlite3WhereMalloc(pWInfo, sizeof(WhereRightJoin)))!=0
114581 + WhereRightJoin *pRJ = pLevel->pRJ;
114582 + pRJ->iMatch = pParse->nTab++;
114583 + pRJ->regBloom = ++pParse->nMem;
114584 + sqlite3VdbeAddOp2(v, OP_Blob, 65536, pRJ->regBloom);
114585 + pRJ->regReturn = ++pParse->nMem;
114586 + sqlite3VdbeAddOp2(v, OP_Null, 0, pRJ->regReturn);
114587 + assert( pTab==pTabItem->pTab );
114590 + sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRJ->iMatch, 1);
114591 + pInfo = sqlite3KeyInfoAlloc(pParse->db, 1, 0);
114593 + pInfo->aColl[0] = 0;
114594 + pInfo->aSortFlags[0] = 0;
114599 + sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRJ->iMatch, pPk->nKeyCol);
114602 + pLoop->wsFlags &= ~WHERE_IDX_ONLY;
114606 + pWInfo->nOBSat = 0;
114607 + pWInfo->eDistinct = WHERE_DISTINCT_UNORDERED;
114610 pWInfo->iTop = sqlite3VdbeCurrentAddr(v);
114611 if( db->mallocFailed ) goto whereBeginError;
114612 @@ -155962,16 +159989,31 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
114617 if( pParse->nErr ) goto whereBeginError;
114618 pLevel = &pWInfo->a[ii];
114619 wsFlags = pLevel->pWLoop->wsFlags;
114620 + pSrc = &pTabList->a[pLevel->iFrom];
114621 + if( pSrc->fg.isMaterialized ){
114622 + if( pSrc->fg.isCorrelated ){
114623 + sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub);
114626 + sqlite3VdbeAddOp2(v, OP_Gosub, pSrc->regReturn, pSrc->addrFillSub);
114633 - if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){
114634 - constructAutomaticIndex(pParse, &pWInfo->sWC,
114635 - &pTabList->a[pLevel->iFrom], notReady, pLevel);
114636 + constructAutomaticIndex(pParse, &pWInfo->sWC,
114637 + &pTabList->a[pLevel->iFrom], notReady, pLevel);
114642 if( db->mallocFailed ) goto whereBeginError;
114644 -#endif
114648 @@ -156019,6 +160061,26 @@ whereBeginError:
114659 + VdbeOp *pOp = sqlite3VdbeGetOp(v,k--);
114660 + if( pOp->p1!=iCur ) continue;
114661 + if( pOp->opcode==OP_Close ) return 0;
114662 + if( pOp->opcode==OP_OpenRead ) return 1;
114663 + if( pOp->opcode==OP_OpenWrite ) return 1;
114664 + if( pOp->opcode==OP_OpenDup ) return 1;
114665 + if( pOp->opcode==OP_OpenAutoindex ) return 1;
114666 + if( pOp->opcode==OP_OpenEphemeral ) return 1;
114675 @@ -156032,6 +160094,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114676 SrcList *pTabList = pWInfo->pTabList;
114677 sqlite3 *db = pParse->db;
114683 @@ -156039,6 +160102,17 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114684 for(i=pWInfo->nLevel-1; i>=0; i--){
114686 pLevel = &pWInfo->a[i];
114687 + if( pLevel->pRJ ){
114690 + WhereRightJoin *pRJ = pLevel->pRJ;
114691 + sqlite3VdbeResolveLabel(v, pLevel->addrCont);
114692 + pLevel->addrCont = 0;
114693 + pRJ->endSubrtn = sqlite3VdbeCurrentAddr(v);
114694 + sqlite3VdbeAddOp3(v, OP_Return, pRJ->regReturn, pRJ->addrSubrtn, 1);
114698 pLoop = pLevel->pWLoop;
114699 if( pLevel->op!=OP_Noop ){
114701 @@ -156066,7 +160140,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114705 - sqlite3VdbeResolveLabel(v, pLevel->addrCont);
114706 + if( pLevel->addrCont ) sqlite3VdbeResolveLabel(v, pLevel->addrCont);
114707 sqlite3VdbeAddOp3(v, pLevel->op, pLevel->p1, pLevel->p2, pLevel->p3);
114708 sqlite3VdbeChangeP5(v, pLevel->p5);
114710 @@ -156081,7 +160155,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114714 - }else{
114715 + }else if( pLevel->addrCont ){
114716 sqlite3VdbeResolveLabel(v, pLevel->addrCont);
114718 if( (pLoop->wsFlags & WHERE_IN_ABLE)!=0 && pLevel->u.in.nIn>0 ){
114719 @@ -156131,6 +160205,10 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114722 sqlite3VdbeResolveLabel(v, pLevel->addrBrk);
114723 + if( pLevel->pRJ ){
114724 + sqlite3VdbeAddOp3(v, OP_Return, pLevel->pRJ->regReturn, 0, 1);
114727 if( pLevel->addrSkip ){
114728 sqlite3VdbeGoto(v, pLevel->addrSkip);
114729 VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName));
114730 @@ -156174,12 +160252,8 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114731 pWInfo->pTabList->a[pLevel->iFrom].pTab->zName));
114734 - /* The "break" point is here, just past the end of the outer loop.
114735 - ** Set it.
114736 - */
114737 - sqlite3VdbeResolveLabel(v, pWInfo->iBreak);
114738 -
114739 assert( pWInfo->nLevel<=pTabList->nSrc );
114740 + if( pWInfo->pExprMods ) whereUndoExprMods(pWInfo);
114741 for(i=0, pLevel=pWInfo->a; i<pWInfo->nLevel; i++, pLevel++){
114744 @@ -156189,6 +160263,15 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114746 pLoop = pLevel->pWLoop;
114752 + if( pLevel->pRJ ){
114757 /* For a co-routine, change all OP_Column references to the table of
114758 ** the co-routine into OP_Copy of result contained in a register.
114760 @@ -156200,29 +160283,6 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114764 -#ifdef SQLITE_ENABLE_EARLY_CURSOR_CLOSE
114765 - /* Close all of the cursors that were opened by sqlite3WhereBegin.
114766 - ** Except, do not close cursors that will be reused by the OR optimization
114767 - ** (WHERE_OR_SUBCLAUSE). And do not close the OP_OpenWrite cursors
114768 - ** created for the ONEPASS optimization.
114769 - */
114770 - if( (pTab->tabFlags & TF_Ephemeral)==0
114771 - && !IsView(pTab)
114772 - && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0
114773 - ){
114774 - int ws = pLoop->wsFlags;
114775 - if( pWInfo->eOnePass==ONEPASS_OFF && (ws & WHERE_IDX_ONLY)==0 ){
114776 - sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor);
114777 - }
114778 - if( (ws & WHERE_INDEXED)!=0
114779 - && (ws & (WHERE_IPK|WHERE_AUTO_INDEX))==0
114780 - && pLevel->iIdxCur!=pWInfo->aiCurOnePass[1]
114781 - ){
114782 - sqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur);
114783 - }
114784 - }
114785 -#endif
114786 -
114790 @@ -156271,6 +160331,11 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114792 int x = pOp->p2;
114793 assert( pIdx->pTable==pTab );
114795 + if( pOp->opcode==OP_Offset ){
114801 x = pPk->aiColumn[x];
114802 @@ -156284,9 +160349,22 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114803 pOp->p2 = x;
114804 pOp->p1 = pLevel->iIdxCur;
114805 OpcodeRewriteTrace(db, k, pOp);
114808 + ** reference. Verify that this is harmless - that the
114812 + assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0
114813 + || cursorIsOpen(v,pOp->p1,k)
114814 + || pOp->opcode==OP_Offset
114817 + assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0
114818 + || cursorIsOpen(v,pOp->p1,k)
114822 - assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 || x>=0
114823 - || pWInfo->eOnePass );
114824 }else if( pOp->opcode==OP_Rowid ){
114825 pOp->p1 = pLevel->iIdxCur;
114826 pOp->opcode = OP_IdxRowid;
114827 @@ -156305,11 +160383,16 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){
114834 + sqlite3VdbeResolveLabel(v, pWInfo->iBreak);
114838 - if( pWInfo->pExprMods ) whereUndoExprMods(pWInfo);
114839 pParse->nQueryLoop = pWInfo->savedNQueryLoop;
114840 whereInfoFree(db, pWInfo);
114841 + pParse->withinRJSubrtn -= nRJ;
114845 @@ -157041,7 +161124,7 @@ SQLITE_PRIVATE void sqlite3WindowUpdate(
114849 - pWin->pFunc = pFunc;
114850 + pWin->pWFunc = pFunc;
114854 @@ -157233,7 +161316,7 @@ static ExprList *exprListAppendList(
114858 - if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;
114859 + if( pList ) pList->a[nInit+i].fg.sortFlags = pAppend->a[i].fg.sortFlags;
114863 @@ -157274,7 +161357,11 @@ static int disallowAggregatesInOrderByCb(Walker *pWalker, Expr *pExpr){
114867 - if( p->pWin && p->pPrior==0 && ALWAYS((p->selFlags & SF_WinRewrite)==0) ){
114868 + if( p->pWin
114869 + && p->pPrior==0
114870 + && ALWAYS((p->selFlags & SF_WinRewrite)==0)
114874 sqlite3 *db = pParse->db;
114876 @@ -157349,8 +161436,9 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){
114877 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
114879 assert( ExprUseXList(pWin->pOwner) );
114880 + assert( pWin->pWFunc!=0 );
114881 pArgs = pWin->pOwner->x.pList;
114882 - if( pWin->pFunc->funcFlags & SQLITE_FUNC_SUBTYPE ){
114883 + if( pWin->pWFunc->funcFlags & SQLITE_FUNC_SUBTYPE ){
114885 pWin->iArgCol = (pSublist ? pSublist->nExpr : 0);
114886 pWin->bExprArgs = 1;
114887 @@ -157423,12 +161511,7 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){
114891 - if( rc ){
114892 - if( pParse->nErr==0 ){
114893 - assert( pParse->db->mallocFailed );
114894 - sqlite3ErrorToParser(pParse->db, SQLITE_NOMEM);
114895 - }
114896 - }
114897 + assert( rc==SQLITE_OK || pParse->nErr!=0 );
114901 @@ -157737,7 +161820,7 @@ SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse *pParse, Select *pSelect){
114904 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
114905 - FuncDef *p = pWin->pFunc;
114906 + FuncDef *p = pWin->pWFunc;
114907 if( (p->funcFlags & SQLITE_FUNC_MINMAX) && pWin->eStart!=TK_UNBOUNDED ){
114910 @@ -157754,7 +161837,7 @@ SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse *pParse, Select *pSelect){
114911 pWin->csrApp = pParse->nTab++;
114912 pWin->regApp = pParse->nMem+1;
114913 pParse->nMem += 3;
114914 - if( pKeyInfo && pWin->pFunc->zName[1]=='i' ){
114915 + if( pKeyInfo && pWin->pWFunc->zName[1]=='i' ){
114916 assert( pKeyInfo->aSortFlags[0]==0 );
114917 pKeyInfo->aSortFlags[0] = KEYINFO_ORDER_DESC;
114919 @@ -157977,7 +162060,7 @@ static void windowAggStep(
114922 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
114923 - FuncDef *pFunc = pWin->pFunc;
114924 + FuncDef *pFunc = pWin->pWFunc;
114926 int nArg = pWin->bExprArgs ? 0 : windowArgCount(pWin);
114928 @@ -158046,7 +162129,7 @@ static void windowAggStep(
114932 - if( pOp->opcode==OP_Column && pOp->p1==pWin->iEphCsr ){
114933 + if( pOp->opcode==OP_Column && pOp->p1==pMWin->iEphCsr ){
114934 pOp->p1 = csr;
114937 @@ -158091,7 +162174,7 @@ static void windowAggFinal(WindowCodeArg *p, int bFin){
114939 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
114940 if( pMWin->regStartRowid==0
114941 - && (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX)
114942 + && (pWin->pWFunc->funcFlags & SQLITE_FUNC_MINMAX)
114943 && (pWin->eStart!=TK_UNBOUNDED)
114945 sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult);
114946 @@ -158105,12 +162188,12 @@ static void windowAggFinal(WindowCodeArg *p, int bFin){
114949 sqlite3VdbeAddOp2(v, OP_AggFinal, pWin->regAccum, nArg);
114950 - sqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF);
114951 + sqlite3VdbeAppendP4(v, pWin->pWFunc, P4_FUNCDEF);
114952 sqlite3VdbeAddOp2(v, OP_Copy, pWin->regAccum, pWin->regResult);
114953 sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
114955 sqlite3VdbeAddOp3(v, OP_AggValue,pWin->regAccum,nArg,pWin->regResult);
114956 - sqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF);
114957 + sqlite3VdbeAppendP4(v, pWin->pWFunc, P4_FUNCDEF);
114961 @@ -158239,7 +162322,7 @@ static void windowReturnOneRow(WindowCodeArg *p){
114964 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
114965 - FuncDef *pFunc = pWin->pFunc;
114966 + FuncDef *pFunc = pWin->pWFunc;
114967 assert( ExprUseXList(pWin->pOwner) );
114968 if( pFunc->zName==nth_valueName
114969 || pFunc->zName==first_valueName
114970 @@ -158311,7 +162394,7 @@ static int windowInitAccum(Parse *pParse, Window *pMWin){
114973 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
114974 - FuncDef *pFunc = pWin->pFunc;
114975 + FuncDef *pFunc = pWin->pWFunc;
114976 assert( pWin->regAccum );
114977 sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum);
114979 @@ -158341,7 +162424,7 @@ static int windowCacheFrame(Window *pMWin){
114981 if( pMWin->regStartRowid ) return 1;
114982 for(pWin=pMWin; pWin; pWin=pWin->pNextWin){
114983 - FuncDef *pFunc = pWin->pFunc;
114984 + FuncDef *pFunc = pWin->pWFunc;
114985 if( (pFunc->zName==nth_valueName)
114986 || (pFunc->zName==first_valueName)
114987 || (pFunc->zName==leadName)
114988 @@ -158434,7 +162517,7 @@ static void windowCodeRangeTest(
114991 assert( pOrderBy && pOrderBy->nExpr==1 );
114992 - if( pOrderBy->a[0].sortFlags & KEYINFO_ORDER_DESC ){
114993 + if( pOrderBy->a[0].fg.sortFlags & KEYINFO_ORDER_DESC ){
114997 @@ -158467,7 +162550,7 @@ static void windowCodeRangeTest(
115001 - if( pOrderBy->a[0].sortFlags & KEYINFO_ORDER_BIGNULL ){
115002 + if( pOrderBy->a[0].fg.sortFlags & KEYINFO_ORDER_BIGNULL ){
115006 @@ -158699,7 +162782,7 @@ SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window…
115007 pNew->zName = sqlite3DbStrDup(db, p->zName);
115008 pNew->zBase = sqlite3DbStrDup(db, p->zBase);
115009 pNew->pFilter = sqlite3ExprDup(db, p->pFilter, 0);
115010 - pNew->pFunc = p->pFunc;
115011 + pNew->pWFunc = p->pWFunc;
115012 pNew->pPartition = sqlite3ExprListDup(db, p->pPartition, 0);
115013 pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, 0);
115014 pNew->eFrmType = p->eFrmType;
115015 @@ -159576,10 +163659,7 @@ static void updateDeleteLimitError(
115019 - /* Construct a new Expr object from a single identifier. Use the
115020 - ** new Expr to populate pOut. Set the span of pOut to be the identifier
115021 - ** that created the expression.
115022 - */
115025 Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1);
115027 @@ -159588,7 +163668,7 @@ static void updateDeleteLimitError(
115028 p->affExpr = 0;
115029 p->flags = EP_Leaf;
115031 - p->iAgg = -1;
115032 + /* p->iAgg = -1; // Not required */
115033 p->pLeft = p->pRight = 0;
115034 p->pAggInfo = 0;
115035 memset(&p->x, 0, sizeof(p->x));
115036 @@ -159599,6 +163679,7 @@ static void updateDeleteLimitError(
115037 p->u.zToken = (char*)&p[1];
115038 memcpy(p->u.zToken, t.z, t.n);
115039 p->u.zToken[t.n] = 0;
115040 + p->w.iOfst = (int)(t.z - pParse->zTail);
115041 if( sqlite3Isquote(p->u.zToken[0]) ){
115044 @@ -159755,75 +163836,76 @@ static void updateDeleteLimitError(
115048 -#define TK_COLLATE 102
115049 -#define TK_BITNOT 103
115050 -#define TK_ON 104
115051 -#define TK_INDEXED 105
115052 -#define TK_STRING 106
115053 -#define TK_JOIN_KW 107
115054 -#define TK_CONSTRAINT 108
115055 -#define TK_DEFAULT 109
115056 -#define TK_NULL 110
115057 -#define TK_PRIMARY 111
115058 -#define TK_UNIQUE 112
115059 -#define TK_CHECK 113
115060 -#define TK_REFERENCES 114
115061 -#define TK_AUTOINCR 115
115062 -#define TK_INSERT 116
115063 -#define TK_DELETE 117
115064 -#define TK_UPDATE 118
115065 -#define TK_SET 119
115066 -#define TK_DEFERRABLE 120
115067 -#define TK_FOREIGN 121
115068 -#define TK_DROP 122
115069 -#define TK_UNION 123
115070 -#define TK_ALL 124
115071 -#define TK_EXCEPT 125
115072 -#define TK_INTERSECT 126
115073 -#define TK_SELECT 127
115074 -#define TK_VALUES 128
115075 -#define TK_DISTINCT 129
115076 -#define TK_DOT 130
115077 -#define TK_FROM 131
115078 -#define TK_JOIN 132
115079 -#define TK_USING 133
115080 -#define TK_ORDER 134
115081 -#define TK_GROUP 135
115082 -#define TK_HAVING 136
115083 -#define TK_LIMIT 137
115084 -#define TK_WHERE 138
115085 -#define TK_RETURNING 139
115086 -#define TK_INTO 140
115087 -#define TK_NOTHING 141
115088 -#define TK_FLOAT 142
115089 -#define TK_BLOB 143
115090 -#define TK_INTEGER 144
115091 -#define TK_VARIABLE 145
115092 -#define TK_CASE 146
115093 -#define TK_WHEN 147
115094 -#define TK_THEN 148
115095 -#define TK_ELSE 149
115096 -#define TK_INDEX 150
115097 -#define TK_ALTER 151
115098 -#define TK_ADD 152
115099 -#define TK_COLUMN 153
115100 -#define TK_AGG_FUNCTION 154
115101 -#define TK_AGG_COLUMN 155
115102 -#define TK_TRUEFALSE 156
115103 -#define TK_ISNOT 157
115104 -#define TK_FUNCTION 158
115105 -#define TK_UMINUS 159
115106 -#define TK_UPLUS 160
115107 -#define TK_TRUTH 161
115108 -#define TK_REGISTER 162
115109 -#define TK_VECTOR 163
115110 -#define TK_SELECT_COLUMN 164
115111 -#define TK_IF_NULL_ROW 165
115112 -#define TK_ASTERISK 166
115113 -#define TK_SPAN 167
115114 -#define TK_ERROR 168
115115 -#define TK_SPACE 169
115116 -#define TK_ILLEGAL 170
115190 @@ -159883,28 +163965,29 @@ static void updateDeleteLimitError(
115194 -#define YYNOCODE 289
115202 - With* yy23;
115203 - const char* yy70;
115204 - struct TrigEvent yy96;
115205 - SrcList* yy155;
115206 - u32 yy213;
115207 - Upsert* yy232;
115208 - Cte* yy259;
115209 - struct {int value; int mask;} yy277;
115210 - int yy332;
115211 - ExprList* yy368;
115212 - IdList* yy374;
115213 - TriggerStep* yy387;
115214 - Select* yy433;
115215 - Expr* yy454;
115216 - u8 yy478;
115236 @@ -159920,18 +164003,18 @@ typedef union {
115237 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
115238 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
115240 -#define YYNSTATE 517
115241 -#define YYNRULE 360
115242 -#define YYNRULE_WITH_ACTION 299
115243 -#define YYNTOKEN 171
115244 -#define YY_MAX_SHIFT 516
115245 -#define YY_MIN_SHIFTREDUCE 742
115246 -#define YY_MAX_SHIFTREDUCE 1101
115247 -#define YY_ERROR_ACTION 1102
115248 -#define YY_ACCEPT_ACTION 1103
115249 -#define YY_NO_ACTION 1104
115250 -#define YY_MIN_REDUCE 1105
115251 -#define YY_MAX_REDUCE 1464
115267 @@ -159998,529 +164081,543 @@ typedef union {
115271 -#define YY_ACTTAB_COUNT (1736)
115274 - /* 0 */ 102, 99, 196, 102, 99, 196, 480, 1127, 510, 418,
115275 - /* 10 */ 1174, 510, 1153, 504, 504, 504, 372, 513, 370, 513,
115276 - /* 20 */ 1174, 1380, 1460, 358, 341, 242, 242, 342, 875, 12,
115277 - /* 30 */ 12, 58, 58, 372, 43, 43, 876, 507, 481, 86,
115278 - /* 40 */ 362, 109, 110, 100, 1079, 1079, 949, 952, 942, 942,
115279 - /* 50 */ 107, 107, 108, 108, 108, 108, 1179, 1179, 109, 110,
115280 - /* 60 */ 100, 1079, 1079, 949, 952, 942, 942, 107, 107, 108,
115281 - /* 70 */ 108, 108, 108, 248, 248, 248, 248, 102, 99, 196,
115282 - /* 80 */ 102, 99, 196, 357, 1099, 507, 111, 507, 414, 224,
115283 - /* 90 */ 193, 345, 106, 106, 106, 106, 105, 105, 104, 104,
115284 - /* 100 */ 104, 103, 407, 372, 433, 1278, 414, 413, 407, 106,
115285 - /* 110 */ 106, 106, 106, 105, 105, 104, 104, 104, 103, 407,
115286 - /* 120 */ 108, 108, 108, 108, 101, 405, 405, 405, 109, 110,
115287 - /* 130 */ 100, 1079, 1079, 949, 952, 942, 942, 107, 107, 108,
115288 - /* 140 */ 108, 108, 108, 106, 106, 106, 106, 105, 105, 104,
115289 - /* 150 */ 104, 104, 103, 407, 68, 1100, 235, 167, 426, 301,
115290 - /* 160 */ 106, 106, 106, 106, 105, 105, 104, 104, 104, 103,
115291 - /* 170 */ 407, 372, 245, 1349, 860, 387, 69, 414, 1136, 106,
115292 - /* 180 */ 106, 106, 106, 105, 105, 104, 104, 104, 103, 407,
115293 - /* 190 */ 1055, 1349, 1351, 372, 313, 1055, 109, 110, 100, 1079,
115294 - /* 200 */ 1079, 949, 952, 942, 942, 107, 107, 108, 108, 108,
115295 - /* 210 */ 108, 105, 105, 104, 104, 104, 103, 407, 109, 110,
115296 - /* 220 */ 100, 1079, 1079, 949, 952, 942, 942, 107, 107, 108,
115297 - /* 230 */ 108, 108, 108, 104, 104, 104, 103, 407, 1055, 1056,
115298 - /* 240 */ 1057, 103, 407, 1055, 1056, 1057, 1139, 106, 106, 106,
115299 - /* 250 */ 106, 105, 105, 104, 104, 104, 103, 407, 308, 195,
115300 - /* 260 */ 311, 1138, 1349, 8, 372, 1055, 1177, 1177, 315, 106,
115301 - /* 270 */ 106, 106, 106, 105, 105, 104, 104, 104, 103, 407,
115302 - /* 280 */ 108, 108, 108, 108, 860, 939, 939, 950, 953, 109,
115303 - /* 290 */ 110, 100, 1079, 1079, 949, 952, 942, 942, 107, 107,
115304 - /* 300 */ 108, 108, 108, 108, 217, 284, 841, 465, 462, 461,
115305 - /* 310 */ 124, 1431, 435, 1055, 1056, 1057, 182, 460, 431, 243,
115306 - /* 320 */ 106, 106, 106, 106, 105, 105, 104, 104, 104, 103,
115307 - /* 330 */ 407, 510, 441, 372, 176, 1055, 437, 466, 415, 425,
115308 - /* 340 */ 106, 106, 106, 106, 105, 105, 104, 104, 104, 103,
115309 - /* 350 */ 407, 943, 329, 184, 59, 59, 277, 501, 109, 110,
115310 - /* 360 */ 100, 1079, 1079, 949, 952, 942, 942, 107, 107, 108,
115311 - /* 370 */ 108, 108, 108, 509, 404, 403, 416, 510, 102, 99,
115312 - /* 380 */ 196, 510, 1083, 1055, 1056, 1057, 256, 1085, 493, 452,
115313 - /* 390 */ 492, 391, 475, 1344, 911, 1084, 404, 403, 1425, 482,
115314 - /* 400 */ 59, 59, 124, 168, 39, 39, 1146, 1209, 510, 106,
115315 - /* 410 */ 106, 106, 106, 105, 105, 104, 104, 104, 103, 407,
115316 - /* 420 */ 1086, 1127, 1086, 248, 248, 8, 372, 248, 248, 260,
115317 - /* 430 */ 781, 9, 9, 1125, 1379, 507, 492, 299, 1055, 507,
115318 - /* 440 */ 476, 1055, 1086, 372, 1086, 494, 385, 774, 277, 501,
115319 - /* 450 */ 124, 109, 110, 100, 1079, 1079, 949, 952, 942, 942,
115320 - /* 460 */ 107, 107, 108, 108, 108, 108, 376, 992, 109, 110,
115321 - /* 470 */ 100, 1079, 1079, 949, 952, 942, 942, 107, 107, 108,
115322 - /* 480 */ 108, 108, 108, 357, 1031, 1055, 1055, 1056, 1057, 1055,
115323 - /* 490 */ 1056, 1057, 510, 331, 1055, 994, 277, 501, 331, 994,
115324 - /* 500 */ 127, 442, 106, 106, 106, 106, 105, 105, 104, 104,
115325 - /* 510 */ 104, 103, 407, 200, 510, 9, 9, 340, 177, 106,
115326 - /* 520 */ 106, 106, 106, 105, 105, 104, 104, 104, 103, 407,
115327 - /* 530 */ 390, 360, 447, 1055, 1056, 1057, 372, 9, 9, 1278,
115328 - /* 540 */ 930, 135, 1055, 1056, 1057, 217, 137, 446, 465, 462,
115329 - /* 550 */ 461, 443, 392, 372, 911, 1100, 331, 916, 460, 1094,
115330 - /* 560 */ 452, 109, 110, 100, 1079, 1079, 949, 952, 942, 942,
115331 - /* 570 */ 107, 107, 108, 108, 108, 108, 426, 301, 109, 110,
115332 - /* 580 */ 100, 1079, 1079, 949, 952, 942, 942, 107, 107, 108,
115333 - /* 590 */ 108, 108, 108, 1055, 85, 1013, 435, 299, 421, 287,
115334 - /* 600 */ 452, 510, 1402, 1055, 134, 380, 1157, 1402, 130, 388,
115335 - /* 610 */ 1014, 329, 106, 106, 106, 106, 105, 105, 104, 104,
115336 - /* 620 */ 104, 103, 407, 441, 59, 59, 1015, 177, 4, 106,
115337 - /* 630 */ 106, 106, 106, 105, 105, 104, 104, 104, 103, 407,
115338 - /* 640 */ 371, 1055, 1056, 1057, 510, 1343, 372, 817, 382, 174,
115339 - /* 650 */ 399, 1055, 1056, 1057, 997, 997, 449, 190, 1059, 818,
115340 - /* 660 */ 492, 410, 269, 372, 269, 1402, 1055, 59, 59, 491,
115341 - /* 670 */ 261, 109, 110, 100, 1079, 1079, 949, 952, 942, 942,
115342 - /* 680 */ 107, 107, 108, 108, 108, 108, 71, 788, 109, 110,
115343 - /* 690 */ 100, 1079, 1079, 949, 952, 942, 942, 107, 107, 108,
115344 - /* 700 */ 108, 108, 108, 492, 1013, 396, 508, 1059, 831, 831,
115345 - /* 710 */ 319, 1430, 474, 806, 1055, 1056, 1057, 286, 1055, 1014,
115346 - /* 720 */ 298, 382, 106, 106, 106, 106, 105, 105, 104, 104,
115347 - /* 730 */ 104, 103, 407, 1055, 479, 1015, 777, 435, 486, 106,
115348 - /* 740 */ 106, 106, 106, 105, 105, 104, 104, 104, 103, 407,
115349 - /* 750 */ 1404, 1044, 252, 510, 277, 501, 498, 355, 355, 354,
115350 - /* 760 */ 237, 352, 177, 427, 754, 331, 1055, 1056, 1057, 929,
115351 - /* 770 */ 351, 254, 929, 83, 468, 365, 44, 44, 88, 282,
115352 - /* 780 */ 265, 1055, 1056, 1057, 777, 922, 296, 281, 922, 921,
115353 - /* 790 */ 257, 393, 921, 862, 2, 91, 435, 234, 251, 327,
115354 - /* 800 */ 471, 322, 470, 222, 473, 1036, 248, 248, 861, 318,
115355 - /* 810 */ 510, 264, 372, 136, 1278, 248, 248, 178, 507, 194,
115356 - /* 820 */ 201, 921, 921, 923, 921, 921, 923, 507, 146, 372,
115357 - /* 830 */ 836, 122, 1055, 59, 59, 835, 344, 109, 110, 100,
115358 - /* 840 */ 1079, 1079, 949, 952, 942, 942, 107, 107, 108, 108,
115359 - /* 850 */ 108, 108, 1128, 378, 109, 110, 100, 1079, 1079, 949,
115360 - /* 860 */ 952, 942, 942, 107, 107, 108, 108, 108, 108, 487,
115361 - /* 870 */ 266, 452, 373, 1156, 1402, 1278, 510, 277, 501, 510,
115362 - /* 880 */ 1055, 1056, 1057, 1185, 389, 113, 1386, 331, 106, 106,
115363 - /* 890 */ 106, 106, 105, 105, 104, 104, 104, 103, 407, 59,
115364 - /* 900 */ 59, 412, 9, 9, 510, 106, 106, 106, 106, 105,
115365 - /* 910 */ 105, 104, 104, 104, 103, 407, 1186, 268, 248, 248,
115366 - /* 920 */ 510, 291, 372, 1032, 1458, 382, 1458, 9, 9, 836,
115367 - /* 930 */ 507, 745, 746, 747, 835, 402, 441, 1032, 1459, 372,
115368 - /* 940 */ 1459, 452, 489, 59, 59, 448, 227, 109, 98, 100,
115369 - /* 950 */ 1079, 1079, 949, 952, 942, 942, 107, 107, 108, 108,
115370 - /* 960 */ 108, 108, 369, 368, 253, 110, 100, 1079, 1079, 949,
115371 - /* 970 */ 952, 942, 942, 107, 107, 108, 108, 108, 108, 406,
115372 - /* 980 */ 249, 249, 1076, 1155, 457, 288, 1182, 290, 757, 452,
115373 - /* 990 */ 1388, 1123, 507, 477, 259, 1030, 1403, 280, 106, 106,
115374 - /* 1000 */ 106, 106, 105, 105, 104, 104, 104, 103, 407, 1030,
115375 - /* 1010 */ 495, 797, 221, 202, 1278, 106, 106, 106, 106, 105,
115376 - /* 1020 */ 105, 104, 104, 104, 103, 407, 248, 248, 248, 248,
115377 - /* 1030 */ 190, 1076, 372, 267, 306, 411, 132, 5, 507, 227,
115378 - /* 1040 */ 507, 503, 378, 469, 497, 248, 248, 220, 219, 218,
115379 - /* 1050 */ 424, 379, 154, 798, 1075, 277, 501, 507, 289, 100,
115380 - /* 1060 */ 1079, 1079, 949, 952, 942, 942, 107, 107, 108, 108,
115381 - /* 1070 */ 108, 108, 377, 510, 769, 1076, 510, 1384, 95, 502,
115382 - /* 1080 */ 510, 3, 972, 510, 400, 419, 247, 193, 318, 860,
115383 - /* 1090 */ 1191, 283, 72, 181, 370, 505, 11, 11, 394, 32,
115384 - /* 1100 */ 32, 507, 510, 45, 45, 13, 33, 33, 106, 106,
115385 - /* 1110 */ 106, 106, 105, 105, 104, 104, 104, 103, 407, 408,
115386 - /* 1120 */ 1336, 221, 204, 769, 1076, 46, 46, 1222, 483, 95,
115387 - /* 1130 */ 502, 510, 3, 499, 1221, 1405, 516, 1105, 510, 185,
115388 - /* 1140 */ 428, 439, 278, 124, 128, 383, 505, 95, 502, 370,
115389 - /* 1150 */ 3, 1187, 929, 510, 47, 47, 510, 453, 93, 93,
115390 - /* 1160 */ 22, 48, 48, 185, 505, 94, 432, 408, 512, 511,
115391 - /* 1170 */ 408, 420, 921, 276, 195, 370, 49, 49, 1391, 50,
115392 - /* 1180 */ 50, 377, 370, 784, 499, 875, 248, 248, 408, 277,
115393 - /* 1190 */ 501, 510, 23, 876, 92, 133, 90, 28, 507, 860,
115394 - /* 1200 */ 292, 510, 499, 929, 921, 921, 923, 924, 19, 93,
115395 - /* 1210 */ 93, 840, 205, 1368, 34, 34, 94, 484, 408, 512,
115396 - /* 1220 */ 511, 929, 1367, 921, 35, 35, 429, 93, 93, 510,
115397 - /* 1230 */ 440, 1027, 784, 359, 94, 444, 408, 512, 511, 510,
115398 - /* 1240 */ 979, 921, 510, 409, 87, 502, 510, 3, 510, 262,
115399 - /* 1250 */ 878, 879, 36, 36, 326, 921, 921, 923, 924, 19,
115400 - /* 1260 */ 510, 505, 38, 38, 325, 51, 51, 510, 250, 52,
115401 - /* 1270 */ 52, 53, 53, 921, 921, 923, 924, 19, 303, 297,
115402 - /* 1280 */ 913, 85, 226, 10, 10, 408, 179, 1044, 252, 979,
115403 - /* 1290 */ 54, 54, 925, 355, 355, 354, 237, 352, 510, 499,
115404 - /* 1300 */ 754, 1103, 1, 1, 516, 1105, 796, 795, 274, 434,
115405 - /* 1310 */ 278, 226, 128, 1218, 307, 282, 510, 310, 929, 1187,
115406 - /* 1320 */ 312, 115, 115, 281, 93, 93, 510, 314, 1170, 510,
115407 - /* 1330 */ 436, 94, 226, 408, 512, 511, 240, 510, 921, 55,
115408 - /* 1340 */ 55, 925, 302, 458, 85, 223, 316, 1154, 85, 40,
115409 - /* 1350 */ 40, 321, 56, 56, 248, 248, 201, 330, 510, 1230,
115410 - /* 1360 */ 57, 57, 1277, 510, 146, 510, 507, 122, 510, 1205,
115411 - /* 1370 */ 921, 921, 923, 924, 19, 803, 804, 510, 1216, 1418,
115412 - /* 1380 */ 205, 41, 41, 510, 496, 1283, 141, 141, 142, 142,
115413 - /* 1390 */ 1135, 64, 64, 510, 975, 510, 223, 510, 1126, 510,
115414 - /* 1400 */ 42, 42, 510, 869, 510, 226, 60, 60, 373, 1114,
115415 - /* 1410 */ 833, 409, 97, 277, 501, 510, 116, 116, 61, 61,
115416 - /* 1420 */ 117, 117, 118, 118, 510, 114, 114, 140, 140, 1113,
115417 - /* 1430 */ 991, 510, 991, 990, 510, 990, 510, 412, 139, 139,
115418 - /* 1440 */ 510, 767, 510, 131, 510, 1115, 510, 123, 123, 510,
115419 - /* 1450 */ 1411, 834, 1202, 97, 121, 121, 187, 119, 119, 120,
115420 - /* 1460 */ 120, 333, 335, 63, 63, 65, 65, 62, 62, 31,
115421 - /* 1470 */ 31, 337, 37, 37, 356, 7, 199, 417, 1259, 258,
115422 - /* 1480 */ 1264, 1252, 255, 463, 294, 295, 263, 191, 1269, 1153,
115423 - /* 1490 */ 438, 300, 500, 1268, 363, 350, 324, 1340, 1339, 1414,
115424 - /* 1500 */ 1094, 1091, 186, 229, 381, 71, 339, 183, 165, 1345,
115425 - /* 1510 */ 151, 422, 160, 423, 158, 456, 207, 83, 161, 67,
115426 - /* 1520 */ 156, 197, 70, 162, 25, 1265, 163, 1273, 361, 445,
115427 - /* 1530 */ 430, 1271, 1270, 364, 26, 169, 1334, 211, 77, 451,
115428 - /* 1540 */ 241, 213, 173, 454, 309, 214, 366, 1116, 215, 472,
115429 - /* 1550 */ 1356, 1173, 1172, 305, 1171, 395, 79, 1164, 788, 1429,
115430 - /* 1560 */ 367, 1428, 397, 1143, 398, 272, 485, 82, 1142, 323,
115431 - /* 1570 */ 1163, 478, 1141, 1427, 273, 1213, 1214, 332, 328, 334,
115432 - /* 1580 */ 228, 1212, 336, 401, 1211, 338, 6, 1320, 343, 112,
115433 - /* 1590 */ 490, 1237, 1236, 89, 84, 488, 275, 24, 514, 1049,
115434 - /* 1600 */ 239, 236, 1195, 238, 515, 1111, 1106, 374, 348, 346,
115435 - /* 1610 */ 347, 349, 143, 1372, 1373, 375, 1371, 1370, 144, 129,
115436 - /* 1620 */ 270, 180, 188, 279, 189, 198, 145, 126, 66, 155,
115437 - /* 1630 */ 989, 987, 285, 147, 157, 820, 159, 1075, 203, 206,
115438 - /* 1640 */ 293, 1003, 164, 148, 149, 384, 386, 166, 150, 73,
115439 - /* 1650 */ 74, 75, 76, 1006, 208, 1002, 209, 138, 14, 210,
115440 - /* 1660 */ 304, 995, 170, 226, 450, 1088, 212, 171, 27, 756,
115441 - /* 1670 */ 325, 216, 455, 459, 464, 799, 172, 78, 15, 786,
115442 - /* 1680 */ 317, 16, 320, 80, 29, 152, 271, 928, 927, 467,
115443 - /* 1690 */ 955, 81, 1038, 244, 192, 1037, 246, 868, 175, 97,
115444 - /* 1700 */ 863, 231, 225, 85, 970, 17, 18, 956, 954, 958,
115445 - /* 1710 */ 1012, 959, 1011, 230, 20, 30, 506, 926, 768, 96,
115446 - /* 1720 */ 21, 232, 353, 1045, 153, 233, 1420, 125, 830, 1104,
115447 - /* 1730 */ 1104, 1104, 1104, 1104, 1104, 1419,
115630 - /* 0 */ 257, 258, 259, 257, 258, 259, 178, 178, 178, 229,
115631 - /* 10 */ 208, 178, 210, 195, 196, 197, 16, 188, 238, 190,
115632 - /* 20 */ 218, 278, 284, 285, 204, 224, 225, 204, 28, 201,
115633 - /* 30 */ 202, 201, 202, 16, 201, 202, 36, 236, 189, 22,
115634 - /* 40 */ 189, 41, 42, 43, 44, 45, 46, 47, 48, 49,
115635 - /* 50 */ 50, 51, 52, 53, 54, 55, 220, 221, 41, 42,
115643 - /* 70 */ 53, 54, 55, 224, 225, 224, 225, 257, 258, 259,
115644 - /* 80 */ 257, 258, 259, 19, 20, 236, 69, 236, 178, 240,
115645 - /* 90 */ 241, 261, 92, 93, 94, 95, 96, 97, 98, 99,
115646 - /* 100 */ 100, 101, 102, 16, 253, 178, 196, 197, 102, 92,
115652 - /* 120 */ 52, 53, 54, 55, 56, 195, 196, 197, 41, 42,
115653 - /* 130 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
115654 - /* 140 */ 53, 54, 55, 92, 93, 94, 95, 96, 97, 98,
115655 - /* 150 */ 99, 100, 101, 102, 67, 91, 23, 19, 117, 118,
115656 - /* 160 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
115657 - /* 170 */ 102, 16, 20, 178, 22, 248, 21, 267, 201, 92,
115665 - /* 190 */ 57, 196, 197, 16, 13, 57, 41, 42, 43, 44,
115666 - /* 200 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
115667 - /* 210 */ 55, 96, 97, 98, 99, 100, 101, 102, 41, 42,
115668 - /* 220 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
115669 - /* 230 */ 53, 54, 55, 98, 99, 100, 101, 102, 105, 106,
115670 - /* 240 */ 107, 101, 102, 105, 106, 107, 201, 92, 93, 94,
115671 - /* 250 */ 95, 96, 97, 98, 99, 100, 101, 102, 77, 107,
115672 - /* 260 */ 79, 201, 267, 198, 16, 57, 220, 221, 20, 92,
115673 - /* 270 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
115674 - /* 280 */ 52, 53, 54, 55, 132, 44, 45, 46, 47, 41,
115675 - /* 290 */ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
115676 - /* 300 */ 52, 53, 54, 55, 108, 178, 98, 111, 112, 113,
115677 - /* 310 */ 81, 215, 178, 105, 106, 107, 139, 121, 104, 198,
115678 - /* 320 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
115679 - /* 330 */ 102, 178, 178, 16, 269, 57, 178, 20, 109, 274,
115680 - /* 340 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
115681 - /* 350 */ 102, 110, 178, 139, 201, 202, 127, 128, 41, 42,
115682 - /* 360 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
115683 - /* 370 */ 53, 54, 55, 178, 96, 97, 253, 178, 257, 258,
115684 - /* 380 */ 259, 178, 104, 105, 106, 107, 252, 109, 189, 178,
115685 - /* 390 */ 237, 217, 189, 266, 73, 117, 96, 97, 200, 246,
115686 - /* 400 */ 201, 202, 81, 19, 201, 202, 208, 242, 178, 92,
115687 - /* 410 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
115688 - /* 420 */ 142, 178, 144, 224, 225, 198, 16, 224, 225, 275,
115689 - /* 430 */ 20, 201, 202, 190, 223, 236, 237, 116, 57, 236,
115690 - /* 440 */ 237, 57, 142, 16, 144, 246, 216, 20, 127, 128,
115691 - /* 450 */ 81, 41, 42, 43, 44, 45, 46, 47, 48, 49,
115692 - /* 460 */ 50, 51, 52, 53, 54, 55, 183, 8, 41, 42,
115693 - /* 470 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
115694 - /* 480 */ 53, 54, 55, 19, 20, 57, 105, 106, 107, 105,
115695 - /* 490 */ 106, 107, 178, 178, 57, 26, 127, 128, 178, 30,
115696 - /* 500 */ 72, 274, 92, 93, 94, 95, 96, 97, 98, 99,
115697 - /* 510 */ 100, 101, 102, 12, 178, 201, 202, 178, 178, 92,
115698 - /* 520 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
115699 - /* 530 */ 216, 191, 63, 105, 106, 107, 16, 201, 202, 178,
115700 - /* 540 */ 20, 226, 105, 106, 107, 108, 226, 264, 111, 112,
115701 - /* 550 */ 113, 268, 216, 16, 73, 91, 178, 20, 121, 58,
115702 - /* 560 */ 178, 41, 42, 43, 44, 45, 46, 47, 48, 49,
115703 - /* 570 */ 50, 51, 52, 53, 54, 55, 117, 118, 41, 42,
115704 - /* 580 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
115705 - /* 590 */ 53, 54, 55, 57, 22, 9, 178, 116, 117, 118,
115706 - /* 600 */ 178, 178, 287, 57, 226, 223, 211, 287, 72, 248,
115707 - /* 610 */ 24, 178, 92, 93, 94, 95, 96, 97, 98, 99,
115708 - /* 620 */ 100, 101, 102, 178, 201, 202, 40, 178, 19, 92,
115709 - /* 630 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
115710 - /* 640 */ 191, 105, 106, 107, 178, 223, 16, 61, 178, 22,
115711 - /* 650 */ 217, 105, 106, 107, 116, 117, 118, 22, 57, 73,
115712 - /* 660 */ 237, 279, 213, 16, 215, 287, 57, 201, 202, 246,
115713 - /* 670 */ 252, 41, 42, 43, 44, 45, 46, 47, 48, 49,
115714 - /* 680 */ 50, 51, 52, 53, 54, 55, 140, 115, 41, 42,
115715 - /* 690 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
115716 - /* 700 */ 53, 54, 55, 237, 9, 16, 123, 106, 125, 126,
115717 - /* 710 */ 21, 20, 246, 22, 105, 106, 107, 247, 57, 24,
115718 - /* 720 */ 275, 178, 92, 93, 94, 95, 96, 97, 98, 99,
115719 - /* 730 */ 100, 101, 102, 57, 16, 40, 57, 178, 178, 92,
115720 - /* 740 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
115721 - /* 750 */ 0, 1, 2, 178, 127, 128, 61, 7, 8, 9,
115722 - /* 760 */ 10, 11, 178, 118, 14, 178, 105, 106, 107, 90,
115723 - /* 770 */ 186, 189, 90, 138, 85, 191, 201, 202, 148, 29,
115724 - /* 780 */ 189, 105, 106, 107, 105, 106, 141, 37, 106, 110,
115725 - /* 790 */ 247, 102, 110, 132, 19, 148, 178, 108, 109, 110,
115726 - /* 800 */ 111, 112, 113, 114, 98, 87, 224, 225, 132, 120,
115727 - /* 810 */ 178, 252, 16, 226, 178, 224, 225, 21, 236, 178,
115728 - /* 820 */ 70, 142, 143, 144, 142, 143, 144, 236, 78, 16,
115729 - /* 830 */ 124, 81, 57, 201, 202, 129, 178, 41, 42, 43,
115730 - /* 840 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
115731 - /* 850 */ 54, 55, 193, 194, 41, 42, 43, 44, 45, 46,
115732 - /* 860 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 237,
115733 - /* 870 */ 252, 178, 122, 211, 287, 178, 178, 127, 128, 178,
115734 - /* 880 */ 105, 106, 107, 189, 248, 19, 178, 178, 92, 93,
115735 - /* 890 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 201,
115736 - /* 900 */ 202, 151, 201, 202, 178, 92, 93, 94, 95, 96,
115737 - /* 910 */ 97, 98, 99, 100, 101, 102, 223, 216, 224, 225,
115738 - /* 920 */ 178, 13, 16, 19, 20, 178, 22, 201, 202, 124,
115739 - /* 930 */ 236, 4, 5, 6, 129, 237, 178, 19, 20, 16,
115740 - /* 940 */ 22, 178, 216, 201, 202, 248, 21, 41, 42, 43,
115741 - /* 950 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
115742 - /* 960 */ 54, 55, 96, 97, 89, 42, 43, 44, 45, 46,
115743 - /* 970 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 237,
115744 - /* 980 */ 224, 225, 57, 211, 16, 77, 223, 79, 18, 178,
115745 - /* 990 */ 178, 189, 236, 189, 247, 91, 287, 122, 92, 93,
115746 - /* 1000 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 91,
115747 - /* 1010 */ 189, 32, 44, 21, 178, 92, 93, 94, 95, 96,
115748 - /* 1020 */ 97, 98, 99, 100, 101, 102, 224, 225, 224, 225,
115749 - /* 1030 */ 22, 106, 16, 275, 223, 178, 19, 19, 236, 21,
115750 - /* 1040 */ 236, 193, 194, 64, 221, 224, 225, 116, 117, 118,
115751 - /* 1050 */ 80, 282, 283, 74, 22, 127, 128, 236, 150, 43,
115752 - /* 1060 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
115753 - /* 1070 */ 54, 55, 104, 178, 57, 57, 178, 178, 16, 17,
115754 - /* 1080 */ 178, 19, 112, 178, 248, 229, 240, 241, 120, 22,
115755 - /* 1090 */ 225, 178, 138, 139, 238, 33, 201, 202, 119, 201,
115756 - /* 1100 */ 202, 236, 178, 201, 202, 19, 201, 202, 92, 93,
115757 - /* 1110 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 57,
115758 - /* 1120 */ 150, 44, 130, 106, 106, 201, 202, 178, 16, 16,
115759 - /* 1130 */ 17, 178, 19, 71, 178, 173, 174, 175, 178, 131,
115760 - /* 1140 */ 229, 16, 180, 81, 182, 59, 33, 16, 17, 238,
115761 - /* 1150 */ 19, 189, 90, 178, 201, 202, 178, 271, 96, 97,
115762 - /* 1160 */ 19, 201, 202, 131, 33, 103, 229, 105, 106, 107,
115763 - /* 1170 */ 57, 178, 110, 229, 107, 238, 201, 202, 178, 201,
115764 - /* 1180 */ 202, 104, 238, 57, 71, 28, 224, 225, 57, 127,
115765 - /* 1190 */ 128, 178, 51, 36, 147, 19, 149, 21, 236, 132,
115766 - /* 1200 */ 178, 178, 71, 90, 142, 143, 144, 145, 146, 96,
115767 - /* 1210 */ 97, 98, 250, 178, 201, 202, 103, 105, 105, 106,
115768 - /* 1220 */ 107, 90, 178, 110, 201, 202, 118, 96, 97, 178,
115769 - /* 1230 */ 105, 20, 106, 22, 103, 178, 105, 106, 107, 178,
115770 - /* 1240 */ 57, 110, 178, 281, 16, 17, 178, 19, 178, 141,
115771 - /* 1250 */ 83, 84, 201, 202, 110, 142, 143, 144, 145, 146,
115772 - /* 1260 */ 178, 33, 201, 202, 120, 201, 202, 178, 19, 201,
115773 - /* 1270 */ 202, 201, 202, 142, 143, 144, 145, 146, 178, 20,
115774 - /* 1280 */ 20, 22, 22, 201, 202, 57, 227, 1, 2, 106,
115775 - /* 1290 */ 201, 202, 57, 7, 8, 9, 10, 11, 178, 71,
115776 - /* 1300 */ 14, 171, 172, 173, 174, 175, 109, 110, 239, 20,
115777 - /* 1310 */ 180, 22, 182, 178, 178, 29, 178, 178, 90, 189,
115778 - /* 1320 */ 178, 201, 202, 37, 96, 97, 178, 178, 178, 178,
115779 - /* 1330 */ 20, 103, 22, 105, 106, 107, 270, 178, 110, 201,
115780 - /* 1340 */ 202, 106, 20, 20, 22, 22, 20, 178, 22, 201,
115781 - /* 1350 */ 202, 178, 201, 202, 224, 225, 70, 178, 178, 178,
115782 - /* 1360 */ 201, 202, 178, 178, 78, 178, 236, 81, 178, 178,
115783 - /* 1370 */ 142, 143, 144, 145, 146, 4, 5, 178, 178, 130,
115784 - /* 1380 */ 250, 201, 202, 178, 178, 178, 201, 202, 201, 202,
115785 - /* 1390 */ 178, 201, 202, 178, 20, 178, 22, 178, 178, 178,
115786 - /* 1400 */ 201, 202, 178, 20, 178, 22, 201, 202, 122, 178,
115787 - /* 1410 */ 20, 281, 22, 127, 128, 178, 201, 202, 201, 202,
115788 - /* 1420 */ 201, 202, 201, 202, 178, 201, 202, 201, 202, 178,
115789 - /* 1430 */ 142, 178, 144, 142, 178, 144, 178, 151, 201, 202,
115790 - /* 1440 */ 178, 20, 178, 22, 178, 178, 178, 201, 202, 178,
115791 - /* 1450 */ 178, 20, 239, 22, 201, 202, 199, 201, 202, 201,
115792 - /* 1460 */ 202, 239, 239, 201, 202, 201, 202, 201, 202, 201,
115793 - /* 1470 */ 202, 239, 201, 202, 176, 228, 280, 243, 251, 243,
115794 - /* 1480 */ 255, 251, 230, 205, 276, 231, 231, 214, 255, 210,
115795 - /* 1490 */ 276, 230, 263, 255, 255, 230, 204, 204, 204, 181,
115796 - /* 1500 */ 58, 35, 228, 130, 185, 140, 243, 139, 19, 266,
115797 - /* 1510 */ 41, 15, 222, 185, 219, 15, 184, 138, 222, 277,
115798 - /* 1520 */ 280, 280, 277, 222, 254, 256, 222, 219, 231, 185,
115799 - /* 1530 */ 231, 256, 256, 231, 254, 219, 231, 184, 147, 60,
115800 - /* 1540 */ 185, 184, 19, 206, 185, 184, 206, 185, 184, 104,
115801 - /* 1550 */ 273, 203, 203, 272, 203, 62, 19, 212, 115, 209,
115802 - /* 1560 */ 206, 209, 21, 203, 102, 265, 133, 104, 205, 203,
115803 - /* 1570 */ 212, 288, 203, 203, 265, 245, 245, 244, 206, 244,
115804 - /* 1580 */ 185, 245, 244, 82, 245, 244, 19, 260, 185, 137,
115805 - /* 1590 */ 134, 249, 249, 147, 136, 135, 262, 22, 187, 10,
115806 - /* 1600 */ 3, 179, 235, 179, 177, 177, 177, 286, 232, 234,
115807 - /* 1610 */ 233, 231, 192, 198, 198, 286, 198, 198, 192, 207,
115808 - /* 1620 */ 207, 19, 199, 152, 199, 12, 192, 13, 198, 283,
115809 - /* 1630 */ 20, 20, 128, 119, 140, 17, 131, 22, 21, 133,
115810 - /* 1640 */ 13, 1, 131, 119, 119, 59, 34, 140, 119, 51,
115811 - /* 1650 */ 51, 51, 51, 105, 31, 1, 130, 2, 19, 104,
115812 - /* 1660 */ 150, 68, 68, 22, 38, 75, 130, 104, 21, 17,
115813 - /* 1670 */ 120, 114, 16, 67, 67, 25, 19, 19, 19, 57,
115814 - /* 1680 */ 20, 19, 21, 19, 19, 34, 67, 20, 20, 86,
115815 - /* 1690 */ 20, 22, 20, 20, 130, 87, 20, 105, 19, 22,
115816 - /* 1700 */ 132, 19, 31, 22, 20, 31, 31, 20, 20, 20,
115817 - /* 1710 */ 20, 8, 20, 22, 19, 19, 22, 20, 20, 19,
115818 - /* 1720 */ 19, 130, 12, 1, 22, 130, 130, 20, 124, 289,
115819 - /* 1730 */ 289, 289, 289, 289, 289, 130, 289, 289, 289, 289,
115820 - /* 1740 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115821 - /* 1750 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115822 - /* 1760 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115823 - /* 1770 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115824 - /* 1780 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115825 - /* 1790 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115826 - /* 1800 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115827 - /* 1810 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115828 - /* 1820 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115829 - /* 1830 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115830 - /* 1840 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115831 - /* 1850 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115832 - /* 1860 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115833 - /* 1870 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115834 - /* 1880 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115835 - /* 1890 */ 289, 289, 289, 289, 289, 289, 289, 289, 289, 289,
115836 - /* 1900 */ 289, 289, 289, 289, 289, 289, 289,
116016 -#define YY_SHIFT_COUNT (516)
116019 -#define YY_SHIFT_MAX (1722)
116022 - /* 0 */ 1286, 750, 1062, 1062, 369, 1131, 1131, 1131, 321, 0,
116023 - /* 10 */ 0, 87, 813, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
116024 - /* 20 */ 1131, 1131, 278, 278, 437, 229, 369, 369, 369, 369,
116025 - /* 30 */ 369, 17, 155, 177, 248, 317, 410, 427, 520, 537,
116026 - /* 40 */ 630, 647, 796, 813, 813, 813, 813, 813, 813, 813,
116027 - /* 50 */ 813, 813, 813, 813, 813, 813, 813, 813, 813, 813,
116028 - /* 60 */ 813, 906, 813, 923, 1016, 1016, 1113, 1131, 1131, 1131,
116029 - /* 70 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
116030 - /* 80 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
116031 - /* 90 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
116032 - /* 100 */ 1228, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131,
116033 - /* 110 */ 1131, 1131, 1131, 1131, 68, 228, 228, 228, 228, 228,
116034 - /* 120 */ 51, 115, 428, 135, 536, 133, 381, 381, 970, 968,
116035 - /* 130 */ 381, 300, 300, 381, 627, 627, 627, 627, 41, 140,
116036 - /* 140 */ 6, 1736, 1736, 689, 689, 689, 546, 138, 138, 138,
116037 - /* 150 */ 138, 586, 586, 133, 904, 918, 381, 381, 381, 381,
116038 - /* 160 */ 381, 381, 381, 381, 381, 381, 381, 381, 381, 381,
116039 - /* 170 */ 381, 381, 381, 381, 381, 381, 459, 601, 601, 928,
116040 - /* 180 */ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 679, 682, 682,
116041 - /* 190 */ 384, 196, 208, 609, 661, 676, 775, 381, 381, 381,
116042 - /* 200 */ 381, 381, 381, 381, 381, 481, 381, 381, 381, 381,
116043 - /* 210 */ 381, 381, 381, 381, 381, 381, 381, 381, 979, 979,
116044 - /* 220 */ 979, 381, 381, 381, 152, 381, 381, 381, 1018, 381,
116045 - /* 230 */ 381, 695, 381, 381, 381, 381, 381, 381, 381, 381,
116046 - /* 240 */ 538, 469, 583, 925, 925, 925, 925, 1067, 583, 583,
116047 - /* 250 */ 706, 866, 927, 501, 214, 954, 1008, 1112, 954, 1112,
116048 - /* 260 */ 1125, 635, 214, 214, 635, 214, 1008, 1125, 572, 691,
116049 - /* 270 */ 1077, 1157, 1157, 1157, 1112, 1047, 1032, 805, 1176, 1442,
116050 - /* 280 */ 1442, 1466, 1466, 1373, 1365, 1368, 1489, 1469, 1496, 1496,
116051 - /* 290 */ 1496, 1496, 1373, 1500, 1379, 1368, 1368, 1379, 1489, 1469,
116052 - /* 300 */ 1379, 1469, 1379, 1373, 1500, 1391, 1479, 1373, 1500, 1523,
116053 - /* 310 */ 1373, 1500, 1373, 1500, 1523, 1445, 1445, 1445, 1493, 1537,
116054 - /* 320 */ 1537, 1523, 1445, 1443, 1445, 1493, 1445, 1445, 1541, 1462,
116055 - /* 330 */ 1462, 1523, 1433, 1463, 1433, 1463, 1433, 1463, 1433, 1463,
116056 - /* 340 */ 1373, 1501, 1501, 1567, 1373, 1446, 1452, 1456, 1458, 1460,
116057 - /* 350 */ 1379, 1575, 1589, 1589, 1597, 1597, 1597, 1736, 1736, 1736,
116058 - /* 360 */ 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736, 1736,
116059 - /* 370 */ 1736, 1736, 241, 908, 64, 464, 181, 931, 1017, 1211,
116060 - /* 380 */ 875, 1141, 992, 645, 1108, 1259, 1086, 1260, 1289, 1310,
116061 - /* 390 */ 1322, 1323, 1326, 1126, 1197, 1371, 1144, 718, 1183, 1374,
116062 - /* 400 */ 1383, 1167, 1390, 1288, 1291, 1421, 1431, 1235, 1249, 1602,
116063 - /* 410 */ 1471, 1613, 1614, 1610, 1611, 1504, 1494, 1514, 1615, 1615,
116064 - /* 420 */ 1617, 1505, 1618, 1506, 1627, 1640, 1511, 1524, 1615, 1525,
116065 - /* 430 */ 1586, 1612, 1615, 1507, 1598, 1599, 1600, 1601, 1529, 1548,
116066 - /* 440 */ 1623, 1526, 1654, 1655, 1639, 1555, 1510, 1593, 1641, 1594,
116067 - /* 450 */ 1590, 1626, 1536, 1563, 1647, 1652, 1656, 1550, 1557, 1657,
116068 - /* 460 */ 1606, 1658, 1659, 1660, 1662, 1607, 1622, 1661, 1603, 1650,
116069 - /* 470 */ 1664, 1619, 1651, 1667, 1668, 1670, 1669, 1672, 1665, 1608,
116070 - /* 480 */ 1564, 1673, 1676, 1592, 1671, 1679, 1568, 1677, 1674, 1681,
116071 - /* 490 */ 1675, 1684, 1677, 1687, 1688, 1689, 1690, 1691, 1692, 1682,
116072 - /* 500 */ 1703, 1695, 1696, 1697, 1698, 1700, 1701, 1694, 1604, 1591,
116073 - /* 510 */ 1595, 1596, 1605, 1702, 1707, 1710, 1722,
116128 -#define YY_REDUCE_COUNT (371)
116129 -#define YY_REDUCE_MIN (-262)
116130 -#define YY_REDUCE_MAX (1434)
116132 +#define YY_REDUCE_MIN (-263)
116135 - /* 0 */ 1130, 962, 199, 203, -151, 153, 423, 466, -149, -180,
116136 - /* 10 */ -177, -257, 121, 230, 314, 336, 701, 632, 726, -170,
116137 - /* 20 */ 698, 742, -90, -5, 449, 582, 591, 694, 802, 804,
116138 - /* 30 */ 821, -254, -254, -254, -254, -254, -254, -254, -254, -254,
116139 - /* 40 */ -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,
116140 - /* 50 */ -254, -254, -254, -254, -254, -254, -254, -254, -254, -254,
116141 - /* 60 */ -254, -254, -254, -254, -254, -254, -172, -167, 575, 895,
116142 - /* 70 */ 898, 902, 905, 924, 953, 960, 975, 978, 1013, 1023,
116143 - /* 80 */ 1051, 1061, 1064, 1068, 1070, 1082, 1089, 1120, 1138, 1148,
116144 - /* 90 */ 1151, 1159, 1180, 1185, 1187, 1190, 1199, 1205, 1215, 1217,
116145 - /* 100 */ 1219, 1221, 1224, 1226, 1237, 1246, 1253, 1256, 1258, 1262,
116146 - /* 110 */ 1264, 1266, 1268, 1271, -254, -254, -254, -254, -254, -254,
116147 - /* 120 */ -254, -254, 315, -254, 320, -171, 382, 378, 283, -198,
116148 - /* 130 */ 587, -182, -70, 584, -199, 756, -199, 756, 65, -254,
116149 - /* 140 */ -254, -254, -254, 198, 198, 198, 127, 134, 418, 559,
116150 - /* 150 */ 618, -164, 46, 243, -262, -262, 340, 470, 543, 747,
116151 - /* 160 */ 211, 422, 693, 763, 154, -73, 445, 361, 636, 758,
116152 - /* 170 */ 697, 811, 174, 433, 709, 836, 227, 659, 848, 865,
116153 - /* 180 */ 769, -220, 856, 911, 937, 846, 944, -23, 45, 60,
116154 - /* 190 */ 158, 96, 195, 339, 560, 641, 658, 708, 812, 857,
116155 - /* 200 */ 899, 913, 949, 956, 993, 123, 1000, 1022, 1035, 1044,
116156 - /* 210 */ 1057, 1100, 1135, 1136, 1139, 1142, 1149, 1150, 395, 662,
116157 - /* 220 */ 772, 1169, 1173, 1179, 165, 1181, 1184, 1191, 1069, 1200,
116158 - /* 230 */ 1206, 823, 1207, 195, 1212, 1220, 1231, 1251, 1267, 1272,
116159 - /* 240 */ 886, 1066, 1059, 1213, 1222, 1223, 1232, 165, 1059, 1059,
116160 - /* 250 */ 1247, 1257, 1298, 1196, 1225, 1227, 1252, 1234, 1230, 1236,
116161 - /* 260 */ 1208, 1254, 1233, 1238, 1255, 1239, 1261, 1214, 1278, 1273,
116162 - /* 270 */ 1279, 1292, 1293, 1294, 1263, 1229, 1265, 1274, 1318, 1240,
116163 - /* 280 */ 1241, 1242, 1245, 1319, 1243, 1269, 1270, 1295, 1290, 1296,
116164 - /* 290 */ 1301, 1304, 1328, 1332, 1297, 1275, 1276, 1299, 1280, 1308,
116165 - /* 300 */ 1302, 1316, 1305, 1344, 1353, 1277, 1281, 1355, 1357, 1337,
116166 - /* 310 */ 1359, 1361, 1362, 1364, 1340, 1348, 1349, 1351, 1345, 1350,
116167 - /* 320 */ 1352, 1354, 1360, 1363, 1366, 1358, 1369, 1370, 1283, 1300,
116168 - /* 330 */ 1309, 1372, 1330, 1333, 1331, 1335, 1336, 1338, 1339, 1341,
116169 - /* 340 */ 1395, 1342, 1343, 1327, 1403, 1334, 1367, 1375, 1377, 1376,
116170 - /* 350 */ 1380, 1411, 1422, 1424, 1427, 1428, 1429, 1321, 1329, 1346,
116171 - /* 360 */ 1420, 1415, 1416, 1418, 1419, 1426, 1412, 1413, 1423, 1425,
116172 - /* 370 */ 1430, 1434,
116173 + /* 0 */ 880, 1225, 223, 226, -152, 446, 448, 599, -150, -181,
116174 + /* 10 */ -178, -258, 159, -96, 359, 693, 779, 709, 969, -171,
116176 + /* 30 */ 660, -255, -255, -255, -255, -255, -255, -255, -255, -255,
116177 + /* 40 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
116178 + /* 50 */ -255, -255, -255, -255, -255, -255, -255, -255, -255, -255,
116179 + /* 60 */ -255, -255, -255, -255, -255, -255, -173, -168, 668, 729,
116184 + /* 110 */ 1333, 1336, 1339, 1341, 1343, 1345, 1350, -255, -255, -255,
116185 + /* 120 */ -255, -255, -255, -255, -255, -255, -255, -255, -122, 283,
116186 + /* 130 */ -172, 244, 393, 685, -199, 455, -183, 113, 552, -200,
116187 + /* 140 */ 616, -200, -255, 616, -77, -255, -255, -255, -255, 221,
116188 + /* 150 */ 221, 221, -50, 90, 162, 312, 710, 15, 117, 267,
116189 + /* 160 */ -263, -263, 600, 21, 376, 377, 506, 735, 834, 835,
116190 + /* 170 */ 403, 149, 727, 183, 274, 730, 291, 838, -91, 669,
116192 + /* 190 */ 885, 886, 906, 949, 899, 953, -193, -146, -52, 106,
116213 - /* 0 */ 1464, 1464, 1329, 1102, 1210, 1329, 1329, 1329, 1102, 1240,
116214 - /* 10 */ 1240, 1382, 1133, 1102, 1102, 1102, 1102, 1102, 1102, 1328,
116215 - /* 20 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116216 - /* 30 */ 1102, 1249, 1102, 1256, 1102, 1102, 1102, 1102, 1330, 1331,
116217 - /* 40 */ 1102, 1102, 1102, 1381, 1383, 1346, 1263, 1262, 1261, 1260,
116218 - /* 50 */ 1364, 1227, 1254, 1247, 1251, 1324, 1325, 1323, 1327, 1331,
116219 - /* 60 */ 1330, 1102, 1250, 1295, 1309, 1294, 1102, 1102, 1102, 1102,
116220 - /* 70 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116221 - /* 80 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116222 - /* 90 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116223 - /* 100 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116224 - /* 110 */ 1102, 1102, 1102, 1102, 1303, 1308, 1314, 1307, 1304, 1297,
116225 - /* 120 */ 1296, 1298, 1102, 1299, 1102, 1124, 1102, 1102, 1121, 1175,
116226 - /* 130 */ 1102, 1102, 1102, 1102, 1397, 1396, 1102, 1102, 1133, 1300,
116227 - /* 140 */ 1301, 1311, 1310, 1385, 1417, 1416, 1347, 1102, 1102, 1102,
116228 - /* 150 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116229 - /* 160 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116230 - /* 170 */ 1102, 1102, 1102, 1102, 1102, 1102, 1133, 1129, 1129, 1102,
116231 - /* 180 */ 1392, 1201, 1201, 1201, 1201, 1210, 1201, 1102, 1102, 1102,
116232 - /* 190 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116233 - /* 200 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116234 - /* 210 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116235 - /* 220 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1206, 1102,
116236 - /* 230 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1410,
116237 - /* 240 */ 1102, 1359, 1189, 1206, 1206, 1206, 1206, 1208, 1190, 1188,
116238 - /* 250 */ 1200, 1134, 1107, 1456, 1266, 1255, 1207, 1229, 1255, 1229,
116239 - /* 260 */ 1453, 1253, 1266, 1266, 1253, 1266, 1207, 1453, 1150, 1433,
116240 - /* 270 */ 1145, 1240, 1240, 1240, 1229, 1326, 1207, 1200, 1102, 1456,
116241 - /* 280 */ 1456, 1455, 1455, 1215, 1347, 1440, 1275, 1178, 1184, 1184,
116242 - /* 290 */ 1184, 1184, 1215, 1118, 1253, 1440, 1440, 1253, 1275, 1178,
116243 - /* 300 */ 1253, 1178, 1253, 1215, 1118, 1363, 1450, 1215, 1118, 1337,
116244 - /* 310 */ 1215, 1118, 1215, 1118, 1337, 1176, 1176, 1176, 1165, 1102,
116245 - /* 320 */ 1102, 1337, 1176, 1150, 1176, 1165, 1176, 1176, 1102, 1341,
116246 - /* 330 */ 1341, 1337, 1233, 1228, 1233, 1228, 1233, 1228, 1233, 1228,
116247 - /* 340 */ 1215, 1243, 1243, 1332, 1215, 1102, 1248, 1234, 1246, 1244,
116248 - /* 350 */ 1253, 1168, 1413, 1413, 1409, 1409, 1409, 1461, 1461, 1392,
116249 - /* 360 */ 1426, 1133, 1133, 1133, 1133, 1426, 1152, 1152, 1134, 1134,
116250 - /* 370 */ 1133, 1426, 1102, 1102, 1102, 1102, 1102, 1102, 1421, 1102,
116251 - /* 380 */ 1387, 1348, 1219, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116252 - /* 390 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1398, 1102, 1102,
116253 - /* 400 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1280, 1389,
116254 - /* 410 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1257, 1258,
116255 - /* 420 */ 1220, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1272, 1102,
116256 - /* 430 */ 1102, 1102, 1267, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116257 - /* 440 */ 1102, 1452, 1102, 1102, 1102, 1102, 1102, 1102, 1362, 1361,
116258 - /* 450 */ 1102, 1102, 1217, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116259 - /* 460 */ 1102, 1102, 1102, 1102, 1102, 1102, 1148, 1102, 1102, 1102,
116260 - /* 470 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116261 - /* 480 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1245, 1102, 1235,
116262 - /* 490 */ 1102, 1102, 1443, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
116263 - /* 500 */ 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1437, 1192, 1282,
116264 - /* 510 */ 1102, 1281, 1285, 1122, 1102, 1112, 1102,
116319 /********** End of lemon-generated parsing tables *****************************/
116321 @@ -160642,6 +164739,7 @@ static const YYCODETYPE yyFallback[] = {
116329 @@ -160901,193 +164999,194 @@ static const char *const yyTokenName[] = {
116333 - /* 102 */ "COLLATE",
116334 - /* 103 */ "BITNOT",
116335 - /* 104 */ "ON",
116336 - /* 105 */ "INDEXED",
116337 - /* 106 */ "STRING",
116338 - /* 107 */ "JOIN_KW",
116339 - /* 108 */ "CONSTRAINT",
116340 - /* 109 */ "DEFAULT",
116341 - /* 110 */ "NULL",
116342 - /* 111 */ "PRIMARY",
116343 - /* 112 */ "UNIQUE",
116344 - /* 113 */ "CHECK",
116345 - /* 114 */ "REFERENCES",
116346 - /* 115 */ "AUTOINCR",
116347 - /* 116 */ "INSERT",
116348 - /* 117 */ "DELETE",
116349 - /* 118 */ "UPDATE",
116350 - /* 119 */ "SET",
116351 - /* 120 */ "DEFERRABLE",
116352 - /* 121 */ "FOREIGN",
116353 - /* 122 */ "DROP",
116354 - /* 123 */ "UNION",
116355 - /* 124 */ "ALL",
116356 - /* 125 */ "EXCEPT",
116357 - /* 126 */ "INTERSECT",
116358 - /* 127 */ "SELECT",
116359 - /* 128 */ "VALUES",
116360 - /* 129 */ "DISTINCT",
116361 - /* 130 */ "DOT",
116362 - /* 131 */ "FROM",
116363 - /* 132 */ "JOIN",
116364 - /* 133 */ "USING",
116365 - /* 134 */ "ORDER",
116366 - /* 135 */ "GROUP",
116367 - /* 136 */ "HAVING",
116368 - /* 137 */ "LIMIT",
116369 - /* 138 */ "WHERE",
116370 - /* 139 */ "RETURNING",
116371 - /* 140 */ "INTO",
116372 - /* 141 */ "NOTHING",
116373 - /* 142 */ "FLOAT",
116374 - /* 143 */ "BLOB",
116375 - /* 144 */ "INTEGER",
116376 - /* 145 */ "VARIABLE",
116377 - /* 146 */ "CASE",
116378 - /* 147 */ "WHEN",
116379 - /* 148 */ "THEN",
116380 - /* 149 */ "ELSE",
116381 - /* 150 */ "INDEX",
116382 - /* 151 */ "ALTER",
116383 - /* 152 */ "ADD",
116384 - /* 153 */ "COLUMN",
116385 - /* 154 */ "AGG_FUNCTION",
116386 - /* 155 */ "AGG_COLUMN",
116387 - /* 156 */ "TRUEFALSE",
116388 - /* 157 */ "ISNOT",
116389 - /* 158 */ "FUNCTION",
116390 - /* 159 */ "UMINUS",
116391 - /* 160 */ "UPLUS",
116392 - /* 161 */ "TRUTH",
116393 - /* 162 */ "REGISTER",
116394 - /* 163 */ "VECTOR",
116395 - /* 164 */ "SELECT_COLUMN",
116396 - /* 165 */ "IF_NULL_ROW",
116397 - /* 166 */ "ASTERISK",
116398 - /* 167 */ "SPAN",
116399 - /* 168 */ "ERROR",
116400 - /* 169 */ "SPACE",
116401 - /* 170 */ "ILLEGAL",
116402 - /* 171 */ "input",
116403 - /* 172 */ "cmdlist",
116404 - /* 173 */ "ecmd",
116405 - /* 174 */ "cmdx",
116406 - /* 175 */ "cmd",
116407 - /* 176 */ "transtype",
116408 - /* 177 */ "trans_opt",
116409 - /* 178 */ "nm",
116410 - /* 179 */ "savepoint_opt",
116411 - /* 180 */ "create_table",
116412 - /* 181 */ "create_table_args",
116413 - /* 182 */ "createkw",
116414 - /* 183 */ "temp",
116415 - /* 184 */ "ifnotexists",
116416 - /* 185 */ "dbnm",
116417 - /* 186 */ "columnlist",
116418 - /* 187 */ "conslist_opt",
116419 - /* 188 */ "table_option_set",
116420 - /* 189 */ "select",
116421 - /* 190 */ "table_option",
116422 - /* 191 */ "columnname",
116423 - /* 192 */ "carglist",
116424 - /* 193 */ "typetoken",
116425 - /* 194 */ "typename",
116426 - /* 195 */ "signed",
116427 - /* 196 */ "plus_num",
116428 - /* 197 */ "minus_num",
116429 - /* 198 */ "scanpt",
116430 - /* 199 */ "scantok",
116431 - /* 200 */ "ccons",
116432 - /* 201 */ "term",
116433 - /* 202 */ "expr",
116434 - /* 203 */ "onconf",
116435 - /* 204 */ "sortorder",
116436 - /* 205 */ "autoinc",
116437 - /* 206 */ "eidlist_opt",
116438 - /* 207 */ "refargs",
116439 - /* 208 */ "defer_subclause",
116440 - /* 209 */ "generated",
116441 - /* 210 */ "refarg",
116442 - /* 211 */ "refact",
116443 - /* 212 */ "init_deferred_pred_opt",
116444 - /* 213 */ "conslist",
116445 - /* 214 */ "tconscomma",
116446 - /* 215 */ "tcons",
116447 - /* 216 */ "sortlist",
116448 - /* 217 */ "eidlist",
116449 - /* 218 */ "defer_subclause_opt",
116450 - /* 219 */ "orconf",
116451 - /* 220 */ "resolvetype",
116452 - /* 221 */ "raisetype",
116453 - /* 222 */ "ifexists",
116454 - /* 223 */ "fullname",
116455 - /* 224 */ "selectnowith",
116456 - /* 225 */ "oneselect",
116457 - /* 226 */ "wqlist",
116458 - /* 227 */ "multiselect_op",
116459 - /* 228 */ "distinct",
116460 - /* 229 */ "selcollist",
116461 - /* 230 */ "from",
116462 - /* 231 */ "where_opt",
116463 - /* 232 */ "groupby_opt",
116464 - /* 233 */ "having_opt",
116465 - /* 234 */ "orderby_opt",
116466 - /* 235 */ "limit_opt",
116467 - /* 236 */ "values",
116468 - /* 237 */ "nexprlist",
116469 - /* 238 */ "sclp",
116470 - /* 239 */ "as",
116471 - /* 240 */ "seltablist",
116472 - /* 241 */ "stl_prefix",
116473 - /* 242 */ "joinop",
116474 - /* 243 */ "indexed_opt",
116475 - /* 244 */ "on_opt",
116476 - /* 245 */ "using_opt",
116624 - /* 249 */ "nulls",
116625 - /* 250 */ "with",
116626 - /* 251 */ "where_opt_ret",
116627 - /* 252 */ "setlist",
116628 - /* 253 */ "insert_cmd",
116629 - /* 254 */ "idlist_opt",
116630 - /* 255 */ "upsert",
116631 - /* 256 */ "returning",
116632 - /* 257 */ "likeop",
116633 - /* 258 */ "between_op",
116634 - /* 259 */ "in_op",
116635 - /* 260 */ "paren_exprlist",
116636 - /* 261 */ "case_operand",
116637 - /* 262 */ "case_exprlist",
116638 - /* 263 */ "case_else",
116639 - /* 264 */ "uniqueflag",
116640 - /* 265 */ "collate",
116641 - /* 266 */ "vinto",
116642 - /* 267 */ "nmnum",
116643 - /* 268 */ "trigger_decl",
116644 - /* 269 */ "trigger_cmd_list",
116645 - /* 270 */ "trigger_time",
116646 - /* 271 */ "trigger_event",
116647 - /* 272 */ "foreach_clause",
116648 - /* 273 */ "when_clause",
116649 - /* 274 */ "trigger_cmd",
116650 - /* 275 */ "trnm",
116651 - /* 276 */ "tridxby",
116652 - /* 277 */ "database_kw_opt",
116653 - /* 278 */ "key_opt",
116654 - /* 279 */ "add_column_fullname",
116655 - /* 280 */ "kwcolumn_opt",
116656 - /* 281 */ "create_vtab",
116657 - /* 282 */ "vtabarglist",
116658 - /* 283 */ "vtabarg",
116659 - /* 284 */ "vtabargtoken",
116660 - /* 285 */ "lp",
116661 - /* 286 */ "anylist",
116662 - /* 287 */ "wqitem",
116663 - /* 288 */ "wqas",
116708 @@ -161201,29 +165300,29 @@ static const char *const yyRuleName[] = {
116712 - /* 106 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
116713 - /* 107 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
116714 - /* 108 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
116715 - /* 109 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
116716 - /* 110 */ "dbnm ::=",
116717 - /* 111 */ "dbnm ::= DOT nm",
116718 - /* 112 */ "fullname ::= nm",
116719 - /* 113 */ "fullname ::= nm DOT nm",
116720 - /* 114 */ "xfullname ::= nm",
116721 - /* 115 */ "xfullname ::= nm DOT nm",
116722 - /* 116 */ "xfullname ::= nm DOT nm AS nm",
116723 - /* 117 */ "xfullname ::= nm AS nm",
116724 - /* 118 */ "joinop ::= COMMA|JOIN",
116725 - /* 119 */ "joinop ::= JOIN_KW JOIN",
116726 - /* 120 */ "joinop ::= JOIN_KW nm JOIN",
116727 - /* 121 */ "joinop ::= JOIN_KW nm nm JOIN",
116728 - /* 122 */ "on_opt ::= ON expr",
116729 - /* 123 */ "on_opt ::=",
116730 - /* 124 */ "indexed_opt ::=",
116731 - /* 125 */ "indexed_opt ::= INDEXED BY nm",
116732 - /* 126 */ "indexed_opt ::= NOT INDEXED",
116733 - /* 127 */ "using_opt ::= USING LP idlist RP",
116734 - /* 128 */ "using_opt ::=",
116761 @@ -161299,162 +165398,166 @@ static const char *const yyRuleName[] = {
116765 - /* 204 */ "expr ::= NOT expr",
116766 - /* 205 */ "expr ::= BITNOT expr",
116767 - /* 206 */ "expr ::= PLUS|MINUS expr",
116768 - /* 207 */ "between_op ::= BETWEEN",
116769 - /* 208 */ "between_op ::= NOT BETWEEN",
116770 - /* 209 */ "expr ::= expr between_op expr AND expr",
116771 - /* 210 */ "in_op ::= IN",
116772 - /* 211 */ "in_op ::= NOT IN",
116773 - /* 212 */ "expr ::= expr in_op LP exprlist RP",
116774 - /* 213 */ "expr ::= LP select RP",
116775 - /* 214 */ "expr ::= expr in_op LP select RP",
116776 - /* 215 */ "expr ::= expr in_op nm dbnm paren_exprlist",
116777 - /* 216 */ "expr ::= EXISTS LP select RP",
116778 - /* 217 */ "expr ::= CASE case_operand case_exprlist case_else END",
116779 - /* 218 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
116780 - /* 219 */ "case_exprlist ::= WHEN expr THEN expr",
116781 - /* 220 */ "case_else ::= ELSE expr",
116782 - /* 221 */ "case_else ::=",
116783 - /* 222 */ "case_operand ::= expr",
116784 - /* 223 */ "case_operand ::=",
116785 - /* 224 */ "exprlist ::=",
116786 - /* 225 */ "nexprlist ::= nexprlist COMMA expr",
116787 - /* 226 */ "nexprlist ::= expr",
116788 - /* 227 */ "paren_exprlist ::=",
116789 - /* 228 */ "paren_exprlist ::= LP exprlist RP",
116790 - /* 229 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
116791 - /* 230 */ "uniqueflag ::= UNIQUE",
116792 - /* 231 */ "uniqueflag ::=",
116793 - /* 232 */ "eidlist_opt ::=",
116794 - /* 233 */ "eidlist_opt ::= LP eidlist RP",
116795 - /* 234 */ "eidlist ::= eidlist COMMA nm collate sortorder",
116796 - /* 235 */ "eidlist ::= nm collate sortorder",
116797 - /* 236 */ "collate ::=",
116798 - /* 237 */ "collate ::= COLLATE ID|STRING",
116799 - /* 238 */ "cmd ::= DROP INDEX ifexists fullname",
116800 - /* 239 */ "cmd ::= VACUUM vinto",
116801 - /* 240 */ "cmd ::= VACUUM nm vinto",
116802 - /* 241 */ "vinto ::= INTO expr",
116803 - /* 242 */ "vinto ::=",
116804 - /* 243 */ "cmd ::= PRAGMA nm dbnm",
116805 - /* 244 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
116806 - /* 245 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
116807 - /* 246 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
116808 - /* 247 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
116809 - /* 248 */ "plus_num ::= PLUS INTEGER|FLOAT",
116810 - /* 249 */ "minus_num ::= MINUS INTEGER|FLOAT",
116811 - /* 250 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
116812 - /* 251 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullna…
116813 - /* 252 */ "trigger_time ::= BEFORE|AFTER",
116814 - /* 253 */ "trigger_time ::= INSTEAD OF",
116815 - /* 254 */ "trigger_time ::=",
116816 - /* 255 */ "trigger_event ::= DELETE|INSERT",
116817 - /* 256 */ "trigger_event ::= UPDATE",
116818 - /* 257 */ "trigger_event ::= UPDATE OF idlist",
116819 - /* 258 */ "when_clause ::=",
116820 - /* 259 */ "when_clause ::= WHEN expr",
116821 - /* 260 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
116822 - /* 261 */ "trigger_cmd_list ::= trigger_cmd SEMI",
116823 - /* 262 */ "trnm ::= nm DOT nm",
116824 - /* 263 */ "tridxby ::= INDEXED BY nm",
116825 - /* 264 */ "tridxby ::= NOT INDEXED",
116826 - /* 265 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
116827 - /* 266 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
116828 - /* 267 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
116829 - /* 268 */ "trigger_cmd ::= scanpt select scanpt",
116830 - /* 269 */ "expr ::= RAISE LP IGNORE RP",
116831 - /* 270 */ "expr ::= RAISE LP raisetype COMMA nm RP",
116832 - /* 271 */ "raisetype ::= ROLLBACK",
116833 - /* 272 */ "raisetype ::= ABORT",
116834 - /* 273 */ "raisetype ::= FAIL",
116835 - /* 274 */ "cmd ::= DROP TRIGGER ifexists fullname",
116836 - /* 275 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
116837 - /* 276 */ "cmd ::= DETACH database_kw_opt expr",
116838 - /* 277 */ "key_opt ::=",
116839 - /* 278 */ "key_opt ::= KEY expr",
116840 - /* 279 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
116841 - /* 280 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
116842 - /* 281 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
116843 - /* 282 */ "add_column_fullname ::= fullname",
116844 - /* 283 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
116845 - /* 284 */ "cmd ::= create_vtab",
116846 - /* 285 */ "cmd ::= create_vtab LP vtabarglist RP",
116847 - /* 286 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
116848 - /* 287 */ "vtabarg ::=",
116849 - /* 288 */ "vtabargtoken ::= ANY",
116850 - /* 289 */ "vtabargtoken ::= lp anylist RP",
116851 - /* 290 */ "lp ::= LP",
116852 - /* 291 */ "with ::= WITH wqlist",
116853 - /* 292 */ "with ::= WITH RECURSIVE wqlist",
116854 - /* 293 */ "wqas ::= AS",
116855 - /* 294 */ "wqas ::= AS MATERIALIZED",
116856 - /* 295 */ "wqas ::= AS NOT MATERIALIZED",
116857 - /* 296 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
116858 - /* 297 */ "wqlist ::= wqitem",
116859 - /* 298 */ "wqlist ::= wqlist COMMA wqitem",
116860 - /* 299 */ "input ::= cmdlist",
116861 - /* 300 */ "cmdlist ::= cmdlist ecmd",
116862 - /* 301 */ "cmdlist ::= ecmd",
116863 - /* 302 */ "ecmd ::= SEMI",
116864 - /* 303 */ "ecmd ::= cmdx SEMI",
116865 - /* 304 */ "trans_opt ::=",
116866 - /* 305 */ "trans_opt ::= TRANSACTION",
116867 - /* 306 */ "trans_opt ::= TRANSACTION nm",
116868 - /* 307 */ "savepoint_opt ::= SAVEPOINT",
116869 - /* 308 */ "savepoint_opt ::=",
116870 - /* 309 */ "cmd ::= create_table create_table_args",
116871 - /* 310 */ "table_option_set ::= table_option",
116872 - /* 311 */ "columnlist ::= columnlist COMMA columnname carglist",
116873 - /* 312 */ "columnlist ::= columnname carglist",
116874 - /* 313 */ "nm ::= ID|INDEXED",
116875 - /* 314 */ "nm ::= STRING",
116876 - /* 315 */ "nm ::= JOIN_KW",
116877 - /* 316 */ "typetoken ::= typename",
116878 - /* 317 */ "typename ::= ID|STRING",
116879 - /* 318 */ "signed ::= plus_num",
116880 - /* 319 */ "signed ::= minus_num",
116881 - /* 320 */ "carglist ::= carglist ccons",
116882 - /* 321 */ "carglist ::=",
116883 - /* 322 */ "ccons ::= NULL onconf",
116884 - /* 323 */ "ccons ::= GENERATED ALWAYS AS generated",
116885 - /* 324 */ "ccons ::= AS generated",
116886 - /* 325 */ "conslist_opt ::= COMMA conslist",
116887 - /* 326 */ "conslist ::= conslist tconscomma tcons",
116888 - /* 327 */ "conslist ::= tcons",
116889 - /* 328 */ "tconscomma ::=",
116890 - /* 329 */ "defer_subclause_opt ::= defer_subclause",
116891 - /* 330 */ "resolvetype ::= raisetype",
116892 - /* 331 */ "selectnowith ::= oneselect",
116893 - /* 332 */ "oneselect ::= values",
116894 - /* 333 */ "sclp ::= selcollist COMMA",
116895 - /* 334 */ "as ::= ID|STRING",
116896 - /* 335 */ "returning ::=",
116897 - /* 336 */ "expr ::= term",
116898 - /* 337 */ "likeop ::= LIKE_KW|MATCH",
116899 - /* 338 */ "exprlist ::= nexprlist",
116900 - /* 339 */ "nmnum ::= plus_num",
116901 - /* 340 */ "nmnum ::= nm",
116902 - /* 341 */ "nmnum ::= ON",
116903 - /* 342 */ "nmnum ::= DELETE",
116904 - /* 343 */ "nmnum ::= DEFAULT",
116905 - /* 344 */ "plus_num ::= INTEGER|FLOAT",
116906 - /* 345 */ "foreach_clause ::=",
116907 - /* 346 */ "foreach_clause ::= FOR EACH ROW",
116908 - /* 347 */ "trnm ::= nm",
116909 - /* 348 */ "tridxby ::=",
116910 - /* 349 */ "database_kw_opt ::= DATABASE",
116911 - /* 350 */ "database_kw_opt ::=",
116912 - /* 351 */ "kwcolumn_opt ::=",
116913 - /* 352 */ "kwcolumn_opt ::= COLUMNKW",
116914 - /* 353 */ "vtabarglist ::= vtabarg",
116915 - /* 354 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
116916 - /* 355 */ "vtabarg ::= vtabarg vtabargtoken",
116917 - /* 356 */ "anylist ::=",
116918 - /* 357 */ "anylist ::= anylist LP anylist RP",
116919 - /* 358 */ "anylist ::= anylist ANY",
116920 - /* 359 */ "with ::=",
117084 @@ -161580,75 +165683,73 @@ static void yy_destructor(
117088 - case 189: /* select */
117089 - case 224: /* selectnowith */
117090 - case 225: /* oneselect */
117091 - case 236: /* values */
117097 -sqlite3SelectDelete(pParse->db, (yypminor->yy433));
117098 -}
117099 - break;
117100 - case 201: /* term */
117101 - case 202: /* expr */
117102 - case 231: /* where_opt */
117103 - case 233: /* having_opt */
117104 - case 244: /* on_opt */
117105 - case 251: /* where_opt_ret */
117106 - case 261: /* case_operand */
117107 - case 263: /* case_else */
117108 - case 266: /* vinto */
117109 - case 273: /* when_clause */
117110 - case 278: /* key_opt */
117111 +sqlite3SelectDelete(pParse->db, (yypminor->yy279));
117125 -sqlite3ExprDelete(pParse->db, (yypminor->yy454));
117126 +sqlite3ExprDelete(pParse->db, (yypminor->yy122));
117129 - case 206: /* eidlist_opt */
117130 - case 216: /* sortlist */
117131 - case 217: /* eidlist */
117132 - case 229: /* selcollist */
117133 - case 232: /* groupby_opt */
117134 - case 234: /* orderby_opt */
117135 - case 237: /* nexprlist */
117136 - case 238: /* sclp */
117146 - case 252: /* setlist */
117147 - case 260: /* paren_exprlist */
117148 - case 262: /* case_exprlist */
117153 -sqlite3ExprListDelete(pParse->db, (yypminor->yy368));
117154 +sqlite3ExprListDelete(pParse->db, (yypminor->yy322));
117157 - case 223: /* fullname */
117158 - case 230: /* from */
117159 - case 240: /* seltablist */
117160 - case 241: /* stl_prefix */
117167 -sqlite3SrcListDelete(pParse->db, (yypminor->yy155));
117168 +sqlite3SrcListDelete(pParse->db, (yypminor->yy247));
117171 - case 226: /* wqlist */
117174 -sqlite3WithDelete(pParse->db, (yypminor->yy23));
117175 +sqlite3WithDelete(pParse->db, (yypminor->yy231));
117178 - case 245: /* using_opt */
117180 - case 254: /* idlist_opt */
117183 -sqlite3IdListDelete(pParse->db, (yypminor->yy374));
117184 +sqlite3IdListDelete(pParse->db, (yypminor->yy80));
117187 - case 269: /* trigger_cmd_list */
117188 - case 274: /* trigger_cmd */
117192 -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy387));
117193 +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy207));
117196 - case 271: /* trigger_event */
117199 -sqlite3IdListDelete(pParse->db, (yypminor->yy96).b);
117200 +sqlite3IdListDelete(pParse->db, (yypminor->yy470).b);
117204 @@ -161939,366 +166040,370 @@ static void yy_shift(
117205 /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
117208 - 174, /* (0) cmdx ::= cmd */
117209 - 175, /* (1) cmd ::= BEGIN transtype trans_opt */
117210 - 176, /* (2) transtype ::= */
117211 - 176, /* (3) transtype ::= DEFERRED */
117212 - 176, /* (4) transtype ::= IMMEDIATE */
117213 - 176, /* (5) transtype ::= EXCLUSIVE */
117214 - 175, /* (6) cmd ::= COMMIT|END trans_opt */
117215 - 175, /* (7) cmd ::= ROLLBACK trans_opt */
117216 - 175, /* (8) cmd ::= SAVEPOINT nm */
117217 - 175, /* (9) cmd ::= RELEASE savepoint_opt nm */
117218 - 175, /* (10) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
117219 - 180, /* (11) create_table ::= createkw temp TABLE ifnotexists nm dbnm */
117220 - 182, /* (12) createkw ::= CREATE */
117221 - 184, /* (13) ifnotexists ::= */
117222 - 184, /* (14) ifnotexists ::= IF NOT EXISTS */
117223 - 183, /* (15) temp ::= TEMP */
117224 - 183, /* (16) temp ::= */
117225 - 181, /* (17) create_table_args ::= LP columnlist conslist_opt RP table_option_set */
117226 - 181, /* (18) create_table_args ::= AS select */
117227 - 188, /* (19) table_option_set ::= */
117228 - 188, /* (20) table_option_set ::= table_option_set COMMA table_option */
117229 - 190, /* (21) table_option ::= WITHOUT nm */
117230 - 190, /* (22) table_option ::= nm */
117231 - 191, /* (23) columnname ::= nm typetoken */
117232 - 193, /* (24) typetoken ::= */
117233 - 193, /* (25) typetoken ::= typename LP signed RP */
117234 - 193, /* (26) typetoken ::= typename LP signed COMMA signed RP */
117235 - 194, /* (27) typename ::= typename ID|STRING */
117236 - 198, /* (28) scanpt ::= */
117237 - 199, /* (29) scantok ::= */
117238 - 200, /* (30) ccons ::= CONSTRAINT nm */
117239 - 200, /* (31) ccons ::= DEFAULT scantok term */
117240 - 200, /* (32) ccons ::= DEFAULT LP expr RP */
117241 - 200, /* (33) ccons ::= DEFAULT PLUS scantok term */
117242 - 200, /* (34) ccons ::= DEFAULT MINUS scantok term */
117243 - 200, /* (35) ccons ::= DEFAULT scantok ID|INDEXED */
117244 - 200, /* (36) ccons ::= NOT NULL onconf */
117245 - 200, /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */
117246 - 200, /* (38) ccons ::= UNIQUE onconf */
117247 - 200, /* (39) ccons ::= CHECK LP expr RP */
117248 - 200, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */
117249 - 200, /* (41) ccons ::= defer_subclause */
117250 - 200, /* (42) ccons ::= COLLATE ID|STRING */
117251 - 209, /* (43) generated ::= LP expr RP */
117252 - 209, /* (44) generated ::= LP expr RP ID */
117253 - 205, /* (45) autoinc ::= */
117254 - 205, /* (46) autoinc ::= AUTOINCR */
117255 - 207, /* (47) refargs ::= */
117256 - 207, /* (48) refargs ::= refargs refarg */
117257 - 210, /* (49) refarg ::= MATCH nm */
117258 - 210, /* (50) refarg ::= ON INSERT refact */
117259 - 210, /* (51) refarg ::= ON DELETE refact */
117260 - 210, /* (52) refarg ::= ON UPDATE refact */
117261 - 211, /* (53) refact ::= SET NULL */
117262 - 211, /* (54) refact ::= SET DEFAULT */
117263 - 211, /* (55) refact ::= CASCADE */
117264 - 211, /* (56) refact ::= RESTRICT */
117265 - 211, /* (57) refact ::= NO ACTION */
117266 - 208, /* (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
117267 - 208, /* (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
117268 - 212, /* (60) init_deferred_pred_opt ::= */
117269 - 212, /* (61) init_deferred_pred_opt ::= INITIALLY DEFERRED */
117270 - 212, /* (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
117271 - 187, /* (63) conslist_opt ::= */
117272 - 214, /* (64) tconscomma ::= COMMA */
117273 - 215, /* (65) tcons ::= CONSTRAINT nm */
117274 - 215, /* (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
117275 - 215, /* (67) tcons ::= UNIQUE LP sortlist RP onconf */
117276 - 215, /* (68) tcons ::= CHECK LP expr RP onconf */
117277 - 215, /* (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subcl…
117278 - 218, /* (70) defer_subclause_opt ::= */
117279 - 203, /* (71) onconf ::= */
117280 - 203, /* (72) onconf ::= ON CONFLICT resolvetype */
117281 - 219, /* (73) orconf ::= */
117282 - 219, /* (74) orconf ::= OR resolvetype */
117283 - 220, /* (75) resolvetype ::= IGNORE */
117284 - 220, /* (76) resolvetype ::= REPLACE */
117285 - 175, /* (77) cmd ::= DROP TABLE ifexists fullname */
117286 - 222, /* (78) ifexists ::= IF EXISTS */
117287 - 222, /* (79) ifexists ::= */
117288 - 175, /* (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
117289 - 175, /* (81) cmd ::= DROP VIEW ifexists fullname */
117290 - 175, /* (82) cmd ::= select */
117291 - 189, /* (83) select ::= WITH wqlist selectnowith */
117292 - 189, /* (84) select ::= WITH RECURSIVE wqlist selectnowith */
117293 - 189, /* (85) select ::= selectnowith */
117294 - 224, /* (86) selectnowith ::= selectnowith multiselect_op oneselect */
117295 - 227, /* (87) multiselect_op ::= UNION */
117296 - 227, /* (88) multiselect_op ::= UNION ALL */
117297 - 227, /* (89) multiselect_op ::= EXCEPT|INTERSECT */
117298 - 225, /* (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt or…
117299 - 236, /* (91) values ::= VALUES LP nexprlist RP */
117300 - 236, /* (92) values ::= values COMMA LP nexprlist RP */
117301 - 228, /* (93) distinct ::= DISTINCT */
117302 - 228, /* (94) distinct ::= ALL */
117303 - 228, /* (95) distinct ::= */
117304 - 238, /* (96) sclp ::= */
117305 - 229, /* (97) selcollist ::= sclp scanpt expr scanpt as */
117306 - 229, /* (98) selcollist ::= sclp scanpt STAR */
117307 - 229, /* (99) selcollist ::= sclp scanpt nm DOT STAR */
117308 - 239, /* (100) as ::= AS nm */
117309 - 239, /* (101) as ::= */
117310 - 230, /* (102) from ::= */
117311 - 230, /* (103) from ::= FROM seltablist */
117312 - 241, /* (104) stl_prefix ::= seltablist joinop */
117313 - 241, /* (105) stl_prefix ::= */
117314 - 240, /* (106) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
117315 - 240, /* (107) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
117316 - 240, /* (108) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
117317 - 240, /* (109) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
117318 - 185, /* (110) dbnm ::= */
117319 - 185, /* (111) dbnm ::= DOT nm */
117320 - 223, /* (112) fullname ::= nm */
117321 - 223, /* (113) fullname ::= nm DOT nm */
117322 - 247, /* (114) xfullname ::= nm */
117323 - 247, /* (115) xfullname ::= nm DOT nm */
117324 - 247, /* (116) xfullname ::= nm DOT nm AS nm */
117325 - 247, /* (117) xfullname ::= nm AS nm */
117326 - 242, /* (118) joinop ::= COMMA|JOIN */
117327 - 242, /* (119) joinop ::= JOIN_KW JOIN */
117328 - 242, /* (120) joinop ::= JOIN_KW nm JOIN */
117329 - 242, /* (121) joinop ::= JOIN_KW nm nm JOIN */
117330 - 244, /* (122) on_opt ::= ON expr */
117331 - 244, /* (123) on_opt ::= */
117332 - 243, /* (124) indexed_opt ::= */
117333 - 243, /* (125) indexed_opt ::= INDEXED BY nm */
117334 - 243, /* (126) indexed_opt ::= NOT INDEXED */
117335 - 245, /* (127) using_opt ::= USING LP idlist RP */
117336 - 245, /* (128) using_opt ::= */
117337 - 234, /* (129) orderby_opt ::= */
117338 - 234, /* (130) orderby_opt ::= ORDER BY sortlist */
117339 - 216, /* (131) sortlist ::= sortlist COMMA expr sortorder nulls */
117340 - 216, /* (132) sortlist ::= expr sortorder nulls */
117341 - 204, /* (133) sortorder ::= ASC */
117342 - 204, /* (134) sortorder ::= DESC */
117343 - 204, /* (135) sortorder ::= */
117344 - 249, /* (136) nulls ::= NULLS FIRST */
117345 - 249, /* (137) nulls ::= NULLS LAST */
117346 - 249, /* (138) nulls ::= */
117347 - 232, /* (139) groupby_opt ::= */
117348 - 232, /* (140) groupby_opt ::= GROUP BY nexprlist */
117349 - 233, /* (141) having_opt ::= */
117350 - 233, /* (142) having_opt ::= HAVING expr */
117351 - 235, /* (143) limit_opt ::= */
117352 - 235, /* (144) limit_opt ::= LIMIT expr */
117353 - 235, /* (145) limit_opt ::= LIMIT expr OFFSET expr */
117354 - 235, /* (146) limit_opt ::= LIMIT expr COMMA expr */
117355 - 175, /* (147) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */
117356 - 231, /* (148) where_opt ::= */
117357 - 231, /* (149) where_opt ::= WHERE expr */
117358 - 251, /* (150) where_opt_ret ::= */
117359 - 251, /* (151) where_opt_ret ::= WHERE expr */
117360 - 251, /* (152) where_opt_ret ::= RETURNING selcollist */
117361 - 251, /* (153) where_opt_ret ::= WHERE expr RETURNING selcollist */
117362 - 175, /* (154) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret …
117363 - 252, /* (155) setlist ::= setlist COMMA nm EQ expr */
117364 - 252, /* (156) setlist ::= setlist COMMA LP idlist RP EQ expr */
117365 - 252, /* (157) setlist ::= nm EQ expr */
117366 - 252, /* (158) setlist ::= LP idlist RP EQ expr */
117367 - 175, /* (159) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
117368 - 175, /* (160) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */
117369 - 255, /* (161) upsert ::= */
117370 - 255, /* (162) upsert ::= RETURNING selcollist */
117371 - 255, /* (163) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt …
117372 - 255, /* (164) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
117373 - 255, /* (165) upsert ::= ON CONFLICT DO NOTHING returning */
117374 - 255, /* (166) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */
117375 - 256, /* (167) returning ::= RETURNING selcollist */
117376 - 253, /* (168) insert_cmd ::= INSERT orconf */
117377 - 253, /* (169) insert_cmd ::= REPLACE */
117378 - 254, /* (170) idlist_opt ::= */
117379 - 254, /* (171) idlist_opt ::= LP idlist RP */
117554 - 202, /* (174) expr ::= LP expr RP */
117555 - 202, /* (175) expr ::= ID|INDEXED */
117556 - 202, /* (176) expr ::= JOIN_KW */
117557 - 202, /* (177) expr ::= nm DOT nm */
117558 - 202, /* (178) expr ::= nm DOT nm DOT nm */
117559 - 201, /* (179) term ::= NULL|FLOAT|BLOB */
117560 - 201, /* (180) term ::= STRING */
117561 - 201, /* (181) term ::= INTEGER */
117562 - 202, /* (182) expr ::= VARIABLE */
117563 - 202, /* (183) expr ::= expr COLLATE ID|STRING */
117564 - 202, /* (184) expr ::= CAST LP expr AS typetoken RP */
117565 - 202, /* (185) expr ::= ID|INDEXED LP distinct exprlist RP */
117566 - 202, /* (186) expr ::= ID|INDEXED LP STAR RP */
117567 - 201, /* (187) term ::= CTIME_KW */
117568 - 202, /* (188) expr ::= LP nexprlist COMMA expr RP */
117569 - 202, /* (189) expr ::= expr AND expr */
117570 - 202, /* (190) expr ::= expr OR expr */
117571 - 202, /* (191) expr ::= expr LT|GT|GE|LE expr */
117572 - 202, /* (192) expr ::= expr EQ|NE expr */
117573 - 202, /* (193) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
117574 - 202, /* (194) expr ::= expr PLUS|MINUS expr */
117575 - 202, /* (195) expr ::= expr STAR|SLASH|REM expr */
117576 - 202, /* (196) expr ::= expr CONCAT expr */
117577 - 257, /* (197) likeop ::= NOT LIKE_KW|MATCH */
117578 - 202, /* (198) expr ::= expr likeop expr */
117579 - 202, /* (199) expr ::= expr likeop expr ESCAPE expr */
117580 - 202, /* (200) expr ::= expr ISNULL|NOTNULL */
117581 - 202, /* (201) expr ::= expr NOT NULL */
117582 - 202, /* (202) expr ::= expr IS expr */
117583 - 202, /* (203) expr ::= expr IS NOT expr */
117584 - 202, /* (204) expr ::= NOT expr */
117585 - 202, /* (205) expr ::= BITNOT expr */
117586 - 202, /* (206) expr ::= PLUS|MINUS expr */
117587 - 258, /* (207) between_op ::= BETWEEN */
117588 - 258, /* (208) between_op ::= NOT BETWEEN */
117589 - 202, /* (209) expr ::= expr between_op expr AND expr */
117590 - 259, /* (210) in_op ::= IN */
117591 - 259, /* (211) in_op ::= NOT IN */
117592 - 202, /* (212) expr ::= expr in_op LP exprlist RP */
117593 - 202, /* (213) expr ::= LP select RP */
117594 - 202, /* (214) expr ::= expr in_op LP select RP */
117595 - 202, /* (215) expr ::= expr in_op nm dbnm paren_exprlist */
117596 - 202, /* (216) expr ::= EXISTS LP select RP */
117597 - 202, /* (217) expr ::= CASE case_operand case_exprlist case_else END */
117598 - 262, /* (218) case_exprlist ::= case_exprlist WHEN expr THEN expr */
117599 - 262, /* (219) case_exprlist ::= WHEN expr THEN expr */
117600 - 263, /* (220) case_else ::= ELSE expr */
117601 - 263, /* (221) case_else ::= */
117602 - 261, /* (222) case_operand ::= expr */
117603 - 261, /* (223) case_operand ::= */
117604 - 246, /* (224) exprlist ::= */
117605 - 237, /* (225) nexprlist ::= nexprlist COMMA expr */
117606 - 237, /* (226) nexprlist ::= expr */
117607 - 260, /* (227) paren_exprlist ::= */
117608 - 260, /* (228) paren_exprlist ::= LP exprlist RP */
117609 - 175, /* (229) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where…
117610 - 264, /* (230) uniqueflag ::= UNIQUE */
117611 - 264, /* (231) uniqueflag ::= */
117612 - 206, /* (232) eidlist_opt ::= */
117613 - 206, /* (233) eidlist_opt ::= LP eidlist RP */
117614 - 217, /* (234) eidlist ::= eidlist COMMA nm collate sortorder */
117615 - 217, /* (235) eidlist ::= nm collate sortorder */
117616 - 265, /* (236) collate ::= */
117617 - 265, /* (237) collate ::= COLLATE ID|STRING */
117618 - 175, /* (238) cmd ::= DROP INDEX ifexists fullname */
117619 - 175, /* (239) cmd ::= VACUUM vinto */
117620 - 175, /* (240) cmd ::= VACUUM nm vinto */
117621 - 266, /* (241) vinto ::= INTO expr */
117622 - 266, /* (242) vinto ::= */
117623 - 175, /* (243) cmd ::= PRAGMA nm dbnm */
117624 - 175, /* (244) cmd ::= PRAGMA nm dbnm EQ nmnum */
117625 - 175, /* (245) cmd ::= PRAGMA nm dbnm LP nmnum RP */
117626 - 175, /* (246) cmd ::= PRAGMA nm dbnm EQ minus_num */
117627 - 175, /* (247) cmd ::= PRAGMA nm dbnm LP minus_num RP */
117628 - 196, /* (248) plus_num ::= PLUS INTEGER|FLOAT */
117629 - 197, /* (249) minus_num ::= MINUS INTEGER|FLOAT */
117630 - 175, /* (250) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
117631 - 268, /* (251) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON …
117632 - 270, /* (252) trigger_time ::= BEFORE|AFTER */
117633 - 270, /* (253) trigger_time ::= INSTEAD OF */
117634 - 270, /* (254) trigger_time ::= */
117635 - 271, /* (255) trigger_event ::= DELETE|INSERT */
117636 - 271, /* (256) trigger_event ::= UPDATE */
117637 - 271, /* (257) trigger_event ::= UPDATE OF idlist */
117638 - 273, /* (258) when_clause ::= */
117639 - 273, /* (259) when_clause ::= WHEN expr */
117640 - 269, /* (260) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
117641 - 269, /* (261) trigger_cmd_list ::= trigger_cmd SEMI */
117642 - 275, /* (262) trnm ::= nm DOT nm */
117643 - 276, /* (263) tridxby ::= INDEXED BY nm */
117644 - 276, /* (264) tridxby ::= NOT INDEXED */
117645 - 274, /* (265) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
117646 - 274, /* (266) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
117647 - 274, /* (267) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
117648 - 274, /* (268) trigger_cmd ::= scanpt select scanpt */
117649 - 202, /* (269) expr ::= RAISE LP IGNORE RP */
117650 - 202, /* (270) expr ::= RAISE LP raisetype COMMA nm RP */
117651 - 221, /* (271) raisetype ::= ROLLBACK */
117652 - 221, /* (272) raisetype ::= ABORT */
117653 - 221, /* (273) raisetype ::= FAIL */
117654 - 175, /* (274) cmd ::= DROP TRIGGER ifexists fullname */
117655 - 175, /* (275) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
117656 - 175, /* (276) cmd ::= DETACH database_kw_opt expr */
117657 - 278, /* (277) key_opt ::= */
117658 - 278, /* (278) key_opt ::= KEY expr */
117659 - 175, /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */
117660 - 175, /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
117661 - 175, /* (281) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
117662 - 279, /* (282) add_column_fullname ::= fullname */
117663 - 175, /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
117664 - 175, /* (284) cmd ::= create_vtab */
117665 - 175, /* (285) cmd ::= create_vtab LP vtabarglist RP */
117666 - 281, /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
117667 - 283, /* (287) vtabarg ::= */
117668 - 284, /* (288) vtabargtoken ::= ANY */
117669 - 284, /* (289) vtabargtoken ::= lp anylist RP */
117670 - 285, /* (290) lp ::= LP */
117671 - 250, /* (291) with ::= WITH wqlist */
117672 - 250, /* (292) with ::= WITH RECURSIVE wqlist */
117673 - 288, /* (293) wqas ::= AS */
117674 - 288, /* (294) wqas ::= AS MATERIALIZED */
117675 - 288, /* (295) wqas ::= AS NOT MATERIALIZED */
117676 - 287, /* (296) wqitem ::= nm eidlist_opt wqas LP select RP */
117677 - 226, /* (297) wqlist ::= wqitem */
117678 - 226, /* (298) wqlist ::= wqlist COMMA wqitem */
117679 - 171, /* (299) input ::= cmdlist */
117680 - 172, /* (300) cmdlist ::= cmdlist ecmd */
117681 - 172, /* (301) cmdlist ::= ecmd */
117682 - 173, /* (302) ecmd ::= SEMI */
117683 - 173, /* (303) ecmd ::= cmdx SEMI */
117684 - 177, /* (304) trans_opt ::= */
117685 - 177, /* (305) trans_opt ::= TRANSACTION */
117686 - 177, /* (306) trans_opt ::= TRANSACTION nm */
117687 - 179, /* (307) savepoint_opt ::= SAVEPOINT */
117688 - 179, /* (308) savepoint_opt ::= */
117689 - 175, /* (309) cmd ::= create_table create_table_args */
117690 - 188, /* (310) table_option_set ::= table_option */
117691 - 186, /* (311) columnlist ::= columnlist COMMA columnname carglist */
117692 - 186, /* (312) columnlist ::= columnname carglist */
117693 - 178, /* (313) nm ::= ID|INDEXED */
117694 - 178, /* (314) nm ::= STRING */
117695 - 178, /* (315) nm ::= JOIN_KW */
117696 - 193, /* (316) typetoken ::= typename */
117697 - 194, /* (317) typename ::= ID|STRING */
117698 - 195, /* (318) signed ::= plus_num */
117699 - 195, /* (319) signed ::= minus_num */
117700 - 192, /* (320) carglist ::= carglist ccons */
117701 - 192, /* (321) carglist ::= */
117702 - 200, /* (322) ccons ::= NULL onconf */
117703 - 200, /* (323) ccons ::= GENERATED ALWAYS AS generated */
117704 - 200, /* (324) ccons ::= AS generated */
117705 - 187, /* (325) conslist_opt ::= COMMA conslist */
117706 - 213, /* (326) conslist ::= conslist tconscomma tcons */
117707 - 213, /* (327) conslist ::= tcons */
117708 - 214, /* (328) tconscomma ::= */
117709 - 218, /* (329) defer_subclause_opt ::= defer_subclause */
117710 - 220, /* (330) resolvetype ::= raisetype */
117711 - 224, /* (331) selectnowith ::= oneselect */
117712 - 225, /* (332) oneselect ::= values */
117713 - 238, /* (333) sclp ::= selcollist COMMA */
117714 - 239, /* (334) as ::= ID|STRING */
117715 - 256, /* (335) returning ::= */
117716 - 202, /* (336) expr ::= term */
117717 - 257, /* (337) likeop ::= LIKE_KW|MATCH */
117718 - 246, /* (338) exprlist ::= nexprlist */
117719 - 267, /* (339) nmnum ::= plus_num */
117720 - 267, /* (340) nmnum ::= nm */
117721 - 267, /* (341) nmnum ::= ON */
117722 - 267, /* (342) nmnum ::= DELETE */
117723 - 267, /* (343) nmnum ::= DEFAULT */
117724 - 196, /* (344) plus_num ::= INTEGER|FLOAT */
117725 - 272, /* (345) foreach_clause ::= */
117726 - 272, /* (346) foreach_clause ::= FOR EACH ROW */
117727 - 275, /* (347) trnm ::= nm */
117728 - 276, /* (348) tridxby ::= */
117729 - 277, /* (349) database_kw_opt ::= DATABASE */
117730 - 277, /* (350) database_kw_opt ::= */
117731 - 280, /* (351) kwcolumn_opt ::= */
117732 - 280, /* (352) kwcolumn_opt ::= COLUMNKW */
117733 - 282, /* (353) vtabarglist ::= vtabarg */
117734 - 282, /* (354) vtabarglist ::= vtabarglist COMMA vtabarg */
117735 - 283, /* (355) vtabarg ::= vtabarg vtabargtoken */
117736 - 286, /* (356) anylist ::= */
117737 - 286, /* (357) anylist ::= anylist LP anylist RP */
117738 - 286, /* (358) anylist ::= anylist ANY */
117739 - 250, /* (359) with ::= */
117933 @@ -162410,29 +166515,29 @@ static const signed char yyRuleInfoNRhs[] = {
117934 -2, /* (103) from ::= FROM seltablist */
117935 -2, /* (104) stl_prefix ::= seltablist joinop */
117937 - -7, /* (106) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
117938 - -9, /* (107) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
117939 - -7, /* (108) seltablist ::= stl_prefix LP select RP as on_opt using_opt */
117940 - -7, /* (109) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
117941 - 0, /* (110) dbnm ::= */
117942 - -2, /* (111) dbnm ::= DOT nm */
117943 - -1, /* (112) fullname ::= nm */
117944 - -3, /* (113) fullname ::= nm DOT nm */
117945 - -1, /* (114) xfullname ::= nm */
117946 - -3, /* (115) xfullname ::= nm DOT nm */
117947 - -5, /* (116) xfullname ::= nm DOT nm AS nm */
117948 - -3, /* (117) xfullname ::= nm AS nm */
117949 - -1, /* (118) joinop ::= COMMA|JOIN */
117950 - -2, /* (119) joinop ::= JOIN_KW JOIN */
117951 - -3, /* (120) joinop ::= JOIN_KW nm JOIN */
117952 - -4, /* (121) joinop ::= JOIN_KW nm nm JOIN */
117953 - -2, /* (122) on_opt ::= ON expr */
117954 - 0, /* (123) on_opt ::= */
117955 - 0, /* (124) indexed_opt ::= */
117956 - -3, /* (125) indexed_opt ::= INDEXED BY nm */
117957 - -2, /* (126) indexed_opt ::= NOT INDEXED */
117958 - -4, /* (127) using_opt ::= USING LP idlist RP */
117959 - 0, /* (128) using_opt ::= */
117960 + -5, /* (106) seltablist ::= stl_prefix nm dbnm as on_using */
117961 + -6, /* (107) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */
117962 + -8, /* (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */
117963 + -6, /* (109) seltablist ::= stl_prefix LP select RP as on_using */
117964 + -6, /* (110) seltablist ::= stl_prefix LP seltablist RP as on_using */
117966 + -2, /* (112) dbnm ::= DOT nm */
117967 + -1, /* (113) fullname ::= nm */
117968 + -3, /* (114) fullname ::= nm DOT nm */
117969 + -1, /* (115) xfullname ::= nm */
117970 + -3, /* (116) xfullname ::= nm DOT nm */
117971 + -5, /* (117) xfullname ::= nm DOT nm AS nm */
117972 + -3, /* (118) xfullname ::= nm AS nm */
117973 + -1, /* (119) joinop ::= COMMA|JOIN */
117974 + -2, /* (120) joinop ::= JOIN_KW JOIN */
117975 + -3, /* (121) joinop ::= JOIN_KW nm JOIN */
117976 + -4, /* (122) joinop ::= JOIN_KW nm nm JOIN */
117977 + -2, /* (123) on_using ::= ON expr */
117978 + -4, /* (124) on_using ::= USING LP idlist RP */
117981 + -3, /* (127) indexed_by ::= INDEXED BY nm */
117982 + -2, /* (128) indexed_by ::= NOT INDEXED */
117984 -3, /* (130) orderby_opt ::= ORDER BY sortlist */
117985 -5, /* (131) sortlist ::= sortlist COMMA expr sortorder nulls */
117986 @@ -162508,162 +166613,166 @@ static const signed char yyRuleInfoNRhs[] = {
117987 -3, /* (201) expr ::= expr NOT NULL */
117988 -3, /* (202) expr ::= expr IS expr */
117989 -4, /* (203) expr ::= expr IS NOT expr */
117990 - -2, /* (204) expr ::= NOT expr */
117991 - -2, /* (205) expr ::= BITNOT expr */
117992 - -2, /* (206) expr ::= PLUS|MINUS expr */
117993 - -1, /* (207) between_op ::= BETWEEN */
117994 - -2, /* (208) between_op ::= NOT BETWEEN */
117995 - -5, /* (209) expr ::= expr between_op expr AND expr */
117996 - -1, /* (210) in_op ::= IN */
117997 - -2, /* (211) in_op ::= NOT IN */
117998 - -5, /* (212) expr ::= expr in_op LP exprlist RP */
117999 - -3, /* (213) expr ::= LP select RP */
118000 - -5, /* (214) expr ::= expr in_op LP select RP */
118001 - -5, /* (215) expr ::= expr in_op nm dbnm paren_exprlist */
118002 - -4, /* (216) expr ::= EXISTS LP select RP */
118003 - -5, /* (217) expr ::= CASE case_operand case_exprlist case_else END */
118004 - -5, /* (218) case_exprlist ::= case_exprlist WHEN expr THEN expr */
118005 - -4, /* (219) case_exprlist ::= WHEN expr THEN expr */
118006 - -2, /* (220) case_else ::= ELSE expr */
118007 - 0, /* (221) case_else ::= */
118008 - -1, /* (222) case_operand ::= expr */
118009 - 0, /* (223) case_operand ::= */
118010 - 0, /* (224) exprlist ::= */
118011 - -3, /* (225) nexprlist ::= nexprlist COMMA expr */
118012 - -1, /* (226) nexprlist ::= expr */
118013 - 0, /* (227) paren_exprlist ::= */
118014 - -3, /* (228) paren_exprlist ::= LP exprlist RP */
118015 - -12, /* (229) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_…
118016 - -1, /* (230) uniqueflag ::= UNIQUE */
118017 - 0, /* (231) uniqueflag ::= */
118018 - 0, /* (232) eidlist_opt ::= */
118019 - -3, /* (233) eidlist_opt ::= LP eidlist RP */
118020 - -5, /* (234) eidlist ::= eidlist COMMA nm collate sortorder */
118021 - -3, /* (235) eidlist ::= nm collate sortorder */
118022 - 0, /* (236) collate ::= */
118023 - -2, /* (237) collate ::= COLLATE ID|STRING */
118024 - -4, /* (238) cmd ::= DROP INDEX ifexists fullname */
118025 - -2, /* (239) cmd ::= VACUUM vinto */
118026 - -3, /* (240) cmd ::= VACUUM nm vinto */
118027 - -2, /* (241) vinto ::= INTO expr */
118028 - 0, /* (242) vinto ::= */
118029 - -3, /* (243) cmd ::= PRAGMA nm dbnm */
118030 - -5, /* (244) cmd ::= PRAGMA nm dbnm EQ nmnum */
118031 - -6, /* (245) cmd ::= PRAGMA nm dbnm LP nmnum RP */
118032 - -5, /* (246) cmd ::= PRAGMA nm dbnm EQ minus_num */
118033 - -6, /* (247) cmd ::= PRAGMA nm dbnm LP minus_num RP */
118034 - -2, /* (248) plus_num ::= PLUS INTEGER|FLOAT */
118035 - -2, /* (249) minus_num ::= MINUS INTEGER|FLOAT */
118036 - -5, /* (250) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
118037 - -11, /* (251) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON f…
118038 - -1, /* (252) trigger_time ::= BEFORE|AFTER */
118039 - -2, /* (253) trigger_time ::= INSTEAD OF */
118040 - 0, /* (254) trigger_time ::= */
118041 - -1, /* (255) trigger_event ::= DELETE|INSERT */
118042 - -1, /* (256) trigger_event ::= UPDATE */
118043 - -3, /* (257) trigger_event ::= UPDATE OF idlist */
118044 - 0, /* (258) when_clause ::= */
118045 - -2, /* (259) when_clause ::= WHEN expr */
118046 - -3, /* (260) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
118047 - -2, /* (261) trigger_cmd_list ::= trigger_cmd SEMI */
118048 - -3, /* (262) trnm ::= nm DOT nm */
118049 - -3, /* (263) tridxby ::= INDEXED BY nm */
118050 - -2, /* (264) tridxby ::= NOT INDEXED */
118051 - -9, /* (265) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
118052 - -8, /* (266) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
118053 - -6, /* (267) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
118054 - -3, /* (268) trigger_cmd ::= scanpt select scanpt */
118055 - -4, /* (269) expr ::= RAISE LP IGNORE RP */
118056 - -6, /* (270) expr ::= RAISE LP raisetype COMMA nm RP */
118057 - -1, /* (271) raisetype ::= ROLLBACK */
118058 - -1, /* (272) raisetype ::= ABORT */
118059 - -1, /* (273) raisetype ::= FAIL */
118060 - -4, /* (274) cmd ::= DROP TRIGGER ifexists fullname */
118061 - -6, /* (275) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
118062 - -3, /* (276) cmd ::= DETACH database_kw_opt expr */
118063 - 0, /* (277) key_opt ::= */
118064 - -2, /* (278) key_opt ::= KEY expr */
118065 - -6, /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */
118066 - -7, /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
118067 - -6, /* (281) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
118068 - -1, /* (282) add_column_fullname ::= fullname */
118069 - -8, /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
118070 - -1, /* (284) cmd ::= create_vtab */
118071 - -4, /* (285) cmd ::= create_vtab LP vtabarglist RP */
118072 - -8, /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
118073 - 0, /* (287) vtabarg ::= */
118074 - -1, /* (288) vtabargtoken ::= ANY */
118075 - -3, /* (289) vtabargtoken ::= lp anylist RP */
118076 - -1, /* (290) lp ::= LP */
118077 - -2, /* (291) with ::= WITH wqlist */
118078 - -3, /* (292) with ::= WITH RECURSIVE wqlist */
118079 - -1, /* (293) wqas ::= AS */
118080 - -2, /* (294) wqas ::= AS MATERIALIZED */
118081 - -3, /* (295) wqas ::= AS NOT MATERIALIZED */
118082 - -6, /* (296) wqitem ::= nm eidlist_opt wqas LP select RP */
118083 - -1, /* (297) wqlist ::= wqitem */
118084 - -3, /* (298) wqlist ::= wqlist COMMA wqitem */
118085 - -1, /* (299) input ::= cmdlist */
118086 - -2, /* (300) cmdlist ::= cmdlist ecmd */
118087 - -1, /* (301) cmdlist ::= ecmd */
118088 - -1, /* (302) ecmd ::= SEMI */
118089 - -2, /* (303) ecmd ::= cmdx SEMI */
118090 - 0, /* (304) trans_opt ::= */
118091 - -1, /* (305) trans_opt ::= TRANSACTION */
118092 - -2, /* (306) trans_opt ::= TRANSACTION nm */
118093 - -1, /* (307) savepoint_opt ::= SAVEPOINT */
118094 - 0, /* (308) savepoint_opt ::= */
118095 - -2, /* (309) cmd ::= create_table create_table_args */
118096 - -1, /* (310) table_option_set ::= table_option */
118097 - -4, /* (311) columnlist ::= columnlist COMMA columnname carglist */
118098 - -2, /* (312) columnlist ::= columnname carglist */
118099 - -1, /* (313) nm ::= ID|INDEXED */
118100 - -1, /* (314) nm ::= STRING */
118101 - -1, /* (315) nm ::= JOIN_KW */
118102 - -1, /* (316) typetoken ::= typename */
118103 - -1, /* (317) typename ::= ID|STRING */
118104 - -1, /* (318) signed ::= plus_num */
118105 - -1, /* (319) signed ::= minus_num */
118106 - -2, /* (320) carglist ::= carglist ccons */
118107 - 0, /* (321) carglist ::= */
118108 - -2, /* (322) ccons ::= NULL onconf */
118109 - -4, /* (323) ccons ::= GENERATED ALWAYS AS generated */
118110 - -2, /* (324) ccons ::= AS generated */
118111 - -2, /* (325) conslist_opt ::= COMMA conslist */
118112 - -3, /* (326) conslist ::= conslist tconscomma tcons */
118113 - -1, /* (327) conslist ::= tcons */
118114 - 0, /* (328) tconscomma ::= */
118115 - -1, /* (329) defer_subclause_opt ::= defer_subclause */
118116 - -1, /* (330) resolvetype ::= raisetype */
118117 - -1, /* (331) selectnowith ::= oneselect */
118118 - -1, /* (332) oneselect ::= values */
118119 - -2, /* (333) sclp ::= selcollist COMMA */
118120 - -1, /* (334) as ::= ID|STRING */
118121 - 0, /* (335) returning ::= */
118122 - -1, /* (336) expr ::= term */
118123 - -1, /* (337) likeop ::= LIKE_KW|MATCH */
118124 - -1, /* (338) exprlist ::= nexprlist */
118125 - -1, /* (339) nmnum ::= plus_num */
118126 - -1, /* (340) nmnum ::= nm */
118127 - -1, /* (341) nmnum ::= ON */
118128 - -1, /* (342) nmnum ::= DELETE */
118129 - -1, /* (343) nmnum ::= DEFAULT */
118130 - -1, /* (344) plus_num ::= INTEGER|FLOAT */
118131 - 0, /* (345) foreach_clause ::= */
118132 - -3, /* (346) foreach_clause ::= FOR EACH ROW */
118133 - -1, /* (347) trnm ::= nm */
118134 - 0, /* (348) tridxby ::= */
118135 - -1, /* (349) database_kw_opt ::= DATABASE */
118136 - 0, /* (350) database_kw_opt ::= */
118137 - 0, /* (351) kwcolumn_opt ::= */
118138 - -1, /* (352) kwcolumn_opt ::= COLUMNKW */
118139 - -1, /* (353) vtabarglist ::= vtabarg */
118140 - -3, /* (354) vtabarglist ::= vtabarglist COMMA vtabarg */
118141 - -2, /* (355) vtabarg ::= vtabarg vtabargtoken */
118142 - 0, /* (356) anylist ::= */
118143 - -4, /* (357) anylist ::= anylist LP anylist RP */
118144 - -2, /* (358) anylist ::= anylist ANY */
118145 - 0, /* (359) with ::= */
118146 + -6, /* (204) expr ::= expr IS NOT DISTINCT FROM expr */
118147 + -5, /* (205) expr ::= expr IS DISTINCT FROM expr */
118148 + -2, /* (206) expr ::= NOT expr */
118149 + -2, /* (207) expr ::= BITNOT expr */
118150 + -2, /* (208) expr ::= PLUS|MINUS expr */
118151 + -3, /* (209) expr ::= expr PTR expr */
118152 + -1, /* (210) between_op ::= BETWEEN */
118153 + -2, /* (211) between_op ::= NOT BETWEEN */
118154 + -5, /* (212) expr ::= expr between_op expr AND expr */
118155 + -1, /* (213) in_op ::= IN */
118156 + -2, /* (214) in_op ::= NOT IN */
118157 + -5, /* (215) expr ::= expr in_op LP exprlist RP */
118158 + -3, /* (216) expr ::= LP select RP */
118159 + -5, /* (217) expr ::= expr in_op LP select RP */
118160 + -5, /* (218) expr ::= expr in_op nm dbnm paren_exprlist */
118161 + -4, /* (219) expr ::= EXISTS LP select RP */
118162 + -5, /* (220) expr ::= CASE case_operand case_exprlist case_else END */
118163 + -5, /* (221) case_exprlist ::= case_exprlist WHEN expr THEN expr */
118164 + -4, /* (222) case_exprlist ::= WHEN expr THEN expr */
118165 + -2, /* (223) case_else ::= ELSE expr */
118167 + -1, /* (225) case_operand ::= expr */
118170 + -3, /* (228) nexprlist ::= nexprlist COMMA expr */
118171 + -1, /* (229) nexprlist ::= expr */
118173 + -3, /* (231) paren_exprlist ::= LP exprlist RP */
118174 + -12, /* (232) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_…
118175 + -1, /* (233) uniqueflag ::= UNIQUE */
118178 + -3, /* (236) eidlist_opt ::= LP eidlist RP */
118179 + -5, /* (237) eidlist ::= eidlist COMMA nm collate sortorder */
118180 + -3, /* (238) eidlist ::= nm collate sortorder */
118182 + -2, /* (240) collate ::= COLLATE ID|STRING */
118183 + -4, /* (241) cmd ::= DROP INDEX ifexists fullname */
118184 + -2, /* (242) cmd ::= VACUUM vinto */
118185 + -3, /* (243) cmd ::= VACUUM nm vinto */
118186 + -2, /* (244) vinto ::= INTO expr */
118188 + -3, /* (246) cmd ::= PRAGMA nm dbnm */
118189 + -5, /* (247) cmd ::= PRAGMA nm dbnm EQ nmnum */
118190 + -6, /* (248) cmd ::= PRAGMA nm dbnm LP nmnum RP */
118191 + -5, /* (249) cmd ::= PRAGMA nm dbnm EQ minus_num */
118192 + -6, /* (250) cmd ::= PRAGMA nm dbnm LP minus_num RP */
118193 + -2, /* (251) plus_num ::= PLUS INTEGER|FLOAT */
118194 + -2, /* (252) minus_num ::= MINUS INTEGER|FLOAT */
118195 + -5, /* (253) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
118196 + -11, /* (254) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON f…
118197 + -1, /* (255) trigger_time ::= BEFORE|AFTER */
118198 + -2, /* (256) trigger_time ::= INSTEAD OF */
118200 + -1, /* (258) trigger_event ::= DELETE|INSERT */
118201 + -1, /* (259) trigger_event ::= UPDATE */
118202 + -3, /* (260) trigger_event ::= UPDATE OF idlist */
118204 + -2, /* (262) when_clause ::= WHEN expr */
118205 + -3, /* (263) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
118206 + -2, /* (264) trigger_cmd_list ::= trigger_cmd SEMI */
118207 + -3, /* (265) trnm ::= nm DOT nm */
118208 + -3, /* (266) tridxby ::= INDEXED BY nm */
118209 + -2, /* (267) tridxby ::= NOT INDEXED */
118210 + -9, /* (268) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
118211 + -8, /* (269) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
118212 + -6, /* (270) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
118213 + -3, /* (271) trigger_cmd ::= scanpt select scanpt */
118214 + -4, /* (272) expr ::= RAISE LP IGNORE RP */
118215 + -6, /* (273) expr ::= RAISE LP raisetype COMMA nm RP */
118216 + -1, /* (274) raisetype ::= ROLLBACK */
118217 + -1, /* (275) raisetype ::= ABORT */
118218 + -1, /* (276) raisetype ::= FAIL */
118219 + -4, /* (277) cmd ::= DROP TRIGGER ifexists fullname */
118220 + -6, /* (278) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
118221 + -3, /* (279) cmd ::= DETACH database_kw_opt expr */
118223 + -2, /* (281) key_opt ::= KEY expr */
118224 + -6, /* (282) cmd ::= ALTER TABLE fullname RENAME TO nm */
118225 + -7, /* (283) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
118226 + -6, /* (284) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
118227 + -1, /* (285) add_column_fullname ::= fullname */
118228 + -8, /* (286) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
118229 + -1, /* (287) cmd ::= create_vtab */
118230 + -4, /* (288) cmd ::= create_vtab LP vtabarglist RP */
118231 + -8, /* (289) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
118233 + -1, /* (291) vtabargtoken ::= ANY */
118234 + -3, /* (292) vtabargtoken ::= lp anylist RP */
118235 + -1, /* (293) lp ::= LP */
118236 + -2, /* (294) with ::= WITH wqlist */
118237 + -3, /* (295) with ::= WITH RECURSIVE wqlist */
118238 + -1, /* (296) wqas ::= AS */
118239 + -2, /* (297) wqas ::= AS MATERIALIZED */
118240 + -3, /* (298) wqas ::= AS NOT MATERIALIZED */
118241 + -6, /* (299) wqitem ::= nm eidlist_opt wqas LP select RP */
118242 + -1, /* (300) wqlist ::= wqitem */
118243 + -3, /* (301) wqlist ::= wqlist COMMA wqitem */
118244 + -1, /* (302) input ::= cmdlist */
118245 + -2, /* (303) cmdlist ::= cmdlist ecmd */
118246 + -1, /* (304) cmdlist ::= ecmd */
118247 + -1, /* (305) ecmd ::= SEMI */
118248 + -2, /* (306) ecmd ::= cmdx SEMI */
118250 + -1, /* (308) trans_opt ::= TRANSACTION */
118251 + -2, /* (309) trans_opt ::= TRANSACTION nm */
118252 + -1, /* (310) savepoint_opt ::= SAVEPOINT */
118254 + -2, /* (312) cmd ::= create_table create_table_args */
118255 + -1, /* (313) table_option_set ::= table_option */
118256 + -4, /* (314) columnlist ::= columnlist COMMA columnname carglist */
118257 + -2, /* (315) columnlist ::= columnname carglist */
118258 + -1, /* (316) nm ::= ID|INDEXED */
118259 + -1, /* (317) nm ::= STRING */
118260 + -1, /* (318) nm ::= JOIN_KW */
118261 + -1, /* (319) typetoken ::= typename */
118262 + -1, /* (320) typename ::= ID|STRING */
118263 + -1, /* (321) signed ::= plus_num */
118264 + -1, /* (322) signed ::= minus_num */
118265 + -2, /* (323) carglist ::= carglist ccons */
118267 + -2, /* (325) ccons ::= NULL onconf */
118268 + -4, /* (326) ccons ::= GENERATED ALWAYS AS generated */
118269 + -2, /* (327) ccons ::= AS generated */
118270 + -2, /* (328) conslist_opt ::= COMMA conslist */
118271 + -3, /* (329) conslist ::= conslist tconscomma tcons */
118272 + -1, /* (330) conslist ::= tcons */
118274 + -1, /* (332) defer_subclause_opt ::= defer_subclause */
118275 + -1, /* (333) resolvetype ::= raisetype */
118276 + -1, /* (334) selectnowith ::= oneselect */
118277 + -1, /* (335) oneselect ::= values */
118278 + -2, /* (336) sclp ::= selcollist COMMA */
118279 + -1, /* (337) as ::= ID|STRING */
118280 + -1, /* (338) indexed_opt ::= indexed_by */
118282 + -1, /* (340) expr ::= term */
118283 + -1, /* (341) likeop ::= LIKE_KW|MATCH */
118284 + -1, /* (342) exprlist ::= nexprlist */
118285 + -1, /* (343) nmnum ::= plus_num */
118286 + -1, /* (344) nmnum ::= nm */
118287 + -1, /* (345) nmnum ::= ON */
118288 + -1, /* (346) nmnum ::= DELETE */
118289 + -1, /* (347) nmnum ::= DEFAULT */
118290 + -1, /* (348) plus_num ::= INTEGER|FLOAT */
118292 + -3, /* (350) foreach_clause ::= FOR EACH ROW */
118293 + -1, /* (351) trnm ::= nm */
118295 + -1, /* (353) database_kw_opt ::= DATABASE */
118298 + -1, /* (356) kwcolumn_opt ::= COLUMNKW */
118299 + -1, /* (357) vtabarglist ::= vtabarg */
118300 + -3, /* (358) vtabarglist ::= vtabarglist COMMA vtabarg */
118301 + -2, /* (359) vtabarg ::= vtabarg vtabargtoken */
118303 + -4, /* (361) anylist ::= anylist LP anylist RP */
118304 + -2, /* (362) anylist ::= anylist ANY */
118309 @@ -162709,15 +166818,15 @@ static YYACTIONTYPE yy_reduce(
118313 -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy332);}
118314 +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy452);}
118317 -{yymsp[1].minor.yy332 = TK_DEFERRED;}
118323 -{yymsp[0].minor.yy332 = yymsp[0].major; /*A-overwrites-X*/}
118324 +{yymsp[0].minor.yy452 = yymsp[0].major; /*A-overwrites-X*/}
118328 @@ -162740,7 +166849,7 @@ static YYACTIONTYPE yy_reduce(
118332 - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy332,0,0,yym…
118333 + sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy452,0,0,yym…
118337 @@ -162753,39 +166862,39 @@ static YYACTIONTYPE yy_reduce(
118341 - case 236: /* collate ::= */ yytestcase(yyruleno==236);
118342 -{yymsp[1].minor.yy332 = 0;}
118347 -{yymsp[-2].minor.yy332 = 1;}
118348 +{yymsp[-2].minor.yy452 = 1;}
118351 -{yymsp[0].minor.yy332 = pParse->db->init.busy==0;}
118352 +{yymsp[0].minor.yy452 = pParse->db->init.busy==0;}
118356 - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy213,0);
118357 + sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy227,0);
118362 - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy433);
118363 - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy433);
118365 + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy279);
118369 -{yymsp[1].minor.yy213 = 0;}
118373 -{yylhsminor.yy213 = yymsp[-2].minor.yy213|yymsp[0].minor.yy213;}
118374 - yymsp[-2].minor.yy213 = yylhsminor.yy213;
118375 +{yylhsminor.yy227 = yymsp[-2].minor.yy227|yymsp[0].minor.yy227;}
118376 + yymsp[-2].minor.yy227 = yylhsminor.yy227;
118381 - yymsp[-1].minor.yy213 = TF_WithoutRowid | TF_NoVisibleRowid;
118382 + yymsp[-1].minor.yy227 = TF_WithoutRowid | TF_NoVisibleRowid;
118384 - yymsp[-1].minor.yy213 = 0;
118385 + yymsp[-1].minor.yy227 = 0;
118389 @@ -162793,13 +166902,13 @@ static YYACTIONTYPE yy_reduce(
118393 - yylhsminor.yy213 = TF_Strict;
118396 - yylhsminor.yy213 = 0;
118401 - yymsp[0].minor.yy213 = yylhsminor.yy213;
118405 {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);}
118406 @@ -162825,7 +166934,7 @@ static YYACTIONTYPE yy_reduce(
118410 - yymsp[1].minor.yy70 = yyLookaheadToken.z;
118415 @@ -162839,17 +166948,17 @@ static YYACTIONTYPE yy_reduce(
118416 {pParse->constraintName = yymsp[0].minor.yy0;}
118419 -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[y…
118420 …te3AddDefaultValue(pParse,yymsp[0].minor.yy122,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[
118423 -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z)…
118424 +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy122,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z)…
118427 -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[y…
118428 …te3AddDefaultValue(pParse,yymsp[0].minor.yy122,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[
118432 - Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0);
118434 …sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n…
118437 @@ -162864,297 +166973,305 @@ static YYACTIONTYPE yy_reduce(
118441 -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy332);}
118445 -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy332,yymsp[0].minor.yy332,yymsp[-2].minor.yy332);}
118446 +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy452,yymsp[0].minor.yy452,yymsp[-2].minor.yy452);}
118449 -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy332,0,0,0,0,
118454 -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z…
118455 +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy122,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z…
118458 -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy368,yymsp[0].minor.yy332)…
118459 +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy452)…
118462 -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy332);}
118469 -{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy454,0);}
118470 +{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy122,0);}
118473 -{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy454,&yymsp[0].minor.yy0);}
118474 +{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy122,&yymsp[0].minor.yy0);}
118477 -{yymsp[0].minor.yy332 = 1;}
118481 -{ yymsp[1].minor.yy332 = OE_None*0x0101; /* EV: R-19803-45884 */}
118482 +{ yymsp[1].minor.yy452 = OE_None*0x0101; /* EV: R-19803-45884 */}
118485 -{ yymsp[-1].minor.yy332 = (yymsp[-1].minor.yy332 & ~yymsp[0].minor.yy277.mask) | yymsp[0].minor.yy…
118486 +{ yymsp[-1].minor.yy452 = (yymsp[-1].minor.yy452 & ~yymsp[0].minor.yy347.mask) | yymsp[0].minor.yy…
118489 -{ yymsp[-1].minor.yy277.value = 0; yymsp[-1].minor.yy277.mask = 0x000000; }
118490 +{ yymsp[-1].minor.yy347.value = 0; yymsp[-1].minor.yy347.mask = 0x000000; }
118493 -{ yymsp[-2].minor.yy277.value = 0; yymsp[-2].minor.yy277.mask = 0x000000; }
118494 +{ yymsp[-2].minor.yy347.value = 0; yymsp[-2].minor.yy347.mask = 0x000000; }
118497 -{ yymsp[-2].minor.yy277.value = yymsp[0].minor.yy332; yymsp[-2].minor.yy277.mask = 0x0000ff; }
118498 +{ yymsp[-2].minor.yy347.value = yymsp[0].minor.yy452; yymsp[-2].minor.yy347.mask = 0x0000ff; }
118501 -{ yymsp[-2].minor.yy277.value = yymsp[0].minor.yy332<<8; yymsp[-2].minor.yy277.mask = 0x00ff00; }
118502 +{ yymsp[-2].minor.yy347.value = yymsp[0].minor.yy452<<8; yymsp[-2].minor.yy347.mask = 0x00ff00; }
118505 -{ yymsp[-1].minor.yy332 = OE_SetNull; /* EV: R-33326-45252 */}
118506 +{ yymsp[-1].minor.yy452 = OE_SetNull; /* EV: R-33326-45252 */}
118509 -{ yymsp[-1].minor.yy332 = OE_SetDflt; /* EV: R-33326-45252 */}
118510 +{ yymsp[-1].minor.yy452 = OE_SetDflt; /* EV: R-33326-45252 */}
118513 -{ yymsp[0].minor.yy332 = OE_Cascade; /* EV: R-33326-45252 */}
118514 +{ yymsp[0].minor.yy452 = OE_Cascade; /* EV: R-33326-45252 */}
118517 -{ yymsp[0].minor.yy332 = OE_Restrict; /* EV: R-33326-45252 */}
118518 +{ yymsp[0].minor.yy452 = OE_Restrict; /* EV: R-33326-45252 */}
118521 -{ yymsp[-1].minor.yy332 = OE_None; /* EV: R-33326-45252 */}
118522 +{ yymsp[-1].minor.yy452 = OE_None; /* EV: R-33326-45252 */}
118525 -{yymsp[-2].minor.yy332 = 0;}
118526 +{yymsp[-2].minor.yy452 = 0;}
118531 -{yymsp[-1].minor.yy332 = yymsp[0].minor.yy332;}
118532 +{yymsp[-1].minor.yy452 = yymsp[0].minor.yy452;}
118536 - case 208: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==208);
118537 - case 211: /* in_op ::= NOT IN */ yytestcase(yyruleno==211);
118538 - case 237: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==237);
118539 -{yymsp[-1].minor.yy332 = 1;}
118543 +{yymsp[-1].minor.yy452 = 1;}
118546 -{yymsp[-1].minor.yy332 = 0;}
118547 +{yymsp[-1].minor.yy452 = 0;}
118550 {pParse->constraintName.n = 0;}
118553 -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy368,yymsp[0].minor.yy332,yymsp[-2].minor.yy332,0);}
118554 +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy452,yymsp[-2].minor.yy452,0);}
118557 -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy368,yymsp[0].minor.yy332,0,0,0,0,
118558 +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy452,0,0,0,0,
118562 -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.…
118563 +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy122,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.…
118567 - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy368, &yymsp[-3].minor.yy0, yymsp[-2].minor.y…
118568 - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy332);
118569 … sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.y…
118575 -{yymsp[1].minor.yy332 = OE_Default;}
118579 -{yymsp[-2].minor.yy332 = yymsp[0].minor.yy332;}
118580 +{yymsp[-2].minor.yy452 = yymsp[0].minor.yy452;}
118583 -{yymsp[0].minor.yy332 = OE_Ignore;}
118588 -{yymsp[0].minor.yy332 = OE_Replace;}
118593 - sqlite3DropTable(pParse, yymsp[0].minor.yy155, 0, yymsp[-1].minor.yy332);
118594 + sqlite3DropTable(pParse, yymsp[0].minor.yy247, 0, yymsp[-1].minor.yy452);
118599 - sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yyms…
118600 …, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0…
118605 - sqlite3DropTable(pParse, yymsp[0].minor.yy155, 1, yymsp[-1].minor.yy332);
118606 + sqlite3DropTable(pParse, yymsp[0].minor.yy247, 1, yymsp[-1].minor.yy452);
118612 - sqlite3Select(pParse, yymsp[0].minor.yy433, &dest);
118613 - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy433);
118615 + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy279);
118619 -{yymsp[-2].minor.yy433 = attachWithToSelect(pParse,yymsp[0].minor.yy433,yymsp[-1].minor.yy23);}
118620 +{yymsp[-2].minor.yy279 = attachWithToSelect(pParse,yymsp[0].minor.yy279,yymsp[-1].minor.yy231);}
118623 -{yymsp[-3].minor.yy433 = attachWithToSelect(pParse,yymsp[0].minor.yy433,yymsp[-1].minor.yy23);}
118624 +{yymsp[-3].minor.yy279 = attachWithToSelect(pParse,yymsp[0].minor.yy279,yymsp[-1].minor.yy231);}
118628 - Select *p = yymsp[0].minor.yy433;
118633 - yymsp[0].minor.yy433 = p; /*A-overwrites-X*/
118634 + yymsp[0].minor.yy279 = p; /*A-overwrites-X*/
118639 - Select *pRhs = yymsp[0].minor.yy433;
118640 - Select *pLhs = yymsp[-2].minor.yy433;
118642 + Select *pLhs = yymsp[-2].minor.yy279;
118643 if( pRhs && pRhs->pPrior ){
118648 - pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0);
118653 - pRhs->op = (u8)yymsp[-1].minor.yy332;
118654 + pRhs->op = (u8)yymsp[-1].minor.yy452;
118655 pRhs->pPrior = pLhs;
118656 if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue;
118657 pRhs->selFlags &= ~SF_MultiValue;
118658 - if( yymsp[-1].minor.yy332!=TK_ALL ) pParse->hasCompound = 1;
118659 + if( yymsp[-1].minor.yy452!=TK_ALL ) pParse->hasCompound = 1;
118661 sqlite3SelectDelete(pParse->db, pLhs);
118663 - yymsp[-2].minor.yy433 = pRhs;
118664 + yymsp[-2].minor.yy279 = pRhs;
118669 -{yymsp[0].minor.yy332 = yymsp[0].major; /*A-overwrites-OP*/}
118670 +{yymsp[0].minor.yy452 = yymsp[0].major; /*A-overwrites-OP*/}
118673 -{yymsp[-1].minor.yy332 = TK_ALL;}
118674 +{yymsp[-1].minor.yy452 = TK_ALL;}
118678 - yymsp[-8].minor.yy433 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy368,yymsp[-5].minor.yy155,yyms…
118679-8].minor.yy279 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy247,yymsp[-4].mi…
118684 - yymsp[-3].minor.yy433 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy368,0,0,0,0,0,SF_Values,0);
118685 + yymsp[-3].minor.yy279 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0);
118690 - Select *pRight, *pLeft = yymsp[-4].minor.yy433;
118691 - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy368,0,0,0,0,0,SF_Values|SF_MultiValue,0);
118692 + Select *pRight, *pLeft = yymsp[-4].minor.yy279;
118693 + pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0);
118694 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
118696 pRight->op = TK_ALL;
118697 pRight->pPrior = pLeft;
118698 - yymsp[-4].minor.yy433 = pRight;
118699 + yymsp[-4].minor.yy279 = pRight;
118701 - yymsp[-4].minor.yy433 = pLeft;
118702 + yymsp[-4].minor.yy279 = pLeft;
118707 -{yymsp[0].minor.yy332 = SF_Distinct;}
118711 -{yymsp[0].minor.yy332 = SF_All;}
118717 - case 224: /* exprlist ::= */ yytestcase(yyruleno==224);
118718 - case 227: /* paren_exprlist ::= */ yytestcase(yyruleno==227);
118719 - case 232: /* eidlist_opt ::= */ yytestcase(yyruleno==232);
118720 -{yymsp[1].minor.yy368 = 0;}
118728 - yymsp[-4].minor.yy368 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy368, yymsp[-2].minor.yy…
118729 - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy368, &yymsp[0].mi…
118730 - sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy368,yymsp[-3].minor.yy70,yymsp[-1].minor.yy70);
118731 + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy…
118732 + if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].mi…
118733 + sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy116,yymsp[-1].minor.yy116…
118738 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
118739 - yymsp[-2].minor.yy368 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy368, p);
118740 + yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p);
118746 - Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
118747 + Expr *pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0);
118749 - yymsp[-4].minor.yy368 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy368, pDot);
118750 + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
118754 - case 111: /* dbnm ::= DOT nm */ yytestcase(yyruleno==111);
118755 - case 248: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==248);
118756 - case 249: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==249);
118760 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
118764 -{yymsp[1].minor.yy155 = 0;}
118769 - yymsp[-1].minor.yy155 = yymsp[0].minor.yy155;
118770 - sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy155);
118771 + yymsp[-1].minor.yy247 = yymsp[0].minor.yy247;
118772 + sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy247);
118777 - if( ALWAYS(yymsp[-1].minor.yy155 && yymsp[-1].minor.yy155->nSrc>0) ) yymsp[-1].minor.yy155->a[y…
118778 + if( ALWAYS(yymsp[-1].minor.yy247 && yymsp[-1].minor.yy247->nSrc>0) ) yymsp[-1].minor.yy247->a[y…
118783 + yymsp[-4].minor.yy247 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy247,&yymsp[-3].min…
118786 - case 106: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
118789 - yymsp[-6].minor.yy155 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy155,&yymsp[-5].min…
118790 - sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy155, &yymsp[-2].minor.yy0);
118791 + yymsp[-5].minor.yy247 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy247,&yymsp[-4].min…
118792 + sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy247, &yymsp[-1].minor.yy0);
118795 - case 107: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
118798 - yymsp[-8].minor.yy155 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy155,&yymsp[-7].min…
118799 - sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy155, yymsp[-4].minor.yy368);
118800 + yymsp[-7].minor.yy247 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy247,&yymsp[-6].min…
118801 + sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy247, yymsp[-3].minor.yy322);
118804 - case 108: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
118807 - yymsp[-6].minor.yy155 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy155,0,0,&yymsp[-
118808 + yymsp[-5].minor.yy247 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy247,0,0,&yymsp[-
118811 - case 109: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
118814 - if( yymsp[-6].minor.yy155==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy454==0 && yymsp[…
118815 - yymsp[-6].minor.yy155 = yymsp[-4].minor.yy155;
118816 - }else if( yymsp[-4].minor.yy155->nSrc==1 ){
118817 - yymsp[-6].minor.yy155 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy155,0,0,&yymsp…
118818 - if( yymsp[-6].minor.yy155 ){
118819 - SrcItem *pNew = &yymsp[-6].minor.yy155->a[yymsp[-6].minor.yy155->nSrc-1];
118820 - SrcItem *pOld = yymsp[-4].minor.yy155->a;
118821 + if( yymsp[-5].minor.yy247==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy445.pOn==0 && yym…
118822 + yymsp[-5].minor.yy247 = yymsp[-3].minor.yy247;
118823 + }else if( yymsp[-3].minor.yy247->nSrc==1 ){
118824 + yymsp[-5].minor.yy247 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy247,0,0,&yymsp…
118825 + if( yymsp[-5].minor.yy247 ){
118826 + SrcItem *pNew = &yymsp[-5].minor.yy247->a[yymsp[-5].minor.yy247->nSrc-1];
118827 + SrcItem *pOld = yymsp[-3].minor.yy247->a;
118828 pNew->zName = pOld->zName;
118829 pNew->zDatabase = pOld->zDatabase;
118830 pNew->pSelect = pOld->pSelect;
118831 + if( pNew->pSelect && (pNew->pSelect->selFlags & SF_NestedFrom)!=0 ){
118832 + pNew->fg.isNestedFrom = 1;
118834 if( pOld->fg.isTabFunc ){
118835 pNew->u1.pFuncArg = pOld->u1.pFuncArg;
118836 pOld->u1.pFuncArg = 0;
118837 @@ -163164,267 +167281,277 @@ static YYACTIONTYPE yy_reduce(
118838 pOld->zName = pOld->zDatabase = 0;
118839 pOld->pSelect = 0;
118841 - sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy155);
118842 + sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy247);
118845 - sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy155);
118846 - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy155,0,0,0,0,SF_NestedFrom,0);
118847 - yymsp[-6].minor.yy155 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy155,0,0,&yymsp…
118848 + sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy247);
118849 + pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy247,0,0,0,0,SF_NestedFrom,0);
118850 + yymsp[-5].minor.yy247 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy247,0,0,&yymsp…
118854 - case 110: /* dbnm ::= */
118855 - case 124: /* indexed_opt ::= */ yytestcase(yyruleno==124);
118860 - case 112: /* fullname ::= nm */
118863 - yylhsminor.yy155 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0);
118864 - if( IN_RENAME_OBJECT && yylhsminor.yy155 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy155->a[0].…
118866 + if( IN_RENAME_OBJECT && yylhsminor.yy247 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy247->a[0].…
118868 - yymsp[0].minor.yy155 = yylhsminor.yy155;
118871 - case 113: /* fullname ::= nm DOT nm */
118874 - yylhsminor.yy155 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
118875 - if( IN_RENAME_OBJECT && yylhsminor.yy155 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy155->a[0].…
118876 + yylhsminor.yy247 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
118877 + if( IN_RENAME_OBJECT && yylhsminor.yy247 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy247->a[0].…
118879 - yymsp[-2].minor.yy155 = yylhsminor.yy155;
118880 + yymsp[-2].minor.yy247 = yylhsminor.yy247;
118882 - case 114: /* xfullname ::= nm */
118883 -{yymsp[0].minor.yy155 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
118885 +{yymsp[0].minor.yy247 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/}
118887 - case 115: /* xfullname ::= nm DOT nm */
118888 -{yymsp[-2].minor.yy155 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); …
118890 +{yymsp[-2].minor.yy247 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); …
118892 - case 116: /* xfullname ::= nm DOT nm AS nm */
118895 - yymsp[-4].minor.yy155 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0…
118896 - if( yymsp[-4].minor.yy155 ) yymsp[-4].minor.yy155->a[0].zAlias = sqlite3NameFromToken(pParse->d…
118897 + yymsp[-4].minor.yy247 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0…
118898 + if( yymsp[-4].minor.yy247 ) yymsp[-4].minor.yy247->a[0].zAlias = sqlite3NameFromToken(pParse->d…
118901 - case 117: /* xfullname ::= nm AS nm */
118904 - yymsp[-2].minor.yy155 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X…
118905 - if( yymsp[-2].minor.yy155 ) yymsp[-2].minor.yy155->a[0].zAlias = sqlite3NameFromToken(pParse->d…
118906 + yymsp[-2].minor.yy247 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X…
118907 + if( yymsp[-2].minor.yy247 ) yymsp[-2].minor.yy247->a[0].zAlias = sqlite3NameFromToken(pParse->d…
118910 - case 118: /* joinop ::= COMMA|JOIN */
118911 -{ yymsp[0].minor.yy332 = JT_INNER; }
118915 - case 119: /* joinop ::= JOIN_KW JOIN */
118916 -{yymsp[-1].minor.yy332 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
118918 +{yymsp[-1].minor.yy452 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
118920 - case 120: /* joinop ::= JOIN_KW nm JOIN */
118921 -{yymsp[-2].minor.yy332 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-
118923 +{yymsp[-2].minor.yy452 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-
118925 - case 121: /* joinop ::= JOIN_KW nm nm JOIN */
118926 -{yymsp[-3].minor.yy332 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-
118928 +{yymsp[-3].minor.yy452 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-
118930 - case 122: /* on_opt ::= ON expr */
118931 - case 142: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==142);
118932 - case 149: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==149);
118933 - case 151: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==151);
118934 - case 220: /* case_else ::= ELSE expr */ yytestcase(yyruleno==220);
118935 - case 241: /* vinto ::= INTO expr */ yytestcase(yyruleno==241);
118936 -{yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;}
118938 +{yymsp[-1].minor.yy445.pOn = yymsp[0].minor.yy122; yymsp[-1].minor.yy445.pUsing = 0;}
118940 - case 123: /* on_opt ::= */
118941 - case 141: /* having_opt ::= */ yytestcase(yyruleno==141);
118942 - case 143: /* limit_opt ::= */ yytestcase(yyruleno==143);
118943 - case 148: /* where_opt ::= */ yytestcase(yyruleno==148);
118944 - case 150: /* where_opt_ret ::= */ yytestcase(yyruleno==150);
118945 - case 221: /* case_else ::= */ yytestcase(yyruleno==221);
118946 - case 223: /* case_operand ::= */ yytestcase(yyruleno==223);
118947 - case 242: /* vinto ::= */ yytestcase(yyruleno==242);
118948 -{yymsp[1].minor.yy454 = 0;}
118950 +{yymsp[-3].minor.yy445.pOn = 0; yymsp[-3].minor.yy445.pUsing = yymsp[-1].minor.yy80;}
118952 - case 125: /* indexed_opt ::= INDEXED BY nm */
118957 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
118959 - case 126: /* indexed_opt ::= NOT INDEXED */
118961 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
118963 - case 127: /* using_opt ::= USING LP idlist RP */
118964 -{yymsp[-3].minor.yy374 = yymsp[-1].minor.yy374;}
118965 - break;
118966 - case 128: /* using_opt ::= */
118967 - case 170: /* idlist_opt ::= */ yytestcase(yyruleno==170);
118968 -{yymsp[1].minor.yy374 = 0;}
118969 - break;
118972 -{yymsp[-2].minor.yy368 = yymsp[0].minor.yy368;}
118973 +{yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;}
118977 - yymsp[-4].minor.yy368 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy368,yymsp[-2].minor.yy454…
118978 - sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy368,yymsp[-1].minor.yy332,yymsp[0].minor.yy332);
118979 + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322,yymsp[-2].minor.yy122…
118980 + sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy322,yymsp[-1].minor.yy452,yymsp[0].minor.yy452);
118985 - yymsp[-2].minor.yy368 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy454); /*A-overwrites-Y*/
118986 - sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy368,yymsp[-1].minor.yy332,yymsp[0].minor.yy332);
118987 + yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy122); /*A-overwrites-Y*/
118988 + sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy322,yymsp[-1].minor.yy452,yymsp[0].minor.yy452);
118992 -{yymsp[0].minor.yy332 = SQLITE_SO_ASC;}
118996 -{yymsp[0].minor.yy332 = SQLITE_SO_DESC;}
119001 -{yymsp[1].minor.yy332 = SQLITE_SO_UNDEFINED;}
119005 -{yymsp[-1].minor.yy332 = SQLITE_SO_ASC;}
119006 +{yymsp[-1].minor.yy452 = SQLITE_SO_ASC;}
119009 -{yymsp[-1].minor.yy332 = SQLITE_SO_DESC;}
119010 +{yymsp[-1].minor.yy452 = SQLITE_SO_DESC;}
119026 +{yymsp[-1].minor.yy122 = yymsp[0].minor.yy122;}
119029 -{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,0);}
119030 +{yymsp[-1].minor.yy122 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy122,0);}
119033 -{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
119034 +{yymsp[-3].minor.yy122 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy122,yymsp[0].minor.yy122);}
119037 -{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,yymsp[-2].minor.yy454);}
119038 +{yymsp[-3].minor.yy122 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy122,yymsp[-2].minor.yy122);}
119042 - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy155, &yymsp[-1].minor.yy0);
119043 - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy155,yymsp[0].minor.yy454,0,0);
119044 + sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy247, &yymsp[-1].minor.yy0);
119045 + sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy247,yymsp[0].minor.yy122,0,0);
119049 -{sqlite3AddReturning(pParse,yymsp[0].minor.yy368); yymsp[-1].minor.yy454 = 0;}
119050 +{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-1].minor.yy122 = 0;}
119053 -{sqlite3AddReturning(pParse,yymsp[0].minor.yy368); yymsp[-3].minor.yy454 = yymsp[-2].minor.yy454;}
119054 +{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-3].minor.yy122 = yymsp[-2].minor.yy122;}
119058 - sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy155, &yymsp[-4].minor.yy0);
119059 - sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy368,"set list");
119060 - yymsp[-5].minor.yy155 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy155, yymsp[-1].minor.…
119061 - sqlite3Update(pParse,yymsp[-5].minor.yy155,yymsp[-2].minor.yy368,yymsp[0].minor.yy454,yymsp[-6].…
119062 + sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy247, &yymsp[-4].minor.yy0);
119063 + sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy322,"set list");
119064 + if( yymsp[-1].minor.yy247 ){
119065 + SrcList *pFromClause = yymsp[-1].minor.yy247;
119066 + if( pFromClause->nSrc>1 ){
119074 + yymsp[-5].minor.yy247 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy247, pFromClause);
119076 + sqlite3Update(pParse,yymsp[-5].minor.yy247,yymsp[-2].minor.yy322,yymsp[0].minor.yy122,yymsp[-6].…
119081 - yymsp[-4].minor.yy368 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy368, yymsp[0].minor.yy45…
119082 - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy368, &yymsp[-2].minor.yy0, 1);
119083 + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy12…
119084 + sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1);
119089 - yymsp[-6].minor.yy368 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy368, yymsp[-3].min…
119090 + yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].min…
119095 - yylhsminor.yy368 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy454);
119096 - sqlite3ExprListSetName(pParse, yylhsminor.yy368, &yymsp[-2].minor.yy0, 1);
119098 + sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1);
119100 - yymsp[-2].minor.yy368 = yylhsminor.yy368;
119101 + yymsp[-2].minor.yy322 = yylhsminor.yy322;
119105 - yymsp[-4].minor.yy368 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy374, yymsp[0].m…
119106 + yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy80, yymsp[0].mi…
119111 - sqlite3Insert(pParse, yymsp[-3].minor.yy155, yymsp[-1].minor.yy433, yymsp[-2].minor.yy374, yymsp…
119112 + sqlite3Insert(pParse, yymsp[-3].minor.yy247, yymsp[-1].minor.yy279, yymsp[-2].minor.yy80, yymsp[
119117 - sqlite3Insert(pParse, yymsp[-4].minor.yy155, 0, yymsp[-3].minor.yy374, yymsp[-6].minor.yy332, 0);
119118 + sqlite3Insert(pParse, yymsp[-4].minor.yy247, 0, yymsp[-3].minor.yy80, yymsp[-6].minor.yy452, 0);
119122 -{ yymsp[1].minor.yy232 = 0; }
119126 -{ yymsp[-1].minor.yy232 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy368); }
119127 +{ yymsp[-1].minor.yy38 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy322); }
119130 -{ yymsp[-11].minor.yy232 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy368,yymsp[-6].minor.yy454…
119131 +{ yymsp[-11].minor.yy38 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy322,yymsp[-6].minor.yy122,…
119134 -{ yymsp[-8].minor.yy232 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy368,yymsp[-3].minor.yy454,…
119135 +{ yymsp[-8].minor.yy38 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy322,yymsp[-3].minor.yy122,0…
119138 -{ yymsp[-4].minor.yy232 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
119139 +{ yymsp[-4].minor.yy38 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
119142 -{ yymsp[-7].minor.yy232 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy368,yymsp[-1].minor.yy…
119143 +{ yymsp[-7].minor.yy38 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy322,yymsp[-1].minor.yy1…
119146 -{sqlite3AddReturning(pParse,yymsp[0].minor.yy368);}
119153 -{yymsp[-2].minor.yy374 = yymsp[-1].minor.yy374;}
119154 +{yymsp[-2].minor.yy80 = yymsp[-1].minor.yy80;}
119157 -{yymsp[-2].minor.yy374 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy374,&yymsp[0].minor.yy0);}
119158 +{yymsp[-2].minor.yy80 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy80,&yymsp[0].minor.yy0);}
119161 -{yymsp[0].minor.yy374 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
119162 +{yymsp[0].minor.yy80 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
119165 -{yymsp[-2].minor.yy454 = yymsp[-1].minor.yy454;}
119166 +{yymsp[-2].minor.yy122 = yymsp[-1].minor.yy122;}
119170 -{yymsp[0].minor.yy454=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
119171 +{yymsp[0].minor.yy122=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
119175 - Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
119176 - Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
119177 - if( IN_RENAME_OBJECT ){
119178 - sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
119179 - sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0);
119180 - }
119181 - yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
119182 + Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
119186 - yymsp[-2].minor.yy454 = yylhsminor.yy454;
119187 + yymsp[-2].minor.yy122 = yylhsminor.yy122;
119191 - Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
119192 - Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
119193 - Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
119194 + Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
119195 + Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
119199 - sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0);
119200 - sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0);
119203 - yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
119206 - yymsp[-4].minor.yy454 = yylhsminor.yy454;
119207 + yymsp[-4].minor.yy122 = yylhsminor.yy122;
119211 -{yymsp[0].minor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
119212 +{yymsp[0].minor.yy122=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
119216 - yylhsminor.yy454 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
119217 + yylhsminor.yy122 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
119218 + if( yylhsminor.yy122 ) yylhsminor.yy122->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
119220 - yymsp[0].minor.yy454 = yylhsminor.yy454;
119227 - yymsp[0].minor.yy454 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
119228 - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy454, n);
119234 @@ -163433,51 +167560,51 @@ static YYACTIONTYPE yy_reduce(
119236 if( pParse->nested==0 ){
119238 - yymsp[0].minor.yy454 = 0;
119241 - yymsp[0].minor.yy454 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
119242 - if( yymsp[0].minor.yy454 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy454->iTable);
119244 + if( yymsp[0].minor.yy122 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy122->iTable);
119251 - yymsp[-2].minor.yy454 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy454, &yymsp[0].mino…
119252 + yymsp[-2].minor.yy122 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy122, &yymsp[0].mino…
119257 - yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
119258 - sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy454, yymsp[-3].minor.yy454, 0);
119259 + yymsp[-5].minor.yy122 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
119260 + sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy122, yymsp[-3].minor.yy122, 0);
119265 - yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy368, &yymsp[-4].minor.yy0, yyms…
119266 …yylhsminor.yy122 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[
119268 - yymsp[-4].minor.yy454 = yylhsminor.yy454;
119269 + yymsp[-4].minor.yy122 = yylhsminor.yy122;
119273 - yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
119274 + yylhsminor.yy122 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
119276 - yymsp[-3].minor.yy454 = yylhsminor.yy454;
119277 + yymsp[-3].minor.yy122 = yylhsminor.yy122;
119281 - yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
119284 - yymsp[0].minor.yy454 = yylhsminor.yy454;
119289 - ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy368, yymsp[-1].minor.yy454);
119290 - yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
119291 - if( yymsp[-4].minor.yy454 ){
119292 - yymsp[-4].minor.yy454->x.pList = pList;
119293 + ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy122);
119294 + yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
119295 + if( yymsp[-4].minor.yy122 ){
119296 + yymsp[-4].minor.yy122->x.pList = pList;
119297 if( ALWAYS(pList->nExpr) ){
119298 - yymsp[-4].minor.yy454->flags |= pList->a[0].pExpr->flags & EP_Propagate;
119299 + yymsp[-4].minor.yy122->flags |= pList->a[0].pExpr->flags & EP_Propagate;
119302 sqlite3ExprListDelete(pParse->db, pList);
119303 @@ -163485,7 +167612,7 @@ static YYACTIONTYPE yy_reduce(
119307 -{yymsp[-2].minor.yy454=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);}
119308 +{yymsp[-2].minor.yy122=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy122,yymsp[0].minor.yy122);}
119312 @@ -163494,7 +167621,7 @@ static YYACTIONTYPE yy_reduce(
119316 -{yymsp[-2].minor.yy454=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy…
119317 +{yymsp[-2].minor.yy122=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy122,yymsp[0].minor.yy…
119320 …{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-
119321 @@ -163504,11 +167631,11 @@ static YYACTIONTYPE yy_reduce(
119323 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
119324 yymsp[-1].minor.yy0.n &= 0x7fffffff;
119325 - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy454);
119326 - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy454);
119327 - yymsp[-2].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
119328 - if( bNot ) yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy454, 0);
119329 - if( yymsp[-2].minor.yy454 ) yymsp[-2].minor.yy454->flags |= EP_InfixFunc;
119331 + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy122);
119332 + yymsp[-2].minor.yy122 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
119333 + if( bNot ) yymsp[-2].minor.yy122 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy122, 0);
119334 + if( yymsp[-2].minor.yy122 ) yymsp[-2].minor.yy122->flags |= EP_InfixFunc;
119338 @@ -163516,62 +167643,82 @@ static YYACTIONTYPE yy_reduce(
119340 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
119341 yymsp[-3].minor.yy0.n &= 0x7fffffff;
119342 - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
119343 - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy454);
119344 - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
119345 - yymsp[-4].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
119346 - if( bNot ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0);
119347 - if( yymsp[-4].minor.yy454 ) yymsp[-4].minor.yy454->flags |= EP_InfixFunc;
119348 + pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy122);
119349 + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy122);
119351 + yymsp[-4].minor.yy122 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
119352 + if( bNot ) yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy122, 0);
119353 + if( yymsp[-4].minor.yy122 ) yymsp[-4].minor.yy122->flags |= EP_InfixFunc;
119357 -{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy454,0);}
119358 +{yymsp[-1].minor.yy122 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy122,0);}
119361 -{yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy454,0);}
119362 +{yymsp[-2].minor.yy122 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy122,0);}
119366 - yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);
119367 - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-2].minor.yy454, TK_ISNULL);
119368 + yymsp[-2].minor.yy122 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy122,yymsp[0].minor.yy122);
119369 + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy122, yymsp[-2].minor.yy122, TK_ISNULL);
119374 - yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy454,yymsp[0].minor.yy454);
119375 - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-3].minor.yy454, TK_NOTNULL);
119376 + yymsp[-3].minor.yy122 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy122,yymsp[0].minor.yy122);
119377 + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy122, yymsp[-3].minor.yy122, TK_NOTNULL);
119380 - case 204: /* expr ::= NOT expr */
119381 - case 205: /* expr ::= BITNOT expr */ yytestcase(yyruleno==205);
119382 -{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0);/*A-overwr…
119385 + yymsp[-5].minor.yy122 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy122,yymsp[0].minor.yy122);
119386 + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy122, yymsp[-5].minor.yy122, TK_ISNULL);
119389 - case 206: /* expr ::= PLUS|MINUS expr */
119392 - yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yy…
119393 + yymsp[-4].minor.yy122 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy122,yymsp[0].minor.yy122);
119394 + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy122, yymsp[-4].minor.yy122, TK_NOTNULL);
119399 +{yymsp[-1].minor.yy122 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy122, 0);/*A-overwr…
119403 + yymsp[-1].minor.yy122 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yy…
119404 /*A-overwrites-B*/
119407 - case 207: /* between_op ::= BETWEEN */
119408 - case 210: /* in_op ::= IN */ yytestcase(yyruleno==210);
119409 -{yymsp[0].minor.yy332 = 0;}
119412 + ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy122);
119414 + yylhsminor.yy122 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
119416 + yymsp[-2].minor.yy122 = yylhsminor.yy122;
119422 - case 209: /* expr ::= expr between_op expr AND expr */
119425 - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
119426 - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454);
119427 - yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0);
119428 - if( yymsp[-4].minor.yy454 ){
119429 - yymsp[-4].minor.yy454->x.pList = pList;
119430 + ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy122);
119432 + yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy122, 0);
119433 + if( yymsp[-4].minor.yy122 ){
119434 + yymsp[-4].minor.yy122->x.pList = pList;
119436 sqlite3ExprListDelete(pParse->db, pList);
119438 - if( yymsp[-3].minor.yy332 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor…
119439 + if( yymsp[-3].minor.yy452 ) yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor…
119442 - case 212: /* expr ::= expr in_op LP exprlist RP */
119445 - if( yymsp[-1].minor.yy368==0 ){
119446 + if( yymsp[-1].minor.yy322==0 ){
119450 @@ -163580,205 +167727,206 @@ static YYACTIONTYPE yy_reduce(
119454 - sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy454);
119455 - yymsp[-4].minor.yy454 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy332 ? "1" : "0…
119456 - }else{
119457 - Expr *pRHS = yymsp[-1].minor.yy368->a[0].pExpr;
119458 - if( yymsp[-1].minor.yy368->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy454-
119459 - yymsp[-1].minor.yy368->a[0].pExpr = 0;
119460 - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy368);
119461 + sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy122);
119462 + yymsp[-4].minor.yy122 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy452 ? "true" : …
119463 + if( yymsp[-4].minor.yy122 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy122);
119465 + Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr;
119466 + if( yymsp[-1].minor.yy322->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy122-
119467 + yymsp[-1].minor.yy322->a[0].pExpr = 0;
119468 + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
119470 - yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy454, pRHS);
119471 + yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy122, pRHS);
119473 - yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
119474 - if( yymsp[-4].minor.yy454==0 ){
119475 - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy368);
119476 - }else if( yymsp[-4].minor.yy454->pLeft->op==TK_VECTOR ){
119477 - int nExpr = yymsp[-4].minor.yy454->pLeft->x.pList->nExpr;
119478 - Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy368);
119479 + yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy122, 0);
119480 + if( yymsp[-4].minor.yy122==0 ){
119481 + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322);
119482 + }else if( yymsp[-4].minor.yy122->pLeft->op==TK_VECTOR ){
119483 + int nExpr = yymsp[-4].minor.yy122->pLeft->x.pList->nExpr;
119484 + Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy322);
119487 - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelectRHS);
119488 + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy122, pSelectRHS);
119491 - yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy368;
119492 - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
119493 + yymsp[-4].minor.yy122->x.pList = yymsp[-1].minor.yy322;
119494 + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy122);
119497 - if( yymsp[-3].minor.yy332 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].m…
119498 + if( yymsp[-3].minor.yy452 ) yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].m…
119502 - case 213: /* expr ::= LP select RP */
119505 - yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
119506 - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy454, yymsp[-1].minor.yy433);
119507 + yymsp[-2].minor.yy122 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
119508 + sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy122, yymsp[-1].minor.yy279);
119511 - case 214: /* expr ::= expr in_op LP select RP */
119514 - yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
119515 - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, yymsp[-1].minor.yy433);
119516 - if( yymsp[-3].minor.yy332 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].min…
119517 + yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy122, 0);
119518 + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy122, yymsp[-1].minor.yy279);
119519 + if( yymsp[-3].minor.yy452 ) yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].min…
119522 - case 215: /* expr ::= expr in_op nm dbnm paren_exprlist */
119525 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
119527 - if( yymsp[0].minor.yy368 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.…
119528 - yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0);
119529 - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelect);
119530 - if( yymsp[-3].minor.yy332 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].min…
119532 + yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy122, 0);
119533 + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy122, pSelect);
119534 + if( yymsp[-3].minor.yy452 ) yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].min…
119537 - case 216: /* expr ::= EXISTS LP select RP */
119541 - p = yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
119542 - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy433);
119543 + p = yymsp[-3].minor.yy122 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
119544 + sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy279);
119547 - case 217: /* expr ::= CASE case_operand case_exprlist case_else END */
119550 - yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, 0);
119551 - if( yymsp[-4].minor.yy454 ){
119552 - yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy454 ? sqlite3ExprListAppend(pParse,yymsp[-2…
119553 - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454);
119554 + yymsp[-4].minor.yy122 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy122, 0);
119555 + if( yymsp[-4].minor.yy122 ){
119556 … yymsp[-4].minor.yy122->x.pList = yymsp[-1].minor.yy122 ? sqlite3ExprListAppend(pParse,yymsp[-2]…
119557 + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy122);
119559 - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy368);
119560 - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454);
119561 + sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
119562 + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy122);
119566 - case 218: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
119569 - yymsp[-4].minor.yy368 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy368, yymsp[-2].minor.yy45…
119570 - yymsp[-4].minor.yy368 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy368, yymsp[0].minor.yy454…
119571 + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy12…
119572 + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy122…
119575 - case 219: /* case_exprlist ::= WHEN expr THEN expr */
119578 - yymsp[-3].minor.yy368 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454);
119579 - yymsp[-3].minor.yy368 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy368, yymsp[0].minor.yy454…
119580 + yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy122);
119581 + yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy122…
119584 - case 222: /* case_operand ::= expr */
119585 -{yymsp[0].minor.yy454 = yymsp[0].minor.yy454; /*A-overwrites-X*/}
119587 +{yymsp[0].minor.yy122 = yymsp[0].minor.yy122; /*A-overwrites-X*/}
119589 - case 225: /* nexprlist ::= nexprlist COMMA expr */
119590 -{yymsp[-2].minor.yy368 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy368,yymsp[0].minor.yy454);}
119592 +{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy122);}
119594 - case 226: /* nexprlist ::= expr */
119595 -{yymsp[0].minor.yy368 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454); /*A-overwrites-Y*/}
119597 +{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy122); /*A-overwrites-Y*/}
119599 - case 228: /* paren_exprlist ::= LP exprlist RP */
119600 - case 233: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==233);
119601 -{yymsp[-2].minor.yy368 = yymsp[-1].minor.yy368;}
119604 +{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
119606 - case 229: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP wher…
119609 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
119610 - sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy368,…
119611 - &yymsp[-11].minor.yy0, yymsp[0].minor.yy454, SQLITE_SO_ASC, yymsp[-8].minor.…
119612 … sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp…
119613 + &yymsp[-11].minor.yy0, yymsp[0].minor.yy122, SQLITE_SO_ASC, yymsp[-8].minor.…
119614 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
119615 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
119619 - case 230: /* uniqueflag ::= UNIQUE */
119620 - case 272: /* raisetype ::= ABORT */ yytestcase(yyruleno==272);
119621 -{yymsp[0].minor.yy332 = OE_Abort;}
119626 - case 231: /* uniqueflag ::= */
119627 -{yymsp[1].minor.yy332 = OE_None;}
119631 - case 234: /* eidlist ::= eidlist COMMA nm collate sortorder */
119634 - yymsp[-4].minor.yy368 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy368, &yymsp[-2].minor.…
119635 + yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.…
119638 - case 235: /* eidlist ::= nm collate sortorder */
119641 - yymsp[-2].minor.yy368 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor…
119642 … yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor…
119645 - case 238: /* cmd ::= DROP INDEX ifexists fullname */
119646 -{sqlite3DropIndex(pParse, yymsp[0].minor.yy155, yymsp[-1].minor.yy332);}
119648 +{sqlite3DropIndex(pParse, yymsp[0].minor.yy247, yymsp[-1].minor.yy452);}
119650 - case 239: /* cmd ::= VACUUM vinto */
119651 -{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy454);}
119655 - case 240: /* cmd ::= VACUUM nm vinto */
119656 -{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy454);}
119658 +{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy122);}
119660 - case 243: /* cmd ::= PRAGMA nm dbnm */
119662 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
119664 - case 244: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
119666 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
119668 - case 245: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
119670 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
119672 - case 246: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
119674 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
119676 - case 247: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
119678 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
119680 - case 250: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
119684 all.z = yymsp[-3].minor.yy0.z;
119685 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
119686 - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy387, &all);
119687 + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy207, &all);
119690 - case 251: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON…
119693 - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy332, y…
119694-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy452, yymsp[-4].minor.yy470.a, yymsp[-4].min…
119695 …yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-ove…
119698 - case 252: /* trigger_time ::= BEFORE|AFTER */
119699 -{ yymsp[0].minor.yy332 = yymsp[0].major; /*A-overwrites-X*/ }
119701 +{ yymsp[0].minor.yy452 = yymsp[0].major; /*A-overwrites-X*/ }
119703 - case 253: /* trigger_time ::= INSTEAD OF */
119704 -{ yymsp[-1].minor.yy332 = TK_INSTEAD;}
119706 +{ yymsp[-1].minor.yy452 = TK_INSTEAD;}
119708 - case 254: /* trigger_time ::= */
119709 -{ yymsp[1].minor.yy332 = TK_BEFORE; }
119713 - case 255: /* trigger_event ::= DELETE|INSERT */
119714 - case 256: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==256);
119715 -{yymsp[0].minor.yy96.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy96.b = 0;}
119718 +{yymsp[0].minor.yy470.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy470.b = 0;}
119720 - case 257: /* trigger_event ::= UPDATE OF idlist */
119721 -{yymsp[-2].minor.yy96.a = TK_UPDATE; yymsp[-2].minor.yy96.b = yymsp[0].minor.yy374;}
119723 +{yymsp[-2].minor.yy470.a = TK_UPDATE; yymsp[-2].minor.yy470.b = yymsp[0].minor.yy80;}
119725 - case 258: /* when_clause ::= */
119726 - case 277: /* key_opt ::= */ yytestcase(yyruleno==277);
119727 -{ yymsp[1].minor.yy454 = 0; }
119732 - case 259: /* when_clause ::= WHEN expr */
119733 - case 278: /* key_opt ::= KEY expr */ yytestcase(yyruleno==278);
119734 -{ yymsp[-1].minor.yy454 = yymsp[0].minor.yy454; }
119737 +{ yymsp[-1].minor.yy122 = yymsp[0].minor.yy122; }
119739 - case 260: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
119742 - assert( yymsp[-2].minor.yy387!=0 );
119743 - yymsp[-2].minor.yy387->pLast->pNext = yymsp[-1].minor.yy387;
119744 - yymsp[-2].minor.yy387->pLast = yymsp[-1].minor.yy387;
119745 + assert( yymsp[-2].minor.yy207!=0 );
119746 + yymsp[-2].minor.yy207->pLast->pNext = yymsp[-1].minor.yy207;
119747 + yymsp[-2].minor.yy207->pLast = yymsp[-1].minor.yy207;
119750 - case 261: /* trigger_cmd_list ::= trigger_cmd SEMI */
119753 - assert( yymsp[-1].minor.yy387!=0 );
119754 - yymsp[-1].minor.yy387->pLast = yymsp[-1].minor.yy387;
119755 + assert( yymsp[-1].minor.yy207!=0 );
119756 + yymsp[-1].minor.yy207->pLast = yymsp[-1].minor.yy207;
119759 - case 262: /* trnm ::= nm DOT nm */
119762 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
119764 @@ -163786,211 +167934,212 @@ static YYACTIONTYPE yy_reduce(
119768 - case 263: /* tridxby ::= INDEXED BY nm */
119776 - case 264: /* tridxby ::= NOT INDEXED */
119784 - case 265: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
119785 -{yylhsminor.yy387 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy155, …
119786 - yymsp[-8].minor.yy387 = yylhsminor.yy387;
119788 …tep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy247, yymsp[-3].minor.yy322, yymsp[-1].minor.yy…
119789 + yymsp[-8].minor.yy207 = yylhsminor.yy207;
119791 - case 266: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
119794 - yylhsminor.yy387 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy374,y…
119795-4].minor.yy0,yymsp[-3].minor.yy80,yymsp[-2].minor.yy279,yymsp[-6].minor.yy452,yymsp[-1].minor.yy3…
119797 - yymsp[-7].minor.yy387 = yylhsminor.yy387;
119798 + yymsp[-7].minor.yy207 = yylhsminor.yy207;
119800 - case 267: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
119801 -{yylhsminor.yy387 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy454, …
119802 - yymsp[-5].minor.yy387 = yylhsminor.yy387;
119804 …minor.yy207 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy122, yymsp[
119805 + yymsp[-5].minor.yy207 = yylhsminor.yy207;
119807 - case 268: /* trigger_cmd ::= scanpt select scanpt */
119808 -{yylhsminor.yy387 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy433, yymsp[-2].minor.yy…
119809 - yymsp[-2].minor.yy387 = yylhsminor.yy387;
119811 …gerSelectStep(pParse->db, yymsp[-1].minor.yy279, yymsp[-2].minor.yy116, yymsp[0].minor.yy116); /*y…
119812 + yymsp[-2].minor.yy207 = yylhsminor.yy207;
119814 - case 269: /* expr ::= RAISE LP IGNORE RP */
119817 - yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
119818 - if( yymsp[-3].minor.yy454 ){
119819 - yymsp[-3].minor.yy454->affExpr = OE_Ignore;
119820 + yymsp[-3].minor.yy122 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
119821 + if( yymsp[-3].minor.yy122 ){
119822 + yymsp[-3].minor.yy122->affExpr = OE_Ignore;
119826 - case 270: /* expr ::= RAISE LP raisetype COMMA nm RP */
119829 - yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
119830 - if( yymsp[-5].minor.yy454 ) {
119831 - yymsp[-5].minor.yy454->affExpr = (char)yymsp[-3].minor.yy332;
119832 + yymsp[-5].minor.yy122 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
119833 + if( yymsp[-5].minor.yy122 ) {
119834 + yymsp[-5].minor.yy122->affExpr = (char)yymsp[-3].minor.yy452;
119838 - case 271: /* raisetype ::= ROLLBACK */
119839 -{yymsp[0].minor.yy332 = OE_Rollback;}
119843 - case 273: /* raisetype ::= FAIL */
119844 -{yymsp[0].minor.yy332 = OE_Fail;}
119848 - case 274: /* cmd ::= DROP TRIGGER ifexists fullname */
119851 - sqlite3DropTrigger(pParse,yymsp[0].minor.yy155,yymsp[-1].minor.yy332);
119852 + sqlite3DropTrigger(pParse,yymsp[0].minor.yy247,yymsp[-1].minor.yy452);
119855 - case 275: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
119858 - sqlite3Attach(pParse, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, yymsp[0].minor.yy454);
119859 + sqlite3Attach(pParse, yymsp[-3].minor.yy122, yymsp[-1].minor.yy122, yymsp[0].minor.yy122);
119862 - case 276: /* cmd ::= DETACH database_kw_opt expr */
119865 - sqlite3Detach(pParse, yymsp[0].minor.yy454);
119869 - case 279: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
119872 - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy155,&yymsp[0].minor.yy0);
119873 + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy247,&yymsp[0].minor.yy0);
119876 - case 280: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
119879 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
119880 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
119883 - case 281: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
119886 - sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy155, &yymsp[0].minor.yy0);
119887 + sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy247, &yymsp[0].minor.yy0);
119890 - case 282: /* add_column_fullname ::= fullname */
119894 - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy155);
119898 - case 283: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
119901 - sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy155, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy…
119902 + sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy247, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy…
119905 - case 284: /* cmd ::= create_vtab */
119909 - case 285: /* cmd ::= create_vtab LP vtabarglist RP */
119913 - case 286: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
119916 - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0,…
119917 + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0,…
119920 - case 287: /* vtabarg ::= */
119924 - case 288: /* vtabargtoken ::= ANY */
119925 - case 289: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==289);
119926 - case 290: /* lp ::= LP */ yytestcase(yyruleno==290);
119932 - case 291: /* with ::= WITH wqlist */
119933 - case 292: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==292);
119934 -{ sqlite3WithPush(pParse, yymsp[0].minor.yy23, 1); }
119939 - case 293: /* wqas ::= AS */
119940 -{yymsp[0].minor.yy478 = M10d_Any;}
119944 - case 294: /* wqas ::= AS MATERIALIZED */
119945 -{yymsp[-1].minor.yy478 = M10d_Yes;}
119947 +{yymsp[-1].minor.yy458 = M10d_Yes;}
119949 - case 295: /* wqas ::= AS NOT MATERIALIZED */
119950 -{yymsp[-2].minor.yy478 = M10d_No;}
119952 +{yymsp[-2].minor.yy458 = M10d_No;}
119954 - case 296: /* wqitem ::= nm eidlist_opt wqas LP select RP */
119957 - yymsp[-5].minor.yy259 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy368, yymsp…
119958 …sp[-5].minor.yy559 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].…
119961 - case 297: /* wqlist ::= wqitem */
119964 - yymsp[0].minor.yy23 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy259); /*A-overwrites-X*/
119965 + yymsp[0].minor.yy231 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy559); /*A-overwrites-X*/
119968 - case 298: /* wqlist ::= wqlist COMMA wqitem */
119971 - yymsp[-2].minor.yy23 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy23, yymsp[0].minor.yy259);
119972 + yymsp[-2].minor.yy231 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy231, yymsp[0].minor.yy559);
119976 - /* (299) input ::= cmdlist */ yytestcase(yyruleno==299);
119977 - /* (300) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==300);
119978 - /* (301) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=301);
119979 - /* (302) ecmd ::= SEMI */ yytestcase(yyruleno==302);
119980 - /* (303) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==303);
119981 - /* (304) trans_opt ::= */ yytestcase(yyruleno==304);
119982 - /* (305) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==305);
119983 - /* (306) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==306);
119984 - /* (307) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==307);
119985 - /* (308) savepoint_opt ::= */ yytestcase(yyruleno==308);
119986 - /* (309) cmd ::= create_table create_table_args */ yytestcase(yyruleno==309);
119987 - /* (310) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=310);
119988 - /* (311) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==311);
119989 - /* (312) columnlist ::= columnname carglist */ yytestcase(yyruleno==312);
119990 - /* (313) nm ::= ID|INDEXED */ yytestcase(yyruleno==313);
119991 - /* (314) nm ::= STRING */ yytestcase(yyruleno==314);
119992 - /* (315) nm ::= JOIN_KW */ yytestcase(yyruleno==315);
119993 - /* (316) typetoken ::= typename */ yytestcase(yyruleno==316);
119994 - /* (317) typename ::= ID|STRING */ yytestcase(yyruleno==317);
119995 - /* (318) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=318);
119996 - /* (319) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=319);
119997 - /* (320) carglist ::= carglist ccons */ yytestcase(yyruleno==320);
119998 - /* (321) carglist ::= */ yytestcase(yyruleno==321);
119999 - /* (322) ccons ::= NULL onconf */ yytestcase(yyruleno==322);
120000 - /* (323) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==323);
120001 - /* (324) ccons ::= AS generated */ yytestcase(yyruleno==324);
120002 - /* (325) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==325);
120003 - /* (326) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==326);
120004 - /* (327) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=327);
120005 - /* (328) tconscomma ::= */ yytestcase(yyruleno==328);
120006 - /* (329) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=329);
120007 - /* (330) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=330);
120008 - /* (331) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=331);
120009 - /* (332) oneselect ::= values */ yytestcase(yyruleno==332);
120010 - /* (333) sclp ::= selcollist COMMA */ yytestcase(yyruleno==333);
120011 - /* (334) as ::= ID|STRING */ yytestcase(yyruleno==334);
120012 - /* (335) returning ::= */ yytestcase(yyruleno==335);
120013 - /* (336) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=336);
120014 - /* (337) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==337);
120015 - /* (338) exprlist ::= nexprlist */ yytestcase(yyruleno==338);
120016 - /* (339) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=339);
120017 - /* (340) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=340);
120018 - /* (341) nmnum ::= ON */ yytestcase(yyruleno==341);
120019 - /* (342) nmnum ::= DELETE */ yytestcase(yyruleno==342);
120020 - /* (343) nmnum ::= DEFAULT */ yytestcase(yyruleno==343);
120021 - /* (344) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==344);
120022 - /* (345) foreach_clause ::= */ yytestcase(yyruleno==345);
120023 - /* (346) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==346);
120024 - /* (347) trnm ::= nm */ yytestcase(yyruleno==347);
120025 - /* (348) tridxby ::= */ yytestcase(yyruleno==348);
120026 - /* (349) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==349);
120027 - /* (350) database_kw_opt ::= */ yytestcase(yyruleno==350);
120028 - /* (351) kwcolumn_opt ::= */ yytestcase(yyruleno==351);
120029 - /* (352) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==352);
120030 - /* (353) vtabarglist ::= vtabarg */ yytestcase(yyruleno==353);
120031 - /* (354) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==354);
120032 - /* (355) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==355);
120033 - /* (356) anylist ::= */ yytestcase(yyruleno==356);
120034 - /* (357) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==357);
120035 - /* (358) anylist ::= anylist ANY */ yytestcase(yyruleno==358);
120036 - /* (359) with ::= */ yytestcase(yyruleno==359);
120102 @@ -165077,6 +169226,9 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType…
120104 *tokenType = TK_SPACE; /* IMP: R-22934-25134 */
120112 @@ -165346,13 +169498,9 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenTyp…
120116 -** Run the parser on the given SQL string. The parser structure is
120117 -** passed in. An SQLITE_ status code is returned. If an error occurs
120118 -** then an and attempt is made to write an error message into
120119 -** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that
120120 -** error message.
120123 -SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
120126 void *pEngine; /* The LEMON-generated LALR(1) parser */
120128 @@ -165373,7 +169521,6 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char…
120130 pParse->rc = SQLITE_OK;
120131 pParse->zTail = zSql;
120132 - assert( pzErrMsg!=0 );
120134 if( db->flags & SQLITE_ParserTrace ){
120136 @@ -165403,6 +169550,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char…
120137 mxSqlLen -= n;
120139 pParse->rc = SQLITE_TOOBIG;
120140 + pParse->nErr++;
120144 @@ -165416,6 +169564,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char…
120146 if( AtomicLoad(&db->u1.isInterrupted) ){
120147 pParse->rc = SQLITE_INTERRUPT;
120148 + pParse->nErr++;
120152 @@ -165445,7 +169594,10 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, cha…
120156 - sqlite3ErrorMsg(pParse, "unrecognized token: \"%.*s\"", n, zSql);
120164 @@ -165473,44 +169625,29 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, ch…
120165 if( db->mallocFailed ){
120166 pParse->rc = SQLITE_NOMEM_BKPT;
120168 - if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
120169 - pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));
120170 - }
120171 - assert( pzErrMsg!=0 );
120172 - if( pParse->zErrMsg ){
120173 - *pzErrMsg = pParse->zErrMsg;
120174 - sqlite3_log(pParse->rc, "%s in \"%s\"",
120175 - *pzErrMsg, pParse->zTail);
120176 - pParse->zErrMsg = 0;
120177 + if( pParse->zErrMsg || (pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE) ){
120178 + if( pParse->zErrMsg==0 ){
120179 + pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc));
120181 + sqlite3_log(pParse->rc, "%s in \"%s\"", pParse->zErrMsg, pParse->zTail);
120184 pParse->zTail = zSql;
120185 - if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){
120186 - sqlite3VdbeDelete(pParse->pVdbe);
120187 - pParse->pVdbe = 0;
120188 - }
120189 -#ifndef SQLITE_OMIT_SHARED_CACHE
120190 - if( pParse->nested==0 ){
120191 - sqlite3DbFree(db, pParse->aTableLock);
120192 - pParse->aTableLock = 0;
120193 - pParse->nTableLock = 0;
120194 - }
120195 -#endif
120197 sqlite3_free(pParse->apVtabLock);
120200 - if( !IN_SPECIAL_PARSE ){
120201 + if( pParse->pNewTable && !IN_SPECIAL_PARSE ){
120202 /* If the pParse->declareVtab flag is set, do not delete any table
120203 ** structure built up in pParse->pNewTable. The calling code (see vtab.c)
120206 sqlite3DeleteTable(db, pParse->pNewTable);
120208 - if( !IN_RENAME_OBJECT ){
120209 + if( pParse->pNewTrigger && !IN_RENAME_OBJECT ){
120210 sqlite3DeleteTrigger(db, pParse->pNewTrigger);
120212 - sqlite3DbFree(db, pParse->pVList);
120213 + if( pParse->pVList ) sqlite3DbFreeNN(db, pParse->pVList);
120214 db->pParse = pParentParse;
120215 assert( nErr==0 || pParse->rc!=SQLITE_OK );
120217 @@ -166092,9 +170229,6 @@ SQLITE_PRIVATE int sqlite3Fts2Init(sqlite3*);
120221 -#ifdef SQLITE_ENABLE_JSON1
120222 -SQLITE_PRIVATE int sqlite3Json1Init(sqlite3*);
120223 -#endif
120227 @@ -166129,8 +170263,8 @@ static int (*const sqlite3BuiltinExtensions[])(sqlite3*) = {
120231 -#ifdef SQLITE_ENABLE_JSON1
120232 - sqlite3Json1Init,
120238 @@ -168639,6 +172773,19 @@ SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){
120245 +SQLITE_API int sqlite3_error_offset(sqlite3 *db){
120246 + int iOffset = -1;
120247 + if( db && sqlite3SafetyCheckSickOrOk(db) && db->errCode ){
120248 + sqlite3_mutex_enter(db->mutex);
120249 + iOffset = db->errByteOffset;
120250 + sqlite3_mutex_leave(db->mutex);
120257 ** Return UTF-16 encoded English language explanation of the most recent
120258 @@ -170061,12 +174208,16 @@ SQLITE_API int sqlite3_test_control(int op, ...){
120262 - /* MSVC is picky about pulling func ptrs from va lists.
120263 - ** http://support.microsoft.com/kb/47961
120267 + ** http://support.microsoft.com/kb/47961 <-- dead hyperlink
120268 + ** Search at http://web.archive.org/ to find the 2015-03-16 archive
120272 - typedef int(*TESTCALLBACKFUNC_t)(int);
120273 - sqlite3GlobalConfig.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t);
120279 @@ -170125,6 +174276,28 @@ SQLITE_API int sqlite3_test_control(int op, ...){
120281 assert( /*side-effects-ok*/ (x = va_arg(ap,int))!=0 );
120308 @@ -170193,13 +174366,27 @@ SQLITE_API int sqlite3_test_control(int op, ...){
120312 - /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
120323 - ** If parameter onoff is non-zero, subsequent calls to localtime()
120324 - ** and its variants fail. If onoff is zero, undo this setting.
120326 + ** and return zero on success, or return non-zero on failure.
120339 @@ -170372,8 +174559,8 @@ SQLITE_API int sqlite3_test_control(int op, ...){
120343 - ** op==0 Store the current sqlite3SelectTrace in *ptr
120344 - ** op==1 Set sqlite3SelectTrace to the value *ptr
120350 @@ -170381,14 +174568,36 @@ SQLITE_API int sqlite3_test_control(int op, ...){
120354 - case 0: *ptr = sqlite3SelectTrace; break;
120355 - case 1: sqlite3SelectTrace = *ptr; break;
120356 - case 2: *ptr = sqlite3WhereTrace; break;
120357 - case 3: sqlite3WhereTrace = *ptr; break;
120391 @@ -170599,6 +174808,24 @@ SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbN…
120392 return iDb<0 ? 0 : db->aDb[iDb].pBt;
120396 +** Return the name of the N-th database schema. Return NULL if N is out
120399 +SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N){
120401 + if( !sqlite3SafetyCheckOk(db) ){
120406 + if( N<0 || N>=db->nDb ){
120409 + return db->aDb[N].zDbSName;
120416 @@ -172286,7 +176513,7 @@ struct Fts3MultiSegReader {
120417 int nAdvance; /* How many seg-readers to advance */
120420 - int nBuffer; /* Allocated size of aBuffer[] in bytes */
120425 @@ -172369,7 +176596,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *,…
120429 -SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *);
120434 @@ -172402,6 +176629,12 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int);
120447 @@ -173266,7 +177499,7 @@ static int fts3InitVtab(
120451 - Fts3Hash *pHash = (Fts3Hash *)pAux;
120452 + Fts3Hash *pHash = &((Fts3HashWrapper*)pAux)->hash;
120456 @@ -174976,7 +179209,7 @@ static int fts3TermSelectMerge(
120460 - pTS->aaOutput[0] = sqlite3_malloc(nDoclist + FTS3_VARINT_MAX + 1);
120461 + pTS->aaOutput[0] = sqlite3_malloc64((i64)nDoclist + FTS3_VARINT_MAX + 1);
120462 pTS->anOutput[0] = nDoclist;
120463 if( pTS->aaOutput[0] ){
120464 memcpy(pTS->aaOutput[0], aDoclist, nDoclist);
120465 @@ -176101,9 +180334,12 @@ static const sqlite3_module fts3Module = {
120469 - Fts3Hash *pHash = (Fts3Hash *)p;
120470 - sqlite3Fts3HashClear(pHash);
120471 - sqlite3_free(pHash);
120473 + pHash->nRef--;
120474 + if( pHash->nRef<=0 ){
120475 + sqlite3Fts3HashClear(&pHash->hash);
120481 @@ -176133,7 +180369,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(sqlite3_tokenizer_modul…
120483 SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
120485 - Fts3Hash *pHash = 0;
120490 @@ -176161,23 +180397,24 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
120493 /* Allocate and initialize the hash-table used to store tokenizers. */
120494 - pHash = sqlite3_malloc(sizeof(Fts3Hash));
120499 - sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);
120500 + sqlite3Fts3HashInit(&pHash->hash, FTS3_HASH_STRING, 1);
120501 + pHash->nRef = 0;
120504 /* Load the built-in tokenizers into the hash table */
120506 - if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple)
120507 - || sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter)
120508 + if( sqlite3Fts3HashInsert(&pHash->hash, "simple", 7, (void *)pSimple)
120509 + || sqlite3Fts3HashInsert(&pHash->hash, "porter", 7, (void *)pPorter)
120512 - || sqlite3Fts3HashInsert(pHash, "unicode61", 10, (void *)pUnicode)
120513 + || sqlite3Fts3HashInsert(&pHash->hash, "unicode61", 10, (void *)pUnicode)
120516 - || (pIcu && sqlite3Fts3HashInsert(pHash, "icu", 4, (void *)pIcu))
120517 + || (pIcu && sqlite3Fts3HashInsert(&pHash->hash, "icu", 4, (void *)pIcu))
120521 @@ -176186,7 +180423,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
120525 - rc = sqlite3Fts3ExprInitTestInterface(db, pHash);
120526 + rc = sqlite3Fts3ExprInitTestInterface(db, &pHash->hash);
120530 @@ -176195,23 +180432,26 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
120534 - && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
120535 + && SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
120536 && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
120537 && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
120538 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
120539 && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2))
120540 && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1))
120542 + pHash->nRef++;
120544 db, "fts3", &fts3Module, (void *)pHash, hashDestroy
120547 + pHash->nRef++;
120549 - db, "fts4", &fts3Module, (void *)pHash, 0
120550 + db, "fts4", &fts3Module, (void *)pHash, hashDestroy
120554 - rc = sqlite3Fts3InitTok(db, (void *)pHash);
120555 + pHash->nRef++;
120556 + rc = sqlite3Fts3InitTok(db, (void *)pHash, hashDestroy);
120560 @@ -176220,7 +180460,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
120564 - sqlite3Fts3HashClear(pHash);
120565 + sqlite3Fts3HashClear(&pHash->hash);
120569 @@ -176389,8 +180629,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){
120572 int iPrev = -1; /* Token number of previous deferred token */
120573 -
120574 - assert( pPhrase->doclist.bFreeList==0 );
120575 + char *aFree = (pPhrase->doclist.bFreeList ? pPhrase->doclist.pList : 0);
120577 for(iToken=0; iToken<pPhrase->nToken; iToken++){
120578 Fts3PhraseToken *pToken = &pPhrase->aToken[iToken];
120579 @@ -176404,6 +180643,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){
120584 pPhrase->doclist.pList = 0;
120585 pPhrase->doclist.nList = 0;
120587 @@ -176424,6 +180664,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){
120588 nPoslist = (int)(aOut - aPoslist);
120592 pPhrase->doclist.pList = 0;
120593 pPhrase->doclist.nList = 0;
120595 @@ -176456,13 +180697,14 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase…
120596 nDistance = iPrev - nMaxUndeferred;
120599 - aOut = (char *)sqlite3_malloc(nPoslist+8);
120606 pPhrase->doclist.pList = aOut;
120609 pPhrase->doclist.bFreeList = 1;
120610 pPhrase->doclist.nList = (int)(aOut - pPhrase->doclist.pList);
120611 @@ -176475,6 +180717,7 @@ static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){
120615 + if( pPhrase->doclist.pList!=aFree ) sqlite3_free(aFree);
120619 @@ -176823,7 +181066,7 @@ static int fts3EvalIncrPhraseNext(
120622 int nByte = a[p->nToken-1].nList;
120623 - char *aDoclist = sqlite3_malloc(nByte+FTS3_BUFFER_PADDING);
120626 memcpy(aDoclist, a[p->nToken-1].pList, nByte+1);
120628 @@ -177649,11 +181892,10 @@ static int fts3EvalTestExpr(
120632 - if( pCsr->pDeferred
120633 - && (pExpr->iDocid==pCsr->iPrevId || pExpr->bDeferred)
120634 - ){
120635 + if( pCsr->pDeferred && (pExpr->bDeferred || (
120636 + pExpr->iDocid==pCsr->iPrevId && pExpr->pPhrase->doclist.pList
120638 Fts3Phrase *pPhrase = pExpr->pPhrase;
120639 - assert( pExpr->bDeferred || pPhrase->doclist.bFreeList==0 );
120640 if( pExpr->bDeferred ){
120643 @@ -181060,7 +185302,7 @@ static int porterNext(
120644 if( n>c->nAllocated ){
120646 c->nAllocated = n+20;
120647 - pNew = sqlite3_realloc(c->zToken, c->nAllocated);
120648 + pNew = sqlite3_realloc64(c->zToken, c->nAllocated);
120650 c->zToken = pNew;
120652 @@ -181812,7 +186054,7 @@ static int simpleNext(
120653 if( n>c->nTokenAllocated ){
120655 c->nTokenAllocated = n+20;
120656 - pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated);
120657 + pNew = sqlite3_realloc64(c->pToken, c->nTokenAllocated);
120659 c->pToken = pNew;
120661 @@ -182284,7 +186526,7 @@ static int fts3tokRowidMethod(
120662 ** Register the fts3tok module with database connection db. Return SQLITE_OK
120665 -SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){
120666 +SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash, void(*xDestroy)(void*)){
120670 @@ -182313,7 +186555,9 @@ SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){
120674 - rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash);
120676 + db, "fts3tokenize", &fts3tok_module, (void*)pHash, xDestroy
120681 @@ -182972,7 +187216,7 @@ static int fts3PendingListAppendVarint(
120685 - p = sqlite3_malloc(sizeof(*p) + 100);
120690 @@ -182981,14 +187225,14 @@ static int fts3PendingListAppendVarint(
120691 p->nData = 0;
120693 else if( p->nData+FTS3_VARINT_MAX+1>p->nSpace ){
120694 - int nNew = p->nSpace * 2;
120695 - p = sqlite3_realloc(p, sizeof(*p) + nNew);
120696 + i64 nNew = p->nSpace * 2;
120703 - p->nSpace = nNew;
120704 + p->nSpace = (int)nNew;
120705 p->aData = (char *)&p[1];
120708 @@ -183545,7 +187789,7 @@ SQLITE_PRIVATE int sqlite3Fts3ReadBlock(
120709 int nByte = sqlite3_blob_bytes(p->pSegments);
120712 - char *aByte = sqlite3_malloc(nByte + FTS3_NODE_PADDING);
120717 @@ -183662,7 +187906,7 @@ static int fts3SegReaderNext(
120719 if( (nTerm+1)>pReader->nTermAlloc ){
120720 sqlite3_free(pReader->zTerm);
120721 - pReader->zTerm = (char*)sqlite3_malloc((nTerm+1)*2);
120722 + pReader->zTerm = (char*)sqlite3_malloc64(((i64)nTerm+1)*2);
120723 if( !pReader->zTerm ) return SQLITE_NOMEM;
120724 pReader->nTermAlloc = (nTerm+1)*2;
120726 @@ -183670,7 +187914,7 @@ static int fts3SegReaderNext(
120727 pReader->zTerm[nTerm] = '\0';
120728 pReader->nTerm = nTerm;
120730 - aCopy = (char*)sqlite3_malloc(nCopy);
120733 memcpy(aCopy, pList->aData, nCopy);
120734 pReader->nNode = pReader->nDoclist = nCopy;
120735 @@ -183957,7 +188201,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(
120739 - pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra);
120744 @@ -184049,7 +188293,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderPending(
120748 - aElem2 = (Fts3HashElem **)sqlite3_realloc(
120753 @@ -184383,7 +188627,7 @@ static int fts3NodeAddTerm(
120756 assert( pTree->aData==(char *)&pTree[1] );
120757 - pTree->aData = (char *)sqlite3_malloc(nReq);
120758 + pTree->aData = (char *)sqlite3_malloc64(nReq);
120759 if( !pTree->aData ){
120762 @@ -184401,7 +188645,7 @@ static int fts3NodeAddTerm(
120765 if( pTree->nMalloc<nTerm ){
120766 - char *zNew = sqlite3_realloc(pTree->zMalloc, nTerm*2);
120767 + char *zNew = sqlite3_realloc64(pTree->zMalloc, (i64)nTerm*2);
120771 @@ -184427,7 +188671,7 @@ static int fts3NodeAddTerm(
120775 - pNew = (SegmentNode *)sqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize);
120776 + pNew = (SegmentNode *)sqlite3_malloc64(sizeof(SegmentNode) + p->nNodeSize);
120780 @@ -184565,7 +188809,7 @@ static int fts3SegWriterAdd(
120784 - int nReq; /* Number of bytes required on leaf page */
120789 @@ -184574,13 +188818,13 @@ static int fts3SegWriterAdd(
120793 - pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter));
120800 - pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize);
120801 + pWriter->aData = (char *)sqlite3_malloc64(p->nNodeSize);
120802 if( !pWriter->aData ) return SQLITE_NOMEM;
120803 pWriter->nSize = p->nNodeSize;
120805 @@ -184655,7 +188899,7 @@ static int fts3SegWriterAdd(
120808 if( nReq>pWriter->nSize ){
120809 - char *aNew = sqlite3_realloc(pWriter->aData, nReq);
120810 + char *aNew = sqlite3_realloc64(pWriter->aData, nReq);
120812 pWriter->aData = aNew;
120813 pWriter->nSize = nReq;
120814 @@ -184680,7 +188924,7 @@ static int fts3SegWriterAdd(
120817 if( nTerm>pWriter->nMalloc ){
120818 - char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2);
120819 + char *zNew = sqlite3_realloc64(pWriter->zMalloc, (i64)nTerm*2);
120823 @@ -184988,12 +189232,12 @@ static void fts3ColumnFilter(
120825 Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
120827 - int nList
120830 if( nList>pMsr->nBuffer ){
120832 pMsr->nBuffer = nList*2;
120833 - pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer);
120834 + pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
120836 pMsr->aBuffer = pNew;
120838 @@ -185049,7 +189293,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
120839 fts3SegReaderSort(pMsr->apSegment, nMerge, j, xCmp);
120842 - rc = fts3MsrBufferData(pMsr, pList, nList+1);
120845 assert( (pMsr->aBuffer[nList] & 0xFE)==0x00 );
120846 pList = pMsr->aBuffer;
120847 @@ -185186,11 +189430,11 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){
120851 -static int fts3GrowSegReaderBuffer(Fts3MultiSegReader *pCsr, int nReq){
120853 if( nReq>pCsr->nBuffer ){
120855 pCsr->nBuffer = nReq*2;
120856 - aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer);
120857 + aNew = sqlite3_realloc64(pCsr->aBuffer, pCsr->nBuffer);
120861 @@ -185281,7 +189525,8 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(
120863 pCsr->nDoclist = apSegment[0]->nDoclist;
120865 - rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist, pCsr->nDoclist);
120866 + rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist,
120867 + (i64)pCsr->nDoclist);
120868 pCsr->aDoclist = pCsr->aBuffer;
120870 pCsr->aDoclist = apSegment[0]->aDoclist;
120871 @@ -185334,7 +189579,8 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(
120875 - rc = fts3GrowSegReaderBuffer(pCsr, nByte+nDoclist+FTS3_NODE_PADDING);
120881 @@ -185360,7 +189606,7 @@ SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(
120885 - rc = fts3GrowSegReaderBuffer(pCsr, nDoclist+FTS3_NODE_PADDING);
120888 memset(&pCsr->aBuffer[nDoclist], 0, FTS3_NODE_PADDING);
120889 pCsr->aDoclist = pCsr->aBuffer;
120890 @@ -186073,7 +190319,7 @@ struct NodeReader {
120892 if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){
120894 - char *a = (char *)sqlite3_realloc(pBlob->a, nAlloc);
120895 + char *a = (char *)sqlite3_realloc64(pBlob->a, nAlloc);
120897 pBlob->nAlloc = nAlloc;
120898 pBlob->a = a;
120899 @@ -186222,6 +190468,8 @@ static int fts3IncrmergePush(
120900 pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nPrefix);
120902 pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nSuffix);
120905 memcpy(&pBlk->a[pBlk->n], &zTerm[nPrefix], nSuffix);
120906 pBlk->n += nSuffix;
120908 @@ -186344,6 +190592,7 @@ static int fts3IncrmergeAppend(
120909 pLeaf = &pWriter->aNodeWriter[0];
120910 nPrefix = fts3PrefixCompress(pLeaf->key.a, pLeaf->key.n, zTerm, nTerm);
120911 nSuffix = nTerm - nPrefix;
120916 @@ -186867,7 +191116,7 @@ static int fts3RepackSegdirLevel(
120920 - aNew = sqlite3_realloc(aIdx, nAlloc*sizeof(int));
120925 @@ -187241,7 +191490,7 @@ SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMi…
120929 - pWriter = (IncrmergeWriter *)sqlite3_malloc(nAlloc);
120934 @@ -187877,7 +192126,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferredTokenList(
120938 - pRet = (char *)sqlite3_malloc(p->pList->nData);
120939 + pRet = (char *)sqlite3_malloc64(p->pList->nData);
120942 nSkip = sqlite3Fts3GetVarint(p->pList->aData, &dummy);
120943 @@ -187897,7 +192146,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferToken(
120944 int iCol /* Column that token must appear in (or -1) */
120947 - pDeferred = sqlite3_malloc(sizeof(*pDeferred));
120952 @@ -190672,7 +194921,7 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){
120956 -/************** Begin file json1.c *******************************************/
120959 ** 2015-08-12
120961 @@ -190685,10 +194934,10 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){
120965 -** This SQLite extension implements JSON functions. The interface is
120966 -** modeled after MySQL JSON functions:
120969 -** https://dev.mysql.com/doc/refman/5.7/en/json.html
120975 @@ -190696,48 +194945,8 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){
120979 -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1)
120980 -#if !defined(SQLITEINT_H)
120981 -/* #include "sqlite3ext.h" */
120982 -#endif
120983 -SQLITE_EXTENSION_INIT1
120984 -/* #include <assert.h> */
120985 -/* #include <string.h> */
120986 -/* #include <stdlib.h> */
120987 -/* #include <stdarg.h> */
120988 -
120989 -/* Mark a function parameter as unused, to suppress nuisance compiler
120990 -** warnings. */
120991 -#ifndef UNUSED_PARAM
120992 -# define UNUSED_PARAM(X) (void)(X)
120993 -#endif
120994 -
120995 -#ifndef LARGEST_INT64
120996 -# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32))
120997 -# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64)
120998 -#endif
120999 -
121000 -#ifndef deliberate_fall_through
121001 -# define deliberate_fall_through
121002 -#endif
121003 -
121004 -/*
121005 -** Versions of isspace(), isalnum() and isdigit() to which it is safe
121006 -** to pass signed char values.
121007 -*/
121008 -#ifdef sqlite3Isdigit
121009 - /* Use the SQLite core versions if this routine is part of the
121010 - ** SQLite amalgamation */
121011 -# define safe_isdigit(x) sqlite3Isdigit(x)
121012 -# define safe_isalnum(x) sqlite3Isalnum(x)
121013 -# define safe_isxdigit(x) sqlite3Isxdigit(x)
121014 -#else
121015 - /* Use the standard library for separate compilation */
121016 -#include <ctype.h> /* amalgamator: keep */
121017 -# define safe_isdigit(x) isdigit((unsigned char)(x))
121018 -# define safe_isalnum(x) isalnum((unsigned char)(x))
121019 -# define safe_isxdigit(x) isxdigit((unsigned char)(x))
121020 -#endif
121026 @@ -190762,44 +194971,14 @@ static const char jsonIsSpace[] = {
121030 -#define safe_isspace(x) (jsonIsSpace[(unsigned char)x])
121033 -#ifndef SQLITE_AMALGAMATION
121034 - /* Unsigned integer types. These are already defined in the sqliteInt.h,
121035 - ** but the definitions need to be repeated for separate compilation. */
121036 - typedef sqlite3_uint64 u64;
121037 - typedef unsigned int u32;
121038 - typedef unsigned short int u16;
121039 - typedef unsigned char u8;
121040 -# if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST)
121041 -# define SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS 1
121042 -# endif
121043 -# if defined(SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS)
121044 -# define ALWAYS(X) (1)
121045 -# define NEVER(X) (0)
121046 -# elif !defined(NDEBUG)
121047 -# define ALWAYS(X) ((X)?1:(assert(0),0))
121048 -# define NEVER(X) ((X)?(assert(0),1):0)
121049 -# else
121050 -# define ALWAYS(X) (X)
121051 -# define NEVER(X) (X)
121052 -# endif
121053 -# define testcase(X)
121054 -#endif
121061 -/*
121062 -** Some of the testcase() macros in this file are problematic for gcov
121063 -** in that they generate false-miss errors randomly. This is a gcov problem,
121064 -** not a problem in this case. But to work around it, we disable the
121065 -** problematic test cases for production builds.
121066 -*/
121067 -#define json_testcase(X)
121068 -
121072 @@ -191257,10 +195436,10 @@ static u8 jsonHexToInt(int h){
121076 - assert( safe_isxdigit(z[0]) );
121077 - assert( safe_isxdigit(z[1]) );
121078 - assert( safe_isxdigit(z[2]) );
121079 - assert( safe_isxdigit(z[3]) );
121087 @@ -191495,7 +195674,7 @@ static int jsonParseAddNode(
121091 - for(i=0; i<4; i++) if( !safe_isxdigit(z[i]) ) return 0;
121096 @@ -191514,13 +195693,13 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
121099 const char *z = pParse->zJson;
121100 - while( safe_isspace(z[i]) ){ i++; }
121105 if( iThis<0 ) return -1;
121107 - while( safe_isspace(z[j]) ){ j++; }
121109 if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
121112 @@ -191533,14 +195712,14 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
121113 if( pNode->eType!=JSON_STRING ) return -1;
121114 pNode->jnFlags |= JNODE_LABEL;
121116 - while( safe_isspace(z[j]) ){ j++; }
121118 if( z[j]!=':' ) return -1;
121121 pParse->iDepth--;
121122 if( x<0 ) return -1;
121124 - while( safe_isspace(z[j]) ){ j++; }
121128 if( c!='}' ) return -1;
121129 @@ -191554,7 +195733,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
121130 if( iThis<0 ) return -1;
121131 memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u));
121133 - while( safe_isspace(z[j]) ){ j++; }
121135 if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1;
121137 pParse->iDepth--;
121138 @@ -191563,7 +195742,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
121139 return -1;
121142 - while( safe_isspace(z[j]) ){ j++; }
121146 if( c!=']' ) return -1;
121147 @@ -191600,17 +195779,17 @@ static int jsonParseValue(JsonParse *pParse, u32 i){
121151 - && !safe_isalnum(z[i+4]) ){
121157 - && !safe_isalnum(z[i+4]) ){
121163 - && !safe_isalnum(z[i+5]) ){
121167 }else if( c=='-' || (c>='0' && c<='9') ){
121168 @@ -191681,7 +195860,7 @@ static int jsonParse(
121169 if( pParse->oom ) i = -1;
121171 assert( pParse->iDepth==0 );
121172 - while( safe_isspace(zJson[i]) ) i++;
121174 if( zJson[i] ) i = -1;
121177 @@ -191864,14 +196043,15 @@ static JsonNode *jsonLookupStep(
121186 - }
121187 - if( nKey==0 ){
121188 - *pzErr = zPath;
121189 - return 0;
121197 @@ -191909,7 +196089,7 @@ static JsonNode *jsonLookupStep(
121201 - while( safe_isdigit(zPath[j]) ){
121203 i = i*10 + zPath[j] - '0';
121206 @@ -191930,13 +196110,13 @@ static JsonNode *jsonLookupStep(
121210 - if( zPath[2]=='-' && safe_isdigit(zPath[3]) ){
121211 + if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){
121215 x = x*10 + zPath[j] - '0';
121217 - }while( safe_isdigit(zPath[j]) );
121220 i -= x;
121222 @@ -192155,7 +196335,7 @@ static void jsonTest1Func(
121226 - UNUSED_PARAM(argc);
121231 @@ -192176,7 +196356,7 @@ static void jsonQuoteFunc(
121235 - UNUSED_PARAM(argc);
121240 @@ -192247,13 +196427,34 @@ static void jsonArrayLengthFunc(
121246 +** jsonSetFunc() via the user-data value.
121255 +** "->"(JSON,PATH)
121256 +** "->>"(JSON,PATH)
121270 -** Return the element described by PATH. Return NULL if there is no
121271 -** PATH element. If there are multiple PATHs, then return a JSON array
121272 -** with the result from each path. Throw an error if the JSON or any PATH
121273 -** is malformed.
121279 @@ -192263,35 +196464,77 @@ static void jsonExtractFunc(
121285 - int i;
121290 - jsonInit(&jx, ctx);
121291 - jsonAppendChar(&jx, '[');
121292 - for(i=1; i<argc; i++){
121293 - zPath = (const char*)sqlite3_value_text(argv[i]);
121294 - pNode = jsonLookup(p, zPath, 0, ctx);
121295 - if( p->nErr ) break;
121296 - if( argc>2 ){
121303 + /* The -> and ->> operators accept abbreviated PATH arguments. This
121336 + if( p->nErr==0 && pNode ) jsonReturn(pNode, ctx, 0);
121347 + if( p->nErr ) break;
121354 - }else if( pNode ){
121355 - jsonReturn(pNode, ctx, 0);
121364 - if( argc>2 && i==argc ){
121365 - jsonAppendChar(&jx, ']');
121366 - jsonResult(&jx);
121367 - sqlite3_result_subtype(ctx, JSON_SUBTYPE);
121368 - }
121369 - jsonReset(&jx);
121373 @@ -192307,7 +196550,7 @@ static JsonNode *jsonMergePatch(
121374 if( pPatch->eType!=JSON_OBJECT ){
121377 - assert( iTarget>=0 && iTarget<pParse->nNode );
121378 + assert( iTarget<pParse->nNode );
121379 pTarget = &pParse->aNode[iTarget];
121380 assert( (pPatch->jnFlags & JNODE_APPEND)==0 );
121381 if( pTarget->eType!=JSON_OBJECT ){
121382 @@ -192387,7 +196630,7 @@ static void jsonPatchFunc(
121386 - UNUSED_PARAM(argc);
121391 @@ -192508,7 +196751,7 @@ static void jsonReplaceFunc(
121394 assert( pNode->eU==0 || pNode->eU==1 || pNode->eU==4 );
121395 - json_testcase( pNode->eU!=0 && pNode->eU!=1 );
121396 + testcase( pNode->eU!=0 && pNode->eU!=1 );
121397 pNode->jnFlags |= (u8)JNODE_REPLACE;
121398 VVA( pNode->eU = 4 );
121399 pNode->u.iReplace = i + 1;
121400 @@ -192524,6 +196767,7 @@ replace_err:
121408 @@ -192546,7 +196790,7 @@ static void jsonSetFunc(
121412 - int bIsSet = *(int*)sqlite3_user_data(ctx);
121417 @@ -192565,8 +196809,8 @@ static void jsonSetFunc(
121421 - json_testcase( pNode->eU!=0 && pNode->eU!=1 && pNode->eU!=4 );
121422 - assert( pNode->eU!=3 || pNode->eU!=5 );
121423 + testcase( pNode->eU!=0 && pNode->eU!=1 );
121424 + assert( pNode->eU!=3 && pNode->eU!=5 );
121425 VVA( pNode->eU = 4 );
121426 pNode->jnFlags |= (u8)JNODE_REPLACE;
121427 pNode->u.iReplace = i + 1;
121428 @@ -192586,8 +196830,8 @@ jsonSetDone:
121432 -** Return the top-level "type" of a JSON string. Throw an error if
121433 -** either the JSON or PATH inputs are not well-formed.
121434 +** Return the top-level "type" of a JSON string. json_type() raises an
121435 +** error if either the JSON or PATH inputs are not well-formed.
121439 @@ -192623,7 +196867,7 @@ static void jsonValidFunc(
121443 - UNUSED_PARAM(argc);
121448 @@ -192643,7 +196887,7 @@ static void jsonArrayStep(
121452 - UNUSED_PARAM(argc);
121456 if( pStr->zBuf==0 ){
121457 @@ -192703,8 +196947,8 @@ static void jsonGroupInverse(
121461 - UNUSED_PARAM(argc);
121462 - UNUSED_PARAM(argv);
121467 /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will
121468 @@ -192748,7 +196992,7 @@ static void jsonObjectStep(
121472 - UNUSED_PARAM(argc);
121476 if( pStr->zBuf==0 ){
121477 @@ -192839,10 +197083,10 @@ static int jsonEachConnect(
121481 - UNUSED_PARAM(pzErr);
121482 - UNUSED_PARAM(argv);
121483 - UNUSED_PARAM(argc);
121484 - UNUSED_PARAM(pAux);
121489 rc = sqlite3_declare_vtab(db,
121492 @@ -192865,7 +197109,7 @@ static int jsonEachDisconnect(sqlite3_vtab *pVtab){
121496 - UNUSED_PARAM(p);
121501 @@ -192925,7 +197169,7 @@ static int jsonEachNext(sqlite3_vtab_cursor *cur){
121502 p->eType = pUp->eType;
121503 if( pUp->eType==JSON_ARRAY ){
121504 assert( pUp->eU==0 || pUp->eU==3 );
121505 - json_testcase( pUp->eU==3 );
121506 + testcase( pUp->eU==3 );
121507 VVA( pUp->eU = 3 );
121508 if( iUp==p->i-1 ){
121509 pUp->u.iKey = 0;
121510 @@ -192955,6 +197199,33 @@ static int jsonEachNext(sqlite3_vtab_cursor *cur){
121523 + assert( pNode->eType==JSON_STRING );
121524 + assert( pNode->jnFlags & JNODE_LABEL );
121525 + assert( pNode->eU==1 );
121526 + z = pNode->u.zJContent;
121527 + nn = pNode->n;
121530 + assert( z[nn-1]=='"' );
121532 + for(jj=2; jj<nn-1 && sqlite3Isalnum(z[jj]); jj++){}
121533 + if( jj==nn-1 ){
121535 + nn -= 2;
121544 @@ -192979,10 +197250,7 @@ static void jsonEachComputePath(
121546 assert( pUp->eType==JSON_OBJECT );
121547 if( (pNode->jnFlags & JNODE_LABEL)==0 ) pNode--;
121548 - assert( pNode->eType==JSON_STRING );
121549 - assert( pNode->jnFlags & JNODE_LABEL );
121550 - assert( pNode->eU==1 );
121551 - jsonPrintf(pNode->n+1, pStr, ".%.*s", pNode->n-2, pNode->u.zJContent+1);
121556 @@ -193053,8 +197321,7 @@ static int jsonEachColumn(
121557 if( p->eType==JSON_ARRAY ){
121558 jsonPrintf(30, &x, "[%d]", p->iRowid);
121559 }else if( p->eType==JSON_OBJECT ){
121560 - assert( pThis->eU==1 );
121561 - jsonPrintf(pThis->n, &x, ".%.*s", pThis->n-2, pThis->u.zJContent+1);
121566 @@ -193112,7 +197379,7 @@ static int jsonEachBestIndex(
121570 - UNUSED_PARAM(tab);
121572 aIdx[0] = aIdx[1] = -1;
121573 pConstraint = pIdxInfo->aConstraint;
121574 for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
121575 @@ -193168,8 +197435,8 @@ static int jsonEachFilter(
121579 - UNUSED_PARAM(idxStr);
121580 - UNUSED_PARAM(argc);
121586 @@ -193294,108 +197561,68 @@ static sqlite3_module jsonTreeModule = {
121590 -
121591 -/****************************************************************************
121592 -** The following routines are the only publically visible identifiers in this
121593 -** file. Call the following routines in order to register the various SQL
121594 -** functions and the virtual table implemented by this file.
121595 -****************************************************************************/
121596 -
121597 -SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){
121598 - int rc = SQLITE_OK;
121599 - unsigned int i;
121600 - static const struct {
121601 - const char *zName;
121602 - int nArg;
121603 - int flag;
121604 - void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
121605 - } aFunc[] = {
121606 - { "json", 1, 0, jsonRemoveFunc },
121607 - { "json_array", -1, 0, jsonArrayFunc },
121608 - { "json_array_length", 1, 0, jsonArrayLengthFunc },
121609 - { "json_array_length", 2, 0, jsonArrayLengthFunc },
121610 - { "json_extract", -1, 0, jsonExtractFunc },
121611 - { "json_insert", -1, 0, jsonSetFunc },
121612 - { "json_object", -1, 0, jsonObjectFunc },
121613 - { "json_patch", 2, 0, jsonPatchFunc },
121614 - { "json_quote", 1, 0, jsonQuoteFunc },
121615 - { "json_remove", -1, 0, jsonRemoveFunc },
121616 - { "json_replace", -1, 0, jsonReplaceFunc },
121617 - { "json_set", -1, 1, jsonSetFunc },
121618 - { "json_type", 1, 0, jsonTypeFunc },
121619 - { "json_type", 2, 0, jsonTypeFunc },
121620 - { "json_valid", 1, 0, jsonValidFunc },
121621 -
121631 + JFUNCTION(json_array, -1, 0, jsonArrayFunc),
121634 + JFUNCTION(json_extract, -1, 0, jsonExtractFunc),
121635 + JFUNCTION(->, 2, JSON_JSON, jsonExtractFunc),
121636 + JFUNCTION(->>, 2, JSON_SQL, jsonExtractFunc),
121637 + JFUNCTION(json_insert, -1, 0, jsonSetFunc),
121638 + JFUNCTION(json_object, -1, 0, jsonObjectFunc),
121641 + JFUNCTION(json_remove, -1, 0, jsonRemoveFunc),
121642 + JFUNCTION(json_replace, -1, 0, jsonReplaceFunc),
121643 + JFUNCTION(json_set, -1, JSON_ISSET, jsonSetFunc),
121648 - /* DEBUG and TESTING functions */
121649 - { "json_parse", 1, 0, jsonParseFunc },
121650 - { "json_test1", 1, 0, jsonTest1Func },
121651 -#endif
121668 +** Register the JSON table-valued functions
121670 +SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3 *db){
121673 - const char *zName;
121674 - int nArg;
121675 - void (*xStep)(sqlite3_context*,int,sqlite3_value**);
121676 - void (*xFinal)(sqlite3_context*);
121677 - void (*xValue)(sqlite3_context*);
121678 - } aAgg[] = {
121679 - { "json_group_array", 1,
121680 - jsonArrayStep, jsonArrayFinal, jsonArrayValue },
121681 - { "json_group_object", 2,
121682 - jsonObjectStep, jsonObjectFinal, jsonObjectValue },
121683 - };
121684 -#ifndef SQLITE_OMIT_VIRTUALTABLE
121685 - static const struct {
121686 - const char *zName;
121687 - sqlite3_module *pModule;
121694 -#endif
121695 - static const int enc =
121696 - SQLITE_UTF8 |
121697 - SQLITE_DETERMINISTIC |
121698 - SQLITE_INNOCUOUS;
121699 - for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
121700 - rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, enc,
121701 - (void*)&aFunc[i].flag,
121702 - aFunc[i].xFunc, 0, 0);
121703 - }
121704 -#ifndef SQLITE_OMIT_WINDOWFUNC
121705 - for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){
121706 - rc = sqlite3_create_window_function(db, aAgg[i].zName, aAgg[i].nArg,
121707 - SQLITE_SUBTYPE | enc, 0,
121708 - aAgg[i].xStep, aAgg[i].xFinal,
121709 - aAgg[i].xValue, jsonGroupInverse, 0);
121710 - }
121711 -#endif
121712 -#ifndef SQLITE_OMIT_VIRTUALTABLE
121715 rc = sqlite3_create_module(db, aMod[i].zName, aMod[i].pModule, 0);
121717 -#endif
121722 -
121723 -#ifndef SQLITE_CORE
121724 -#ifdef _WIN32
121725 -__declspec(dllexport)
121726 -#endif
121727 -SQLITE_API int sqlite3_json_init(
121728 - sqlite3 *db,
121729 - char **pzErrMsg,
121730 - const sqlite3_api_routines *pApi
121731 -){
121732 - SQLITE_EXTENSION_INIT2(pApi);
121733 - (void)pzErrMsg; /* Unused parameter */
121734 - return sqlite3Json1Init(db);
121735 -}
121736 -#endif
121737 -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1) */
121738 -
121739 -/************** End of json1.c ***********************************************/
121744 @@ -197829,11 +202056,7 @@ static void rtreecheck(
121748 -#ifndef JSON_NULL /* The following stuff repeats things found in json1 */
121749 -/*
121750 -** Versions of isspace(), isalnum() and isdigit() to which it is safe
121751 -** to pass signed char values.
121752 -*/
121757 @@ -197848,6 +202071,7 @@ static void rtreecheck(
121765 @@ -197870,7 +202094,7 @@ static const char geopolyIsSpace[] = {
121769 -#define safe_isspace(x) (geopolyIsSpace[(unsigned char)x])
121771 #endif /* JSON NULL - back to original code */
121774 @@ -197959,7 +202183,7 @@ static void geopolySwab32(unsigned char *a){
121776 /* Skip whitespace. Return the next non-whitespace character. */
121778 - while( safe_isspace(p->z[0]) ) p->z++;
121779 + while( fast_isspace(p->z[0]) ) p->z++;
121780 return p->z[0];
121783 @@ -199501,7 +203725,7 @@ static int geopolyUpdate(
121787 - for(jj=1; jj<pRtree->nAux; jj++){
121788 + for(jj=1; jj<nData-2; jj++){
121792 @@ -200104,8 +204328,9 @@ static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **a…
121796 - }else{
121797 - assert(!pExpr);
121804 @@ -202799,7 +207024,7 @@ static char *rbuVacuumTableStart(
121808 -char *rbuVacuumIndexStart(
121813 @@ -207644,6 +211869,7 @@ static int dbpageBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInf…
121815 pIdxInfo->orderByConsumed = 1;
121821 @@ -207821,7 +212047,7 @@ static int dbpageUpdate(
121824 pBt = pTab->db->aDb[iDb].pBt;
121825 - if( pgno<1 || pBt==0 || pgno>(int)sqlite3BtreeLastPage(pBt) ){
121830 @@ -220371,6 +224597,9 @@ static Fts5ExprNearset *sqlite3Fts5ParseNearset(
121832 if( pRet->nPhrase>0 ){
121833 Fts5ExprPhrase *pLast = pRet->apPhrase[pRet->nPhrase-1];
121835 + assert( pParse->apPhrase!=0 );
121836 + assert( pParse->nPhrase>=2 );
121837 assert( pLast==pParse->apPhrase[pParse->nPhrase-2] );
121838 if( pPhrase->nTerm==0 ){
121840 @@ -222670,7 +226899,7 @@ struct Fts5Index {
121844 - sqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=? */
121849 @@ -227939,7 +232168,7 @@ static int sqlite3Fts5IndexQuery(
121850 if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
121853 - if( nToken ) memcpy(&buf.p[1], pToken, nToken);
121858 @@ -229998,7 +234227,7 @@ static int fts5SorterNext(Fts5Cursor *pCsr){
121859 rc = sqlite3_step(pSorter->pStmt);
121862 - CsrFlagSet(pCsr, FTS5CSR_EOF);
121867 @@ -231987,7 +236216,7 @@ static void fts5SourceIdFunc(
121871 - sqlite3_result_text(pCtx, "fts5: 2021-12-30 15:30:28 378629bf2ea546f73eee84063c5358439a12f7300e4…
121872 …ite3_result_text(pCtx, "fts5: 2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c…
121876 @@ -236658,6 +240887,16 @@ SQLITE_EXTENSION_INIT1
121893 @@ -236675,8 +240914,7 @@ typedef struct stmt_cursor stmt_cursor;
121895 sqlite3_vtab_cursor base; /* Base class - must be first */
121896 sqlite3 *db; /* Database connection for this cursor */
121897 - sqlite3_stmt *pStmt; /* Statement cursor is currently pointing at */
121898 - sqlite3_int64 iRowid; /* The rowid */
121903 @@ -236720,7 +240958,7 @@ static int stmtConnect(
121907 - pNew = sqlite3_malloc( sizeof(*pNew) );
121912 @@ -236742,7 +240980,7 @@ static int stmtDisconnect(sqlite3_vtab *pVtab){
121916 - pCur = sqlite3_malloc( sizeof(*pCur) );
121920 pCur->db = ((stmt_vtab*)p)->db;
121921 @@ -236750,10 +240988,21 @@ static int stmtOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
121928 + for(pRow=pCur->pRow; pRow; pRow=pNext){
121929 + pNext = pRow->pNext;
121932 + pCur->pRow = 0;
121943 @@ -236764,8 +241013,9 @@ static int stmtClose(sqlite3_vtab_cursor *cur){
121947 - pCur->iRowid++;
121948 - pCur->pStmt = sqlite3_next_stmt(pCur->db, pCur->pStmt);
121949 + StmtRow *pNext = pCur->pRow->pNext;
121950 + sqlite3_free(pCur->pRow);
121951 + pCur->pRow = pNext;
121955 @@ -236779,39 +241029,11 @@ static int stmtColumn(
121959 - switch( i ){
121960 - case STMT_COLUMN_SQL: {
121961 - sqlite3_result_text(ctx, sqlite3_sql(pCur->pStmt), -1, SQLITE_TRANSIENT);
121962 - break;
121963 - }
121964 - case STMT_COLUMN_NCOL: {
121965 - sqlite3_result_int(ctx, sqlite3_column_count(pCur->pStmt));
121966 - break;
121967 - }
121968 - case STMT_COLUMN_RO: {
121969 - sqlite3_result_int(ctx, sqlite3_stmt_readonly(pCur->pStmt));
121970 - break;
121971 - }
121972 - case STMT_COLUMN_BUSY: {
121973 - sqlite3_result_int(ctx, sqlite3_stmt_busy(pCur->pStmt));
121974 - break;
121975 - }
121976 - default: {
121977 - assert( i==STMT_COLUMN_MEM );
121978 - i = SQLITE_STMTSTATUS_MEMUSED +
121979 - STMT_COLUMN_NSCAN - SQLITE_STMTSTATUS_FULLSCAN_STEP;
121980 - /* Fall thru */
121981 - }
121982 - case STMT_COLUMN_NSCAN:
121983 - case STMT_COLUMN_NSORT:
121984 - case STMT_COLUMN_NAIDX:
121985 - case STMT_COLUMN_NSTEP:
121986 - case STMT_COLUMN_REPREP:
121987 - case STMT_COLUMN_RUN: {
121988 - sqlite3_result_int(ctx, sqlite3_stmt_status(pCur->pStmt,
121989 - i-STMT_COLUMN_NSCAN+SQLITE_STMTSTATUS_FULLSCAN_STEP, 0));
121990 - break;
121991 - }
121992 + StmtRow *pRow = pCur->pRow;
121994 + sqlite3_result_text(ctx, pRow->zSql, -1, SQLITE_TRANSIENT);
121996 + sqlite3_result_int(ctx, pRow->aCol[i]);
122000 @@ -236822,7 +241044,7 @@ static int stmtColumn(
122004 - *pRowid = pCur->iRowid;
122005 + *pRowid = pCur->pRow->iRowid;
122009 @@ -236832,7 +241054,7 @@ static int stmtRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
122013 - return pCur->pStmt==0;
122014 + return pCur->pRow==0;
122018 @@ -236847,9 +241069,53 @@ static int stmtFilter(
122022 - pCur->pStmt = 0;
122023 - pCur->iRowid = 0;
122024 - return stmtNext(pVtabCursor);
122030 + ppRow = &pCur->pRow;
122031 + for(p=sqlite3_next_stmt(pCur->db, 0); p; p=sqlite3_next_stmt(pCur->db, p)){
122039 + pNew->zSql = (char*)&pNew[1];
122040 + memcpy(pNew->zSql, zSql, nSql);
122042 + pNew->aCol[STMT_COLUMN_NCOL] = sqlite3_column_count(p);
122043 + pNew->aCol[STMT_COLUMN_RO] = sqlite3_stmt_readonly(p);
122044 + pNew->aCol[STMT_COLUMN_BUSY] = sqlite3_stmt_busy(p);
122045 + pNew->aCol[STMT_COLUMN_NSCAN] = sqlite3_stmt_status(
122048 + pNew->aCol[STMT_COLUMN_NSORT] = sqlite3_stmt_status(
122051 + pNew->aCol[STMT_COLUMN_NAIDX] = sqlite3_stmt_status(
122054 + pNew->aCol[STMT_COLUMN_NSTEP] = sqlite3_stmt_status(
122057 + pNew->aCol[STMT_COLUMN_REPREP] = sqlite3_stmt_status(
122060 + pNew->aCol[STMT_COLUMN_RUN] = sqlite3_stmt_status(
122063 + pNew->aCol[STMT_COLUMN_MEM] = sqlite3_stmt_status(
122066 + pNew->iRowid = iRowid++;
122068 + ppRow = &pNew->pNext;
122075 diff --git a/src/third_party/sqlite/src/amalgamation/sqlite3.h b/src/third_party/sqlite/src/amalgam…
122077 --- a/src/third_party/sqlite/src/amalgamation/sqlite3.h
122079 @@ -146,9 +146,9 @@ extern "C" {
122083 -#define SQLITE_VERSION "3.37.1"
122084 -#define SQLITE_VERSION_NUMBER 3037001
122085 -#define SQLITE_SOURCE_ID "2021-12-30 15:30:28 378629bf2ea546f73eee84063c5358439a12f7300e433f1…
122088 +#define SQLITE_SOURCE_ID "2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41…
122091 ** CAPI3REF: Run-Time Library Version Numbers
122092 @@ -566,7 +566,7 @@ SQLITE_API int sqlite3_exec(
122096 -#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8))
122101 @@ -3824,13 +3824,14 @@ SQLITE_API void sqlite3_free_filename(char*);
122104 ** change the value of the error code. The error-code preserving
122105 -** interfaces are:
122116 ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
122117 @@ -3845,6 +3846,13 @@ SQLITE_API void sqlite3_free_filename(char*);
122126 +** SQL, then the sqlite3_error_offset() function returns -1.
122131 @@ -3864,6 +3872,7 @@ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
122135 +SQLITE_API int sqlite3_error_offset(sqlite3 *db);
122139 @@ -4275,6 +4284,10 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
122141 ** read-only no-op if the table already exists, but
122150 @@ -4343,6 +4356,8 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
122153 ** implementation of [application-defined SQL functions] are protected.
122159 @@ -4964,6 +4979,10 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
122160 ** even empty strings, are always zero-terminated. ^The return
122161 ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
122170 @@ -4977,7 +4996,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
122171 ** [application-defined SQL functions] or [virtual tables], not within
122172 ** top-level application code.
122174 -** The these routines may attempt to convert the datatype of the result.
122179 @@ -5002,7 +5021,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
122183 -** <tr><td> BLOB <td> TEXT <td> Add a zero terminator if needed
122188 @@ -5574,7 +5593,8 @@ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
122192 -** memory allocation fails.
122198 @@ -6256,6 +6276,28 @@ SQLITE_API int sqlite3_get_autocommit(sqlite3*);
122207 +** for the N-th database on database connection D, or a NULL pointer of N is
122209 +** the "temp" schema. Larger values of N correspond to various ATTACH-ed
122217 +** remember the string long-term should make their own copy. Applications that
122219 +** threads should mutex-protect calls to this API and should make their own
122222 +SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N);
122227 @@ -7122,24 +7164,56 @@ struct sqlite3_index_info {
122231 -** an operator that is part of a constraint term in the wHERE clause of
122234 -*/
122235 -#define SQLITE_INDEX_CONSTRAINT_EQ 2
122236 -#define SQLITE_INDEX_CONSTRAINT_GT 4
122237 -#define SQLITE_INDEX_CONSTRAINT_LE 8
122238 -#define SQLITE_INDEX_CONSTRAINT_LT 16
122239 -#define SQLITE_INDEX_CONSTRAINT_GE 32
122240 -#define SQLITE_INDEX_CONSTRAINT_MATCH 64
122241 -#define SQLITE_INDEX_CONSTRAINT_LIKE 65
122242 -#define SQLITE_INDEX_CONSTRAINT_GLOB 66
122243 -#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
122244 -#define SQLITE_INDEX_CONSTRAINT_NE 68
122245 -#define SQLITE_INDEX_CONSTRAINT_ISNOT 69
122246 -#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
122247 -#define SQLITE_INDEX_CONSTRAINT_ISNULL 71
122248 -#define SQLITE_INDEX_CONSTRAINT_IS 72
122249 -#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
122251 +** ^The left-hand operand of the operator is given by the corresponding
122252 +** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand
122255 +** operators have no left-hand operand, and so for those operators the
122264 +** The right-hand operands for each constraint might be accessible using
122265 +** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand
122267 +** in the input SQL. If the right-hand operand is another column or an
122271 +** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand
122276 +** the [sqlite3_vtab_collation()] interface. For most real-world virtual
122301 @@ -7168,7 +7242,7 @@ struct sqlite3_index_info {
122305 -** NULL then no new module is create and any existing modules with the
122310 @@ -7944,7 +8018,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
122314 -#define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
122320 @@ -8467,6 +8542,16 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
122329 +** step was bypassed because a Bloom filter returned not-found. The
122337 @@ -8481,6 +8566,8 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
122346 @@ -9449,19 +9536,276 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);
122353 -** method of a [virtual table].
122368 -** The first argument must be the sqlite3_index_info object that is the
122369 -** first parameter to the xBestIndex() method. The second argument must be
122370 -** an index into the aConstraint[] array belonging to the sqlite3_index_info
122371 -** structure passed to xBestIndex. This function returns a pointer to a buffer
122372 -** containing the name of the collation sequence for the corresponding
122373 -** constraint.
122479 +** on the right-hand side of the IN operator.)^ Thus the virtual table
122480 +** only sees a single value from the right-hand side of the IN operator
122484 +** table to see all values on the right-hand of the IN operator all at
122489 +** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero)
122490 +** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint
122492 +** sqlite3_vtab_in() with -1 in the third argument is a mechanism
122493 +** by which the virtual table can ask SQLite if all-at-once processing
122499 +** the IN operator all-at-once, respectively. ^Thus when the third
122500 +** parameter (F) is non-negative, this interface is the mechanism by
122509 +** (non-zero), that means that the constraint is an IN operator
122510 +** that can be processed all-at-once. ^If the constraint is not an IN
122511 +** operator or cannot be processed all-at-once, then the interface returns
122514 +** ^(All-at-once processing of the IN operator is selected if both of the
122518 +** <li><p> The P->aConstraintUsage[N].argvIndex value is set to a positive
122520 +** use the N-th constraint.
122523 +** non-negative had F>=1.
122527 +** the traditional one-at-a-time processing strategy for the IN constraint.
122528 +** ^If both conditions are true, then the argvIndex-th parameter to the
122531 +** [sqlite3_vtab_in_next()] to find all values on the right-hand side
122537 +** CAPI3REF: Find all elements on the right-hand side of an IN constraint.
122547 +** a parameter that was previously selected for all-at-once IN constraint
122550 +** an xFilter argument that was selected for all-at-once IN constraint
122554 +** ^(Use these routines to access all values on the right-hand side
122596 +** J being a 0-based index into P->aConstraint[], then this routine
122597 +** attempts to set *V to the value of the right-hand operand of
122598 +** that constraint if the right-hand operand is known. ^If the
122599 +** right-hand operand is not known, then *V is set to a NULL pointer.
122602 +** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
122608 +** the right-hand operand of a constraint is a literal value in the original
122609 +** SQL statement. If the right-hand operand is an expression or a reference
122614 +** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such
122623 +** "Right-Hand Side".
122630 diff --git a/src/third_party/sqlite/src/amalgamation_dev/rename_exports.h b/src/third_party/sqlite/…
122632 --- a/src/third_party/sqlite/src/amalgamation_dev/rename_exports.h
122634 @@ -1,4 +1,4 @@
122635 -// Copyright 2018 The Chromium Authors. All rights reserved.
122637 // Use of this source code is governed by a BSD-style license that can be
122640 @@ -7,342 +7,349 @@
122644 -#define sqlite3_activate_cerod chrome_sqlite3_activate_cerod // Lines 6068-6070
122645 -#define sqlite3_aggregate_context chrome_sqlite3_aggregate_context // Line 5629
122646 -#define sqlite3_aggregate_count chrome_sqlite3_aggregate_count // Line 5404
122647 -#define sqlite3_auto_extension chrome_sqlite3_auto_extension // Line 6884
122648 -#define sqlite3_autovacuum_pages chrome_sqlite3_autovacuum_pages // Lines 6476-6481
122649 -#define sqlite3_backup_finish chrome_sqlite3_backup_finish // Line 8918
122650 -#define sqlite3_backup_init chrome_sqlite3_backup_init // Lines 8911-8916
122651 -#define sqlite3_backup_pagecount chrome_sqlite3_backup_pagecount // Line 8920
122652 -#define sqlite3_backup_remaining chrome_sqlite3_backup_remaining // Line 8919
122653 -#define sqlite3_backup_step chrome_sqlite3_backup_step // Line 8917
122654 -#define sqlite3_bind_blob chrome_sqlite3_bind_blob // Line 4510
122655 -#define sqlite3_bind_blob64 chrome_sqlite3_bind_blob64 // Lines 4511-4512
122656 -#define sqlite3_bind_double chrome_sqlite3_bind_double // Line 4513
122657 -#define sqlite3_bind_int chrome_sqlite3_bind_int // Line 4514
122658 -#define sqlite3_bind_int64 chrome_sqlite3_bind_int64 // Line 4515
122659 -#define sqlite3_bind_null chrome_sqlite3_bind_null // Line 4516
122660 -#define sqlite3_bind_parameter_count chrome_sqlite3_bind_parameter_count // Line 4545
122661 -#define sqlite3_bind_parameter_index chrome_sqlite3_bind_parameter_index // Line 4591
122662 -#define sqlite3_bind_parameter_name chrome_sqlite3_bind_parameter_name // Line 4573
122663 -#define sqlite3_bind_pointer chrome_sqlite3_bind_pointer // Line 4522
122664 -#define sqlite3_bind_text chrome_sqlite3_bind_text // Line 4517
122665 -#define sqlite3_bind_text16 chrome_sqlite3_bind_text16 // Line 4518
122666 -#define sqlite3_bind_text64 chrome_sqlite3_bind_text64 // Lines 4519-4520
122667 -#define sqlite3_bind_value chrome_sqlite3_bind_value // Line 4521
122668 -#define sqlite3_bind_zeroblob chrome_sqlite3_bind_zeroblob // Line 4523
122669 -#define sqlite3_bind_zeroblob64 chrome_sqlite3_bind_zeroblob64 // Line 4524
122670 -#define sqlite3_blob_bytes chrome_sqlite3_blob_bytes // Line 7462
122671 -#define sqlite3_blob_close chrome_sqlite3_blob_close // Line 7446
122672 -#define sqlite3_blob_open chrome_sqlite3_blob_open // Lines 7390-7398
122673 -#define sqlite3_blob_read chrome_sqlite3_blob_read // Line 7491
122674 -#define sqlite3_blob_reopen chrome_sqlite3_blob_reopen // Line 7423
122675 -#define sqlite3_blob_write chrome_sqlite3_blob_write // Line 7533
122676 +#define sqlite3_activate_cerod chrome_sqlite3_activate_cerod // Lines 6088-6090
122680 +#define sqlite3_autovacuum_pages chrome_sqlite3_autovacuum_pages // Lines 6518-6523
122682 +#define sqlite3_backup_init chrome_sqlite3_backup_init // Lines 8998-9003
122687 +#define sqlite3_bind_blob64 chrome_sqlite3_bind_blob64 // Lines 4526-4527
122698 +#define sqlite3_bind_text64 chrome_sqlite3_bind_text64 // Lines 4534-4535
122704 +#define sqlite3_blob_open chrome_sqlite3_blob_open // Lines 7464-7472
122710 -#define sqlite3_cancel_auto_extension chrome_sqlite3_cancel_auto_extension // Line 6896
122714 -#define sqlite3_clear_bindings chrome_sqlite3_clear_bindings // Line 4601
122718 -#define sqlite3_collation_needed chrome_sqlite3_collation_needed // Lines 6052-6056
122719 -#define sqlite3_collation_needed16 chrome_sqlite3_collation_needed16 // Lines 6057-6061
122720 -#define sqlite3_column_blob chrome_sqlite3_column_blob // Line 5077
122721 -#define sqlite3_column_bytes chrome_sqlite3_column_bytes // Line 5084
122722 -#define sqlite3_column_bytes16 chrome_sqlite3_column_bytes16 // Line 5085
122723 -#define sqlite3_column_count chrome_sqlite3_column_count // Line 4617
122724 -#define sqlite3_column_database_name chrome_sqlite3_column_database_name // Line 4691
122725 -#define sqlite3_column_database_name16 chrome_sqlite3_column_database_name16 // Line 4692
122726 -#define sqlite3_column_decltype chrome_sqlite3_column_decltype // Line 4728
122727 -#define sqlite3_column_decltype16 chrome_sqlite3_column_decltype16 // Line 4729
122728 -#define sqlite3_column_double chrome_sqlite3_column_double // Line 5078
122729 -#define sqlite3_column_int chrome_sqlite3_column_int // Line 5079
122730 -#define sqlite3_column_int64 chrome_sqlite3_column_int64 // Line 5080
122731 -#define sqlite3_column_name chrome_sqlite3_column_name // Line 4646
122732 -#define sqlite3_column_name16 chrome_sqlite3_column_name16 // Line 4647
122733 -#define sqlite3_column_origin_name chrome_sqlite3_column_origin_name // Line 4695
122734 -#define sqlite3_column_origin_name16 chrome_sqlite3_column_origin_name16 // Line 4696
122735 -#define sqlite3_column_table_name chrome_sqlite3_column_table_name // Line 4693
122736 -#define sqlite3_column_table_name16 chrome_sqlite3_column_table_name16 // Line 4694
122737 -#define sqlite3_column_text chrome_sqlite3_column_text // Line 5081
122738 -#define sqlite3_column_text16 chrome_sqlite3_column_text16 // Line 5082
122739 -#define sqlite3_column_type chrome_sqlite3_column_type // Line 5086
122740 -#define sqlite3_column_value chrome_sqlite3_column_value // Line 5083
122741 -#define sqlite3_commit_hook chrome_sqlite3_commit_hook // Line 6415
122742 +#define sqlite3_collation_needed chrome_sqlite3_collation_needed // Lines 6072-6076
122743 +#define sqlite3_collation_needed16 chrome_sqlite3_collation_needed16 // Lines 6077-6081
122771 -#define sqlite3_context_db_handle chrome_sqlite3_context_db_handle // Line 5656
122772 -#define sqlite3_create_collation chrome_sqlite3_create_collation // Lines 6002-6008
122773 -#define sqlite3_create_collation16 chrome_sqlite3_create_collation16 // Lines 6017-6023
122774 -#define sqlite3_create_collation_v2 chrome_sqlite3_create_collation_v2 // Lines 6009-6016
122776 +#define sqlite3_create_collation chrome_sqlite3_create_collation // Lines 6022-6028
122777 +#define sqlite3_create_collation16 chrome_sqlite3_create_collation16 // Lines 6037-6043
122778 +#define sqlite3_create_collation_v2 chrome_sqlite3_create_collation_v2 // Lines 6029-6036
122779 #define sqlite3_create_filename chrome_sqlite3_create_filename // Lines 3801-3807
122780 -#define sqlite3_create_function chrome_sqlite3_create_function // Lines 5266-5275
122781 -#define sqlite3_create_function16 chrome_sqlite3_create_function16 // Lines 5276-5285
122782 -#define sqlite3_create_function_v2 chrome_sqlite3_create_function_v2 // Lines 5286-5296
122783 -#define sqlite3_create_module chrome_sqlite3_create_module // Lines 7176-7181
122784 -#define sqlite3_create_module_v2 chrome_sqlite3_create_module_v2 // Lines 7182-7188
122785 -#define sqlite3_create_window_function chrome_sqlite3_create_window_function // Lines 5297-5308
122786 -#define sqlite3_data_count chrome_sqlite3_data_count // Line 4834
122787 -#define sqlite3_data_directory chrome_sqlite3_data_directory // Line 6185
122788 +#define sqlite3_create_function chrome_sqlite3_create_function // Lines 5285-5294
122789 +#define sqlite3_create_function16 chrome_sqlite3_create_function16 // Lines 5295-5304
122790 +#define sqlite3_create_function_v2 chrome_sqlite3_create_function_v2 // Lines 5305-5315
122791 +#define sqlite3_create_module chrome_sqlite3_create_module // Lines 7250-7255
122792 +#define sqlite3_create_module_v2 chrome_sqlite3_create_module_v2 // Lines 7256-7262
122793 +#define sqlite3_create_window_function chrome_sqlite3_create_window_function // Lines 5316-5327
122797 -#define sqlite3_db_cacheflush chrome_sqlite3_db_cacheflush // Line 9617
122800 -#define sqlite3_db_filename chrome_sqlite3_db_filename // Line 6289
122801 -#define sqlite3_db_handle chrome_sqlite3_db_handle // Line 6257
122802 -#define sqlite3_db_mutex chrome_sqlite3_db_mutex // Line 7841
122803 -#define sqlite3_db_readonly chrome_sqlite3_db_readonly // Line 6299
122804 -#define sqlite3_db_release_memory chrome_sqlite3_db_release_memory // Line 6608
122805 -#define sqlite3_db_status chrome_sqlite3_db_status // Line 8268
122806 -#define sqlite3_declare_vtab chrome_sqlite3_declare_vtab // Line 7262
122807 -#define sqlite3_deserialize chrome_sqlite3_deserialize // Lines 10027-10034
122808 -#define sqlite3_drop_modules chrome_sqlite3_drop_modules // Lines 7202-7205
122809 -#define sqlite3_enable_load_extension chrome_sqlite3_enable_load_extension // Line 6846
122810 -#define sqlite3_enable_shared_cache chrome_sqlite3_enable_shared_cache // Line 6578
122811 -#define sqlite3_errcode chrome_sqlite3_errcode // Line 3862
122812 -#define sqlite3_errmsg chrome_sqlite3_errmsg // Line 3864
122813 -#define sqlite3_errmsg16 chrome_sqlite3_errmsg16 // Line 3865
122814 -#define sqlite3_errstr chrome_sqlite3_errstr // Line 3866
122823 +#define sqlite3_deserialize chrome_sqlite3_deserialize // Lines 10371-10378
122824 +#define sqlite3_drop_modules chrome_sqlite3_drop_modules // Lines 7276-7279
122832 #define sqlite3_exec chrome_sqlite3_exec // Lines 425-431
122833 -#define sqlite3_expanded_sql chrome_sqlite3_expanded_sql // Line 4231
122834 -#define sqlite3_expired chrome_sqlite3_expired // Line 5405
122835 -#define sqlite3_extended_errcode chrome_sqlite3_extended_errcode // Line 3863
122840 -#define sqlite3_file_control chrome_sqlite3_file_control // Line 7884
122845 -#define sqlite3_finalize chrome_sqlite3_finalize // Line 5114
122850 -#define sqlite3_get_autocommit chrome_sqlite3_get_autocommit // Line 6244
122851 -#define sqlite3_get_auxdata chrome_sqlite3_get_auxdata // Line 5715
122854 #define sqlite3_get_table chrome_sqlite3_get_table // Lines 2835-2842
122855 -#define sqlite3_global_recover chrome_sqlite3_global_recover // Line 5407
122856 -#define sqlite3_hard_heap_limit64 chrome_sqlite3_hard_heap_limit64 // Line 6675
122861 -#define sqlite3_keyword_check chrome_sqlite3_keyword_check // Line 7998
122862 -#define sqlite3_keyword_count chrome_sqlite3_keyword_count // Line 7996
122863 -#define sqlite3_keyword_name chrome_sqlite3_keyword_name // Line 7997
122870 -#define sqlite3_limit chrome_sqlite3_limit // Line 3934
122871 -#define sqlite3_load_extension chrome_sqlite3_load_extension // Lines 6814-6819
122872 -#define sqlite3_log chrome_sqlite3_log // Line 9116
122874 +#define sqlite3_load_extension chrome_sqlite3_load_extension // Lines 6856-6861
122878 -#define sqlite3_memory_alarm chrome_sqlite3_memory_alarm // Lines 5409-5410
122879 +#define sqlite3_memory_alarm chrome_sqlite3_memory_alarm // Lines 5428-5429
122884 -#define sqlite3_mutex_alloc chrome_sqlite3_mutex_alloc // Line 7682
122885 -#define sqlite3_mutex_enter chrome_sqlite3_mutex_enter // Line 7684
122886 -#define sqlite3_mutex_free chrome_sqlite3_mutex_free // Line 7683
122887 -#define sqlite3_mutex_held chrome_sqlite3_mutex_held // Line 7796
122888 -#define sqlite3_mutex_leave chrome_sqlite3_mutex_leave // Line 7686
122889 -#define sqlite3_mutex_notheld chrome_sqlite3_mutex_notheld // Line 7797
122890 -#define sqlite3_mutex_try chrome_sqlite3_mutex_try // Line 7685
122891 -#define sqlite3_next_stmt chrome_sqlite3_next_stmt // Line 6366
122892 -#define sqlite3_normalized_sql chrome_sqlite3_normalized_sql // Line 4233
122902 #define sqlite3_open chrome_sqlite3_open // Lines 3620-3623
122903 #define sqlite3_open16 chrome_sqlite3_open16 // Lines 3624-3627
122904 #define sqlite3_open_v2 chrome_sqlite3_open_v2 // Lines 3628-3633
122907 -#define sqlite3_overload_function chrome_sqlite3_overload_function // Line 7281
122908 -#define sqlite3_prepare chrome_sqlite3_prepare // Lines 4144-4150
122909 -#define sqlite3_prepare16 chrome_sqlite3_prepare16 // Lines 4166-4172
122910 -#define sqlite3_prepare16_v2 chrome_sqlite3_prepare16_v2 // Lines 4173-4179
122911 -#define sqlite3_prepare16_v3 chrome_sqlite3_prepare16_v3 // Lines 4180-4187
122912 -#define sqlite3_prepare_v2 chrome_sqlite3_prepare_v2 // Lines 4151-4157
122913 -#define sqlite3_prepare_v3 chrome_sqlite3_prepare_v3 // Lines 4158-4165
122914 -#define sqlite3_preupdate_blobwrite chrome_sqlite3_preupdate_blobwrite // Line 9729
122915 -#define sqlite3_preupdate_count chrome_sqlite3_preupdate_count // Line 9726
122916 -#define sqlite3_preupdate_depth chrome_sqlite3_preupdate_depth // Line 9727
122917 -#define sqlite3_preupdate_hook chrome_sqlite3_preupdate_hook // Lines 9712-9724
122918 -#define sqlite3_preupdate_new chrome_sqlite3_preupdate_new // Line 9728
122919 -#define sqlite3_preupdate_old chrome_sqlite3_preupdate_old // Line 9725
122921 +#define sqlite3_prepare chrome_sqlite3_prepare // Lines 4153-4159
122922 +#define sqlite3_prepare16 chrome_sqlite3_prepare16 // Lines 4175-4181
122923 +#define sqlite3_prepare16_v2 chrome_sqlite3_prepare16_v2 // Lines 4182-4188
122924 +#define sqlite3_prepare16_v3 chrome_sqlite3_prepare16_v3 // Lines 4189-4196
122925 +#define sqlite3_prepare_v2 chrome_sqlite3_prepare_v2 // Lines 4160-4166
122926 +#define sqlite3_prepare_v3 chrome_sqlite3_prepare_v3 // Lines 4167-4174
122930 +#define sqlite3_preupdate_hook chrome_sqlite3_preupdate_hook // Lines 10056-10068
122933 #define sqlite3_profile chrome_sqlite3_profile // Lines 3220-3221
122938 -#define sqlite3_release_memory chrome_sqlite3_release_memory // Line 6594
122939 -#define sqlite3_reset chrome_sqlite3_reset // Line 5141
122940 -#define sqlite3_reset_auto_extension chrome_sqlite3_reset_auto_extension // Line 6904
122941 -#define sqlite3_result_blob chrome_sqlite3_result_blob // Line 5883
122942 -#define sqlite3_result_blob64 chrome_sqlite3_result_blob64 // Lines 5884-5885
122943 -#define sqlite3_result_double chrome_sqlite3_result_double // Line 5886
122944 -#define sqlite3_result_error chrome_sqlite3_result_error // Line 5887
122945 -#define sqlite3_result_error16 chrome_sqlite3_result_error16 // Line 5888
122946 -#define sqlite3_result_error_code chrome_sqlite3_result_error_code // Line 5891
122947 -#define sqlite3_result_error_nomem chrome_sqlite3_result_error_nomem // Line 5890
122948 -#define sqlite3_result_error_toobig chrome_sqlite3_result_error_toobig // Line 5889
122949 -#define sqlite3_result_int chrome_sqlite3_result_int // Line 5892
122950 -#define sqlite3_result_int64 chrome_sqlite3_result_int64 // Line 5893
122951 -#define sqlite3_result_null chrome_sqlite3_result_null // Line 5894
122952 -#define sqlite3_result_pointer chrome_sqlite3_result_pointer // Line 5902
122953 -#define sqlite3_result_subtype chrome_sqlite3_result_subtype // Line 5919
122954 -#define sqlite3_result_text chrome_sqlite3_result_text // Line 5895
122955 -#define sqlite3_result_text16 chrome_sqlite3_result_text16 // Line 5898
122956 -#define sqlite3_result_text16be chrome_sqlite3_result_text16be // Line 5900
122957 -#define sqlite3_result_text16le chrome_sqlite3_result_text16le // Line 5899
122958 -#define sqlite3_result_text64 chrome_sqlite3_result_text64 // Lines 5896-5897
122959 -#define sqlite3_result_value chrome_sqlite3_result_value // Line 5901
122960 -#define sqlite3_result_zeroblob chrome_sqlite3_result_zeroblob // Line 5903
122961 -#define sqlite3_result_zeroblob64 chrome_sqlite3_result_zeroblob64 // Line 5904
122962 -#define sqlite3_rollback_hook chrome_sqlite3_rollback_hook // Line 6416