RESOLVED FIXED 211544
Add some missing null checks for DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=211544
Summary Add some missing null checks for DocumentLoader
Darin Adler
Reported 2020-05-06 19:00:55 PDT
Add some missing null checks for DocumentLoader
Attachments
Patch (5.58 KB, patch)
2020-05-06 19:02 PDT, Darin Adler
andersca: review+
Patch (7.40 KB, patch)
2020-05-07 10:07 PDT, Darin Adler
no flags
Patch (7.39 KB, patch)
2020-05-07 10:10 PDT, Darin Adler
no flags
Darin Adler
Comment 1 2020-05-06 19:02:14 PDT
Darin Adler
Comment 2 2020-05-06 19:03:04 PDT
Anders Carlsson
Comment 3 2020-05-07 07:33:15 PDT
Comment on attachment 398696 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398696&action=review > Source/WebCore/loader/FrameLoader.cpp:2173 > + auto dl = m_documentLoader; I would have renamed this to documentLoader. > Source/WebCore/loader/FrameLoader.cpp:2226 > + m_documentLoader->writer().setMIMEType(dl->responseMIMEType()); Should this use dl instead of m_documentLoader? (Maybe there's a chance that m_documentLoader is replaced mid-function?) > Source/WebCore/loader/HistoryController.cpp:417 > + const URL& historyURL = m_frame.loader().documentLoader() ? m_frame.loader().documentLoader()->urlForHistory() : URL { }; I'd change this to no longer hold a const reference, since urlForHistory() returns a const&, it will always be copied anyway AFAICT.
Darin Adler
Comment 4 2020-05-07 08:44:24 PDT
Comment on attachment 398696 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=398696&action=review >> Source/WebCore/loader/FrameLoader.cpp:2173 >> + auto dl = m_documentLoader; > > I would have renamed this to documentLoader. OK, I’ll do that. >> Source/WebCore/loader/FrameLoader.cpp:2226 >> + m_documentLoader->writer().setMIMEType(dl->responseMIMEType()); > > Should this use dl instead of m_documentLoader? (Maybe there's a chance that m_documentLoader is replaced mid-function?) I thought the point was to set the MIME type on the new writer with the possibly-old loader’s MIME type. Not really sure. >> Source/WebCore/loader/HistoryController.cpp:417 >> + const URL& historyURL = m_frame.loader().documentLoader() ? m_frame.loader().documentLoader()->urlForHistory() : URL { }; > > I'd change this to no longer hold a const reference, since urlForHistory() returns a const&, it will always be copied anyway AFAICT. Will do.
Darin Adler
Comment 5 2020-05-07 10:07:24 PDT Comment hidden (obsolete)
Darin Adler
Comment 6 2020-05-07 10:07:46 PDT Comment hidden (obsolete)
Darin Adler
Comment 7 2020-05-07 10:10:29 PDT
EWS
Comment 8 2020-05-07 11:55:55 PDT
Committed r261323: <https://trac.webkit.org/changeset/261323> All reviewed patches have been landed. Closing bug and clearing flags on attachment 398752 [details].
Radar WebKit Bug Importer
Comment 9 2020-05-07 11:56:15 PDT
Note You need to log in before you can comment on or make changes to this bug.