+2016-03-15 Chris Dumez <cdumez@apple.com>
+
+ Unreviewed, rolling out r198203.
+
+ Favorites view is no longer loading on iOS
+
+ Reverted changeset:
+
+ "URL Parsing should signal failure for illegal IDN"
+ https://bugs.webkit.org/show_bug.cgi?id=154945
+ http://trac.webkit.org/changeset/198203
+
2016-03-15 Antti Koivisto <antti@apple.com>
Class change invalidation does not handle :not correctly
FAIL canonicalize('http://GOO goo.com/') should be http://goo%20%20goo.com/. Was http://GOO goo.com/.
PASS canonicalize('http://GOOgoo.com/') is 'http://googoo.com/'
PASS canonicalize('http://www.foo。bar.com/') is 'http://www.foo.bar.com/'
-FAIL canonicalize('http://zyx.com/') should be http://%EF%BF%BDzyx.com/. Was about:blank.
+FAIL canonicalize('http://zyx.com/') should be http://%EF%BF%BDzyx.com/. Was http:/.
FAIL canonicalize('http://%ef%b7%90zyx.com/') should be http://%EF%BF%BDzyx.com/. Was http://%ef%b7%90zyx.com/.
PASS canonicalize('http://Go.com/') is 'http://go.com/'
FAIL canonicalize('http://%41.com/') should be http://a.com/. Was http://%41.com/.
PASS canonicalize('http://www.looĸout.net/') is 'http://www.xn--looout-5bb.net/'
FAIL canonicalize('http://www.lookout.net⩴80/') should be http://www.lookout.net::%3D80/. Was http://www.lookout.net⩴80/.
FAIL canonicalize('http://www .lookout.net/') should be http://www%20.lookout.net/. Was http://www .lookout.net/.
-FAIL canonicalize('http:// lookout.net/') should be http://%E1%9A%80lookout.net/. Was about:blank.
+FAIL canonicalize('http:// lookout.net/') should be http://%E1%9A%80lookout.net/. Was http:/.
FAIL canonicalize('http://\1flookout.net/') should be http://%1Flookout.net/. Was http://\1flookout.net/.
-FAIL canonicalize('http://lookout.net/') should be http://look%DB%9Dout.net/. Was about:blank.
-FAIL canonicalize('http://lookout.net/') should be http://look%E1%A0%8Eout.net/. Was about:blank.
+FAIL canonicalize('http://lookout.net/') should be http://look%DB%9Dout.net/. Was http:/.
+FAIL canonicalize('http://lookout.net/') should be http://look%E1%A0%8Eout.net/. Was http:/.
FAIL canonicalize('http://lookout.net/') should be http://look%E2%81%A0out.net/. Was http://lookout.net/.
FAIL canonicalize('http://lookout.net/') should be http://look%EF%BB%BFout.net/. Was http://lookout.net/.
-FAIL canonicalize('http://lookout.net/') should be http://look%F0%9F%BF%BEout.net/. Was about:blank.
-FAIL canonicalize('http://lookout.net/') should be http://look%EF%BF%BAout.net/. Was about:blank.
-FAIL canonicalize('http://look⿰out.net/') should be http://look%E2%BF%B0out.net/. Was about:blank.
+FAIL canonicalize('http://lookout.net/') should be http://look%F0%9F%BF%BEout.net/. Was http:/.
+FAIL canonicalize('http://lookout.net/') should be http://look%EF%BF%BAout.net/. Was http:/.
+FAIL canonicalize('http://look⿰out.net/') should be http://look%E2%BF%B0out.net/. Was http:/.
FAIL canonicalize('http://looḱout.net/') should be http://look%CD%81out.net/. Was http://xn--looout-kp7b.net/.
-FAIL canonicalize('http://lookout.net/') should be http://look%E2%80%AEout.net/. Was about:blank.
-FAIL canonicalize('http://lookout.net/') should be http://look%E2%81%ABout.net/. Was about:blank.
-FAIL canonicalize('http://lookout.net/') should be http://look%F3%A0%80%81out.net/. Was about:blank.
-FAIL canonicalize('http://lookout.net/') should be http://look%F3%A0%80%A0out.net/. Was about:blank.
-FAIL canonicalize('http://look־out.net/') should be http://look%D6%BEout.net/. Was about:blank.
+FAIL canonicalize('http://lookout.net/') should be http://look%E2%80%AEout.net/. Was http:/.
+FAIL canonicalize('http://lookout.net/') should be http://look%E2%81%ABout.net/. Was http:/.
+FAIL canonicalize('http://lookout.net/') should be http://look%F3%A0%80%81out.net/. Was http:/.
+FAIL canonicalize('http://lookout.net/') should be http://look%F3%A0%80%A0out.net/. Was http:/.
+FAIL canonicalize('http://look־out.net/') should be http://look%D6%BEout.net/. Was http:/.
PASS successfullyParsed is true
TEST COMPLETE
+++ /dev/null
-Test passes if all the invalid urls are converted to about:blank.
-about:blank
-about:blank
-
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-16">
-<!-- Set the base so that the current URL does not affect the tests. -->
-<base href="">
-</head>
-<body>
-
-<script>
-if (window.testRunner)
- testRunner.dumpAsText();
-
-// Start the bidding at 42 for no particular reason.
-var lastID = 42;
-
-function canonicalize(url)
-{
- var id = ++lastID;
- document.write("<a id='" + id + "' href='" + url + "'></a>");
- return document.getElementById(id).href;
-}
-
-// Those are all invalid URLs. They should not be accepted by the parser.
-var testSet = [
- 'http://.com',
- 'http://www.اast.fm'
-];
-
-document.write("Test passes if all the invalid urls are converted to about:blank.<br>");
-for (var i = 0; i < testSet.length; ++i) {
- src = canonicalize(testSet[i]);
- document.write(src + "<br>");
-}
-</script>
-</body>
-</html>
+2016-03-15 Chris Dumez <cdumez@apple.com>
+
+ Unreviewed, rolling out r198203.
+
+ Favorites view is no longer loading on iOS
+
+ Reverted changeset:
+
+ "URL Parsing should signal failure for illegal IDN"
+ https://bugs.webkit.org/show_bug.cgi?id=154945
+ http://trac.webkit.org/changeset/198203
+
2016-03-15 Tim Horton <timothy_horton@apple.com>
<attachment> on iOS should use short and emphasized fonts
};
static int copyPathRemovingDots(char* dst, const char* src, int srcStart, int srcEnd);
-static bool encodeRelativeString(const String& rel, const TextEncoding&, CharBuffer& ouput);
+static void encodeRelativeString(const String& rel, const TextEncoding&, CharBuffer& ouput);
static String substituteBackslashes(const String&);
static inline bool isSchemeFirstChar(char c) { return characterClassTable[static_cast<unsigned char>(c)] & SchemeFirstChar; }
strBuffer[len] = 0;
str = strBuffer.data();
} else {
- if (!encodeRelativeString(rel, encoding, strBuffer)) {
- m_string = blankURL();
- invalidate();
- return;
- }
-
+ encodeRelativeString(rel, encoding, strBuffer);
str = strBuffer.data();
len = strlen(str);
}
// Appends the punycoded hostname identified by the given string and length to
// the output buffer. The result will not be null terminated.
-// Return value of false means error in encoding.
-static bool appendEncodedHostname(UCharBuffer& buffer, StringView string)
+static void appendEncodedHostname(UCharBuffer& buffer, StringView string)
{
// Needs to be big enough to hold an IDN-encoded name.
// For host names bigger than this, we won't do IDN encoding, which is almost certainly OK.
if (string.length() > hostnameBufferLength || containsOnlyASCII(string)) {
append(buffer, string);
- return true;
+ return;
}
UChar hostnameBuffer[hostnameBufferLength];
#pragma GCC diagnostic pop
#endif
- if (error == U_ZERO_ERROR) {
+ if (error == U_ZERO_ERROR)
buffer.append(hostnameBuffer, numCharactersConverted);
- return true;
- }
- return false;
}
static void findHostnamesInMailToURL(StringView string, Vector<std::pair<int, int>>& nameRanges)
// Converts all hostnames found in the given input to punycode, preserving the
// rest of the URL unchanged. The output will NOT be null-terminated.
-// Return value of false means error in encoding.
-static bool encodeHostnames(StringView string, UCharBuffer& buffer)
+static void encodeHostnames(StringView string, UCharBuffer& buffer)
{
buffer.clear();
for (int i = 0; i < n; ++i) {
const std::pair<int, int>& r = hostnameRanges[i];
append(buffer, string.substring(p, r.first - p));
- if (!appendEncodedHostname(buffer, string.substring(r.first, r.second - r.first)))
- return false;
+ appendEncodedHostname(buffer, string.substring(r.first, r.second - r.first));
p = r.second;
}
// This will copy either everything after the last hostname, or the
int hostStart, hostEnd;
if (findHostnameInHierarchicalURL(string, hostStart, hostEnd)) {
append(buffer, string.substring(0, hostStart)); // Before hostname.
- if (!appendEncodedHostname(buffer, string.substring(hostStart, hostEnd - hostStart)))
- return false;
+ appendEncodedHostname(buffer, string.substring(hostStart, hostEnd - hostStart));
append(buffer, string.substring(hostEnd)); // After hostname.
} else {
// No hostname to encode, return the input.
append(buffer, string);
}
}
-
- return true;
}
-// Return value of false means error in encoding.
-static bool encodeRelativeString(const String& rel, const TextEncoding& encoding, CharBuffer& output)
+static void encodeRelativeString(const String& rel, const TextEncoding& encoding, CharBuffer& output)
{
UCharBuffer s;
- if (!encodeHostnames(rel, s))
- return false;
+ encodeHostnames(rel, s);
TextEncoding pathEncoding(UTF8Encoding()); // Path is always encoded as UTF-8; other parts may depend on the scheme.
memcpy(output.data() + pathDecoded.length(), otherDecoded.data(), otherDecoded.length());
}
output.append('\0'); // null-terminate the output.
-
- return true;
}
static String substituteBackslashes(const String& string)
WEBCORE_EXPORT NSString *userVisibleString(NSURL *);
WEBCORE_EXPORT NSURL *URLByCanonicalizingURL(NSURL *);
-WEBCORE_EXPORT NSURL *URLWithUserTypedString(NSString *, NSURL *baseURL); // Return value of nil means error.
+WEBCORE_EXPORT NSURL *URLWithUserTypedString(NSString *, NSURL *baseURL);
WEBCORE_EXPORT NSURL *URLByRemovingUserInfo(NSURL *);
-WEBCORE_EXPORT BOOL hostNameNeedsDecodingWithRange(NSString *, NSRange, BOOL* error);
-WEBCORE_EXPORT BOOL hostNameNeedsEncodingWithRange(NSString *, NSRange, BOOL* error);
-WEBCORE_EXPORT NSString *decodeHostNameWithRange(NSString *, NSRange); // Return value of nil means error.
-WEBCORE_EXPORT NSString *encodeHostNameWithRange(NSString *, NSRange); // Return value of nil means error.
-WEBCORE_EXPORT NSString *decodeHostName(NSString *); // Return value of nil means error.
-WEBCORE_EXPORT NSString *encodeHostName(NSString *); // Return value of nil means error.
+WEBCORE_EXPORT BOOL hostNameNeedsDecodingWithRange(NSString *, NSRange);
+WEBCORE_EXPORT BOOL hostNameNeedsEncodingWithRange(NSString *, NSRange);
+WEBCORE_EXPORT NSString *decodeHostNameWithRange(NSString *, NSRange);
+WEBCORE_EXPORT NSString *encodeHostNameWithRange(NSString *, NSRange);
+WEBCORE_EXPORT NSString *decodeHostName(NSString *);
+WEBCORE_EXPORT NSString *encodeHostName(NSString *);
WEBCORE_EXPORT NSURL *URLByTruncatingOneCharacterBeforeComponent(NSURL *, CFURLComponentType);
WEBCORE_EXPORT NSURL *URLWithData(NSData *, NSURL *baseURL);
WEBCORE_EXPORT NSData *originalURLData(NSURL *);
WEBCORE_EXPORT NSData *dataForURLComponentType(NSURL *, CFURLComponentType);
-WEBCORE_EXPORT NSURL *URLWithUserTypedStringDeprecated(NSString *, NSURL *baseURL);
NSRange rangeOfURLScheme(NSString *);
WEBCORE_EXPORT BOOL isUserVisibleURL(NSString *);
// Return value of nil means no mapping is necessary.
// If makeString is NO, then return value is either nil or self to indicate mapping is necessary.
// If makeString is YES, then return value is either nil or the mapped string.
-static NSString *mapHostNameWithRange(NSString *string, NSRange range, BOOL encode, BOOL makeString, BOOL *error)
+static NSString *mapHostNameWithRange(NSString *string, NSRange range, BOOL encode, BOOL makeString)
{
if (range.length > HOST_NAME_BUFFER_LENGTH)
return nil;
int length = range.length;
[string getCharacters:sourceBuffer range:range];
- UErrorCode uerror = U_ZERO_ERROR;
- int32_t numCharactersConverted = (encode ? uidna_IDNToASCII : uidna_IDNToUnicode)(sourceBuffer, length, destinationBuffer, HOST_NAME_BUFFER_LENGTH, UIDNA_ALLOW_UNASSIGNED, NULL, &uerror);
- if (U_FAILURE(uerror)) {
- *error = YES;
+ UErrorCode error = U_ZERO_ERROR;
+ int32_t numCharactersConverted = (encode ? uidna_IDNToASCII : uidna_IDNToUnicode)(sourceBuffer, length, destinationBuffer, HOST_NAME_BUFFER_LENGTH, UIDNA_ALLOW_UNASSIGNED, NULL, &error);
+ if (error != U_ZERO_ERROR)
return nil;
- }
if (numCharactersConverted == length && !memcmp(sourceBuffer, destinationBuffer, length * sizeof(UChar)))
return nil;
if (!encode && !allCharactersInIDNScriptWhiteList(destinationBuffer, numCharactersConverted) && !allCharactersAllowedByTLDRules(destinationBuffer, numCharactersConverted))
return nil;
- return makeString ? [NSString stringWithCharacters:destinationBuffer length:numCharactersConverted] : string;
+ return makeString ? (NSString *)[NSString stringWithCharacters:destinationBuffer length:numCharactersConverted] : string;
}
-BOOL hostNameNeedsDecodingWithRange(NSString *string, NSRange range, BOOL *error)
+BOOL hostNameNeedsDecodingWithRange(NSString *string, NSRange range)
{
- return mapHostNameWithRange(string, range, NO, NO, error) != nil;
+ return mapHostNameWithRange(string, range, NO, NO) != nil;
}
-BOOL hostNameNeedsEncodingWithRange(NSString *string, NSRange range, BOOL *error)
+BOOL hostNameNeedsEncodingWithRange(NSString *string, NSRange range)
{
- return mapHostNameWithRange(string, range, YES, NO, error) != nil;
+ return mapHostNameWithRange(string, range, YES, NO) != nil;
}
NSString *decodeHostNameWithRange(NSString *string, NSRange range)
{
- BOOL error = NO;
- NSString *host = mapHostNameWithRange(string, range, NO, YES, &error);
- if (error)
- return nil;
- return !host ? string : host;
+ return mapHostNameWithRange(string, range, NO, YES);
}
NSString *encodeHostNameWithRange(NSString *string, NSRange range)
{
- BOOL error = NO;
- NSString *host = mapHostNameWithRange(string, range, YES, YES, &error);
- if (error)
- return nil;
- return !host ? string : host;
+ return mapHostNameWithRange(string, range, YES, YES);
}
NSString *decodeHostName(NSString *string)
{
- BOOL error = NO;
- NSString *host = mapHostNameWithRange(string, NSMakeRange(0, [string length]), NO, YES, &error);
- if (error)
- return nil;
- return !host ? string : host;
+ NSString *name = mapHostNameWithRange(string, NSMakeRange(0, [string length]), NO, YES);
+ return !name ? string : name;
}
NSString *encodeHostName(NSString *string)
{
- BOOL error = NO;
- NSString *host = mapHostNameWithRange(string, NSMakeRange(0, [string length]), YES, YES, &error);
- if (error)
- return nil;
- return !host ? string : host;
+ NSString *name = mapHostNameWithRange(string, NSMakeRange(0, [string length]), YES, YES);
+ return !name ? string : name;
}
static void collectRangesThatNeedMapping(NSString *string, NSRange range, void *context, BOOL encode)
{
- // Generally, we want to optimize for the case where there is one host name that does not need mapping.
- // Therefore, we use nil to indicate no mapping here and an empty array to indicate error.
-
- BOOL error = NO;
- BOOL needsMapping = encode ? hostNameNeedsEncodingWithRange(string, range, &error) : hostNameNeedsDecodingWithRange(string, range, &error);
- if (!error && !needsMapping)
+ BOOL needsMapping = encode ? hostNameNeedsEncodingWithRange(string, range) : hostNameNeedsDecodingWithRange(string, range);
+ if (!needsMapping)
return;
NSMutableArray **array = (NSMutableArray **)context;
if (!*array)
*array = [[NSMutableArray alloc] init];
- if (!error)
- [*array addObject:[NSValue valueWithRange:range]];
+ [*array addObject:[NSValue valueWithRange:range]];
}
static void collectRangesThatNeedEncoding(NSString *string, NSRange range, void *context)
applyHostNameFunctionToURLString(string, f, &hostNameRanges);
if (!hostNameRanges)
return string;
-
- if (![hostNameRanges count])
- return nil;
// Do the mapping.
NSMutableString *mutableCopy = [string mutableCopy];
result = CFBridgingRelease(CFURLCreateAbsoluteURLWithBytes(NULL, bytes, length, kCFStringEncodingISOLatin1, (CFURLRef)baseURL, YES));
} else
result = [NSURL URLWithString:@""];
-
+
return result;
}
-static NSData *dataWithUserTypedString(NSString *string)
+
+NSURL *URLWithUserTypedString(NSString *string, NSURL *URL)
{
+ if (!string)
+ return nil;
+
+ string = mapHostNames(stringByTrimmingWhitespace(string), YES);
+
NSData *userTypedData = [string dataUsingEncoding:NSUTF8StringEncoding];
ASSERT(userTypedData);
const UInt8* inBytes = static_cast<const UInt8 *>([userTypedData bytes]);
int inLength = [userTypedData length];
if (!inLength)
- return nil;
+ return [NSURL URLWithString:@""];
char* outBytes = static_cast<char *>(malloc(inLength * 3)); // large enough to %-escape every character
char* p = outBytes;
}
}
- return [NSData dataWithBytesNoCopy:outBytes length:outLength]; // adopts outBytes
-}
-
-NSURL *URLWithUserTypedString(NSString *string, NSURL *URL)
-{
- if (!string)
- return nil;
-
- string = mapHostNames(stringByTrimmingWhitespace(string), YES);
- if (!string)
- return nil;
-
- NSData *data = dataWithUserTypedString(string);
- if (!data)
- return [NSURL URLWithString:@""];
-
+ NSData *data = [NSData dataWithBytesNoCopy:outBytes length:outLength]; // adopts outBytes
return URLWithData(data, URL);
}
-NSURL *URLWithUserTypedStringDeprecated(NSString *string, NSURL *URL)
-{
- NSURL *result = URLWithUserTypedString(string, URL);
- if (!result) {
- NSData *resultData = dataWithUserTypedString(string);
- if (!resultData)
- return [NSURL URLWithString:@""];
- result = URLWithData(resultData, URL);
- }
-
- return result;
-}
-
static BOOL hasQuestionMarkOnlyQueryString(NSURL *URL)
{
CFRange rangeWithSeparators;
free(after);
- if (mayNeedHostNameDecoding) {
- // FIXME: Is it good to ignore the failure of mapHostNames and keep result intact?
- NSString *mappedResult = mapHostNames(result, NO);
- if (mappedResult)
- result = mappedResult;
- }
-
+ if (mayNeedHostNameDecoding)
+ result = mapHostNames(result, NO);
result = [result precomposedStringWithCanonicalMapping];
return CFBridgingRelease(createStringWithEscapedUnsafeCharacters((CFStringRef)result));
}
+2016-03-15 Chris Dumez <cdumez@apple.com>
+
+ Unreviewed, rolling out r198203.
+
+ Favorites view is no longer loading on iOS
+
+ Reverted changeset:
+
+ "URL Parsing should signal failure for illegal IDN"
+ https://bugs.webkit.org/show_bug.cgi?id=154945
+ http://trac.webkit.org/changeset/198203
+
2016-03-15 Jiewen Tan <jiewen_tan@apple.com>
URL Parsing should signal failure for illegal IDN
if (URLHasScheme) {
// - use it unchanged
- NSURL *URL = [NSURL _webkit_URLWithUserTypedString:workString];
+ NSURL *URL = [NSURL _web_URLWithUserTypedString:workString];
if (URL != nil) {
[result addObject:URL];
}
if ([[workString lowercaseString] hasPrefix:@"www."]) {
// - just prepend "http://"
[workString insertString:@"http://" atIndex:0];
- URL = [NSURL _webkit_URLWithUserTypedString:workString];
+ URL = [NSURL _web_URLWithUserTypedString:workString];
if (URL != nil) {
[result addObject:URL];
}
} else if ([[workString lowercaseString] hasPrefix:@"ftp."]) {
// - just prepend "ftp://"
[workString insertString:@"ftp://" atIndex:0];
- URL = [NSURL _webkit_URLWithUserTypedString:workString];
+ URL = [NSURL _web_URLWithUserTypedString:workString];
if (URL != nil) {
[result addObject:URL];
}
} else if (firstAtRange.location != NSNotFound && firstAtRange.location < firstSlashRange.location) {
// - justprepend "http://"
[workString insertString:@"http://" atIndex:0];
- URL = [NSURL _webkit_URLWithUserTypedString:workString];
+ URL = [NSURL _web_URLWithUserTypedString:workString];
if (URL != nil) {
[result addObject:URL];
}
} else if (firstDotRange.location != NSNotFound && firstDotRange.location < firstSlashRange.location) {
// - try prepending "http://"
[workString insertString:@"http://" atIndex:0];
- URL = [NSURL _webkit_URLWithUserTypedString:workString];
+ URL = [NSURL _web_URLWithUserTypedString:workString];
if (URL != nil) {
[result addObject:URL];
}
// - try prepending "http://www."
[workString insertString:@"www." atIndex:strlen("http://")];
- URL = [NSURL _webkit_URLWithUserTypedString:workString];
+ URL = [NSURL _web_URLWithUserTypedString:workString];
if (URL != nil) {
[result addObject:URL];
}
[[workString lowercaseString] hasPrefix:@"localhost/"]) {
// - just prepend "http://"
[workString insertString:@"http://" atIndex:0];
- URL = [NSURL _webkit_URLWithUserTypedString:workString];
+ URL = [NSURL _web_URLWithUserTypedString:workString];
if (URL != nil) {
[result addObject:URL];
}
} else {
// - try prepending "http://"
[workString insertString:@"http://" atIndex:0];
- URL = [NSURL _webkit_URLWithUserTypedString:workString];
+ URL = [NSURL _web_URLWithUserTypedString:workString];
if (URL != nil) {
[result addObject:URL];
}
[workString insertString:@".com" atIndex:endOfHostnameOrPort];
}
[workString insertString:@"www." atIndex:strlen("http://")];
- URL = [NSURL _webkit_URLWithUserTypedString:workString];
+ URL = [NSURL _web_URLWithUserTypedString:workString];
if (URL != nil) {
[result addObject:URL];
}
{
NSString *titleFromURL = [URL lastPathComponent];
if (![titleFromURL length] || [titleFromURL isEqualToString:@"/"])
- titleFromURL = [[URL _web_hostString] _webkit_decodeHostName];
+ titleFromURL = [[URL _web_hostString] _web_decodeHostName];
[self setTitle:titleFromURL];
[[self _frame] _dispatchDidReceiveTitle:titleFromURL];
+2016-03-15 Chris Dumez <cdumez@apple.com>
+
+ Unreviewed, rolling out r198203.
+
+ Favorites view is no longer loading on iOS
+
+ Reverted changeset:
+
+ "URL Parsing should signal failure for illegal IDN"
+ https://bugs.webkit.org/show_bug.cgi?id=154945
+ http://trac.webkit.org/changeset/198203
+
2016-03-15 Jiewen Tan <jiewen_tan@apple.com>
URL Parsing should signal failure for illegal IDN
// Check if we've read a broken URL from the file that has non-Latin1 chars. If so, try to convert
// as if it was from user typing.
if (![URLString canBeConvertedToEncoding:NSISOLatin1StringEncoding]) {
- NSURL *tempURL = [NSURL _webkit_URLWithUserTypedString:URLString];
+ NSURL *tempURL = [NSURL _web_URLWithUserTypedString:URLString];
ASSERT(tempURL);
NSString *newURLString = [tempURL _web_originalDataAsString];
core(_private)->setURLString(newURLString);
+ (NSError *)_webKitErrorWithCode:(int)code failingURL:(NSString *)URLString
{
- return [self _webKitErrorWithDomain:WebKitErrorDomain code:code URL:[NSURL _webkit_URLWithUserTypedString:URLString]];
+ return [self _webKitErrorWithDomain:WebKitErrorDomain code:code URL:[NSURL _web_URLWithUserTypedString:URLString]];
}
- (id)_initWithPluginErrorCode:(int)code
ASSERT(URLString);
ASSERT(path);
- NSURL *URL = [NSURL _webkit_URLWithUserTypedString:URLString];
+ NSURL *URL = [NSURL _web_URLWithUserTypedString:URLString];
if (URL)
URLString = [[URL _web_URLByRemovingUserInfo] _web_userVisibleString];
if ([types containsObject:NSStringPboardType]) {
NSString *URLString = [self stringForType:NSStringPboardType];
if ([URLString _webkit_looksLikeAbsoluteURL]) {
- NSURL *URL = [[NSURL _webkit_URLWithUserTypedString:URLString] _webkit_canonicalize];
+ NSURL *URL = [[NSURL _web_URLWithUserTypedString:URLString] _webkit_canonicalize];
if (URL) {
return URL;
}
@interface NSURL (WebNSURLExtras)
-// Deprecated as it ignores URL parsing error.
-// Please use the _webkit_ counterparts.
+ (NSURL *)_web_URLWithUserTypedString:(NSString *)string;
+ (NSURL *)_web_URLWithUserTypedString:(NSString *)string relativeToURL:(NSURL *)URL;
-// New SPI.
-// Return value of nil means error in URL parsing.
-+ (NSURL *)_webkit_URLWithUserTypedString:(NSString *)string;
-+ (NSURL *)_webkit_URLWithUserTypedString:(NSString *)string relativeToURL:(NSURL *)URL;
-
+ (NSURL *)_web_URLWithDataAsString:(NSString *)string;
+ (NSURL *)_web_URLWithDataAsString:(NSString *)string relativeToURL:(NSURL *)baseURL;
- (BOOL)_web_isUserVisibleURL;
-// Deprecated as it ignores URL parsing error.
-// Please use the _webkit_ counterparts.
-// turns funny-looking ASCII form into Unicode, returns self if no decoding needed, convenient cover
-- (NSString *)_web_decodeHostName;
-// turns Unicode into funny-looking ASCII form, returns self if no decoding needed, convenient cover
-- (NSString *)_web_encodeHostName;
-
-// New SPI.
-// Return value of nil means error in URL parsing.
-- (NSString *)_webkit_decodeHostName;
-- (NSString *)_webkit_encodeHostName;
+- (NSString *)_web_decodeHostName; // turns funny-looking ASCII form into Unicode, returns self if no decoding needed, convenient cover
+- (NSString *)_web_encodeHostName; // turns Unicode into funny-looking ASCII form, returns self if no decoding needed, convenient cover
- (BOOL)_webkit_isJavaScriptURL;
- (BOOL)_webkit_isFileURL;
+ (NSURL *)_web_URLWithUserTypedString:(NSString *)string relativeToURL:(NSURL *)URL
{
- return URLWithUserTypedStringDeprecated(string, URL);
-}
-
-+ (NSURL *)_web_URLWithUserTypedString:(NSString *)string
-{
- return URLWithUserTypedStringDeprecated(string, nil);
-}
-
-+ (NSURL *)_webkit_URLWithUserTypedString:(NSString *)string relativeToURL:(NSURL *)URL
-{
return URLWithUserTypedString(string, URL);
}
-+ (NSURL *)_webkit_URLWithUserTypedString:(NSString *)string
++ (NSURL *)_web_URLWithUserTypedString:(NSString *)string
{
return URLWithUserTypedString(string, nil);
}
- (NSString *)_web_decodeHostName
{
- NSString *name = decodeHostName(self);
- return !name ? self : name;
-}
-
-- (NSString *)_web_encodeHostName
-{
- NSString *name = encodeHostName(self);
- return !name ? self : name;
-}
-
-- (NSString *)_webkit_decodeHostName
-{
return decodeHostName(self);
}
-- (NSString *)_webkit_encodeHostName
+- (NSString *)_web_encodeHostName
{
return encodeHostName(self);
}
NSString *host;
if ([space port] == 0) {
- host = [[space host] _webkit_decodeHostName];
+ host = [[space host] _web_decodeHostName];
} else {
- host = [NSString stringWithFormat:@"%@:%ld", [[space host] _webkit_decodeHostName], (long)[space port]];
+ host = [NSString stringWithFormat:@"%@:%ld", [[space host] _web_decodeHostName], (long)[space port]];
}
NSString *realm = [space realm];
{
NSURL *URL = nil;
if ([URLString _webkit_looksLikeAbsoluteURL])
- URL = [[NSURL _webkit_URLWithUserTypedString:URLString] _webkit_canonicalize];
+ URL = [[NSURL _web_URLWithUserTypedString:URLString] _webkit_canonicalize];
return URL;
}
+2016-03-15 Chris Dumez <cdumez@apple.com>
+
+ Unreviewed, rolling out r198203.
+
+ Favorites view is no longer loading on iOS
+
+ Reverted changeset:
+
+ "URL Parsing should signal failure for illegal IDN"
+ https://bugs.webkit.org/show_bug.cgi?id=154945
+ http://trac.webkit.org/changeset/198203
+
2016-03-15 Jiewen Tan <jiewen_tan@apple.com>
URL Parsing should signal failure for illegal IDN
{
[urlText setStringValue:[self addProtocolIfNecessary:[urlText stringValue]]];
- [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL _webkit_URLWithUserTypedString:[urlText stringValue]]]];
+ [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL _web_URLWithUserTypedString:[urlText stringValue]]]];
}
- (IBAction)showHideWebView:(id)sender
EXPECT_STREQ("site.com\xE3\x80\x80othersite.org", [WebCore::decodeHostName(@"site.com\xE3\x80\x80othersite.org") UTF8String]);
}
-TEST(WebCore, URLExtras_ParsingError)
-{
- // Expect IDN failure.
- NSURL *url = WebCore::URLWithUserTypedString(@"http://.com", nil);
- EXPECT_TRUE(url == nil);
-
- NSString *encodedHostName = WebCore::encodeHostName(@"http://.com");
- EXPECT_TRUE(encodedHostName == nil);
-}
-
} // namespace TestWebKitAPI