| Summary: | Revoking Blob URL after calling XMLHttpRequest::open() causes the XHR to fail | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||||
| Component: | Page Loading | Assignee: | Chris Dumez <cdumez> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | achristensen, beidson, darin, ews-watchlist, ggaren, japhet, sam, webkit-bug-importer, youennf | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=228923 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Chris Dumez
2021-07-08 16:13:15 PDT
Created attachment 433182 [details]
Patch
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. (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. (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? Created attachment 433239 [details]
Patch
Created attachment 433240 [details]
Patch
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]. |