зеркало из https://github.com/mozilla/pjs.git
Put up dialog to let users know when posting secure data from insecure site
(bug 151653).
This commit is contained in:
Родитель
8b7bd16407
Коммит
5a22fb08ea
|
@ -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,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>
|
||||
|
|
Двоичный файл не отображается.
|
@ -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,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>
|
||||
|
|
Двоичный файл не отображается.
|
@ -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>
|
||||
|
|
Двоичный файл не отображается.
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,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>
|
||||
|
|
Двоичный файл не отображается.
|
@ -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,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>
|
||||
|
|
Двоичный файл не отображается.
|
@ -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>
|
||||
|
|
Двоичный файл не отображается.
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче