Update web-platform-tests to revision 4f397167b4ed552a02201c92d363cfaecfe2c7f0

This commit is contained in:
WPT Sync Bot 2018-04-26 21:09:36 -04:00 committed by Anthony Ramine
parent 73b5bf201f
commit 84b40513c3
182 changed files with 4779 additions and 1937 deletions

View file

@ -13,7 +13,7 @@ policies and contribution forms [3].
/* Documentation: http://web-platform-tests.org/writing-tests/testharness-api.html
* (../docs/_writing-tests/testharness-api.md) */
(function ()
(function (global_scope)
{
var debug = false;
// default timeout is 10 seconds, test can override if needed
@ -48,9 +48,6 @@ policies and contribution forms [3].
*
* // Should return the test harness timeout duration in milliseconds.
* float test_timeout();
*
* // Should return the global scope object.
* object global_scope();
* };
*/
@ -248,10 +245,6 @@ policies and contribution forms [3].
return settings.harness_timeout.normal;
};
WindowTestEnvironment.prototype.global_scope = function() {
return window;
};
/*
* Base TestEnvironment implementation for a generic web worker.
*
@ -344,10 +337,6 @@ policies and contribution forms [3].
return null;
};
WorkerTestEnvironment.prototype.global_scope = function() {
return self;
};
/*
* Dedicated web workers.
* https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope
@ -463,23 +452,23 @@ policies and contribution forms [3].
};
function create_test_environment() {
if ('document' in self) {
if ('document' in global_scope) {
return new WindowTestEnvironment();
}
if ('DedicatedWorkerGlobalScope' in self &&
self instanceof DedicatedWorkerGlobalScope) {
if ('DedicatedWorkerGlobalScope' in global_scope &&
global_scope instanceof DedicatedWorkerGlobalScope) {
return new DedicatedWorkerTestEnvironment();
}
if ('SharedWorkerGlobalScope' in self &&
self instanceof SharedWorkerGlobalScope) {
if ('SharedWorkerGlobalScope' in global_scope &&
global_scope instanceof SharedWorkerGlobalScope) {
return new SharedWorkerTestEnvironment();
}
if ('ServiceWorkerGlobalScope' in self &&
self instanceof ServiceWorkerGlobalScope) {
if ('ServiceWorkerGlobalScope' in global_scope &&
global_scope instanceof ServiceWorkerGlobalScope) {
return new ServiceWorkerTestEnvironment();
}
if ('WorkerGlobalScope' in self &&
self instanceof WorkerGlobalScope) {
if ('WorkerGlobalScope' in global_scope &&
global_scope instanceof WorkerGlobalScope) {
return new DedicatedWorkerTestEnvironment();
}
@ -489,13 +478,13 @@ policies and contribution forms [3].
var test_environment = create_test_environment();
function is_shared_worker(worker) {
return 'SharedWorker' in self && worker instanceof SharedWorker;
return 'SharedWorker' in global_scope && worker instanceof SharedWorker;
}
function is_service_worker(worker) {
// The worker object may be from another execution context,
// so do not use instanceof here.
return 'ServiceWorker' in self &&
return 'ServiceWorker' in global_scope &&
Object.prototype.toString.call(worker) == '[object ServiceWorker]';
}
@ -2824,7 +2813,7 @@ policies and contribution forms [3].
function expose(object, name)
{
var components = name.split(".");
var target = test_environment.global_scope();
var target = global_scope;
for (var i = 0; i < components.length - 1; i++) {
if (!(components[i] in target)) {
target[components[i]] = {};
@ -2846,7 +2835,7 @@ policies and contribution forms [3].
/** Returns the 'src' URL of the first <script> tag in the page to include the file 'testharness.js'. */
function get_script_url()
{
if (!('document' in self)) {
if (!('document' in global_scope)) {
return undefined;
}
@ -2954,5 +2943,5 @@ policies and contribution forms [3].
test_environment.on_tests_ready();
})();
})(this);
// vim: set expandtab shiftwidth=4 tabstop=4: