<!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>[210196] releases/WebKitGTK/webkit-2.14/Source</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/210196">210196</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-12-28 03:04:16 -0800 (Wed, 28 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/208168">r208168</a> - Do a better job of protecting Frame objects in the context of JavaScript calls
https://bugs.webkit.org/show_bug.cgi?id=164163
<rdar://problem/28955249>
Reviewed by Darin Adler.
Source/WebCore:
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): Protected the Frame.
* editing/Editor.cpp:
(WebCore::Editor::setTextAsChildOfElement): Ditto.
* editing/EditorCommand.cpp:
(WebCore::executeSwapWithMark): Ditto.
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::deleteKeyPressed): Ditto.
(WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
* editing/mac/EditorMac.mm:
(WebCore::Editor::replaceNodeFromPasteboard): Ditto.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
* page/DOMSelection.cpp:
(WebCore::DOMSelection::collapse): Ditto.
(WebCore::DOMSelection::collapseToEnd): Ditto.
(WebCore::DOMSelection::collapseToStart): Ditto.
(WebCore::DOMSelection::setBaseAndExtent): Ditto.
(WebCore::DOMSelection::setPosition): Ditto.
(WebCore::DOMSelection::modify): Ditto.
(WebCore::DOMSelection::extend): Ditto.
(WebCore::DOMSelection::addRange): Ditto.
(WebCore::DOMSelection::deleteFromDocument): Ditto.
* page/DragController.cpp:
(WebCore::setSelectionToDragCaret): Ditto.
(WebCore::DragController::startDrag): Ditto.
* page/Frame.cpp:
(WebCore::Frame::checkOverflowScroll): Ditto.
* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange): Ditto.
Source/WebKit2:
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::renderedImage): Protected the Frame.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::insertTextAsync): Ditto.
(WebKit::WebPage::setComposition): Ditto.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::insertDictatedTextAsync): Ditto.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreeditingAlternativeTextControllercpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/AlternativeTextController.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreeditingEditorcpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreeditingEditorCommandcpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/EditorCommand.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreeditingTypingCommandcpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/TypingCommand.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreeditingmacEditorMacmm">releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/mac/EditorMac.mm</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCorepageContextMenuControllercpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/page/ContextMenuController.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCorepageDOMSelectioncpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DOMSelection.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCorepageDragControllercpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DragController.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCorepageFramecpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/page/Frame.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCorepageTextIndicatorcpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/page/TextIndicator.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2ChangeLog">releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2WebProcessInjectedBundleDOMInjectedBundleRangeHandlecpp">releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2WebProcessWebPageWebPagecpp">releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebKit2WebProcessWebPagemacWebPageMacmm">releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit214SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2016-10-28 Brent Fulgham <bfulgham@apple.com>
+
+ Do a better job of protecting Frame objects in the context of JavaScript calls
+ https://bugs.webkit.org/show_bug.cgi?id=164163
+ <rdar://problem/28955249>
+
+ Reviewed by Darin Adler.
+
+ * editing/AlternativeTextController.cpp:
+ (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection): Protected the Frame.
+ * editing/Editor.cpp:
+ (WebCore::Editor::setTextAsChildOfElement): Ditto.
+ * editing/EditorCommand.cpp:
+ (WebCore::executeSwapWithMark): Ditto.
+ * editing/TypingCommand.cpp:
+ (WebCore::TypingCommand::deleteKeyPressed): Ditto.
+ (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
+ * editing/mac/EditorMac.mm:
+ (WebCore::Editor::replaceNodeFromPasteboard): Ditto.
+ * page/ContextMenuController.cpp:
+ (WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
+ * page/DOMSelection.cpp:
+ (WebCore::DOMSelection::collapse): Ditto.
+ (WebCore::DOMSelection::collapseToEnd): Ditto.
+ (WebCore::DOMSelection::collapseToStart): Ditto.
+ (WebCore::DOMSelection::setBaseAndExtent): Ditto.
+ (WebCore::DOMSelection::setPosition): Ditto.
+ (WebCore::DOMSelection::modify): Ditto.
+ (WebCore::DOMSelection::extend): Ditto.
+ (WebCore::DOMSelection::addRange): Ditto.
+ (WebCore::DOMSelection::deleteFromDocument): Ditto.
+ * page/DragController.cpp:
+ (WebCore::setSelectionToDragCaret): Ditto.
+ (WebCore::DragController::startDrag): Ditto.
+ * page/Frame.cpp:
+ (WebCore::Frame::checkOverflowScroll): Ditto.
+ * page/TextIndicator.cpp:
+ (WebCore::TextIndicator::createWithRange): Ditto.
+
</ins><span class="cx"> 2016-10-27 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> Prevent hit tests from being performed on an invalid render tree
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreeditingAlternativeTextControllercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/AlternativeTextController.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/AlternativeTextController.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/AlternativeTextController.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2008, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
</span><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -317,6 +317,8 @@
</span><span class="cx"> {
</span><span class="cx"> if (AlternativeTextClient* client = alternativeTextClient())
</span><span class="cx"> client->recordAutocorrectionResponse(AutocorrectionReverted, corrected, correction);
</span><ins>+
+ Ref<Frame> protector(m_frame);
</ins><span class="cx"> m_frame.document()->updateLayout();
</span><span class="cx"> m_frame.selection().setSelection(selectionOfCorrected, FrameSelection::defaultSetSelectionOptions() | FrameSelection::SpellCorrectionTriggered);
</span><span class="cx"> RefPtr<Range> range = Range::create(*m_frame.document(), m_frame.selection().selection().start(), m_frame.selection().selection().end());
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/Editor.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/Editor.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/Editor.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007, 2008, 2011, 2013-2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2008, 2011, 2013-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
</span><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -1786,6 +1786,8 @@
</span><span class="cx">
</span><span class="cx"> void Editor::setComposition(const String& text, const Vector<CompositionUnderline>& underlines, unsigned selectionStart, unsigned selectionEnd)
</span><span class="cx"> {
</span><ins>+ Ref<Frame> protection(m_frame);
+
</ins><span class="cx"> UserTypingGestureIndicator typingGestureIndicator(m_frame);
</span><span class="cx">
</span><span class="cx"> setIgnoreCompositionSelectionChange(true);
</span><span class="lines">@@ -1919,6 +1921,8 @@
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> void Editor::advanceToNextMisspelling(bool startBeforeSelection)
</span><span class="cx"> {
</span><ins>+ Ref<Frame> protection(m_frame);
+
</ins><span class="cx"> // The basic approach is to search in two phases - from the selection end to the end of the doc, and
</span><span class="cx"> // then we wrap and search from the doc start to (approximately) where we started.
</span><span class="cx">
</span><span class="lines">@@ -2237,6 +2241,8 @@
</span><span class="cx">
</span><span class="cx"> void Editor::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping, bool doReplacement)
</span><span class="cx"> {
</span><ins>+ Ref<Frame> protection(m_frame);
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> UNUSED_PARAM(selectionAfterTyping);
</span><span class="cx"> UNUSED_PARAM(doReplacement);
</span><span class="lines">@@ -2487,6 +2493,7 @@
</span><span class="cx">
</span><span class="cx"> void Editor::markAndReplaceFor(PassRefPtr<SpellCheckRequest> request, const Vector<TextCheckingResult>& results)
</span><span class="cx"> {
</span><ins>+ Ref<Frame> protection(m_frame);
</ins><span class="cx"> ASSERT(request);
</span><span class="cx">
</span><span class="cx"> TextCheckingTypeMask textCheckingOptions = request->data().mask();
</span><span class="lines">@@ -2945,6 +2952,8 @@
</span><span class="cx">
</span><span class="cx"> void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, FrameSelection::SetSelectionOptions options)
</span><span class="cx"> {
</span><ins>+ Ref<Frame> protection(m_frame);
+
</ins><span class="cx"> // If the new selection is orphaned, then don't update the selection.
</span><span class="cx"> if (newSelection.start().isOrphan() || newSelection.end().isOrphan())
</span><span class="cx"> return;
</span><span class="lines">@@ -3135,6 +3144,8 @@
</span><span class="cx">
</span><span class="cx"> bool Editor::findString(const String& target, FindOptions options)
</span><span class="cx"> {
</span><ins>+ Ref<Frame> protection(m_frame);
+
</ins><span class="cx"> VisibleSelection selection = m_frame.selection().selection();
</span><span class="cx">
</span><span class="cx"> RefPtr<Range> resultRange = rangeOfString(target, selection.firstRange().get(), options);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreeditingEditorCommandcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/EditorCommand.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/EditorCommand.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/EditorCommand.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007, 2008, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2008, 2014, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
</span><span class="cx"> * Copyright (C) 2009 Igalia S.L.
</span><span class="cx"> *
</span><span class="lines">@@ -1061,6 +1061,7 @@
</span><span class="cx">
</span><span class="cx"> static bool executeSwapWithMark(Frame& frame, Event*, EditorCommandSource, const String&)
</span><span class="cx"> {
</span><ins>+ Ref<Frame> protector(frame);
</ins><span class="cx"> const VisibleSelection& mark = frame.editor().mark();
</span><span class="cx"> const VisibleSelection& selection = frame.selection().selection();
</span><span class="cx"> if (mark.isNone() || selection.isNone()) {
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreeditingTypingCommandcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/TypingCommand.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/TypingCommand.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/TypingCommand.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2005-2008, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -480,6 +480,7 @@
</span><span class="cx"> void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool shouldAddToKillRing)
</span><span class="cx"> {
</span><span class="cx"> Frame& frame = this->frame();
</span><ins>+ Ref<Frame> protector(frame);
</ins><span class="cx">
</span><span class="cx"> frame.editor().updateMarkersForWordsAffectedByEditing(false);
</span><span class="cx">
</span><span class="lines">@@ -593,6 +594,7 @@
</span><span class="cx"> void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool shouldAddToKillRing)
</span><span class="cx"> {
</span><span class="cx"> Frame& frame = this->frame();
</span><ins>+ Ref<Frame> protector(frame);
</ins><span class="cx">
</span><span class="cx"> frame.editor().updateMarkersForWordsAffectedByEditing(false);
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCoreeditingmacEditorMacmm"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/mac/EditorMac.mm (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/mac/EditorMac.mm        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/editing/mac/EditorMac.mm        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -259,6 +259,7 @@
</span><span class="cx"> if (&node->document() != m_frame.document())
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(m_frame);
</ins><span class="cx"> RefPtr<Range> range = Range::create(node->document(), Position(node, Position::PositionIsBeforeAnchor), Position(node, Position::PositionIsAfterAnchor));
</span><span class="cx"> m_frame.selection().setSelection(VisibleSelection(*range), FrameSelection::DoNotSetFocus);
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCorepageContextMenuControllercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/page/ContextMenuController.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/page/ContextMenuController.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/page/ContextMenuController.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006-2007, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2010 Igalia S.L
</span><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -223,6 +223,8 @@
</span><span class="cx"> if (!frame)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(*frame);
+
</ins><span class="cx"> switch (action) {
</span><span class="cx"> case ContextMenuItemTagOpenLinkInNewWindow:
</span><span class="cx"> openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame, ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCorepageDOMSelectioncpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DOMSelection.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DOMSelection.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DOMSelection.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2007, 2009, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2012 Google Inc. All rights reserved.
</span><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -196,6 +196,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // FIXME: Eliminate legacy editing positions
</span><ins>+ Ref<Frame> protector(*m_frame);
</ins><span class="cx"> m_frame->selection().moveTo(createLegacyEditingPosition(node, offset), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -211,6 +212,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(*m_frame);
</ins><span class="cx"> m_frame->selection().moveTo(selection.end(), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -226,6 +228,7 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(*m_frame);
</ins><span class="cx"> m_frame->selection().moveTo(selection.start(), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -245,6 +248,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // FIXME: Eliminate legacy editing positions
</span><ins>+ Ref<Frame> protector(*m_frame);
</ins><span class="cx"> m_frame->selection().moveTo(createLegacyEditingPosition(baseNode, baseOffset), createLegacyEditingPosition(extentNode, extentOffset), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -257,6 +261,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // FIXME: Eliminate legacy editing positions
</span><ins>+ Ref<Frame> protector(*m_frame);
</ins><span class="cx"> m_frame->selection().moveTo(createLegacyEditingPosition(node, offset), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -307,6 +312,7 @@
</span><span class="cx"> else
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(*m_frame);
</ins><span class="cx"> m_frame->selection().modify(alter, direction, granularity);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -324,6 +330,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // FIXME: Eliminate legacy editing positions
</span><ins>+ Ref<Frame> protector(*m_frame);
</ins><span class="cx"> m_frame->selection().setExtent(createLegacyEditingPosition(&node, offset), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -361,6 +368,8 @@
</span><span class="cx"> if (!m_frame)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(*m_frame);
+
</ins><span class="cx"> FrameSelection& selection = m_frame->selection();
</span><span class="cx"> if (selection.isNone()) {
</span><span class="cx"> selection.moveTo(&range);
</span><span class="lines">@@ -411,6 +420,7 @@
</span><span class="cx"> if (!selectedRange)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(*m_frame);
</ins><span class="cx"> selectedRange->deleteContents(ASSERT_NO_EXCEPTION);
</span><span class="cx">
</span><span class="cx"> setBaseAndExtent(&selectedRange->startContainer(), selectedRange->startOffset(), &selectedRange->startContainer(), selectedRange->startOffset());
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCorepageDragControllercpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DragController.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DragController.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DragController.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2007, 2009, 2010, 2013, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2007, 2009-2010, 2013, 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -433,6 +433,7 @@
</span><span class="cx">
</span><span class="cx"> static bool setSelectionToDragCaret(Frame* frame, VisibleSelection& dragCaret, RefPtr<Range>& range, const IntPoint& point)
</span><span class="cx"> {
</span><ins>+ Ref<Frame> protector(*frame);
</ins><span class="cx"> frame->selection().setSelection(dragCaret);
</span><span class="cx"> if (frame->selection().selection().isNone()) {
</span><span class="cx"> dragCaret = frame->visiblePositionForPoint(point);
</span><span class="lines">@@ -753,6 +754,7 @@
</span><span class="cx"> if (!src.view() || !src.contentRenderer() || !state.source)
</span><span class="cx"> return false;
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(src);
</ins><span class="cx"> HitTestResult hitTestResult = src.eventHandler().hitTestResultAtPoint(dragOrigin, HitTestRequest::ReadOnly | HitTestRequest::Active);
</span><span class="cx">
</span><span class="cx"> // FIXME(136836): Investigate whether all elements should use the containsIncludingShadowDOM() path here.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCorepageFramecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/page/Frame.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/page/Frame.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/page/Frame.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -604,6 +604,8 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ Ref<Frame> protectedThis(*this);
+
</ins><span class="cx"> if (action == PerformOverflowScroll && (deltaX || deltaY)) {
</span><span class="cx"> layer->scrollToOffset(layer->scrollOffset() + IntSize(deltaX, deltaY));
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/page/TextIndicator.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/page/TextIndicator.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/page/TextIndicator.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010, 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -69,6 +69,8 @@
</span><span class="cx"> if (!frame)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(*frame);
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> frame->editor().setIgnoreCompositionSelectionChange(true);
</span><span class="cx"> frame->selection().setUpdateAppearanceEnabled(true);
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/ChangeLog        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-10-28 Brent Fulgham <bfulgham@apple.com>
+
+ Do a better job of protecting Frame objects in the context of JavaScript calls
+ https://bugs.webkit.org/show_bug.cgi?id=164163
+ <rdar://problem/28955249>
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
+ (WebKit::InjectedBundleRangeHandle::renderedImage): Protected the Frame.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::insertTextAsync): Ditto.
+ (WebKit::WebPage::setComposition): Ditto.
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::insertDictatedTextAsync): Ditto.
+
</ins><span class="cx"> 2016-10-21 David Kilzer <ddkilzer@apple.com>
</span><span class="cx">
</span><span class="cx"> Bug 163762: IntSize::area() should used checked arithmetic
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2WebProcessInjectedBundleDOMInjectedBundleRangeHandlecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010, 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -114,6 +114,8 @@
</span><span class="cx"> if (!frameView)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(*frame);
+
</ins><span class="cx"> VisibleSelection oldSelection = frame->selection().selection();
</span><span class="cx"> frame->selection().setSelection(VisibleSelection(*m_range));
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -4565,6 +4565,7 @@
</span><span class="cx"> {
</span><span class="cx"> Frame& frame = m_page->focusController().focusedOrMainFrame();
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(frame);
</ins><span class="cx"> if (replacementEditingRange.location != notFound) {
</span><span class="cx"> RefPtr<Range> replacementRange = rangeFromEditingRange(frame, replacementEditingRange, static_cast<EditingRangeIsRelativeTo>(editingRangeIsRelativeTo));
</span><span class="cx"> if (replacementRange)
</span><span class="lines">@@ -4727,6 +4728,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(*targetFrame);
+
</ins><span class="cx"> if (replacementLength > 0) {
</span><span class="cx"> // The layout needs to be uptodate before setting a selection
</span><span class="cx"> targetFrame->document()->updateLayout();
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebKit2WebProcessWebPagemacWebPageMacmm"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (210195 => 210196)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2016-12-28 10:37:07 UTC (rev 210195)
+++ releases/WebKitGTK/webkit-2.14/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2016-12-28 11:04:16 UTC (rev 210196)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2010, 2011, 2012, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2010-2012, 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -310,6 +310,8 @@
</span><span class="cx"> {
</span><span class="cx"> Frame& frame = m_page->focusController().focusedOrMainFrame();
</span><span class="cx">
</span><ins>+ Ref<Frame> protector(frame);
+
</ins><span class="cx"> if (replacementEditingRange.location != notFound) {
</span><span class="cx"> RefPtr<Range> replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
</span><span class="cx"> if (replacementRange)
</span></span></pre>
</div>
</div>
</body>
</html>