Bug 211589 - Add missing null-check of page in ResourceLoader::loadDataURL
Summary: Add missing null-check of page in ResourceLoader::loadDataURL
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-07 12:10 PDT by Darin Adler
Modified: 2020-05-09 09:07 PDT (History)
8 users (show)

See Also:


Attachments
Patch (1.60 KB, patch)
2020-05-07 12:10 PDT, Darin Adler
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2020-05-07 12:10:26 PDT
Add missing null-check of page in ResourceLoader::loadDataURL
Comment 1 Darin Adler 2020-05-07 12:10:55 PDT
Created attachment 398774 [details]
Patch
Comment 2 Darin Adler 2020-05-07 12:11:23 PDT
rdar://57213601
Comment 3 Sam Weinig 2020-05-07 12:23:56 PDT
Comment on attachment 398774 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=398774&action=review

> Source/WebCore/loader/ResourceLoader.cpp:274
> +    if (auto page = m_frame->page()) {
> +        if (auto scheduledPairs = page->scheduledRunLoopPairs())
> +            scheduleContext.scheduledPairs = *scheduledPairs;
> +    }

What's the effect to the rest of this function is page is null? When HAVE(RUNLOOP_TIMER) is enabled and you don't set scheduledPairs, does the call to DataURLDecoder::decode continue to work?
Comment 4 Darin Adler 2020-05-07 12:32:08 PDT
Comment on attachment 398774 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=398774&action=review

>> Source/WebCore/loader/ResourceLoader.cpp:274
>> +    }
> 
> What's the effect to the rest of this function is page is null? When HAVE(RUNLOOP_TIMER) is enabled and you don't set scheduledPairs, does the call to DataURLDecoder::decode continue to work?

Three thoughts:

1) This mostly happens when scheduling a load during tear-down, and so I think the load never completes and gets torn down.
2) Another way to ask this is to ask what happens to all the scheduled stuff when the frame detaches from the page.
3) Is all of this for legacy WebKit on Cocoa platforms only?
Comment 5 Darin Adler 2020-05-07 12:45:03 PDT
I suspect the real answer is (1) above.

This is just one of multiple ways to harmlessly do nothing. Could also return and do nothing harmlessly.
Comment 6 Darin Adler 2020-05-07 12:45:43 PDT
And test results seem to confirm that.
Comment 7 Alex Christensen 2020-05-07 21:51:45 PDT
(In reply to Darin Adler from comment #4)
> 3) Is all of this for legacy WebKit on Cocoa platforms only?
Yes.

While we're at it, why don't we null check the frame?  I see that null checked elsewhere in this file.
Comment 8 Darin Adler 2020-05-08 09:05:20 PDT
(In reply to Alex Christensen from comment #7)
> While we're at it, why don't we null check the frame?  I see that null
> checked elsewhere in this file.

Seems fine to do that. Good to do it more consistently.
Comment 9 Darin Adler 2020-05-09 06:36:16 PDT
(In reply to Darin Adler from comment #8)
> Seems fine to do that. Good to do it more consistently.

But can I do that in a separate patch?
Comment 10 EWS 2020-05-09 09:07:53 PDT
Committed r261438: <https://trac.webkit.org/changeset/261438>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 398774 [details].