Update web-platform-tests to revision c792ea26624bde49b72afce348de07ab72fb9ad7

This commit is contained in:
WPT Sync Bot 2018-08-13 21:52:18 -04:00
parent e051c5880e
commit ca45711d07
178 changed files with 2163 additions and 1807 deletions

View file

@ -0,0 +1,16 @@
[canvas-createImageBitmap-resize.html]
[createImageBitmap from an ImageData with resize option.]
expected: FAIL
[createImageBitmap from a HTMLImageElement with resize option.]
expected: FAIL
[createImageBitmap from a HTMLCanvasElement with resize option.]
expected: FAIL
[createImageBitmap from an ImageBitmap with resize option.]
expected: FAIL
[createImageBitmap from a Blob with resize option.]
expected: FAIL

View file

@ -0,0 +1,4 @@
[canvas-createImageBitmap-video-resize.html]
[createImageBitmap(HTMLVideoElement) with resize option]
expected: FAIL

View file

@ -1,14 +1,10 @@
[url-in-tags-revoke.window.html]
expected: TIMEOUT
[Fetching a blob URL immediately before revoking it works in an iframe.]
expected: FAIL
[Fetching a blob URL immediately before revoking it works in an iframe navigation.]
expected: FAIL
[Fetching a blob URL immediately before revoking it works in <script> tags.]
expected: TIMEOUT
[Opening a blob URL in a new window immediately before revoking it works.]
expected: FAIL

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
[remove-only-one-bom.html]
[Should have removed only one BOM from frame 2]
expected: FAIL
[Should have removed only one BOM from frame 1]
expected: FAIL

View file

@ -3,7 +3,7 @@
disabled: iframe thread issue 5247
[single-byte-decoder.html?document]
expected: CRASH
expected: TIMEOUT
[single-byte-decoder.html?XMLHttpRequest]
expected: CRASH

View file

@ -0,0 +1,4 @@
[beforeunload-synchronous.html]
[beforeunload event is emitted synchronously]
expected: FAIL

View file

@ -1,5 +0,0 @@
[traverse_the_history_1.html]
type: testharness
[Multiple history traversals from the same task]
expected: FAIL

View file

@ -0,0 +1,4 @@
[traverse_the_history_5.html]
[Multiple history traversals, last would be aborted]
expected: FAIL

View file

@ -30,3 +30,6 @@
[Set HTTP URL frame location.protocol to data]
expected: FAIL
[Set HTTP URL frame location.protocol to x]
expected: FAIL

View file

@ -172,63 +172,3 @@
[XHTML img usemap="http://example.org/#garbage-before-hash-id"]
expected: FAIL
[XHTML img usemap="#percent-escape-id-%41"]
expected: FAIL
[XHTML img usemap="#different-CASE-id"]
expected: FAIL
[HTML (quirks) IMG usemap="#"]
expected: FAIL
[XHTML img usemap="hash-last#"]
expected: FAIL
[HTML (quirks) IMG usemap="no-hash-id"]
expected: FAIL
[HTML (quirks) IMG usemap="no-hash-name"]
expected: FAIL
[HTML (quirks) IMG usemap="#no-such-map"]
expected: FAIL
[HTML (quirks) IMG usemap="hash-last#"]
expected: FAIL
[XHTML img usemap="no-hash-id"]
expected: FAIL
[HTML (quirks) IMG usemap="#different-CASE-name"]
expected: FAIL
[XHTML img usemap="#no-such-map"]
expected: FAIL
[XHTML img usemap="#percent-escape-name-%41"]
expected: FAIL
[XHTML img usemap="#"]
expected: FAIL
[HTML (quirks) IMG usemap="#different-CASE-id"]
expected: FAIL
[XHTML img usemap="#different-CASE-name"]
expected: FAIL
[XHTML img usemap=""]
expected: FAIL
[HTML (quirks) IMG usemap=""]
expected: FAIL
[HTML (quirks) IMG usemap="#percent-escape-name-%41"]
expected: FAIL
[HTML (quirks) IMG usemap="#percent-escape-id-%41"]
expected: FAIL
[XHTML img usemap="no-hash-name"]
expected: FAIL

View file

@ -2,10 +2,13 @@
[request.formData() with input: a&b&c]
expected: FAIL
[request.formData() with input: &&&a=b&&&&c=d&]
[response.formData() with input: a&b&c]
expected: FAIL
[request.formData() with input: a=b&c=d]
[request.formData() with input: _charset_=windows-1252&test=%C2x]
expected: FAIL
[request.formData() with input: a=b&c=d&]
expected: FAIL
@ -16,21 +19,15 @@
[request.formData() with input: a&b&c]
expected: FAIL
[request.formData() with input: a=b&c=d]
expected: FAIL
[response.formData() with input: &&&a=b&&&&c=d&]
expected: FAIL
[response.formData() with input: a=b&c=d&]
expected: FAIL
[response.formData() with input: _charset_=windows-1252&test=%C2x]
expected: FAIL
[response.formData() with input: a=b&c=d]
expected: FAIL
[request.formData() with input: a=b&c=d&]
expected: FAIL
[request.formData() with input: &&&a=b&&&&c=d&]
expected: FAIL
[request.formData() with input: _charset_=windows-1252&test=%C2x]
expected: FAIL

View file

@ -1,5 +0,0 @@
[second-argument-null.html]
type: testharness
[Using null in postMessage's second argument]
expected: FAIL

View file

@ -1,5 +1,6 @@
[005.html]
type: testharness
expected: ERROR
[dedicated worker in shared worker in dedicated worker]
expected: FAIL

View file

@ -0,0 +1,5 @@
[complex-glsl-does-not-crash.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -0,0 +1,5 @@
[shader-uniform-packing-restrictions.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -0,0 +1,5 @@
[shader-with-non-reserved-words.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -0,0 +1,159 @@
<!DOCTYPE HTML>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
function checkNoCrop(imageBitmap)
{
var canvas = document.createElement("canvas");
canvas.width = 50;
canvas.height = 50;
var ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(imageBitmap, 0, 0);
var d = ctx.getImageData(0, 0, 1, 1).data;
assert_array_equals(d, [255, 0, 0, 255], "This pixel should be red.");
d = ctx.getImageData(39, 0, 1, 1).data;
assert_array_equals(d, [0, 255, 0, 255], "This pixel should be green.");
d = ctx.getImageData(0, 39, 1, 1).data;
assert_array_equals(d, [0, 0, 255, 255], "This pixel should be blue.");
d = ctx.getImageData(39, 39, 1, 1).data;
assert_array_equals(d, [0, 0, 0, 255], "This pixel should be black.");
d = ctx.getImageData(41, 41, 1, 1).data;
assert_array_equals(d, [0, 0, 0, 0], "This pixel should be transparent black.");
}
function checkCrop(imageBitmap)
{
var canvas = document.createElement("canvas");
canvas.width = 50;
canvas.height = 50;
var ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(imageBitmap, 0, 0);
var d = ctx.getImageData(0, 0, 1, 1).data;
assert_array_equals(d, [255, 0, 0, 255], "This pixel should be red.");
d = ctx.getImageData(19, 0, 1, 1).data;
assert_array_equals(d, [0, 255, 0, 255], "This pixel should be green.");
d = ctx.getImageData(0, 19, 1, 1).data;
assert_array_equals(d, [0, 0, 255, 255], "This pixel should be blue.");
d = ctx.getImageData(19, 19, 1, 1).data;
assert_array_equals(d, [0, 0, 0, 255], "This pixel should be black.");
d = ctx.getImageData(21, 21, 1, 1).data;
assert_array_equals(d, [0, 0, 0, 0], "This pixel should be transparent black.");
}
function compareBitmaps(bitmap1, bitmap2)
{
var canvas1 = document.createElement("canvas");
var canvas2 = document.createElement("canvas");
canvas1.width = 50;
canvas1.height = 50;
canvas2.width = 50;
canvas2.height = 50;
var ctx1 = canvas1.getContext("2d");
var ctx2 = canvas2.getContext("2d");
ctx1.clearRect(0, 0, canvas1.width, canvas1.height);
ctx2.clearRect(0, 0, canvas2.width, canvas2.height);
ctx1.drawImage(bitmap1, 0, 0);
ctx2.drawImage(bitmap2, 0, 0);
var data1 = ctx1.getImageData(0, 0, 50, 50).data;
var data2 = ctx2.getImageData(0, 0, 50, 50).data;
var dataMatched = true;
for (var i = 0; i < data1.length; i++) {
if (data1[i] != data2[i]) {
dataMatched = false;
break;
}
}
assert_false(dataMatched);
}
function testImageBitmap(source)
{
return Promise.all([
createImageBitmap(source, {resizeWidth: 40, resizeHeight: 40, resizeQuality: "high"}),
createImageBitmap(source, {resizeWidth: 40, resizeHeight: 40, resizeQuality: "medium"}),
createImageBitmap(source, {resizeWidth: 40, resizeHeight: 40, resizeQuality: "low"}),
createImageBitmap(source, {resizeWidth: 40, resizeHeight: 40, resizeQuality: "pixelated"}),
createImageBitmap(source, 5, 5, 10, 10, {resizeWidth: 20, resizeHeight: 20, resizeQuality: "high"}),
createImageBitmap(source, 5, 5, 10, 10, {resizeWidth: 20, resizeHeight: 20, resizeQuality: "medium"}),
createImageBitmap(source, 5, 5, 10, 10, {resizeWidth: 20, resizeHeight: 20, resizeQuality: "low"}),
createImageBitmap(source, 5, 5, 10, 10, {resizeWidth: 20, resizeHeight: 20, resizeQuality: "pixelated"}),
]).then(([noCropHigh, noCropMedium, noCropLow, noCropPixelated, cropHigh, cropMedium, cropLow, cropPixelated]) => {
checkNoCrop(noCropHigh);
checkNoCrop(noCropMedium);
checkNoCrop(noCropLow);
checkNoCrop(noCropPixelated);
checkCrop(cropHigh);
checkCrop(cropMedium);
checkCrop(cropLow);
checkCrop(cropPixelated);
// Brute-force comparison among all bitmaps is too expensive
compareBitmaps(noCropHigh, noCropMedium);
compareBitmaps(noCropLow, noCropPixelated);
compareBitmaps(cropHigh, cropMedium);
compareBitmaps(cropLow, cropPixelated);
});
}
function initializeTestCanvas()
{
var testCanvas = document.createElement("canvas");
testCanvas.width = 20;
testCanvas.height = 20;
var testCtx = testCanvas.getContext("2d");
testCtx.fillStyle = "rgb(255, 0, 0)";
testCtx.fillRect(0, 0, 10, 10);
testCtx.fillStyle = "rgb(0, 255, 0)";
testCtx.fillRect(10, 0, 10, 10);
testCtx.fillStyle = "rgb(0, 0, 255)";
testCtx.fillRect(0, 10, 10, 10);
testCtx.fillStyle = "rgb(0, 0, 0)";
testCtx.fillRect(10, 10, 10, 10);
return testCanvas;
}
// Blob
promise_test(function() {
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest();
xhr.open("GET", '/images/pattern.png');
xhr.responseType = 'blob';
xhr.send();
xhr.onload = function() {
resolve(xhr.response);
};
}).then(testImageBitmap);
}, 'createImageBitmap from a Blob with resize option.');
// HTMLCanvasElement
promise_test(function() {
var testCanvas = initializeTestCanvas();
return testImageBitmap(testCanvas);
}, 'createImageBitmap from a HTMLCanvasElement with resize option.');
// HTMLImageElement
promise_test(function() {
return new Promise((resolve, reject) => {
var image = new Image();
image.onload = function() {
resolve(image);
}
image.src = '/images/pattern.png'
}).then(testImageBitmap);
}, 'createImageBitmap from a HTMLImageElement with resize option.');
// ImageBitmap
promise_test(function() {
var testCanvas = initializeTestCanvas();
return createImageBitmap(testCanvas).then(testImageBitmap);
}, 'createImageBitmap from an ImageBitmap with resize option.');
// ImageData
promise_test(function() {
var canvas = initializeTestCanvas();
var ctx = canvas.getContext("2d");
var data = ctx.getImageData(0, 0, 20, 20);
return testImageBitmap(data);
}, 'createImageBitmap from an ImageData with resize option.');
</script>

View file

@ -0,0 +1,58 @@
<!DOCTYPE HTML>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
function createNewCanvas(width, height)
{
var canvas = document.createElement("canvas");
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, width, height);
return ctx;
}
function checkLowResult(imageBitmap, bw, bh, video, sx, sy, sw, sh)
{
var ctx1 = createNewCanvas(bw, bh);
var ctx2 = createNewCanvas(bw, bh);
ctx1.drawImage(imageBitmap, 0, 0);
ctx2.drawImage(video, sx, sy, sw, sh, 0, 0, bw, bh);
var data1 = ctx1.getImageData(0, 0, bw, bh).data;
var data2 = ctx2.getImageData(0, 0, bw, bh).data;
var dataMatched = true;
for (var i = 0; i < data1.length; i++) {
// data1[i] is strictly the same as data2[i] on software rendering.
// But on GPU, the difference could be quite significant.
if (Math.abs(data1[i] - data2[i]) > 18) {
dataMatched = false;
break;
}
}
assert_true(dataMatched);
}
function generateTest()
{
bitmapWidth = video.videoWidth/2;
bitmapHeight = video.videoHeight/2;
return Promise.all([
createImageBitmap(video, {resizeWidth: bitmapWidth, resizeHeight: bitmapHeight, resizeQuality: "low"}),
createImageBitmap(video, 10, 10, bitmapWidth, bitmapHeight, {resizeWidth: bitmapWidth, resizeHeight: bitmapHeight, resizeQuality: "low"}),
]).then(t.step_func_done(([noCropLow, cropLow]) => {
checkLowResult(noCropLow, bitmapWidth, bitmapHeight, video, 0, 0, video.videoWidth, video.videoHeight);
checkLowResult(cropLow, bitmapWidth, bitmapHeight, video, 10, 10, bitmapWidth, bitmapHeight);
}), t.step_func_done(function() {
assert_true(false, 'Promise rejected');
}));
}
var t = async_test('createImageBitmap(HTMLVideoElement) with resize option');
// HTMLVideoElement
var video = document.createElement("video");
video.oncanplaythrough = t.step_func(function() {
return generateTest();
});
video.src = "/media/video.ogv";
</script>

View file

@ -10,6 +10,5 @@ idl_test(
['service-workers', 'html', 'dom'],
idlArray => {
// TODO: Objects
},
'Background Sync interfaces.'
}
);

View file

@ -35,8 +35,7 @@
FileList: ['document.querySelector("#fileChooser").files'],
FileReader: ['new FileReader()']
});
},
'Test FileAPI IDL implementation'
}
);
</script>

View file

@ -16,7 +16,6 @@ idl_test(
FileReader: ['new FileReader()'],
FileReaderSync: ['new FileReaderSync()']
});
},
'Test FileAPI IDL implementation'
}
);
done();

View file

@ -20,6 +20,5 @@ idl_test(
IDBVersionChangeEvent: ['new IDBVersionChangeEvent("type")'],
DOMStringList: [],
});
},
'IndexedDB interfaces'
}
);

View file

@ -11,6 +11,5 @@ idl_test(
Crypto: ['crypto'],
SubtleCrypto: ['crypto.subtle']
});
},
'WebCryptoAPI interfaces'
}
);

View file

@ -14,6 +14,5 @@ idl_test(
LinearAccelerationSensor: ['new LinearAccelerationSensor();'],
GravitySensor: ['new GravitySensor();']
});
},
'Test IDL implementation of Accelerometer Sensor'
}
);

View file

@ -12,6 +12,5 @@ idl_test(
idl_array.add_objects({
AmbientLightSensor: ['new AmbientLightSensor()']
});
},
'Test IDL implementation of Ambient Light Sensor'
}
);

View file

@ -0,0 +1,17 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://wicg.github.io/animation-worklet/
idl_test(
['animation-worklet'],
['worklets', 'web-animations', 'html', 'cssom', 'dom'],
idl_array => {
idl_array.add_objects({
WorkletAnimation: ['new WorkletAnimation("name")'],
// TODO: WorkletGroupEffect
});
}
);

View file

@ -1,16 +0,0 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://wicg.github.io/animation-worklet/
promise_test(async () => {
const idl = await (await fetch('/interfaces/animation-worklet.idl')).text();
const html = await (await fetch('/interfaces/html.idl')).text();
const idlArray = new IdlArray();
idlArray.add_idls(idl);
idlArray.add_dependency_idls(html);
idlArray.test();
done();
}, 'Test driver');

View file

@ -13,6 +13,5 @@ idl_test(
Window: ['window'],
BeforeInstallPromptEvent: ['new BeforeInstallPromptEvent("type")'],
});
},
'appmanifest interfaces'
}
);

View file

@ -20,6 +20,5 @@ idl_test(
BackgroundFetchUpdateEvent: ['new BackgroundFetchUpdateEvent("type")'],
});
}
},
'background-fetch interfaces'
}
);

View file

@ -6,7 +6,7 @@
'use strict';
idl_test(
['battery'],
['battery-status'],
['dom', 'html'],
async idl_array => {
idl_array.add_objects({
@ -15,6 +15,5 @@ idl_test(
})
self.manager = await navigator.getBattery();
},
'Test IDL implementation of Battery Status API'
}
);

View file

@ -20,6 +20,5 @@ idl_test(
Bluetooth: ['navigator.bluetooth'],
BluetoothAdvertisingEvent: ['event'],
});
},
'web-bluetooth interfaces.'
}
);

View file

@ -12,6 +12,5 @@ idl_test(
idl_array.add_objects({
HTMLIFrameElement: ['document.createElement("iframe")'],
});
},
'csp-embedded-enforcement IDL'
}
);

View file

@ -14,6 +14,5 @@ idl_test(
'new SecurityPolicyViolationEvent("securitypolicyviolation")'
]
})
},
'Test Content Security Policy IDL implementation'
}
);

View file

@ -17,7 +17,6 @@ idl_test(
CookieStore: ['cookieStore'],
CookieChangeEvent: ['new CookieChangeEvent("change")'],
});
},
'Interface test'
}
);
</script>

View file

@ -39,8 +39,8 @@
CSSKeyframesRule: ['keyframes'],
CSSKeyframeRule: ['keyframes.cssRules[0]'],
});
},
'Test css-animations IDL implementation');
}
);
</script>
</body>

View file

@ -28,7 +28,6 @@
idl_array.add_objects({
CSSCounterStyleRule: ['counter'],
});
},
'css-counter-styles interfaces'
}
);
</script>

View file

@ -18,7 +18,6 @@ idl_test(
FontFaceSetLoadEvent: ['new FontFaceSetLoadEvent("type")'],
FontFaceSet: ['document.fonts'],
});
},
'css-font-loading interfaces'
}
);
</script>

View file

@ -13,7 +13,6 @@
['cssom'],
idl_array => {
// No objects,
},
'Test IDL implementation of css-masking'
}
);
</script>

View file

@ -17,8 +17,7 @@
SVGClipPathElement: [document.querySelector('#clip1')],
SVGMaskElement: [document.querySelector('#mask1')],
});
},
'Test IDL implementation of css-masking'
}
);
</script>

View file

@ -13,7 +13,6 @@
['cssom'],
idl_array => {
// No objects
},
'CSS-Parser-API interfaces'
}
);
</script>

View file

@ -13,16 +13,22 @@
// Properties are generated on demand, as `--prop-${g_counter}`.
let g_counter = 1;
// Generate a new property name.
function gen_name() {
let name = `--prop-${g_counter}`;
g_counter++;
return name;
}
// Generate a property and return its name.
function gen_prop(syntax, initialValue) {
let name = `--prop-${g_counter}`;
let name = gen_name();
CSS.registerProperty({
name: name,
syntax: syntax,
initialValue: initialValue,
inherits: false
});
g_counter++;
return name;
}
@ -50,6 +56,28 @@ function assert_computed_type(name, value, expected) {
}
}
function assert_attribute_get_type(syntax, value, expected) {
let name = gen_name();
target.style = `${name}: ${value}`;
assert_true(target.attributeStyleMap.get(name) instanceof CSSUnparsedValue);
CSS.registerProperty({
name: name,
syntax: syntax,
initialValue: value,
inherits: false
});
if (expected == CSSStyleValue) {
assert_false(target.attributeStyleMap.get(name) instanceof CSSUnparsedValue);
}
assert_true(target.attributeStyleMap.get(name) instanceof expected);
}
// computedStyleMap
test(function(){
let name = gen_prop('*', 'if(){}');
assert_true(target.computedStyleMap().get(name) instanceof CSSUnparsedValue);
@ -164,4 +192,110 @@ test(function(){
assert_true(target.computedStyleMap().getAll(name).every(x => x instanceof CSSUnitValue));
}, 'All computed values correctly reified in comma-separated list');
// attributeStyleMap.get
test(function(){
let name1 = gen_prop('<length>', '100px');
let name2 = gen_prop('<length>', '0px');
target.style = `${name2}: var(${name1})`;
assert_true(target.attributeStyleMap.get(name2) instanceof CSSUnparsedValue);
}, 'attributeStyleMap.get returns CSSUnparsedValue for value with var references');
test(function(){
let name1 = gen_prop('<length>', '100px');
let name2 = gen_prop('<length>#', '0px');
target.style = `${name2}: 1px, var(${name1}), 3px`;
assert_true(target.attributeStyleMap.get(name2) instanceof CSSUnparsedValue);
}, 'attributeStyleMap.get returns CSSUnparsedValue for value with var reference in list');
test(function(){
assert_attribute_get_type('*', 'if(){}', CSSUnparsedValue);
}, 'attributeStyleMap.get returns CSSUnparsedValue for *');
test(function(){
assert_attribute_get_type('<angle>', '42deg', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <angle>');
test(function(){
assert_attribute_get_type('<color>', '#fefefe', CSSStyleValue);
}, 'attributeStyleMap.get returns CSSStyleValue for <color>');
test(function(){
assert_attribute_get_type('<custom-ident>', 'none', CSSKeywordValue);
}, 'attributeStyleMap.get returns CSSKeywordValue for <custom-ident>');
test(function(){
assert_attribute_get_type('<image>', 'url(thing.png)', CSSImageValue);
}, 'attributeStyleMap.get returns CSSImageValue for <image>');
test(function(){
assert_attribute_get_type('<integer>', '100', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <integer>');
test(function(){
assert_attribute_get_type('<length-percentage>', '10%', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length-percentage> [10%]');
test(function(){
assert_attribute_get_type('<length-percentage>', '10px', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length-percentage> [10px]');
test(function(){
assert_attribute_get_type('<length-percentage>', 'calc(10px + 10%)', CSSMathSum);
}, 'attributeStyleMap.get returns CSSMathSum for <length-percentage> [calc(10px + 10%)]');
test(function(){
assert_attribute_get_type('<length>', '10px', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length>');
test(function(){
assert_attribute_get_type('<number>', '42', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <number>');
test(function(){
assert_attribute_get_type('<percentage>', '10%', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <percentage>');
test(function(){
assert_attribute_get_type('<resolution>', '300dpi', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <resolution>');
test(function(){
assert_attribute_get_type('<time>', '42s', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <time>');
test(function(){
assert_attribute_get_type('<url>', 'url(a)', CSSStyleValue);
}, 'attributeStyleMap.get returns CSSStyleValue for <url>');
test(function(){
assert_attribute_get_type('thing1 | THING2', 'thing1', CSSKeywordValue);
}, 'attributeStyleMap.get returns CSSKeywordValue for thing1 | THING2');
test(function(){
assert_attribute_get_type('<length>+', '10px 20px', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length>+');
test(function(){
assert_attribute_get_type('<length>#', '10px 20px', CSSUnitValue);
}, 'attributeStyleMap.get returns CSSUnitValue for <length>#');
// attributeStyleMap.getAll
test(function(){
let name = gen_prop('<length>+', '0px');
target.attributeStyleMap.clear();
target.attributeStyleMap.set(name, '10px 20px 30px');
assert_equals(target.attributeStyleMap.getAll(name).length, 3);
assert_true(target.attributeStyleMap.getAll(name).every(x => x instanceof CSSUnitValue));
}, 'attributeStyleMap.getAll returns a list of CSSUnitValues for <length>+');
test(function(){
let name = gen_prop('<length>#', '0px');
target.attributeStyleMap.clear();
target.attributeStyleMap.set(name, '10px, 20px, 30px');
assert_equals(target.attributeStyleMap.getAll(name).length, 3);
assert_true(target.attributeStyleMap.getAll(name).every(x => x instanceof CSSUnitValue));
}, 'attributeStyleMap.getAll returns a list of CSSUnitValues for <length>#');
</script>

View file

@ -22,6 +22,10 @@ div {
--registered-token-stream-1:var(--invalid);
--registered-token-stream-2:var(--invalid,fallback);
--token-stream-1:var(--registered-token-stream-1,moo);
--registered-length-list-1: 1px, var(--registered-length-1), 2px;
--registered-length-list-2: 1px, var(--length-1), var(--registered-length-1), 2px;
--registered-length-list-3: var(--registered-length-list-1), var(--registered-length-list-2);
}
</style>
<div id=element></div>
@ -58,4 +62,39 @@ test(function() {
assert_equals(computedStyle.getPropertyValue('--registered-token-stream-2'), 'fallback');
assert_equals(computedStyle.getPropertyValue('--token-stream-1'), 'moo');
}, "var() references work with registered properties");
test(function(){
CSS.registerProperty({
name: '--registered-length-list-1',
syntax: '<length>#',
initialValue: '0px',
inherits: false
});
let computedStyle = getComputedStyle(element);
assert_equals(computedStyle.getPropertyValue('--registered-length-list-1'), '1px, 10px, 2px');
}, 'References to registered var()-properties work in registered lists');
test(function(){
CSS.registerProperty({
name: '--registered-length-list-2',
syntax: '<length>#',
initialValue: '0px',
inherits: false
});
let computedStyle = getComputedStyle(element);
assert_equals(computedStyle.getPropertyValue('--registered-length-list-2'), '1px, 20px, 10px, 2px');
}, 'References to mixed registered and unregistered var()-properties work in registered lists');
test(function(){
CSS.registerProperty({
name: '--registered-length-list-3',
syntax: '<length>#',
initialValue: '0px',
inherits: false
});
let computedStyle = getComputedStyle(element);
assert_equals(computedStyle.getPropertyValue('--registered-length-list-3'), '1px, 10px, 2px, 1px, 20px, 10px, 2px');
}, 'Registered lists may be concatenated');
</script>

View file

@ -15,7 +15,6 @@
idl_array.add_objects({
Document: ['document'],
})
},
'css-regions interfaces'
}
);
</script>

View file

@ -19,7 +19,6 @@
HTMLElement: ['document'],
Window: ['window'],
})
},
'Test IDL implementation of css-transitions API'
}
);
</script>

View file

@ -72,7 +72,6 @@ idl_test(
CSSPerspective: ['perspective'],
CSSMatrixComponent: ['matrix'],
});
},
'CSS Typed OM IDL test'
}
);
</script>

View file

@ -40,7 +40,6 @@ idl_test(
});
await waitForLoad;
},
'cssom-view interfaces'
}
);
</script>

View file

@ -70,8 +70,7 @@ idl_test(
self.sheet = style_element.sheet;
self.svg_element = document.getElementById('svgElement');
self.xmlss_pi = document.getElementById('xmlssPiIframe').contentDocument.firstChild;
},
'Test driver'
}
);
</script>

View file

@ -10,6 +10,5 @@ idl_test(
['SVG', 'html', 'dom'],
idl_array => {
// TODO: objects
},
'Filter effects interfaces.'
}
);

View file

@ -15,5 +15,5 @@ idl_test(
Range: ['new Range()'],
XMLSerializer: ['new XMLSerializer()'],
})
},
'DOM-Parsing interfaces');
}
);

View file

@ -0,0 +1,20 @@
<!doctype html>
<meta charset=utf-8>
<title></title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
setup({explicit_done:true});
function runTests() {
for (var i = 0; i < window.frames.length; i++) {
test(function() {
assert_equals(window.frames[i].window.document.body.textContent, "\uFEFF");
}, "Should have removed only one BOM from frame " + i);
}
done();
}
</script>
<body onload="runTests()">
<iframe src="resources/two-boms-utf-8.html"></iframe>
<iframe src="resources/two-boms-utf-16le.html"></iframe>
<iframe src="resources/two-boms-utf-16be.html"></iframe>

View file

@ -0,0 +1 @@
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View file

@ -0,0 +1 @@
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>

View file

@ -0,0 +1 @@


View file

@ -16,6 +16,5 @@ idl_test(
} else if (self.GLOBAL.isWorker()) {
idl_array.add_objects({ WorkerGlobalScope: ['self'] });
}
},
'Fetch Standard IDL'
}
);

View file

@ -19,6 +19,5 @@ idl_test(
Document: ['document'],
});
}
},
'Test CORS RFC1918 interfaces'
}
);

View file

@ -32,7 +32,6 @@ idl_test(
t.step_timeout(() => { reject('Timed out waiting for gamepad'); }, 5000);
});
return Promise.race([gamepadConnected, timeout]);
},
'Test IDL implementation of Gamepad API'
}
);
</script>

View file

@ -13,6 +13,5 @@ idl_test(
GamepadEvent: ['new GamepadEvent("gamepad")'],
Navigator: ['navigator']
});
},
'Test IDL implementation of Gamepad API'
}
);

View file

@ -19,5 +19,5 @@ idl_test(
'new SensorErrorEvent("error", { error: new DOMException });'
],
});
},
'Test IDL implementation of Generic Sensor');
}
);

View file

@ -12,6 +12,5 @@ idl_test(
idl_array.add_objects({
GeolocationSensor: ['new GeolocationSensor'],
});
},
'Test IDL implementation of Geolocation Sensor'
}
);

View file

@ -12,6 +12,5 @@ idl_test(
idl_array.add_objects({
Gyroscope: ['new Gyroscope();']
});
},
'Test IDL implementation of Gyroscope Sensor'
}
);

View file

@ -14,5 +14,5 @@ idl_test(
});
self.input = document.createElement('input');
},
'html-media-capture interfaces.');
}
);

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>beforeunload event is emitted synchronously</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
'use strict';
// "navigate a browsing context" synchronously calls "prompt to unload", which
// synchronously calls "dispatch an event".
async_test(function(t) {
var iframe = document.createElement('iframe');
iframe.onload = t.step_func(function() {
var callCount = 0;
iframe.contentWindow.onbeforeunload = function() {
callCount += 1;
};
iframe.contentWindow.location.href = '/common/blank.html';
assert_equals(callCount, 1, 'invoked synchronously exactly once');
t.done();
});
document.body.appendChild(iframe);
});
</script>
</body>

View file

@ -0,0 +1,32 @@
<!doctype html>
<html>
<head>
<title>Auxiliary Browing Contexts: window.opener setter</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/PrefixedLocalStorage.js"></script>
</head>
<body>
<div id="log"></div>
<script>
var prefixedLocalStorage;
setup(() => prefixedLocalStorage = new PrefixedLocalStorageTest());
async_test(t => {
t.add_cleanup(() => prefixedLocalStorage.cleanup());
prefixedLocalStorage.onSet('openerIsNull', t.step_func_done(e => {
assert_equals(e.newValue, 'true');
}));
window.open(prefixedLocalStorage.url('resources/opener-setter.html'),
'iShouldSetOpenerToNull');
}, 'Auxiliary browsing context created via `window.open` and setting `window.opener` to `null` should report `window.opener` `null`');
async_test(t => {
t.add_cleanup(() => prefixedLocalStorage.cleanup());
prefixedLocalStorage.onSet('openerIsTest', t.step_func_done(e => {
assert_equals(e.newValue, 'true');
}));
window.open(prefixedLocalStorage.url('resources/opener-setter.html'),
'iShouldSetOpenerToTest');
}, 'Auxiliary browsing context created via `window.open` and setting `window.opener` to `test` should report `test`');
</script>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!doctype html>
<meta charset="utf-8">
<html>
<p>This window should set the window.opener attribute</p>
<script src="/common/PrefixedLocalStorage.js"></script>
<script>
var prefixedLocalStorage = new PrefixedLocalStorageResource({
close_on_cleanup: true
});
function checkOpener () {
if (window.name == 'iShouldSetOpenerToNull') {
window.opener = null;
return prefixedLocalStorage.setItem('openerIsNull', window.opener === null);
}
if (window.name == 'iShouldSetOpenerToTest') {
window.opener = 'test';
return prefixedLocalStorage.setItem('openerIsTest', window.opener === "test");
}
}
</script>
<body onload="checkOpener()">
</body>
</html>

View file

@ -28,6 +28,7 @@
display: none;
}
</style>
<script>var x;</script>
</head>
<body>
<div class="instructions"><p>Test passes if the two boxes below look exactly the same.</p></div>

View file

@ -29,6 +29,7 @@
display: none;
}
</style>
<script>var x;</script>
</head>
<body>
<div class="instructions"><p>Test passes if the two boxes below look exactly the same.</p></div>

View file

@ -216,8 +216,7 @@ idl_test(
});
idlArray.prevent_multiple_testing('HTMLElement');
await waitForLoad;
},
'html interfaces'
}
);
</script>

View file

@ -1,35 +1,31 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "CSS Animation Worklet API" spec.
// See: https://wicg.github.io/animation-worklet/
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: CSS Animation Worklet API (https://wicg.github.io/animation-worklet/)
partial interface Window {
partial namespace CSS {
[SameObject] readonly attribute Worklet animationWorklet;
};
callback VoidFunction = void ();
[ Exposed=AnimationWorklet, Global=AnimationWorklet ]
interface AnimationWorkletGlobalScope : WorkletGlobalScope {
void registerAnimator(DOMString name, VoidFunction animatorCtor);
};
[Constructor (DOMString animatorName,
optional (AnimationEffectReadOnly or sequence)? effects = null,
optional (AnimationEffect or sequence<AnimationEffect>)? effects = null,
optional AnimationTimeline? timeline,
optional any options)]
interface WorkletAnimation : Animation {
readonly attribute DOMString animatorName;
};
interface WorkletGroupEffectReadOnly : GroupEffectReadOnly {};
interface WorkletGroupEffect : WorkletGroupEffectReadOnly {};
WorkletGroupEffect implements AnimationEffectMutable;
WorkletGroupEffect implements GroupEffectMutable;
interface WorkletGroupEffect {
sequence<AnimationEffect> getChildren();
};
[Exposed=AnimationWorklet]
partial interface AnimationEffectReadOnly {
partial interface AnimationEffect {
// Intended for use inside Animation Worklet scope to drive the effect.
attribute double localTime;
};

View file

@ -1,7 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Payment Request API" spec.
// See: https://w3c.github.io/payment-request/
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: Payment Request API (https://w3c.github.io/payment-request/)
[Constructor(sequence<PaymentMethodData> methodData, PaymentDetailsInit details, optional PaymentOptions options),
SecureContext, Exposed=Window]
@ -167,6 +167,8 @@ interface PaymentResponse : EventTarget {
dictionary PaymentValidationErrors {
PayerErrorFields payer;
AddressErrors shippingAddress;
DOMString error;
object paymentMethod;
};
dictionary PayerErrorFields {

View file

@ -1,7 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Service Workers 1" spec.
// See: https://w3c.github.io/ServiceWorker/v1/
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: Service Workers 1 (https://w3c.github.io/ServiceWorker/v1/)
[SecureContext, Exposed=(Window,Worker)]
interface ServiceWorker : EventTarget {

View file

@ -1,7 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Web Speech API" spec.
// See: https://w3c.github.io/speech-api/
// Content was automatically extracted by Reffy into reffy-reports
// (https://github.com/tidoust/reffy-reports)
// Source: Web Speech API (https://w3c.github.io/speech-api/)
[Exposed=Window, Constructor]
interface SpeechRecognition : EventTarget {
@ -157,6 +157,7 @@ enum SpeechSynthesisErrorCode {
"voice-unavailable",
"text-too-long",
"invalid-argument",
"not-allowed",
};
[Exposed=Window]

View file

@ -97,12 +97,7 @@ dictionary XRFrameOfReferenceOptions {
};
[SecureContext, Exposed=Window] interface XRStageBounds {
readonly attribute FrozenArray<XRStageBoundsPoint> geometry;
};
[SecureContext, Exposed=Window] interface XRStageBoundsPoint {
readonly attribute double x;
readonly attribute double z;
readonly attribute FrozenArray<DOMPointReadOnly> geometry;
};
enum XREye {

View file

@ -19,7 +19,7 @@ test(function () {
assert_throws("SYNTAX_ERR", function() {
new IntersectionObserver(e => {}, {rootMargin: "1"})
})
}, 'IntersectionObserver constructor witth { rootMargin: "1" }');
}, 'IntersectionObserver constructor with { rootMargin: "1" }');
test(function () {
assert_throws("SYNTAX_ERR", function() {

View file

@ -13,6 +13,5 @@ idl_test(
Navigator: ['navigator'],
Keyboard: ['navigator.keyboard'],
});
},
'keyboard-lock interfaces'
}
);

View file

@ -16,6 +16,5 @@ idl_test(
});
self.layout_map = await navigator.keyboard.getLayoutMap();
},
'Test IDL implementation of Keyboard Map API'
}
);

View file

@ -13,6 +13,5 @@ idl_test(
Magnetometer: ['new Magnetometer();'],
UncalibratedMagnetometer: ['new UncalibratedMagnetometer();']
});
},
'Test IDL implementation of Magnetometer Sensor'
}
);

View file

@ -41,7 +41,6 @@ promise_test(async () => {
Screen: ['screen'],
ScreenLuminance: ['screen.luminance'],
});
},
'Test IDL implementation of Media Capabilities'
}
);
});

Binary file not shown.

View file

@ -28,6 +28,5 @@ idl_test(
HTMLCanvasElement: ['canvas'],
CanvasCaptureMediaStreamTrack: ['track'],
});
},
'Test mediacapture-fromelement IDL interfaces'
}
);

View file

@ -22,6 +22,5 @@ idl_test(
const track = canvas.captureStream().getVideoTracks()[0];
self.capture = new ImageCapture(track);
self.capabilities = await capture.getPhotoCapabilities();
},
'Test mediacapture-image IDL interfaces'
}
);

View file

@ -34,6 +34,5 @@ idl_test(
error = new MediaRecorderErrorEvent("type", {});
} catch(e) {}
idl_array.add_objects({ MediaRecorderErrorEvent: [error] });
},
'mediastream-recording interfaces'
}
);

View file

@ -14,6 +14,5 @@ idl_test(
MediaSession: ['navigator.mediaSession'],
Navigator: ['navigator']
});
},
'Test IDL implementation of Media Session'
}
);

View file

@ -17,6 +17,5 @@ idl_test(
'performance.getEntriesByType("navigation")[0]'
]
});
},
'navigation-timing interfaces'
}
);

View file

@ -15,5 +15,5 @@ idl_test(
} else {
idl_array.add_objects({ Navigator: ['navigator'] });
}
},
'netinfo interfaces.');
}
);

View file

@ -14,6 +14,5 @@ idl_test(
RelativeOrientationSensor: ['new RelativeOrientationSensor();']
});
idl_array.prevent_multiple_testing('OrientationSensor');
},
'Test IDL implementation of Orientation Sensor'
}
);

View file

@ -12,6 +12,5 @@ idl_test(
idl_array.add_objects({
Document: ['document'],
});
},
'page-visibility interfaces'
}
);

View file

@ -24,5 +24,5 @@ idl_test(
t.step_timeout(() => reject('Timed out waiting for paint event'), 3000);
});
return Promise.race([awaitPaint, timeout]);
},
'paint-timing interfaces.');
}
);

View file

@ -9,4 +9,4 @@ idl_test(
['payment-method-basic-card'],
[], // No deps
null, // No objects
'payment-method-basic-card interfaces.');
);

View file

@ -0,0 +1,50 @@
<!doctype html>
<meta charset="utf8">
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentvalidationerrors-error">
<title>
PaymentValidationErrors' `error` member
</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../payment-response/helpers.js"></script>
<script>
function retryShowsErrorMember(button) {
button.disabled = true;
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
await response.retry({ error: "PASS" });
await response.complete("success");
}, button.textContent.trim());
}
</script>
<h2>
Manual Test for PaymentValidationErrors's `error` member - Please run in order!
</h2>
<p>
Click on each button in sequence from top to bottom without refreshing the page.
Each button will bring up the Payment Request UI window.
</p>
<p>
When presented with the payment sheet, use any card and select to "Pay".
You will be asked to retry the payment and an error should be shown somewhere
in the UI. The expected error string is described in each individual test.
If you see the error, hit "Pay" again. If you don't see the error,
abort the payment request by hitting "esc" - which means that particular test
has failed.
</p>
<ol>
<li>
<button onclick="retryShowsErrorMember(this);">
The payment sheet shows the error "PASS" somewhere in the UI.
</button>
</li>
<li>
<button onclick="done();">
Done!
</button>
</li>
</ol>
<small>
If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
</small>

View file

@ -0,0 +1,65 @@
<!doctype html>
<meta charset="utf8">
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentvalidationerrors-payer">
<title>
PaymentValidationErrors' `payer` member
</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../payment-response/helpers.js"></script>
<script>
function retryShowsPayerMember(button, error) {
button.disabled = true;
promise_test(async t => {
const options = {
requestPayerName: true,
requestPayerEmail: true,
requestPayerPhone: true,
}
const { response } = await getPaymentRequestResponse(options);
await response.retry({ payer: error });
await response.complete("success");
}, button.textContent.trim());
}
</script>
<h2>
Manual Test for PaymentValidationErrors' `payer` member - Please run in order!
</h2>
<p>
Click on each button in sequence from top to bottom without refreshing the page.
Each button will bring up the Payment Request UI window.
</p>
<p>
When presented with the payment sheet, use any card and select to "Pay".
You will be asked to retry the payment and an error should be shown somewhere
in the UI. The expected error string is described in each individual test.
If you see the error, hit "Pay" again. If you don't see the error,
abort the payment request by hitting "esc" - which means that particular test
has failed.
</p>
<ol>
<li>
<button onclick="retryShowsPayerMember(this, { email: 'EMAIL ERROR' });">
The payment sheet shows "EMAIL ERROR" for the payer's email.
</button>
</li>
<li>
<button onclick="retryShowsPayerMember(this, { name: 'NAME ERROR' });">
The payment sheet shows "NAME ERROR" for the payer's name.
</button>
</li>
<li>
<button onclick="retryShowsPayerMember(this, { phone: 'PHONE ERROR' });">
The payment sheet shows "PHONE ERROR" for the payer's phone number.
</button>
</li>
<li>
<button onclick="done();">
Done!
</button>
</li>
</ol>
<small>
If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
</small>

View file

@ -0,0 +1,108 @@
<!doctype html>
<meta charset="utf8">
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentvalidationerrors-shippingaddress">
<title>
PaymentValidationErrors' `shippingAddress` member (AddressErrors)
</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../payment-response/helpers.js"></script>
<script>
function retryShowsShippingAddressMember(button, error) {
button.disabled = true;
promise_test(async t => {
const options = {
requestShipping: true,
}
const { response } = await getPaymentRequestResponse(options);
await response.retry({ shippingAddress: error });
await response.complete("success");
}, button.textContent.trim());
}
</script>
<h2>
Manual Test for PaymentValidationErrors' `shippingAddress` member - Please run in order!
</h2>
<p>
Click on each button in sequence from top to bottom without refreshing the page.
Each button will bring up the Payment Request UI window.
</p>
<p>
When presented with the payment sheet, use any card and select to "Pay".
You will be asked to retry the payment and an error should be shown somewhere
in the UI. The expected error string is described in each individual test.
If you see the error, hit "Pay" again. If you don't see the error,
abort the payment request by hitting "esc" - which means that particular test
has failed.
</p>
<ol>
<li>
<button onclick="retryShowsShippingAddressMember(this, { addressLine: 'ADDRESSLINE ERROR' });">
The payment sheet shows "ADDRESSLINE ERROR" for the shipping address' addressLine.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { city: 'CITY ERROR' });">
The payment sheet shows "CITY ERROR" for the shipping address' city.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { country: 'COUNTRY ERROR' });">
The payment sheet shows "COUNTRY ERROR" for the shipping address' country.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { dependentLocality: 'DEPENDENTLOCALITY ERROR' });">
The payment sheet shows "DEPENDENTLOCALITY ERROR" for the shipping address' dependentLocality.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { languageCode: 'LANGUAGECODE ERROR' });">
The payment sheet shows "LANGUAGECODE ERROR" for the shipping address' languageCode.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { organization: 'ORGANIZATION ERROR' });">
The payment sheet shows "ORGANIZATION ERROR" for the shipping address' organization.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { phone: 'PHONE ERROR' });">
The payment sheet shows "PHONE ERROR" for the shipping address' phone.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { postalCode: 'POSTALCODE ERROR' });">
The payment sheet shows "POSTALCODE ERROR" for the shipping address' postal code.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { recipient: 'RECIPIENT ERROR' });">
The payment sheet shows "RECIPIENT ERROR" for the shipping address' recipient.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { region: 'REGION ERROR' });">
The payment sheet shows "REGION ERROR" for the shipping address' region.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { regionCode: 'REGIONCODE ERROR' });">
The payment sheet shows "REGIONCODE ERROR" for the shipping address' region code.
</button>
</li>
<li>
<button onclick="retryShowsShippingAddressMember(this, { sortingCode: 'SORTINGCODE ERROR' });">
The payment sheet shows "SORTINGCODE ERROR" for the shipping address' sorting code.
</button>
</li>
<li>
<button onclick="done();">
Done!
</button>
</li>
</ol>
<small>
If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
</small>

View file

@ -26,6 +26,5 @@ idl_test(
PaymentMethodChangeEvent: ['new PaymentMethodChangeEvent("paymentmethodchange")'],
PaymentRequestUpdateEvent: ['new PaymentRequestUpdateEvent("paymentrequestupdate")'],
});
},
'Setup for Payment Request API IDL tests.'
}
);

View file

@ -0,0 +1,150 @@
<!DOCTYPE html>
<meta charset=utf-8>
<link rel="help" href="https://w3c.github.io/payment-request/#retry-method">
<title>PaymentResponse retry() rejects if doc is not fully active</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-retry">
<body>
<script>
setup({ explicit_done: true, explicit_timeout: true });
const validMethod = Object.freeze({
supportedMethods: "basic-card",
});
const validMethods = Object.freeze([validMethod]);
const validAmount = Object.freeze({
currency: "USD",
value: "5.00",
});
const validTotal = Object.freeze({
label: "Total due",
amount: validAmount,
});
const validDetails = Object.freeze({
total: validTotal,
});
function getLoadedPaymentResponse(iframe, url) {
return new Promise(resolve => {
iframe.addEventListener(
"load",
async () => {
const { PaymentRequest } = iframe.contentWindow;
const response = await new PaymentRequest(
validMethods,
validDetails
).show();
resolve(response);
},
{ once: true }
);
iframe.src = url;
});
}
function methodNotFullyActive(button, method, ...args) {
const text = button.textContent.trim();
promise_test(async t => {
const iframe = document.createElement("iframe");
iframe.allowPaymentRequest = true;
document.body.appendChild(iframe);
// We first got to page1.html, grab a PaymentResponse instance.
const response = await getLoadedPaymentResponse(
iframe,
"/payment-request/resources/page1.html"
);
// We navigate the iframe again, putting response's document into an inactive state.
await new Promise(resolve => {
iframe.addEventListener("load", resolve);
iframe.src = "/payment-request/resources/page2.html";
});
// Now, response's relevant global object's document is no longer active.
// So, promise needs to reject appropriately.
const promise = response[methodName](...args);
await promise_rejects(
t,
"AbortError",
promise,
"Inactive document, so must throw AbortError"
);
// We are done, so clean up.
iframe.remove();
}, text);
}
function methodBecomesNotFullyActive(button, methodName, ...args) {
const text = button.textContent.trim();
promise_test(async t => {
const iframe = document.createElement("iframe");
iframe.allowPaymentRequest = true;
document.body.appendChild(iframe);
// We first got to page1.html, grab a PaymentResponse instance.
const response = await getLoadedPaymentResponse(
iframe,
"/payment-request/resources/page1.html"
);
// we get the promise from page1.html, while it's active!
const promise = response[methodName](...args);
// We navigate the iframe again, putting response's document into an inactive state.
await new Promise(resolve => {
iframe.addEventListener("load", resolve);
iframe.src = "/payment-request/resources/page2.html";
});
// Now, response's relevant global object's document is no longer active.
// So, promise needs to reject appropriately.
await promise_rejects(
t,
"AbortError",
promise,
"Inactive document, so must throw AbortError"
);
// We are done, so clean up.
iframe.remove();
}, text);
}
</script>
<section>
<p>
For each test, when the payment sheet is shown, select a payment method and hit "Pay".
</p>
<h2>retry() and document active state</h2>
<p>Manual Tests for PaymentResponse.retry() - Please run in order!</p>
<ol>
<li>
<button onclick="methodNotFullyActive(this, 'retry', {});">
retry()'s retryPromise rejects if document is not fully active.
</button>
</li>
<li>
<button onclick="methodBecomesNotFullyActive(this, 'retry', {});">
retry()'s retryPromise rejects if the document becomes not fully active.
</button>
</li>
</ol>
<h2>complete() and document active state</h2>
<p>Manual Tests for PaymentResponse.complete() - Please run in order!</p>
<ol>
<li>
<button onclick="methodNotFullyActive(this, 'complete', 'success');">
complete()'s completePromise rejects if document is not fully active.
</button>
</li>
<li>
<button onclick="methodBecomesNotFullyActive(this, 'complete', 'success');">
complete()'s completePromise rejects if the document becomes not fully active.
</button>
</li>
<li>
<button onclick="done();">Done</button>
</li>
</ol>
</section>
<small>
If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
</small>

View file

@ -0,0 +1,262 @@
<!doctype html>
<meta charset="utf8">
<link rel="help" href="https://w3c.github.io/payment-request/#dom-paymentresponse-retry">
<title>
PaymentResponse.prototype.retry() method
</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="helpers.js"></script>
<script>
test(() => {
assert_true(
"retry" in PaymentResponse.prototype,
"retry must be in prototype"
);
assert_true(
PaymentResponse.prototype.retry instanceof Function,
"retry must be a function"
);
}, "PaymentResponse.prototype must have a retry() function (smoke test).");
function checkCompletedCantRetry(button) {
button.disabled = true;
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
// sets response.[[complete]] to true.
await response.complete("success");
return promise_rejects(
t,
"InvalidStateError",
response.retry({}),
"response.[[complete]] is true, so rejects with InvalidStateError."
);
}, button.textContent.trim());
}
function repeatedCallsToRetry(button) {
button.disabled = true;
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
const retryPromise = response.retry({});
await promise_rejects(
t,
"InvalidStateError",
response.retry({}),
"Calling retry() again rejects with an InvalidStateError"
);
await retryPromise;
await response.complete("success");
}, button.textContent.trim());
}
function callCompleteWhileRetrying(button) {
button.disabled = true;
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
const retryPromise = response.retry({});
await promise_rejects(
t,
"InvalidStateError",
response.complete("success"),
"Calling complete() while retrying rejects with an InvalidStateError"
);
await retryPromise;
await response.complete("success");
}, button.textContent.trim());
}
function callingRequestAbortMustNotAbort(button) {
button.disabled = true;
promise_test(async t => {
const { response, request } = await getPaymentRequestResponse();
const retryPromise = response.retry({});
await promise_rejects(
t,
"InvalidStateError",
request.abort(),
"Calling request.abort() while retrying rejects with an InvalidStateError"
);
await retryPromise;
await response.complete("success");
}, button.textContent.trim());
}
function canRetryMultipleTimes(button) {
button.disabled = true;
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
assert_equals(
await response.retry({}),
undefined,
"Expected undefined as the resolve value"
);
assert_equals(
await response.retry({}),
undefined,
"Expected undefined as the resolve value"
);
await response.complete("success");
await promise_rejects(
t,
"InvalidStateError",
response.retry({}),
"Calling retry() after complete() rejects with a InvalidStateError"
);
}, button.textContent.trim());
}
function userCanAbortARetry(button) {
button.disabled = true;
promise_test(async t => {
const { response } = await getPaymentRequestResponse();
await promise_rejects(
t,
"AbortError",
response.retry({}),
"The user aborting a retry rejects with a AbortError"
);
await promise_rejects(
t,
"InvalidStateError",
response.retry({}),
"After the user aborts, response [[complete]] is true so retry() must reject with InvalidStateError"
);
await promise_rejects(
t,
"InvalidStateError",
response.complete("success"),
"After the user aborts, response [[complete]] is true, so complete() rejects with a InvalidStateError"
);
}, button.textContent.trim());
}
function abortTheUpdate(button) {
button.disabled = true;
promise_test(async t => {
const { response, request } = await getPaymentRequestResponse();
// causes "abort the update" to run
const shippingChangedPromise = new Promise(resolve => {
request.onshippingoptionchange = () => {
event.updateWith({ total: { amount: { currency: "USD", value: "INVALID" } }});
resolve();
};
});
const retryPromise = response.retry({});
await shippingChangedPromise;
await promise_rejects(
t,
"TypeError",
retryPromise,
"retry() aborts with a TypeError, because totals' value is invalid"
);
await promise_rejects(
t,
"InvalidStateError",
response.complete("success"),
"After the user aborts, response [[complete]] is true, so complete() rejects with a InvalidStateError"
);
}, button.textContent.trim());
}
function callingRetryReturnsUniquePromise(button){
button.disabled = true;
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const retryPromise = request.retry();
const promises = new Set([
retryPromise,
request.retry(),
request.retry(),
]);
assert_equals(promises.size, 3, "Must have three unique objects");
await retryPromise;
await response.complete();
}, button.textContent.trim());
};
</script>
<h2>
Manual Tests for PaymentResponse.retry() - Please run in order!
</h2>
<p>
Click on each button in sequence from top to bottom without refreshing the page.
Each button will bring up the Payment Request UI window.
</p>
<p>
When presented with the payment sheet, use any credit card select to "Pay" multiple times.
</p>
<ol>
<li>
<button onclick="checkCompletedCantRetry(this);">
A completed payment request cannot be retried.
</button>
</li>
<li>
<button onclick="repeatedCallsToRetry(this);">
Calling retry() more than once yield a rejected promise, but the
retryPromise resolves independently.
</button>
</li>
<li>
<button onclick="callCompleteWhileRetrying(this);">
Calling complete() while a retry() is in progress results in an InvalidStateError.
</button>
</li>
<li>
<button onclick="callingRequestAbortMustNotAbort(this);">
Trying to abort() via PaymentRequest is not possible.
</button>
</li>
<li>
<button onclick="canRetryMultipleTimes(this);">
It's possible to retry() multiple times and eventually complete().
After complete(), however, retry() rejects with an InvalidStateError.
</button>
</li>
<li>
<p>
When shown the payment sheet, hit pay once, then abort retrying the payment.
</p>
<button onclick="userCanAbortARetry(this);">
The user aborting retrying a payment causes the retryPromise to reject with AbortError.
Aborting a payment is causes it complete.
</button>
</li>
<li>
<p>
When shown the payment sheet, hit pay once. Check payment sheet for error fields.
Then hit escape or otherwise abort the payment.
</p>
<button onclick="userIsShownErrorsFields(this);">
When retrying, the user is shown error fields to fix.
</button>
</li>
<li>
<p>
When shown the payment sheet, hit pay once. Then retry once.
</p>
<button onclick="abortTheUpdate(this);">
When "abort the update" occurs because of an update error,
the `retryPromise` is rejected and response.[[complete]] becomes true.
</button>
</li>
<li>
<p>
When shown the payment sheet, hit pay once. Then retry once.
</p>
<button onclick="callingRetryReturnsUniquePromise(this);">
Calling retry() multiple times is always a new object.
</button>
</li>
<li>
<button onclick="done();">
Done!
</button>
</li>
</ol>
<small>
If you find a buggy test, please <a href="https://github.com/w3c/web-platform-tests/issues">file a bug</a>
and tag one of the <a href="https://github.com/w3c/web-platform-tests/blob/master/payment-request/OWNERS">owners</a>.
</small>

View file

@ -37,8 +37,7 @@ promise_test(async t => {
PerformanceObserver: ['observer'],
PerformanceObserverEntryList: ['entryList'],
});
},
'Test IDL implementation of performance-timeline API'
}
);
};

View file

@ -21,6 +21,5 @@ idl_test(
self.video = await loadVideo();
self.pipw = await requestPictureInPictureWithTrustedClick(video);
},
'picture-in-picture interfaces.'
}
);

View file

@ -10,6 +10,5 @@ idl_test(
idl_array.add_objects({
PointerEvent: ['new PointerEvent("pointer")'],
})
},
'pointerevents extension interfaces'
}
);

View file

@ -15,6 +15,5 @@ idl_test(
Navigator: ['navigator'],
PointerEvent: ['new PointerEvent("type")']
});
},
'pointerevents interfaces'
}
);

View file

@ -14,5 +14,5 @@ idl_test(
Element: ["window.document.documentElement"],
MouseEvent: ["new MouseEvent('foo')"]
});
},
'pointerlock interfaces.');
}
);

Some files were not shown because too many files have changed in this diff Show more