| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012, Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2012, Samsung Electronics. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 protocolWhitelist->add(protocols[i]); | 70 protocolWhitelist->add(protocols[i]); |
| 71 } | 71 } |
| 72 | 72 |
| 73 static bool verifyCustomHandlerURL(const String& baseURL, const String& url, Exc
eptionState& es) | 73 static bool verifyCustomHandlerURL(const String& baseURL, const String& url, Exc
eptionState& es) |
| 74 { | 74 { |
| 75 // The specification requires that it is a SyntaxError if the "%s" token is | 75 // The specification requires that it is a SyntaxError if the "%s" token is |
| 76 // not present. | 76 // not present. |
| 77 static const char token[] = "%s"; | 77 static const char token[] = "%s"; |
| 78 int index = url.find(token); | 78 int index = url.find(token); |
| 79 if (-1 == index) { | 79 if (-1 == index) { |
| 80 es.throwDOMException(SyntaxError); | 80 es.throwUninformativeAndGenericDOMException(SyntaxError); |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 | 83 |
| 84 // It is also a SyntaxError if the custom handler URL, as created by removin
g | 84 // It is also a SyntaxError if the custom handler URL, as created by removin
g |
| 85 // the "%s" token and prepending the base url, does not resolve. | 85 // the "%s" token and prepending the base url, does not resolve. |
| 86 String newURL = url; | 86 String newURL = url; |
| 87 newURL.remove(index, WTF_ARRAY_LENGTH(token) - 1); | 87 newURL.remove(index, WTF_ARRAY_LENGTH(token) - 1); |
| 88 | 88 |
| 89 KURL base(ParsedURLString, baseURL); | 89 KURL base(ParsedURLString, baseURL); |
| 90 KURL kurl(base, newURL); | 90 KURL kurl(base, newURL); |
| 91 | 91 |
| 92 if (kurl.isEmpty() || !kurl.isValid()) { | 92 if (kurl.isEmpty() || !kurl.isValid()) { |
| 93 es.throwDOMException(SyntaxError); | 93 es.throwUninformativeAndGenericDOMException(SyntaxError); |
| 94 return false; | 94 return false; |
| 95 } | 95 } |
| 96 | 96 |
| 97 return true; | 97 return true; |
| 98 } | 98 } |
| 99 | 99 |
| 100 static bool isProtocolWhitelisted(const String& scheme) | 100 static bool isProtocolWhitelisted(const String& scheme) |
| 101 { | 101 { |
| 102 if (!protocolWhitelist) | 102 if (!protocolWhitelist) |
| 103 initProtocolHandlerWhitelist(); | 103 initProtocolHandlerWhitelist(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 void provideNavigatorContentUtilsTo(Page* page, NavigatorContentUtilsClient* cli
ent) | 222 void provideNavigatorContentUtilsTo(Page* page, NavigatorContentUtilsClient* cli
ent) |
| 223 { | 223 { |
| 224 RefCountedSupplement<Page, NavigatorContentUtils>::provideTo(page, Navigator
ContentUtils::supplementName(), NavigatorContentUtils::create(client)); | 224 RefCountedSupplement<Page, NavigatorContentUtils>::provideTo(page, Navigator
ContentUtils::supplementName(), NavigatorContentUtils::create(client)); |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace WebCore | 227 } // namespace WebCore |
| 228 | 228 |
| 229 #endif // ENABLE(NAVIGATOR_CONTENT_UTILS) | 229 #endif // ENABLE(NAVIGATOR_CONTENT_UTILS) |
| 230 | 230 |
| OLD | NEW |