As mentioned in https://bugs.webkit.org/show_bug.cgi?id=131652#c3, frame should always have a document. So, we can return a reference in frame.
Created attachment 229872 [details] WIP
Kling, I wonder if there is any chance that a frame has a null document.
Created attachment 229953 [details] WIP
Frame::document() will be null when the Frame is created, until the FrameLoader has completed loading the initial document. It will also become null during teardown. We shouldn't make document() return a reference until we've eliminated those cases where it can be null.
(In reply to comment #4) > Frame::document() will be null when the Frame is created, until the FrameLoader has completed loading the initial document. It will also become null during teardown. > > We shouldn't make document() return a reference until we've eliminated those cases where it can be null. Kling, thank you for your answer. Let me check those cases.