зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1570600 [wpt PR 18228] - Rewrite self.html as an any.js test., a=testonly
Automatic update from web-platform-tests Rewrite self.html as an any.js test. Bonus: this adds coverage for shared and service workers. -- wpt-commits: 342de366ef12e8daded996654cc4b05f8883ff2d wpt-pr: 18228
This commit is contained in:
Родитель
ff697656b5
Коммит
0624cbc1ce
|
@ -0,0 +1,19 @@
|
||||||
|
// META: global=!default,worker
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
assert_equals(self, self);
|
||||||
|
}, 'self === self');
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
assert_true(self instanceof WorkerGlobalScope);
|
||||||
|
}, 'self instanceof WorkerGlobalScope');
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
assert_true('self' in self);
|
||||||
|
}, '\'self\' in self');
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
var x = self;
|
||||||
|
self = 1;
|
||||||
|
assert_equals(self, x);
|
||||||
|
}, 'self = 1');
|
|
@ -1,16 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<title>self</title>
|
|
||||||
<script src="/resources/testharness.js"></script>
|
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
|
||||||
<div id="log"></div>
|
|
||||||
<script>
|
|
||||||
async_test(function() {
|
|
||||||
var worker = new Worker('self.js');
|
|
||||||
worker.onmessage = this.step_func(function(e) {
|
|
||||||
for (var i = 0; i < e.data.length; ++i) {
|
|
||||||
assert_true(e.data[i][0], e.data[i][1]);
|
|
||||||
}
|
|
||||||
this.done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
|
@ -1,17 +0,0 @@
|
||||||
var results = [];
|
|
||||||
function check(func, msg) {
|
|
||||||
try {
|
|
||||||
results.push([func(), msg]);
|
|
||||||
} catch(ex) {
|
|
||||||
results.push([String(ex), msg]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
check(function() { return self === self; }, 'self === self');
|
|
||||||
check(function() { return self instanceof WorkerGlobalScope; }, 'self instanceof WorkerGlobalScope');
|
|
||||||
check(function() { return 'self' in self; }, '\'self\' in self');
|
|
||||||
check(function() {
|
|
||||||
var x = self;
|
|
||||||
self = 1;
|
|
||||||
return x === self;
|
|
||||||
}, 'self = 1');
|
|
||||||
postMessage(results);
|
|
Загрузка…
Ссылка в новой задаче