summaryrefslogtreecommitdiffstats
path: root/uriloader/exthandler/tests/mochitest/save_filenames.html
blob: c29285ec40ef174f14f64f441d29e7a196ee188d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<style>
  img { padding: 10px; border: 1px solid red; }
  a { padding-left: 10px; }
</style>

<span id="items">

<!-- simple filename -->
<img id="i0" src="http://localhost:8000/basic.png"
     data-noattach="true" data-filename="basic.png">

<!-- simple filename with content disposition -->
<img id="i1" src="http://localhost:8000/save_filename.sjs?type=png&filename=simple.png" data-filename="simple.png">

<!-- invalid characters in the filename -->
<img id="i2" src="http://localhost:8000/save_filename.sjs?type=png&filename=invalidfilename/a:b*c%63d.png" data-filename="invalidfilename_a_b_ccd.png">

<!-- invalid extension for a png image -->
<img id="i3" src="http://localhost:8000/save_filename.sjs?type=png&filename=invalidextension.pang" data-filename="invalidextension.png">

<!-- jpeg extension for a png image -->
<img id="i4" src="http://localhost:8000/save_filename.sjs?type=png&filename=reallyapng.jpeg" data-filename="reallyapng.png">

<!-- txt extension for a png image -->
<img id="i5" src="http://localhost:8000/save_filename.sjs?type=png&filename=nottext.txt" data-filename="nottext.png">

<!-- no extension for a png image -->
<img id="i6" src="http://localhost:8000/save_filename.sjs?type=png&filename=noext" data-filename="noext.png">

<!-- empty extension for a png image -->
<img id="i7" src="http://localhost:8000/save_filename.sjs?type=png&filename=noextdot." data-filename="noextdot.png">

<!-- long filename -->
<img id="i8" src="http://localhost:8000/save_filename.sjs?type=png&filename=averylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilename.png"
     data-filename="averylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongf.png">

<!-- long filename with invalid extension -->
<img id="i9" src="http://localhost:8000/save_filename.sjs?type=png&filename=bverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilename.exe"
     data-filename="bverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongf.png">

<!-- long filename with invalid extension -->
<img id="i10" src="http://localhost:8000/save_filename.sjs?type=png&filename=cverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilename.exe.jpg"
     data-filename="cverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongfilenameverylongf.png">

<!-- jpeg with jpg extension -->
<img id="i11" src="http://localhost:8000/save_filename.sjs?type=jpeg&filename=thejpg.jpg" data-filename="thejpg.jpg">

<!-- jpeg with jpeg extension -->
<img id="i12" src="http://localhost:8000/save_filename.sjs?type=jpeg&filename=thejpg.jpeg" data-filename="thejpg.jpeg">

<!-- jpeg with invalid extension -->
<img id="i13" src="http://localhost:8000/save_filename.sjs?type=jpeg&filename=morejpg.exe" data-filename="morejpg.jpg" data-filename-platformlinux="morejpg.jpeg">

<!-- jpeg with multiple extensions -->
<img id="i14" src="http://localhost:8000/save_filename.sjs?type=jpeg&filename=anotherjpg.jpg.exe" data-filename="anotherjpg.jpg.jpg" data-filename-platformlinux="anotherjpg.jpg.jpeg">

<!-- jpeg with no filename portion -->
<img id="i15" src="http://localhost:8000/save_filename.sjs?type=jpeg&filename=.jpg"
     data-filename="jpg.jpg" data-filename-platformlinux="jpg.jpeg">

<!-- png with no filename portion and invalid extension -->
<img id="i16" src="http://localhost:8000/save_filename.sjs?type=png&filename=.exe" data-filename="exe.png">

<!-- png with escaped characters -->
<img id="i17" src="http://localhost:8000/save_filename.sjs?type=png&filename=first%20file.png" data-filename="first file.png">

<!-- png with more escaped characters -->
<img id="i18" src="http://localhost:8000/save_filename.sjs?type=png&filename=second%32file%2Eexe" data-filename="second2file.png">

<!-- unknown type with png extension -->
<img id="i19" src="http://localhost:8000/save_filename.sjs?type=nonsense&filename=nonsense1.png"
     data-nodrag="true" data-unknown="typeonly" data-filename="nonsense1.png">

<!-- unknown type with exe extension -->
<img id="i20" src="http://localhost:8000/save_filename.sjs?type=nonsense&filename=nonsense2.exe"
     data-nodrag="true" data-unknown="typeonly" data-filename="nonsense2.exe">

<!-- unknown type with no extension -->
<img id="i21" src="http://localhost:8000/save_filename.sjs?type=nonsense&filename=nonsense3"
     data-nodrag="true" data-unknown="typeonly" data-filename="nonsense3">

<!-- simple script -->
<script id="i22" src="http://localhost:8000/save_filename.sjs?type=js&filename=script1.js" data-filename="script1.js"></script>

<!-- script with invalid extension. -->
<script id="i23" src="http://localhost:8000/save_filename.sjs?type=js&filename=script2.exe"
        data-filename="script2.exe" data-savepagename="script2.exe.js"></script>

<!-- script with escaped characters -->
<script id="i24" src="http://localhost:8000/save_filename.sjs?type=js&filename=script%20%33.exe"
        data-filename="script 3.exe" data-savepagename="script 3.exe.js"></script>

<!-- script with long filename -->
<script id="i25" src="http://localhost:8000/save_filename.sjs?type=js&filename=script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789.js"
        data-filename="script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script123456789script12345.js"></script>

<!-- binary with exe extension -->
<object id="i26" data="http://localhost:8000/save_filename.sjs?type=binary&filename=download1.exe"
        data-unknown="true" data-filename="download1.exe"></object>

<!-- binary with invalid extension -->
<object id="i27" data="http://localhost:8000/save_filename.sjs?type=binary&filename=download2.png"
        data-unknown="true" data-filename="download2.png"></object>

<!-- binary with no extension -->
<object id="i28" data="http://localhost:8000/save_filename.sjs?type=binary&filename=downloadnoext"
        data-unknown="true" data-filename="downloadnoext"></object>

<!-- binary with no other invalid characters -->
<object id="i29" data="http://localhost:8000/save_filename.sjs?type=binary&filename=binary^%31%20exe.exe"
        data-unknown="true" data-filename="binary^1 exe.exe"></object>

<!-- unknown image type with no extension, but ending in png -->
<img id="i30" src="http://localhost:8000/save_filename.sjs?type=otherimage&filename=specialpng"
     data-unknown="typeonly" data-nodrag="true" data-filename="specialpng">

<!-- unknown image type with no extension, but ending in many dots -->
<img id="i31" src="http://localhost:8000/save_filename.sjs?type=otherimage&filename=extrapng..."
     data-unknown="typeonly" data-nodrag="true" data-filename="extrapng">

<!-- image type with no content-disposition filename specified -->
<img id="i32" src="http://localhost:8000/save_filename.sjs?type=png" data-filename="save_filename.png">

<!-- binary with no content-disposition filename specified -->
<object id="i33" data="http://localhost:8000/save_filename.sjs?type=binary"
        data-unknown="true" data-filename="save_filename.sjs"></object>

<!-- image where url has png extension -->
<img id="i34" src="http://localhost:8000/getdata.png?type=png&filename=override.png" data-filename="override.png">

<!-- image where url has png extension but content disposition has incorrect extension -->
<img id="i35" src="http://localhost:8000/getdata.png?type=png&filename=flower.jpeg" data-filename="flower.png">

<!-- image where url has png extension but content disposition does not -->
<img id="i36" src="http://localhost:8000/getdata.png?type=png&filename=ruby" data-filename="ruby.png">

<!-- image where url has png extension but content disposition has invalid characters -->
<img id="i37" src="http://localhost:8000/getdata.png?type=png&filename=sapphire/data" data-filename="sapphire_data.png">

<!-- image where neither content disposition or url have an extension -->
<img id="i38" src="http://localhost:8000/base?type=png&filename=emerald" data-filename="emerald.png">

<!-- image where filename is not specified -->
<img id="i39" src="http://localhost:8000/base?type=png" data-filename="base.png">

<!-- simple script where url filename has no extension -->
<script id="i40" src="http://localhost:8000/base?type=js&filename=script4.js" data-filename="script4.js"></script>

<!-- script where url filename has no extension and invalid extension in content disposition filename -->
<script id="i41" src="http://localhost:8000/base?type=js&filename=script5.exe"
        data-filename="script5.exe" data-savepagename="script5.exe.js"></script>

<!-- script where url filename has no extension and escaped characters in content disposition filename-->
<script id="i42" src="http://localhost:8000/base?type=js&filename=script%20%36.exe"
        data-filename="script 6.exe" data-savepagename="script 6.exe.js"></script>

<!-- text where filename is present -->
<img id="i43" src="http://localhost:8000/getdata.png?type=text&filename=readme.txt"
     data-nodrag="true" data-filename="readme.txt">

<!-- text where filename is present with a different extension -->
<img id="i44" src="http://localhost:8000/getdata.png?type=text&filename=main.cpp"
     data-nodrag="true" data-filename="main.cpp">

<!-- text where extension is not present -->
<img id="i45" src="http://localhost:8000/getdata.png?type=text&filename=readme"
     data-nodrag="true" data-filename="readme">

<!-- text where extension is not present and url does not have extension -->
<img id="i46" src="http://localhost:8000/base?type=text&filename=info"
     data-nodrag="true" data-filename="info">

<!-- text where filename is not present -->
<img id="i47" src="http://localhost:8000/basetext?type=text"
     data-nodrag="true" data-filename="basetext">

<!-- text where url has extension -->
<img id="i48" src="http://localhost:8000/text2.txt?type=text"
     data-nodrag="true" data-filename="text2.txt">

<!-- text where url has extension -->
<img id="i49" src="http://localhost:8000/text3.gonk?type=text"
     data-nodrag="true" data-filename="text3.gonk">

<!-- text with long filename -->
<img id="i50" src="http://localhost:8000/text3.gonk?type=text&filename=text0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789text0123456789zztext0123456789zztext0123456789zztext01234567.exe.txt" data-nodrag="true" data-filename="text0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext0123456789zztext012345.txt">

<!-- webp image -->
<img id="i51" src="http://localhost:8000/save_filename.sjs?type=webp&filename=webpimage.webp"
     data-filename="webpimage.webp">

<!-- webp image with jpg extension -->
<img id="i52" src="http://localhost:8000/save_filename.sjs?type=webp&filename=realwebpimage.jpg"
     data-filename="realwebpimage.webp">

<!-- no content type specified -->
<img id="i53" src="http://localhost:8000/save_filename.sjs?&filename=notype.png"
     data-nodrag="true" data-filename="notype.png">

<!-- no content type specified. -->
<img id="i54" src="http://localhost:8000/save_filename.sjs?&filename=notypebin.exe"
     data-nodrag="true" data-filename="notypebin.exe">

<!-- extension contains invalid characters -->
<img id="i55" src="http://localhost:8000/save_filename.sjs?type=png&filename=extinvalid.a?*"
     data-filename="extinvalid.png">

<!-- filename with redirect and content disposition -->
<img id="i56" src="http://localhost:8000/redir?type=png&filename=red.png" data-filename="red.png">

<!-- filename with redirect and different type -->
<img id="i57" src="http://localhost:8000/redir?type=jpeg&filename=green.png"
     data-filename="green.jpg" data-filename-platformlinux="green.jpeg">

<!-- filename with redirect and binary type -->
<object id="i58" data="http://localhost:8000/redir?type=binary&filename=blue.png"
        data-unknown="true" data-filename="blue.png"></object>

<!-- filename in url with incorrect extension -->
<img id="i59" src="http://localhost:8000/aquamarine.jpeg"
     data-noattach="true" data-filename="aquamarine.png">

<!-- filename in url with exe extension, but returns a png image -->
<img id="i60" src="http://localhost:8000/lazuli.exe"
     data-noattach="true" data-filename="lazuli.png">

<!-- filename with leading, trailing and duplicate spaces -->
<img id="i61" src="http://localhost:8000/save_filename.sjs?type=png&filename=  with  spaces.png  "
     data-filename="with spaces.png">

<!-- filename with leading and trailing periods -->
<img id="i62" src="http://localhost:8000/save_filename.sjs?type=png&filename=..with..dots..png.."
     data-filename="with..dots..png">

<!-- filename with non-ascii character -->
<img id="i63" src="http://localhost:8000/base?type=png&filename=s%C3%B6meescapes.%C3%B7ng" data-filename="sömeescapes.png">

<!-- filename with content disposition name assigned. The name is only used
     when selecting to manually save, otherwise it is ignored.  -->
<img id="i64" src="http://localhost:8000/save_thename.sjs?type=png&dispname=withname"
     data-filename="save_thename.png">

<!-- reserved filename on Windows -->
<img id="i65" src="http://localhost:8000/save_filename.sjs?type=text&filename=com1"
     data-nodrag="true" data-filename="com1" data-filename-platformwin="Untitled">

<!-- reserved filename with extension on Windows -->
<img id="i66" src="http://localhost:8000/save_filename.sjs?type=text&filename=com2.any"
     data-nodrag="true" data-filename="com2.any" data-filename-platformwin="Untitled">

<!-- simple zip file -->
<object id="i67" data="http://localhost:8000/save_filename.sjs?type=zip&filename=simple.zip" data-filename="simple.zip"
        data-unknown="true"></object>

<!-- simple zip file with differing extension -->
<object id="i68" data="http://localhost:8000/save_filename.sjs?type=zip&filename=simple.jar" data-filename="simple.jar"
        data-unknown="true"></object>

<!-- simple zip file with no extension -->
<object id="i69" data="http://localhost:8000/save_filename.sjs?type=zip&filename=simplepack" data-filename="simplepack.zip"
        data-unknown="true"></object>

<!-- simple json file -->
<object id="i70" data="http://localhost:8000/save_filename.sjs?type=json&filename=simple.json" data-filename="simple.json"
        data-unknown="true"></object>

<!-- simple json file with differing extension -->
<object id="i71" data="http://localhost:8000/save_filename.sjs?type=json&filename=simple.dat" data-filename="simple.dat"
        data-unknown="true"></object>

<!-- compressed file with .gz extension -->
<img id="i72" src="http://localhost:8000/save_filename.sjs?type=png&filename=compressed.png.gz" data-filename="compressed.png.png">

<!-- compressed file with .tar.gz extension -->
<object id="i73" data="http://localhost:8000/save_filename.sjs?type=tar&filename=compressed2.tar.gz" data-filename="compressed2.tar.gz"
        data-unknown="true"></object>

<!-- compressed file with bittar.gz extension. There is no tar mime info on Windows so the filename is not changed. -->
<object id="i74" data="http://localhost:8000/save_filename.sjs?type=tar&filename=compressed3.bittar.gz"
        data-filename="compressed3.bittar.gz"
        data-unknown="true"></object>

<!-- compressed file with .tar.bz2 extension -->
<object id="i75" data="http://localhost:8000/save_filename.sjs?type=tar&filename=buzz.tar.bz2" data-filename="buzz.tar.bz2"
        data-unknown="true"></object>

<!-- executable with no filename specified and an extension specified within the url -->
<img id="i76" src="http://localhost:8000/executable.exe?type=nonsense"
     data-nodrag="true" data-unknown="typeonly" data-filename="executable.exe">

<!-- embedded child html -->
<object id="i77" data="http://localhost:8000/save_filename.sjs?type=html&filename=child.par"
        data-filename="child.par" data-unknown="true"></object>

<!-- file starting with a dot with and unknown extension -->
<img id="i78" src="http://localhost:8000/save_filename.sjs?type=png&filename=.extension" data-filename="extension.png">

<!-- html file starting with a dot -->
<object id="i79" data="http://localhost:8000/save_filename.sjs?type=html&filename=.alternate"
        data-filename="alternate.html" data-filename-platformwin="alternate.htm" data-unknown="true"></object>

<!-- unrecognized file type starting with a dot -->
<object id="i80" data="http://localhost:8000/save_filename.sjs?type=otherimage&filename=.alternate" data-filename="alternate"
        data-unknown="true"></object>

<!-- filename with lnk extension -->
<img id="i81" src="http://localhost:8000/save_filename.sjs?type=nonsense&filename=shortcut.lnk"
     data-nodrag="true" data-unknown="typeonly"
     data-filename="shortcut.lnk.download">

<!-- long filename with lnk extension -->
<img id="i82" src="http://localhost:8000/save_filename.sjs?type=nonsense&filename=longshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshort1234567890.lnk"
     data-nodrag="true" data-unknown="typeonly"
     data-filename="longshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshortcutnamelongshort1234567890.lnk.download">

</span>

<!-- This set is used to test the filename specified by the download attribute is validated correctly. -->
<span id="downloads">
  <a id="download0" href="http://localhost:8000/base" download="pearl.png" data-filename="pearl.png">Link</a>
  <a id="download1" href="http://localhost:8000/save_filename.sjs?type=png" download="opal.jpeg" data-filename="opal.png">Link</a>
  <a id="download2" href="http://localhost:8000/save_filename.sjs?type=jpeg"
     download="amethyst.png" data-filename="amethyst.jpg"
     data-filename-platformlinux="amethyst.jpeg">Link</a>
  <a id="download3" href="http://localhost:8000/save_filename.sjs?type=text"
     download="onyx.png" data-filename="onyx.png">Link</a>
  <!-- The content-disposition overrides the download attribute. -->
  <a id="download4" href="http://localhost:8000/save_filename.sjs?type=png&filename=fakename.jpeg" download="topaz.jpeg" data-filename="fakename.png">Link</a>
  <a id="download5" href="http://localhost:8000/save_filename.sjs?type=png"
     download="amber?.png" data-filename="amber .png">Link</a>
  <a id="download6" href="http://localhost:8000/save_filename.sjs?type=jpeg"
     download="jade.:*jpeg" data-filename="jade.jpg"
     data-filename-platformlinux="jade.jpeg">Link</a>>
  <a id="download7" href="http://localhost:8000/save_filename.sjs?type=png"
     download="thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename.png"
     data-filename="thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisaverylongfilename-thisisavery.png">Link</a>
  <a id="download8" href="http://localhost:8000/base"
      download="&Tab;&NewLine;&nbsp;&#11&#x180e;&#x180e;&#12   spa   ced.png &Tab;&NewLine;&nbsp;&#x180e;&#x180e;&#11&#12 "
      data-filename="spa ced.png">Link</a>
</span>

<span id="links">
  <a id="link0" href="http://localhost:8000/save_filename.sjs?type=png&filename=one.png" data-filename="one.png">One</a>
  <a id="link1" href="http://localhost:8000/save_filename.sjs?type=png&filename=two.jpeg" data-filename="two.png">Two</a>
  <a id="link2" href="http://localhost:8000/save_filename.sjs?type=png&filename=three.con" data-filename="three.png">Three</a>
  <a id="link3" href="http://localhost:8000/save_filename.sjs?type=png&dispname=four" data-filename="four.png">Four</a>
  <a id="link4" href="http://localhost:8000/save_filename.sjs?type=png&filename=five.local" data-filename="five.png">Five</a>
</span>

<!-- The content-disposition attachment generates links from the images/objects/scripts above
     and inserts them here. -->
<p id="attachment-links">
</p>

</body></html>