diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-04 01:56:18 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-04 01:56:18 +0000 |
commit | 4035a150e22bf51631b09fc810002d859aea1565 (patch) | |
tree | 0f5a8908585dd4dfc1b274c6a0caad28124b0485 | |
parent | c296bfc9c44bd0ab389bb2d2772fcdf4cbac30c6 (diff) | |
download | chromium_src-4035a150e22bf51631b09fc810002d859aea1565.zip chromium_src-4035a150e22bf51631b09fc810002d859aea1565.tar.gz chromium_src-4035a150e22bf51631b09fc810002d859aea1565.tar.bz2 |
Fix -[NSString isValidURI].
Use GURL for validation instead of NSURL. NSURL is extremely liberal
with what it considers a valid URI, since it also uses RFC 1808 to
parse.
BUG=43100
TEST=none
Review URL: http://codereview.chromium.org/1904001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46318 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/chrome_browser.gypi | 2 | ||||
-rw-r--r-- | third_party/mozilla/NSString+Utils.mm (renamed from third_party/mozilla/NSString+Utils.m) | 7 | ||||
-rw-r--r-- | third_party/mozilla/README.chromium | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 8e636d3..9b161c5 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2660,7 +2660,7 @@ '../third_party/mozilla/NSScreen+Utils.h', '../third_party/mozilla/NSScreen+Utils.m', '../third_party/mozilla/NSString+Utils.h', - '../third_party/mozilla/NSString+Utils.m', + '../third_party/mozilla/NSString+Utils.mm', '../third_party/mozilla/NSURL+Utils.h', '../third_party/mozilla/NSURL+Utils.m', '../third_party/mozilla/NSWorkspace+Utils.h', diff --git a/third_party/mozilla/NSString+Utils.m b/third_party/mozilla/NSString+Utils.mm index c145505..bc6b342 100644 --- a/third_party/mozilla/NSString+Utils.m +++ b/third_party/mozilla/NSString+Utils.mm @@ -39,6 +39,7 @@ #import <AppKit/AppKit.h> // for NSStringDrawing.h #import "NSString+Utils.h" +#include "googleurl/src/gurl.h" @implementation NSString (ChimeraStringUtils) @@ -89,12 +90,12 @@ - (BOOL)isValidURI { - // This will only return a non-nil object for valid, well-formed URI strings - NSURL* testURL = [NSURL URLWithString:self]; + // isValid() will only be true for valid, well-formed URI strings + GURL testURL([self UTF8String]); // |javascript:| and |data:| URIs might not have passed the test, // but spaces will work OK, so evaluate them separately. - if ((testURL) || [self isLooselyValidatedURI]) { + if ((testURL.is_valid()) || [self isLooselyValidatedURI]) { return YES; } return NO; diff --git a/third_party/mozilla/README.chromium b/third_party/mozilla/README.chromium index ab83407..658fd72 100644 --- a/third_party/mozilla/README.chromium +++ b/third_party/mozilla/README.chromium @@ -14,3 +14,5 @@ Description: Local modifications: NSURL+Utils.m was modified to use non-deprecated Cocoa APIs to allow compilation on future versions of Mac OS X. + NSString+Utils.m was renamed to NSString+Utils.mm and modified to use GURL + for validation in -[NSString isValidURI]. |