Title: [226612] trunk
Revision
226612
Author
wenson_hs...@apple.com
Date
2018-01-08 20:08:21 -0800 (Mon, 08 Jan 2018)

Log Message

[Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
https://bugs.webkit.org/show_bug.cgi?id=181420
<rdar://problem/36365827>

Reviewed by Alex Christensen.

Source/WebCore:

Add a new IDL definition for uniqueIdentifier on HTMLAttachmentElement. This allows clients to relate attachment
elements in the DOM to _WKAttachments delivered via Objective-C SPI.

Adjusted existing tests in WKAttachmentTests.

* html/HTMLAttachmentElement.idl:

Tools:

Adjusts some existing API tests to verify that attachment elements' uniqueIdentifiers match the uniqueIdentifier
of corresponding _WKAttachments.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (226611 => 226612)


--- trunk/Source/WebCore/ChangeLog	2018-01-09 03:52:49 UTC (rev 226611)
+++ trunk/Source/WebCore/ChangeLog	2018-01-09 04:08:21 UTC (rev 226612)
@@ -1,3 +1,18 @@
+2018-01-08  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
+        https://bugs.webkit.org/show_bug.cgi?id=181420
+        <rdar://problem/36365827>
+
+        Reviewed by Alex Christensen.
+
+        Add a new IDL definition for uniqueIdentifier on HTMLAttachmentElement. This allows clients to relate attachment
+        elements in the DOM to _WKAttachments delivered via Objective-C SPI.
+
+        Adjusted existing tests in WKAttachmentTests.
+
+        * html/HTMLAttachmentElement.idl:
+
 2018-01-08  Don Olmstead  <don.olmst...@sony.com>
 
         AccessibilityARIAGrid does not compile when accessibility is disabled

Modified: trunk/Source/WebCore/html/HTMLAttachmentElement.idl (226611 => 226612)


--- trunk/Source/WebCore/html/HTMLAttachmentElement.idl	2018-01-09 03:52:49 UTC (rev 226611)
+++ trunk/Source/WebCore/html/HTMLAttachmentElement.idl	2018-01-09 04:08:21 UTC (rev 226612)
@@ -28,4 +28,5 @@
     EnabledAtRuntime=AttachmentElement,
 ] interface HTMLAttachmentElement : HTMLElement {
     attribute File? file;
+    readonly attribute DOMString uniqueIdentifier;
 };

Modified: trunk/Tools/ChangeLog (226611 => 226612)


--- trunk/Tools/ChangeLog	2018-01-09 03:52:49 UTC (rev 226611)
+++ trunk/Tools/ChangeLog	2018-01-09 04:08:21 UTC (rev 226612)
@@ -1,3 +1,17 @@
+2018-01-08  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
+        https://bugs.webkit.org/show_bug.cgi?id=181420
+        <rdar://problem/36365827>
+
+        Reviewed by Alex Christensen.
+
+        Adjusts some existing API tests to verify that attachment elements' uniqueIdentifiers match the uniqueIdentifier
+        of corresponding _WKAttachments.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
+        (TestWebKitAPI::TEST):
+
 2018-01-08  Alex Christensen  <achristen...@webkit.org>
 
         Add WKNavigationDelegate SPI exposing WebProcess crash reason

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm (226611 => 226612)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm	2018-01-09 03:52:49 UTC (rev 226611)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm	2018-01-09 04:08:21 UTC (rev 226612)
@@ -570,6 +570,7 @@
     EXPECT_FALSE([webView hasAttribute:@"webkitattachmentbloburl" forQuerySelector:@"attachment"]);
     EXPECT_FALSE([webView hasAttribute:@"webkitattachmentpath" forQuerySelector:@"attachment"]);
     EXPECT_FALSE([webView hasAttribute:@"webkitattachmentid" forQuerySelector:@"attachment"]);
+    EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
     {
         ObserveAttachmentUpdatesForScope observer(webView.get());
         [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').remove()"];
@@ -589,6 +590,7 @@
         observer.expectAttachmentUpdates(@[], @[attachment.get()]);
     }
     [attachment expectRequestedDataToBe:testHTMLData()];
+    EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
     [webView _synchronouslyExecuteEditCommand:@"SelectAll" argument:nil];
     {
         ObserveAttachmentUpdatesForScope observer(webView.get());
@@ -617,6 +619,7 @@
         observer.expectAttachmentUpdates(@[], @[attachment.get()]);
     }
     [attachment expectRequestedDataToBe:[NSData data]];
+    EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
     {
         ObserveAttachmentUpdatesForScope scope(webView.get());
         [webView _synchronouslyExecuteEditCommand:@"DeleteBackward" argument:nil];
@@ -697,6 +700,7 @@
     [webView expectUpdatesAfterCommand:@"DeleteBackward" withArgument:nil expectedRemovals:@[] expectedInsertions:@[]];
 
     [attachment expectRequestedDataToBe:imageData.get()];
+    EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
     [webView waitForAttachmentElementSizeToBecome:CGSizeMake(215, 174)];
 
     [webView expectUpdatesAfterCommand:@"DeleteForward" withArgument:nil expectedRemovals:@[attachment.get()] expectedInsertions:@[]];
@@ -843,6 +847,7 @@
     auto size = platformImageWithData([attachment synchronouslyRequestData:nil]).size;
     EXPECT_EQ(215., size.width);
     EXPECT_EQ(174., size.height);
+    EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
 
     {
         ObserveAttachmentUpdatesForScope observer(webView.get());
@@ -869,6 +874,7 @@
     [attachment expectRequestedDataToBe:testImageData()];
     EXPECT_WK_STREQ("Lorem ipsum  dolor sit amet.", [webView stringByEvaluatingJavaScript:@"document.body.textContent"]);
     EXPECT_WK_STREQ("image/png", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]);
+    EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
 
     {
         ObserveAttachmentUpdatesForScope observer(webView.get());
@@ -914,6 +920,10 @@
     EXPECT_WK_STREQ("application/octet-stream", zipAttachmentType);
 #endif
 
+    EXPECT_WK_STREQ([imageAttachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[0].uniqueIdentifier"]);
+    EXPECT_WK_STREQ([pdfAttachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[1].uniqueIdentifier"]);
+    EXPECT_WK_STREQ([zipAttachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[2].uniqueIdentifier"]);
+
     {
         ObserveAttachmentUpdatesForScope observer(webView.get());
         [webView _synchronouslyExecuteEditCommand:@"SelectAll" argument:nil];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to