<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213902] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213902">213902</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2017-03-14 10:01:40 -0700 (Tue, 14 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WK2] Data interaction tests occasionally hit assertions in debug builds
https://bugs.webkit.org/show_bug.cgi?id=169002
&lt;rdar://problem/30994806&gt;

Reviewed by Tim Horton.

Source/WebCore:

Data interaction unit tests occasionally fail due to the UI process expecting the latest received EditorState to
contain post layout data, but finding that it does not in -[WKContentView selectedTextRange]. The incomplete
EditorStates in question are sent while performing a data interaction operation, due to transient changes in the
frame selection. The UI process does not need to (and should not) be informed of these selection changes at all.

We can fix this by preventing the editor client from responding to selection changes during data interaction
operation. This patch also renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges to better
reflect the fact that it is used outside of the context of holding selection change updates during IME. We
already use this affordance in various places, such as TextIndicator (while taking a snapshot on iOS), in
FindController on iOS, and when replacing selected or dictated text. Additionally, there is no logic in
setIgnoreCompositionSelectionChange that limits its use to composition.

* editing/Editor.cpp:
(WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
(WebCore::Editor::setComposition):
(WebCore::Editor::revealSelectionAfterEditingOperation):
(WebCore::Editor::setIgnoreSelectionChanges):
(WebCore::Editor::changeSelectionAfterCommand):
(WebCore::Editor::respondToChangedSelection):
(WebCore::Editor::setIgnoreCompositionSelectionChange): Deleted.
* editing/Editor.h:
(WebCore::Editor::ignoreSelectionChanges):
(WebCore::Editor::ignoreCompositionSelectionChange): Deleted.
* editing/mac/EditorMac.mm:
(WebCore::Editor::selectionWillChange):
* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):

Source/WebKit/mac:

Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _updateSelectionForInputManager]):
* WebView/WebView.mm:
(-[WebView updateTextTouchBar]):

Source/WebKit2:

Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.

* Shared/EditorState.cpp:
(WebKit::EditorState::encode):
(WebKit::EditorState::decode):
* Shared/EditorState.h:
* UIProcess/gtk/WebPageProxyGtk.cpp:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::editorStateChanged):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::editorStateChanged):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState):
(WebKit::WebPage::performDragControllerAction):
(WebKit::WebPage::setComposition):
(WebKit::WebPage::didChangeSelection):
* WebProcess/WebPage/ios/FindControllerIOS.mm:
(WebKit::setSelectionChangeUpdatesEnabledInAllFrames):
(WebKit::FindController::willFindString):
(WebKit::FindController::didFailToFindString):
(WebKit::FindController::didHideFindIndicator):
(WebKit::setCompositionSelectionChangeEnabledInAllFrames): Deleted.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateSelectionAppearance):
(WebKit::WebPage::replaceSelectedText):
(WebKit::WebPage::replaceDictatedText):

Tools:

Reenables and refactors data interaction tests.

* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[DataInteractionSimulator _resetSimulatedState]):
(-[DataInteractionSimulator runFrom:to:]):
(-[DataInteractionSimulator _advanceProgress]):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorh">trunk/Source/WebCore/editing/Editor.h</a></li>
<li><a href="#trunkSourceWebCoreeditingmacEditorMacmm">trunk/Source/WebCore/editing/mac/EditorMac.mm</a></li>
<li><a href="#trunkSourceWebCorepageTextIndicatorcpp">trunk/Source/WebCore/page/TextIndicator.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedEditorStatecpp">trunk/Source/WebKit2/Shared/EditorState.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedEditorStateh">trunk/Source/WebKit2/Shared/EditorState.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessgtkWebPageProxyGtkcpp">trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebPageProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosFindControllerIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsiosDataInteractionTestsmm">trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPIiosDataInteractionSimulatorh">trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h</a></li>
<li><a href="#trunkToolsTestWebKitAPIiosDataInteractionSimulatormm">trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/ChangeLog        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2017-03-14  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        [WK2] Data interaction tests occasionally hit assertions in debug builds
+        https://bugs.webkit.org/show_bug.cgi?id=169002
+        &lt;rdar://problem/30994806&gt;
+
+        Reviewed by Tim Horton.
+
+        Data interaction unit tests occasionally fail due to the UI process expecting the latest received EditorState to
+        contain post layout data, but finding that it does not in -[WKContentView selectedTextRange]. The incomplete
+        EditorStates in question are sent while performing a data interaction operation, due to transient changes in the
+        frame selection. The UI process does not need to (and should not) be informed of these selection changes at all.
+
+        We can fix this by preventing the editor client from responding to selection changes during data interaction
+        operation. This patch also renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges to better
+        reflect the fact that it is used outside of the context of holding selection change updates during IME. We
+        already use this affordance in various places, such as TextIndicator (while taking a snapshot on iOS), in
+        FindController on iOS, and when replacing selected or dictated text. Additionally, there is no logic in
+        setIgnoreCompositionSelectionChange that limits its use to composition.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
+        (WebCore::Editor::setComposition):
+        (WebCore::Editor::revealSelectionAfterEditingOperation):
+        (WebCore::Editor::setIgnoreSelectionChanges):
+        (WebCore::Editor::changeSelectionAfterCommand):
+        (WebCore::Editor::respondToChangedSelection):
+        (WebCore::Editor::setIgnoreCompositionSelectionChange): Deleted.
+        * editing/Editor.h:
+        (WebCore::Editor::ignoreSelectionChanges):
+        (WebCore::Editor::ignoreCompositionSelectionChange): Deleted.
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::selectionWillChange):
+        * page/TextIndicator.cpp:
+        (WebCore::TextIndicator::createWithRange):
+
</ins><span class="cx"> 2017-03-14  Antoine Quint  &lt;graouts@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Modern Media Controls] iOS may attempt to load fullscreen icon variants
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/editing/Editor.cpp        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -1683,7 +1683,7 @@
</span><span class="cx"> {
</span><span class="cx">     unsigned start;
</span><span class="cx">     unsigned end;
</span><del>-    if (!hasComposition() || ignoreCompositionSelectionChange() || getCompositionSelection(start, end))
</del><ins>+    if (!hasComposition() || ignoreSelectionChanges() || getCompositionSelection(start, end))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     cancelComposition();
</span><span class="lines">@@ -1700,7 +1700,7 @@
</span><span class="cx">     ASSERT(mode == ConfirmComposition || mode == CancelComposition);
</span><span class="cx">     UserTypingGestureIndicator typingGestureIndicator(m_frame);
</span><span class="cx"> 
</span><del>-    setIgnoreCompositionSelectionChange(true);
</del><ins>+    setIgnoreSelectionChanges(true);
</ins><span class="cx"> 
</span><span class="cx">     if (mode == CancelComposition)
</span><span class="cx">         ASSERT(text == emptyString());
</span><span class="lines">@@ -1711,7 +1711,7 @@
</span><span class="cx">     m_customCompositionUnderlines.clear();
</span><span class="cx"> 
</span><span class="cx">     if (m_frame.selection().isNone()) {
</span><del>-        setIgnoreCompositionSelectionChange(false);
</del><ins>+        setIgnoreSelectionChanges(false);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1731,7 +1731,7 @@
</span><span class="cx">         TypingCommand::closeTyping(&amp;m_frame);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    setIgnoreCompositionSelectionChange(false);
</del><ins>+    setIgnoreSelectionChanges(false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Editor::setComposition(const String&amp; text, const Vector&lt;CompositionUnderline&gt;&amp; underlines, unsigned selectionStart, unsigned selectionEnd)
</span><span class="lines">@@ -1740,7 +1740,7 @@
</span><span class="cx"> 
</span><span class="cx">     UserTypingGestureIndicator typingGestureIndicator(m_frame);
</span><span class="cx"> 
</span><del>-    setIgnoreCompositionSelectionChange(true);
</del><ins>+    setIgnoreSelectionChanges(true);
</ins><span class="cx"> 
</span><span class="cx">     // Updates styles before setting selection for composition to prevent
</span><span class="cx">     // inserting the previous composition text into text nodes oddly.
</span><span class="lines">@@ -1750,7 +1750,7 @@
</span><span class="cx">     selectComposition();
</span><span class="cx"> 
</span><span class="cx">     if (m_frame.selection().isNone()) {
</span><del>-        setIgnoreCompositionSelectionChange(false);
</del><ins>+        setIgnoreSelectionChanges(false);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1843,7 +1843,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    setIgnoreCompositionSelectionChange(false);
</del><ins>+    setIgnoreSelectionChanges(false);
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)        
</span><span class="cx">     client()-&gt;stopDelayingAndCoalescingContentChangeNotifications();
</span><span class="lines">@@ -2775,7 +2775,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Editor::revealSelectionAfterEditingOperation(const ScrollAlignment&amp; alignment, RevealExtentOption revealExtentOption)
</span><span class="cx"> {
</span><del>-    if (m_ignoreCompositionSelectionChange)
</del><ins>+    if (m_ignoreSelectionChanges)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -2787,12 +2787,12 @@
</span><span class="cx">     m_frame.selection().revealSelection(revealMode, alignment, revealExtentOption);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Editor::setIgnoreCompositionSelectionChange(bool ignore, RevealSelection shouldRevealExistingSelection)
</del><ins>+void Editor::setIgnoreSelectionChanges(bool ignore, RevealSelection shouldRevealExistingSelection)
</ins><span class="cx"> {
</span><del>-    if (m_ignoreCompositionSelectionChange == ignore)
</del><ins>+    if (m_ignoreSelectionChanges == ignore)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_ignoreCompositionSelectionChange = ignore;
</del><ins>+    m_ignoreSelectionChanges = ignore;
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // FIXME: Should suppress selection change notifications during a composition change &lt;https://webkit.org/b/38830&gt; 
</span><span class="cx">     if (!ignore)
</span><span class="lines">@@ -2944,7 +2944,7 @@
</span><span class="cx">     // starts a new kill ring sequence, but we want to do these things (matches AppKit).
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // FIXME: Should suppress selection change notifications during a composition change &lt;https://webkit.org/b/38830&gt;
</span><del>-    if (m_ignoreCompositionSelectionChange)
</del><ins>+    if (m_ignoreSelectionChanges)
</ins><span class="cx">         return;
</span><span class="cx"> #endif
</span><span class="cx">     if (selectionDidNotChangeDOMPosition &amp;&amp; client())
</span><span class="lines">@@ -3286,7 +3286,7 @@
</span><span class="cx"> {
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // FIXME: Should suppress selection change notifications during a composition change &lt;https://webkit.org/b/38830&gt; 
</span><del>-    if (m_ignoreCompositionSelectionChange)
</del><ins>+    if (m_ignoreSelectionChanges)
</ins><span class="cx">         return;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.h (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.h        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/editing/Editor.h        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -334,8 +334,8 @@
</span><span class="cx">     const Vector&lt;CompositionUnderline&gt;&amp; customCompositionUnderlines() const { return m_customCompositionUnderlines; }
</span><span class="cx"> 
</span><span class="cx">     enum class RevealSelection { No, Yes };
</span><del>-    WEBCORE_EXPORT void setIgnoreCompositionSelectionChange(bool, RevealSelection shouldRevealExistingSelection = RevealSelection::Yes);
-    bool ignoreCompositionSelectionChange() const { return m_ignoreCompositionSelectionChange; }
</del><ins>+    WEBCORE_EXPORT void setIgnoreSelectionChanges(bool, RevealSelection shouldRevealExistingSelection = RevealSelection::Yes);
+    bool ignoreSelectionChanges() const { return m_ignoreSelectionChanges; }
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT PassRefPtr&lt;Range&gt; rangeForPoint(const IntPoint&amp; windowPoint);
</span><span class="cx"> 
</span><span class="lines">@@ -544,7 +544,7 @@
</span><span class="cx">     unsigned m_compositionStart;
</span><span class="cx">     unsigned m_compositionEnd;
</span><span class="cx">     Vector&lt;CompositionUnderline&gt; m_customCompositionUnderlines;
</span><del>-    bool m_ignoreCompositionSelectionChange { false };
</del><ins>+    bool m_ignoreSelectionChanges { false };
</ins><span class="cx">     bool m_shouldStartNewKillRingSequence { false };
</span><span class="cx">     bool m_shouldStyleWithCSS { false };
</span><span class="cx">     const std::unique_ptr&lt;KillRing&gt; m_killRing;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmacEditorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/mac/EditorMac.mm        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -258,7 +258,7 @@
</span><span class="cx"> 
</span><span class="cx"> void Editor::selectionWillChange()
</span><span class="cx"> {
</span><del>-    if (!hasComposition() || ignoreCompositionSelectionChange() || m_frame.selection().isNone())
</del><ins>+    if (!hasComposition() || ignoreSelectionChanges() || m_frame.selection().isNone())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     cancelComposition();
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.cpp (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.cpp        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/page/TextIndicator.cpp        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx">     Ref&lt;Frame&gt; protector(*frame);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    frame-&gt;editor().setIgnoreCompositionSelectionChange(true);
</del><ins>+    frame-&gt;editor().setIgnoreSelectionChanges(true);
</ins><span class="cx">     frame-&gt;selection().setUpdateAppearanceEnabled(true);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">     frame-&gt;selection().setSelection(oldSelection);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    frame-&gt;editor().setIgnoreCompositionSelectionChange(false, Editor::RevealSelection::No);
</del><ins>+    frame-&gt;editor().setIgnoreSelectionChanges(false, Editor::RevealSelection::No);
</ins><span class="cx">     frame-&gt;selection().setUpdateAppearanceEnabled(false);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit/mac/ChangeLog        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2017-03-14  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        [WK2] Data interaction tests occasionally hit assertions in debug builds
+        https://bugs.webkit.org/show_bug.cgi?id=169002
+        &lt;rdar://problem/30994806&gt;
+
+        Reviewed by Tim Horton.
+
+        Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _updateSelectionForInputManager]):
+        * WebView/WebView.mm:
+        (-[WebView updateTextTouchBar]):
+
</ins><span class="cx"> 2017-03-13  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix build warnings.
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -7211,7 +7211,7 @@
</span><span class="cx"> 
</span><span class="cx">     [self _updateSecureInputState];
</span><span class="cx"> 
</span><del>-    if (!coreFrame-&gt;editor().hasComposition() || coreFrame-&gt;editor().ignoreCompositionSelectionChange())
</del><ins>+    if (!coreFrame-&gt;editor().hasComposition() || coreFrame-&gt;editor().ignoreSelectionChanges())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     unsigned start;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -9616,7 +9616,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if ([NSSpellChecker isAutomaticTextCompletionEnabled] &amp;&amp; !_private-&gt;_isCustomizingTouchBar) {
</span><del>-        BOOL shouldShowCandidateList = !coreFrame-&gt;selection().selection().isRange() || coreFrame-&gt;editor().ignoreCompositionSelectionChange();
</del><ins>+        BOOL shouldShowCandidateList = !coreFrame-&gt;selection().selection().isRange() || coreFrame-&gt;editor().ignoreSelectionChanges();
</ins><span class="cx">         [self.candidateList updateWithInsertionPointVisibility:shouldShowCandidateList];
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2017-03-14  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        [WK2] Data interaction tests occasionally hit assertions in debug builds
+        https://bugs.webkit.org/show_bug.cgi?id=169002
+        &lt;rdar://problem/30994806&gt;
+
+        Reviewed by Tim Horton.
+
+        Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.
+
+        * Shared/EditorState.cpp:
+        (WebKit::EditorState::encode):
+        (WebKit::EditorState::decode):
+        * Shared/EditorState.h:
+        * UIProcess/gtk/WebPageProxyGtk.cpp:
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::editorStateChanged):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::editorStateChanged):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::editorState):
+        (WebKit::WebPage::performDragControllerAction):
+        (WebKit::WebPage::setComposition):
+        (WebKit::WebPage::didChangeSelection):
+        * WebProcess/WebPage/ios/FindControllerIOS.mm:
+        (WebKit::setSelectionChangeUpdatesEnabledInAllFrames):
+        (WebKit::FindController::willFindString):
+        (WebKit::FindController::didFailToFindString):
+        (WebKit::FindController::didHideFindIndicator):
+        (WebKit::setCompositionSelectionChangeEnabledInAllFrames): Deleted.
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateSelectionAppearance):
+        (WebKit::WebPage::replaceSelectedText):
+        (WebKit::WebPage::replaceDictatedText):
+
</ins><span class="cx"> 2017-03-14  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed. Fix syntax error in GTK+ API docs.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEditorStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EditorState.cpp (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EditorState.cpp        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/Shared/EditorState.cpp        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> 
</span><span class="cx"> void EditorState::encode(IPC::Encoder&amp; encoder) const
</span><span class="cx"> {
</span><del>-    encoder &lt;&lt; shouldIgnoreCompositionSelectionChange;
</del><ins>+    encoder &lt;&lt; shouldIgnoreSelectionChanges;
</ins><span class="cx">     encoder &lt;&lt; selectionIsNone;
</span><span class="cx">     encoder &lt;&lt; selectionIsRange;
</span><span class="cx">     encoder &lt;&lt; isContentEditable;
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool EditorState::decode(IPC::Decoder&amp; decoder, EditorState&amp; result)
</span><span class="cx"> {
</span><del>-    if (!decoder.decode(result.shouldIgnoreCompositionSelectionChange))
</del><ins>+    if (!decoder.decode(result.shouldIgnoreSelectionChanges))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (!decoder.decode(result.selectionIsNone))
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedEditorStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/EditorState.h (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/EditorState.h        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/Shared/EditorState.h        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct EditorState {
</span><del>-    bool shouldIgnoreCompositionSelectionChange { false };
</del><ins>+    bool shouldIgnoreSelectionChanges { false };
</ins><span class="cx"> 
</span><span class="cx">     bool selectionIsNone { true }; // This will be false when there is a caret selection.
</span><span class="cx">     bool selectionIsRange { false };
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessgtkWebPageProxyGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> {
</span><span class="cx">     m_editorState = editorState;
</span><span class="cx">     
</span><del>-    if (editorState.shouldIgnoreCompositionSelectionChange)
</del><ins>+    if (editorState.shouldIgnoreSelectionChanges)
</ins><span class="cx">         return;
</span><span class="cx">     if (m_editorState.selectionIsRange)
</span><span class="cx">         WebPasteboardProxy::singleton().setPrimarySelectionOwner(focusedFrame());
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -1085,7 +1085,7 @@
</span><span class="cx">     if (couldChangeSecureInputState &amp;&amp; !editorState.selectionIsNone)
</span><span class="cx">         m_pageClient.updateSecureInputState();
</span><span class="cx">     
</span><del>-    if (editorState.shouldIgnoreCompositionSelectionChange)
</del><ins>+    if (editorState.shouldIgnoreSelectionChanges)
</ins><span class="cx">         return;
</span><span class="cx">     
</span><span class="cx">     // We always need to notify the client on iOS to make sure the selection is redrawn,
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -574,7 +574,7 @@
</span><span class="cx">     if (couldChangeSecureInputState &amp;&amp; !editorState.selectionIsNone)
</span><span class="cx">         m_pageClient.updateSecureInputState();
</span><span class="cx">     
</span><del>-    if (editorState.shouldIgnoreCompositionSelectionChange)
</del><ins>+    if (editorState.shouldIgnoreSelectionChanges)
</ins><span class="cx">         return;
</span><span class="cx">     
</span><span class="cx">     m_pageClient.selectionDidChange();
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -831,7 +831,7 @@
</span><span class="cx">     result.isContentRichlyEditable = selection.isContentRichlyEditable();
</span><span class="cx">     result.isInPasswordField = selection.isInPasswordField();
</span><span class="cx">     result.hasComposition = frame.editor().hasComposition();
</span><del>-    result.shouldIgnoreCompositionSelectionChange = frame.editor().ignoreCompositionSelectionChange();
</del><ins>+    result.shouldIgnoreSelectionChanges = frame.editor().ignoreSelectionChanges();
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     if (shouldIncludePostLayoutData == IncludePostLayoutDataHint::Yes &amp;&amp; result.isContentEditable) {
</span><span class="lines">@@ -3525,7 +3525,10 @@
</span><span class="cx">                 m_pendingDropExtensionsForFileUpload.append(extension);
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        auto&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
+        frame.editor().setIgnoreSelectionChanges(true);
</ins><span class="cx">         m_page-&gt;dragController().performDragOperation(dragData);
</span><ins>+        frame.editor().setIgnoreSelectionChanges(false);
</ins><span class="cx"> 
</span><span class="cx">         // If we started loading a local file, the sandbox extension tracker would have adopted this
</span><span class="cx">         // pending drop sandbox extension. If not, we'll play it safe and clear it.
</span><span class="lines">@@ -4861,9 +4864,9 @@
</span><span class="cx"> 
</span><span class="cx">         Element* scope = targetFrame-&gt;selection().selection().rootEditableElement();
</span><span class="cx">         RefPtr&lt;Range&gt; replacementRange = TextIterator::rangeFromLocationAndLength(scope, replacementStart, replacementLength);
</span><del>-        targetFrame-&gt;editor().setIgnoreCompositionSelectionChange(true);
</del><ins>+        targetFrame-&gt;editor().setIgnoreSelectionChanges(true);
</ins><span class="cx">         targetFrame-&gt;selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
</span><del>-        targetFrame-&gt;editor().setIgnoreCompositionSelectionChange(false);
</del><ins>+        targetFrame-&gt;editor().setIgnoreSelectionChanges(false);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     targetFrame-&gt;editor().setComposition(text, underlines, selectionStart, selectionStart + selectionLength);
</span><span class="lines">@@ -4957,7 +4960,7 @@
</span><span class="cx">     // FIXME: This logic should be in WebCore.
</span><span class="cx">     // FIXME: Many changes that affect composition node do not go through didChangeSelection(). We need to do something when DOM manipulation affects the composition, because otherwise input method's idea about it will be different from Editor's.
</span><span class="cx">     // FIXME: We can't cancel composition when selection changes to NoSelection, but we probably should.
</span><del>-    if (frame.editor().hasComposition() &amp;&amp; !frame.editor().ignoreCompositionSelectionChange() &amp;&amp; !frame.selection().isNone()) {
</del><ins>+    if (frame.editor().hasComposition() &amp;&amp; !frame.editor().ignoreSelectionChanges() &amp;&amp; !frame.selection().isNone()) {
</ins><span class="cx">         frame.editor().cancelComposition();
</span><span class="cx">         discardedComposition();
</span><span class="cx">     } else
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosFindControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -131,15 +131,15 @@
</span><span class="cx">     didHideFindIndicator();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void setCompositionSelectionChangeEnabledInAllFrames(WebPage&amp; page, bool enabled)
</del><ins>+static void setSelectionChangeUpdatesEnabledInAllFrames(WebPage&amp; page, bool enabled)
</ins><span class="cx"> {
</span><span class="cx">     for (Frame* coreFrame = page.mainFrame(); coreFrame; coreFrame = coreFrame-&gt;tree().traverseNext())
</span><del>-        coreFrame-&gt;editor().setIgnoreCompositionSelectionChange(enabled);
</del><ins>+        coreFrame-&gt;editor().setIgnoreSelectionChanges(enabled);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FindController::willFindString()
</span><span class="cx"> {
</span><del>-    setCompositionSelectionChangeEnabledInAllFrames(*m_webPage, true);
</del><ins>+    setSelectionChangeUpdatesEnabledInAllFrames(*m_webPage, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FindController::didFindString()
</span><span class="lines">@@ -157,12 +157,12 @@
</span><span class="cx"> 
</span><span class="cx"> void FindController::didFailToFindString()
</span><span class="cx"> {
</span><del>-    setCompositionSelectionChangeEnabledInAllFrames(*m_webPage, false);
</del><ins>+    setSelectionChangeUpdatesEnabledInAllFrames(*m_webPage, false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FindController::didHideFindIndicator()
</span><span class="cx"> {
</span><del>-    setCompositionSelectionChangeEnabledInAllFrames(*m_webPage, false);
</del><ins>+    setSelectionChangeUpdatesEnabledInAllFrames(*m_webPage, false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -534,7 +534,7 @@
</span><span class="cx"> void WebPage::updateSelectionAppearance()
</span><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = m_page-&gt;focusController().focusedOrMainFrame();
</span><del>-    if (!frame.editor().ignoreCompositionSelectionChange() &amp;&amp; (frame.editor().hasComposition() || !frame.selection().selection().isNone()))
</del><ins>+    if (!frame.editor().ignoreSelectionChanges() &amp;&amp; (frame.editor().hasComposition() || !frame.selection().selection().isNone()))
</ins><span class="cx">         didChangeSelection();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2156,10 +2156,10 @@
</span><span class="cx">     if (plainTextReplacingNoBreakSpace(wordRange.get()) != oldText)
</span><span class="cx">         return;
</span><span class="cx">     
</span><del>-    frame.editor().setIgnoreCompositionSelectionChange(true);
</del><ins>+    frame.editor().setIgnoreSelectionChanges(true);
</ins><span class="cx">     frame.selection().setSelectedRange(wordRange.get(), UPSTREAM, true);
</span><span class="cx">     frame.editor().insertText(newText, 0);
</span><del>-    frame.editor().setIgnoreCompositionSelectionChange(false);
</del><ins>+    frame.editor().setIgnoreSelectionChanges(false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::replaceDictatedText(const String&amp; oldText, const String&amp; newText)
</span><span class="lines">@@ -2183,10 +2183,10 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // We don't want to notify the client that the selection has changed until we are done inserting the new text.
</span><del>-    frame.editor().setIgnoreCompositionSelectionChange(true);
</del><ins>+    frame.editor().setIgnoreSelectionChanges(true);
</ins><span class="cx">     frame.selection().setSelectedRange(range.get(), UPSTREAM, true);
</span><span class="cx">     frame.editor().insertText(newText, 0);
</span><del>-    frame.editor().setIgnoreCompositionSelectionChange(false);
</del><ins>+    frame.editor().setIgnoreSelectionChanges(false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::requestAutocorrectionData(const String&amp; textForAutocorrection, uint64_t callbackID)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Tools/ChangeLog        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-03-14  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        [WK2] Data interaction tests occasionally hit assertions in debug builds
+        https://bugs.webkit.org/show_bug.cgi?id=169002
+        &lt;rdar://problem/30994806&gt;
+
+        Reviewed by Tim Horton.
+
+        Reenables and refactors data interaction tests.
+
+        * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+        * TestWebKitAPI/ios/DataInteractionSimulator.h:
+        * TestWebKitAPI/ios/DataInteractionSimulator.mm:
+        (-[DataInteractionSimulator _resetSimulatedState]):
+        (-[DataInteractionSimulator runFrom:to:]):
+        (-[DataInteractionSimulator _advanceProgress]):
+
</ins><span class="cx"> 2017-03-13  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r213877): WebKit2.CookieManager fails.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsiosDataInteractionTestsmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> 
</span><del>-#if 0
</del><ins>+#if ENABLE(DATA_INTERACTION)
</ins><span class="cx"> 
</span><span class="cx"> #import &quot;DataInteractionSimulator.h&quot;
</span><span class="cx"> #import &quot;PlatformUtilities.h&quot;
</span><span class="lines">@@ -251,33 +251,6 @@
</span><span class="cx">     EXPECT_TRUE([[dataInteractionSimulator finalSelectionRects] isEqualToArray:@[ makeCGRectValue(1, 201, 215, 174) ]]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TEST(DataInteractionTests, AttachmentElementItemProviders)
-{
-    RetainPtr&lt;WKWebViewConfiguration&gt; configuration = [WKWebViewConfiguration testwebkitapi_configurationWithTestPlugInClassName:@&quot;BundleEditingDelegatePlugIn&quot;];
-    [configuration _setAttachmentElementEnabled:YES];
-    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500) configuration:configuration.get()]);
-    auto dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
-    [webView synchronouslyLoadTestPageNamed:@&quot;attachment-element&quot;];
-
-    NSString *injectedTypeIdentifier = @&quot;org.webkit.data&quot;;
-    __block RetainPtr&lt;NSString&gt; injectedString;
-    [dataInteractionSimulator setConvertItemProvidersBlock:^NSArray *(NSArray *originalItemProviders)
-    {
-        for (UIItemProvider *provider in originalItemProviders) {
-            NSData *injectedData = [provider copyDataRepresentationForTypeIdentifier:injectedTypeIdentifier error:nil];
-            if (!injectedData.length)
-                continue;
-            injectedString = adoptNS([[NSString alloc] initWithData:injectedData encoding:NSUTF8StringEncoding]);
-            break;
-        }
-        return originalItemProviders;
-    }];
-
-    [dataInteractionSimulator runFrom:CGPointMake(50, 50) to:CGPointMake(50, 400)];
-
-    EXPECT_WK_STREQ(&quot;hello&quot;, [injectedString UTF8String]);
-}
-
</del><span class="cx"> } // namespace TestWebKitAPI
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(DATA_INTERACTION)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIiosDataInteractionSimulatorh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#if 0
</del><ins>+#if ENABLE(DATA_INTERACTION)
</ins><span class="cx"> 
</span><span class="cx"> #import &quot;TestWKWebView.h&quot;
</span><span class="cx"> #import &lt;UIKit/UIItemProvider.h&gt;
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> #import &lt;WebKit/_WKTestingDelegate.h&gt;
</span><span class="cx"> #import &lt;wtf/BlockPtr.h&gt;
</span><span class="cx"> 
</span><del>-@class MockDataInteractionInfo;
</del><ins>+@class MockDataOperationSession;
</ins><span class="cx"> @class MockDataInteractionSession;
</span><span class="cx"> 
</span><span class="cx"> extern NSString * const DataInteractionEnterEventName;
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx"> @interface DataInteractionSimulator : NSObject&lt;_WKTestingDelegate, WKUIDelegatePrivate&gt; {
</span><span class="cx">     RetainPtr&lt;TestWKWebView&gt; _webView;
</span><span class="cx">     RetainPtr&lt;MockDataInteractionSession&gt; _dataInteractionSession;
</span><del>-    RetainPtr&lt;MockDataInteractionInfo&gt; _dataInteractionInfo;
</del><ins>+    RetainPtr&lt;MockDataOperationSession&gt; _dataOperationSession;
</ins><span class="cx">     RetainPtr&lt;NSMutableArray&gt; _observedEventNames;
</span><span class="cx">     RetainPtr&lt;UIItemProvider&gt; _externalItemProvider;
</span><span class="cx">     RetainPtr&lt;NSArray *&gt; _finalSelectionRects;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIiosDataInteractionSimulatormm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm (213901 => 213902)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm        2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm        2017-03-14 17:01:40 UTC (rev 213902)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;DataInteractionSimulator.h&quot;
</span><span class="cx"> 
</span><del>-#if 0
</del><ins>+#if ENABLE(DATA_INTERACTION)
</ins><span class="cx"> 
</span><span class="cx"> #import &quot;PlatformUtilities.h&quot;
</span><span class="cx"> #import &lt;UIKit/UIItemProvider_Private.h&gt;
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx">     _observedEventNames = adoptNS([[NSMutableArray alloc] init]);
</span><span class="cx">     _finalSelectionRects = @[ ];
</span><span class="cx">     _dataInteractionSession = nil;
</span><del>-    _dataInteractionInfo = nil;
</del><ins>+    _dataOperationSession = nil;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)observedEventNames
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx">     _endLocation = endLocation;
</span><span class="cx"> 
</span><span class="cx">     if (self.externalItemProvider) {
</span><del>-        _dataInteractionInfo = adoptNS([[MockDataInteractionInfo alloc] initWithProvider:self.externalItemProvider location:_startLocation window:[_webView window]]);
</del><ins>+        _dataOperationSession = adoptNS([[MockDataOperationSession alloc] initWithProvider:self.externalItemProvider location:_startLocation window:[_webView window]]);
</ins><span class="cx">         _phase = DataInteractionBegan;
</span><span class="cx">         [self _advanceProgress];
</span><span class="cx">     } else {
</span><span class="lines">@@ -135,11 +135,11 @@
</span><span class="cx">     _currentProgress += progressIncrementStep;
</span><span class="cx">     CGPoint locationInWindow = self._currentLocation;
</span><span class="cx">     [_dataInteractionSession setMockLocationInWindow:locationInWindow];
</span><del>-    [_dataInteractionInfo setMockLocationInWindow:locationInWindow];
</del><ins>+    [_dataOperationSession setMockLocationInWindow:locationInWindow];
</ins><span class="cx"> 
</span><span class="cx">     if (_currentProgress &gt;= 1) {
</span><del>-        [_webView _simulateDataInteractionPerformOperation:_dataInteractionInfo.get()];
-        [_webView _simulateDataInteractionEnded:_dataInteractionInfo.get()];
</del><ins>+        [_webView _simulateDataInteractionPerformOperation:_dataOperationSession.get()];
+        [_webView _simulateDataInteractionEnded:_dataOperationSession.get()];
</ins><span class="cx">         if (_dataInteractionSession)
</span><span class="cx">             [_webView _simulateDataInteractionSessionDidEnd:_dataInteractionSession.get()];
</span><span class="cx"> 
</span><span class="lines">@@ -164,7 +164,7 @@
</span><span class="cx">             [itemProviders addObject:item.itemProvider];
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-        _dataInteractionInfo = adoptNS([[MockDataInteractionInfo alloc] initWithProvider:itemProviders.firstObject location:self._currentLocation window:[_webView window]]);
</del><ins>+        _dataOperationSession = adoptNS([[MockDataOperationSession alloc] initWithProvider:itemProviders.firstObject location:self._currentLocation window:[_webView window]]);
</ins><span class="cx"> #if HAS_DATA_INTERACTION_ITEMS
</span><span class="cx">         [_dataInteractionSession setItems:items];
</span><span class="cx"> #endif
</span><span class="lines">@@ -173,11 +173,11 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     case DataInteractionBegan:
</span><del>-        [_webView _simulateDataInteractionEntered:_dataInteractionInfo.get()];
</del><ins>+        [_webView _simulateDataInteractionEntered:_dataOperationSession.get()];
</ins><span class="cx">         _phase = DataInteractionEntered;
</span><span class="cx">         break;
</span><span class="cx">     case DataInteractionEntered:
</span><del>-        [_webView _simulateDataInteractionUpdated:_dataInteractionInfo.get()];
</del><ins>+        [_webView _simulateDataInteractionUpdated:_dataOperationSession.get()];
</ins><span class="cx">         break;
</span><span class="cx">     default:
</span><span class="cx">         break;
</span></span></pre>
</div>
</div>

</body>
</html>