Improve wording of the postdata dialog. Bug 112848, patch by Magnus Melin
<mkmelin+mozilla@iki.fi>, r=darin, sr=bzbarsky
This commit is contained in:
@@ -42,8 +42,9 @@ connectionFailure=Firefox can't establish a connection to the server at %S.
|
||||
netInterrupt=The connection to %S was interrupted while the page was loading.
|
||||
netTimeout=The server at %S is taking too long to respond.
|
||||
redirectLoop=Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
|
||||
repost=The page you are trying to view contains POSTDATA that has expired from cache. If you resend the data, any action the form carried out (such as a search or online purchase) will be repeated. To resend the data, click OK. Otherwise, click Cancel.
|
||||
repostConfirm=The page you are trying to view contains POSTDATA. If you resend the data, any action the form carried out (such as a search or online purchase) will be repeated. To resend the data, click OK. Otherwise, click Cancel.
|
||||
## LOCALIZATION NOTE (confirmRepost): In this item, don't translate "%S"
|
||||
confirmRepost=To display this page, the information previously sent by %S must be resent. This will repeat any action (such as a search or order submission) that had been performed earlier.
|
||||
resendButton.label=Resend
|
||||
unknownSocketType=Firefox doesn't know how to communicate with the server.
|
||||
netReset=The connection to the server was reset while the page was loading.
|
||||
netOffline=Firefox is currently in offline mode and can't browse the Web.
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
|
||||
// we want to explore making the document own the load group
|
||||
// so we can associate the document URI with the load group.
|
||||
@@ -221,6 +222,9 @@ static PRLogModuleInfo* gDocShellLog;
|
||||
static PRLogModuleInfo* gDocShellLeakLog;
|
||||
#endif
|
||||
|
||||
const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties";
|
||||
const char kAppstringsBundleURL[] = "chrome://global/locale/appstrings.properties";
|
||||
|
||||
static void
|
||||
FavorPerformanceHint(PRBool perfOverStarvation, PRUint32 starvationDelay)
|
||||
{
|
||||
@@ -7709,28 +7713,14 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType)
|
||||
* repost the data to the server.
|
||||
*/
|
||||
if ((aLoadType & LOAD_CMD_RELOAD) && postData) {
|
||||
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
PRBool repost;
|
||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
||||
GetPromptAndStringBundle(getter_AddRefs(prompter),
|
||||
getter_AddRefs(stringBundle));
|
||||
rv = ConfirmRepost(&repost);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (stringBundle && prompter) {
|
||||
nsXPIDLString messageStr;
|
||||
nsresult rv = stringBundle->GetStringFromName(NS_LITERAL_STRING("repostConfirm").get(),
|
||||
getter_Copies(messageStr));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && messageStr) {
|
||||
prompter->Confirm(nsnull, messageStr, &repost);
|
||||
/* If the user pressed cancel in the dialog, return. We're
|
||||
* done here.
|
||||
*/
|
||||
// If the user pressed cancel in the dialog, return. We're done here.
|
||||
if (!repost)
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rv = InternalLoad(uri,
|
||||
referrerURI,
|
||||
@@ -8207,7 +8197,56 @@ nsDocShell::GetLoadType(PRUint32 * aLoadType)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define DIALOG_STRING_URI "chrome://global/locale/appstrings.properties"
|
||||
nsresult
|
||||
nsDocShell::ConfirmRepost(PRBool * aRepost)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
CallGetInterface(this, NS_STATIC_CAST(nsIPrompt**, getter_AddRefs(prompter)));
|
||||
|
||||
nsCOMPtr<nsIStringBundleService>
|
||||
stringBundleService(do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIStringBundle> appBundle;
|
||||
rv = stringBundleService->CreateBundle(kAppstringsBundleURL,
|
||||
getter_AddRefs(appBundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIStringBundle> brandBundle;
|
||||
rv = stringBundleService->CreateBundle(kBrandBundleURL, getter_AddRefs(brandBundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ASSERTION(prompter && brandBundle && appBundle,
|
||||
"Unable to set up repost prompter.");
|
||||
|
||||
nsXPIDLString brandName;
|
||||
rv = brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
|
||||
getter_Copies(brandName));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
const PRUnichar *formatStrings[] = { brandName.get() };
|
||||
|
||||
nsXPIDLString msgString, button0Title;
|
||||
rv = appBundle->FormatStringFromName(NS_LITERAL_STRING("confirmRepost").get(),
|
||||
formatStrings, NS_ARRAY_LENGTH(formatStrings),
|
||||
getter_Copies(msgString));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = appBundle->GetStringFromName(NS_LITERAL_STRING("resendButton.label").get(),
|
||||
getter_Copies(button0Title));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 buttonPressed;
|
||||
rv = prompter->
|
||||
ConfirmEx(nsnull, msgString.get(),
|
||||
(nsIPrompt::BUTTON_POS_0 * nsIPrompt::BUTTON_TITLE_IS_STRING) +
|
||||
(nsIPrompt::BUTTON_POS_1 * nsIPrompt::BUTTON_TITLE_CANCEL),
|
||||
button0Title.get(), nsnull, nsnull, nsnull, nsnull, &buttonPressed);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*aRepost = (buttonPressed == 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
||||
@@ -8221,7 +8260,7 @@ nsDocShell::GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
||||
NS_ENSURE_TRUE(stringBundleService, NS_ERROR_FAILURE);
|
||||
|
||||
NS_ENSURE_SUCCESS(stringBundleService->
|
||||
CreateBundle(DIALOG_STRING_URI,
|
||||
CreateBundle(kAppstringsBundleURL,
|
||||
aStringBundle),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
@@ -360,6 +360,7 @@ protected:
|
||||
nsIChannel * aChannel);
|
||||
|
||||
// Helper Routines
|
||||
nsresult ConfirmRepost(PRBool * aRepost);
|
||||
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
||||
nsIStringBundle ** aStringBundle);
|
||||
NS_IMETHOD GetChildOffset(nsIDOMNode * aChild, nsIDOMNode * aParent,
|
||||
|
||||
@@ -1167,22 +1167,11 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
||||
if (httpChannel)
|
||||
httpChannel->GetRequestMethod(method);
|
||||
if (method.Equals("POST") && !NS_IsOffline()) {
|
||||
nsCOMPtr<nsIPrompt> prompter;
|
||||
PRBool repost;
|
||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
||||
GetPromptAndStringBundle(getter_AddRefs(prompter),
|
||||
getter_AddRefs(stringBundle));
|
||||
|
||||
if (stringBundle && prompter) {
|
||||
nsXPIDLString messageStr;
|
||||
nsresult rv = stringBundle->GetStringFromName(NS_LITERAL_STRING("repost").get(),
|
||||
getter_Copies(messageStr));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && messageStr) {
|
||||
prompter->Confirm(nsnull, messageStr, &repost);
|
||||
/* If the user pressed cancel in the dialog, return. Don't
|
||||
* try to load the page with out the post data.
|
||||
*/
|
||||
rv = ConfirmRepost(&repost);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// If the user pressed cancel in the dialog, return. Don't try to load
|
||||
// the page without the post data.
|
||||
if (!repost)
|
||||
return NS_OK;
|
||||
|
||||
@@ -1227,10 +1216,10 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
||||
// anyway, since we've updated the session history index above.
|
||||
SetHistoryEntry(&mOSHE, loadingSHE);
|
||||
|
||||
/* The user does want to repost the data to the server.
|
||||
* Initiate a new load again.
|
||||
*/
|
||||
/* Get the postdata if any from the channel */
|
||||
// The user does want to repost the data to the server.
|
||||
// Initiate a new load again.
|
||||
|
||||
// Get the postdata if any from the channel.
|
||||
nsCOMPtr<nsIInputStream> inputStream;
|
||||
nsCOMPtr<nsIURI> referrer;
|
||||
if (channel) {
|
||||
@@ -1263,8 +1252,6 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
||||
nsnull, // No nsIDocShell
|
||||
nsnull); // No nsIRequest
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
DisplayLoadError(aStatus, url, nsnull, channel);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,9 @@ connectionFailure=The connection was refused when attempting to contact %S.
|
||||
netInterrupt=The connection to %S has terminated unexpectedly. Some data may have been transferred.
|
||||
netTimeout=The operation timed out when attempting to contact %S.
|
||||
redirectLoop=Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked.
|
||||
repost=The page you are trying to view contains POSTDATA that has expired from cache. If you resend the data, any action the form carried out (such as a search or online purchase) will be repeated. To resend the data, click OK. Otherwise, click Cancel.
|
||||
repostConfirm=The page you are trying to view contains POSTDATA. If you resend the data, any action the form carried out (such as a search or online purchase) will be repeated. To resend the data, click OK. Otherwise, click Cancel.
|
||||
## LOCALIZATION NOTE (confirmRepost): In this item, don't translate "%S"
|
||||
confirmRepost=To display this page, the information previously sent by %S must be resent. This will repeat any action (such as a search or order submission) that had been performed earlier.
|
||||
resendButton.label=Resend
|
||||
unknownSocketType=This document cannot be displayed unless you install the Personal Security Manager (PSM). Download and install PSM and try again, or contact your system administrator.
|
||||
netReset=The document contains no data.
|
||||
netOffline=This document cannot be displayed while offline. To go online, uncheck Work Offline from the File menu.
|
||||
|
||||
Reference in New Issue
Block a user