Put up dialog to let users know when posting secure data from insecure site

(bug 151653).
This commit is contained in:
pinkerton%netscape.com 2002-06-27 22:06:20 +00:00
Родитель 8b7bd16407
Коммит 5a22fb08ea
34 изменённых файлов: 252 добавлений и 274 удалений

48
camino/English.lproj/alert.nib/classes.nib сгенерированный
Просмотреть файл

@ -1,48 +0,0 @@
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = java.lang.Object; LANGUAGE = Java; },
{
ACTIONS = {hitButton1 = id; hitButton2 = id; hitButton3 = id; };
CLASS = nsAlertController;
LANGUAGE = ObjC;
OUTLETS = {
alertCheckPanel = id;
alertCheckPanelCheck = id;
alertCheckPanelText = id;
alertPanel = id;
alertPanelText = id;
confirmCheckPanel = id;
confirmCheckPanelButton1 = id;
confirmCheckPanelButton2 = id;
confirmCheckPanelButton3 = id;
confirmCheckPanelCheck = id;
confirmCheckPanelText = id;
confirmPanel = id;
confirmPanelButton1 = id;
confirmPanelButton2 = id;
confirmPanelButton3 = id;
confirmPanelText = id;
expiredCertPanel = id;
owner = id;
passwordPanel = id;
passwordPanelCheck = id;
passwordPanelInput = id;
passwordPanelText = id;
promptPanel = id;
promptPanelCheck = id;
promptPanelInput = id;
promptPanelText = id;
securityMismatchPanel = id;
securityUnknownPanel = id;
usernamePanel = id;
usernamePanelCheck = id;
usernamePanelPassword = id;
usernamePanelText = id;
usernamePanelUserName = id;
};
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}

6
camino/English.lproj/alert.nib/info.nib сгенерированный
Просмотреть файл

@ -6,7 +6,11 @@
<string>285 97 356 301 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBOpenObjects</key>
<array>
<integer>227</integer>
</array>
<key>IBSystem Version</key>
<string>5Q125</string>
<string>5S60</string>
</dict>
</plist>

Двоичные данные
camino/English.lproj/alert.nib/objects.nib сгенерированный

Двоичный файл не отображается.

48
camino/alert.nib/classes.nib сгенерированный
Просмотреть файл

@ -1,48 +0,0 @@
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = java.lang.Object; LANGUAGE = Java; },
{
ACTIONS = {hitButton1 = id; hitButton2 = id; hitButton3 = id; };
CLASS = nsAlertController;
LANGUAGE = ObjC;
OUTLETS = {
alertCheckPanel = id;
alertCheckPanelCheck = id;
alertCheckPanelText = id;
alertPanel = id;
alertPanelText = id;
confirmCheckPanel = id;
confirmCheckPanelButton1 = id;
confirmCheckPanelButton2 = id;
confirmCheckPanelButton3 = id;
confirmCheckPanelCheck = id;
confirmCheckPanelText = id;
confirmPanel = id;
confirmPanelButton1 = id;
confirmPanelButton2 = id;
confirmPanelButton3 = id;
confirmPanelText = id;
expiredCertPanel = id;
owner = id;
passwordPanel = id;
passwordPanelCheck = id;
passwordPanelInput = id;
passwordPanelText = id;
promptPanel = id;
promptPanelCheck = id;
promptPanelInput = id;
promptPanelText = id;
securityMismatchPanel = id;
securityUnknownPanel = id;
usernamePanel = id;
usernamePanelCheck = id;
usernamePanelPassword = id;
usernamePanelText = id;
usernamePanelUserName = id;
};
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}

6
camino/alert.nib/info.nib сгенерированный
Просмотреть файл

@ -6,7 +6,11 @@
<string>285 97 356 301 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBOpenObjects</key>
<array>
<integer>227</integer>
</array>
<key>IBSystem Version</key>
<string>5Q125</string>
<string>5S60</string>
</dict>
</plist>

Двоичные данные
camino/alert.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -63,6 +63,7 @@
IBOutlet id passwordPanelCheck;
IBOutlet id passwordPanelText;
IBOutlet id passwordPanelInput;
IBOutlet id postToInsecureFromSecurePanel;
IBOutlet id securityMismatchPanel;
IBOutlet id expiredCertPanel;
IBOutlet id securityUnknownPanel;

Просмотреть файл

@ -268,6 +268,15 @@
}
- (BOOL)postToInsecureFromSecure:(NSWindow*)parent
{
int result = [NSApp runModalForWindow:postToInsecureFromSecurePanel relativeToWindow:parent];
[postToInsecureFromSecurePanel close];
return (result == 1);
}
- (BOOL)badCert:(NSWindow*)parent
{
int result = [NSApp runModalForWindow:securityMismatchPanel relativeToWindow:parent];

Просмотреть файл

@ -77,6 +77,8 @@ public:
private:
nsresult EnsureSecurityStringBundle();
nsresult AlertDialog(nsIInterfaceRequestor *ctx, const char *prefName,
const PRUnichar *messageName,
const PRUnichar *showAgainName);

Просмотреть файл

@ -714,6 +714,21 @@ nsCocoaBrowserService::AlertMixedMode(nsIInterfaceRequestor *ctx)
}
nsresult
nsCocoaBrowserService::EnsureSecurityStringBundle()
{
if (!mSecurityStringBundle) {
#define STRING_BUNDLE_URL "chrome://communicator/locale/security.properties"
nsCOMPtr<nsIStringBundleService> service = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if ( service ) {
nsresult rv = service->CreateBundle(STRING_BUNDLE_URL, getter_AddRefs(mSecurityStringBundle));
if (NS_FAILED(rv)) return rv;
}
}
return NS_OK;
}
nsresult
nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefName,
const PRUnichar *dialogMessageName,
@ -722,22 +737,20 @@ nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefN
nsresult rv = NS_OK;
// Get user's preference for this alert
nsCOMPtr<nsIPrefBranch> pref;
PRBool prefValue = PR_TRUE;
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
if ( pref )
pref->GetBoolPref(prefName, &prefValue);
if ( prefName ) {
pref = do_GetService("@mozilla.org/preferences-service;1");
if ( pref )
pref->GetBoolPref(prefName, &prefValue);
// Stop if alert is not requested
if (!prefValue) return NS_OK;
if (!mSecurityStringBundle) {
#define STRING_BUNDLE_URL "chrome://communicator/locale/security.properties"
nsCOMPtr<nsIStringBundleService> service = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if ( service )
rv = service->CreateBundle(STRING_BUNDLE_URL, getter_AddRefs(mSecurityStringBundle));
if (NS_FAILED(rv)) return rv;
// Stop if alert is not requested
if (!prefValue) return NS_OK;
}
if ( NS_FAILED(rv = EnsureSecurityStringBundle()) )
return rv;
// Get Prompt to use
nsCOMPtr<nsIPrompt> prompt = do_GetInterface(ctx);
if (!prompt) return NS_ERROR_FAILURE;
@ -747,13 +760,17 @@ nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefN
mSecurityStringBundle->GetStringFromName(NS_LITERAL_STRING("Title").get(), getter_Copies(windowTitle));
mSecurityStringBundle->GetStringFromName(dialogMessageName, getter_Copies(message));
mSecurityStringBundle->GetStringFromName(showAgainName, getter_Copies(dontShowAgain));
if (!windowTitle || !message || !dontShowAgain) return NS_ERROR_FAILURE;
rv = prompt->AlertCheck(windowTitle, message, dontShowAgain, &prefValue);
if ( prefName )
mSecurityStringBundle->GetStringFromName(showAgainName, getter_Copies(dontShowAgain));
if (!windowTitle.get() || !message.get()) return NS_ERROR_FAILURE;
if ( prefName )
rv = prompt->AlertCheck(windowTitle, message, dontShowAgain, &prefValue);
else
rv = prompt->AlertCheck(windowTitle, message, nil, nil);
if (NS_FAILED(rv)) return rv;
if (!prefValue)
if (prefName && !prefValue)
pref->SetBoolPref(prefName, PR_FALSE);
return rv;
@ -770,7 +787,14 @@ nsCocoaBrowserService::ConfirmPostToInsecure(nsIInterfaceRequestor *ctx, PRBool*
nsresult
nsCocoaBrowserService::ConfirmPostToInsecureFromSecure(nsIInterfaceRequestor *ctx, PRBool* _result)
{
// users may care about this one, but we haven't yet implemented ConfirmEx().
*_result = PR_TRUE;
nsAlertController* controller = GetAlertController();
if (!controller)
return NS_ERROR_FAILURE;
// HACK: there is no way to get which window this is for from the API. The
// security team in mozilla just cheats and assumes the frontmost window so
// that's what we'll do. Yes, it's wrong. Yes, it's skanky. Oh well.
*_result = (PRBool)[controller postToInsecureFromSecure:[NSApp mainWindow]];
return NS_OK;
}

Просмотреть файл

@ -29,6 +29,7 @@
passwordPanelCheck = id;
passwordPanelInput = id;
passwordPanelText = id;
postToInsecureFromSecurePanel = id;
promptPanel = id;
promptPanelCheck = id;
promptPanelInput = id;

Просмотреть файл

@ -6,7 +6,11 @@
<string>285 97 356 301 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBOpenObjects</key>
<array>
<integer>227</integer>
</array>
<key>IBSystem Version</key>
<string>5Q125</string>
<string>5S60</string>
</dict>
</plist>

Двоичные данные
camino/resources/localized/English.lproj/alert.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -63,6 +63,7 @@
IBOutlet id passwordPanelCheck;
IBOutlet id passwordPanelText;
IBOutlet id passwordPanelInput;
IBOutlet id postToInsecureFromSecurePanel;
IBOutlet id securityMismatchPanel;
IBOutlet id expiredCertPanel;
IBOutlet id securityUnknownPanel;

Просмотреть файл

@ -268,6 +268,15 @@
}
- (BOOL)postToInsecureFromSecure:(NSWindow*)parent
{
int result = [NSApp runModalForWindow:postToInsecureFromSecurePanel relativeToWindow:parent];
[postToInsecureFromSecurePanel close];
return (result == 1);
}
- (BOOL)badCert:(NSWindow*)parent
{
int result = [NSApp runModalForWindow:securityMismatchPanel relativeToWindow:parent];

Просмотреть файл

@ -77,6 +77,8 @@ public:
private:
nsresult EnsureSecurityStringBundle();
nsresult AlertDialog(nsIInterfaceRequestor *ctx, const char *prefName,
const PRUnichar *messageName,
const PRUnichar *showAgainName);

Просмотреть файл

@ -714,6 +714,21 @@ nsCocoaBrowserService::AlertMixedMode(nsIInterfaceRequestor *ctx)
}
nsresult
nsCocoaBrowserService::EnsureSecurityStringBundle()
{
if (!mSecurityStringBundle) {
#define STRING_BUNDLE_URL "chrome://communicator/locale/security.properties"
nsCOMPtr<nsIStringBundleService> service = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if ( service ) {
nsresult rv = service->CreateBundle(STRING_BUNDLE_URL, getter_AddRefs(mSecurityStringBundle));
if (NS_FAILED(rv)) return rv;
}
}
return NS_OK;
}
nsresult
nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefName,
const PRUnichar *dialogMessageName,
@ -722,22 +737,20 @@ nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefN
nsresult rv = NS_OK;
// Get user's preference for this alert
nsCOMPtr<nsIPrefBranch> pref;
PRBool prefValue = PR_TRUE;
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
if ( pref )
pref->GetBoolPref(prefName, &prefValue);
if ( prefName ) {
pref = do_GetService("@mozilla.org/preferences-service;1");
if ( pref )
pref->GetBoolPref(prefName, &prefValue);
// Stop if alert is not requested
if (!prefValue) return NS_OK;
if (!mSecurityStringBundle) {
#define STRING_BUNDLE_URL "chrome://communicator/locale/security.properties"
nsCOMPtr<nsIStringBundleService> service = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if ( service )
rv = service->CreateBundle(STRING_BUNDLE_URL, getter_AddRefs(mSecurityStringBundle));
if (NS_FAILED(rv)) return rv;
// Stop if alert is not requested
if (!prefValue) return NS_OK;
}
if ( NS_FAILED(rv = EnsureSecurityStringBundle()) )
return rv;
// Get Prompt to use
nsCOMPtr<nsIPrompt> prompt = do_GetInterface(ctx);
if (!prompt) return NS_ERROR_FAILURE;
@ -747,13 +760,17 @@ nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefN
mSecurityStringBundle->GetStringFromName(NS_LITERAL_STRING("Title").get(), getter_Copies(windowTitle));
mSecurityStringBundle->GetStringFromName(dialogMessageName, getter_Copies(message));
mSecurityStringBundle->GetStringFromName(showAgainName, getter_Copies(dontShowAgain));
if (!windowTitle || !message || !dontShowAgain) return NS_ERROR_FAILURE;
rv = prompt->AlertCheck(windowTitle, message, dontShowAgain, &prefValue);
if ( prefName )
mSecurityStringBundle->GetStringFromName(showAgainName, getter_Copies(dontShowAgain));
if (!windowTitle.get() || !message.get()) return NS_ERROR_FAILURE;
if ( prefName )
rv = prompt->AlertCheck(windowTitle, message, dontShowAgain, &prefValue);
else
rv = prompt->AlertCheck(windowTitle, message, nil, nil);
if (NS_FAILED(rv)) return rv;
if (!prefValue)
if (prefName && !prefValue)
pref->SetBoolPref(prefName, PR_FALSE);
return rv;
@ -770,7 +787,14 @@ nsCocoaBrowserService::ConfirmPostToInsecure(nsIInterfaceRequestor *ctx, PRBool*
nsresult
nsCocoaBrowserService::ConfirmPostToInsecureFromSecure(nsIInterfaceRequestor *ctx, PRBool* _result)
{
// users may care about this one, but we haven't yet implemented ConfirmEx().
*_result = PR_TRUE;
nsAlertController* controller = GetAlertController();
if (!controller)
return NS_ERROR_FAILURE;
// HACK: there is no way to get which window this is for from the API. The
// security team in mozilla just cheats and assumes the frontmost window so
// that's what we'll do. Yes, it's wrong. Yes, it's skanky. Oh well.
*_result = (PRBool)[controller postToInsecureFromSecure:[NSApp mainWindow]];
return NS_OK;
}

48
chimera/English.lproj/alert.nib/classes.nib сгенерированный
Просмотреть файл

@ -1,48 +0,0 @@
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = java.lang.Object; LANGUAGE = Java; },
{
ACTIONS = {hitButton1 = id; hitButton2 = id; hitButton3 = id; };
CLASS = nsAlertController;
LANGUAGE = ObjC;
OUTLETS = {
alertCheckPanel = id;
alertCheckPanelCheck = id;
alertCheckPanelText = id;
alertPanel = id;
alertPanelText = id;
confirmCheckPanel = id;
confirmCheckPanelButton1 = id;
confirmCheckPanelButton2 = id;
confirmCheckPanelButton3 = id;
confirmCheckPanelCheck = id;
confirmCheckPanelText = id;
confirmPanel = id;
confirmPanelButton1 = id;
confirmPanelButton2 = id;
confirmPanelButton3 = id;
confirmPanelText = id;
expiredCertPanel = id;
owner = id;
passwordPanel = id;
passwordPanelCheck = id;
passwordPanelInput = id;
passwordPanelText = id;
promptPanel = id;
promptPanelCheck = id;
promptPanelInput = id;
promptPanelText = id;
securityMismatchPanel = id;
securityUnknownPanel = id;
usernamePanel = id;
usernamePanelCheck = id;
usernamePanelPassword = id;
usernamePanelText = id;
usernamePanelUserName = id;
};
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}

6
chimera/English.lproj/alert.nib/info.nib сгенерированный
Просмотреть файл

@ -6,7 +6,11 @@
<string>285 97 356 301 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBOpenObjects</key>
<array>
<integer>227</integer>
</array>
<key>IBSystem Version</key>
<string>5Q125</string>
<string>5S60</string>
</dict>
</plist>

Двоичные данные
chimera/English.lproj/alert.nib/objects.nib сгенерированный

Двоичный файл не отображается.

48
chimera/alert.nib/classes.nib сгенерированный
Просмотреть файл

@ -1,48 +0,0 @@
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{CLASS = java.lang.Object; LANGUAGE = Java; },
{
ACTIONS = {hitButton1 = id; hitButton2 = id; hitButton3 = id; };
CLASS = nsAlertController;
LANGUAGE = ObjC;
OUTLETS = {
alertCheckPanel = id;
alertCheckPanelCheck = id;
alertCheckPanelText = id;
alertPanel = id;
alertPanelText = id;
confirmCheckPanel = id;
confirmCheckPanelButton1 = id;
confirmCheckPanelButton2 = id;
confirmCheckPanelButton3 = id;
confirmCheckPanelCheck = id;
confirmCheckPanelText = id;
confirmPanel = id;
confirmPanelButton1 = id;
confirmPanelButton2 = id;
confirmPanelButton3 = id;
confirmPanelText = id;
expiredCertPanel = id;
owner = id;
passwordPanel = id;
passwordPanelCheck = id;
passwordPanelInput = id;
passwordPanelText = id;
promptPanel = id;
promptPanelCheck = id;
promptPanelInput = id;
promptPanelText = id;
securityMismatchPanel = id;
securityUnknownPanel = id;
usernamePanel = id;
usernamePanelCheck = id;
usernamePanelPassword = id;
usernamePanelText = id;
usernamePanelUserName = id;
};
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}

6
chimera/alert.nib/info.nib сгенерированный
Просмотреть файл

@ -6,7 +6,11 @@
<string>285 97 356 301 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBOpenObjects</key>
<array>
<integer>227</integer>
</array>
<key>IBSystem Version</key>
<string>5Q125</string>
<string>5S60</string>
</dict>
</plist>

Двоичные данные
chimera/alert.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -63,6 +63,7 @@
IBOutlet id passwordPanelCheck;
IBOutlet id passwordPanelText;
IBOutlet id passwordPanelInput;
IBOutlet id postToInsecureFromSecurePanel;
IBOutlet id securityMismatchPanel;
IBOutlet id expiredCertPanel;
IBOutlet id securityUnknownPanel;

Просмотреть файл

@ -268,6 +268,15 @@
}
- (BOOL)postToInsecureFromSecure:(NSWindow*)parent
{
int result = [NSApp runModalForWindow:postToInsecureFromSecurePanel relativeToWindow:parent];
[postToInsecureFromSecurePanel close];
return (result == 1);
}
- (BOOL)badCert:(NSWindow*)parent
{
int result = [NSApp runModalForWindow:securityMismatchPanel relativeToWindow:parent];

Просмотреть файл

@ -77,6 +77,8 @@ public:
private:
nsresult EnsureSecurityStringBundle();
nsresult AlertDialog(nsIInterfaceRequestor *ctx, const char *prefName,
const PRUnichar *messageName,
const PRUnichar *showAgainName);

Просмотреть файл

@ -714,6 +714,21 @@ nsCocoaBrowserService::AlertMixedMode(nsIInterfaceRequestor *ctx)
}
nsresult
nsCocoaBrowserService::EnsureSecurityStringBundle()
{
if (!mSecurityStringBundle) {
#define STRING_BUNDLE_URL "chrome://communicator/locale/security.properties"
nsCOMPtr<nsIStringBundleService> service = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if ( service ) {
nsresult rv = service->CreateBundle(STRING_BUNDLE_URL, getter_AddRefs(mSecurityStringBundle));
if (NS_FAILED(rv)) return rv;
}
}
return NS_OK;
}
nsresult
nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefName,
const PRUnichar *dialogMessageName,
@ -722,22 +737,20 @@ nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefN
nsresult rv = NS_OK;
// Get user's preference for this alert
nsCOMPtr<nsIPrefBranch> pref;
PRBool prefValue = PR_TRUE;
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
if ( pref )
pref->GetBoolPref(prefName, &prefValue);
if ( prefName ) {
pref = do_GetService("@mozilla.org/preferences-service;1");
if ( pref )
pref->GetBoolPref(prefName, &prefValue);
// Stop if alert is not requested
if (!prefValue) return NS_OK;
if (!mSecurityStringBundle) {
#define STRING_BUNDLE_URL "chrome://communicator/locale/security.properties"
nsCOMPtr<nsIStringBundleService> service = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if ( service )
rv = service->CreateBundle(STRING_BUNDLE_URL, getter_AddRefs(mSecurityStringBundle));
if (NS_FAILED(rv)) return rv;
// Stop if alert is not requested
if (!prefValue) return NS_OK;
}
if ( NS_FAILED(rv = EnsureSecurityStringBundle()) )
return rv;
// Get Prompt to use
nsCOMPtr<nsIPrompt> prompt = do_GetInterface(ctx);
if (!prompt) return NS_ERROR_FAILURE;
@ -747,13 +760,17 @@ nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefN
mSecurityStringBundle->GetStringFromName(NS_LITERAL_STRING("Title").get(), getter_Copies(windowTitle));
mSecurityStringBundle->GetStringFromName(dialogMessageName, getter_Copies(message));
mSecurityStringBundle->GetStringFromName(showAgainName, getter_Copies(dontShowAgain));
if (!windowTitle || !message || !dontShowAgain) return NS_ERROR_FAILURE;
rv = prompt->AlertCheck(windowTitle, message, dontShowAgain, &prefValue);
if ( prefName )
mSecurityStringBundle->GetStringFromName(showAgainName, getter_Copies(dontShowAgain));
if (!windowTitle.get() || !message.get()) return NS_ERROR_FAILURE;
if ( prefName )
rv = prompt->AlertCheck(windowTitle, message, dontShowAgain, &prefValue);
else
rv = prompt->AlertCheck(windowTitle, message, nil, nil);
if (NS_FAILED(rv)) return rv;
if (!prefValue)
if (prefName && !prefValue)
pref->SetBoolPref(prefName, PR_FALSE);
return rv;
@ -770,7 +787,14 @@ nsCocoaBrowserService::ConfirmPostToInsecure(nsIInterfaceRequestor *ctx, PRBool*
nsresult
nsCocoaBrowserService::ConfirmPostToInsecureFromSecure(nsIInterfaceRequestor *ctx, PRBool* _result)
{
// users may care about this one, but we haven't yet implemented ConfirmEx().
*_result = PR_TRUE;
nsAlertController* controller = GetAlertController();
if (!controller)
return NS_ERROR_FAILURE;
// HACK: there is no way to get which window this is for from the API. The
// security team in mozilla just cheats and assumes the frontmost window so
// that's what we'll do. Yes, it's wrong. Yes, it's skanky. Oh well.
*_result = (PRBool)[controller postToInsecureFromSecure:[NSApp mainWindow]];
return NS_OK;
}

Просмотреть файл

@ -29,6 +29,7 @@
passwordPanelCheck = id;
passwordPanelInput = id;
passwordPanelText = id;
postToInsecureFromSecurePanel = id;
promptPanel = id;
promptPanelCheck = id;
promptPanelInput = id;

Просмотреть файл

@ -6,7 +6,11 @@
<string>285 97 356 301 0 0 1024 746 </string>
<key>IBFramework Version</key>
<string>248.0</string>
<key>IBOpenObjects</key>
<array>
<integer>227</integer>
</array>
<key>IBSystem Version</key>
<string>5Q125</string>
<string>5S60</string>
</dict>
</plist>

Двоичные данные
chimera/resources/localized/English.lproj/alert.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -63,6 +63,7 @@
IBOutlet id passwordPanelCheck;
IBOutlet id passwordPanelText;
IBOutlet id passwordPanelInput;
IBOutlet id postToInsecureFromSecurePanel;
IBOutlet id securityMismatchPanel;
IBOutlet id expiredCertPanel;
IBOutlet id securityUnknownPanel;

Просмотреть файл

@ -268,6 +268,15 @@
}
- (BOOL)postToInsecureFromSecure:(NSWindow*)parent
{
int result = [NSApp runModalForWindow:postToInsecureFromSecurePanel relativeToWindow:parent];
[postToInsecureFromSecurePanel close];
return (result == 1);
}
- (BOOL)badCert:(NSWindow*)parent
{
int result = [NSApp runModalForWindow:securityMismatchPanel relativeToWindow:parent];

Просмотреть файл

@ -77,6 +77,8 @@ public:
private:
nsresult EnsureSecurityStringBundle();
nsresult AlertDialog(nsIInterfaceRequestor *ctx, const char *prefName,
const PRUnichar *messageName,
const PRUnichar *showAgainName);

Просмотреть файл

@ -714,6 +714,21 @@ nsCocoaBrowserService::AlertMixedMode(nsIInterfaceRequestor *ctx)
}
nsresult
nsCocoaBrowserService::EnsureSecurityStringBundle()
{
if (!mSecurityStringBundle) {
#define STRING_BUNDLE_URL "chrome://communicator/locale/security.properties"
nsCOMPtr<nsIStringBundleService> service = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if ( service ) {
nsresult rv = service->CreateBundle(STRING_BUNDLE_URL, getter_AddRefs(mSecurityStringBundle));
if (NS_FAILED(rv)) return rv;
}
}
return NS_OK;
}
nsresult
nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefName,
const PRUnichar *dialogMessageName,
@ -722,22 +737,20 @@ nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefN
nsresult rv = NS_OK;
// Get user's preference for this alert
nsCOMPtr<nsIPrefBranch> pref;
PRBool prefValue = PR_TRUE;
nsCOMPtr<nsIPrefBranch> pref(do_GetService("@mozilla.org/preferences-service;1"));
if ( pref )
pref->GetBoolPref(prefName, &prefValue);
if ( prefName ) {
pref = do_GetService("@mozilla.org/preferences-service;1");
if ( pref )
pref->GetBoolPref(prefName, &prefValue);
// Stop if alert is not requested
if (!prefValue) return NS_OK;
if (!mSecurityStringBundle) {
#define STRING_BUNDLE_URL "chrome://communicator/locale/security.properties"
nsCOMPtr<nsIStringBundleService> service = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
if ( service )
rv = service->CreateBundle(STRING_BUNDLE_URL, getter_AddRefs(mSecurityStringBundle));
if (NS_FAILED(rv)) return rv;
// Stop if alert is not requested
if (!prefValue) return NS_OK;
}
if ( NS_FAILED(rv = EnsureSecurityStringBundle()) )
return rv;
// Get Prompt to use
nsCOMPtr<nsIPrompt> prompt = do_GetInterface(ctx);
if (!prompt) return NS_ERROR_FAILURE;
@ -747,13 +760,17 @@ nsCocoaBrowserService::AlertDialog(nsIInterfaceRequestor *ctx, const char *prefN
mSecurityStringBundle->GetStringFromName(NS_LITERAL_STRING("Title").get(), getter_Copies(windowTitle));
mSecurityStringBundle->GetStringFromName(dialogMessageName, getter_Copies(message));
mSecurityStringBundle->GetStringFromName(showAgainName, getter_Copies(dontShowAgain));
if (!windowTitle || !message || !dontShowAgain) return NS_ERROR_FAILURE;
rv = prompt->AlertCheck(windowTitle, message, dontShowAgain, &prefValue);
if ( prefName )
mSecurityStringBundle->GetStringFromName(showAgainName, getter_Copies(dontShowAgain));
if (!windowTitle.get() || !message.get()) return NS_ERROR_FAILURE;
if ( prefName )
rv = prompt->AlertCheck(windowTitle, message, dontShowAgain, &prefValue);
else
rv = prompt->AlertCheck(windowTitle, message, nil, nil);
if (NS_FAILED(rv)) return rv;
if (!prefValue)
if (prefName && !prefValue)
pref->SetBoolPref(prefName, PR_FALSE);
return rv;
@ -770,7 +787,14 @@ nsCocoaBrowserService::ConfirmPostToInsecure(nsIInterfaceRequestor *ctx, PRBool*
nsresult
nsCocoaBrowserService::ConfirmPostToInsecureFromSecure(nsIInterfaceRequestor *ctx, PRBool* _result)
{
// users may care about this one, but we haven't yet implemented ConfirmEx().
*_result = PR_TRUE;
nsAlertController* controller = GetAlertController();
if (!controller)
return NS_ERROR_FAILURE;
// HACK: there is no way to get which window this is for from the API. The
// security team in mozilla just cheats and assumes the frontmost window so
// that's what we'll do. Yes, it's wrong. Yes, it's skanky. Oh well.
*_result = (PRBool)[controller postToInsecureFromSecure:[NSApp mainWindow]];
return NS_OK;
}