Bug 1161535 - Update web-platform-tests to revision 40a9c4e9e4f99a738cd1a7602066c5e84d1b90b5, a=testonly

This commit is contained in:
James Graham 2015-05-05 14:35:20 +01:00
Родитель 457f496287
Коммит be5d897eb9
42 изменённых файлов: 499 добавлений и 383 удалений

Просмотреть файл

@ -8983,10 +8983,6 @@
"path": "IndexedDB/index_sort_order.htm",
"url": "/IndexedDB/index_sort_order.htm"
},
{
"path": "IndexedDB/interfaces.htm",
"url": "/IndexedDB/interfaces.htm"
},
{
"path": "IndexedDB/interfaces.html",
"url": "/IndexedDB/interfaces.html"
@ -10759,6 +10755,10 @@
"path": "dom/nodes/Text-constructor.html",
"url": "/dom/nodes/Text-constructor.html"
},
{
"path": "dom/nodes/Text-splitText.html",
"url": "/dom/nodes/Text-splitText.html"
},
{
"path": "dom/nodes/attributes.html",
"url": "/dom/nodes/attributes.html"
@ -11803,6 +11803,10 @@
"path": "html/dom/documents/dom-tree-accessors/document.title-08.html",
"url": "/html/dom/documents/dom-tree-accessors/document.title-08.html"
},
{
"path": "html/dom/documents/dom-tree-accessors/document.title-09.html",
"url": "/html/dom/documents/dom-tree-accessors/document.title-09.html"
},
{
"path": "html/dom/documents/dom-tree-accessors/nameditem-01.html",
"url": "/html/dom/documents/dom-tree-accessors/nameditem-01.html"
@ -16896,8 +16900,8 @@
"url": "/web-animations/animation-node/idlharness.html"
},
{
"path": "web-animations/animation-timeline/animation-timeline.html",
"url": "/web-animations/animation-timeline/animation-timeline.html"
"path": "web-animations/animation-timeline/document-timeline.html",
"url": "/web-animations/animation-timeline/document-timeline.html"
},
{
"path": "web-animations/animation-timeline/idlharness.html",
@ -24821,7 +24825,7 @@
}
]
},
"rev": "20aef05e164be1ccbbd8f66192f01e778b5e5c18",
"rev": "40a9c4e9e4f99a738cd1a7602066c5e84d1b90b5",
"url_base": "/",
"version": 2
}

Просмотреть файл

@ -1 +1 @@
821cd0c3a55889f05c04ed9b6c12c810cd1a6c0f
eb7ac376c982330bc85c58e68fffc55aabef604c

Просмотреть файл

@ -11,6 +11,9 @@
<script src=support.js></script>
<script>
// Transaction may fire window.onerror in some implementations.
setup({allow_uncaught_exception:true});
var db,
events = [],
t = async_test(document.title, {timeout: 10000})

Просмотреть файл

@ -13,6 +13,9 @@
<script src="support.js"></script>
<script>
// Transaction may fire window.onerror in some implementations.
setup({allow_uncaught_exception:true});
var db,
events = [],
t = async_test(document.title, {timeout: 10000})

Просмотреть файл

@ -1,64 +0,0 @@
<!--
Test converted from WebKit:
http://trac.webkit.org/browser/trunk/LayoutTests/storage/indexeddb/resources/interfaces.js
-->
<!DOCTYPE html>
<!-- Submitted from TestTWF Paris -->
<meta charset=utf-8>
<title>Test IndexedDB's interfaces</title>
<link rel=author href="mailto:romain.huet@gmail.com" title="Romain Huet">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=support.js></script>
<script>
test(function() {
assert_true('IDBCursor' in self);
}, "Test IDBCursor");
test(function() {
assert_true('IDBCursorWithValue' in self);
}, "Test IDBCursorWithValue");
test(function() {
assert_true('IDBDatabase' in self);
}, "Test IDBDatabase");
test(function() {
assert_true('IDBFactory' in self);
}, "Test IDBFactory");
test(function() {
assert_true('IDBIndex' in self);
}, "Test IDBIndex");
test(function() {
assert_true('IDBKeyRange' in self);
}, "Test IDBKeyRange");
test(function() {
assert_true('IDBObjectStore' in self);
}, "Test IDBObjectStore");
test(function() {
assert_true('IDBOpenDBRequest' in self);
}, "Test IDBOpenDBRequest");
test(function() {
assert_true('IDBRequest' in self);
}, "Test IDBRequest");
test(function() {
assert_true('IDBTransaction' in self);
}, "Test IDBTransaction");
test(function() {
assert_true('IDBVersionChangeEvent' in self);
}, "Test IDBVersionChangeEvent");
</script>
<div id=log></div>

Просмотреть файл

@ -144,13 +144,6 @@
assert_equals(battery.onchargingchange, null, desc);
}, 'onchargingchange: treat array as null');
test(function() {
var desc = 'onchargingchange did not treat noncallable host object as null';
battery.onchargingchange = function() {};
battery.onchargingchange = Node;
assert_equals(battery.onchargingchange, null, desc);
}, 'onchargingchange: treat non-callable host object as null');
// attribute EventHandler onchargingtimechange;
test(function() {
@ -214,13 +207,6 @@
assert_equals(battery.onchargingtimechange, null, desc);
}, 'onchargingtimechange: treat array as null');
test(function() {
var desc = 'onchargingtimechange did not treat noncallable host object as null';
battery.onchargingtimechange = function() {};
battery.onchargingtimechange = Node;
assert_equals(battery.onchargingtimechange, null, desc);
}, 'onchargingtimechange: treat non-callable host object as null');
// attribute EventHandler ondischargingtimechange;
test(function() {
@ -284,13 +270,6 @@
assert_equals(battery.ondischargingtimechange, null, desc);
}, 'ondischargingtimechange: treat array as null');
test(function() {
var desc = 'ondischargingtimechange did not treat noncallable host object as null';
battery.ondischargingtimechange = function() {};
battery.ondischargingtimechange = Node;
assert_equals(battery.ondischargingtimechange, null, desc);
}, 'ondischargingtimechange: treat non-callable host object as null');
// attribute EventHandler onlevelchange;
test(function() {
@ -354,13 +333,6 @@
assert_equals(battery.onlevelchange, null, desc);
}, 'onlevelchange: treat array as null');
test(function() {
var desc = 'onlevelchange did not treat noncallable host object as null';
battery.onlevelchange = function() {};
battery.onlevelchange = Node;
assert_equals(battery.onlevelchange, null, desc);
}, 'onlevelchange: treat non-callable host object as null');
done();
}, function () {});

Просмотреть файл

@ -24,6 +24,14 @@ function testNode(create, type) {
assert_equals(node.data, "test")
}, type + ".appendData('')")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.appendData(", append more 資料,測試資料");
assert_equals(node.data, "test, append more 資料,測試資料");
assert_equals(node.length, 25);
}, type + ".appendData(non-ASCII)")
test(function() {
var node = create()
assert_equals(node.data, "test")

Просмотреть файл

@ -7,22 +7,79 @@
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
function testNode(node) {
function testNode(create, type) {
test(function() {
var node = create()
assert_equals(node.data, "test")
assert_throws("INDEX_SIZE_ERR", function() { node.deleteData(5, 10) })
assert_throws("INDEX_SIZE_ERR", function() { node.deleteData(5, 0) })
assert_throws("INDEX_SIZE_ERR", function() { node.deleteData(-1, 10) })
assert_throws("INDEX_SIZE_ERR", function() { node.deleteData(-1, 0) })
}, type + ".deleteData() out of bounds")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.deleteData(0, 2)
assert_equals(node.data, "st")
}, type + ".deleteData() at the start")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.deleteData(2, 10)
assert_equals(node.data, "te")
})
}, type + ".deleteData() at the end")
test(function() {
node.data = "test"
var node = create()
assert_equals(node.data, "test")
node.deleteData(1, 1)
assert_equals(node.data, "tst")
})
}
}, type + ".deleteData() in the middle")
test(function() {
testNode(document.createTextNode("test"))
testNode(document.createComment("test"))
})
var node = create()
assert_equals(node.data, "test")
node.deleteData(2, 0)
assert_equals(node.data, "test")
node.deleteData(0, 0)
assert_equals(node.data, "test")
}, type + ".deleteData() with zero count")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.deleteData(2, -1)
assert_equals(node.data, "te")
}, type + ".deleteData() with small negative count")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.deleteData(1, -0x100000000 + 2)
assert_equals(node.data, "tt")
}, type + ".deleteData() with large negative count")
test(function() {
var node = create()
node.data = "This is the character data test, append more 資料,更多測試資料";
node.deleteData(40, 5);
assert_equals(node.data, "This is the character data test, append 資料,更多測試資料");
node.deleteData(45, 2);
assert_equals(node.data, "This is the character data test, append 資料,更多資料");
}, type + ".deleteData() with non-ascii data")
}
testNode(function() { return document.createTextNode("test") }, "Text")
testNode(function() { return document.createComment("test") }, "Comment")
</script>

Просмотреть файл

@ -7,22 +7,74 @@
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
function testNode(node) {
function testNode(create, type) {
test(function() {
var node = create()
assert_equals(node.data, "test")
assert_throws("INDEX_SIZE_ERR", function() { node.insertData(5, "x") })
assert_throws("INDEX_SIZE_ERR", function() { node.insertData(5, "") })
}, type + ".insertData() out of bounds")
test(function() {
var node = create()
assert_equals(node.data, "test")
assert_throws("INDEX_SIZE_ERR", function() { node.insertData(-1, "x") })
assert_throws("INDEX_SIZE_ERR", function() { node.insertData(-0x100000000 + 5, "x") })
}, type + ".insertData() negative out of bounds")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.insertData(-0x100000000 + 2, "X")
assert_equals(node.data, "teXst")
}, type + ".insertData() negative in bounds")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.insertData(0, "")
assert_equals(node.data, "test")
}, type + ".insertData('')")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.insertData(0, "X")
assert_equals(node.data, "Xtest")
}, type + ".insertData() at the start")
test(function() {
var node = create()
assert_equals(node.data, "test")
node.insertData(2, "X")
assert_equals(node.data, "teXst")
})
}, type + ".insertData() in the middle")
test(function() {
node.data = "test"
var node = create()
assert_equals(node.data, "test")
node.insertData(4, "ing")
assert_equals(node.data, "testing")
})
}
}, type + ".insertData() at the end")
test(function() {
testNode(document.createTextNode("test"))
testNode(document.createComment("test"))
})
var node = create()
node.data = "This is the character data, append more 資料,測試資料";
node.insertData(26, " test");
assert_equals(node.data, "This is the character data test, append more 資料,測試資料");
node.insertData(48, "更多");
assert_equals(node.data, "This is the character data test, append more 資料,更多測試資料");
}, type + ".insertData() with non-ascii data")
}
testNode(function() { return document.createTextNode("test") }, "Text")
testNode(function() { return document.createComment("test") }, "Comment")
</script>

Просмотреть файл

@ -0,0 +1,53 @@
<!doctype html>
<meta charset=utf-8>
<title>Text.splitText()</title>
<link rel=help href="https://dom.spec.whatwg.org/#dom-text-splittextoffset">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var text = document.createTextNode("camembert");
assert_throws("INDEX_SIZE_ERR", function () { text.splitText(10) });
}, "Split text after end of data");
test(function() {
var text = document.createTextNode("");
var new_text = text.splitText(0);
assert_equals(text.data, "");
assert_equals(new_text.data, "");
}, "Split empty text");
test(function() {
var text = document.createTextNode("comté");
var new_text = text.splitText(0);
assert_equals(text.data, "");
assert_equals(new_text.data, "comté");
}, "Split text at beginning");
test(function() {
var text = document.createTextNode("comté");
var new_text = text.splitText(5);
assert_equals(text.data, "comté");
assert_equals(new_text.data, "");
}, "Split text at end");
test(function() {
var text = document.createTextNode("comté");
var new_text = text.splitText(3);
assert_equals(text.data, "com");
assert_equals(new_text.data, "té");
assert_equals(new_text.parentNode, null);
}, "Split root");
test(function() {
var parent = document.createElement('div');
var text = document.createTextNode("bleu");
parent.appendChild(text);
var new_text = text.splitText(2);
assert_equals(text.data, "bl");
assert_equals(new_text.data, "eu");
assert_equals(text.nextSibling, new_text);
assert_equals(new_text.parentNode, parent);
}, "Split child");
</script>

Просмотреть файл

@ -2,13 +2,32 @@
<title>Encoding API: invalid label</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/encodings.js"></script>
<script>
var tests = ["invalid-invalidLabel"];
setup(function() {
encodings_table.forEach(function(section) {
section.encodings.filter(function(encoding) {
return encoding.name !== 'replacement';
}).forEach(function(encoding) {
encoding.labels.forEach(function(label) {
["\u0000", "\u000b", "\u00a0", "\u2028", "\u2029"].forEach(function(ws) {
tests.push(ws + label);
tests.push(label + ws);
tests.push(ws + label + ws);
});
});
});
});
});
var invalidLabel = "invalid-invalidLabel"
tests.forEach(function(input) {
test(function() {
assert_throws(new RangeError(), function() { new TextEncoder(input); });
}, 'Invalid label ' + format_value(input) + ' should be rejected by TextEncoder.');
test(function() {
assert_throws(new RangeError(), function() { new TextEncoder(invalidLabel); });
assert_throws(new RangeError(), function() { new TextDecoder(invalidLabel); });
}, 'Invalid label "' + invalidLabel + '" should be rejected by API.');
assert_throws(new RangeError(), function() { new TextDecoder(input); });
}, 'Invalid label ' + format_value(input) + ' should be rejected by TextDecoder.');
});
</script>

Просмотреть файл

@ -0,0 +1,3 @@
def main(request, response):
response.headers.set("Content-Type", "text/plain;charset=" + request.GET.first("label"))
response.content = "hello encoding"

Просмотреть файл

@ -86,7 +86,7 @@
async_test(function(t) {
var frame = document.createElement("iframe"),
name = compatibility_names[encoding.name] || encoding.name;
frame.src = "resources/single-byte-raw.py?label=" + label
frame.src = "resources/text-plain-charset.py?label=" + label
frame.onload = t.step_func_done(function() {
assert_equals(frame.contentDocument.characterSet, name)
assert_equals(frame.contentDocument.inputEncoding, name)

Просмотреть файл

@ -4,22 +4,33 @@
<script src="/resources/testharnessreport.js"></script>
<script src="resources/encodings.js"></script>
<script>
var tests = [];
setup(function() {
var whitespace = [' ', '\t', '\n', '\f', '\r'];
encodings_table.forEach(function(section) {
section.encodings.filter(function(encoding) {
return encoding.name !== 'replacement';
}).forEach(function(encoding) {
var name = encoding.name;
encoding.labels.forEach(function(label) {
test(function(){
assert_equals(new TextDecoder(label).encoding, encoding.name,
'label for encoding should match');
assert_equals(new TextDecoder(label.toUpperCase()).encoding,
encoding.name,
'label matching should be case-insensitive');
}, 'name=' + name + ' label=' + label);
tests.push([label, encoding.name]);
whitespace.forEach(function(ws) {
tests.push([ws + label, encoding.name]);
tests.push([label + ws, encoding.name]);
tests.push([ws + label + ws, encoding.name]);
});
});
});
});
});
tests.forEach(function(t) {
var input = t[0], output = t[1];
test(function() {
assert_equals(new TextDecoder(input).encoding, output,
'label for encoding should match');
assert_equals(new TextDecoder(input.toUpperCase()).encoding, output,
'label matching should be case-insensitive');
}, format_value(input) + " => " + format_value(output));
});
</script>

Просмотреть файл

@ -0,0 +1,60 @@
<!DOCTYPE html>
<link rel="help" href="https://html.spec.whatwg.org/multipage/#document.title">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
function newSVGDocument() {
return document.implementation.createDocument(SVG_NAMESPACE, "svg");
}
test(function() {
var doc = newSVGDocument();
assert_equals(doc.title, "");
var child = doc.createElementNS(SVG_NAMESPACE, "x-child");
doc.documentElement.appendChild(child);
doc.title = "foo";
var lastChild = doc.documentElement.lastChild;
assert_equals(lastChild.namespaceURI, SVG_NAMESPACE);
assert_equals(lastChild.localName, "title");
assert_equals(lastChild.textContent, "foo");
assert_equals(doc.title, "foo");
}, "No title element in SVG document");
test(function() {
var doc = newSVGDocument();
var title = doc.createElementNS(SVG_NAMESPACE, "title");
title.textContent = "foo";
doc.documentElement.appendChild(title)
assert_equals(doc.title, "foo");
doc.title += "bar";
assert_equals(title.textContent, "foobar");
assert_equals(title.childNodes.length, 1);
assert_true(title.childNodes[0] instanceof Text);
assert_equals(doc.title, "foobar");
doc.title = "";
assert_equals(title.textContent, "");
assert_equals(doc.title, "");
assert_equals(title.childNodes.length, 0);
}, "Title element in SVG document");
test(function() {
var doc = newSVGDocument();
var title = doc.createElementNS(SVG_NAMESPACE, "title");
title.textContent = "foo";
var child = doc.createElementNS(SVG_NAMESPACE, "x-child");
child.appendChild(title);
doc.documentElement.appendChild(child);
assert_equals(doc.title, "");
}, "Title element not child of SVG root");
test(function() {
var doc = newSVGDocument();
var title = doc.createElement("title");
title.textContent = "foo";
doc.documentElement.appendChild(title);
assert_equals(doc.title, "");
}, "Title element not in SVG namespace");
</script>

Просмотреть файл

@ -63,9 +63,7 @@ test(function() {
assert_equals(img2.id, "test4");
assert_false("test4" in document, '"test4" in document should be false');
var collection = document.test4;
assert_class_string(collection, "HTMLCollection", "collection should be an HTMLCollection");
assert_array_equals(collection, [img1, img2]);
assert_equals(document.test4, undefined);
}, "If there are two imgs, nothing should be returned. (id)");
test(function() {

Просмотреть файл

@ -373,7 +373,7 @@ ReflectionTests.typeMap = {
{toString:function() {return 2;}, valueOf: null},
{valueOf:function() {return 3;}}],
"domExpected": function(val) {
var parsed = ReflectionTests.parseNonneg(val + "");
var parsed = ReflectionTests.parseNonneg(String(val));
if (parsed === false || parsed > maxInt || parsed < minInt) {
return null;
}
@ -409,7 +409,7 @@ ReflectionTests.typeMap = {
{toString:function() {return 2;}, valueOf: null},
{valueOf:function() {return 3;}}],
"domExpected": function(val) {
var parsed = ReflectionTests.parseNonneg(val + "");
var parsed = ReflectionTests.parseNonneg(String(val));
// Note maxInt, not maxUnsigned.
if (parsed === false || parsed < 0 || parsed > maxInt) {
return null;
@ -450,7 +450,7 @@ ReflectionTests.typeMap = {
{toString:function() {return 2;}, valueOf: null},
{valueOf:function() {return 3;}}],
"domExpected": function(val) {
var parsed = ReflectionTests.parseNonneg(val + "");
var parsed = ReflectionTests.parseNonneg(String(val));
// Note maxInt, not maxUnsigned.
if (parsed === false || parsed < 1 || parsed > maxInt) {
return null;
@ -696,7 +696,7 @@ ReflectionTests.doReflects = function(data, idlName, idlObj, domName, domObj) {
}
try {
domObj.setAttribute(domName, domTests[i]);
ReflectionHarness.test(domObj.getAttribute(domName), domTests[i] + "", "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by getAttribute()");
ReflectionHarness.test(domObj.getAttribute(domName), String(domTests[i]), "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by getAttribute()");
ReflectionHarness.test(idlObj[idlName], domExpected[i], "setAttribute() to " + ReflectionHarness.stringRep(domTests[i]) + " followed by IDL get");
if (ReflectionHarness.catchUnexpectedExceptions) {
ReflectionHarness.success();

Просмотреть файл

@ -9,22 +9,25 @@
<script src=interfaces.js></script>
<div id="log"></div>
<script>
function do_test(local_name, iface) {
test(function() {
elements.forEach(function(a) {
test(function() {
var e = document.createElement(a[0]), i = "HTML" + a[1] + "Element";
var e = document.createElement(local_name), i = "HTML" + iface + "Element";
assert_class_string(e, i,
"Element " + a[0] + " should have " + i +
"Element " + local_name + " should have " + i +
" as its primary interface.");
assert_true(e instanceof window[i],
"Element " + a[0] + " should implement " + i + ".");
"Element " + local_name + " should implement " + i + ".");
assert_true(e instanceof HTMLElement,
"Element " + a[0] + " should implement HTMLElement.");
"Element " + local_name + " should implement HTMLElement.");
assert_true(e instanceof Element,
"Element " + a[0] + " should implement Element.");
"Element " + local_name + " should implement Element.");
assert_true(e instanceof Node,
"Element " + a[0] + " should implement Node.");
}, "Interfaces for " + a[0])
})
"Element " + local_name + " should implement Node.");
}, "Interfaces for " + local_name);
}
elements.forEach(function(a) {
do_test(a[0], a[1]);
do_test(a[0].toUpperCase(), a[1]);
})
</script>

Просмотреть файл

@ -134,5 +134,6 @@ var elements = [
["dialog", "Dialog"],
["figcaption", ""],
["summary", ""],
["track", "Track"]
["track", "Track"],
["foo", "Unknown"]
];

Просмотреть файл

@ -97,5 +97,5 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description)
});
});
});
}, description, { timeout: 10000 } );
}, description);
};

Просмотреть файл

@ -211,7 +211,7 @@
test.done();
});
});
}, 'Test setting same duration multiple times does not fire duplicate durationchange', {timeout: 2500});
}, 'Test setting same duration multiple times does not fire duplicate durationchange');
</script>
</body>
</html>

Просмотреть файл

@ -65,7 +65,7 @@
assert_greater_than(timeUpdateCount, 2, "timeUpdateCount");
test.done();
});
}, "Test HTMLVideoElement.getVideoPlaybackQuality() with MediaSource API", {timeout: 5000});
}, "Test HTMLVideoElement.getVideoPlaybackQuality() with MediaSource API");
</script>
</body>
</html>

Просмотреть файл

@ -38,7 +38,7 @@
mediaSource.endOfStream();
mediaElement.play();
});
}, "Test normal playback case with MediaSource API", {timeout: 5000});
}, "Test normal playback case with MediaSource API");
</script>
</body>
</html>

Просмотреть файл

@ -63,7 +63,7 @@
test.done();
});
}, 'Test seeking to a new location before transitioning beyond HAVE_METADATA.', {timeout: 10000} );
}, 'Test seeking to a new location before transitioning beyond HAVE_METADATA.');
mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData)
{
@ -136,7 +136,7 @@
assert_greater_than(mediaElement.readyState, mediaElement.HAVE_CURRENT_DATA, 'Greater than HAVE_CURRENT_DATA');
test.done();
});
}, 'Test seeking to a new location during a pending seek.', {timeout: 10000} );
}, 'Test seeking to a new location during a pending seek.');
</script>
</body>
</html>

Просмотреть файл

@ -1,6 +1,4 @@
(function(window) {
setup({ timeout: 12000 });
var SEGMENT_INFO_LIST = [
{
url: 'mp4/test.mp4',

Просмотреть файл

@ -555,8 +555,8 @@ function IdlInterface(obj, is_callback) {
this.members = obj.members.map(function(m){return new IdlInterfaceMember(m); });
if (this.has_extended_attribute("Unforgeable")) {
this.members
.filter(m => !m["static"] && (m.type == "attribute" || m.type == "operation"))
.forEach(m => m.isUnforgeable = true);
.filter(function(m) { return !m["static"] && (m.type == "attribute" || m.type == "operation"); })
.forEach(function(m) { return m.isUnforgeable = true; });
}
/**

Просмотреть файл

@ -368,8 +368,20 @@ policies and contribution forms [3].
self.addEventListener("message",
function(event) {
if (event.data.type && event.data.type === "connect") {
if (event.ports && event.ports[0]) {
// If a MessageChannel was passed, then use it to
// send results back to the main window. This
// allows the tests to work even if the browser
// does not fully support MessageEvent.source in
// ServiceWorkers yet.
this_obj._add_message_port(event.ports[0]);
event.ports[0].start();
} else {
// If there is no MessageChannel, then attempt to
// use the MessageEvent.source to send results
// back to the main window.
this_obj._add_message_port(event.source);
}
}
});
@ -1476,15 +1488,24 @@ policies and contribution forms [3].
var message_port;
if (is_service_worker(worker)) {
if (window.MessageChannel) {
// The ServiceWorker's implicit MessagePort is currently not
// reliably accessible from the ServiceWorkerGlobalScope due to
// Blink setting MessageEvent.source to null for messages sent via
// ServiceWorker.postMessage(). Until that's resolved, create an
// explicit MessageChannel and pass one end to the worker.
// Blink setting MessageEvent.source to null for messages sent
// via ServiceWorker.postMessage(). Until that's resolved,
// create an explicit MessageChannel and pass one end to the
// worker.
var message_channel = new MessageChannel();
message_port = message_channel.port1;
message_port.start();
worker.postMessage({type: "connect"}, [message_channel.port2]);
} else {
// If MessageChannel is not available, then try the
// ServiceWorker.postMessage() approach using MessageEvent.source
// on the other end.
message_port = navigator.serviceWorker;
worker.postMessage({type: "connect"});
}
} else if (is_shared_worker(worker)) {
message_port = worker.port;
} else {

Просмотреть файл

@ -22,12 +22,12 @@ cache_test(function(cache) {
cache_test(function(cache) {
return assert_promise_rejects(
cache.add('javascript://this-is-not-http-mmkay'),
'NetworkError',
'Cache.add should throw a NetworkError for non-HTTP/HTTPS URLs.');
new TypeError(),
'Cache.add should throw a TypeError for non-HTTP/HTTPS URLs.');
}, 'Cache.add called with non-HTTP/HTTPS URL');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
var request = new Request('../resources/simple.txt');
return cache.add(request)
.then(function(result) {
assert_equals(result, undefined,
@ -36,28 +36,18 @@ cache_test(function(cache) {
}, 'Cache.add called with Request object');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
return request.text()
.then(function() {
assert_false(request.bodyUsed);
})
.then(function() {
return cache.add(request);
});
}, 'Cache.add called with Request object with a used body');
cache_test(function(cache) {
var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
var request = new Request('../resources/simple.txt');
return cache.add(request)
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
})
.then(function() {
return assert_promise_rejects(
cache.add(request),
new TypeError(),
'Cache.add should throw TypeError if same request is added twice.');
return cache.add(request);
})
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
});
}, 'Cache.add called twice with the same Request object');
@ -137,8 +127,8 @@ cache_test(function(cache) {
var request = new Request('../resources/simple.txt');
return assert_promise_rejects(
cache.addAll([request, request]),
new TypeError(),
'Cache.addAll should throw TypeError if the same request is added ' +
'InvalidStateError',
'Cache.addAll should throw InvalidStateError if the same request is added ' +
'twice.');
}, 'Cache.addAll called with the same Request object specified twice');

Просмотреть файл

@ -43,8 +43,8 @@ cache_test(function(cache) {
}, 'Cache.delete called with a string URL');
cache_test(function(cache) {
var request = new Request(test_url, { method: 'POST', body: 'Abc' });
return cache.put(request.clone(), new_test_response())
var request = new Request(test_url);
return cache.put(request, new_test_response())
.then(function() {
return cache.delete(request);
})
@ -52,33 +52,9 @@ cache_test(function(cache) {
assert_true(result,
'Cache.delete should resolve with "true" if an entry ' +
'was successfully deleted.');
assert_false(request.bodyUsed,
'Cache.delete should not consume request body.');
});
}, 'Cache.delete called with a Request object');
cache_test(function(cache) {
var request = new Request(test_url, { method: 'POST', body: 'Abc' });
return cache.put(request.clone(), new_test_response())
.then(function() {
return request.text();
})
.then(function() {
assert_true(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#body-mixin] ' +
'Request.bodyUsed should be true after text() method ' +
'resolves.');
})
.then(function() {
return cache.delete(request);
})
.then(function(result) {
assert_true(result,
'Cache.delete should resolve with "true" if an entry ' +
'was successfully deleted.');
});
}, 'Cache.delete with a Request object containing used body');
cache_test(function(cache) {
return cache.delete(test_url)
.then(function(result) {

Просмотреть файл

@ -103,14 +103,6 @@ var vary_entries = [
request: new Request('http://example.com/c'),
response: new Response('',
{headers: {'Vary': 'Cookies'}})
},
{
name: 'vary_wildcard',
request: new Request('http://example.com/c',
{headers: {'Cookies': 'x', 'X-Key': '1'}}),
response: new Response('',
{headers: {'Vary': '*'}})
}
];
@ -181,32 +173,6 @@ prepopulated_cache_test(simple_entries, function(cache, entries) {
});
}, 'Cache.match with new Request');
cache_test(function(cache) {
var request = new Request('https://example.com/foo', {
method: 'POST',
body: 'Hello world!'
});
var response = new Response('Booyah!', {
status: 200,
headers: {'Content-Type': 'text/plain'}
});
return cache.put(request.clone(), response.clone())
.then(function() {
assert_false(
request.bodyUsed,
'[https://fetch.spec.whatwg.org/#concept-body-used-flag] ' +
'Request.bodyUsed flag should be initially false.');
})
.then(function() {
return cache.match(request);
})
.then(function(result) {
assert_false(request.bodyUsed,
'Cache.match should not consume Request body.');
});
}, 'Cache.match with Request containing non-empty body');
prepopulated_cache_test(simple_entries, function(cache, entries) {
return cache.matchAll(entries.a.request,
{ignoreSearch: true})
@ -337,7 +303,6 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
assert_array_equivalent(
result,
[
entries.vary_wildcard.response,
entries.vary_cookie_absent.response
],
'Cache.matchAll should exclude matches if a vary header is ' +
@ -354,7 +319,6 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
assert_array_equivalent(
result,
[
entries.vary_wildcard.response
],
'Cache.matchAll should exclude matches if a vary header is ' +
'missing in the cached request, but is present in the query ' +
@ -381,7 +345,6 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
assert_object_in_array(
result,
[
entries.vary_wildcard.response,
entries.vary_cookie_absent.response
],
'Cache.match should honor "Vary" header.');
@ -398,7 +361,6 @@ prepopulated_cache_test(vary_entries, function(cache, entries) {
entries.vary_cookie_is_cookie.response,
entries.vary_cookie_is_good.response,
entries.vary_cookie_absent.response,
entries.vary_wildcard.response
],
'Cache.matchAll should honor "ignoreVary" parameter.');
});
@ -464,6 +426,15 @@ cache_test(function(cache) {
});
}, 'Cache.match invoked multiple times for the same Request/Response');
prepopulated_cache_test(simple_entries, function(cache, entries) {
var request = new Request(entries.a.request, { method: 'POST' });
return cache.match(request)
.then(function(result) {
assert_equals(result, undefined,
'Cache.match should not find a match');
});
}, 'Cache.match with POST Request');
// Helpers ---
// Run |test_function| with a Cache object as its only parameter. Prior to the

Просмотреть файл

@ -67,29 +67,6 @@ cache_test(function(cache) {
});
}, 'Cache.put with Response without a body');
cache_test(function(cache) {
var request = new Request(test_url, {
method: 'POST',
body: 'Hello'
});
var response = new Response(test_body);
assert_false(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Request.bodyUsed should be initially false.');
return cache.put(request, response.clone())
.then(function() {
assert_true(request.bodyUsed,
'Cache.put should consume Request body.');
})
.then(function() {
return cache.match(request);
})
.then(function(result) {
assert_object_equals(result, response,
'Cache.put should store response body.');
});
}, 'Cache.put with Request containing a body');
cache_test(function(cache) {
var request = new Request(test_url);
var response = new Response(test_body);
@ -294,18 +271,11 @@ cache_test(function(cache) {
cache_test(function(cache) {
var request = new Request(test_url, {method: 'POST', body: test_body});
assert_false(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Request.bodyUsed should be initially false.');
var copy = new Request(request);
assert_true(request.bodyUsed,
'[https://fetch.spec.whatwg.org/#dom-request] ' +
'Request constructor should set input\'s used flag.');
return assert_promise_rejects(
cache.put(request, new Response(test_body)),
new TypeError(),
'Cache.put should throw a TypeError for a request with used body.');
}, 'Cache.put with a used request body');
'Cache.put should throw a TypeError for a POST request.');
}, 'Cache.put with a POST request');
cache_test(function(cache) {
var response = new Response(test_body);
@ -313,12 +283,35 @@ cache_test(function(cache) {
'[https://fetch.spec.whatwg.org/#dom-body-bodyused] ' +
'Response.bodyUsed should be initially false.');
return response.text().then(function() {
assert_false(
assert_true(
response.bodyUsed,
'[https://fetch.spec.whatwg.org/#concept-body-consume-body] ' +
'The text() method should not set "body passed" flag.');
return cache.put(new Request(test_url), response);
'The text() method should set "body used" flag.');
return assert_promise_rejects(
cache.put(new Request(test_url), response),
new TypeError,
'[https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache-put] ' +
'Cache put should reject with TypeError when Response ' +
'body is already used.');
});
}, 'Cache.put with a used response body');
cache_test(function(cache) {
return assert_promise_rejects(
cache.put(new Request(test_url),
new Response(test_body, { headers: { VARY: '*' }})),
new TypeError(),
'Cache.put should reject VARY:* Responses with a TypeError.');
}, 'Cache.put with a VARY:* Response');
cache_test(function(cache) {
return assert_promise_rejects(
cache.put(new Request(test_url),
new Response(test_body,
{ headers: { VARY: 'Accept-Language,*' }})),
new TypeError(),
'Cache.put should reject Responses with an embedded VARY:* with a ' +
'TypeError.');
}, 'Cache.put with an embedded VARY:* Response');
done();

Просмотреть файл

@ -111,8 +111,11 @@ promise_test(function(test) {
return self.caches.match(transaction.request, {cacheName: 'foo'});
})
.then(function(response) {
assert_equals(response, undefined,
'The response should not be found.');
assert_unreached('The match with bad cache name should reject.');
})
.catch(function(err) {
assert_equals(err.name, 'NotFoundError',
'The match should reject with NotFoundError.');
return self.caches.has('foo');
})
.then(function(has_foo) {

Просмотреть файл

@ -106,6 +106,7 @@ promise_test(function(t) {
promise_test(function(t) {
var cache_name = 'cache-storage/open';
var url = '../resources/simple.txt';
var cache;
return self.caches.delete(cache_name)
.then(function() {
@ -115,21 +116,26 @@ promise_test(function(t) {
cache = result;
})
.then(function() {
return self.caches.open(cache_name);
})
.then(function(result) {
assert_equals(result, cache,
'CacheStorage.open should return the named Cache ' +
'object if it exists.');
return cache.add('../resources/simple.txt');
})
.then(function() {
return self.caches.open(cache_name);
})
.then(function(result) {
assert_equals(result, cache,
'CacheStorage.open should return the same ' +
'instance of an existing Cache object.');
});
assert_true(result instanceof Cache,
'CacheStorage.open should return a Cache object');
assert_not_equals(result, cache,
'CacheStorage.open should return a new Cache ' +
'object each time its called.');
return Promise.all([cache.keys(), result.keys()]);
})
.then(function(results) {
var expected_urls = results[0].map(function(r) { return r.url });
var actual_urls = results[1].map(function(r) { return r.url });
assert_array_equals(actual_urls, expected_urls,
'CacheStorage.open should return a new Cache ' +
'object for the same backing store.');
})
}, 'CacheStorage.open with existing cache');
promise_test(function(t) {

Просмотреть файл

@ -23,7 +23,7 @@ function wait_for_message(id) {
self.addEventListener('message', function listener(e) {
if (e.data.id === id) {
resolve(e.data);
self.removeEventListener(listener);
self.removeEventListener('message', listener);
}
});
});

Просмотреть файл

@ -1,6 +1,6 @@
<!doctype html>
<meta charset=utf-8>
<title>Web Animations API: AnimationTimeline tests</title>
<title>Web Animations API: DocumentTimeline tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>

Просмотреть файл

@ -1,15 +1,18 @@
<!doctype html>
<meta charset=utf-8>
<title>Web Animations API: AnimationTimeline tests</title>
<title>Web Animations API: DocumentTimeline tests</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<div id="log"></div>
<script type="text/plain" id="AnimationTimeline-IDL">
<script type="text/plain" id="DocumentTimeline-IDL">
interface AnimationTimeline {
readonly attribute double? currentTime;
};
interface DocumentTimeline : AnimationTimeline {
};
</script>
<script>
'use strict';
@ -18,8 +21,8 @@ var idlArray;
test(function() {
idlArray = new IdlArray();
idlArray.add_idls(
document.getElementById('AnimationTimeline-IDL').textContent);
idlArray.add_objects( { AnimationTimeline: ['document.timeline'] } );
document.getElementById('DocumentTimeline-IDL').textContent);
idlArray.add_objects( { DocumentTimeline: ['document.timeline'] } );
});
idlArray.test();

Просмотреть файл

@ -30,7 +30,7 @@ interface EventInit {
interface Storage {
readonly attribute unsigned long length;
DOMString? key(unsigned long index);
getter DOMString getItem(DOMString key);
getter DOMString? getItem(DOMString key);
setter creator void setItem(DOMString key, DOMString value);
deleter void removeItem(DOMString key);
void clear();
@ -47,7 +47,7 @@ interface WindowLocalStorage {
Window implements WindowLocalStorage;
[Constructor(DOMString type, optional StorageEventInit eventInitDict)]
interface StorageEvent : Event {
readonly attribute DOMString key;
readonly attribute DOMString? key;
readonly attribute DOMString? oldValue;
readonly attribute DOMString? newValue;
readonly attribute DOMString url;
@ -55,7 +55,7 @@ interface StorageEvent : Event {
};
dictionary StorageEventInit : EventInit {
DOMString key;
DOMString? key;
DOMString? oldValue;
DOMString? newValue;
DOMString url;

Просмотреть файл

@ -4,19 +4,19 @@
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
async_test(function(t) {
async_test(function() {
var testResult;
var worker = new Worker('./support/WorkerTerminate.js');
worker.onmessage = function(e) {
worker.onmessage = this.step_func(function(e) {
testResult = e.data;
if (testResult >= 10000) {
worker.terminate();
worker.onmessage = t.unreached_func('Unexpected message event');
setTimeout(t.step_func_done(function() {
worker.onmessage = this.unreached_func('Unexpected message event');
setTimeout(this.step_func_done(function() {
assert_equals(testResult, 10000);
}), 100);
}
};
});
worker.postMessage("ping");
});
</script>

Просмотреть файл

@ -12,23 +12,15 @@ close();
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
async_test(function() {
var gotMessage = false;
var gotError = false;
var worker = new Worker('#');
worker.onmessage = function(e) {
gotMessage = true;
assert_unreached("Got message");
};
worker.onerror = function(e) {
gotError = true;
assert_unreached("Got error");
};
worker.postMessage(1);
setTimeout(this.step_func(function() {
assert_false(gotMessage, 'got message');
assert_true(gotError, 'got error');
this.done();
}), 500);
});
setTimeout(done, 2000);
</script>
<!--
*/

Просмотреть файл

@ -18,22 +18,14 @@ var interval2 = setInterval(function() {
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
async_test(function() {
var gotMessage = false;
var gotError = false;
var worker = new Worker('#');
worker.onmessage = function(e) {
gotMessage = true;
assert_unreached("Got message");
};
worker.onerror = function(e) {
gotError = true;
assert_unreached("Got error");
};
setTimeout(this.step_func(function() {
assert_false(gotMessage, 'got message');
assert_true(gotError, 'got error');
this.done();
}), 500);
});
setTimeout(done, 2000);
</script>
<!--
*/

Просмотреть файл

@ -14,27 +14,15 @@ setTimeout(x, 0);
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
setup({allow_uncaught_exception: true});
async_test(function() {
var gotMessage = false;
var gotError = false;
var worker = new Worker('#');
worker.onmessage = function(e) {
gotMessage = true;
assert_unreached("Got message");
};
worker.onerror = function(e) {
gotError = true;
assert_unreached("Got error");
};
setTimeout(this.step_func(function() {
assert_false(gotMessage, 'got message');
assert_true(gotError, 'got error');
this.done();
}), 500);
});
setTimeout(done, 2000);
</script>
<!--
*/
//-->

Просмотреть файл

@ -2,7 +2,7 @@ onmessage = function(evt)
{
for (var i=0; true; i++)
{
if (i%1000 == 1)
if (i%1000 == 0)
{
postMessage(i);
}