Skip to content

Commit 1ccfc65

Browse files
[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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@226612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 53b62df commit 1ccfc65

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

Source/WebCore/ChangeLog

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2018-01-08 Wenson Hsieh <[email protected]>
2+
3+
[Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
4+
https://bugs.webkit.org/show_bug.cgi?id=181420
5+
<rdar://problem/36365827>
6+
7+
Reviewed by Alex Christensen.
8+
9+
Add a new IDL definition for uniqueIdentifier on HTMLAttachmentElement. This allows clients to relate attachment
10+
elements in the DOM to _WKAttachments delivered via Objective-C SPI.
11+
12+
Adjusted existing tests in WKAttachmentTests.
13+
14+
* html/HTMLAttachmentElement.idl:
15+
116
2018-01-08 Don Olmstead <[email protected]>
217

318
AccessibilityARIAGrid does not compile when accessibility is disabled

Source/WebCore/html/HTMLAttachmentElement.idl

+1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@
2828
EnabledAtRuntime=AttachmentElement,
2929
] interface HTMLAttachmentElement : HTMLElement {
3030
attribute File? file;
31+
readonly attribute DOMString uniqueIdentifier;
3132
};

Tools/ChangeLog

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2018-01-08 Wenson Hsieh <[email protected]>
2+
3+
[Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
4+
https://bugs.webkit.org/show_bug.cgi?id=181420
5+
<rdar://problem/36365827>
6+
7+
Reviewed by Alex Christensen.
8+
9+
Adjusts some existing API tests to verify that attachment elements' uniqueIdentifiers match the uniqueIdentifier
10+
of corresponding _WKAttachments.
11+
12+
* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
13+
(TestWebKitAPI::TEST):
14+
115
2018-01-08 Alex Christensen <[email protected]>
216

317
Add WKNavigationDelegate SPI exposing WebProcess crash reason

Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm

+10
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ void platformCopyPNG()
570570
EXPECT_FALSE([webView hasAttribute:@"webkitattachmentbloburl" forQuerySelector:@"attachment"]);
571571
EXPECT_FALSE([webView hasAttribute:@"webkitattachmentpath" forQuerySelector:@"attachment"]);
572572
EXPECT_FALSE([webView hasAttribute:@"webkitattachmentid" forQuerySelector:@"attachment"]);
573+
EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
573574
{
574575
ObserveAttachmentUpdatesForScope observer(webView.get());
575576
[webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').remove()"];
@@ -589,6 +590,7 @@ void platformCopyPNG()
589590
observer.expectAttachmentUpdates(@[], @[attachment.get()]);
590591
}
591592
[attachment expectRequestedDataToBe:testHTMLData()];
593+
EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
592594
[webView _synchronouslyExecuteEditCommand:@"SelectAll" argument:nil];
593595
{
594596
ObserveAttachmentUpdatesForScope observer(webView.get());
@@ -617,6 +619,7 @@ void platformCopyPNG()
617619
observer.expectAttachmentUpdates(@[], @[attachment.get()]);
618620
}
619621
[attachment expectRequestedDataToBe:[NSData data]];
622+
EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
620623
{
621624
ObserveAttachmentUpdatesForScope scope(webView.get());
622625
[webView _synchronouslyExecuteEditCommand:@"DeleteBackward" argument:nil];
@@ -697,6 +700,7 @@ void platformCopyPNG()
697700
[webView expectUpdatesAfterCommand:@"DeleteBackward" withArgument:nil expectedRemovals:@[] expectedInsertions:@[]];
698701

699702
[attachment expectRequestedDataToBe:imageData.get()];
703+
EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
700704
[webView waitForAttachmentElementSizeToBecome:CGSizeMake(215, 174)];
701705

702706
[webView expectUpdatesAfterCommand:@"DeleteForward" withArgument:nil expectedRemovals:@[attachment.get()] expectedInsertions:@[]];
@@ -843,6 +847,7 @@ void platformCopyPNG()
843847
auto size = platformImageWithData([attachment synchronouslyRequestData:nil]).size;
844848
EXPECT_EQ(215., size.width);
845849
EXPECT_EQ(174., size.height);
850+
EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
846851

847852
{
848853
ObserveAttachmentUpdatesForScope observer(webView.get());
@@ -869,6 +874,7 @@ void platformCopyPNG()
869874
[attachment expectRequestedDataToBe:testImageData()];
870875
EXPECT_WK_STREQ("Lorem ipsum dolor sit amet.", [webView stringByEvaluatingJavaScript:@"document.body.textContent"]);
871876
EXPECT_WK_STREQ("image/png", [webView valueOfAttribute:@"type" forQuerySelector:@"attachment"]);
877+
EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelector('attachment').uniqueIdentifier"]);
872878

873879
{
874880
ObserveAttachmentUpdatesForScope observer(webView.get());
@@ -914,6 +920,10 @@ void platformCopyPNG()
914920
EXPECT_WK_STREQ("application/octet-stream", zipAttachmentType);
915921
#endif
916922

923+
EXPECT_WK_STREQ([imageAttachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[0].uniqueIdentifier"]);
924+
EXPECT_WK_STREQ([pdfAttachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[1].uniqueIdentifier"]);
925+
EXPECT_WK_STREQ([zipAttachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[2].uniqueIdentifier"]);
926+
917927
{
918928
ObserveAttachmentUpdatesForScope observer(webView.get());
919929
[webView _synchronouslyExecuteEditCommand:@"SelectAll" argument:nil];

0 commit comments

Comments
 (0)