Revision control

1
<!DOCTYPE html>
2
<script src='../resources/testharness.js'></script>
3
<script src='../resources/testharnessreport.js'></script>
4
<script src='../resources/gc.js'></script>
5
<script>
7
8
test(function() {
9
var input = {
10
readable: { },
11
writable: { }
12
};
13
var options = { };
14
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(undefined, input, options); });
15
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(null, input, options); });
16
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(1, input, options); });
17
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call({ "pipeTo": "test" }, input, options); });
18
}, 'ReadableStream.prototype.pipeThrough should throw when "this" has no pipeTo method');
19
20
test(function() {
21
var options = { };
22
var thisValue = {
23
pipeTo: function() {
24
assert_unreached();
25
}
26
};
27
28
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(thisValue, null, options); });
29
assert_throws(new TypeError(), function() { ReadableStream.prototype.pipeThrough.call(thisValue, undefined, options); });
30
}, 'ReadableStream.prototype.pipeThrough should throw when passed argument is not an object');
31
32
test(function() {
33
var options = { };
34
var error = new TypeError("potato");
35
36
var thisWrongValue = {
37
get pipeTo() {
38
throw error;
39
}
40
};
41
assert_throws(error, function() { ReadableStream.prototype.pipeThrough.call(thisWrongValue, { readable: { }, writable: { } }, options); });
42
43
var thisValue = {
44
pipeTo: function() {
45
assert_unreached();
46
}
47
};
48
var wrongInput = {
49
readable: { },
50
get writable() {
51
throw error;
52
}
53
};
54
assert_throws(error, function() { ReadableStream.prototype.pipeThrough.call(thisValue, wrongInput, options); });
55
56
var wrongInput2 = {
57
get readable() {
58
throw error;
59
},
60
writable: { }
61
};
62
var thisValue2 = {
63
pipeTo: function() { }
64
};
65
assert_throws(error, function() { ReadableStream.prototype.pipeThrough.call(thisValue2, wrongInput2, options); });
66
}, 'ReadableStream.prototype.pipeThrough should throw when called getters are throwing');
67
</script>