author | Boris Zbarsky <bzbarsky@mit.edu> |
Wed, 01 Jun 2011 16:00:36 -0400 | |
changeset 70456 | f0270e2a21bc11cb6e4b19827cc8cead1c7c3f60 |
parent 70455 | 66efdc6a98c5811fb771f15f11ef8afe54a04d07 |
child 70457 | 1e3b54a0191393b5d845f78072e8ceab948edab1 |
push id | 20324 |
push user | mlamouri@mozilla.com |
push date | Thu, 02 Jun 2011 11:11:19 +0000 |
treeherder | mozilla-central@1e3b54a01913 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smaug |
bugs | 660404 |
milestone | 7.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -7039,22 +7039,31 @@ nsDocument::CanSavePresentation(nsIReque // Check if we have pending network requests nsCOMPtr<nsILoadGroup> loadGroup = GetDocumentLoadGroup(); if (loadGroup) { nsCOMPtr<nsISimpleEnumerator> requests; loadGroup->GetRequests(getter_AddRefs(requests)); PRBool hasMore = PR_FALSE; + // We want to bail out if we have any requests other than aNewRequest (or + // in the case when aNewRequest is a part of a multipart response the base + // channel the multipart response is coming in on). + nsCOMPtr<nsIChannel> baseChannel; + nsCOMPtr<nsIMultiPartChannel> part(do_QueryInterface(aNewRequest)); + if (part) { + part->GetBaseChannel(getter_AddRefs(baseChannel)); + } + while (NS_SUCCEEDED(requests->HasMoreElements(&hasMore)) && hasMore) { nsCOMPtr<nsISupports> elem; requests->GetNext(getter_AddRefs(elem)); nsCOMPtr<nsIRequest> request = do_QueryInterface(elem); - if (request && request != aNewRequest) { + if (request && request != aNewRequest && request != baseChannel) { #ifdef DEBUG_PAGE_CACHE nsCAutoString requestName, docSpec; request->GetName(requestName); if (mDocumentURI) mDocumentURI->GetSpec(docSpec); printf("document %s has request %s\n", docSpec.get(), requestName.get());
--- a/docshell/test/Makefile.in +++ b/docshell/test/Makefile.in @@ -101,16 +101,19 @@ include $(topsrcdir)/config/rules.mk test_bug640387_1.html \ test_bug640387_2.html \ file_bug640387.html \ test_bug653741.html \ file_bug653741.html \ test_framedhistoryframes.html \ test_windowedhistoryframes.html \ historyframes.html \ + test_bug660404.html \ + file_bug660404 \ + file_bug660404^headers^ \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) _TEST_FILES += \ test_bug511449.html \ file_bug511449.html \ $(NULL) endif
new file mode 100644 --- /dev/null +++ b/docshell/test/file_bug660404 @@ -0,0 +1,5 @@ +--testingtesting +Content-Type: text/html + +<script>opener.finishTest();</script> +--testingtesting--
new file mode 100644 --- /dev/null +++ b/docshell/test/file_bug660404^headers^ @@ -0,0 +1,1 @@ +Content-Type: multipart/x-mixed-replace; boundary="testingtesting"
new file mode 100644 --- /dev/null +++ b/docshell/test/test_bug660404.html @@ -0,0 +1,49 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=660404 +--> +<head> + <title>Test for Bug 660404</title> + <script type="application/javascript" src="/MochiKit/packed.js"></script> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=660404">Mozilla Bug 660404</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script type="application/javascript"> + +/** Test for Bug 660404 **/ +SimpleTest.waitForExplicitFinish(); + +var w; + +function continueTest() { + // Do this async so the load event can finish firing + SimpleTest.executeSoon(function() { + w.onpagehide = function(ev) { + is(ev.persisted, true, "Should be bfcached when navigating to multipart"); + } + w.location.href = "file_bug660404"; + }); +} + +function finishTest() { + is(w.document.documentElement.textContent, "opener.finishTest();"); + is(w.document.documentElement.innerHTML, "<head><script>opener.finishTest();</"+"script></head>"); + w.close(); + SimpleTest.finish(); +} + +// Have to open a new window, since there's no bfcache in subframes +w = window.open("data:text/html,<script>window.onload = function() { opener.continueTest(); }</"+"script>"); + +</script> +</pre> +</body> +</html>