summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-08-06 10:13:34 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-02-25 10:43:45 +0100
commit04a3d1fba9abe8f293de2810ce0eaf40b4caed9a (patch)
tree6c775b7fd25c7db8f56dfc7607f963e66e8b0b26
parent1481fddcaf274eacb8a8d83f92973cd87eb9ac44 (diff)
downloadqtwebengine-chromium-04a3d1fba9abe8f293de2810ce0eaf40b4caed9a.tar.gz
Fix crashes with MSVC
In particular don't call virtual functions on objects not yet constructed. Reproducible with tst_QWebEngineUrlRequestInterceptor::jsServiceWorker core auto test in debug mode. Change-Id: Icc627c88ffa758dd787a4dcf02fe237066ef9beb Reviewed-by: Michal Klocek <michal.klocek@qt.io> (cherry picked from commit b0cfc1ca1ac37974ba35dab2177d1853c204a1ce) Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/workers/worker_global_scope.cc9
-rw-r--r--chromium/third_party/perfetto/src/base/file_utils.cc2
-rwxr-xr-xchromium/tools/json_to_struct/json_to_struct.py11
-rw-r--r--chromium/ui/base/clipboard/clipboard.cc3
5 files changed, 17 insertions, 12 deletions
diff --git a/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc b/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc
index afa6deaeaf2..3402204d546 100644
--- a/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc
+++ b/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc
@@ -340,8 +340,8 @@ class SuperPageSnapshot final {
kMinPartitionPageSize);
#else
static constexpr size_t kMinPartitionPageSize = 1 << 14;
- static constexpr size_t kQuarantineBitmapsReservedSize =
- base::bits::AlignUp(2 * sizeof(QuarantineBitmap),
+ static constexpr size_t kStateBitmapMinReservedSize =
+ base::bits::AlignUp(sizeof(AllocationStateMap),
kMinPartitionPageSize);
#endif
// Take into account guard partition page at the end of super-page.
diff --git a/chromium/third_party/blink/renderer/core/workers/worker_global_scope.cc b/chromium/third_party/blink/renderer/core/workers/worker_global_scope.cc
index 04ad96b56e7..4f9acf43f2c 100644
--- a/chromium/third_party/blink/renderer/core/workers/worker_global_scope.cc
+++ b/chromium/third_party/blink/renderer/core/workers/worker_global_scope.cc
@@ -93,8 +93,7 @@ void RemoveURLFromMemoryCacheInternal(const KURL& url) {
}
scoped_refptr<SecurityOrigin> CreateSecurityOrigin(
- GlobalScopeCreationParams* creation_params,
- ExecutionContext* execution_context) {
+ GlobalScopeCreationParams* creation_params) {
// A worker environment settings object's origin must be set as follows:
//
// - DedicatedWorkers and SharedWorkers
@@ -119,8 +118,8 @@ scoped_refptr<SecurityOrigin> CreateSecurityOrigin(
// https://w3c.github.io/ServiceWorker/#start-register
// Step 3: If scriptURL’s scheme is not one of "http" and "https", reject
// promise with a TypeError and abort these steps. [spec text]
- DCHECK(!execution_context->IsServiceWorkerGlobalScope() ||
- !KURL(creation_params->script_url).ProtocolIsData());
+// DCHECK(!execution_context->IsServiceWorkerGlobalScope() ||
+// !KURL(creation_params->script_url).ProtocolIsData());
// TODO(https://crbug.com/1058305) Inherit |agent_cluster_id_| for dedicated
// workers. DO NOT inherit for shared workers and service workers.
@@ -540,7 +539,7 @@ WorkerGlobalScope::WorkerGlobalScope(
base::TimeTicks time_origin)
: WorkerOrWorkletGlobalScope(
thread->GetIsolate(),
- CreateSecurityOrigin(creation_params.get(), GetExecutionContext()),
+ CreateSecurityOrigin(creation_params.get()),
MakeGarbageCollected<Agent>(
thread->GetIsolate(),
(creation_params->agent_cluster_id.is_empty()
diff --git a/chromium/third_party/perfetto/src/base/file_utils.cc b/chromium/third_party/perfetto/src/base/file_utils.cc
index 91a5fc44813..5de51a2ea16 100644
--- a/chromium/third_party/perfetto/src/base/file_utils.cc
+++ b/chromium/third_party/perfetto/src/base/file_utils.cc
@@ -239,7 +239,7 @@ base::Status ListFilesRecursive(const std::string& dir_path,
WIN32_FIND_DATAA ffd;
// Wrap FindClose to: (1) make the return unix-style; (2) deal w/ stdcall.
- static auto find_close = [](HANDLE h) { return FindClose(h) ? 0 : -1; };
+ static constexpr auto find_close = [](HANDLE h) { return FindClose(h) ? 0 : -1; };
base::ScopedResource<HANDLE, find_close, nullptr, false,
base::PlatformHandleChecker>
hFind(FindFirstFileA(glob_path.c_str(), &ffd));
diff --git a/chromium/tools/json_to_struct/json_to_struct.py b/chromium/tools/json_to_struct/json_to_struct.py
index 86d1772b063..3aac4769c91 100755
--- a/chromium/tools/json_to_struct/json_to_struct.py
+++ b/chromium/tools/json_to_struct/json_to_struct.py
@@ -185,9 +185,14 @@ def _GenerateCC(basepath, fileroot, head, namespace, schema, description):
if 'generate_array' in description:
f.write(u'\n')
- f.write(
- u'const %s* const %s[] = {\n' %
- (schema['type_name'], description['generate_array']['array_name']))
+ if len(description['elements']) == 0:
+ f.write(
+ u'const %s* const %s[1] = {\n' %
+ (schema['type_name'], description['generate_array']['array_name']))
+ else:
+ f.write(
+ u'const %s* const %s[] = {\n' %
+ (schema['type_name'], description['generate_array']['array_name']))
for element_name, _ in description['elements'].items():
f.write(u'\t&%s,\n' % element_name)
f.write(u'};\n')
diff --git a/chromium/ui/base/clipboard/clipboard.cc b/chromium/ui/base/clipboard/clipboard.cc
index bf36e5a02b7..fcc799464f5 100644
--- a/chromium/ui/base/clipboard/clipboard.cc
+++ b/chromium/ui/base/clipboard/clipboard.cc
@@ -39,10 +39,11 @@ bool Clipboard::IsSupportedClipboardBuffer(ClipboardBuffer buffer) {
switch (buffer) {
case ClipboardBuffer::kCopyPaste:
return true;
- case ClipboardBuffer::kSelection:
+ case ClipboardBuffer::kSelection: {
// Cache the result to make this function cheap.
static bool selection_result = IsSupportedSelectionClipboard();
return selection_result;
+ }
case ClipboardBuffer::kDrag:
return false;
}