<rdar://problem/7908830> and https://bugs.webkit.org/show_bug.cgi?id=34679 Location...
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Mar 2012 15:57:37 +0000 (15:57 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Mar 2012 15:57:37 +0000 (15:57 +0000)
commitcaa28d72b40b01c40edcccfc50cfc4a7f92b2c2c
treed7b970392c238281ebde2b23f3f461be33f517a5
parente9091fffeffec09d921856bbd166a8965ca28de1
<rdar://problem/7908830> and https://bugs.webkit.org/show_bug.cgi?id=34679 Location and other objects are dysfunctional after a document gets restored from page cache

Reviewed by Adam Barth.

Source/WebCore:

Test: fast/loader/window-properties-restored-from-page-cache.html

Give DOMWindowProperties the ability to reconnect to their Frame:
* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::reconnectFrame):
* page/DOMWindowProperty.h:
(DOMWindowProperty):

Let ApplicationCache do some extra work when reconnecting:
* loader/appcache/DOMApplicationCache.cpp:
(WebCore::DOMApplicationCache::reconnectFrame):
(WebCore):
* loader/appcache/DOMApplicationCache.h:
(DOMApplicationCache):

Let IndexDB do some extra work when reconnecting:
* Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
(WebCore::DOMWindowIndexedDatabase::disconnectFrame):
(WebCore::DOMWindowIndexedDatabase::reconnectFrame):
(WebCore::DOMWindowIndexedDatabase::webkitIndexedDB):
* Modules/indexeddb/DOMWindowIndexedDatabase.h:
(DOMWindowIndexedDatabase):

Tell the DOMWindow to suspend to the page cache:
* history/CachedFrame.cpp:
(WebCore::CachedFrame::CachedFrame):

Tell the DOMWindow to resume from the page cache:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::open):

* page/DOMWindow.cpp:
(WebCore::DOMWindow::DOMWindow):
(WebCore::DOMWindow::~DOMWindow): Call clearDOMWindowProperties directly instead of clear()
(WebCore::DOMWindow::frameDestroyed): Ditto.
(WebCore::DOMWindow::clear): Only clear if the DOMWindow is not suspended for the page cache.
(WebCore::DOMWindow::suspendForPageCache): Disconnect properties and set the page cache flag.
(WebCore::DOMWindow::resumeFromPageCache): Reconnect properties and revert the page cache flag.
(WebCore::DOMWindow::disconnectDOMWindowProperties): Only disconnect the registered properties.
(WebCore::DOMWindow::reconnectDOMWindowProperties):
(WebCore::DOMWindow::clearDOMWindowProperties): Disconnect the registered properties then clear them out.

For all of the following, if the DOMWindow is not displayed in a frame (i.e., it is suspended), do nothing:
(WebCore::DOMWindow::screen):
(WebCore::DOMWindow::history):
(WebCore::DOMWindow::crypto):
(WebCore::DOMWindow::locationbar):
(WebCore::DOMWindow::menubar):
(WebCore::DOMWindow::personalbar):
(WebCore::DOMWindow::scrollbars):
(WebCore::DOMWindow::statusbar):
(WebCore::DOMWindow::toolbar):
(WebCore::DOMWindow::console):
(WebCore::DOMWindow::applicationCache):
(WebCore::DOMWindow::navigator):
(WebCore::DOMWindow::performance):
(WebCore::DOMWindow::location):
(WebCore::DOMWindow::sessionStorage):
(WebCore::DOMWindow::localStorage):
(WebCore::DOMWindow::webkitNotifications):
(WebCore::DOMWindow::postMessageTimerFired):
(WebCore::DOMWindow::getSelection):
(WebCore::DOMWindow::styleMedia):
(WebCore::DOMWindow::webkitStorageInfo):
* page/DOMWindow.h:

LayoutTests:

* fast/loader/window-properties-restored-from-page-cache-expected.txt: Added.
* fast/loader/window-properties-restored-from-page-cache.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110570 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/loader/window-properties-restored-from-page-cache-expected.txt [new file with mode: 0644]
LayoutTests/fast/loader/window-properties-restored-from-page-cache.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp
Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h
Source/WebCore/history/CachedFrame.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/appcache/DOMApplicationCache.cpp
Source/WebCore/loader/appcache/DOMApplicationCache.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/page/DOMWindowProperty.cpp
Source/WebCore/page/DOMWindowProperty.h