AlexRee / chromedevtools

Automatically exported from code.google.com/p/chromedevtools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

CSS Property Editor Pane - Race Condition #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Chrome 38.0.2125.104 dev tools.

There is a race condition between user entered text and code completion when 
using the CSS property editor pane. On my machine, the code completions are 
returning before '_applyFreeFlowStyleTextEditTimer' fires.

I noticed the issue when adding a new property to an element and after hitting 
'enter' the property was disappearing (extremely frustrating!). Debugging it 
showed that when I was hitting enter an error was being returned from 
'CSS.setPropertyText' saying that the range was not valid.

The range was not valid because the editor pane's internal state thought the 
auto-completed style was applied, when it had been overwritten by the user 
input (which is usually shorter, hence the bad range).

Bug was most likely introduced when the semi=colon part of the CSS style was 
made a fixture instead of part of the auto-completion suffix. You can see there 
is a check for that case @ 
'WebInspector.StylePropertyTreeElement._applyFreeFlowStyleTextEdit' 
(valueText.indexOf(";") === -1). (Sorry I don't have un-minified source ready).

But that check would only protect the internal state, it would not fix the 
actual race condition! Really 100ms for '_applyFreeFlowStyleTextEditTimer' is 
simply too long.

Original issue reported on code.google.com by james.ke...@wishabi.com on 20 Oct 2014 at 6:33

GoogleCodeExporter commented 9 years ago
Oops, this is the wrong project.

Original comment by james.ke...@wishabi.com on 20 Oct 2014 at 6:34

GoogleCodeExporter commented 9 years ago

Original comment by apav...@chromium.org on 21 Oct 2014 at 8:45