If HtmlPage.cloneNode() is used the resulting HtmlPage and the original share almost all references. So modifications to one of the pages may be reflected on the other one. See clone() in HtmlPage and SgmlPage for more detailed info.
One example of the problems that causes is if a page contains a frame and HtmlPage.cloneNode(true) is used.
HtmlPage.notifyNodeAdded() will be called as a result of this on the newly cloned HtmlPage and the frame will be added to frameElements_. But as frameElements_ for both pages is pointing to the same object it now contains the same frame twice.
A test showing this behaviour is attached.
Hi Carsten,
thanks for the test case, it is now part of the test suite. I have done some hotfixes for this but the problem seems to be a more general one.
Hopefully the fix cures your problem.
This issue will stay open until we implement a real solution (maybe with test cases for all clone-ables from the bottom up).