Skip to content

Commit

Permalink
ServiceWorker: add crash keys for debugging of IPCs and remove old keys
Browse files Browse the repository at this point in the history
This patch is to check if the process_id() is kInvalidUniqueID or the value
itself is valid. Additionally, I removed several crash keys which was for an
issue which has been fixed.

BUG=668633,619294

Review-Url: https://codereview.chromium.org/2560873004
Cr-Commit-Position: refs/heads/master@{#437432}
  • Loading branch information
makotoshimazu authored and Commit bot committed Dec 9, 2016
1 parent 56a9038 commit 7194546
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 22 deletions.
8 changes: 4 additions & 4 deletions blimp/engine/app/blimp_engine_crash_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ size_t RegisterEngineCrashKeys() {
{ "swdh_register_cannot_scope_url", crash_keys::kLargeSize },
{ "swdh_register_cannot_script_url", crash_keys::kLargeSize },

// Temporary for https://crbug.com/619294.
{ "swdh_unregister_cannot_host_url", crash_keys::kLargeSize },
{ "swdh_unregister_cannot_scope_url", crash_keys::kLargeSize },

// Temporary for https://crbug.com/630496.
{ "swdh_get_registration_cannot_host_url", crash_keys::kLargeSize },
{ "swdh_get_registration_cannot_document_url", crash_keys::kLargeSize },

// Temporary for https://crbug.com/668633.
{ "swdh_set_hosted_version_worker_pid", crash_keys::kSmallSize },
{ "swdh_set_hosted_version_host_pid", crash_keys::kSmallSize },
};

return base::debug::InitCrashKeys(engine_keys, arraysize(engine_keys),
Expand Down
8 changes: 4 additions & 4 deletions chrome/app/chrome_crash_reporter_client_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ size_t RegisterCrashKeysHelper() {
{"swdh_register_cannot_scope_url", crash_keys::kLargeSize},
{"swdh_register_cannot_script_url", crash_keys::kLargeSize},

// Temporary for https://crbug.com/619294.
{"swdh_unregister_cannot_host_url", crash_keys::kLargeSize},
{"swdh_unregister_cannot_scope_url", crash_keys::kLargeSize},

// Temporary for https://crbug.com/630496.
{"swdh_get_registration_cannot_host_url", crash_keys::kLargeSize},
{"swdh_get_registration_cannot_document_url", crash_keys::kLargeSize},

// Temporary for https://crbug.com/668633.
{"swdh_set_hosted_version_worker_pid", crash_keys::kSmallSize},
{"swdh_set_hosted_version_host_pid", crash_keys::kSmallSize},
};

// This dynamic set of keys is used for sets of key value pairs when gathering
Expand Down
8 changes: 4 additions & 4 deletions chrome/common/crash_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ size_t RegisterChromeCrashKeys() {
{ "swdh_register_cannot_scope_url", crash_keys::kLargeSize },
{ "swdh_register_cannot_script_url", crash_keys::kLargeSize },

// Temporary for https://crbug.com/619294.
{ "swdh_unregister_cannot_host_url", crash_keys::kLargeSize },
{ "swdh_unregister_cannot_scope_url", crash_keys::kLargeSize },

// Temporary for https://crbug.com/630496.
{ "swdh_get_registration_cannot_host_url", crash_keys::kLargeSize },
{ "swdh_get_registration_cannot_document_url", crash_keys::kLargeSize },

// Temporary for https://crbug.com/668633.
{ "swdh_set_hosted_version_worker_pid", crash_keys::kSmallSize },
{ "swdh_set_hosted_version_host_pid", crash_keys::kSmallSize },
};

// This dynamic set of keys is used for sets of key value pairs when gathering
Expand Down
7 changes: 3 additions & 4 deletions chromecast/crash/cast_crash_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,13 @@ size_t RegisterCastCrashKeys() {
{ "swdh_register_cannot_scope_url", kLargeSize },
{ "swdh_register_cannot_script_url", kLargeSize },

// Temporary for https://crbug.com/619294.
{ "swdh_unregister_cannot_host_url", kLargeSize },
{ "swdh_unregister_cannot_scope_url", kLargeSize },

// Temporary for https://crbug.com/630496.
{ "swdh_get_registration_cannot_host_url", kLargeSize },
{ "swdh_get_registration_cannot_document_url", kLargeSize },

// Temporary for https://crbug.com/668633.
{ "swdh_set_hosted_version_worker_pid", kSmallSize },
{ "swdh_set_hosted_version_host_pid", kSmallSize },
};

return base::debug::InitCrashKeys(fixed_keys, arraysize(fixed_keys),
Expand Down
14 changes: 8 additions & 6 deletions content/browser/service_worker/service_worker_dispatcher_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/profiler/scoped_tracker.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
Expand Down Expand Up @@ -481,12 +482,6 @@ void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(
std::vector<GURL> urls = {provider_host->document_url(),
registration->pattern()};
if (!ServiceWorkerUtils::AllOriginsMatchAndCanAccessServiceWorkers(urls)) {
// Temporary debugging for https://crbug.com/619294
base::debug::ScopedCrashKey host_url_key(
"swdh_unregister_cannot_host_url",
provider_host->document_url().spec());
base::debug::ScopedCrashKey scope_url_key(
"swdh_unregister_cannot_scope_url", registration->pattern().spec());
bad_message::ReceivedBadMessage(this, bad_message::SWDH_UNREGISTER_CANNOT);
return;
}
Expand Down Expand Up @@ -1081,6 +1076,13 @@ void ServiceWorkerDispatcherHost::OnSetHostedVersionId(int provider_id,

// A process for the worker must be equal to a process for the provider host.
if (version->embedded_worker()->process_id() != provider_host->process_id()) {
// Temporary debugging for https://crbug.com/668633
base::debug::ScopedCrashKey scope_worker_pid(
"swdh_set_hosted_version_worker_pid",
base::IntToString(version->embedded_worker()->process_id()));
base::debug::ScopedCrashKey scope_provider_host_pid(
"swdh_set_hosted_version_host_pid",
base::IntToString(provider_host->process_id()));
bad_message::ReceivedBadMessage(
this, bad_message::SWDH_SET_HOSTED_VERSION_PROCESS_MISMATCH);
return;
Expand Down

0 comments on commit 7194546

Please sign in to comment.