From c980dbf22c8257376037fa794c8d76b1ca9cc38e Mon Sep 17 00:00:00 2001 From: Philip Pfaffe Date: Thu, 2 Apr 2020 12:22:54 +0200 Subject: [PATCH] Fix a race in the wasmDWARFDebugging experiment A race can occur when enabling the wasmDWARFDebuggin experiment. DebuggerModel instances created before that happens are not associated with a plugin manager. We thus need to catch that particular case when new scripts arrive for an existing DebuggerModel after the experiment is enabled. Change-Id: Iad1fa36c8e8f1a76fae86b1928acd4b38242f009 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2132239 Reviewed-by: Eric Leese Commit-Queue: Philip Pfaffe --- front_end/sdk/DebuggerModel.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front_end/sdk/DebuggerModel.js b/front_end/sdk/DebuggerModel.js index daf0532266..7cd566c204 100644 --- a/front_end/sdk/DebuggerModel.js +++ b/front_end/sdk/DebuggerModel.js @@ -661,7 +661,8 @@ export class DebuggerModel extends SDKModel { this.dispatchEventToListeners(Events.ParsedScriptSource, script); const pluginManager = Bindings.debuggerWorkspaceBinding.getLanguagePluginManager(this); - if (!Root.Runtime.experiments.isEnabled('wasmDWARFDebugging') || !pluginManager.hasPluginForScript(script)) { + if (!Root.Runtime.experiments.isEnabled('wasmDWARFDebugging') || !pluginManager || + !pluginManager.hasPluginForScript(script)) { const sourceMapId = DebuggerModel._sourceMapId(script.executionContextId, script.sourceURL, script.sourceMapURL); if (sourceMapId && !hasSyntaxError) { // Consecutive script evaluations in the same execution context with the same sourceURL