From 5511047da1ff2e98785247285290a84d2ac84df3 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 5 Jan 2021 16:03:14 +0000 Subject: [PATCH] Fix changes computation for inspector-stylesheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The inspector-stylesheet is a special virtual file that is used to keep track of any new CSS rules, which can be added by clicking the "New Style Rule" button in the Elements panel. However, the changes computation broke and was no longer showing any changes to this file. The most likely culprit is https://crrev.com/c/2378070 which changed the way errors were handled. The TLDR is that the `baseline` became an empty string, which is falsy. Hence, the diff computation bailed and was not showing any diffs. Instead, we should be explicitly checking of the `baseline` is `null`, since it is legal to perform a diff computation between an empty string and a larger string. R=szuend@chromium.org Fixed: 1152507 Change-Id: I1aa778e7922586a4381cbc1e1e6e543a5ccffdd9 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2610964 Auto-Submit: Tim van der Lippe Reviewed-by: Simon Zünd Commit-Queue: Tim van der Lippe --- front_end/workspace_diff/WorkspaceDiff.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front_end/workspace_diff/WorkspaceDiff.js b/front_end/workspace_diff/WorkspaceDiff.js index 38f656f434..059eb15848 100644 --- a/front_end/workspace_diff/WorkspaceDiff.js +++ b/front_end/workspace_diff/WorkspaceDiff.js @@ -293,7 +293,7 @@ export class UISourceCodeDiff extends Common.ObjectWrapper.ObjectWrapper { } const baseline = await this._originalContent(); - if (!baseline) { + if (baseline === null) { return null; } if (baseline.length > 1024 * 1024) {