Title: [287131] trunk
Revision
287131
Author
[email protected]
Date
2021-12-16 06:52:10 -0800 (Thu, 16 Dec 2021)

Log Message

Mark range boundary point containers
https://bugs.webkit.org/show_bug.cgi?id=233462

Patch by Rob Buis <[email protected]> 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287130 => 287131)


--- trunk/LayoutTests/ChangeLog	2021-12-16 14:40:26 UTC (rev 287130)
+++ trunk/LayoutTests/ChangeLog	2021-12-16 14:52:10 UTC (rev 287131)
@@ -1,3 +1,13 @@
+2021-12-16  Rob Buis  <[email protected]>
+
+        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.
+
 2021-12-16  Vitaly Dyachkov  <[email protected]>
 
         Flexbox ignores margins of absolute positioned children when `align-items: flex-end` or `justify-content: flex-end`

Added: trunk/LayoutTests/fast/dom/Range/delete-contents-crash-expected.txt (0 => 287131)


--- 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)
@@ -0,0 +1 @@
+PASS: Test did not crash.

Modified: trunk/Source/WebCore/ChangeLog (287130 => 287131)


--- 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)
@@ -1,3 +1,23 @@
+2021-12-16  Rob Buis  <[email protected]>
+
+        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:
+
 2021-12-16  Alan Bujtas  <[email protected]>
 
         [LFC][IFC] Do not use inlineItemOffsets for checking if an inline item is a "content" type.

Modified: trunk/Source/WebCore/Sources.txt (287130 => 287131)


--- 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)
@@ -590,6 +590,7 @@
 bindings/js/JSPopStateEventCustom.cpp
 bindings/js/JSPromiseRejectionEventCustom.cpp
 bindings/js/JSRTCRtpSFrameTransformCustom.cpp
+bindings/js/JSRangeCustom.cpp
 bindings/js/JSReadableStreamSourceCustom.cpp
 bindings/js/JSRemoteDOMWindowBase.cpp
 bindings/js/JSRemoteDOMWindowCustom.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (287130 => 287131)


--- 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)
@@ -9059,6 +9059,7 @@
 		445612AB270F6F3800758C97 /* FragmentDirectiveParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FragmentDirectiveParser.h; sourceTree = "<group>"; };
 		445775E420472F73008DCE5D /* LocalDefaultSystemAppearance.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalDefaultSystemAppearance.h; sourceTree = "<group>"; };
 		445775E92047303B008DCE5D /* LocalDefaultSystemAppearance.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalDefaultSystemAppearance.mm; sourceTree = "<group>"; };
+		4469587A276B3A9000449C2D /* JSRangeCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSRangeCustom.cpp; sourceTree = "<group>"; };
 		446DC64624A29D9B0061F390 /* PlaybackTargetClientContextIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlaybackTargetClientContextIdentifier.h; sourceTree = "<group>"; };
 		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; };
 		4471710B205AF945000A116E /* MediaQueryParserContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryParserContext.cpp; sourceTree = "<group>"; };
@@ -24705,6 +24706,7 @@
 				CB38FD551CD21D5B00592A3F /* JSPerformanceEntryCustom.cpp */,
 				833CF70F20DB3F5F00141BCC /* JSPerformanceObserverCustom.cpp */,
 				A4A69B8BB91B49D0A804C31D /* JSPromiseRejectionEventCustom.cpp */,
+				4469587A276B3A9000449C2D /* JSRangeCustom.cpp */,
 				5868C7C42539DA3300BF9DF3 /* JSResizeObserverCustom.cpp */,
 				5884FE5622813E2D0040AFF6 /* JSResizeObserverEntryCustom.cpp */,
 				83F572941FA1066F003837BE /* JSServiceWorkerClientCustom.cpp */,
@@ -36153,6 +36155,7 @@
 				312C0C41146DC6CC0016C911 /* Notification.h in Headers */,
 				33503C9A10179A74003B47E1 /* NotificationClient.h in Headers */,
 				3128CA6B147331630074C72A /* NotificationController.h in Headers */,
+				51123E2F276940CA00F9D41B /* NotificationData.h in Headers */,
 				7CC2DE031ECA04A50027B774 /* NotificationDirection.h in Headers */,
 				7CC2DDFB1EC9415A0027B774 /* NotificationPermission.h in Headers */,
 				31FE6DFA15004C2A0004EBC4 /* NotificationPermissionCallback.h in Headers */,
@@ -37066,7 +37069,6 @@
 				7E474E1E12494DC900235364 /* SQLiteDatabaseTrackerClient.h in Headers */,
 				B5A684220FFABE9800D24689 /* SQLiteFileSystem.h in Headers */,
 				512BDB4B1C456FFA006494DF /* SQLiteIDBBackingStore.h in Headers */,
-				51123E2F276940CA00F9D41B /* NotificationData.h in Headers */,
 				511EC1301C50ABF50032F983 /* SQLiteIDBCursor.h in Headers */,
 				511EC12C1C50ABBF0032F983 /* SQLiteIDBTransaction.h in Headers */,
 				1A22464C0CC98DDB00C05240 /* SQLiteStatement.h in Headers */,

Added: trunk/Source/WebCore/bindings/js/JSRangeCustom.cpp (0 => 287131)


--- 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)
@@ -0,0 +1,41 @@
+/*
+ * 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

Modified: trunk/Source/WebCore/dom/Range.cpp (287130 => 287131)


--- 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)
@@ -38,6 +38,7 @@
 #include "HTMLBodyElement.h"
 #include "HTMLHtmlElement.h"
 #include "HTMLNames.h"
+#include "JSNode.h"
 #include "NodeTraversal.h"
 #include "NodeWithIndex.h"
 #include "ProcessingInstruction.h"
@@ -1100,6 +1101,12 @@
     return createLiveRange(*range);
 }
 
+void Range::visitNodesConcurrently(JSC::AbstractSlotVisitor& visitor) const
+{
+    visitor.addOpaqueRoot(root(&m_start.container()));
+    visitor.addOpaqueRoot(root(&m_end.container()));
+}
+
 } // namespace WebCore
 
 #if ENABLE(TREE_DEBUGGING)

Modified: trunk/Source/WebCore/dom/Range.h (287130 => 287131)


--- 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)
@@ -115,6 +115,8 @@
     String debugDescription() const;
 #endif
 
+    void visitNodesConcurrently(JSC::AbstractSlotVisitor&) const;
+
     enum ActionType : uint8_t { Delete, Extract, Clone };
 
 private:

Modified: trunk/Source/WebCore/dom/Range.idl (287130 => 287131)


--- 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)
@@ -22,6 +22,7 @@
     GenerateIsReachable=ReachableFromDOMWindow,
     ExportMacro=WEBCORE_EXPORT,
     Exposed=Window,
+    JSCustomMarkFunction,
     JSGenerateToNativeObject,
 ] interface Range : AbstractRange {
     [CallWith=Document] constructor();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to