Bug 1225909 - Update web-platform-tests to revision 623c1536821f7536d8ee2859bbeaf0d9738ea707, a=testonly

This commit is contained in:
James Graham 2015-11-16 17:03:31 +00:00
Родитель a54c1be89e
Коммит 55699f2d5c
21 изменённых файлов: 653 добавлений и 41 удалений

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

@ -14681,6 +14681,10 @@
"path": "hr-time/basic.html",
"url": "/hr-time/basic.html"
},
{
"path": "hr-time/basic.worker.js",
"url": "/hr-time/basic.worker"
},
{
"path": "hr-time/idlharness.html",
"url": "/hr-time/idlharness.html"
@ -26245,6 +26249,38 @@
"path": "url/url-constructor.html",
"url": "/url/url-constructor.html"
},
{
"path": "url/urlsearchparams-append.html",
"url": "/url/urlsearchparams-append.html"
},
{
"path": "url/urlsearchparams-constructor.html",
"url": "/url/urlsearchparams-constructor.html"
},
{
"path": "url/urlsearchparams-delete.html",
"url": "/url/urlsearchparams-delete.html"
},
{
"path": "url/urlsearchparams-get.html",
"url": "/url/urlsearchparams-get.html"
},
{
"path": "url/urlsearchparams-getall.html",
"url": "/url/urlsearchparams-getall.html"
},
{
"path": "url/urlsearchparams-has.html",
"url": "/url/urlsearchparams-has.html"
},
{
"path": "url/urlsearchparams-set.html",
"url": "/url/urlsearchparams-set.html"
},
{
"path": "url/urlsearchparams-stringifier.html",
"url": "/url/urlsearchparams-stringifier.html"
},
{
"path": "user-timing/idlharness.html",
"url": "/user-timing/idlharness.html"
@ -35420,7 +35456,7 @@
}
]
},
"rev": "a5f15d6bdbeeec010465dc906e542873d64797ec",
"rev": "623c1536821f7536d8ee2859bbeaf0d9738ea707",
"url_base": "/",
"version": 2
}

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

@ -1 +1 @@
1e125923b6586c58492f54dc396e6cbfd09c6ae2
f0cc59cdba5802f6981f9325129c4ac4f3c7b805

1
testing/web-platform/tests/.gitmodules поставляемый
Просмотреть файл

@ -5,3 +5,4 @@
[submodule "tools"]
path = tools
url = https://github.com/w3c/wpt-tools.git
ignore = dirty

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

@ -31,6 +31,10 @@ connect-src 'self'; script-src 'self' 'unsafe-inline'; child-src 'self';
worker.onmessage = function(event) {
alert_assert(event.data);
};
worker.onerror = function(event) {
alert_assert('TEST COMPLETE');
event.preventDefault();
}
} catch (e) {
alert_assert('TEST COMPLETE');
}

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

@ -31,6 +31,10 @@ connect-src 'self'; script-src 'self' 'unsafe-inline'; child-src *;
worker.onmessage = function(event) {
alert_assert(event.data);
};
worker.onerror = function(event) {
event.preventDefault();
alert_assert('TEST COMPLETE');
}
} catch (e) {
alert_assert('TEST COMPLETE');
}

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

@ -0,0 +1,18 @@
importScripts("/resources/testharness.js");
test(function() {
assert_true((performance !== undefined), "WorkerGlobalScope.performance exists");
assert_equals((typeof performance.now), "function");
}, "WorkerGlobalScope.performance.now() is a function");
test(function() {
assert_true(performance.now() > 0);
}, "WorkerGlobalScope.performance.now() returns a positive number");
test(function() {
var now1 = performance.now();
var now2 = performance.now();
assert_true((now2-now1) >= 0);
}, "WorkerGlobalScope.performance.now() difference is not negative");
done();

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

@ -83,7 +83,8 @@ function setAttributes(el, attrs) {
function bindEvents(element, resolveEventName, rejectEventName) {
element.eventPromise = new Promise(function(resolve, reject) {
element.addEventListener(resolveEventName || "load", resolve);
element.addEventListener(rejectEventName || "error", reject);
element.addEventListener(rejectEventName || "error",
function(e) { e.preventDefault(); reject(); } );
});
}

2
testing/web-platform/tests/tools/.gitignore поставляемый
Просмотреть файл

@ -3,4 +3,4 @@
*.sw[po]
*~
\#*
runner/MANIFEST.json

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

@ -1,8 +1,18 @@
import os
import urlparse
from abc import ABCMeta, abstractmethod, abstractproperty
item_types = ["testharness", "reftest", "manual", "stub", "wdspec"]
def from_os_path(path):
return path.replace(os.path.sep, "/")
def to_os_path(path):
return path.replace("/", os.path.sep)
def get_source_file(source_files, tests_root, manifest, path):
def make_new():
from sourcefile import SourceFile
@ -17,6 +27,7 @@ def get_source_file(source_files, tests_root, manifest, path):
return source_files[path]
class ManifestItem(object):
__metaclass__ = ABCMeta
@ -58,7 +69,7 @@ class ManifestItem(object):
return hash(self.key() + self.meta_key())
def to_json(self):
return {"path": self.path}
return {"path": from_os_path(self.path)}
@classmethod
def from_json(self, manifest, tests_root, obj, source_files=None):
@ -86,7 +97,8 @@ class URLManifestItem(ManifestItem):
@classmethod
def from_json(cls, manifest, tests_root, obj, source_files=None):
source_file = get_source_file(source_files, tests_root, manifest, obj["path"])
source_file = get_source_file(source_files, tests_root, manifest,
to_os_path(obj["path"]))
return cls(source_file,
obj["url"],
url_base=manifest.url_base,
@ -111,7 +123,8 @@ class TestharnessTest(URLManifestItem):
@classmethod
def from_json(cls, manifest, tests_root, obj, source_files=None):
source_file = get_source_file(source_files, tests_root, manifest, obj["path"])
source_file = get_source_file(source_files, tests_root, manifest,
to_os_path(obj["path"]))
return cls(source_file,
obj["url"],
url_base=manifest.url_base,
@ -147,7 +160,8 @@ class RefTest(URLManifestItem):
@classmethod
def from_json(cls, manifest, tests_root, obj, source_files=None):
source_file = get_source_file(source_files, tests_root, manifest, obj["path"])
source_file = get_source_file(source_files, tests_root, manifest,
to_os_path(obj["path"]))
return cls(source_file,
obj["url"],
obj["references"],
@ -171,5 +185,6 @@ class WebdriverSpecTest(ManifestItem):
@classmethod
def from_json(cls, manifest, tests_root, obj, source_files=None):
source_file = get_source_file(source_files, tests_root, manifest, obj["path"])
source_file = get_source_file(source_files, tests_root, manifest,
to_os_path(obj["path"]))
return cls(source_file, manifest=manifest)

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

@ -0,0 +1,11 @@
/*
Extending the W3C testharness.js with locally useful functionality.
*/
function assert_type_error(f, msg) {
assert_throws(TypeError(), f, msg);
}
function assert_syntax_error(f, msg) {
assert_throws(SyntaxError(), f, msg);
}

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

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<meta charset="utf8">
<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-append">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-extras.js"></script>
<script>
test(function() {
var params = new URLSearchParams();
params.append('a', 'b');
assert_equals(params + '', 'a=b');
params.append('a', 'b');
assert_equals(params + '', 'a=b&a=b');
params.append('a', 'c');
assert_equals(params + '', 'a=b&a=b&a=c');
}, 'Append same name');
test(function() {
var params = new URLSearchParams();
params.append('', '');
assert_equals(params + '', '=');
params.append('', '');
assert_equals(params + '', '=&=');
}, 'Append empty strings');
test(function() {
var params = new URLSearchParams();
params.append(null, null);
assert_equals(params + '', 'null=null');
params.append(null, null);
assert_equals(params + '', 'null=null&null=null');
}, 'Append null');
test(function() {
var params = new URLSearchParams();
params.append('first', 1);
params.append('second', 2);
params.append('third', '');
params.append('first', 10);
assert_true(params.has('first'), 'Search params object has name "first"');
assert_equals(params.get('first'), '1', 'Search params object has name "first" with value "1"');
assert_equals(params.get('second'), '2', 'Search params object has name "second" with value "2"');
assert_equals(params.get('third'), '', 'Search params object has name "third" with value ""');
params.append('first', 10);
assert_equals(params.get('first'), '1', 'Search params object has name "first" with value "1"');
}, 'Append multiple');
</script>
</head>
</html>

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

@ -0,0 +1,129 @@
<!doctype html>
<html>
<head>
<meta charset="utf8">
<link rel="help" href="http://url.spec.whatwg.org/#urlsearchparams">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-extras.js"></script>
<script>
test(function() {
var params = new URLSearchParams();
assert_equals(params + '', '');
params = new URLSearchParams('');
assert_equals(params + '', '');
params = new URLSearchParams('a=b');
assert_equals(params + '', 'a=b');
params = new URLSearchParams(params);
assert_equals(params + '', 'a=b');
}, 'Basic URLSearchParams construction');
test(function() {
assert_type_error(function () { URLSearchParams(); }, 'Failed to construct \'URLSearchParams\': Please use the \'new\' operator, this DOM object constructor cannot be called as a function.');
assert_type_error(function () { new URLSearchParams(DOMException.prototype); });
var params = new URLSearchParams('');
assert_true(params != null, 'constructor returned non-null value.');
assert_equals(params.__proto__, URLSearchParams.prototype, 'expected URLSearchParams.prototype as prototype.');
params = new URLSearchParams({});
assert_equals(params + '', '%5Bobject+Object%5D=');
}, 'URLSearchParams constructor, empty.');
test(function() {
var params = new URLSearchParams('a=b');
assert_true(params != null, 'constructor returned non-null value.');
assert_true(params.has('a'), 'Search params object has name "a"');
assert_false(params.has('b'), 'Search params object has not got name "b"');
var params = new URLSearchParams('a=b&c');
assert_true(params != null, 'constructor returned non-null value.');
assert_true(params.has('a'), 'Search params object has name "a"');
assert_true(params.has('c'), 'Search params object has name "c"');
var params = new URLSearchParams('&a&&& &&&&&a+b=& c&m%c3%b8%c3%b8');
assert_true(params != null, 'constructor returned non-null value.');
assert_true(params.has('a'), 'Search params object has name "a"');
assert_true(params.has('a b'), 'Search params object has name "a b"');
assert_true(params.has(' '), 'Search params object has name " "');
assert_false(params.has('c'), 'Search params object did not have the name "c"');
assert_true(params.has(' c'), 'Search params object has name " c"');
assert_true(params.has('møø'), 'Search params object has name "møø"');
}, 'URLSearchParams constructor, string.');
test(function() {
var seed = new URLSearchParams('a=b&c=d');
var params = new URLSearchParams(seed);
assert_true(params != null, 'constructor returned non-null value.');
assert_equals(params.get('a'), 'b');
assert_equals(params.get('c'), 'd');
assert_false(params.has('d'));
// The name-value pairs are copied when created; later updates
// should not be observable.
seed.append('e', 'f');
assert_false(params.has('e'));
params.append('g', 'h');
assert_false(seed.has('g'));
}, 'URLSearchParams constructor, object.');
test(function() {
var params = new URLSearchParams('a=b+c');
assert_equals(params.get('a'), 'b c');
params = new URLSearchParams('a+b=c');
assert_equals(params.get('a b'), 'c');
}, 'Parse +');
test(function() {
var params = new URLSearchParams('a=b c');
assert_equals(params.get('a'), 'b c');
params = new URLSearchParams('a b=c');
assert_equals(params.get('a b'), 'c');
}, 'Parse space');
test(function() {
var params = new URLSearchParams('a=b%20c');
assert_equals(params.get('a'), 'b c');
params = new URLSearchParams('a%20b=c');
assert_equals(params.get('a b'), 'c');
}, 'Parse %20');
test(function() {
var params = new URLSearchParams('a=b\0c');
assert_equals(params.get('a'), 'b\0c');
params = new URLSearchParams('a\0b=c');
assert_equals(params.get('a\0b'), 'c');
}, 'Parse \\0');
test(function() {
var params = new URLSearchParams('a=b%00c');
assert_equals(params.get('a'), 'b\0c');
params = new URLSearchParams('a%00b=c');
assert_equals(params.get('a\0b'), 'c');
}, 'Parse %00');
test(function() {
var params = new URLSearchParams('a=b\u2384');
assert_equals(params.get('a'), 'b\u2384');
params = new URLSearchParams('a\u2384b=c');
assert_equals(params.get('a\u2384b'), 'c');
}, 'Parse \u2384'); // Unicode Character 'COMPOSITION SYMBOL' (U+2384)
test(function() {
var params = new URLSearchParams('a=b%e2%8e%84');
assert_equals(params.get('a'), 'b\u2384');
params = new URLSearchParams('a%e2%8e%84b=c');
assert_equals(params.get('a\u2384b'), 'c');
}, 'Parse %e2%8e%84'); // Unicode Character 'COMPOSITION SYMBOL' (U+2384)
test(function() {
var params = new URLSearchParams('a=b\uD83D\uDCA9c');
assert_equals(params.get('a'), 'b\uD83D\uDCA9c');
params = new URLSearchParams('a\uD83D\uDCA9b=c');
assert_equals(params.get('a\uD83D\uDCA9b'), 'c');
}, 'Parse \uD83D\uDCA9'); // Unicode Character 'PILE OF POO' (U+1F4A9)
test(function() {
var params = new URLSearchParams('a=b%f0%9f%92%a9c');
assert_equals(params.get('a'), 'b\uD83D\uDCA9c');
params = new URLSearchParams('a%f0%9f%92%a9b=c');
assert_equals(params.get('a\uD83D\uDCA9b'), 'c');
}, 'Parse %f0%9f%92%a9'); // Unicode Character 'PILE OF POO' (U+1F4A9)
</script>
</head>
</html>

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

@ -0,0 +1,42 @@
<!doctype html>
<html>
<head>
<meta charset="utf8">
<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-delete">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-extras.js"></script>
<script>
test(function() {
var params = new URLSearchParams('a=b&c=d');
params.delete('a');
assert_equals(params + '', 'c=d');
params = new URLSearchParams('a=a&b=b&a=a&c=c');
params.delete('a');
assert_equals(params + '', 'b=b&c=c');
params = new URLSearchParams('a=a&=&b=b&c=c');
params.delete('');
assert_equals(params + '', 'a=a&b=b&c=c');
params = new URLSearchParams('a=a&null=null&b=b');
params.delete(null);
assert_equals(params + '', 'a=a&b=b');
params = new URLSearchParams('a=a&undefined=undefined&b=b');
params.delete(undefined);
assert_equals(params + '', 'a=a&b=b');
}, 'Delete basics');
test(function() {
var params = new URLSearchParams();
params.append('first', 1);
assert_true(params.has('first'), 'Search params object has name "first"');
assert_equals(params.get('first'), '1', 'Search params object has name "first" with value "1"');
params.delete('first');
assert_false(params.has('first'), 'Search params object has no "first" name');
params.append('first', 1);
params.append('first', 10);
params.delete('first');
assert_false(params.has('first'), 'Search params object has no "first" name');
}, 'Deleting appended multiple');
</script>
</head>
</html>

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

@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset="utf8">
<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-get">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-extras.js"></script>
<script>
test(function() {
var params = new URLSearchParams('a=b&c=d');
assert_equals(params.get('a'), 'b');
assert_equals(params.get('c'), 'd');
assert_equals(params.get('e'), null);
params = new URLSearchParams('a=b&c=d&a=e');
assert_equals(params.get('a'), 'b');
params = new URLSearchParams('=b&c=d');
assert_equals(params.get(''), 'b');
params = new URLSearchParams('a=&c=d&a=e');
assert_equals(params.get('a'), '');
}, 'Get basics');
test(function() {
var params = new URLSearchParams('first=second&third&&');
assert_true(params != null, 'constructor returned non-null value.');
assert_true(params.has('first'), 'Search params object has name "first"');
assert_equals(params.get('first'), 'second', 'Search params object has name "first" with value "second"');
assert_equals(params.get('third'), '', 'Search params object has name "third" with the empty value.');
assert_equals(params.get('fourth'), null, 'Search params object has no "fourth" name and value.');
}, 'More get() basics');
</script>
</head>
</html>

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

@ -0,0 +1,37 @@
<!doctype html>
<html>
<head>
<meta charset="utf8">
<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-getAll">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-extras.js"></script>
<script>
test(function() {
var params = new URLSearchParams('a=b&c=d');
assert_array_equals(params.getAll('a'), ['b']);
assert_array_equals(params.getAll('c'), ['d']);
assert_array_equals(params.getAll('e'), []);
params = new URLSearchParams('a=b&c=d&a=e');
assert_array_equals(params.getAll('a'), ['b', 'e']);
params = new URLSearchParams('=b&c=d');
assert_array_equals(params.getAll(''), ['b']);
params = new URLSearchParams('a=&c=d&a=e');
assert_array_equals(params.getAll('a'), ['', 'e']);
}, 'getAll() basics');
test(function() {
var params = new URLSearchParams('a=1&a=2&a=3&a');
assert_true(params.has('a'), 'Search params object has name "a"');
var matches = params.getAll('a');
assert_true(matches && matches.length == 4, 'Search params object has values for name "a"');
assert_array_equals(matches, ['1', '2', '3', ''], 'Search params object has expected name "a" values');
params.set('a', 'one');
assert_equals(params.get('a'), 'one', 'Search params object has name "a" with value "one"');
var matches = params.getAll('a');
assert_true(matches && matches.length == 1, 'Search params object has values for name "a"');
assert_array_equals(matches, ['one'], 'Search params object has expected name "a" values');
}, 'getAll() multiples');
</script>
</head>
</html>

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

@ -0,0 +1,36 @@
<!doctype html>
<html>
<head>
<meta charset="utf8">
<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-has">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-extras.js"></script>
<script>
test(function() {
var params = new URLSearchParams('a=b&c=d');
assert_true(params.has('a'));
assert_true(params.has('c'));
assert_false(params.has('e'));
params = new URLSearchParams('a=b&c=d&a=e');
assert_true(params.has('a'));
params = new URLSearchParams('=b&c=d');
assert_true(params.has(''));
params = new URLSearchParams('null=a');
assert_true(params.has(null));
}, 'Has basics');
test(function() {
var params = new URLSearchParams('a=b&c=d&&');
params.append('first', 1);
params.append('first', 2);
assert_true(params.has('a'), 'Search params object has name "a"');
assert_true(params.has('c'), 'Search params object has name "c"');
assert_true(params.has('first'), 'Search params object has name "first"');
assert_false(params.has('d'), 'Search params object has no name "d"');
params.delete('first');
assert_false(params.has('first'), 'Search params object has no name "first"');
}, 'has() following delete()');
</script>
</head>
</html>

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

@ -0,0 +1,35 @@
<!doctype html>
<html>
<head>
<meta charset="utf8">
<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-set">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-extras.js"></script>
<script>
test(function() {
var params = new URLSearchParams('a=b&c=d');
params.set('a', 'B');
assert_equals(params + '', 'a=B&c=d');
params = new URLSearchParams('a=b&c=d&a=e');
params.set('a', 'B');
assert_equals(params + '', 'a=B&c=d')
params.set('e', 'f');
assert_equals(params + '', 'a=B&c=d&e=f')
}, 'Set basics');
test(function() {
var params = new URLSearchParams('a=1&a=2&a=3');
assert_true(params.has('a'), 'Search params object has name "a"');
assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"');
params.set('first', 4);
assert_true(params.has('a'), 'Search params object has name "a"');
assert_equals(params.get('a'), '1', 'Search params object has name "a" with value "1"');
params.set('a', 4);
assert_true(params.has('a'), 'Search params object has name "a"');
assert_equals(params.get('a'), '4', 'Search params object has name "a" with value "4"');
}, 'URLSearchParams.set');
</script>
</head>
</html>

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

@ -0,0 +1,123 @@
<!doctype html>
<html>
<head>
<meta charset="utf8">
<link rel="help" href="http://url.spec.whatwg.org/#dom-urlsearchparams-set">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-extras.js"></script>
<script>
test(function() {
var params = new URLSearchParams();
params.append('a', 'b c');
assert_equals(params + '', 'a=b+c');
params.delete('a');
params.append('a b', 'c');
assert_equals(params + '', 'a+b=c');
}, 'Serialize space');
test(function() {
var params = new URLSearchParams();
params.append('a', '');
assert_equals(params + '', 'a=');
params.append('a', '');
assert_equals(params + '', 'a=&a=');
params.append('', 'b');
assert_equals(params + '', 'a=&a=&=b');
params.append('', '');
assert_equals(params + '', 'a=&a=&=b&=');
params.append('', '');
assert_equals(params + '', 'a=&a=&=b&=&=');
}, 'Serialize empty value');
test(function() {
var params = new URLSearchParams();
params.append('', 'b');
assert_equals(params + '', '=b');
params.append('', 'b');
assert_equals(params + '', '=b&=b');
}, 'Serialize empty name');
test(function() {
var params = new URLSearchParams();
params.append('', '');
assert_equals(params + '', '=');
params.append('', '');
assert_equals(params + '', '=&=');
}, 'Serialize empty name and value');
test(function() {
var params = new URLSearchParams();
params.append('a', 'b+c');
assert_equals(params + '', 'a=b%2Bc');
params.delete('a');
params.append('a+b', 'c');
assert_equals(params + '', 'a%2Bb=c');
}, 'Serialize +');
test(function() {
var params = new URLSearchParams();
params.append('=', 'a');
assert_equals(params + '', '%3D=a');
params.append('b', '=');
assert_equals(params + '', '%3D=a&b=%3D');
}, 'Serialize =');
test(function() {
var params = new URLSearchParams();
params.append('&', 'a');
assert_equals(params + '', '%26=a');
params.append('b', '&');
assert_equals(params + '', '%26=a&b=%26');
}, 'Serialize &');
test(function() {
var params = new URLSearchParams();
params.append('a', '*-._');
assert_equals(params + '', 'a=*-._');
params.delete('a');
params.append('*-._', 'c');
assert_equals(params + '', '*-._=c');
}, 'Serialize *-._');
test(function() {
var params = new URLSearchParams();
params.append('a', 'b%c');
assert_equals(params + '', 'a=b%25c');
params.delete('a');
params.append('a%b', 'c');
assert_equals(params + '', 'a%25b=c');
}, 'Serialize %');
test(function() {
var params = new URLSearchParams();
params.append('a', 'b\0c');
assert_equals(params + '', 'a=b%00c');
params.delete('a');
params.append('a\0b', 'c');
assert_equals(params + '', 'a%00b=c');
}, 'Serialize \\0');
test(function() {
var params = new URLSearchParams();
params.append('a', 'b\uD83D\uDCA9c');
assert_equals(params + '', 'a=b%F0%9F%92%A9c');
params.delete('a');
params.append('a\uD83D\uDCA9b', 'c');
assert_equals(params + '', 'a%F0%9F%92%A9b=c');
}, 'Serialize \uD83D\uDCA9'); // Unicode Character 'PILE OF POO' (U+1F4A9)
test(function() {
var params;
params = new URLSearchParams('a=b&c=d&&e&&');
assert_equals(params.toString(), 'a=b&c=d&e=');
params = new URLSearchParams('a = b &a=b&c=d%20');
assert_equals(params.toString(), 'a+=+b+&a=b&c=d+');
// The lone '=' _does_ survive the roundtrip.
params = new URLSearchParams('a=&a=b');
assert_equals(params.toString(), 'a=&a=b');
}, 'URLSearchParams.toString');
</script>
</head>
</html>

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

@ -4,9 +4,14 @@
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
test(function() {
assert_throws("SECURITY_ERR", function() {
new Worker("ftp://example.org/support/WorkerBasic.js");
});
async_test(function(t) {
try {
var w = new Worker("ftp://example.org/support/WorkerBasic.js");
w.onerror = t.step_func_done(function(e) {
assert_true(e instanceof ErrorEvent);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
}
});
</script>

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

@ -12,35 +12,54 @@
// not propogate to the window before the tests finish
setup({allow_uncaught_exception: true});
function testSharedWorkerHelper(t, script) {
try {
var worker = new SharedWorker(script, '');
worker.onerror = t.step_func_done(function(e) {
assert_true(e instanceof ErrorEvent);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
}
}
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('unsupported:', ''); });
}, "unsupported_scheme");
async_test(function() {
var worker = new SharedWorker('data:,onconnect = function(e) { e.ports[0].postMessage(1); }', '');
worker.port.onmessage = this.step_func_done(function(e) {
assert_equals(e.data, 1);
});
}, "data_url");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('javascript:""', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'javascript:""');
}, "javascript_url");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('about:blank', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'about:blank');
}, "about_blank");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('http://www.opera.com/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'http://www.opera.com/');
}, "opera_com");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker(location.protocol+'//'+location.hostname+':81/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, location.protocol+'//'+location.hostname+':81/');
}, "port_81");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('https://'+location.hostname+':80/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'https://'+location.hostname+':80/');
}, "https_port_80");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('https://'+location.hostname+':8000/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'https://'+location.hostname+':8000/');
}, "https_port_8000");
test(function() {
assert_throws("SecurityError", function() { new SharedWorker('http://'+location.hostname+':8012/', ''); });
async_test(function(t) {
testSharedWorkerHelper(this, 'http://'+location.hostname+':8012/');
}, "http_port_8012");
</script>
<!--

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

@ -10,6 +10,17 @@
// not propogate to the window before the tests finish
setup({allow_uncaught_exception: true});
function testSharedWorkerHelper(t, script) {
try {
var worker = new SharedWorker(script, '');
worker.onerror = t.step_func_done(function(e) {
assert_true(e instanceof ErrorEvent);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
}
}
test(function() {
assert_throws("SecurityError", function() { new Worker('unsupported:'); });
}, "unsupported_scheme");
@ -21,31 +32,32 @@ async_test(function() {
});
}, "data_url");
test(function() {
assert_throws("SecurityError", function() { new Worker('about:blank'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'about:blank');
}, "about_blank");
test(function() {
assert_throws("SecurityError", function() { new Worker('http://www.example.invalid/'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'http://www.example.invalid/');
}, "example_invalid");
test(function() {
assert_throws("SecurityError", function() { new Worker(location.protocol+'//'+location.hostname+':81/'); });
async_test(function(t) {
testSharedWorkerHelper(t, location.protocol+'//'+location.hostname+':81/');
}, "port_81");
test(function() {
assert_throws("SecurityError", function() { new Worker('https://'+location.hostname+':80/'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'https://'+location.hostname+':80/');
}, "https_port_80");
test(function() {
assert_throws("SecurityError", function() { new Worker('https://'+location.hostname+':8000/'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'https://'+location.hostname+':8000/');
}, "https_port_8000");
test(function() {
assert_throws("SecurityError", function() { new Worker('http://'+location.hostname+':8012/'); });
async_test(function(t) {
testSharedWorkerHelper(t, 'http://'+location.hostname+':8012/');
}, "http_post_8012");
test(function() {
assert_throws("SecurityError", function() { new Worker('javascript:""'); });
async_test(function(t) {
testSharedWorkerHelper(t,'javascript:""');
}, "javascript_url");
</script>