Openlayers 3 using debugger inside pointermove handler crashes chrome

302 views Asked by At

When I set a breakpoint inside a " map.on('pointermove', handler) " handler, using chrome's built in debugger, chrome crashes.

By crash, I mean no future pointermove events are generated, and the pointer styles do not react to any elements of the web page (ex. 'cursor' style over links). Drag navigation stops working.

Is this just something I should avoid doing?

1

There are 1 answers

0
Peter Paul Kiefer On BEST ANSWER

The is neither an error of the browser nor an error of the interpreter (JS). It's expected behaviour.

If you set a breakpoint in an event handler then execution of the handler code is stopped at the breakpoint, i.e. the event is not excuted until you step on with the debugger or resume execution.

Edit

The event handler is running in the event loop thread that performs all event handler of a browser window. If a handler is stopped then, the event loop is paused. But the browser window casts new events if you move the mouse over it for example and then stores them into the event queue. If you resume execution, the next event in the queue will be handled. But the breakpoint is still active. You can resume again but meanwhile there are more and more events stored in the queue. And the next is catched in the breakpoint.

So removing the breakpoint and resume execution is the only thing that could get you out of this trap. Then all events are executed and further events have a chance to be handled too.

I don't know the size of the queue, but if it is full and more events are delivered, the browser could crash. That means the tab/window or the browser itselve will not react anymore.