Check focused node reference when traversing through history
https://bugs.webkit.org/show_bug.cgi?id=113082

Patch by Nima Ghanavatian <nghanavatian@blackberry.com> on 2013-03-22
Reviewed by Rob Buis.

PR312101
Check if we have a valid node and document before attempting to access its frame and
frame selection. This is causing issues when going back to a page after a redirect
where a stale pointer is used.
Further, the focused node should be changed after the frame is fully loaded.

* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::setElementUnfocused):
(BlackBerry::WebKit::InputHandler::restoreViewState):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146641 268f45cc-cd09-0410-ab3c-d52691b4dbfc