Skip to content

Commit

Permalink
test: update WPT common and resources
Browse files Browse the repository at this point in the history
PR-URL: #39697
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
targos authored and danielleadams committed Aug 16, 2021
1 parent 69a2a6b commit 94381fb
Show file tree
Hide file tree
Showing 14 changed files with 1,655 additions and 1,325 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/wpt/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The 3-Clause BSD License

Copyright 2019 web-platform-tests contributors
Copyright © web-platform-tests contributors

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ See [test/wpt](../../wpt/README.md) for information on how these tests are run.

Last update:

- common: https://github.com/web-platform-tests/wpt/tree/bb97a68974/common
- common: https://github.com/web-platform-tests/wpt/tree/03c5072aff/common
- console: https://github.com/web-platform-tests/wpt/tree/3b1f72e99a/console
- dom/abort: https://github.com/web-platform-tests/wpt/tree/1728d198c9/dom/abort
- encoding: https://github.com/web-platform-tests/wpt/tree/35f70910d3/encoding
Expand All @@ -21,7 +21,7 @@ Last update:
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/5873f2d8f1/html/webappapis/timers
- interfaces: https://github.com/web-platform-tests/wpt/tree/fc086c82d5/interfaces
- performance-timeline: https://github.com/web-platform-tests/wpt/tree/17ebc3aea0/performance-timeline
- resources: https://github.com/web-platform-tests/wpt/tree/972ca5b669/resources
- resources: https://github.com/web-platform-tests/wpt/tree/fbee645164/resources
- streams: https://github.com/web-platform-tests/wpt/tree/8f60d94439/streams
- url: https://github.com/web-platform-tests/wpt/tree/77d54aa9e0/url
- user-timing: https://github.com/web-platform-tests/wpt/tree/df24fb604e/user-timing
Expand Down
Empty file.
1 change: 1 addition & 0 deletions test/fixtures/wpt/common/blank-with-cors.html.headers
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Access-Control-Allow-Origin: *
5 changes: 5 additions & 0 deletions test/fixtures/wpt/common/get-host-info.sub.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ function get_host_info() {
var HTTPS_PORT2 = '{{ports[https][1]}}';
var PROTOCOL = self.location.protocol;
var IS_HTTPS = (PROTOCOL == "https:");
var PORT = IS_HTTPS ? HTTPS_PORT : HTTP_PORT;
var PORT2 = IS_HTTPS ? HTTPS_PORT2 : HTTP_PORT2;
var HTTP_PORT_ELIDED = HTTP_PORT == "80" ? "" : (":" + HTTP_PORT);
var HTTP_PORT2_ELIDED = HTTP_PORT2 == "80" ? "" : (":" + HTTP_PORT2);
var HTTPS_PORT_ELIDED = HTTPS_PORT == "443" ? "" : (":" + HTTPS_PORT);
Expand All @@ -24,6 +26,8 @@ function get_host_info() {
HTTP_PORT2: HTTP_PORT2,
HTTPS_PORT: HTTPS_PORT,
HTTPS_PORT2: HTTPS_PORT2,
PORT: PORT,
PORT2: PORT2,
ORIGINAL_HOST: ORIGINAL_HOST,
REMOTE_HOST: REMOTE_HOST,

Expand All @@ -33,6 +37,7 @@ function get_host_info() {
HTTPS_ORIGIN_WITH_CREDS: 'https://foo:bar@' + ORIGINAL_HOST + HTTPS_PORT_ELIDED,
HTTP_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + ORIGINAL_HOST + HTTP_PORT2_ELIDED,
REMOTE_ORIGIN: PROTOCOL + "//" + REMOTE_HOST + PORT_ELIDED,
OTHER_ORIGIN: PROTOCOL + "//" + OTHER_HOST + PORT_ELIDED,
HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + HTTP_PORT_ELIDED,
HTTP_NOTSAMESITE_ORIGIN: 'http://' + NOTSAMESITE_HOST + HTTP_PORT_ELIDED,
HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + REMOTE_HOST + HTTP_PORT2_ELIDED,
Expand Down
9 changes: 7 additions & 2 deletions test/fixtures/wpt/common/sab.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
const createBuffer = (() => {
// See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`
const sabConstructor = new WebAssembly.Memory({ shared:true, initial:0, maximum:0 }).buffer.constructor;
let sabConstructor;
try {
sabConstructor = new WebAssembly.Memory({ shared:true, initial:0, maximum:0 }).buffer.constructor;
} catch(e) {
sabConstructor = null;
}
return (type, length) => {
if (type === "ArrayBuffer") {
return new ArrayBuffer(length);
} else if (type === "SharedArrayBuffer") {
if (sabConstructor.name !== "SharedArrayBuffer") {
if (sabConstructor && sabConstructor.name !== "SharedArrayBuffer") {
throw new Error("WebAssembly.Memory does not support shared:true");
}
return new sabConstructor(length);
Expand Down
12 changes: 12 additions & 0 deletions test/fixtures/wpt/common/window-name-setter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>A page that sets window.name</title>

<script>
"use strict";

window.onload = () => {
window.name = location.hash.slice(1); // Drop the first '#' character.
window.name = "spices";
};
</script>
6 changes: 6 additions & 0 deletions test/fixtures/wpt/resources/check-layout-th.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function checkDataKeys(node) {
"data-expected-scroll-width",
"data-expected-scroll-height",
"data-expected-bounding-client-rect-width",
"data-expected-bounding-client-rect-height",
"data-total-x",
"data-total-y",
"data-expected-display",
Expand Down Expand Up @@ -107,6 +108,11 @@ function checkExpectedValues(t, node, prefix)
assert_tolerance(node.getBoundingClientRect().width, expectedWidth, prefix + "getBoundingClientRect().width");
}

var expectedHeight = checkAttribute(output, node, "data-expected-bounding-client-rect-height");
if (expectedHeight) {
assert_tolerance(node.getBoundingClientRect().height, expectedHeight, prefix + "getBoundingClientRect().height");
}

var expectedOffset = checkAttribute(output, node, "data-total-x");
if (expectedOffset) {
var totalLeft = node.clientLeft + node.offsetLeft;
Expand Down
Loading

0 comments on commit 94381fb

Please sign in to comment.