RESOLVED FIXED 225636
Allow logging minimal info about sending media files through XMLHttpRequest
https://bugs.webkit.org/show_bug.cgi?id=225636
Summary Allow logging minimal info about sending media files through XMLHttpRequest
Said Abou-Hallawa
Reported 2021-05-10 22:26:57 PDT
Some files may be uploaded from JavaScript through XMLHttpRequest. We need to handle this case as we did for HTMLFormElement::submit in r275103.
Attachments
Patch (7.58 KB, patch)
2021-05-11 00:24 PDT, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (7.59 KB, patch)
2021-05-11 00:34 PDT, Said Abou-Hallawa
no flags
Patch (7.62 KB, patch)
2021-05-11 11:29 PDT, Said Abou-Hallawa
no flags
Patch (8.45 KB, patch)
2021-05-14 20:21 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2021-05-11 00:23:17 PDT
Said Abou-Hallawa
Comment 2 2021-05-11 00:24:09 PDT
Said Abou-Hallawa
Comment 3 2021-05-11 00:34:31 PDT
Said Abou-Hallawa
Comment 4 2021-05-11 11:29:17 PDT
Alex Christensen
Comment 5 2021-05-12 11:24:34 PDT
Comment on attachment 428302 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428302&action=review > Source/WebCore/html/HTMLFormElement.cpp:408 > + document().page()->logSubmittedImageOrMediaFiles(imageOrMediaFilesCount); Let's null check page: if (auto* page = document().page()) page->... > Source/WebCore/page/Page.cpp:1056 > +void Page::logSubmittedImageOrMediaFiles(unsigned imageOrMediaFilesCount) Why don't we just make one function and pass a FormData& as a parameter instead of one function to count then another function to log? > Source/WebCore/xml/XMLHttpRequest.cpp:549 > + if (auto page = scriptExecutionContext()->isDocument() ? document()->page() : nullptr) auto* It's also not great to introduce code in XHR that only works in document context. This fixes another case of unreported FormData uploading, but workers are the next case and fetch is probably the one after that. This might be nicer in a more central location, like if we added a request parameter to addParametersShared and checked its HTTP body there, instead of one in HTMLFormElement and one in xhr.
Said Abou-Hallawa
Comment 6 2021-05-14 20:21:07 PDT
Said Abou-Hallawa
Comment 7 2021-05-15 13:44:37 PDT
Comment on attachment 428302 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428302&action=review >> Source/WebCore/xml/XMLHttpRequest.cpp:549 >> + if (auto page = scriptExecutionContext()->isDocument() ? document()->page() : nullptr) > > auto* > > It's also not great to introduce code in XHR that only works in document context. This fixes another case of unreported FormData uploading, but workers are the next case and fetch is probably the one after that. This might be nicer in a more central location, like if we added a request parameter to addParametersShared and checked its HTTP body there, instead of one in HTMLFormElement and one in xhr. This is a great idea. I was looking for a common place for all file uploading but I could not find one because I was looking for it in WebCore. I added the logging in addParametersShared().
EWS
Comment 8 2021-05-18 11:48:56 PDT
Committed r277666 (237868@main): <https://commits.webkit.org/237868@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 428703 [details].
Note You need to log in before you can comment on or make changes to this bug.