mirror of
https://github.com/servo/servo.git
synced 2025-08-09 23:45:35 +01:00
Update web-platform-tests to revision be959408023fe02cf79abe70f6018598a7004a88
This commit is contained in:
parent
a76777b115
commit
761c8bc2a9
171 changed files with 2434 additions and 907 deletions
57
tests/wpt/web-platform-tests/resources/test/variants.js
Normal file
57
tests/wpt/web-platform-tests/resources/test/variants.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
var variants = {
|
||||
/**
|
||||
* Tests are executed in the absence of the global Promise constructor by
|
||||
* default in order to verify support for the Server browser engine.
|
||||
*
|
||||
* https://github.com/w3c/web-platform-tests/issues/6266
|
||||
*/
|
||||
'default': {
|
||||
description: 'Global Promise constructor removed.',
|
||||
apply: function() {
|
||||
delete window.Promise;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* This variant allows for testing functionality that is fundamentally
|
||||
* dependent on Promise support, e.g. the `promise_test` function
|
||||
*/
|
||||
'keep-promise': {
|
||||
description: 'No modification of global environment.',
|
||||
apply: function() {}
|
||||
}
|
||||
};
|
||||
var match = window.location.search.match(/\?(.*)$/);
|
||||
var variantName = (match && match[1]) || 'default';
|
||||
|
||||
if (!Object.hasOwnProperty.call(variants, variantName)) {
|
||||
window.location = 'javascript:"Unrecognized variant: ' + variantName + '";';
|
||||
document.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof test === 'function') {
|
||||
test(function() {
|
||||
assert_unreached('variants.js must be included before testharness.js');
|
||||
});
|
||||
}
|
||||
var variant = variants[variantName];
|
||||
|
||||
var variantNode = document.createElement('div');
|
||||
variantNode.innerHTML = '<p>This testharness.js test was executed with ' +
|
||||
'the variant named, "' + variantName + '". ' + variant.description +
|
||||
'</p><p>Refer to the test harness README file for more information.</p>';
|
||||
function onReady() {
|
||||
if (document.readyState !== 'complete') {
|
||||
return;
|
||||
}
|
||||
|
||||
document.body.insertBefore(variantNode, document.body.firstChild);
|
||||
}
|
||||
|
||||
onReady();
|
||||
document.addEventListener('readystatechange', onReady);
|
||||
|
||||
variant.apply();
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue