<commit_before>From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <<EMAIL>>
Date: Thu, 20 Sep 2018 17:44:38 -0700
Subject: dcheck.patch

This disables some debug checks which currently fail when running the Electron
test suite. In general there should be sustained effort to have all debug checks
enabled. If you want to help, choose one of the diffs below and remove it. Then
build Electron (debug configuration) and make sure all tests pass on the CI
systems. Unfortunately the tests don't always cover the check failures, so it's
good to also run some non-trivial Electron app to verify.

Apart from getting rid of a whole diff, you may also be able to replace one diff
with another which enables at least some of the previously disabled checks. For
example, the checks might be disabled for a whole build target, but actually
only one or two specific checks fail. Then it's better to simply comment out the
failing checks and allow the rest of the target to have them enabled.

Please keep the following lists updated.

The ELECTRON_NO_DCHECK build flag disables debug checks universally.
This patch applies the flag to the following GN targets:

  third_party/blink/renderer/core/loader:loader
  url:url

These files have debug checks explicitly commented out:

  base/memory/weak_ptr.cc
  base/process/kill_win.cc
  components/viz/service/display/program_binding.h
  components/viz/service/display_embedder/server_shared_bitmap_manager.cc
  content/browser/frame_host/navigation_controller_impl.cc
  content/browser/frame_host/render_frame_host_impl.cc
  content/browser/renderer_host/render_widget_host_view_mac.mm
  ppapi/host/ppapi_host.cc
  third_party/blink/renderer/core/dom/node.cc
  third_party/blink/renderer/platform/wtf/text/string_impl.cc
  ui/base/clipboard/clipboard_win.cc

diff --git a/base/logging.h b/base/logging.h
index 08c1f0fc59672b2134c634e081f0c4df4d261b75..7a758ce3ef90145d2b68e07e17f00fc30cfb30a6 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -874,7 +874,7 @@ const LogSeverity LOG_DCHECK = LOG_FATAL;
 
 #else  // !(defined(_PREFAST_) && defined(OS_WIN))
 
-#if DCHECK_IS_ON()
+#if DCHECK_IS_ON() && !defined(ELECTRON_NO_DCHECK)
 
 #define DCHECK(condition)                                           \
   LAZY_STREAM(LOG_STREAM(DCHECK), !ANALYZER_ASSUME_TRUE(condition)) \
diff --git a/base/memory/weak_ptr.cc b/base/memory/weak_ptr.cc
index c993fcb8a13a156c1ba6fc1979d8d18fbedd9059..80a5b708d2597bbda53826dac4175fe9788bf154 100644
--- a/base/memory/weak_ptr.cc
+++ b/base/memory/weak_ptr.cc
@@ -25,8 +25,8 @@ void WeakReference::Flag::Invalidate() {
 }
 
 bool WeakReference::Flag::IsValid() const {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_)
-      << "WeakPtrs must be checked on the same sequenced thread.";
+  // DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_)
+  //     << "WeakPtrs must be checked on the same sequenced thread.";
   return !invalidated_.IsSet();
 }
 
diff --git a/base/process/process_metrics_win.cc b/base/process/process_metrics_win.cc
index 18ef58a725c3a87a30413a4676044533f1751c7c..239f319c8b4cf52c115acd6173a15978f6ff3386 100644
--- a/base/process/process_metrics_win.cc
+++ b/base/process/process_metrics_win.cc
@@ -153,10 +153,9 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
 ProcessMetrics::ProcessMetrics(ProcessHandle process) {
   if (process) {
     HANDLE duplicate_handle = INVALID_HANDLE_VALUE;
-    BOOL result = ::DuplicateHandle(::GetCurrentProcess(), process,
-                                    ::GetCurrentProcess(), &duplicate_handle,
-                                    PROCESS_QUERY_INFORMATION, FALSE, 0);
-    DPCHECK(result);
+    ::DuplicateHandle(::GetCurrentProcess(), process,
+                      ::GetCurrentProcess(), &duplicate_handle,
+                      PROCESS_QUERY_INFORMATION, FALSE, 0);
     process_.Set(duplicate_handle);
   }
 }
diff --git a/components/viz/service/display/program_binding.h b/components/viz/service/display/program_binding.h
index 2a8fb9f5484768f88ec6d383639da2d42fd777fd..2c318b310b2aeb39a1256feb612e19dc0fd53a72 100644
--- a/components/viz/service/display/program_binding.h
+++ b/components/viz/service/display/program_binding.h
@@ -434,7 +434,7 @@ class VIZ_SERVICE_EXPORT Program : public ProgramBindingBase {
     if (!ProgramBindingBase::Init(context_provider->ContextGL(),
                                   vertex_shader_.GetShaderString(),
                                   fragment_shader_.GetShaderString())) {
-      DCHECK(IsContextLost(context_provider->ContextGL()));
+      // DCHECK(IsContextLost(context_provider->ContextGL()));
       return;
     }
 
@@ -446,7 +446,7 @@ class VIZ_SERVICE_EXPORT Program : public ProgramBindingBase {
 
     // Link after binding uniforms
     if (!Link(context_provider->ContextGL())) {
-      DCHECK(IsContextLost(context_provider->ContextGL()));
+      // DCHECK(IsContextLost(context_provider->ContextGL()));
       return;
     }
 
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index d8aca9e2cbffdfd0bbb0bd67e8adfb53547132bb..86224ab7a3c5637422559da25bc8c1040a03e937 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -995,8 +995,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
     return NAVIGATION_TYPE_NEW_SUBFRAME;
   }
 
-  // We only clear the session history when navigating to a new page.
-  DCHECK(!params.history_list_was_cleared);
+  // Electron does its own book keeping of navigation entries and we
+  // expect content to not track any, by clearing history list for
+  // all navigations.
+  // DCHECK(!params.history_list_was_cleared);
 
   if (rfh->GetParent()) {
     // All manual subframes would be did_create_new_entry and handled above, so
@@ -1233,7 +1235,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage(
     new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon();
   }
 
-  DCHECK(!params.history_list_was_cleared || !replace_entry);
+  // Electron does its own book keeping of navigation entries and we
+  // expect content to not track any, by clearing history list for
+  // all navigations.
+  // DCHECK(!params.history_list_was_cleared || !replace_entry);
   // The browser requested to clear the session history when it initiated the
   // navigation. Now we know that the renderer has updated its state accordingly
   // and it is safe to also clear the browser side history.
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 8e5af3e3b9c5b9e5c7a2462600fb2c9582df0c7c..520dcffb53534e76d739cff74ea58d49bdfb682a 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -2416,8 +2416,10 @@ void RenderFrameHostImpl::AllowBindings(int bindings_flags) {
   }
 
   enabled_bindings_ |= bindings_flags;
-  if (GetParent())
-    DCHECK_EQ(GetParent()->GetEnabledBindings(), GetEnabledBindings());
+  // WebUI in sub frames require binding policy while the parent does not,
+  // Fix this when we use OOPIF in Electron.
+  // if (GetParent())
+  //  DCHECK_EQ(GetParent()->GetEnabledBindings(), GetEnabledBindings());
 
   if (render_frame_created_) {
     if (!frame_bindings_control_)
diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc
index 3f80e73535c8b4a2bcff08821e3585306f691c8b..bf40b94ad24c0621cbe093002c3355693219ebc4 100644
--- a/ppapi/host/ppapi_host.cc
+++ b/ppapi/host/ppapi_host.cc
@@ -238,7 +238,7 @@ void PpapiHost::OnHostMsgResourceCreated(
       CreateResourceHost(params.pp_resource(), instance, nested_msg);
 
   if (!resource_host.get()) {
-    NOTREACHED();
+    // NOTREACHED();
     return;
   }
 
diff --git a/third_party/blink/renderer/core/dom/node.cc b/third_party/blink/renderer/core/dom/node.cc
index 5629f8170851f0b58069e2cd0c14ebe093d89d00..bc773ac9b1e462385dcbb8bef2fc4c2d7e6c7b06 100644
--- a/third_party/blink/renderer/core/dom/node.cc
+++ b/third_party/blink/renderer/core/dom/node.cc
@@ -2568,7 +2568,7 @@ StaticNodeList* Node::getDestinationInsertionPoints() {
 
 HTMLSlotElement* Node::AssignedSlot() const {
   // assignedSlot doesn't need to call updateDistribution().
-  DCHECK(!IsPseudoElement());
+  // DCHECK(!IsPseudoElement());
   if (ShadowRoot* root = V1ShadowRootOfParent())
     return root->AssignedSlotFor(*this);
   return nullptr;
diff --git a/third_party/blink/renderer/core/loader/BUILD.gn b/third_party/blink/renderer/core/loader/BUILD.gn
index 49b4ead3dc521796bf3c6a207a072ff5eeff1849..0083e5c8efb71cf2cb097944174dcad8eff1cc3e 100644
--- a/third_party/blink/renderer/core/loader/BUILD.gn
+++ b/third_party/blink/renderer/core/loader/BUILD.gn
@@ -135,4 +135,11 @@ blink_core_sources("loader") {
   public_deps = [
     "//third_party/blink/renderer/platform",
   ]
+
+  if (is_electron_build) {
+    if (!defined(defines)) {
+      defines = []
+    }
+    defines += [ "ELECTRON_NO_DCHECK" ]
+  }
 }
diff --git a/third_party/blink/renderer/platform/wtf/text/string_impl.h b/third_party/blink/renderer/platform/wtf/text/string_impl.h
index 0e7c40b732ec283e006b2e3517c42e699d7e3102..7c513d95a586d8ac80e691aa89abaf49793e9a18 100644
--- a/third_party/blink/renderer/platform/wtf/text/string_impl.h
+++ b/third_party/blink/renderer/platform/wtf/text/string_impl.h
@@ -258,21 +258,21 @@ class WTF_EXPORT StringImpl {
   }
 
   ALWAYS_INLINE bool HasOneRef() const {
-#if DCHECK_IS_ON()
+#if 0
     DCHECK(IsStatic() || verifier_.IsSafeToUse()) << AsciiForDebugging();
 #endif
     return ref_count_ == 1;
   }
 
   ALWAYS_INLINE void AddRef() const {
-#if DCHECK_IS_ON()
+#if 0
     DCHECK(IsStatic() || verifier_.OnRef(ref_count_)) << AsciiForDebugging();
 #endif
     ++ref_count_;
   }
 
   ALWAYS_INLINE void Release() const {
-#if DCHECK_IS_ON()
+#if 0
     DCHECK(IsStatic() || verifier_.OnDeref(ref_count_))
         << AsciiForDebugging() << " " << CurrentThread();
 #endif
diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc
index e49dd8c81270cdd9794ddee11bad036c2f444af5..9e61c901cd2df168520b83a8522ca8c032f4c0ae 100644
--- a/ui/base/clipboard/clipboard_win.cc
+++ b/ui/base/clipboard/clipboard_win.cc
@@ -905,9 +905,9 @@ void ClipboardWin::WriteBitmapFromHandle(HBITMAP source_hbitmap,
 }
 
 void ClipboardWin::WriteToClipboard(unsigned int format, HANDLE handle) {
-  DCHECK(clipboard_owner_->hwnd() != NULL);
+  // DCHECK(clipboard_owner_->hwnd() != NULL);
   if (handle && !::SetClipboardData(format, handle)) {
-    DCHECK(ERROR_CLIPBOARD_NOT_OPEN != GetLastError());
+    // DCHECK(ERROR_CLIPBOARD_NOT_OPEN != GetLastError());
     FreeData(format, handle);
   }
 }
diff --git a/url/BUILD.gn b/url/BUILD.gn
index 57bbe16c15ea442963a53f89b009e2c99c7b090a..07725187c595784d9e5f49d45a8835da78144830 100644
--- a/url/BUILD.gn
+++ b/url/BUILD.gn
@@ -98,6 +98,10 @@ component("url") {
     ]
     deps += [ "//third_party/icu" ]
   }
+
+  if (is_electron_build) {
+    defines += [ "ELECTRON_NO_DCHECK" ]
+  }
 }
 
 if (is_android) {
<commit_msg>chore: restore viz dcheck (#15632)<commit_after>From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <<EMAIL>>
Date: Thu, 20 Sep 2018 17:44:38 -0700
Subject: dcheck.patch

This disables some debug checks which currently fail when running the Electron
test suite. In general there should be sustained effort to have all debug checks
enabled. If you want to help, choose one of the diffs below and remove it. Then
build Electron (debug configuration) and make sure all tests pass on the CI
systems. Unfortunately the tests don't always cover the check failures, so it's
good to also run some non-trivial Electron app to verify.

Apart from getting rid of a whole diff, you may also be able to replace one diff
with another which enables at least some of the previously disabled checks. For
example, the checks might be disabled for a whole build target, but actually
only one or two specific checks fail. Then it's better to simply comment out the
failing checks and allow the rest of the target to have them enabled.

Please keep the following lists updated.

The ELECTRON_NO_DCHECK build flag disables debug checks universally.
This patch applies the flag to the following GN targets:

  third_party/blink/renderer/core/loader:loader
  url:url

These files have debug checks explicitly commented out:

  base/memory/weak_ptr.cc
  base/process/kill_win.cc
  components/viz/service/display/program_binding.h
  components/viz/service/display_embedder/server_shared_bitmap_manager.cc
  content/browser/frame_host/navigation_controller_impl.cc
  content/browser/frame_host/render_frame_host_impl.cc
  content/browser/renderer_host/render_widget_host_view_mac.mm
  ppapi/host/ppapi_host.cc
  third_party/blink/renderer/core/dom/node.cc
  third_party/blink/renderer/platform/wtf/text/string_impl.cc
  ui/base/clipboard/clipboard_win.cc

diff --git a/base/logging.h b/base/logging.h
index 08c1f0fc59672b2134c634e081f0c4df4d261b75..7a758ce3ef90145d2b68e07e17f00fc30cfb30a6 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -874,7 +874,7 @@ const LogSeverity LOG_DCHECK = LOG_FATAL;
 
 #else  // !(defined(_PREFAST_) && defined(OS_WIN))
 
-#if DCHECK_IS_ON()
+#if DCHECK_IS_ON() && !defined(ELECTRON_NO_DCHECK)
 
 #define DCHECK(condition)                                           \
   LAZY_STREAM(LOG_STREAM(DCHECK), !ANALYZER_ASSUME_TRUE(condition)) \
diff --git a/base/memory/weak_ptr.cc b/base/memory/weak_ptr.cc
index c993fcb8a13a156c1ba6fc1979d8d18fbedd9059..80a5b708d2597bbda53826dac4175fe9788bf154 100644
--- a/base/memory/weak_ptr.cc
+++ b/base/memory/weak_ptr.cc
@@ -25,8 +25,8 @@ void WeakReference::Flag::Invalidate() {
 }
 
 bool WeakReference::Flag::IsValid() const {
-  DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_)
-      << "WeakPtrs must be checked on the same sequenced thread.";
+  // DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_)
+  //     << "WeakPtrs must be checked on the same sequenced thread.";
   return !invalidated_.IsSet();
 }
 
diff --git a/base/process/process_metrics_win.cc b/base/process/process_metrics_win.cc
index 18ef58a725c3a87a30413a4676044533f1751c7c..239f319c8b4cf52c115acd6173a15978f6ff3386 100644
--- a/base/process/process_metrics_win.cc
+++ b/base/process/process_metrics_win.cc
@@ -153,10 +153,9 @@ bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
 ProcessMetrics::ProcessMetrics(ProcessHandle process) {
   if (process) {
     HANDLE duplicate_handle = INVALID_HANDLE_VALUE;
-    BOOL result = ::DuplicateHandle(::GetCurrentProcess(), process,
-                                    ::GetCurrentProcess(), &duplicate_handle,
-                                    PROCESS_QUERY_INFORMATION, FALSE, 0);
-    DPCHECK(result);
+    ::DuplicateHandle(::GetCurrentProcess(), process,
+                      ::GetCurrentProcess(), &duplicate_handle,
+                      PROCESS_QUERY_INFORMATION, FALSE, 0);
     process_.Set(duplicate_handle);
   }
 }
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index d8aca9e2cbffdfd0bbb0bd67e8adfb53547132bb..86224ab7a3c5637422559da25bc8c1040a03e937 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -995,8 +995,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation(
     return NAVIGATION_TYPE_NEW_SUBFRAME;
   }
 
-  // We only clear the session history when navigating to a new page.
-  DCHECK(!params.history_list_was_cleared);
+  // Electron does its own book keeping of navigation entries and we
+  // expect content to not track any, by clearing history list for
+  // all navigations.
+  // DCHECK(!params.history_list_was_cleared);
 
   if (rfh->GetParent()) {
     // All manual subframes would be did_create_new_entry and handled above, so
@@ -1233,7 +1235,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage(
     new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon();
   }
 
-  DCHECK(!params.history_list_was_cleared || !replace_entry);
+  // Electron does its own book keeping of navigation entries and we
+  // expect content to not track any, by clearing history list for
+  // all navigations.
+  // DCHECK(!params.history_list_was_cleared || !replace_entry);
   // The browser requested to clear the session history when it initiated the
   // navigation. Now we know that the renderer has updated its state accordingly
   // and it is safe to also clear the browser side history.
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 8e5af3e3b9c5b9e5c7a2462600fb2c9582df0c7c..520dcffb53534e76d739cff74ea58d49bdfb682a 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -2416,8 +2416,10 @@ void RenderFrameHostImpl::AllowBindings(int bindings_flags) {
   }
 
   enabled_bindings_ |= bindings_flags;
-  if (GetParent())
-    DCHECK_EQ(GetParent()->GetEnabledBindings(), GetEnabledBindings());
+  // WebUI in sub frames require binding policy while the parent does not,
+  // Fix this when we use OOPIF in Electron.
+  // if (GetParent())
+  //  DCHECK_EQ(GetParent()->GetEnabledBindings(), GetEnabledBindings());
 
   if (render_frame_created_) {
     if (!frame_bindings_control_)
diff --git a/ppapi/host/ppapi_host.cc b/ppapi/host/ppapi_host.cc
index 3f80e73535c8b4a2bcff08821e3585306f691c8b..bf40b94ad24c0621cbe093002c3355693219ebc4 100644
--- a/ppapi/host/ppapi_host.cc
+++ b/ppapi/host/ppapi_host.cc
@@ -238,7 +238,7 @@ void PpapiHost::OnHostMsgResourceCreated(
       CreateResourceHost(params.pp_resource(), instance, nested_msg);
 
   if (!resource_host.get()) {
-    NOTREACHED();
+    // NOTREACHED();
     return;
   }
 
diff --git a/third_party/blink/renderer/core/dom/node.cc b/third_party/blink/renderer/core/dom/node.cc
index 5629f8170851f0b58069e2cd0c14ebe093d89d00..bc773ac9b1e462385dcbb8bef2fc4c2d7e6c7b06 100644
--- a/third_party/blink/renderer/core/dom/node.cc
+++ b/third_party/blink/renderer/core/dom/node.cc
@@ -2568,7 +2568,7 @@ StaticNodeList* Node::getDestinationInsertionPoints() {
 
 HTMLSlotElement* Node::AssignedSlot() const {
   // assignedSlot doesn't need to call updateDistribution().
-  DCHECK(!IsPseudoElement());
+  // DCHECK(!IsPseudoElement());
   if (ShadowRoot* root = V1ShadowRootOfParent())
     return root->AssignedSlotFor(*this);
   return nullptr;
diff --git a/third_party/blink/renderer/core/loader/BUILD.gn b/third_party/blink/renderer/core/loader/BUILD.gn
index 49b4ead3dc521796bf3c6a207a072ff5eeff1849..0083e5c8efb71cf2cb097944174dcad8eff1cc3e 100644
--- a/third_party/blink/renderer/core/loader/BUILD.gn
+++ b/third_party/blink/renderer/core/loader/BUILD.gn
@@ -135,4 +135,11 @@ blink_core_sources("loader") {
   public_deps = [
     "//third_party/blink/renderer/platform",
   ]
+
+  if (is_electron_build) {
+    if (!defined(defines)) {
+      defines = []
+    }
+    defines += [ "ELECTRON_NO_DCHECK" ]
+  }
 }
diff --git a/third_party/blink/renderer/platform/wtf/text/string_impl.h b/third_party/blink/renderer/platform/wtf/text/string_impl.h
index 0e7c40b732ec283e006b2e3517c42e699d7e3102..7c513d95a586d8ac80e691aa89abaf49793e9a18 100644
--- a/third_party/blink/renderer/platform/wtf/text/string_impl.h
+++ b/third_party/blink/renderer/platform/wtf/text/string_impl.h
@@ -258,21 +258,21 @@ class WTF_EXPORT StringImpl {
   }
 
   ALWAYS_INLINE bool HasOneRef() const {
-#if DCHECK_IS_ON()
+#if 0
     DCHECK(IsStatic() || verifier_.IsSafeToUse()) << AsciiForDebugging();
 #endif
     return ref_count_ == 1;
   }
 
   ALWAYS_INLINE void AddRef() const {
-#if DCHECK_IS_ON()
+#if 0
     DCHECK(IsStatic() || verifier_.OnRef(ref_count_)) << AsciiForDebugging();
 #endif
     ++ref_count_;
   }
 
   ALWAYS_INLINE void Release() const {
-#if DCHECK_IS_ON()
+#if 0
     DCHECK(IsStatic() || verifier_.OnDeref(ref_count_))
         << AsciiForDebugging() << " " << CurrentThread();
 #endif
diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc
index e49dd8c81270cdd9794ddee11bad036c2f444af5..9e61c901cd2df168520b83a8522ca8c032f4c0ae 100644
--- a/ui/base/clipboard/clipboard_win.cc
+++ b/ui/base/clipboard/clipboard_win.cc
@@ -905,9 +905,9 @@ void ClipboardWin::WriteBitmapFromHandle(HBITMAP source_hbitmap,
 }
 
 void ClipboardWin::WriteToClipboard(unsigned int format, HANDLE handle) {
-  DCHECK(clipboard_owner_->hwnd() != NULL);
+  // DCHECK(clipboard_owner_->hwnd() != NULL);
   if (handle && !::SetClipboardData(format, handle)) {
-    DCHECK(ERROR_CLIPBOARD_NOT_OPEN != GetLastError());
+    // DCHECK(ERROR_CLIPBOARD_NOT_OPEN != GetLastError());
     FreeData(format, handle);
   }
 }
diff --git a/url/BUILD.gn b/url/BUILD.gn
index 57bbe16c15ea442963a53f89b009e2c99c7b090a..07725187c595784d9e5f49d45a8835da78144830 100644
--- a/url/BUILD.gn
+++ b/url/BUILD.gn
@@ -98,6 +98,10 @@ component("url") {
     ]
     deps += [ "//third_party/icu" ]
   }
+
+  if (is_electron_build) {
+    defines += [ "ELECTRON_NO_DCHECK" ]
+  }
 }
 
 if (is_android) {

{'fraction_non_alphanumeric': 0.1144301900927053, 'fraction_numerical': 0.07856540874613728, 'mean_word_length': 4.335748188858356, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7540780', 'n_tokens_mistral': 8493, 'n_tokens_neox': 7447, 'n_words': 1407}