Bug 485196 - Web page generated by POST is retried as GET when Save Frame As used, and the page is no longer in the cache. r=smaug, r=gavin

--HG--
rename : toolkit/content/tests/browser/browser_bug471962.js => toolkit/content/tests/browser/browser_save_resend_postdata.js
extra : rebase_source : e985407c54fcd0f138bb7c1bf350356aa4dec2de
This commit is contained in:
Paolo Amadini 2010-06-08 03:15:00 -04:00
parent 8b5783ed0b
commit 57ade91b4c
3 changed files with 22 additions and 11 deletions

View File

@ -750,13 +750,17 @@ function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension,
function getPostData(aDocument)
{
try {
var sessionHistory = aDocument.defaultView
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.sessionHistory;
return sessionHistory.getEntryAtIndex(sessionHistory.index, false)
.QueryInterface(Components.interfaces.nsISHEntry)
.postData;
// Find the session history entry corresponding to the given document. In
// the current implementation, nsIWebPageDescriptor.currentDescriptor always
// returns a session history entry.
var sessionHistoryEntry =
aDocument.defaultView
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIWebPageDescriptor)
.currentDescriptor
.QueryInterface(Components.interfaces.nsISHEntry);
return sessionHistoryEntry.postData;
}
catch (e) {
}

View File

@ -51,9 +51,9 @@ DIRS = \
include $(topsrcdir)/config/rules.mk
_BROWSER_TEST_FILES = \
browser_bug471962.js \
browser_keyevents_during_autoscrolling.js \
browser_bug295977_autoscroll_overflow.js \
browser_save_resend_postdata.js \
browser_Services.js \
$(NULL)

View File

@ -38,6 +38,10 @@
* Test for bug 471962 <https://bugzilla.mozilla.org/show_bug.cgi?id=471962>:
* When saving an inner frame as file only, the POST data of the outer page is
* sent to the address of the inner page.
*
* Test for bug 485196 <https://bugzilla.mozilla.org/show_bug.cgi?id=485196>:
* Web page generated by POST is retried as GET when Save Frame As used, and the
* page is no longer in the cache.
*/
function test() {
@ -121,10 +125,13 @@ function test() {
// Read the entire saved file.
var fileContents = readShortFile(mockFilePickerResults.selectedFile);
// Check if outer POST data is found.
const searchPattern = "inputfield=outer";
ok(fileContents.indexOf(searchPattern) === -1,
// Check if outer POST data is found (bug 471962).
ok(fileContents.indexOf("inputfield=outer") === -1,
"The saved inner frame does not contain outer POST data");
// Check if inner POST data is found (bug 485196).
ok(fileContents.indexOf("inputfield=inner") > -1,
"The saved inner frame was generated using the correct POST data");
}
finally {
// Clean up the saved file.