(input)
| 138 | |
| 139 | // https://fetch.spec.whatwg.org/#header-value-get-decode-and-split |
| 140 | function getDecodeAndSplit(input) { |
| 141 | const values = []; |
| 142 | let temporaryValue = ""; |
| 143 | let position = 0; |
| 144 | |
| 145 | while (true) { |
| 146 | // Collect sequence of code points that are not " or , |
| 147 | while (position < input.length && input[position] !== "\"" && input[position] !== ",") { |
| 148 | temporaryValue += input[position++]; |
| 149 | } |
| 150 | |
| 151 | // If position is not past end and code point is " |
| 152 | if (position < input.length && input[position] === '"') { |
| 153 | // Inlined: collect HTTP quoted string (extract-value = false) |
| 154 | const positionStart = position++; |
| 155 | while (true) { |
| 156 | while (position < input.length && input[position] !== "\"" && input[position] !== "\\") { |
| 157 | position++; |
| 158 | } |
| 159 | if (position >= input.length) { |
| 160 | break; |
| 161 | } |
| 162 | if (input[position++] === "\\") { |
| 163 | if (position >= input.length) { |
| 164 | break; |
| 165 | } |
| 166 | position++; |
| 167 | } else { |
| 168 | break; // It was " |
| 169 | } |
| 170 | } |
| 171 | temporaryValue += input.slice(positionStart, position); |
| 172 | if (position < input.length) { |
| 173 | continue; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | // Remove HTTP tab or space from start and end |
| 178 | let start = 0; |
| 179 | let end = temporaryValue.length; |
| 180 | while (start < end && (temporaryValue[start] === "\t" || temporaryValue[start] === " ")) { |
| 181 | start++; |
| 182 | } |
| 183 | while (end > start && (temporaryValue[end - 1] === "\t" || temporaryValue[end - 1] === " ")) { |
| 184 | end--; |
| 185 | } |
| 186 | |
| 187 | values.push(temporaryValue.slice(start, end)); |
| 188 | temporaryValue = ""; |
| 189 | |
| 190 | if (position >= input.length) { |
| 191 | return values; |
| 192 | } |
| 193 | // Assert: code point at position is , |
| 194 | position++; |
| 195 | } |
| 196 | } |
| 197 |
no test coverage detected
searching dependent graphs…