RESOLVED FIXED 227821
Revoking Blob URL after calling XMLHttpRequest::open() causes the XHR to fail
https://bugs.webkit.org/show_bug.cgi?id=227821
Summary Revoking Blob URL after calling XMLHttpRequest::open() causes the XHR to fail
Chris Dumez
Reported 2021-07-08 16:13:15 PDT
Revoking Blob URL after calling XMLHttpRequest::open() causes the XHR to fail. This doesn't match the behavior of other browsers and is causing WebKit to fail one of the subtests on: - http://wpt.live/FileAPI/url/url-with-xhr.any.html
Attachments
Patch (15.00 KB, patch)
2021-07-08 16:20 PDT, Chris Dumez
no flags
Patch (14.96 KB, patch)
2021-07-09 14:23 PDT, Chris Dumez
no flags
Patch (14.96 KB, patch)
2021-07-09 14:25 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2021-07-08 16:20:37 PDT
youenn fablet
Comment 2 2021-07-09 13:38:55 PDT
Comment on attachment 433182 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=433182&action=review > Source/WebCore/xml/XMLHttpRequest.cpp:121 > + , m_url(makeUniqueRef<BlobURLLifeTimeExtender>()) We are doing an allocation for no good reason here. I think it would look better if we had a separate BlobURLLifeTimeExtender that can happen to be null if URL is not a blob. Also, we could probably try to nullify the blob life time extender as soon as we do not need it, maybe when clearing the request for instance. > Source/WebCore/xml/XMLHttpRequest.h:219 > + UniqueRef<BlobURLLifeTimeExtender> m_url; It is a bit odd for BlobURLLifeTimeExtender to be called m_url.
Chris Dumez
Comment 3 2021-07-09 13:41:27 PDT
(In reply to youenn fablet from comment #2) > Comment on attachment 433182 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=433182&action=review > > > Source/WebCore/xml/XMLHttpRequest.cpp:121 > > + , m_url(makeUniqueRef<BlobURLLifeTimeExtender>()) > > We are doing an allocation for no good reason here. > I think it would look better if we had a separate BlobURLLifeTimeExtender > that can happen to be null if URL is not a blob. > Also, we could probably try to nullify the blob life time extender as soon > as we do not need it, maybe when clearing the request for instance. I initially had a separate data member to extend the lifetime of the blob URL. However, this is error prone and we need to make sure we update it whenever m_url gets updated. > > Source/WebCore/xml/XMLHttpRequest.h:219 > > + UniqueRef<BlobURLLifeTimeExtender> m_url; > > It is a bit odd for BlobURLLifeTimeExtender to be called m_url. Sure, we can rename it but it does store a URL.
Chris Dumez
Comment 4 2021-07-09 14:00:11 PDT
(In reply to Chris Dumez from comment #3) > (In reply to youenn fablet from comment #2) > > Comment on attachment 433182 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=433182&action=review > > > > > Source/WebCore/xml/XMLHttpRequest.cpp:121 > > > + , m_url(makeUniqueRef<BlobURLLifeTimeExtender>()) > > > > We are doing an allocation for no good reason here. > > I think it would look better if we had a separate BlobURLLifeTimeExtender > > that can happen to be null if URL is not a blob. > > Also, we could probably try to nullify the blob life time extender as soon > > as we do not need it, maybe when clearing the request for instance. > > I initially had a separate data member to extend the lifetime of the blob > URL. However, this is error prone and we need to make sure we update it > whenever m_url gets updated. > > > > Source/WebCore/xml/XMLHttpRequest.h:219 > > > + UniqueRef<BlobURLLifeTimeExtender> m_url; > > > > It is a bit odd for BlobURLLifeTimeExtender to be called m_url. > > Sure, we can rename it but it does store a URL. Maybe if I rename BlobURLLifeTimeExtender to URLWithBlobURLLifetimeExtension and add an assignment operator, then it will be clearer?
Chris Dumez
Comment 5 2021-07-09 14:23:08 PDT
Chris Dumez
Comment 6 2021-07-09 14:25:45 PDT
EWS
Comment 7 2021-07-13 12:18:58 PDT
Committed r279881 (239633@main): <https://commits.webkit.org/239633@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 433240 [details].
Radar WebKit Bug Importer
Comment 8 2021-07-13 12:19:18 PDT
Note You need to log in before you can comment on or make changes to this bug.