Fix document leak when selection is created inside the document
https://bugs.webkit.org/show_bug.cgi?id=119122

Reviewed by Andreas Kling.

Source/WebCore: 

Merge https://chromium.googlesource.com/chromium/blink/+/b908cb4c8da93316d787de31c93f2a43de332a10

The bug was caused by FrameSelection::m_previousCaretNode holding onto a Node, leaking its document.
Fixed the bug by explicitly clearing it in FrameSelection::prepareForDestruction.

Test: editing/selection/leak-document-with-selection-inside.html

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::prepareForDestruction):

LayoutTests: 

Added a regression test.

* editing/selection/leak-document-with-selection-inside-expected.txt: Added.
* editing/selection/leak-document-with-selection-inside.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153366 268f45cc-cd09-0410-ab3c-d52691b4dbfc