Auto merge of #21037 - servo-wpt-sync:wpt_update_11-06-2018, r=jdm

Sync WPT with upstream (11-06-2018)

Automated downstream sync of changes from upstream as of 11-06-2018.
[no-wpt-sync]

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21037)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-06-12 02:23:58 -04:00 committed by GitHub
commit fc3c558cbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
171 changed files with 2434 additions and 907 deletions

View file

@ -0,0 +1,4 @@
[2d.scrollPathIntoView.basic.html]
[scrollPathIntoView() works]
expected: FAIL

View file

@ -0,0 +1,4 @@
[2d.scrollPathIntoView.path.html]
[scrollPathIntoView() with path argument works]
expected: FAIL

View file

@ -0,0 +1,4 @@
[2d.scrollPathIntoView.verticalLR.html]
[scrollPathIntoView() works in vertical-lr writing mode]
expected: FAIL

View file

@ -0,0 +1,4 @@
[2d.scrollPathIntoView.verticalRL.html]
[scrollPathIntoView() works in vertical-rl writing mode]
expected: FAIL

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,6 @@
[window-name-after-cross-origin-main-frame-navigation.sub.html] [window-name-after-cross-origin-main-frame-navigation.sub.html]
type: testharness type: testharness
expected: ERROR expected: ERROR
[window.name should equal "" after a cross-origin main frame navigation]
expected: TIMEOUT

View file

@ -0,0 +1,4 @@
[scroll-position-vertical-rl.html]
[Fragment Navigation: Scroll to block start position in vertical-rl writing mode]
expected: FAIL

View file

@ -0,0 +1,7 @@
[document_domain.html]
[new Document()]
expected: FAIL
[XMLHttpRequest's response document]
expected: FAIL

View file

@ -0,0 +1,4 @@
[sandboxed-document_domain.html]
[Sandboxed document.domain]
expected: FAIL

View file

@ -32,3 +32,6 @@
[RegisterPtotocolHandler URL: unpaired surrogate codepoint should not make any exceptions.] [RegisterPtotocolHandler URL: unpaired surrogate codepoint should not make any exceptions.]
expected: FAIL expected: FAIL
[USVString test relate to url]
expected: FAIL

View file

@ -0,0 +1,5 @@
[rapid-resizing.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,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.scrollPathIntoView.basic</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.scrollPathIntoView.basic</h1>
<p class="desc">scrollPathIntoView() works</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("scrollPathIntoView() works");
_addTest(function(canvas, ctx) {
var div = document.createElement('div');
div.style.cssText = 'width: 200vw; height: 200vh';
document.body.appendChild(div);
canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;';
window.scrollTo(0, 0);
ctx.beginPath();
ctx.rect(4, 8, 16, 32);
ctx.scrollPathIntoView();
var rect = canvas.getBoundingClientRect();
_assertSame(Math.round(rect.top), -8, "Math.round(rect.top)", "-8");
_assertSame(Math.round(rect.left), 200, "Math.round(rect.left)", "200");
});
</script>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.scrollPathIntoView.path</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.scrollPathIntoView.path</h1>
<p class="desc">scrollPathIntoView() with path argument works</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("scrollPathIntoView() with path argument works");
_addTest(function(canvas, ctx) {
var div = document.createElement('div');
div.style.cssText = 'width: 200vw; height: 200vh';
document.body.appendChild(div);
canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;';
window.scrollTo(0, 0);
var path = new Path2D();
path.rect(4, 8, 16, 32);
ctx.scrollPathIntoView(path);
var rect = canvas.getBoundingClientRect();
_assertSame(Math.round(rect.top), -8, "Math.round(rect.top)", "-8");
_assertSame(Math.round(rect.left), 200, "Math.round(rect.left)", "200");
});
</script>

View file

@ -0,0 +1,39 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.scrollPathIntoView.verticalLR</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.scrollPathIntoView.verticalLR</h1>
<p class="desc">scrollPathIntoView() works in vertical-lr writing mode</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("scrollPathIntoView() works in vertical-lr writing mode");
_addTest(function(canvas, ctx) {
document.documentElement.style.cssText = 'writing-mode: vertical-lr';
var div = document.createElement('div');
div.style.cssText = 'width: 200vw; height: 200vh';
document.body.appendChild(div);
canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;';
window.scrollTo(0, 0);
ctx.beginPath();
ctx.rect(4, 8, 16, 32);
ctx.scrollPathIntoView();
var rect = canvas.getBoundingClientRect();
_assertSame(Math.round(rect.top), 100, "Math.round(rect.top)", "100");
_assertSame(Math.round(rect.left), -4, "Math.round(rect.left)", "-4");
});
</script>

View file

@ -0,0 +1,41 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.scrollPathIntoView.verticalRL</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.scrollPathIntoView.verticalRL</h1>
<p class="desc">scrollPathIntoView() works in vertical-rl writing mode</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("scrollPathIntoView() works in vertical-rl writing mode");
_addTest(function(canvas, ctx) {
document.documentElement.style.cssText = 'writing-mode: vertical-rl';
var div = document.createElement('div');
div.style.cssText = 'width: 200vw; height: 200vh';
document.body.appendChild(div);
canvas.style.cssText = 'position: absolute; top: 100px; right: 200px; border: none;';
window.scrollTo(0, 0);
ctx.beginPath();
ctx.rect(4, 8, 16, 32);
ctx.scrollPathIntoView();
var rect = canvas.getBoundingClientRect();
var viewportWidth = document.scrollingElement.clientWidth;
var canvasWidth = canvas.width;
_assertSame(Math.round(rect.top), 100, "Math.round(rect.top)", "100");
_assertSame(Math.round(rect.right), viewportWidth + (canvasWidth - 4 - 16), "Math.round(rect.right)", "viewportWidth + (canvasWidth - 4 - 16)");
});
</script>

View file

@ -32,6 +32,7 @@
2d.text.draw.space.collapse.space: "text-styles" 2d.text.draw.space.collapse.space: "text-styles"
2d.text.draw.space.collapse.start: "text-styles" 2d.text.draw.space.collapse.start: "text-styles"
2d.state: "the-canvas-state" 2d.state: "the-canvas-state"
2d.scrollPathIntoView: "scroll"
2d.canvas: "../html/semantics/embedded-content/the-canvas-element" 2d.canvas: "../html/semantics/embedded-content/the-canvas-element"
2d.getcontext: "../html/semantics/embedded-content/the-canvas-element" 2d.getcontext: "../html/semantics/embedded-content/the-canvas-element"
2d.scaled: "../html/semantics/embedded-content/the-canvas-element" 2d.scaled: "../html/semantics/embedded-content/the-canvas-element"

View file

@ -687,6 +687,9 @@ assertions:
- id: 2d.colorspace.img.noinfo - id: 2d.colorspace.img.noinfo
text: "Furthermore, the rendering of images that have no color correction information (such as those returned by the toDataURL() method) *must* be rendered with no color correction<^>." text: "Furthermore, the rendering of images that have no color correction information (such as those returned by the toDataURL() method) *must* be rendered with no color correction<^>."
- id: 2d.scrollPathIntoView.basic
text: "The scrollPathIntoView() method, when invoked, *must* run these steps<^>:"
- id: security.start - id: security.start
text: "All canvas elements *must* start with their origin-clean set to true<^>." text: "All canvas elements *must* start with their origin-clean set to true<^>."
- id: security.drawImage.image - id: security.drawImage.image

View file

@ -10153,3 +10153,79 @@
ctx.fill(); ctx.fill();
@assert pixel 50,25 ==~ 0,255,0,255; @assert pixel 50,25 ==~ 0,255,0,255;
expected: green expected: green
- name: 2d.scrollPathIntoView.basic
desc: scrollPathIntoView() works
testing:
- 2d.scrollPathIntoView.basic
code: |
var div = document.createElement('div');
div.style.cssText = 'width: 200vw; height: 200vh';
document.body.appendChild(div);
canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;';
window.scrollTo(0, 0);
ctx.beginPath();
ctx.rect(4, 8, 16, 32);
ctx.scrollPathIntoView();
var rect = canvas.getBoundingClientRect();
@assert Math.round(rect.top) === -8;
@assert Math.round(rect.left) === 200;
- name: 2d.scrollPathIntoView.verticalLR
desc: scrollPathIntoView() works in vertical-lr writing mode
testing:
- 2d.scrollPathIntoView.basic
code: |
document.documentElement.style.cssText = 'writing-mode: vertical-lr';
var div = document.createElement('div');
div.style.cssText = 'width: 200vw; height: 200vh';
document.body.appendChild(div);
canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;';
window.scrollTo(0, 0);
ctx.beginPath();
ctx.rect(4, 8, 16, 32);
ctx.scrollPathIntoView();
var rect = canvas.getBoundingClientRect();
@assert Math.round(rect.top) === 100;
@assert Math.round(rect.left) === -4;
- name: 2d.scrollPathIntoView.verticalRL
desc: scrollPathIntoView() works in vertical-rl writing mode
testing:
- 2d.scrollPathIntoView.basic
code: |
document.documentElement.style.cssText = 'writing-mode: vertical-rl';
var div = document.createElement('div');
div.style.cssText = 'width: 200vw; height: 200vh';
document.body.appendChild(div);
canvas.style.cssText = 'position: absolute; top: 100px; right: 200px; border: none;';
window.scrollTo(0, 0);
ctx.beginPath();
ctx.rect(4, 8, 16, 32);
ctx.scrollPathIntoView();
var rect = canvas.getBoundingClientRect();
var viewportWidth = document.scrollingElement.clientWidth;
var canvasWidth = canvas.width;
@assert Math.round(rect.top) === 100;
@assert Math.round(rect.right) === viewportWidth + (canvasWidth - 4 - 16);
- name: 2d.scrollPathIntoView.path
desc: scrollPathIntoView() with path argument works
testing:
- 2d.scrollPathIntoView.basic
code: |
var div = document.createElement('div');
div.style.cssText = 'width: 200vw; height: 200vh';
document.body.appendChild(div);
canvas.style.cssText = 'position: absolute; top: 100px; left: 200px; border: none;';
window.scrollTo(0, 0);
var path = new Path2D();
path.rect(4, 8, 16, 32);
ctx.scrollPathIntoView(path);
var rect = canvas.getBoundingClientRect();
@assert Math.round(rect.top) === -8;
@assert Math.round(rect.left) === 200;

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Accelerometer iframe test</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/accelerometer/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/generic-sensor/generic-sensor-tests.js"></script>
<script src="/generic-sensor/generic-sensor-iframe-tests.sub.js"></script>
<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
<div id="log"></div>
<script>
run_generic_sensor_iframe_tests('Accelerometer');
run_generic_sensor_iframe_tests('LinearAccelerationSensor');
run_generic_sensor_iframe_tests('GravitySensor');
</script>

View file

@ -11,14 +11,9 @@ promise_test(async () => {
const idl = await fetch('/interfaces/budget-api.idl').then(r => r.text()); const idl = await fetch('/interfaces/budget-api.idl').then(r => r.text());
const idlArray = new IdlArray(); const idlArray = new IdlArray();
idlArray.add_untested_idls(html, { only: [
'Navigator',
'NavigatorContentUtils',
'NavigatorCookies',
'NavigatorPlugins',
] });
idlArray.add_untested_idls(workers);
idlArray.add_idls(idl); idlArray.add_idls(idl);
idlArray.add_dependency_idls(html);
idlArray.add_dependency_idls(workers);
idlArray.test(); idlArray.test();
done(); done();
}, 'budget-api interfaces.'); }, 'budget-api interfaces.');

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<p>The yellow box should be in the top right corner of the hotpink box.</p>
<div style="width:30em; height:30em; background:hotpink;">
<div style="float:right; writing-mode:vertical-rl; background:yellow;">
<div style="visibility:hidden;">
Roses are red,<br>
violets are blue.<br>
All my base<br>
are belong to you.<br>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<title>Two levels of writing mode roots with text inside, fixed available inline size for inner on outer</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<div style="width:10em; border:solid; background:yellow;">
<div style="padding:3px;">
This text should be inside a box with a yellow background and a black border. There should be no red.
</div>
</div>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Two levels of writing mode roots with text inside, percentage inline size on inner</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<p>There should be three lines below. The middle line should have a yellow
background that takes up about 50% of the viewport width (but otherwise be
exactly like the two others, i.e. no extra height or anything like that).</p>
A B C D E F G
<div style="width:50vw; background:yellow;">
A B C D E F G
</div>
A B C D E F G

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>Two levels of writing mode roots with text inside, no constraints</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-sizing-3/#intrinsic" title="4. Intrinsic Size Determination">
<link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#orthogonal-auto" title="7.3.1. Available Space in Orthogonal Flows">
<p>There should be three lines below. The middle line should have a
yellow background (but otherwise be exactly like the two others,
i.e. no extra height or anything like that)</p>
A B C D E F G
<div style="width:fit-content; background:yellow;">
A B C D E F G
</div>
A B C D E F G

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<title>Three levels of writing mode roots with text inside, no constraints</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-sizing-3/#intrinsic" title="4. Intrinsic Size Determination">
<link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#orthogonal-auto" title="7.3.1. Available Space in Orthogonal Flows">
<link rel="match" href="reference/three-levels-of-orthogonal-flows.html">
<p>The yellow box should be in the top right corner of the hotpink box.</p>
<div style="writing-mode:vertical-rl; width:30em; height:30em; background:hotpink;">
<div style="writing-mode:horizontal-tb;">
<div style="writing-mode:vertical-rl; background:yellow;">
<div style="visibility:hidden;">
Roses are red,<br>
violets are blue.<br>
All my base<br>
are belong to you.<br>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<title>Two levels of writing mode roots with text inside, fixed available inline size for inner on outer</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-sizing-3/#intrinsic" title="4. Intrinsic Size Determination">
<link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#orthogonal-auto" title="7.3.1. Available Space in Orthogonal Flows">
<link rel="match" href="reference/two-levels-of-orthogonal-flows-fixed.html">
<div style="writing-mode:vertical-rl; width:10em; border:solid; background:red;">
<div style="writing-mode:horizontal-tb; padding:3px; background:yellow;">
This text should be inside a box with a yellow background and a black border. There should be no red.
</div>
</div>

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<title>Two levels of writing mode roots with text inside, percentage inline size on inner</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-sizing-3/#intrinsic" title="4. Intrinsic Size Determination">
<link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#orthogonal-auto" title="7.3.1. Available Space in Orthogonal Flows">
<link rel="match" href="reference/two-levels-of-orthogonal-flows-percentage.html">
<p>There should be three lines below. The middle line should have a yellow
background that takes up about 50% of the viewport width (but otherwise be
exactly like the two others, i.e. no extra height or anything like that).</p>
A B C D E F G
<div style="writing-mode:vertical-rl; background:yellow;">
<div style="writing-mode:horizontal-tb; width:50%;">
A B C D E F G
</div>
</div>
A B C D E F G

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<title>Two levels of writing mode roots with text inside, no constraints</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-sizing-3/#intrinsic" title="4. Intrinsic Size Determination">
<link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#orthogonal-auto" title="7.3.1. Available Space in Orthogonal Flows">
<link rel="match" href="reference/two-levels-of-orthogonal-flows.html">
<p>There should be three lines below. The middle line should have a
yellow background (but otherwise be exactly like the two others,
i.e. no extra height or anything like that)</p>
A B C D E F G
<div style="writing-mode:vertical-rl; background:yellow;">
<div style="writing-mode:horizontal-tb;">
A B C D E F G
</div>
</div>
A B C D E F G

View file

@ -6,7 +6,7 @@
[% END %] [% END %]
<dt>Test Coordinator:</dt> <dt>Test Coordinator:</dt>
<dd>[% suites.$suite.owner %]</dd> <dd>[% suites.$suite.owner %]</dd>
<p>This is a <strong>[% statusNames.${suites.$suite.status}.title or "ERROR: $suite" %]</strong> <p>This is a <strong>[% statusNames.${suites.$suite.status}.title or "ERROR: $suite" %]</strong>
version of the [% suites.$suite.title %].</p> version of the [% suites.$suite.title %].</p>
@ -15,7 +15,7 @@
<dt><a href="http://test.csswg.org/harness/suite/[% suites.$suite.harness %]">Enter Data</a></dt> <dt><a href="http://test.csswg.org/harness/suite/[% suites.$suite.harness %]">Enter Data</a></dt>
<dt><a href="http://test.csswg.org/harness/review/[% suites.$suite.harness %]">Review Results</a></dt> <dt><a href="http://test.csswg.org/harness/review/[% suites.$suite.harness %]">Review Results</a></dt>
[% END %] [% END %]
[% IF devel %] [% IF devel %]
<p>This build exists to aid in test suite development and contains unreviewed <p>This build exists to aid in test suite development and contains unreviewed
@ -42,9 +42,9 @@
The appropriate mailing list for submitting tests and bug reports is The appropriate mailing list for submitting tests and bug reports is
<a href="http://lists.w3.org/Archives/Public/public-css-testsuite/">public-css-testsuite@w3.org</a>.</p> <a href="http://lists.w3.org/Archives/Public/public-css-testsuite/">public-css-testsuite@w3.org</a>.</p>
<p> <p>
To report bugs or feedback about a specific test file, To report bugs or feedback about a specific test file,
search for the filename (without extension) in search for the filename (without extension) in
<a href="https://github.com/w3c/web-platform-tests/issues">Web Platform Tests Issues</a>, <a href="https://github.com/web-platform-tests/wpt/issues">web-platform-tests issues</a>,
and file a new issue if necessary with suggested label "wg-css". and file a new issue if necessary with suggested label "wg-css".
More information on the contribution process and test guidelines is More information on the contribution process and test guidelines is
available on the <a href="http://wiki.csswg.org/test">wiki available on the <a href="http://wiki.csswg.org/test">wiki
@ -88,7 +88,7 @@
features and/or error recovery.</dd> features and/or error recovery.</dd>
</dl> </dl>
[% END %] [% END %]
<p>Unless the test instructions explicitly indicate otherwise, <p>Unless the test instructions explicitly indicate otherwise,
any occurrence of red in a test indicates test failure.</p> any occurrence of red in a test indicates test failure.</p>

View file

@ -11,7 +11,7 @@
</title> </title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"> <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="http://www.w3.org/TR/css-flexbox-1/#abspos-items"> <link rel="help" href="http://www.w3.org/TR/css-flexbox-1/#abspos-items">
<link rel="match" href="flexbox-abspos-child-001-ref.html"> <link rel="match" href="flexbox-abspos-child-002-ref.html">
<style> <style>
.flex { .flex {
display: flex; display: flex;

View file

@ -17,6 +17,10 @@ const cross_origin_src =
"https://{{domains[www]}}:{{ports[https][0]}}" + same_origin_src; "https://{{domains[www]}}:{{ports[https][0]}}" + same_origin_src;
const base_src = "/feature-policy/resources/redirect-on-load.html#"; const base_src = "/feature-policy/resources/redirect-on-load.html#";
function get_feature_policies_for_sensor(sensorType) {
return feature_policies[sensorType];
}
function run_fp_tests_disabled(sensorName) { function run_fp_tests_disabled(sensorName) {
const sensorType = self[sensorName]; const sensorType = self[sensorName];
const featureNameList = feature_policies[sensorName]; const featureNameList = feature_policies[sensorName];

View file

@ -0,0 +1,122 @@
async function send_message_to_iframe(iframe, message, reply) {
if (reply === undefined) {
reply = 'success';
}
return new Promise((resolve, reject) => {
let messageHandler = e => {
if (e.data.command !== message.command) {
return;
}
window.removeEventListener('message', messageHandler);
if (e.data.result === reply) {
resolve();
} else {
reject();
}
}
window.addEventListener('message', messageHandler);
iframe.contentWindow.postMessage(message, '*');
});
}
function run_generic_sensor_iframe_tests(sensorName) {
const sensorType = self[sensorName];
const featurePolicies = get_feature_policies_for_sensor(sensorName);
sensor_test(async t => {
assert_true(sensorName in self);
const iframe = document.createElement('iframe');
iframe.allow = featurePolicies.join(';') + ';';
iframe.src = 'https://{{domains[www1]}}:{{ports[https][0]}}/generic-sensor/resources/iframe_sensor_handler.html';
// Create sensor inside cross-origin nested browsing context.
const iframeLoadWatcher = new EventWatcher(t, iframe, 'load');
document.body.appendChild(iframe);
await iframeLoadWatcher.wait_for('load');
await send_message_to_iframe(iframe, {command: 'create_sensor',
type: sensorName});
// Focus on the main frame and test that sensor recieves readings.
window.focus();
const sensor = new sensorType();
const sensorWatcher = new EventWatcher(t, sensor, ['reading']);
sensor.start();
await sensorWatcher.wait_for('reading');
const cachedTimeStamp = sensor.timestamp;
// Focus on the cross-origin frame and verify that sensor reading updates in
// the top level browsing context are suspended.
iframe.contentWindow.focus();
await send_message_to_iframe(iframe, {command: 'start_sensor'});
assert_equals(cachedTimeStamp, sensor.timestamp);
// Focus on the main frame, verify that sensor reading updates are resumed.
window.focus();
await sensorWatcher.wait_for('reading');
assert_greater_than(sensor.timestamp, cachedTimeStamp);
sensor.stop();
// Verify that sensor in cross-origin frame is suspended.
await send_message_to_iframe(iframe, {command: 'is_sensor_suspended'}, true);
await send_message_to_iframe(iframe, {command: 'reset_sensor_backend'});
// Remove iframe from main document.
iframe.parentNode.removeChild(iframe);
}, `${sensorName}: sensor is suspended and resumed when focus traverses from\
to cross-origin frame`);
sensor_test(async t => {
assert_true(sensorName in self);
const iframe = document.createElement('iframe');
iframe.allow = featurePolicies.join(';') + ';';
iframe.src = 'https://{{host}}:{{ports[https][0]}}/generic-sensor/resources/iframe_sensor_handler.html';
// Create sensor inside same-origin nested browsing context.
const iframeLoadWatcher = new EventWatcher(t, iframe, 'load');
document.body.appendChild(iframe);
await iframeLoadWatcher.wait_for('load');
await send_message_to_iframe(iframe, {command: 'create_sensor',
type: sensorName});
// Focus on main frame and test that sensor recieves readings.
window.focus();
const sensor = new sensorType();
const sensorWatcher = new EventWatcher(t, sensor, ['reading']);
sensor.start();
await sensorWatcher.wait_for('reading');
let cachedTimeStamp = sensor.timestamp;
// Stop sensor in main frame, so that sensorWatcher would not receive
// readings while sensor in iframe is started. Sensors that are active
// and belong to the same-origin context are not suspended, therefore,
// we might get unexpeted 'reading' event, thus, failing the test.
sensor.stop();
iframe.contentWindow.focus();
await send_message_to_iframe(iframe, {command: 'start_sensor'});
// Start sensor on main frame, verify that readings are updated.
window.focus();
sensor.start();
await sensorWatcher.wait_for('reading');
assert_greater_than(sensor.timestamp, cachedTimeStamp);
cachedTimeStamp = sensor.timestamp;
// Verify that sensor in nested browsing context is not suspended.
await send_message_to_iframe(iframe, {command: 'is_sensor_suspended'}, false);
// Verify that sensor in top level browsing context is receiving readings.
iframe.contentWindow.focus();
sensor.start();
await sensorWatcher.wait_for('reading');
assert_greater_than(sensor.timestamp, cachedTimeStamp);
sensor.stop();
await send_message_to_iframe(iframe, {command: 'reset_sensor_backend'});
// Remove iframe from main document.
iframe.parentNode.removeChild(iframe);
}, `${sensorName}: sensor is not suspended when focus traverses from\
to same-origin frame`);
}

View file

@ -33,14 +33,19 @@ let loadChromiumResources = Promise.resolve().then(() => {
return chain; return chain;
}); });
async function initialize_generic_sensor_tests() {
if (typeof GenericSensorTest === 'undefined') {
await loadChromiumResources;
}
assert_true(typeof GenericSensorTest !== 'undefined');
let sensorTest = new GenericSensorTest();
await sensorTest.initialize();
return sensorTest;
}
function sensor_test(func, name, properties) { function sensor_test(func, name, properties) {
promise_test(async (t) => { promise_test(async (t) => {
if (typeof GenericSensorTest === 'undefined') { let sensorTest = await initialize_generic_sensor_tests();
await loadChromiumResources;
}
assert_true(typeof GenericSensorTest !== 'undefined');
let sensorTest = new GenericSensorTest();
await sensorTest.initialize();
try { try {
await func(t); await func(t);
} finally { } finally {

View file

@ -0,0 +1,63 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>iframe sensor tester</title>
<script src="/resources/testharness.js"></script>
<script src="/generic-sensor/generic-sensor-tests.js"></script>
<script>
let mockBackend = null;
// Minimum frequency supported by the mock backend is 5Hz. Using 200ms
// update period + 50ms threshold.
const maxUpdatePeriod = 250;
let sensor = null;
let lastTimestamp = null;
window.onmessage = (e) => {
if (e.data.command === 'create_sensor') {
assert_equals(sensor, null);
initialize_generic_sensor_tests().then((backend) => {
mockBackend = backend;
try {
sensor = new self[e.data.type]();
e.source.postMessage({command: e.data.command,
result: 'success'}, '*');
} catch (e) {
e.source.postMessage({command: e.data.command, result: ''}, '*');
}
});
} else if (e.data.command === 'start_sensor') {
assert_not_equals(sensor, null);
try {
sensor.start();
sensor.onreading = () => lastTimestamp = sensor.timestamp;
let onReadingListener = () => {
e.source.postMessage({command: e.data.command,
result: 'success'}, '*');
}
sensor.addEventListener('reading', onReadingListener, {once: true});
} catch (e) {
e.source.postMessage({command: e.data.command, result: ''}, '*');
}
} else if (e.data.command === 'is_sensor_suspended') {
let cachedTimestamp = lastTimestamp;
let timeoutId = setTimeout(() => {
e.source.postMessage({command: e.data.command,
result: cachedTimestamp === lastTimestamp}, '*');
}, maxUpdatePeriod);
let suspendListener = () => {
clearTimeout(timeoutId);
e.source.postMessage({command: e.data.command,
result: cachedTimestamp === lastTimestamp}, '*');
}
sensor.addEventListener('reading', suspendListener, {once: true});
} else if (e.data.command === 'reset_sensor_backend') {
if (sensor) {
sensor.stop();
}
mockBackend.reset().then(() => {
e.source.postMessage({command: e.data.command,
result: 'success'}, '*');
});
}
}
</script>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Gyroscope iframe test</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/gyroscope/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/generic-sensor/generic-sensor-tests.js"></script>
<script src="/generic-sensor/generic-sensor-iframe-tests.sub.js"></script>
<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
<div id="log"></div>
<script>
run_generic_sensor_iframe_tests('Gyroscope');
</script>

View file

@ -0,0 +1,10 @@
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<script>
document.location = "window-name-navigation.sub.html?hostname={{domains[www1]}}&shouldhavename=false&sendmessage=true";
</script>
</body>
</html>

View file

@ -1,6 +1,7 @@
<script src='/resources/testharness.js'></script> <script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script> <script src='/resources/testharnessreport.js'></script>
<script> <script>
setup({explicit_done: true})
function process_test_result(passed, test_name) { function process_test_result(passed, test_name) {
if ({{GET[sendmessage]}}) { if ({{GET[sendmessage]}}) {
if (window.opener) { if (window.opener) {
@ -12,6 +13,7 @@
test(function(t) { test(function(t) {
assert_equals(passed, true); assert_equals(passed, true);
}, test_name); }, test_name);
done();
} }
} }

View file

@ -1,13 +1,24 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<!-- window.name should equal "" after a cross-origin main frame navigation. -->
<script src='/resources/testharness.js'></script> <script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script> <script src='/resources/testharnessreport.js'></script>
</head> </head>
<body> <body>
<button id="button" onclick="popup();">open popup</button>
<script> <script>
document.location = "support/window-name-navigation.sub.html?hostname={{domains[www1]}}&shouldhavename=false&sendmessage=false"; function popup() {
window.popupWin = window.open('support/window-name-after-cross-origin-main-frame-navigation-popup.sub.html', '_blank');
}
async_test(t => {
t.add_cleanup(() => {
popupWin.close();
})
document.getElementById('button').click();
onmessage = t.step_func(e => {
assert_true(e.data);
});
}, 'window.name should equal "" after a cross-origin main frame navigation');
</script> </script>
</body> </body>
</html> </html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html style="writing-mode: vertical-lr;">
<head>
<meta charset="UTF-8">
<title>Fragment Navigation: Scroll to block start position in vertical-lr writing mode</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="test" style="position: absolute; top: 5px; left: 7px; margin: 5px 7px; border-style: solid; border-width: 5px 7px; padding: 5px 7px; height: 5px; width: 7px;"></div>
<div style="width: 200vw;"></div>
<script>
async_test(function (t) {
on_event(window, 'load', function () {
t.step(function () {
window.scrollTo(0, 0);
location.hash = 'test';
assert_equals(window.scrollX, 14, 'Scroll to the left border edge of #test');
});
t.done();
});
}, '');
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html style="writing-mode: vertical-rl;">
<head>
<meta charset="UTF-8">
<title>Fragment Navigation: Scroll to block start position in vertical-rl writing mode</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="test" style="position: absolute; top: 5px; right: 7px; margin: 5px 7px; border-style: solid; border-width: 5px 7px; padding: 5px 7px; height: 5px; width: 7px;"></div>
<div style="width: 200vw;"></div>
<script>
async_test(function (t) {
on_event(window, 'load', function () {
t.step(function () {
window.scrollTo(0, 0);
location.hash = 'test';
assert_equals(window.scrollX, -14, 'Scroll to the right border edge of #test');
});
t.done();
});
}, '');
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Fragment Navigation: Scroll to block start position</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="test" style="position: absolute; top: 5px; left: 7px; margin: 5px 7px; border-style: solid; border-width: 5px 7px; padding: 5px 7px; height: 5px; width: 7px;"></div>
<div style="height: 200vh;"></div>
<script>
async_test(function (t) {
on_event(window, 'load', function () {
t.step(function () {
window.scrollTo(0, 0);
location.hash = 'test';
assert_equals(window.scrollY, 10, 'Scroll to the top border edge of #test');
});
t.done();
});
}, '');
</script>
</body>
</html>

View file

@ -13,16 +13,13 @@
clearTimeout(timer); clearTimeout(timer);
timer = setTimeout(t.step_func( timer = setTimeout(t.step_func(
function() { function() {
try { assert_array_equals(pages, [4, 2], "Pages opened during history navigation");
assert_array_equals(pages, [4, 2], "Pages opened during history navigation"); t.done();
t.done();
} finally {
// win.close();
}
} }
), 500); ), 500);
} }
); );
t.step(function() {win = window.open("history_entry.html&urls=history_entry.html,history_entry.html,traverse_the_history_1-1.html"); t.step(function() {win = window.open("history_entry.html?urls=history_entry.html,history_entry.html,traverse_the_history_1-1.html");
t.add_cleanup(() => { win.close() });
}); });
</script> </script>

View file

@ -1,14 +1,14 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<title></title> <title>document.domain's getter</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script> <script>
test(function() { test(function() {
assert_equals(typeof document.domain, "string", "document.domain is a string"); assert_equals(typeof document.domain, "string", "document.domain is a string");
assert_not_equals(document.domain, "", "document.domain is not empty"); assert_not_equals(document.domain, "", "document.domain is not empty");
}, "sanity checks"); }, "basics");
test(function() { test(function() {
assert_equals(document.domain, window.location.hostname, "equals location.hostname"); assert_equals(document.domain, window.location.hostname, "equals location.hostname");
@ -16,8 +16,18 @@
test(function() { test(function() {
var doc = new Document(); var doc = new Document();
assert_equals(doc.domain, "", "new document has empty domain"); assert_equals(doc.domain, window.location.hostname, "equals location.hostname");
}, "new document"); }, "new Document()");
async_test(t => {
const client = new XMLHttpRequest();
client.open("GET", "/common/blank.html");
client.responseType = "document"
client.send();
client.onload = t.step_func_done(() => {
assert_equals(client.response.domain, window.location.hostname);
});
}, "XMLHttpRequest's response document");
</script> </script>
</head> </head>
<body> <body>

View file

@ -1,7 +1,7 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<title></title> <title>document.domain's setter</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script> <script src="/common/get-host-info.sub.js"></script>
@ -18,12 +18,14 @@
var iframe_url = new URL("support/document_domain_setter_iframe.html", document.location); var iframe_url = new URL("support/document_domain_setter_iframe.html", document.location);
iframe_url.hostname = REMOTE_HOST; iframe_url.hostname = REMOTE_HOST;
iframe.src = iframe_url; iframe.src = iframe_url;
test(function() { test(function() {
assert_throws("SecurityError", function() { document.domain = SUFFIX_HOST; }); assert_throws("SecurityError", function() { document.domain = SUFFIX_HOST; });
assert_throws("SecurityError", function() { document.domain = "." + SUFFIX_HOST; }); assert_throws("SecurityError", function() { document.domain = "." + SUFFIX_HOST; });
assert_throws("SecurityError", function() { document.domain = REMOTE_HOST; }); assert_throws("SecurityError", function() { document.domain = REMOTE_HOST; });
assert_throws("SecurityError", function() { document.domain = "example.com"; }); assert_throws("SecurityError", function() { document.domain = "example.com"; });
}, "failed setting of document.domain"); }, "failed setting of document.domain");
async_test(function(t) { async_test(function(t) {
iframe.addEventListener("load", t.step_func_done(function() { iframe.addEventListener("load", t.step_func_done(function() {
// Before setting document.domain, the iframe is not // Before setting document.domain, the iframe is not
@ -62,6 +64,12 @@
assert_throws("SecurityError", function() { iframe.contentDocument.open(); }); assert_throws("SecurityError", function() { iframe.contentDocument.open(); });
})); }));
}, "same-origin-domain iframe"); }, "same-origin-domain iframe");
test(() => {
assert_throws("SecurityError", () => { (new Document).domain = document.domain });
assert_throws("SecurityError", () => { document.implementation.createHTMLDocument().domain = document.domain });
assert_throws("SecurityError", () => { document.implementation.createDocument(null, "").domain = document.domain });
}, "failed setting of document.domain for documents without browsing context");
</script> </script>
</body> </body>
</html> </html>

View file

@ -0,0 +1,21 @@
<!doctype html>
<title>Sandboxed document.domain</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
assert_throws("SecurityError", () => { document.domain = document.domain });
});
test(() => {
assert_throws("SecurityError", () => { (new Document).domain = document.domain });
});
test(() => {
assert_throws("SecurityError", () => { document.implementation.createHTMLDocument().domain = document.domain });
});
test(() => {
assert_throws("SecurityError", () => { document.implementation.createDocument(null, "").domain = document.domain });
});
test(() => {
assert_throws("SecurityError", () => { document.createElement("template").content.ownerDocument.domain = document.domain });
});
</script>

View file

@ -0,0 +1 @@
Content-Security-Policy: sandbox allow-scripts allow-same-origin

View file

@ -8,7 +8,7 @@
<script> <script>
async_test(function(t) { async_test(function(t) {
var img = document.getElementById("brokenurl"); var img = document.getElementById("brokenurl");
img.src = "http://also a broken url"; img.src = "http://[";
var errorevent = false; var errorevent = false;
// The errors should be queued in the event loop, so they should only trigger // The errors should be queued in the event loop, so they should only trigger
@ -17,7 +17,7 @@ async_test(function(t) {
img.addEventListener('loadend', t.step_func_done(function() { img.addEventListener('loadend', t.step_func_done(function() {
assert_true(errorevent, "error event fired"); assert_true(errorevent, "error event fired");
})); }));
}, 'src="http://also a broken url"'); }, 'src="http://["');
async_test(function(t) { async_test(function(t) {
var img = document.getElementById("emptysrc"); var img = document.getElementById("emptysrc");

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the Web Background Synchronization spec. // Content of this file was automatically extracted from the
// See https://wicg.github.io/BackgroundSync/spec/ // "Web Background Synchronization" spec.
// See: https://wicg.github.io/BackgroundSync/spec/
partial interface ServiceWorkerRegistration { partial interface ServiceWorkerRegistration {
readonly attribute SyncManager sync; readonly attribute SyncManager sync;

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Accelerometer" spec.
// See: https://w3c.github.io/accelerometer/
[Constructor(optional AccelerometerSensorOptions options), SecureContext, [Constructor(optional AccelerometerSensorOptions options), SecureContext,
Exposed=Window] Exposed=Window]
interface Accelerometer : Sensor { interface Accelerometer : Sensor {

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Ambient Light Sensor" spec.
// See: https://w3c.github.io/ambient-light/
[Constructor(optional SensorOptions sensorOptions), SecureContext, Exposed=Window] [Constructor(optional SensorOptions sensorOptions), SecureContext, Exposed=Window]
interface AmbientLightSensor : Sensor { interface AmbientLightSensor : Sensor {
readonly attribute double? illuminance; readonly attribute double? illuminance;

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the budget-api spec. // Content of this file was automatically extracted from the
// See https://wicg.github.io/budget-api/ // "Web Budget API" spec.
// See: https://wicg.github.io/budget-api/
[Exposed=Window] [Exposed=Window]
partial interface Navigator { partial interface Navigator {

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Clipboard API and events" spec.
// See: https://w3c.github.io/clipboard-apis/
dictionary ClipboardEventInit : EventInit { dictionary ClipboardEventInit : EventInit {
DataTransfer? clipboardData = null; DataTransfer? clipboardData = null;
}; };

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the compat spec. // Content of this file was automatically extracted from the
// See https://compat.spec.whatwg.org/ // "Compatibility Standard" spec.
// See: https://compat.spec.whatwg.org/
partial interface Window { partial interface Window {
readonly attribute short orientation; readonly attribute short orientation;

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "CSS Font Loading Module Level 3" spec.
// See: https://drafts.csswg.org/css-font-loading/
typedef (ArrayBuffer or ArrayBufferView) BinaryData; typedef (ArrayBuffer or ArrayBufferView) BinaryData;
dictionary FontFaceDescriptors { dictionary FontFaceDescriptors {

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the File and Directory Entries API spec. // Content of this file was automatically extracted from the
// See https://wicg.github.io/entries-api/ // "File and Directory Entries API" spec.
// See: https://wicg.github.io/entries-api/
partial interface File { partial interface File {
readonly attribute USVString webkitRelativePath; readonly attribute USVString webkitRelativePath;

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the Feature Policy spec. // Content of this file was automatically extracted from the
// See https://wicg.github.io/feature-policy/ // "Feature Policy" spec.
// See: https://wicg.github.io/feature-policy/
partial interface HTMLIFrameElement { partial interface HTMLIFrameElement {
[CEReactions] attribute DOMString allow; [CEReactions] attribute DOMString allow;

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Fetch Standard" spec.
// See: https://fetch.spec.whatwg.org/
typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit; typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit;
[Constructor(optional HeadersInit init), [Constructor(optional HeadersInit init),

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Fullscreen API Standard" spec.
// See: https://fullscreen.spec.whatwg.org/
partial interface Element { partial interface Element {
Promise<void> requestFullscreen(); Promise<void> requestFullscreen();

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Geolocation Sensor" spec.
// See: https://wicg.github.io/geolocation-sensor/
[Constructor(optional GeolocationSensorOptions options), SecureContext, Exposed=Window] [Constructor(optional GeolocationSensorOptions options), SecureContext, Exposed=Window]
interface GeolocationSensor : Sensor { interface GeolocationSensor : Sensor {
static Promise<GeolocationSensorReading> read(optional ReadOptions readOptions); static Promise<GeolocationSensorReading> read(optional ReadOptions readOptions);

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the Geometry Interfaces spec. // Content of this file was automatically extracted from the
// See https://drafts.fxtf.org/geometry/ // "Geometry Interfaces Module Level 1" spec.
// See: https://drafts.fxtf.org/geometry/
[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, [Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double z = 0, optional unrestricted double w = 1), optional unrestricted double z = 0, optional unrestricted double w = 1),

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Gyroscope" spec.
// See: https://w3c.github.io/gyroscope/
[Constructor(optional GyroscopeSensorOptions sensorOptions), SecureContext, Exposed=Window] [Constructor(optional GyroscopeSensorOptions sensorOptions), SecureContext, Exposed=Window]
interface Gyroscope : Sensor { interface Gyroscope : Sensor {
readonly attribute double? x; readonly attribute double? x;

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Keyboard Lock" spec.
// See: https://w3c.github.io/keyboard-lock/
partial interface Navigator { partial interface Navigator {
[SecureContext, SameObject] readonly attribute Keyboard keyboard; [SecureContext, SameObject] readonly attribute Keyboard keyboard;
}; };

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Magnetometer" spec.
// See: https://w3c.github.io/magnetometer/
[Constructor(optional MagnetometerSensorOptions sensorOptions), SecureContext, [Constructor(optional MagnetometerSensorOptions sensorOptions), SecureContext,
Exposed=Window] Exposed=Window]
interface Magnetometer : Sensor { interface Magnetometer : Sensor {

View file

@ -134,4 +134,4 @@ interface PaymentRequestUpdateEvent : Event {
void updateWith(Promise<PaymentDetailsUpdate> detailsPromise); void updateWith(Promise<PaymentDetailsUpdate> detailsPromise);
}; };
dictionary PaymentRequestUpdateEventInit : EventInit { dictionary PaymentRequestUpdateEventInit : EventInit {
}; };

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "Proximity Sensor" spec.
// See: https://w3c.github.io/proximity/
[Constructor(optional SensorOptions sensorOptions), SecureContext, Exposed=Window] [Constructor(optional SensorOptions sensorOptions), SecureContext, Exposed=Window]
interface ProximitySensor : Sensor { interface ProximitySensor : Sensor {
readonly attribute double? distance; readonly attribute double? distance;

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the Storage spec. // Content of this file was automatically extracted from the
// See https://storage.spec.whatwg.org/ // "Storage Standard" spec.
// See: https://storage.spec.whatwg.org/
[SecureContext] [SecureContext]
interface mixin NavigatorStorage { interface mixin NavigatorStorage {

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the UI Events spec. // Content of this file was automatically extracted from the
// See https://w3c.github.io/uievents/ // "UI Events" spec.
// See: https://w3c.github.io/uievents/
[Constructor(DOMString type, optional UIEventInit eventInitDict), Exposed=Window] [Constructor(DOMString type, optional UIEventInit eventInitDict), Exposed=Window]
interface UIEvent : Event { interface UIEvent : Event {

View file

@ -1,3 +1,8 @@
// GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the
// "URL Standard" spec.
// See: https://url.spec.whatwg.org/
[Constructor(USVString url, optional USVString base), [Constructor(USVString url, optional USVString base),
Exposed=(Window,Worker), Exposed=(Window,Worker),
LegacyWindowAlias=webkitURL] LegacyWindowAlias=webkitURL]

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the Web Animations spec. // Content of this file was automatically extracted from the
// See https://drafts.csswg.org/web-animations/ // "Web Animations" spec.
// See: https://w3c.github.io/web-animations/
[Exposed=Window] [Exposed=Window]
interface AnimationTimeline { interface AnimationTimeline {

View file

@ -1,6 +1,7 @@
// GENERATED CONTENT - DO NOT EDIT // GENERATED CONTENT - DO NOT EDIT
// Content of this file was automatically extracted from the WebVTT spec. // Content of this file was automatically extracted from the
// See https://w3c.github.io/webvtt/ // "WebVTT: The Web Video Text Tracks Format" spec.
// See: https://w3c.github.io/webvtt/
enum AutoKeyword { "auto" }; enum AutoKeyword { "auto" };
typedef (double or AutoKeyword) LineAndPositionSetting; typedef (double or AutoKeyword) LineAndPositionSetting;

View file

@ -144,6 +144,7 @@ SET TIMEOUT: encrypted-media/polyfill/clearkey-polyfill.js
SET TIMEOUT: encrypted-media/scripts/playback-temporary-events.js SET TIMEOUT: encrypted-media/scripts/playback-temporary-events.js
SET TIMEOUT: eventsource/eventsource-close.htm SET TIMEOUT: eventsource/eventsource-close.htm
SET TIMEOUT: eventsource/eventsource-request-cancellation.htm SET TIMEOUT: eventsource/eventsource-request-cancellation.htm
SET TIMEOUT: generic-sensor/resources/iframe_sensor_handler.html
SET TIMEOUT: html/browsers/browsing-the-web/history-traversal/* SET TIMEOUT: html/browsers/browsing-the-web/history-traversal/*
SET TIMEOUT: html/browsers/browsing-the-web/navigating-across-documents/* SET TIMEOUT: html/browsers/browsing-the-web/navigating-across-documents/*
SET TIMEOUT: html/browsers/browsing-the-web/scroll-to-fragid/* SET TIMEOUT: html/browsers/browsing-the-web/scroll-to-fragid/*

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Magnetometer iframe test</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/magnetometer/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/generic-sensor/generic-sensor-tests.js"></script>
<script src="/generic-sensor/generic-sensor-iframe-tests.sub.js"></script>
<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
<div id="log"></div>
<script>
run_generic_sensor_iframe_tests('Magnetometer');
run_generic_sensor_iframe_tests('UncalibratedMagnetometer');
</script>

View file

@ -112,10 +112,11 @@ self.onmessage = function(e) {
</script> </script>
<script> <script>
function makeWorker(script) function makeWorker(test) {
{ var blob = new Blob([document.getElementById("myWorker").textContent]);
var blob = new Blob([script]); var worker = new Worker(URL.createObjectURL(blob));
return new Worker(URL.createObjectURL(blob)); worker.onerror = test.unreached_func("error");
return worker;
} }
function drawCanvas(ctx) function drawCanvas(ctx)
@ -190,7 +191,7 @@ function compareWithToBlob(t, typeVal, qualityVal, blob2)
} }
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "empty", "empty", msg.data); compareWithToBlob(t, "empty", "empty", msg.data);
})); }));
@ -198,7 +199,7 @@ async_test(function(t) {
}, "Test that convertToBlob with default arguments produces correct result in a worker"); }, "Test that convertToBlob with default arguments produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "empty", 1.0, msg.data); compareWithToBlob(t, "empty", 1.0, msg.data);
})); }));
@ -206,7 +207,7 @@ async_test(function(t) {
}, "Test that convertToBlob with default type/1.0 quality produces correct result in a worker"); }, "Test that convertToBlob with default type/1.0 quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "empty", 0.2, msg.data); compareWithToBlob(t, "empty", 0.2, msg.data);
})); }));
@ -214,7 +215,7 @@ async_test(function(t) {
}, "Test that convertToBlob with default type/0.2 quality produces correct result in a worker"); }, "Test that convertToBlob with default type/0.2 quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "image/png", "empty", msg.data); compareWithToBlob(t, "image/png", "empty", msg.data);
})); }));
@ -222,7 +223,7 @@ async_test(function(t) {
}, "Test that convertToBlob with png/default quality produces correct result in a worker"); }, "Test that convertToBlob with png/default quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "image/png", 1.0, msg.data); compareWithToBlob(t, "image/png", 1.0, msg.data);
})); }));
@ -230,7 +231,7 @@ async_test(function(t) {
}, "Test that convertToBlob with png/1.0 quality produces correct result in a worker"); }, "Test that convertToBlob with png/1.0 quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "image/png", 0.2, msg.data); compareWithToBlob(t, "image/png", 0.2, msg.data);
})); }));
@ -238,7 +239,7 @@ async_test(function(t) {
}, "Test that convertToBlob with png/0.2 quality produces correct result in a worker"); }, "Test that convertToBlob with png/0.2 quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "image/jpeg", "empty", msg.data); compareWithToBlob(t, "image/jpeg", "empty", msg.data);
})); }));
@ -246,7 +247,7 @@ async_test(function(t) {
}, "Test that convertToBlob with jpeg/default quality produces correct result in a worker"); }, "Test that convertToBlob with jpeg/default quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "image/jpeg", 1.0, msg.data); compareWithToBlob(t, "image/jpeg", 1.0, msg.data);
})); }));
@ -254,7 +255,7 @@ async_test(function(t) {
}, "Test that convertToBlob with jpeg/1.0 quality produces correct result in a worker"); }, "Test that convertToBlob with jpeg/1.0 quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "image/jpeg", 0.2, msg.data); compareWithToBlob(t, "image/jpeg", 0.2, msg.data);
})); }));
@ -262,7 +263,7 @@ async_test(function(t) {
}, "Test that convertToBlob with jpeg/0.2 quality produces correct result in a worker"); }, "Test that convertToBlob with jpeg/0.2 quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "image/webp", "empty", msg.data); compareWithToBlob(t, "image/webp", "empty", msg.data);
})); }));
@ -270,7 +271,7 @@ async_test(function(t) {
}, "Test that convertToBlob with webp/default quality produces correct result in a worker"); }, "Test that convertToBlob with webp/default quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "image/webp", 1.0, msg.data); compareWithToBlob(t, "image/webp", 1.0, msg.data);
})); }));
@ -278,7 +279,7 @@ async_test(function(t) {
}, "Test that convertToBlob with webp/1.0 quality produces correct result in a worker"); }, "Test that convertToBlob with webp/1.0 quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func(function(msg) { worker.addEventListener('message', t.step_func(function(msg) {
compareWithToBlob(t, "image/webp", 0.2, msg.data); compareWithToBlob(t, "image/webp", 0.2, msg.data);
})); }));
@ -286,7 +287,7 @@ async_test(function(t) {
}, "Test that convertToBlob with webp/0.2 quality produces correct result in a worker"); }, "Test that convertToBlob with webp/0.2 quality produces correct result in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
if (msg.data == true || msg.data == false) if (msg.data == true || msg.data == false)
assert_true(msg.data); assert_true(msg.data);
@ -295,7 +296,7 @@ async_test(function(t) {
}, "Test that call convertToBlob on a detached OffscreenCanvas throws exception in a worker"); }, "Test that call convertToBlob on a detached OffscreenCanvas throws exception in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
if (msg.data == true || msg.data == false) if (msg.data == true || msg.data == false)
assert_true(msg.data); assert_true(msg.data);

View file

@ -49,16 +49,18 @@ function verifyPlaceholder(placeholder) {
_assertPixel(canvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255"); _assertPixel(canvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255");
} }
function makeWorker(script) { function makeWorker(test) {
var blob = new Blob([script]); var blob = new Blob([document.getElementById("myWorker").textContent]);
return new Worker(URL.createObjectURL(blob)); var worker = new Worker(URL.createObjectURL(blob));
worker.onerror = test.unreached_func("error");
return worker;
} }
async_test(function(t) { async_test(function(t) {
var placeholder = document.createElement('canvas'); var placeholder = document.createElement('canvas');
placeholder.width = placeholder.height = 10; placeholder.width = placeholder.height = 10;
var offscreenCanvas = placeholder.transferControlToOffscreen(); var offscreenCanvas = placeholder.transferControlToOffscreen();
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
assert_true(msg.data); assert_true(msg.data);
verifyPlaceholder(placeholder); verifyPlaceholder(placeholder);
@ -67,7 +69,7 @@ async_test(function(t) {
}, "Test that calling OffscreenCanvas's commit pushes its contents to its placeholder."); }, "Test that calling OffscreenCanvas's commit pushes its contents to its placeholder.");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
assert_true(msg.data); assert_true(msg.data);
})); }));

View file

@ -109,10 +109,11 @@ self.onmessage = function(e) {
</script> </script>
<script> <script>
function makeWorker(script) function makeWorker(test) {
{ var blob = new Blob([document.getElementById("myWorker").textContent]);
var blob = new Blob([script]); var worker = new Worker(URL.createObjectURL(blob));
return new Worker(URL.createObjectURL(blob)); worker.onerror = test.unreached_func("error");
return worker;
} }
function drawImageBitmap(image, x, y) function drawImageBitmap(image, x, y)
@ -126,7 +127,7 @@ function drawImageBitmap(image, x, y)
} }
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker();
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
assert_true(msg.data); assert_true(msg.data);
})); }));
@ -134,7 +135,7 @@ async_test(function(t) {
}, "Test that transferToImageBitmap returns an ImageBitmap with correct width and height in a worker"); }, "Test that transferToImageBitmap returns an ImageBitmap with correct width and height in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
var clr = drawImageBitmap(msg.data, 50, 25); var clr = drawImageBitmap(msg.data, 50, 25);
assert_array_equals(clr, [0, 255, 0, 255]); assert_array_equals(clr, [0, 255, 0, 255]);
@ -143,7 +144,7 @@ async_test(function(t) {
}, "Test that transferToImageBitmap returns an ImageBitmap with correct color in a worker"); }, "Test that transferToImageBitmap returns an ImageBitmap with correct color in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
var clr = drawImageBitmap(msg.data, 50, 25); var clr = drawImageBitmap(msg.data, 50, 25);
assert_array_equals(clr, [0, 0, 0, 0]); assert_array_equals(clr, [0, 0, 0, 0]);
@ -152,7 +153,7 @@ async_test(function(t) {
}, "Test that call transferToImageBitmap twice returns an ImageBitmap with correct color in a worker"); }, "Test that call transferToImageBitmap twice returns an ImageBitmap with correct color in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
var clr = drawImageBitmap(msg.data, 50, 25); var clr = drawImageBitmap(msg.data, 50, 25);
assert_array_equals(clr, [0, 0, 0, 255]); assert_array_equals(clr, [0, 0, 0, 255]);
@ -161,7 +162,7 @@ async_test(function(t) {
}, "Test that call transferToImageBitmap twice on a alpha-disabled context returns an ImageBitmap with correct color in a worker"); }, "Test that call transferToImageBitmap twice on a alpha-disabled context returns an ImageBitmap with correct color in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
assert_true(msg.data); assert_true(msg.data);
})); }));
@ -169,7 +170,7 @@ async_test(function(t) {
}, "Test that transferToImageBitmap won't change context's property in a worker"); }, "Test that transferToImageBitmap won't change context's property in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
var clr1 = drawImageBitmap(msg.data, 23, 25); var clr1 = drawImageBitmap(msg.data, 23, 25);
assert_array_equals(clr1, [0, 255, 0, 255]); assert_array_equals(clr1, [0, 255, 0, 255]);
@ -180,7 +181,7 @@ async_test(function(t) {
}, "Test that call transferToImageBitmap preserves transform in a worker"); }, "Test that call transferToImageBitmap preserves transform in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
if (msg.data == true || msg.data == false) if (msg.data == true || msg.data == false)
assert_true(msg.data); assert_true(msg.data);
@ -189,7 +190,7 @@ async_test(function(t) {
}, "Test that call transferToImageBitmap on a detached OffscreenCanvas throws an exception in a worker"); }, "Test that call transferToImageBitmap on a detached OffscreenCanvas throws an exception in a worker");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
assert_true(msg.data); assert_true(msg.data);
})); }));

View file

@ -79,14 +79,15 @@ self.onmessage = function(e) {
</script> </script>
<script> <script>
function makeWorker(script) function makeWorker(test) {
{ var blob = new Blob([document.getElementById("myWorker").textContent]);
var blob = new Blob([script]); var worker = new Worker(URL.createObjectURL(blob));
return new Worker(URL.createObjectURL(blob)); worker.onerror = test.unreached_func("error");
return worker;
} }
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
assert_equals(msg.data.width, 10); assert_equals(msg.data.width, 10);
assert_equals(msg.data.height, 10); assert_equals(msg.data.height, 10);
@ -95,7 +96,7 @@ async_test(function(t) {
}, "Test that OffscreenCanvas's size is correct after being transferred from a worker."); }, "Test that OffscreenCanvas's size is correct after being transferred from a worker.");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
assert_true(msg.data); assert_true(msg.data);
})); }));
@ -103,7 +104,7 @@ async_test(function(t) {
}, "Test that transfer an OffscreenCanvas that has a 2d context throws exception in a worker."); }, "Test that transfer an OffscreenCanvas that has a 2d context throws exception in a worker.");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
assert_true(msg.data); assert_true(msg.data);
})); }));
@ -111,7 +112,7 @@ async_test(function(t) {
}, "Test that transfer an OffscreenCanvas that has a webgl context throws exception in a worker."); }, "Test that transfer an OffscreenCanvas that has a webgl context throws exception in a worker.");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
if (msg.data == true || msg.data == false) if (msg.data == true || msg.data == false)
assert_true(msg.data); assert_true(msg.data);
@ -120,7 +121,7 @@ async_test(function(t) {
}, "Test that transfer an OffscreenCanvas twice throws exception in a worker."); }, "Test that transfer an OffscreenCanvas twice throws exception in a worker.");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
if (msg.data == true || msg.data == false) if (msg.data == true || msg.data == false)
assert_true(msg.data); assert_true(msg.data);
@ -129,7 +130,7 @@ async_test(function(t) {
}, "Test that calling getContext('2d') on a detached OffscreenCanvas throws exception in a worker."); }, "Test that calling getContext('2d') on a detached OffscreenCanvas throws exception in a worker.");
async_test(function(t) { async_test(function(t) {
var worker = makeWorker(document.getElementById("myWorker").textContent); var worker = makeWorker(t);
worker.addEventListener('message', t.step_func_done(function(msg) { worker.addEventListener('message', t.step_func_done(function(msg) {
if (msg.data == true || msg.data == false) if (msg.data == true || msg.data == false)
assert_true(msg.data); assert_true(msg.data);

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>AbsoluteOrientationSensor iframe test</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/orientation-sensor/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/generic-sensor/generic-sensor-tests.js"></script>
<script src="/generic-sensor/generic-sensor-iframe-tests.sub.js"></script>
<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
<div id="log"></div>
<script>
run_generic_sensor_iframe_tests('AbsoluteOrientationSensor');
</script>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>RelativeOrientationSensor iframe test</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/orientation-sensor/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/generic-sensor/generic-sensor-tests.js"></script>
<script src="/generic-sensor/generic-sensor-iframe-tests.sub.js"></script>
<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
<div id="log"></div>
<script>
run_generic_sensor_iframe_tests('RelativeOrientationSensor');
</script>

View file

@ -81,3 +81,10 @@ must include a summary of the expected results as a JSON string within a
"type": "complete" "type": "complete"
} }
</script> </script>
`testharness.js` is expected to function consistently in a number of
distinct environments. In order to verify this expectation, each functional
test may be executed under a number of distinct conditions. These conditions
are applied using WPT's "test variants" pattern. The available variants are
defined in the `variants.js` file; this file must be included before
`testharness.js`. Every test must specify at least one variant.

View file

@ -12,6 +12,7 @@ ENC = 'utf8'
HERE = os.path.dirname(os.path.abspath(__file__)) HERE = os.path.dirname(os.path.abspath(__file__))
WPT_ROOT = os.path.normpath(os.path.join(HERE, '..', '..')) WPT_ROOT = os.path.normpath(os.path.join(HERE, '..', '..'))
HARNESS = os.path.join(HERE, 'harness.html') HARNESS = os.path.join(HERE, 'harness.html')
TEST_TYPES = ('functional', 'unit')
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--binary", action="store", default=None, help="path to browser binary") parser.addoption("--binary", action="store", default=None, help="path to browser binary")
@ -32,12 +33,23 @@ def pytest_configure(config):
config.add_cleanup(config.server.stop) config.add_cleanup(config.server.stop)
config.add_cleanup(config.driver.quit) config.add_cleanup(config.driver.quit)
def resolve_uri(context, uri):
if uri.startswith('/'):
base = WPT_ROOT
path = uri[1:]
else:
base = os.path.dirname(context)
path = uri
return os.path.exists(os.path.join(base, path))
class HTMLItem(pytest.Item, pytest.Collector): class HTMLItem(pytest.Item, pytest.Collector):
def __init__(self, filename, test_type, parent): def __init__(self, filename, test_type, parent):
self.filename = filename self.filename = filename
self.type = test_type self.type = test_type
self.variants = []
if test_type not in ('functional', 'unit'): if test_type not in TEST_TYPES:
raise ValueError('Unrecognized test type: "%s"' % test_type) raise ValueError('Unrecognized test type: "%s"' % test_type)
with io.open(filename, encoding=ENC) as f: with io.open(filename, encoding=ENC) as f:
@ -45,20 +57,36 @@ class HTMLItem(pytest.Item, pytest.Collector):
parsed = html5lib.parse(markup, namespaceHTMLElements=False) parsed = html5lib.parse(markup, namespaceHTMLElements=False)
name = None name = None
includes_variants_script = False
self.expected = None self.expected = None
for element in parsed.getiterator(): for element in parsed.getiterator():
if not name and element.tag == 'title': if not name and element.tag == 'title':
name = element.text name = element.text
continue continue
if element.attrib.get('id') == 'expected': if element.tag == 'meta' and element.attrib.get('name') == 'variant':
self.expected = json.loads(unicode(element.text)) self.variants.append(element.attrib.get('content'))
continue continue
if element.tag == 'script':
if element.attrib.get('id') == 'expected':
self.expected = json.loads(unicode(element.text))
src = element.attrib.get('src', '')
if 'variants.js' in src:
includes_variants_script = True
if not resolve_uri(filename, src):
raise ValueError('Could not resolve path "%s" from %s' % (src, filename))
if not name: if not name:
raise ValueError('No name found in file: %s' % filename) raise ValueError('No name found in file: %s' % filename)
elif self.type == 'functional' and not self.expected: elif self.type == 'functional':
raise ValueError('Functional tests must specify expected report data') if not self.expected:
raise ValueError('Functional tests must specify expected report data')
if not includes_variants_script:
raise ValueError('No variants script found in file: %s' % filename)
if len(self.variants) == 0:
raise ValueError('No test variants specified in file %s' % filename)
elif self.type == 'unit' and self.expected: elif self.type == 'unit' and self.expected:
raise ValueError('Unit tests must not specify expected report data') raise ValueError('Unit tests must not specify expected report data')
@ -95,12 +123,17 @@ class HTMLItem(pytest.Item, pytest.Collector):
assert test[u'status_string'] == u'PASS', msg assert test[u'status_string'] == u'PASS', msg
def _run_functional_test(self): def _run_functional_test(self):
for variant in self.variants:
self._run_functional_test_variant(variant)
def _run_functional_test_variant(self, variant):
driver = self.session.config.driver driver = self.session.config.driver
server = self.session.config.server server = self.session.config.server
driver.get(server.url(HARNESS)) driver.get(server.url(HARNESS))
actual = driver.execute_async_script('runTest("%s", "foo", arguments[0])' % server.url(str(self.filename))) test_url = server.url(str(self.filename) + variant)
actual = driver.execute_async_script('runTest("%s", "foo", arguments[0])' % test_url)
# Test object ordering is not guaranteed. This weak assertion verifies # Test object ordering is not guaranteed. This weak assertion verifies
# that the indices are unique and sequential # that the indices are unique and sequential

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Test#add_cleanup</title> <title>Test#add_cleanup</title>
<script src="../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
</head> </head>

View file

@ -1,7 +1,9 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="?keep-promise">
<title>Test#add_cleanup reported count</title> <title>Test#add_cleanup reported count</title>
<script src="../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
</head> </head>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Test#add_cleanup: error</title> <title>Test#add_cleanup: error</title>
<script src="../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
</head> </head>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Test#add_cleanup: multiple functions with one in error</title> <title>Test#add_cleanup: multiple functions with one in error</title>
<script src="../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
</head> </head>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Sample HTML5 API Tests</title> <title>Sample HTML5 API Tests</title>
<script src="../../variants.js"></script>
<meta name="timeout" content="6000"> <meta name="timeout" content="6000">
</head> </head>
<body onload="load_test_attr.done()"> <body onload="load_test_attr.done()">

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Sample HTML5 API Tests</title> <title>Sample HTML5 API Tests</title>
<script src="../../variants.js"></script>
</head> </head>
<body> <body>
<h1>Sample HTML5 API Tests</h1> <h1>Sample HTML5 API Tests</h1>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Sample HTML5 API Tests</title> <title>Sample HTML5 API Tests</title>
<script src="../../variants.js"></script>
</head> </head>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>

View file

@ -1,7 +1,9 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="?keep-promise">
<title>Test#force_timeout</title> <title>Test#force_timeout</title>
<script src="../../variants.js"></script>
</head> </head>
<body> <body>
<h1>Test#force_timeout</h1> <h1>Test#force_timeout</h1>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Sample for using generate_tests to create a series of tests that share the same callback.</title> <title>Sample for using generate_tests to create a series of tests that share the same callback.</title>
<script src="../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
</head> </head>

View file

@ -3,7 +3,10 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>idlharness: Partial dictionary</title> <title>idlharness: Partial dictionary</title>
<script src="/resources/test/variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script> <script src="/resources/WebIDLParser.js"></script>

View file

@ -2,7 +2,10 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>idlharness: Immutable prototypes</title> <title>idlharness: Immutable prototypes</title>
<script src="../../../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script> <script src="/resources/WebIDLParser.js"></script>

View file

@ -3,7 +3,10 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>idlharness: Partail interface</title> <title>idlharness: Partail interface</title>
<script src="/resources/test/variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script> <script src="/resources/WebIDLParser.js"></script>

View file

@ -2,7 +2,10 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>idlharness: Primary interface</title> <title>idlharness: Primary interface</title>
<script src="../../../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script> <script src="/resources/WebIDLParser.js"></script>

View file

@ -2,7 +2,10 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>IdlInterface.prototype.test_to_json_operation()</title> <title>IdlInterface.prototype.test_to_json_operation()</title>
<script src="../../../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script> <script src="/resources/WebIDLParser.js"></script>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Example with iframe that notifies containing document via callbacks</title> <title>Example with iframe that notifies containing document via callbacks</title>
<script src="../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
</head> </head>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Example with iframe that consolidates errors via fetch_tests_from_window</title> <title>Example with iframe that consolidates errors via fetch_tests_from_window</title>
<script src="../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script> <script>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Example with iframe that consolidates tests via fetch_tests_from_window</title> <title>Example with iframe that consolidates tests via fetch_tests_from_window</title>
<script src="../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script> <script>
@ -16,7 +19,7 @@ tests from an <tt>iframe</tt> into the primary document.</p>
executing</p> executing</p>
<div id="log"></div> <div id="log"></div>
<iframe id="childContext" src="promise-async.html" style="display:none"></iframe> <iframe id="childContext" src="promise-async.html?keep-promise" style="display:none"></iframe>
<!-- promise-async.html has async tests with promises --> <!-- promise-async.html has async tests with promises -->
<script> <script>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Example with iframe that notifies containing document via cross document messaging</title> <title>Example with iframe that notifies containing document via cross document messaging</title>
<script src="../../variants.js"></script>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
</head> </head>

View file

@ -1,7 +1,10 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<meta name="variant" content="">
<meta name="variant" content="?keep-promise">
<title>Ordering</title> <title>Ordering</title>
<script src="../../variants.js"></script>
<meta name="timeout" content="6000"> <meta name="timeout" content="6000">
</head> </head>
<body> <body>

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