зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
f1d4522fed
Коммит
3d88d0d8ff
|
@ -750,13 +750,17 @@ function appendFiltersForContentType(aFilePicker, aContentType, aFileExtension,
|
||||||
function getPostData(aDocument)
|
function getPostData(aDocument)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
var sessionHistory = aDocument.defaultView
|
// Find the session history entry corresponding to the given document. In
|
||||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
// the current implementation, nsIWebPageDescriptor.currentDescriptor always
|
||||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
// returns a session history entry.
|
||||||
.sessionHistory;
|
var sessionHistoryEntry =
|
||||||
return sessionHistory.getEntryAtIndex(sessionHistory.index, false)
|
aDocument.defaultView
|
||||||
.QueryInterface(Components.interfaces.nsISHEntry)
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
.postData;
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||||
|
.QueryInterface(Components.interfaces.nsIWebPageDescriptor)
|
||||||
|
.currentDescriptor
|
||||||
|
.QueryInterface(Components.interfaces.nsISHEntry);
|
||||||
|
return sessionHistoryEntry.postData;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@ DIRS = \
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
_BROWSER_TEST_FILES = \
|
_BROWSER_TEST_FILES = \
|
||||||
browser_bug471962.js \
|
|
||||||
browser_keyevents_during_autoscrolling.js \
|
browser_keyevents_during_autoscrolling.js \
|
||||||
browser_bug295977_autoscroll_overflow.js \
|
browser_bug295977_autoscroll_overflow.js \
|
||||||
|
browser_save_resend_postdata.js \
|
||||||
browser_Services.js \
|
browser_Services.js \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
* Test for bug 471962 <https://bugzilla.mozilla.org/show_bug.cgi?id=471962>:
|
* 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
|
* When saving an inner frame as file only, the POST data of the outer page is
|
||||||
* sent to the address of the inner page.
|
* 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() {
|
function test() {
|
||||||
|
|
||||||
|
@ -121,10 +125,13 @@ function test() {
|
||||||
// Read the entire saved file.
|
// Read the entire saved file.
|
||||||
var fileContents = readShortFile(mockFilePickerResults.selectedFile);
|
var fileContents = readShortFile(mockFilePickerResults.selectedFile);
|
||||||
|
|
||||||
// Check if outer POST data is found.
|
// Check if outer POST data is found (bug 471962).
|
||||||
const searchPattern = "inputfield=outer";
|
ok(fileContents.indexOf("inputfield=outer") === -1,
|
||||||
ok(fileContents.indexOf(searchPattern) === -1,
|
|
||||||
"The saved inner frame does not contain outer POST data");
|
"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 {
|
finally {
|
||||||
// Clean up the saved file.
|
// Clean up the saved file.
|
Загрузка…
Ссылка в новой задаче