Title: [261037] trunk/Tools
Revision
261037
Author
[email protected]
Date
2020-05-01 16:12:07 -0700 (Fri, 01 May 2020)

Log Message

Add a test for webkit.org/b/211311
https://bugs.webkit.org/show_bug.cgi?id=211319
<rdar://problem/62663459>

Reviewed by Tim Horton.

Exercise the crash fixed in r261017 with a new API test that loads a page and then uses
`-[WebHTMLView attributedSubstringFromRange:]` to try and grab the contents of the page as an attributed string.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/AttributedString.mm:
(TestWebKitAPI::AttributedStringTest_NewlineAtEndOfDocument::didLoadURL):
(TestWebKitAPI::AttributedStringTest_NewlineAtEndOfDocument::url const):
(TestWebKitAPI::AttributedStringTest_NewlineAtEndOfDocument::runSyncTest):
* TestWebKitAPI/Tests/mac/attributedStringNewlineAtEndOfDocument.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (261036 => 261037)


--- trunk/Tools/ChangeLog	2020-05-01 23:07:38 UTC (rev 261036)
+++ trunk/Tools/ChangeLog	2020-05-01 23:12:07 UTC (rev 261037)
@@ -1,3 +1,21 @@
+2020-05-01  Wenson Hsieh  <[email protected]>
+
+        Add a test for webkit.org/b/211311
+        https://bugs.webkit.org/show_bug.cgi?id=211319
+        <rdar://problem/62663459>
+
+        Reviewed by Tim Horton.
+
+        Exercise the crash fixed in r261017 with a new API test that loads a page and then uses
+        `-[WebHTMLView attributedSubstringFromRange:]` to try and grab the contents of the page as an attributed string.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/mac/AttributedString.mm:
+        (TestWebKitAPI::AttributedStringTest_NewlineAtEndOfDocument::didLoadURL):
+        (TestWebKitAPI::AttributedStringTest_NewlineAtEndOfDocument::url const):
+        (TestWebKitAPI::AttributedStringTest_NewlineAtEndOfDocument::runSyncTest):
+        * TestWebKitAPI/Tests/mac/attributedStringNewlineAtEndOfDocument.html: Added.
+
 2020-05-01  Per Arne Vollan  <[email protected]>
 
         [iOS] Every running WebContent process should be granted access to frontboard services when Accessibility is enabled

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (261036 => 261037)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2020-05-01 23:07:38 UTC (rev 261036)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2020-05-01 23:12:07 UTC (rev 261037)
@@ -1054,6 +1054,7 @@
 		F41AB9AA1EF4696B0083FA08 /* textarea-to-input.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F41AB9951EF4692C0083FA08 /* textarea-to-input.html */; };
 		F422A3E9235ACA9B00CF00CA /* ClipboardTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F422A3E8235ACA9B00CF00CA /* ClipboardTests.mm */; };
 		F422A3EB235BB16200CF00CA /* clipboard.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F422A3EA235BB14500CF00CA /* clipboard.html */; };
+		F42BD7D9245CC508001E207A /* attributedStringNewlineAtEndOfDocument.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42BD7D8245CC4E6001E207A /* attributedStringNewlineAtEndOfDocument.html */; };
 		F42D634422A1729F00D2FB3A /* AutocorrectionTestsIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = F42D634322A1729F00D2FB3A /* AutocorrectionTestsIOS.mm */; };
 		F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */; };
 		F434CA1A22E65BCA005DDB26 /* ScrollToRevealSelection.mm in Sources */ = {isa = PBXBuildFile; fileRef = F434CA1922E65BCA005DDB26 /* ScrollToRevealSelection.mm */; };
@@ -1230,6 +1231,7 @@
 				11C2598D21FA6324004C9E23 /* async-script-load.html in Copy Resources */,
 				F4856CA31E649EA8009D7EE7 /* attachment-element.html in Copy Resources */,
 				B55F11B71517D03300915916 /* attributedStringCustomFont.html in Copy Resources */,
+				F42BD7D9245CC508001E207A /* attributedStringNewlineAtEndOfDocument.html in Copy Resources */,
 				7C9ED98B17A19F4B00E4DC33 /* attributedStringStrikethrough.html in Copy Resources */,
 				37137E4B21124D01002BEEA4 /* AttrStyle.html in Copy Resources */,
 				CD9E292E1C90C33F000BB800 /* audio-only.html in Copy Resources */,
@@ -2687,6 +2689,7 @@
 		F41AB99E1EF4692C0083FA08 /* div-and-large-image.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "div-and-large-image.html"; sourceTree = "<group>"; };
 		F422A3E8235ACA9B00CF00CA /* ClipboardTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ClipboardTests.mm; sourceTree = "<group>"; };
 		F422A3EA235BB14500CF00CA /* clipboard.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = clipboard.html; sourceTree = "<group>"; };
+		F42BD7D8245CC4E6001E207A /* attributedStringNewlineAtEndOfDocument.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = attributedStringNewlineAtEndOfDocument.html; sourceTree = "<group>"; };
 		F42D634322A1729F00D2FB3A /* AutocorrectionTestsIOS.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AutocorrectionTestsIOS.mm; sourceTree = "<group>"; };
 		F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "large-input-field-focus-onload.html"; path = "Tests/WebKitCocoa/large-input-field-focus-onload.html"; sourceTree = SOURCE_ROOT; };
 		F434CA1922E65BCA005DDB26 /* ScrollToRevealSelection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollToRevealSelection.mm; sourceTree = "<group>"; };
@@ -4252,6 +4255,7 @@
 				379028B814FABE49007E6B43 /* acceptsFirstMouse.html */,
 				725C3EF2220584BA007C36FC /* AdditionalSupportedImageTypes.html */,
 				B55F11B01517A2C400915916 /* attributedStringCustomFont.html */,
+				F42BD7D8245CC4E6001E207A /* attributedStringNewlineAtEndOfDocument.html */,
 				7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */,
 				26DF5A6115A2A22B003689C2 /* CancelLoadFromResourceLoadDelegate.html */,
 				5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */,

Modified: trunk/Tools/TestWebKitAPI/Tests/mac/AttributedString.mm (261036 => 261037)


--- trunk/Tools/TestWebKitAPI/Tests/mac/AttributedString.mm	2020-05-01 23:07:38 UTC (rev 261036)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/AttributedString.mm	2020-05-01 23:12:07 UTC (rev 261037)
@@ -92,4 +92,25 @@
     runWebKit1Test();
 }
 
+class AttributedStringTest_NewlineAtEndOfDocument : public WebKitAgnosticTest {
+public:
+    template <typename View> void runSyncTest(View);
+
+    virtual void didLoadURL(WebView *webView) { runSyncTest(webView); }
+    virtual void didLoadURL(WKView *wkView) { }
+
+    virtual NSURL *url() const { return [[NSBundle mainBundle] URLForResource:@"attributedStringNewlineAtEndOfDocument" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; }
+};
+
+template <typename View>
+void AttributedStringTest_NewlineAtEndOfDocument::runSyncTest(View view)
+{
+    EXPECT_WK_STREQ("a\n", attributedString(view, NSMakeRange(0, 2)).string);
+}
+
+TEST_F(AttributedStringTest_NewlineAtEndOfDocument, WebKit)
+{
+    runWebKit1Test();
+}
+
 } // namespace TestWebKitAPI

Added: trunk/Tools/TestWebKitAPI/Tests/mac/attributedStringNewlineAtEndOfDocument.html (0 => 261037)


--- trunk/Tools/TestWebKitAPI/Tests/mac/attributedStringNewlineAtEndOfDocument.html	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/attributedStringNewlineAtEndOfDocument.html	2020-05-01 23:12:07 UTC (rev 261037)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<body contenteditable>
+   <div>a</div>
+   <div id='target'>
+       <br>
+   </div>
+   <script>getSelection().setPosition(target);</script>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to