Reviewed by Maciej.
[WebKit-https.git] / WebCore / page / Frame.cpp
index 13a277374198bb3e8b40f3cb8229b97d7b4eb0dd..a110573501a7f29bfa34a8d94d99dd483c24d7c0 100644 (file)
@@ -683,8 +683,14 @@ void Frame::endIfNotLoading()
 
     // make sure nothing's left in there...
     if (d->m_doc) {
-        if (d->m_decoder)
-            write(d->m_decoder->flush());
+        if (d->m_decoder) {
+            DeprecatedString decoded = d->m_decoder->flush();
+            if (d->m_bFirstData) {
+                d->m_doc->determineParseMode(decoded);
+                d->m_bFirstData = false;
+            }
+            write(decoded);
+        }
         d->m_doc->finishParsing();
     } else
         // WebKit partially uses WebCore when loading non-HTML docs.  In these cases doc==nil, but