REGRESSION: Crash in MainResourceLoader::setDataBufferingPolicy when sharing an html5...
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 19:19:00 +0000 (19:19 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 19:19:00 +0000 (19:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110075

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Test: webarchive/loading/video-in-webarchive.html

* loader/MainResourceLoader.cpp:
(WebCore::MainResourceLoader::continueAfterContentPolicy): isStopping()
    isn't accurate to determine whether a SubstituteData load should
    continue, as this point in the code shouldn't be reachable from any point
    where isStopping() would return true. DocumentLoader might have completely
    stopped and believe that MainResourceLoader is complete, though. Don't
    continue in that case.
(WebCore::MainResourceLoader::setDataBufferingPolicy): m_resource can be null
    in a reasonable case, handle it rather \1athan asserting that it can't be null.

LayoutTests:

* webarchive/loading/resources/video-in-webarchive.webarchive: Added.
* webarchive/loading/video-in-webarchive-expected.txt: Added.
* webarchive/loading/video-in-webarchive.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/webarchive/loading/resources/video-in-webarchive.webarchive [new file with mode: 0644]
LayoutTests/webarchive/loading/video-in-webarchive-expected.txt [new file with mode: 0644]
LayoutTests/webarchive/loading/video-in-webarchive.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/loader/MainResourceLoader.cpp

index 16dfd1c..35ffbab 100644 (file)
@@ -1,3 +1,14 @@
+2013-02-21  Nate Chapin  <japhet@chromium.org>
+
+        REGRESSION: Crash in MainResourceLoader::setDataBufferingPolicy when sharing an html5 video via email
+        https://bugs.webkit.org/show_bug.cgi?id=110075
+
+        Reviewed by Alexey Proskuryakov.
+
+        * webarchive/loading/resources/video-in-webarchive.webarchive: Added.
+        * webarchive/loading/video-in-webarchive-expected.txt: Added.
+        * webarchive/loading/video-in-webarchive.html: Added.
+
 2013-02-21  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r143616.
diff --git a/LayoutTests/webarchive/loading/resources/video-in-webarchive.webarchive b/LayoutTests/webarchive/loading/resources/video-in-webarchive.webarchive
new file mode 100644 (file)
index 0000000..67b81f8
Binary files /dev/null and b/LayoutTests/webarchive/loading/resources/video-in-webarchive.webarchive differ
diff --git a/LayoutTests/webarchive/loading/video-in-webarchive-expected.txt b/LayoutTests/webarchive/loading/video-in-webarchive-expected.txt
new file mode 100644 (file)
index 0000000..1eb7570
--- /dev/null
@@ -0,0 +1,16 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - willPerformClientRedirectToURL: resources/video-in-webarchive.webarchive 
+main frame - didFinishDocumentLoadForFrame
+main frame - didFinishLoadForFrame
+main frame - didStartProvisionalLoadForFrame
+main frame - didCancelClientRedirectForFrame
+main frame - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didFailLoadWithError
+main frame - didFinishLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
+
diff --git a/LayoutTests/webarchive/loading/video-in-webarchive.html b/LayoutTests/webarchive/loading/video-in-webarchive.html
new file mode 100644 (file)
index 0000000..abc92f6
--- /dev/null
@@ -0,0 +1,7 @@
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+window.location="resources/video-in-webarchive.webarchive";
+</script>
index 640313c..52e9134 100644 (file)
@@ -1,3 +1,22 @@
+2013-02-21  Nate Chapin  <japhet@chromium.org>
+
+        REGRESSION: Crash in MainResourceLoader::setDataBufferingPolicy when sharing an html5 video via email
+        https://bugs.webkit.org/show_bug.cgi?id=110075
+
+        Reviewed by Alexey Proskuryakov.
+
+        Test: webarchive/loading/video-in-webarchive.html
+
+        * loader/MainResourceLoader.cpp:
+        (WebCore::MainResourceLoader::continueAfterContentPolicy): isStopping()
+            isn't accurate to determine whether a SubstituteData load should
+            continue, as this point in the code shouldn't be reachable from any point
+            where isStopping() would return true. DocumentLoader might have completely
+            stopped and believe that MainResourceLoader is complete, though. Don't
+            continue in that case. 
+        (WebCore::MainResourceLoader::setDataBufferingPolicy): m_resource can be null
+            in a reasonable case, handle it rather \1athan asserting that it can't be null.
+
 2013-02-21  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r143616.
index 7f6e593..d179e18 100644 (file)
@@ -363,7 +363,7 @@ void MainResourceLoader::continueAfterContentPolicy(PolicyAction contentPolicy,
     if (!m_documentLoader->isStopping() && m_substituteData.isValid()) {
         if (m_substituteData.content()->size())
             dataReceived(0, m_substituteData.content()->data(), m_substituteData.content()->size());
-        if (!m_documentLoader->isStopping())
+        if (m_documentLoader->isLoadingMainResource())
             didFinishLoading(0);
     }
 }
@@ -719,8 +719,8 @@ bool MainResourceLoader::defersLoading() const
 
 void MainResourceLoader::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy)
 {
-    ASSERT(m_resource);
-    m_resource->setDataBufferingPolicy(dataBufferingPolicy);
+    if (m_resource)
+        m_resource->setDataBufferingPolicy(dataBufferingPolicy);
 }
 
 ResourceLoader* MainResourceLoader::loader() const