Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!doctype html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=819900 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for crash caused by unloading and reloading srcdoc iframes</title> |
michael@0 | 8 | <script src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=819900">Mozilla Bug 819900</a> |
michael@0 | 13 | |
michael@0 | 14 | <pre id="test"> |
michael@0 | 15 | <script> |
michael@0 | 16 | |
michael@0 | 17 | var b = new Blob(['1234567890']); |
michael@0 | 18 | ok(b, 'Blob created'); |
michael@0 | 19 | is(b.size, 10, 'Blob has the right size'); |
michael@0 | 20 | |
michael@0 | 21 | var status = false; |
michael@0 | 22 | try { |
michael@0 | 23 | f = new File(b); |
michael@0 | 24 | } catch(e) { |
michael@0 | 25 | status = true; |
michael@0 | 26 | } |
michael@0 | 27 | ok(status, "File throws if the second argument is missing"); |
michael@0 | 28 | |
michael@0 | 29 | status = false; |
michael@0 | 30 | try { |
michael@0 | 31 | f = new File(42, 'foobar.txt'); |
michael@0 | 32 | } catch(e) { |
michael@0 | 33 | status = true; |
michael@0 | 34 | } |
michael@0 | 35 | ok(status, "File throws if the argument is not an array"); |
michael@0 | 36 | |
michael@0 | 37 | status = false; |
michael@0 | 38 | try { |
michael@0 | 39 | f = new File({}, 'foobar.txt'); |
michael@0 | 40 | } catch(e) { |
michael@0 | 41 | status = true; |
michael@0 | 42 | } |
michael@0 | 43 | ok(status, "File throws if the argument is not an array"); |
michael@0 | 44 | |
michael@0 | 45 | status = false; |
michael@0 | 46 | try { |
michael@0 | 47 | f = new File("hello world", 'foobar.txt'); |
michael@0 | 48 | } catch(e) { |
michael@0 | 49 | status = true; |
michael@0 | 50 | } |
michael@0 | 51 | ok(status, "File throws if the argument is not an array"); |
michael@0 | 52 | |
michael@0 | 53 | f = new File(['1234567890'], ''); |
michael@0 | 54 | ok(f, 'File created'); |
michael@0 | 55 | is(f.size, 10, 'File has the right size'); |
michael@0 | 56 | is(f.name, ''); |
michael@0 | 57 | is(f.type, ''); |
michael@0 | 58 | |
michael@0 | 59 | f = new File(['1234567890'], 42); |
michael@0 | 60 | ok(f, 'File created'); |
michael@0 | 61 | is(f.size, 10, 'File has the right size'); |
michael@0 | 62 | is(f.name, '42'); |
michael@0 | 63 | is(f.type, ''); |
michael@0 | 64 | |
michael@0 | 65 | f = new File(['1234567890'], 'text.txt'); |
michael@0 | 66 | ok(f, 'File created'); |
michael@0 | 67 | is(f.size, 10, 'File has the right size'); |
michael@0 | 68 | is(f.name, 'text.txt'); |
michael@0 | 69 | is(f.type, ''); |
michael@0 | 70 | |
michael@0 | 71 | f = new File(['1234567890'], 'text.txt', { type: 'plain/text' }); |
michael@0 | 72 | ok(f, 'File created'); |
michael@0 | 73 | is(f.size, 10, 'File has the right size'); |
michael@0 | 74 | is(f.name, 'text.txt'); |
michael@0 | 75 | is(f.type, 'plain/text'); |
michael@0 | 76 | |
michael@0 | 77 | f = new File([b], 'text.txt'); |
michael@0 | 78 | ok(f, 'File created'); |
michael@0 | 79 | is(f.name, 'text.txt'); |
michael@0 | 80 | is(f.type, ''); |
michael@0 | 81 | is(f.size, b.size); |
michael@0 | 82 | |
michael@0 | 83 | f = new File([b], 'test.txt', { type: 'plain/text' }); |
michael@0 | 84 | ok(f, 'File created'); |
michael@0 | 85 | is(f.name, 'test.txt'); |
michael@0 | 86 | is(f.type, 'plain/text'); |
michael@0 | 87 | is(f.size, b.size); |
michael@0 | 88 | |
michael@0 | 89 | f = new File([b, b], 'test.txt', { type: 'plain/text' }); |
michael@0 | 90 | ok(f, 'File created'); |
michael@0 | 91 | is(f.name, 'test.txt'); |
michael@0 | 92 | is(f.type, 'plain/text'); |
michael@0 | 93 | is(f.size, b.size * 2); |
michael@0 | 94 | |
michael@0 | 95 | var f2 = new File([f, f], 'test.txt', { type: 'plain/text' }); |
michael@0 | 96 | ok(f2, 'File created'); |
michael@0 | 97 | is(f2.name, 'test.txt'); |
michael@0 | 98 | is(f2.type, 'plain/text'); |
michael@0 | 99 | is(f2.size, f.size * 2); |
michael@0 | 100 | |
michael@0 | 101 | var f2 = new File([f, f], 'test.txt', b); |
michael@0 | 102 | ok(f2, 'File created'); |
michael@0 | 103 | is(f2.name, 'test.txt'); |
michael@0 | 104 | is(f2.type, b.type); |
michael@0 | 105 | is(f2.size, f.size * 2); |
michael@0 | 106 | |
michael@0 | 107 | </script> |
michael@0 | 108 | </pre> |
michael@0 | 109 | </body> |
michael@0 | 110 | </html> |
michael@0 | 111 |