The WebCore::Document::head() method is not const, it should.
Created attachment 61251 [details] Initial patch
Comment on attachment 61251 [details] Initial patch Why should this be const? You have a const pointer to a document and you get a non-const pointer to one of the elements of that document? I think we should not use const so much on classes like Document* that are part of a tree. It doesn't make sense to have a const pointer to something but then call firstChild()->parent() and get back a non-const pointer to the same thing. I suggest going the opposite direction and phasing out use of const Document*.
I came up across this using the Chromium WebKit API (trying to pass a WebDocument as a const& and then call head() on it which ends up calling Document::head()) and thought the const had somehow been forgotten since body() was const. You are right, it does not make sense if the constness can be circumvented. Closing the bug.