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.
|
netInterrupt=The connection to %S was interrupted while the page was loading.
|
||||||
netTimeout=The server at %S is taking too long to respond.
|
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.
|
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.
|
## LOCALIZATION NOTE (confirmRepost): In this item, don't translate "%S"
|
||||||
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.
|
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.
|
unknownSocketType=Firefox doesn't know how to communicate with the server.
|
||||||
netReset=The connection to the server was reset while the page was loading.
|
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.
|
netOffline=Firefox is currently in offline mode and can't browse the Web.
|
||||||
|
|||||||
@@ -99,6 +99,7 @@
|
|||||||
#include "nsIAppShell.h"
|
#include "nsIAppShell.h"
|
||||||
#include "nsWidgetsCID.h"
|
#include "nsWidgetsCID.h"
|
||||||
#include "nsDOMJSUtils.h"
|
#include "nsDOMJSUtils.h"
|
||||||
|
#include "nsIInterfaceRequestorUtils.h"
|
||||||
|
|
||||||
// we want to explore making the document own the load group
|
// we want to explore making the document own the load group
|
||||||
// so we can associate the document URI with the load group.
|
// so we can associate the document URI with the load group.
|
||||||
@@ -221,6 +222,9 @@ static PRLogModuleInfo* gDocShellLog;
|
|||||||
static PRLogModuleInfo* gDocShellLeakLog;
|
static PRLogModuleInfo* gDocShellLeakLog;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties";
|
||||||
|
const char kAppstringsBundleURL[] = "chrome://global/locale/appstrings.properties";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
FavorPerformanceHint(PRBool perfOverStarvation, PRUint32 starvationDelay)
|
FavorPerformanceHint(PRBool perfOverStarvation, PRUint32 starvationDelay)
|
||||||
{
|
{
|
||||||
@@ -7709,28 +7713,14 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType)
|
|||||||
* repost the data to the server.
|
* repost the data to the server.
|
||||||
*/
|
*/
|
||||||
if ((aLoadType & LOAD_CMD_RELOAD) && postData) {
|
if ((aLoadType & LOAD_CMD_RELOAD) && postData) {
|
||||||
|
|
||||||
nsCOMPtr<nsIPrompt> prompter;
|
|
||||||
PRBool repost;
|
PRBool repost;
|
||||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
rv = ConfirmRepost(&repost);
|
||||||
GetPromptAndStringBundle(getter_AddRefs(prompter),
|
if (NS_FAILED(rv)) return rv;
|
||||||
getter_AddRefs(stringBundle));
|
|
||||||
|
|
||||||
if (stringBundle && prompter) {
|
// If the user pressed cancel in the dialog, return. We're done here.
|
||||||
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 (!repost)
|
if (!repost)
|
||||||
return NS_BINDING_ABORTED;
|
return NS_BINDING_ABORTED;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = InternalLoad(uri,
|
rv = InternalLoad(uri,
|
||||||
referrerURI,
|
referrerURI,
|
||||||
@@ -8207,7 +8197,56 @@ nsDocShell::GetLoadType(PRUint32 * aLoadType)
|
|||||||
return NS_OK;
|
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
|
NS_IMETHODIMP
|
||||||
nsDocShell::GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
nsDocShell::GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
||||||
@@ -8221,7 +8260,7 @@ nsDocShell::GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
|||||||
NS_ENSURE_TRUE(stringBundleService, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(stringBundleService, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(stringBundleService->
|
NS_ENSURE_SUCCESS(stringBundleService->
|
||||||
CreateBundle(DIALOG_STRING_URI,
|
CreateBundle(kAppstringsBundleURL,
|
||||||
aStringBundle),
|
aStringBundle),
|
||||||
NS_ERROR_FAILURE);
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
|||||||
@@ -360,6 +360,7 @@ protected:
|
|||||||
nsIChannel * aChannel);
|
nsIChannel * aChannel);
|
||||||
|
|
||||||
// Helper Routines
|
// Helper Routines
|
||||||
|
nsresult ConfirmRepost(PRBool * aRepost);
|
||||||
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
||||||
nsIStringBundle ** aStringBundle);
|
nsIStringBundle ** aStringBundle);
|
||||||
NS_IMETHOD GetChildOffset(nsIDOMNode * aChild, nsIDOMNode * aParent,
|
NS_IMETHOD GetChildOffset(nsIDOMNode * aChild, nsIDOMNode * aParent,
|
||||||
|
|||||||
@@ -1167,22 +1167,11 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
|||||||
if (httpChannel)
|
if (httpChannel)
|
||||||
httpChannel->GetRequestMethod(method);
|
httpChannel->GetRequestMethod(method);
|
||||||
if (method.Equals("POST") && !NS_IsOffline()) {
|
if (method.Equals("POST") && !NS_IsOffline()) {
|
||||||
nsCOMPtr<nsIPrompt> prompter;
|
|
||||||
PRBool repost;
|
PRBool repost;
|
||||||
nsCOMPtr<nsIStringBundle> stringBundle;
|
rv = ConfirmRepost(&repost);
|
||||||
GetPromptAndStringBundle(getter_AddRefs(prompter),
|
if (NS_FAILED(rv)) return rv;
|
||||||
getter_AddRefs(stringBundle));
|
// If the user pressed cancel in the dialog, return. Don't try to load
|
||||||
|
// the page without the post data.
|
||||||
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.
|
|
||||||
*/
|
|
||||||
if (!repost)
|
if (!repost)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
@@ -1227,10 +1216,10 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
|||||||
// anyway, since we've updated the session history index above.
|
// anyway, since we've updated the session history index above.
|
||||||
SetHistoryEntry(&mOSHE, loadingSHE);
|
SetHistoryEntry(&mOSHE, loadingSHE);
|
||||||
|
|
||||||
/* The user does want to repost the data to the server.
|
// The user does want to repost the data to the server.
|
||||||
* Initiate a new load again.
|
// Initiate a new load again.
|
||||||
*/
|
|
||||||
/* Get the postdata if any from the channel */
|
// Get the postdata if any from the channel.
|
||||||
nsCOMPtr<nsIInputStream> inputStream;
|
nsCOMPtr<nsIInputStream> inputStream;
|
||||||
nsCOMPtr<nsIURI> referrer;
|
nsCOMPtr<nsIURI> referrer;
|
||||||
if (channel) {
|
if (channel) {
|
||||||
@@ -1263,8 +1252,6 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress,
|
|||||||
nsnull, // No nsIDocShell
|
nsnull, // No nsIDocShell
|
||||||
nsnull); // No nsIRequest
|
nsnull); // No nsIRequest
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
DisplayLoadError(aStatus, url, nsnull, channel);
|
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.
|
netInterrupt=The connection to %S has terminated unexpectedly. Some data may have been transferred.
|
||||||
netTimeout=The operation timed out when attempting to contact %S.
|
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.
|
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.
|
## LOCALIZATION NOTE (confirmRepost): In this item, don't translate "%S"
|
||||||
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.
|
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.
|
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.
|
netReset=The document contains no data.
|
||||||
netOffline=This document cannot be displayed while offline. To go online, uncheck Work Offline from the File menu.
|
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