Menu ▾ ▴

#1573 HtmlPage created with cloneNode shares state with original

Latest SVN
accepted
nobody
None
1
2015-04-17
2014-02-04
Carsten
No

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.

1 Attachments

Discussion

  • RBRi

    RBRi - 2015-04-17
    • status: open --> accepted
    • assigned_to: RBRi
     
  • RBRi

    RBRi - 2015-04-17

    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).

     
  • RBRi

    RBRi - 2015-04-17
    • assigned_to: RBRi --> nobody
     

Log in to post a comment.