Reviewed by Adam.

        <rdar://problem/4981000> 
        http://bugs.webkit.org/show_bug.cgi?id=12634
        REGRESSION: crash loading web archive (12634)
        
        The reason this bug wasn't always reproducible is that it involved sending an event to a plugin while 
        the page was loading. Before we send the event to the plugin we defer loads. The problem was that
        MainResourceLoader::setDefersLoad would not work with data loads.
        
        * loader/DocumentLoader.cpp:
        (WebCore::DocumentLoader::setRequest):
        Only set m_committed to false if we also have a valid unreachable URL.
        
        * loader/MainResourceLoader.cpp:
        (WebCore::MainResourceLoader::setDefersLoading):
        Make sure to stop and start data loads.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20053 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp
index affa66e..0d2719d 100644
--- a/WebCore/loader/MainResourceLoader.cpp
+++ b/WebCore/loader/MainResourceLoader.cpp
@@ -396,8 +396,17 @@
 void MainResourceLoader::setDefersLoading(bool defers)
 {
     ResourceLoader::setDefersLoading(defers);
-    if (!defers) {
-        if (!m_initialRequest.isNull()) {
+    
+    if (defers) {
+        if (m_dataLoadTimer.isActive())
+            m_dataLoadTimer.stop();
+    } else {
+        if (m_initialRequest.isNull())
+            return;
+        
+        if (m_substituteData.isValid())
+            m_dataLoadTimer.startOneShot(0);
+        else {
             ResourceRequest r(m_initialRequest);
             m_initialRequest = ResourceRequest();
             loadNow(r);