| 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 Motorola Mobility Inc. | 3 * Copyright (C) 2012 Motorola Mobility Inc. |
| 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 void DOMURLUtils::setSearchInternal(const String& value) { | 117 void DOMURLUtils::setSearchInternal(const String& value) { |
| 118 DCHECK(!m_isInUpdate); | 118 DCHECK(!m_isInUpdate); |
| 119 KURL kurl = url(); | 119 KURL kurl = url(); |
| 120 if (!kurl.isValid()) | 120 if (!kurl.isValid()) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 // FIXME: have KURL do this clearing of the query component | 123 // FIXME: have KURL do this clearing of the query component |
| 124 // instead, if practical. Will require addressing | 124 // instead, if practical. Will require addressing |
| 125 // http://crbug.com/108690, for one. | 125 // http://crbug.com/108690, for one. |
| 126 if (value[0] == '?') | 126 if ((value.length() == 1 && value[0] == '?') || value.isEmpty()) |
| 127 kurl.setQuery(value.length() == 1 ? String() : value.substring(1)); | 127 kurl.setQuery(String()); |
| 128 else | 128 else |
| 129 kurl.setQuery(value.isEmpty() ? String() : value); | 129 kurl.setQuery(value); |
| 130 | 130 |
| 131 setURL(kurl); | 131 setURL(kurl); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void DOMURLUtils::setHash(const String& value) { | 134 void DOMURLUtils::setHash(const String& value) { |
| 135 KURL kurl = url(); | 135 KURL kurl = url(); |
| 136 if (kurl.isNull()) | 136 if (kurl.isNull()) |
| 137 return; | 137 return; |
| 138 | 138 |
| 139 // FIXME: have KURL handle the clearing of the fragment component | 139 // FIXME: have KURL handle the clearing of the fragment component |
| 140 // on the same input. | 140 // on the same input. |
| 141 if (value[0] == '#') | 141 if (value[0] == '#') |
| 142 kurl.setFragmentIdentifier(value.length() == 1 ? String() | 142 kurl.setFragmentIdentifier(value.length() == 1 ? String() |
| 143 : value.substring(1)); | 143 : value.substring(1)); |
| 144 else | 144 else |
| 145 kurl.setFragmentIdentifier(value.isEmpty() ? String() : value); | 145 kurl.setFragmentIdentifier(value.isEmpty() ? String() : value); |
| 146 | 146 |
| 147 setURL(kurl); | 147 setURL(kurl); |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace blink | 150 } // namespace blink |
| OLD | NEW |