[M137] Wrap Setting.#maybeLogAccess into a try/catch

As we learned the hard way, serializer can throw and if the settings is read sufficiently early, it might prevent DevTools from opening.

Bug: 420384038
Fixed: 422682900 
No-Tree-Checks: true
Change-Id: I6da6377a43ef0b81333972d3ad9494e870e302b8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6621191
Auto-Submit: Danil Somsikov <dsv@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Danil Somsikov <dsv@chromium.org>
(cherry picked from commit a3e58d7359e8a9a9bf18db53b4a32de932ef6895)
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6624262
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
diff --git a/front_end/core/common/Settings.ts b/front_end/core/common/Settings.ts
index 9ff37fc..f9678a6 100644
--- a/front_end/core/common/Settings.ts
+++ b/front_end/core/common/Settings.ts
@@ -441,11 +441,14 @@
   }
 
   #maybeLogAccess(value: V): void {
-    const valueToLog = typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' ?
-        value :
-        this.#serializer?.stringify(value);
-    if (valueToLog !== undefined && this.#logSettingAccess) {
-      void this.#logSettingAccess(this.name, valueToLog);
+    try {
+      const valueToLog = typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' ?
+          value :
+          this.#serializer?.stringify(value);
+      if (valueToLog !== undefined && this.#logSettingAccess) {
+        void this.#logSettingAccess(this.name, valueToLog);
+      }
+    } catch {
     }
   }