Bug 127786 - Document::topDocument() should return a reference
Summary: Document::topDocument() should return a reference
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-28 12:09 PST by Antti Koivisto
Modified: 2014-01-28 16:26 PST (History)
15 users (show)

See Also:


Attachments
patch (12.36 KB, patch)
2014-01-28 12:10 PST, Antti Koivisto
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2014-01-28 12:09:29 PST
it should
Comment 1 Antti Koivisto 2014-01-28 12:10:53 PST
Created attachment 222473 [details]
patch
Comment 2 WebKit Commit Bot 2014-01-28 12:13:45 PST
Attachment 222473 [details] did not pass style-queue:


ERROR: Source/WebCore/rendering/RenderView.cpp:1269:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 1 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2014-01-28 12:16:34 PST
Comment on attachment 222473 [details]
patch

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

> Source/WebCore/dom/Document.cpp:4316
> -    return m_frame ? m_frame->mainFrame().document() : const_cast<Document*>(this);
> +    return m_frame ? *m_frame->mainFrame().document() : const_cast<Document&>(*this);

We should make this 100% safe by null-checking MainFrame::document and falling back to this in that case too. And if we ever change MainFrame::document to return a reference we can delete that branch.
Comment 4 Antti Koivisto 2014-01-28 14:27:59 PST
https://trac.webkit.org/r162962
Comment 5 Benjamin Poulain 2014-01-28 16:20:34 PST
Looks like it does not build on iOS.
Comment 6 Benjamin Poulain 2014-01-28 16:26:48 PST
Never mind, I am late on the internal updates. Antti already fixed the build.