<!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>[287131] 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/287131">287131</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-12-16 06:52:10 -0800 (Thu, 16 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Mark range boundary point containers
https://bugs.webkit.org/show_bug.cgi?id=233462

Patch by Rob Buis <rbuis@igalia.com> on 2021-12-16
Reviewed by Darin Adler.

Source/WebCore:

Mark range boundary point containers as unreachable for gc.

Test: fast/dom/Range/delete-contents-crash.html

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSRangeCustom.cpp: Added.
(WebCore::JSRange::visitAdditionalChildren):
* dom/Range.cpp:
(WebCore::Range::visitNodesConcurrently const):
* dom/Range.h:
* dom/Range.idl:

LayoutTests:

* fast/dom/Range/delete-contents-crash-expected.txt: Added.
* fast/dom/Range/delete-contents-crash.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomRangecpp">trunk/Source/WebCore/dom/Range.cpp</a></li>
<li><a href="#trunkSourceWebCoredomRangeh">trunk/Source/WebCore/dom/Range.h</a></li>
<li><a href="#trunkSourceWebCoredomRangeidl">trunk/Source/WebCore/dom/Range.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomRangedeletecontentscrashexpectedtxt">trunk/LayoutTests/fast/dom/Range/delete-contents-crash-expected.txt</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSRangeCustomcpp">trunk/Source/WebCore/bindings/js/JSRangeCustom.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (287130 => 287131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-12-16 14:40:26 UTC (rev 287130)
+++ trunk/LayoutTests/ChangeLog 2021-12-16 14:52:10 UTC (rev 287131)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2021-12-16  Rob Buis  <rbuis@igalia.com>
+
+        Mark range boundary point containers
+        https://bugs.webkit.org/show_bug.cgi?id=233462
+
+        Reviewed by Darin Adler.
+
+        * fast/dom/Range/delete-contents-crash-expected.txt: Added.
+        * fast/dom/Range/delete-contents-crash.html: Added.
+
</ins><span class="cx"> 2021-12-16  Vitaly Dyachkov  <obyknovenius@me.com>
</span><span class="cx"> 
</span><span class="cx">         Flexbox ignores margins of absolute positioned children when `align-items: flex-end` or `justify-content: flex-end`
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomRangedeletecontentscrashexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/Range/delete-contents-crash-expected.txt (0 => 287131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Range/delete-contents-crash-expected.txt                              (rev 0)
+++ trunk/LayoutTests/fast/dom/Range/delete-contents-crash-expected.txt 2021-12-16 14:52:10 UTC (rev 287131)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS: Test did not crash.
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (287130 => 287131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-12-16 14:40:26 UTC (rev 287130)
+++ trunk/Source/WebCore/ChangeLog      2021-12-16 14:52:10 UTC (rev 287131)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2021-12-16  Rob Buis  <rbuis@igalia.com>
+
+        Mark range boundary point containers
+        https://bugs.webkit.org/show_bug.cgi?id=233462
+
+        Reviewed by Darin Adler.
+
+        Mark range boundary point containers as unreachable for gc.
+
+        Test: fast/dom/Range/delete-contents-crash.html
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSRangeCustom.cpp: Added.
+        (WebCore::JSRange::visitAdditionalChildren):
+        * dom/Range.cpp:
+        (WebCore::Range::visitNodesConcurrently const):
+        * dom/Range.h:
+        * dom/Range.idl:
+
</ins><span class="cx"> 2021-12-16  Alan Bujtas  <zalan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [LFC][IFC] Do not use inlineItemOffsets for checking if an inline item is a "content" type.
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (287130 => 287131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2021-12-16 14:40:26 UTC (rev 287130)
+++ trunk/Source/WebCore/Sources.txt    2021-12-16 14:52:10 UTC (rev 287131)
</span><span class="lines">@@ -590,6 +590,7 @@
</span><span class="cx"> bindings/js/JSPopStateEventCustom.cpp
</span><span class="cx"> bindings/js/JSPromiseRejectionEventCustom.cpp
</span><span class="cx"> bindings/js/JSRTCRtpSFrameTransformCustom.cpp
</span><ins>+bindings/js/JSRangeCustom.cpp
</ins><span class="cx"> bindings/js/JSReadableStreamSourceCustom.cpp
</span><span class="cx"> bindings/js/JSRemoteDOMWindowBase.cpp
</span><span class="cx"> bindings/js/JSRemoteDOMWindowCustom.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (287130 => 287131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2021-12-16 14:40:26 UTC (rev 287130)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2021-12-16 14:52:10 UTC (rev 287131)
</span><span class="lines">@@ -9059,6 +9059,7 @@
</span><span class="cx">          445612AB270F6F3800758C97 /* FragmentDirectiveParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FragmentDirectiveParser.h; sourceTree = "<group>"; };
</span><span class="cx">          445775E420472F73008DCE5D /* LocalDefaultSystemAppearance.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalDefaultSystemAppearance.h; sourceTree = "<group>"; };
</span><span class="cx">          445775E92047303B008DCE5D /* LocalDefaultSystemAppearance.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalDefaultSystemAppearance.mm; sourceTree = "<group>"; };
</span><ins>+               4469587A276B3A9000449C2D /* JSRangeCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSRangeCustom.cpp; sourceTree = "<group>"; };
</ins><span class="cx">           446DC64624A29D9B0061F390 /* PlaybackTargetClientContextIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlaybackTargetClientContextIdentifier.h; sourceTree = "<group>"; };
</span><span class="cx">          446EE4E8255E0D9200454463 /* LocalizableAdditions.strings.out */ = {isa = PBXFileReference; explicitFileType = text.plist.strings; fileEncoding = 4; name = LocalizableAdditions.strings.out; path = DerivedSources/WebCore/en.lproj/LocalizableAdditions.strings.out; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">          4471710B205AF945000A116E /* MediaQueryParserContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryParserContext.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -24705,6 +24706,7 @@
</span><span class="cx">                          CB38FD551CD21D5B00592A3F /* JSPerformanceEntryCustom.cpp */,
</span><span class="cx">                          833CF70F20DB3F5F00141BCC /* JSPerformanceObserverCustom.cpp */,
</span><span class="cx">                          A4A69B8BB91B49D0A804C31D /* JSPromiseRejectionEventCustom.cpp */,
</span><ins>+                               4469587A276B3A9000449C2D /* JSRangeCustom.cpp */,
</ins><span class="cx">                           5868C7C42539DA3300BF9DF3 /* JSResizeObserverCustom.cpp */,
</span><span class="cx">                          5884FE5622813E2D0040AFF6 /* JSResizeObserverEntryCustom.cpp */,
</span><span class="cx">                          83F572941FA1066F003837BE /* JSServiceWorkerClientCustom.cpp */,
</span><span class="lines">@@ -36153,6 +36155,7 @@
</span><span class="cx">                          312C0C41146DC6CC0016C911 /* Notification.h in Headers */,
</span><span class="cx">                          33503C9A10179A74003B47E1 /* NotificationClient.h in Headers */,
</span><span class="cx">                          3128CA6B147331630074C72A /* NotificationController.h in Headers */,
</span><ins>+                               51123E2F276940CA00F9D41B /* NotificationData.h in Headers */,
</ins><span class="cx">                           7CC2DE031ECA04A50027B774 /* NotificationDirection.h in Headers */,
</span><span class="cx">                          7CC2DDFB1EC9415A0027B774 /* NotificationPermission.h in Headers */,
</span><span class="cx">                          31FE6DFA15004C2A0004EBC4 /* NotificationPermissionCallback.h in Headers */,
</span><span class="lines">@@ -37066,7 +37069,6 @@
</span><span class="cx">                          7E474E1E12494DC900235364 /* SQLiteDatabaseTrackerClient.h in Headers */,
</span><span class="cx">                          B5A684220FFABE9800D24689 /* SQLiteFileSystem.h in Headers */,
</span><span class="cx">                          512BDB4B1C456FFA006494DF /* SQLiteIDBBackingStore.h in Headers */,
</span><del>-                               51123E2F276940CA00F9D41B /* NotificationData.h in Headers */,
</del><span class="cx">                           511EC1301C50ABF50032F983 /* SQLiteIDBCursor.h in Headers */,
</span><span class="cx">                          511EC12C1C50ABBF0032F983 /* SQLiteIDBTransaction.h in Headers */,
</span><span class="cx">                          1A22464C0CC98DDB00C05240 /* SQLiteStatement.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSRangeCustomcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/JSRangeCustom.cpp (0 => 287131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSRangeCustom.cpp                               (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSRangeCustom.cpp  2021-12-16 14:52:10 UTC (rev 287131)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2021 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSRange.h"
+
+#include "Range.h"
+
+namespace WebCore {
+
+template<typename Visitor>
+void JSRange::visitAdditionalChildren(Visitor& visitor)
+{
+    wrapped().visitNodesConcurrently(visitor);
+}
+
+DEFINE_VISIT_ADDITIONAL_CHILDREN(JSRange);
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoredomRangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.cpp (287130 => 287131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.cpp       2021-12-16 14:40:26 UTC (rev 287130)
+++ trunk/Source/WebCore/dom/Range.cpp  2021-12-16 14:52:10 UTC (rev 287131)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include "HTMLBodyElement.h"
</span><span class="cx"> #include "HTMLHtmlElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><ins>+#include "JSNode.h"
</ins><span class="cx"> #include "NodeTraversal.h"
</span><span class="cx"> #include "NodeWithIndex.h"
</span><span class="cx"> #include "ProcessingInstruction.h"
</span><span class="lines">@@ -1100,6 +1101,12 @@
</span><span class="cx">     return createLiveRange(*range);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Range::visitNodesConcurrently(JSC::AbstractSlotVisitor& visitor) const
+{
+    visitor.addOpaqueRoot(root(&m_start.container()));
+    visitor.addOpaqueRoot(root(&m_end.container()));
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TREE_DEBUGGING)
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.h (287130 => 287131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.h 2021-12-16 14:40:26 UTC (rev 287130)
+++ trunk/Source/WebCore/dom/Range.h    2021-12-16 14:52:10 UTC (rev 287131)
</span><span class="lines">@@ -115,6 +115,8 @@
</span><span class="cx">     String debugDescription() const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void visitNodesConcurrently(JSC::AbstractSlotVisitor&) const;
+
</ins><span class="cx">     enum ActionType : uint8_t { Delete, Extract, Clone };
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.idl (287130 => 287131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.idl       2021-12-16 14:40:26 UTC (rev 287130)
+++ trunk/Source/WebCore/dom/Range.idl  2021-12-16 14:52:10 UTC (rev 287131)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx">     GenerateIsReachable=ReachableFromDOMWindow,
</span><span class="cx">     ExportMacro=WEBCORE_EXPORT,
</span><span class="cx">     Exposed=Window,
</span><ins>+    JSCustomMarkFunction,
</ins><span class="cx">     JSGenerateToNativeObject,
</span><span class="cx"> ] interface Range : AbstractRange {
</span><span class="cx">     [CallWith=Document] constructor();
</span></span></pre>
</div>
</div>

</body>
</html>