ferrum icon indicating copy to clipboard operation
ferrum copied to clipboard

Ferrum needs to listen DOM.documentUpdated in order to use NodeId values properly

Open betelgeuse opened this issue 5 years ago • 1 comments

https://chromedevtools.github.io/devtools-protocol/tot/DOM/#event-documentUpdated

Problem

Since ferrum tracks node ids in frontend but does not listen to DOM.documentUpdated it's possible that the following sequence of events happens:

  1. Ferrum::Node has node_id in memory
  2. DOM.documentUpdated happens
  3. calling methods on the node returns information for a new node that has matching id
    1. this would happen because they seem to start again from zero so they are not unique during single session

Fix

Make all Node objects listen to DOM.documentUpdated after which the objects should become stale so that all new commands issued with the node raise an exception.

betelgeuse avatar Jun 05 '20 00:06 betelgeuse

👍 on this, documentation states:

Fired when Document has been totally updated. Node ids are no longer valid.

brutuscat avatar Sep 02 '20 19:09 brutuscat