|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright The Closure Library Authors. |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +// AUTOGENERATED. DO NOT EDIT. |
| 8 | +// clang-format off |
| 9 | + |
| 10 | +goog.module('goog.html.javascriptUrlTestVectors'); |
| 11 | +goog.setTestOnly('goog.html.javascriptUrlTestVectors'); |
| 12 | + |
| 13 | +/** @typedef {{input: string, expected: string, safe: boolean }} */ |
| 14 | +let TestVector; |
| 15 | + |
| 16 | +/** @const {!Array<!TestVector>} */ |
| 17 | +const BASE_VECTORS = [ |
| 18 | + {input: '', expected: '', safe: true}, |
| 19 | + {input: 'http://example.com/', expected: 'http://example.com/', safe: true}, |
| 20 | + {input: 'https://example.com', expected: 'https://example.com', safe: true}, |
| 21 | + {input: 'mailto:[email protected]', expected: 'mailto:[email protected]', safe: true}, |
| 22 | + {input: 'ftp://example.com', expected: 'ftp://example.com', safe: true}, |
| 23 | + {input: 'ftp://[email protected]', expected: 'ftp://[email protected]', safe: true}, |
| 24 | + {input: 'ftp://username:[email protected]', expected: 'ftp://username:[email protected]', safe: true}, |
| 25 | + {input: 'HTtp://example.com/', expected: 'HTtp://example.com/', safe: true}, |
| 26 | + {input: 'https://example.com/path?foo\u003Dbar#baz', expected: 'https://example.com/path?foo\u003Dbar#baz', safe: true}, |
| 27 | + {input: 'https://example.com:123/path?foo\u003Dbar\u0026abc\u003Ddef#baz', expected: 'https://example.com:123/path?foo\u003Dbar\u0026abc\u003Ddef#baz', safe: true}, |
| 28 | + {input: '//example.com/path', expected: '//example.com/path', safe: true}, |
| 29 | + {input: '/path', expected: '/path', safe: true}, |
| 30 | + {input: '/path?foo\u003Dbar#baz', expected: '/path?foo\u003Dbar#baz', safe: true}, |
| 31 | + {input: 'path', expected: 'path', safe: true}, |
| 32 | + {input: 'path?foo\u003Dbar#baz', expected: 'path?foo\u003Dbar#baz', safe: true}, |
| 33 | + {input: 'p//ath', expected: 'p//ath', safe: true}, |
| 34 | + {input: 'p//ath?foo\u003Dbar#baz', expected: 'p//ath?foo\u003Dbar#baz', safe: true}, |
| 35 | + {input: '#baz', expected: '#baz', safe: true}, |
| 36 | + {input: '?:', expected: '?:', safe: true}, |
| 37 | + {input: 'not-data:image/png;base64,z\u003D', expected: 'not-data:image/png;base64,z\u003D', safe: true}, |
| 38 | + {input: ' data:image/png;base64,z\u003D', expected: ' data:image/png;base64,z\u003D', safe: true}, |
| 39 | + {input: 'tel:+1234567890', expected: 'tel:+1234567890', safe: true}, |
| 40 | + {input: 'sms:+1234567890', expected: 'sms:+1234567890', safe: true}, |
| 41 | + {input: 'callto:+1234567890', expected: 'callto:+1234567890', safe: true}, |
| 42 | + {input: 'wtai://wp/mc;+1234567890', expected: 'wtai://wp/mc;+1234567890', safe: true}, |
| 43 | + {input: 'rtsp://example.org/', expected: 'rtsp://example.org/', safe: true}, |
| 44 | + {input: 'market://details?id\u003Dapp', expected: 'market://details?id\u003Dapp', safe: true}, |
| 45 | + {input: 'itms://itunes.apple.com/us', expected: 'itms://itunes.apple.com/us', safe: true}, |
| 46 | + {input: 'javascript:evil(1);', expected: 'about:invalid#zClosurez', safe: false}, |
| 47 | + {input: 'javascript:evil(2);//\u000Ahttp://good.com/', expected: 'about:invalid#zClosurez', safe: false}, |
| 48 | + {input: ' javascript:evil(3);', expected: 'about:invalid#zClosurez', safe: false}, |
| 49 | + {input: '\u0009javascript:evil(4);', expected: 'about:invalid#zClosurez', safe: false}, |
| 50 | + {input: '\u000Bjavascript:evil(5);', expected: 'about:invalid#zClosurez', safe: false}, |
| 51 | + {input: 'JaVasCriPT:evil(6);', expected: 'about:invalid#zClosurez', safe: false}, |
| 52 | + {input: 'javascript:evil(8);', expected: 'about:invalid#zClosurez', safe: false}, |
| 53 | + {input: 'javascript:evil(9);', expected: 'about:invalid#zClosurez', safe: false}, |
| 54 | + {input: 'javasc\u0009ript:evil(10);', expected: 'about:invalid#zClosurez', safe: false}, |
| 55 | + {input: 'javasc\u0009ript:evil(11);', expected: 'about:invalid#zClosurez', safe: false} |
| 56 | +]; |
| 57 | + |
| 58 | +/** @const {!Array<!TestVector>} */ |
| 59 | +const TEL_VECTORS = [ |
| 60 | +]; |
| 61 | + |
| 62 | +/** @const {!Array<!TestVector>} */ |
| 63 | +const SMS_VECTORS = [ |
| 64 | +]; |
| 65 | + |
| 66 | +/** @const {!Array<!TestVector>} */ |
| 67 | +const SSH_VECTORS = [ |
| 68 | +]; |
| 69 | + |
| 70 | +exports = {BASE_VECTORS, TEL_VECTORS, SMS_VECTORS, SSH_VECTORS}; |
0 commit comments