summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-08 19:04:54 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-08 19:04:54 +0000
commita2494cb564bee20bd59457293537599364a2863d (patch)
tree87233d47cdb31747e036d9446f4332c6fe9ca6ee /chrome
parent87258a289e1d0732af8716d0aa5e910fc8c955be (diff)
downloadchromium_src-a2494cb564bee20bd59457293537599364a2863d.zip
chromium_src-a2494cb564bee20bd59457293537599364a2863d.tar.gz
chromium_src-a2494cb564bee20bd59457293537599364a2863d.tar.bz2
Fix NSString conversions to treat a null NSString as a string of length 0, instead of crashing. This allows Cocoa to use null objects as empties, as is its wont, and we only run a check when needed.
This CL also removes the now-superfluous checks for null NSStrings from BugReportWindowController. A cursory look through the code shows that there are many places where a check for null precedes a call to an NSString conversion; filed another bug against myself to go through and fix all of these (http://code.google.com/p/chromium/issues/detail?id=27055). Also filed a bug to expand unit tests for NSString conversion methods (http://code.google.com/p/chromium/issues/detail?id=27059). Review URL: http://codereview.chromium.org/371057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cocoa/bug_report_window_controller.mm11
-rw-r--r--chrome/browser/cocoa/bug_report_window_controller_unittest.mm7
2 files changed, 7 insertions, 11 deletions
diff --git a/chrome/browser/cocoa/bug_report_window_controller.mm b/chrome/browser/cocoa/bug_report_window_controller.mm
index d61adc4..a22e822 100644
--- a/chrome/browser/cocoa/bug_report_window_controller.mm
+++ b/chrome/browser/cocoa/bug_report_window_controller.mm
@@ -33,7 +33,6 @@
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
currentTab_ = currentTab;
profile_ = profile;
- [self setBugDescription:@""];
if (currentTab_ != NULL) {
// Get data from current tab, if one exists. This dialog could be called
@@ -69,10 +68,6 @@
l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_BROWSER_CRASH),
l10n_util::GetNSStringWithFixup(IDS_BUGREPORT_OTHER_PROBLEM),
nil];
- // Because "Report Bug" is being called with no browser open in this
- // case, make URL and title empty.
- [self setPageURL:@""];
- [self setPageTitle:@""];
}
}
return self;
@@ -109,10 +104,10 @@
} else {
BugReportUtil::SendReport(
profile_,
- pageTitle_ ? base::SysNSStringToUTF8(pageTitle_) : "",
+ base::SysNSStringToUTF8(pageTitle_),
bugType_,
- pageURL_ ? base::SysNSStringToUTF8(pageURL_) : "",
- bugDescription_ ? base::SysNSStringToUTF8(bugDescription_) : "",
+ base::SysNSStringToUTF8(pageURL_),
+ base::SysNSStringToUTF8(bugDescription_),
sendScreenshot_ && !pngData_.empty() ?
reinterpret_cast<const char *>(&(pngData_[0])) : NULL,
pngData_.size());
diff --git a/chrome/browser/cocoa/bug_report_window_controller_unittest.mm b/chrome/browser/cocoa/bug_report_window_controller_unittest.mm
index 6b15c4a..4be73fb 100644
--- a/chrome/browser/cocoa/bug_report_window_controller_unittest.mm
+++ b/chrome/browser/cocoa/bug_report_window_controller_unittest.mm
@@ -54,9 +54,10 @@ TEST_F(BugReportWindowControllerUnittest, ReportBugWithNoWindowOpen) {
initWithTabContents:NULL
profile:profile_.get()];
- // Make sure that no page title or URL are recorded.
- EXPECT_TRUE([[controller pageURL] isEqualToString:@""]);
- EXPECT_TRUE([[controller pageTitle] isEqualToString:@""]);
+ // Make sure that no page title or URL are recorded. Note that IB reports
+ // empty textfields as NULL values.
+ EXPECT_FALSE([controller pageURL]);
+ EXPECT_FALSE([controller pageTitle]);
// When we call "report bug" with empty tab contents, only menu options
// that don't refer to a specific page should be available, and the send