Skip to content
Permalink
Browse files
REGRESSION (250994@main): inspector/css/css-property.html is consiste…
…ntly failing

https://bugs.webkit.org/show_bug.cgi?id=240986
<rdar://problem/94001813>

Reviewed by Patrick Angle.

* Source/WebInspectorUI/UserInterface/Models/CSSProperty.js:
(WI.CSSProperty.prototype._updateName.changeCount):
Don't adjust `WI.CSSProperty._cachedNameCounts` when updating `WI.objectStores.cssPropertyNameCounts`
as the latter will not work in LayoutTests (to avoid having to reset state between tests).

Canonical link: https://commits.webkit.org/251033@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294912 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dcrousso committed May 27, 2022
1 parent 54e5acf commit f0a9930cefa6be13e0129fda734392a190b6c714
Showing 1 changed file with 5 additions and 8 deletions.
@@ -557,22 +557,19 @@ WI.CSSProperty = class CSSProperty extends WI.Object
if (!propertyName || this._implicit || this._anonymous || !this._enabled)
return;

let oldCount = WI.CSSProperty._cachedNameCounts[propertyName];
let cachedCount = WI.CSSProperty._cachedNameCounts[propertyName];

// Allow property counts to be updated if the property name has already been counted before.
// This can happen when inspecting a device that has different CSS properties enabled.
if (isNaN(oldCount) && !WI.cssManager.propertyNameCompletions.isValidPropertyName(propertyName))
if (isNaN(cachedCount) && !WI.cssManager.propertyNameCompletions.isValidPropertyName(propertyName))
return;

console.assert(delta > 0 || oldCount >= delta, oldCount, delta);
let newCount = Math.max(0, (oldCount || 0) + delta);
WI.CSSProperty._cachedNameCounts[propertyName] = newCount;
console.assert(delta > 0 || cachedCount >= delta, cachedCount, delta);
WI.CSSProperty._cachedNameCounts[propertyName] = Math.max(0, (cachedCount || 0) + delta);

WI.objectStores.cssPropertyNameCounts.get(propertyName).then((storedCount) => {
console.assert(delta > 0 || storedCount >= delta, storedCount, delta);
storedCount = Math.max(0, (storedCount || 0) + delta);
WI.CSSProperty._cachedNameCounts[propertyName] = storedCount;
WI.objectStores.cssPropertyNameCounts.put(storedCount, propertyName);
WI.objectStores.cssPropertyNameCounts.put(Math.max(0, (storedCount || 0) + delta), propertyName);
});

if (propertyName !== this.canonicalName)

0 comments on commit f0a9930

Please sign in to comment.