Debian Codegraph @

closure-library/closure/goog/html/safeurl_test_vectors.js

raw
1 // Copyright 2017 The Closure Library Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS-IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // AUTOGENERATED. DO NOT EDIT.
16 // clang-format off
17
18 goog.provide('goog.html.safeUrlTestVectors');
19 goog.setTestOnly('goog.html.safeUrlTestVectors');
20
21 goog.html.safeUrlTestVectors.BASE_VECTORS = [
22 {input: '', expected: '', safe: true},
23 {input: 'http://example.com/', expected: 'http://example.com/', safe: true},
24 {input: 'https://example.com', expected: 'https://example.com', safe: true},
25 {input: 'mailto:[email protected]', expected: 'mailto:[email protected]', safe: true},
26 {input: 'ftp://example.com', expected: 'ftp://example.com', safe: true},
27 {input: 'ftp://[email protected]', expected: 'ftp://[email protected]', safe: true},
28 {input: 'ftp://username:[email protected]', expected: 'ftp://username:[email protected]', safe: true},
29 {input: 'HTtp://example.com/', expected: 'HTtp://example.com/', safe: true},
30 {input: 'https://example.com/path?foo=bar#baz', expected: 'https://example.com/path?foo=bar#baz', safe: true},
31 {input: 'https://example.com:123/path?foo=bar&abc=def#baz', expected: 'https://example.com:123/path?foo=bar&abc=def#baz', safe: true},
32 {input: '//example.com/path', expected: '//example.com/path', safe: true},
33 {input: '/path', expected: '/path', safe: true},
34 {input: '/path?foo=bar#baz', expected: '/path?foo=bar#baz', safe: true},
35 {input: 'path', expected: 'path', safe: true},
36 {input: 'path?foo=bar#baz', expected: 'path?foo=bar#baz', safe: true},
37 {input: 'p//ath', expected: 'p//ath', safe: true},
38 {input: 'p//ath?foo=bar#baz', expected: 'p//ath?foo=bar#baz', safe: true},
39 {input: '#baz', expected: '#baz', safe: true},
40 {input: '?:', expected: '?:', safe: true},
41 {input: 'javascript:evil();', expected: 'about:invalid#zClosurez', safe: false},
42 {input: 'javascript:evil();//\u000Ahttp://good.com/', expected: 'about:invalid#zClosurez', safe: false},
43 {input: 'data:', expected: 'about:invalid#zClosurez', safe: false},
44 {input: 'data:blah', expected: 'about:invalid#zClosurez', safe: false},
45 {input: 'not-data:image/png;base64,z=', expected: 'about:invalid#zClosurez', safe: false},
46 {input: ' data:image/png;base64,z=', expected: 'about:invalid#zClosurez', safe: false},
47 {input: 'data:image/png;base64,z= ', expected: 'about:invalid#zClosurez', safe: false},
48 {input: 'data:image/;base64,z=', expected: 'about:invalid#zClosurez', safe: false},
49 {input: 'data:ximage/png', expected: 'about:invalid#zClosurez', safe: false},
50 {input: 'data:ximage/png;base64,z=', expected: 'about:invalid#zClosurez', safe: false},
51 {input: 'data:image/pngx;base64,z=', expected: 'about:invalid#zClosurez', safe: false},
52 {input: 'data:audio/whatever;base64,z=', expected: 'about:invalid#zClosurez', safe: false},
53 {input: 'data:audio/;base64,z=', expected: 'about:invalid#zClosurez', safe: false},
54 {input: 'data:video/whatever;base64,z=', expected: 'about:invalid#zClosurez', safe: false},
55 {input: 'data:video/;base64,z=', expected: 'about:invalid#zClosurez', safe: false},
56 {input: 'data:image/png;base64,', expected: 'about:invalid#zClosurez', safe: false},
57 {input: 'data:image/png;base64,abc=!', expected: 'about:invalid#zClosurez', safe: false},
58 {input: 'data:image/png;base64,$$', expected: 'about:invalid#zClosurez', safe: false},
59 {input: 'data:image/png;base64,\u0000', expected: 'about:invalid#zClosurez', safe: false},
60 {input: 'data:video/mp4;baze64,z=', expected: 'about:invalid#zClosurez', safe: false},
61 {input: 'data:video/mp4;,z=', expected: 'about:invalid#zClosurez', safe: false},
62 {input: 'data:text/html,sdfsdfsdfsfsdfs;base64,anything', expected: 'about:invalid#zClosurez', safe: false},
63 {input: 'data:image/svg+xml;base64,abc', expected: 'about:invalid#zClosurez', safe: false},
64 {input: 'tel:+1234567890', expected: 'about:invalid#zClosurez', safe: false},
65 {input: 'sms:+1234567890', expected: 'about:invalid#zClosurez', safe: false},
66 {input: 'callto:+1234567890', expected: 'about:invalid#zClosurez', safe: false},
67 {input: 'wtai://wp/mc;+1234567890', expected: 'about:invalid#zClosurez', safe: false},
68 {input: 'rtsp://example.org/', expected: 'about:invalid#zClosurez', safe: false},
69 {input: 'market://details?id=app', expected: 'about:invalid#zClosurez', safe: false},
70 {input: 'geo:37.7,42.0', expected: 'about:invalid#zClosurez', safe: false},
71 {input: 'skype:chat?jid=foo', expected: 'about:invalid#zClosurez', safe: false},
72 {input: 'whatsapp://send?text=Hello', expected: 'about:invalid#zClosurez', safe: false},
73 {input: ':', expected: 'about:invalid#zClosurez', safe: false},
74 {input: '\\:', expected: 'about:invalid#zClosurez', safe: false},
75 {input: ':/:', expected: 'about:invalid#zClosurez', safe: false},
76 {input: 'path\u000A:', expected: 'about:invalid#zClosurez', safe: false},
77 {input: 'java\u0000script:evil();', expected: 'about:invalid#zClosurez', safe: false},
78 {input: 'http://www.f\u0000\u0000.com', expected: 'http://www.f\u0000\u0000.com', safe: true},
79 {input: 'data:image/png;base64,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=', expected: 'data:image/png;base64,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=', safe: true},
80 {input: 'dATa:iMage/pNg;bASe64,abc===', expected: 'dATa:iMage/pNg;bASe64,abc===', safe: true},
81 {input: 'data:image/webp;base64,abc===', expected: 'data:image/webp;base64,abc===', safe: true},
82 {input: 'data:audio/ogg;base64,abc', expected: 'data:audio/ogg;base64,abc', safe: true},
83 {input: 'data:video/mpeg;base64,abc', expected: 'data:video/mpeg;base64,abc', safe: true},
84 {input: 'data:video/ogg;base64,z=', expected: 'data:video/ogg;base64,z=', safe: true},
85 {input: 'data:video/mp4;base64,z=', expected: 'data:video/mp4;base64,z=', safe: true},
86 {input: 'data:video/webm;base64,z=', expected: 'data:video/webm;base64,z=', safe: true}
87 ];
88
89 goog.html.safeUrlTestVectors.TEL_VECTORS = [
90 {input: 'tEl:+1(23)129-29192A.ABC#;eXt=29', expected: 'tEl:+1(23)129-29192A.ABC#;eXt=29', safe: true},
91 {input: 'tEL:123;randmomparam=123', expected: 'tEL:123;randmomparam=123', safe: true},
92 {input: ':', expected: 'about:invalid#zClosurez', safe: false},
93 {input: 'tell:', expected: 'about:invalid#zClosurez', safe: false},
94 {input: 'not-tel:+1', expected: 'about:invalid#zClosurez', safe: false},
95 {input: ' tel:+1', expected: 'about:invalid#zClosurez', safe: false},
96 {input: 'javascript:evil()', expected: 'about:invalid#zClosurez', safe: false},
97 {input: 'tel:+1234567890', expected: 'tel:+1234567890', safe: true}
98 ];