RESOLVED FIXED 238473
HTMLAttachmentElement.getAttachmentIdentifier() should propagate attachment data to the client
https://bugs.webkit.org/show_bug.cgi?id=238473
Summary HTMLAttachmentElement.getAttachmentIdentifier() should propagate attachment d...
Wenson Hsieh
Reported 2022-03-28 15:48:12 PDT
..in the case where the attachment element is newly created. rdar://90938796
Attachments
Patch (10.01 KB, patch)
2022-03-28 16:16 PDT, Wenson Hsieh
no flags
For EWS (10.02 KB, patch)
2022-03-28 17:08 PDT, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2022-03-28 16:16:10 PDT
Devin Rousso
Comment 2 2022-03-28 16:33:30 PDT
Comment on attachment 455966 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=455966&action=review r=me > Source/WebCore/editing/Editor.cpp:4233 > + auto& [contentType, preferredFileName, data] = *attachmentInfo; > + client->registerAttachmentIdentifier(identifier, contentType, preferredFileName, WTFMove(data)); NIT: Should these all also be `WTFMove` since that's what's done in the IIFE above? > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:1736 > + NSString *asyncScript = @"return await new Promise(resolve => {" NIT: Is the `await` actually needed?
Wenson Hsieh
Comment 3 2022-03-28 16:39:21 PDT
(In reply to Devin Rousso from comment #2) > Comment on attachment 455966 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=455966&action=review > > r=me > > > Source/WebCore/editing/Editor.cpp:4233 > > + auto& [contentType, preferredFileName, data] = *attachmentInfo; > > + client->registerAttachmentIdentifier(identifier, contentType, preferredFileName, WTFMove(data)); > > NIT: Should these all also be `WTFMove` since that's what's done in the IIFE > above? I'm not sure. `registerAttachmentIdentifier` takes `const String&` anyways, so I just destructured `attachmentInfo` by reference and passed the results to `registerAttachmentIdentifier`. I guess there's no harm in using WTFMove here. > > > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:1736 > > + NSString *asyncScript = @"return await new Promise(resolve => {" > > NIT: Is the `await` actually needed? Good point. It looks like `-callAsyncJavaScript:` automatically awaits in the case where the script returns a Promise.
Wenson Hsieh
Comment 4 2022-03-28 17:08:36 PDT
EWS
Comment 5 2022-03-29 08:49:44 PDT
Committed r292032 (248975@main): <https://commits.webkit.org/248975@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 455972 [details].
Note You need to log in before you can comment on or make changes to this bug.