3 of the new HTML5 loading events need to be asynchronous.

Reviewed by Darin Adler.

Laying the groundwork for:
https://bugs.webkit.org/show_bug.cgi?id=36201
https://bugs.webkit.org/show_bug.cgi?id=36202
https://bugs.webkit.org/show_bug.cgi?id=36334
https://bugs.webkit.org/show_bug.cgi?id=36335

Document already had an asynchronous event delivery mechanism for storage events, so
we can repurpose that for all async events.

No new tests. (No change in behavior)

* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::implicitClose): Use Document::schedule* for the related events.
(WebCore::Document::enqueueEvent): Renamed from enqueueStorageEvent
(WebCore::Document::pendingEventTimerFired): Renamed from "storageEventTimerFired"
(WebCore::Document::statePopped): Use Document::schedulePopstateEvent
(WebCore::Document::enqueuePageshowEvent): All Pageshow events are piped through here.
  This will be made asynchronous in a separate patch.
(WebCore::Document::enqueueHashchangeEvent): All Hashchange events are piped through here.
  This will be made asynchronous in a separate patch.
(WebCore::Document::enqueuePopstateEvent): All Popstate events are piped through here.
  This will be made asynchronous in a separate patch.
* dom/Document.h:
(WebCore::):

* history/CachedFrame.cpp:
(WebCore::CachedFrameBase::restore): Use Document::enqueuePageshowEvent

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadInSameDocument): Use Document::enqueueHashchangeEvent

* storage/StorageEventDispatcher.cpp:
(WebCore::StorageEventDispatcher::dispatch): Use Document::enqueueEvent



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56249 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 54339c3..0134eb6 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -1743,7 +1743,10 @@
         history()->updateBackForwardListForFragmentScroll();
     }
     
+    String oldURL;
     bool hashChange = equalIgnoringFragmentIdentifier(url, m_URL) && url.fragmentIdentifier() != m_URL.fragmentIdentifier();
+    oldURL = m_URL;
+    
     m_URL = url;
     history()->updateForSameDocumentNavigation();
 
@@ -1778,7 +1781,7 @@
     }
     
     if (hashChange) {
-        m_frame->document()->dispatchWindowEvent(Event::create(eventNames().hashchangeEvent, false, false));
+        m_frame->document()->enqueueHashchangeEvent(oldURL, m_URL);
         m_client->dispatchDidChangeLocationWithinPage();
     }