Update web-platform-tests to revision 615bb572c95add74ca4fb9fed4af5269a49cf4ef

This commit is contained in:
WPT Sync Bot 2018-11-06 20:34:54 -05:00
parent b628b6ef8e
commit 0aa76d7524
162 changed files with 2069 additions and 636 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
[adjacent-to-relpos-inline-in-inline-that-had-block.html]
[Make sure that we're sized by the right ancestor]
expected: FAIL

View file

@ -1,2 +0,0 @@
[mix-blend-mode-animation.html]
expected: FAIL

View file

@ -5,9 +5,6 @@
[Descriptor mathcing priority: Stretch has higher priority than weight]
expected: FAIL
[Matching font-weight: '400' should prefer '400' over '450 460']
expected: FAIL
[Matching font-weight: '400' should prefer '450 460' over '500']
expected: FAIL
@ -23,9 +20,6 @@
[Matching font-weight: '400' should prefer '501 550' over '502 560']
expected: FAIL
[Matching font-weight: '430' should prefer '420 440' over '450 460']
expected: FAIL
[Matching font-weight: '430' should prefer '450 460' over '500']
expected: FAIL
@ -62,9 +56,6 @@
[Matching font-weight: '501' should prefer '450 460' over '390 410']
expected: FAIL
[Matching font-weight: '501' should prefer '390 410' over '300 350']
expected: FAIL
[Matching font-weight: '399' should prefer '340 360' over '200 300']
expected: FAIL
@ -98,9 +89,6 @@
[Matching font-style: 'italic' should prefer 'oblique 40deg 50deg' over 'oblique 5deg 10deg']
expected: FAIL
[Matching font-style: 'italic' should prefer 'oblique 5deg' over 'normal']
expected: FAIL
[Matching font-style: 'italic' should prefer 'normal' over 'oblique 0deg']
expected: FAIL

View file

@ -701,9 +701,6 @@
[font-size length(in) / values]
expected: FAIL
[text-indent length(ex) / values]
expected: FAIL
[font-size length(em) / values]
expected: FAIL
@ -713,9 +710,6 @@
[vertical-align length(em) / values]
expected: FAIL
[text-indent length(px) / values]
expected: FAIL
[clip rectangle(rectangle) / values]
expected: FAIL
@ -857,9 +851,6 @@
[max-width length(px) / values]
expected: FAIL
[text-indent length(mm) / values]
expected: FAIL
[font-size length(mm) / values]
expected: FAIL
@ -908,9 +899,6 @@
[word-spacing length(pt) / values]
expected: FAIL
[text-indent length(cm) / values]
expected: FAIL
[border-right-width length(mm) / values]
expected: FAIL
@ -929,9 +917,6 @@
[border-left-width length(in) / values]
expected: FAIL
[text-shadow shadow(shadow) / values]
expected: FAIL
[max-height length(in) / values]
expected: FAIL
@ -992,12 +977,6 @@
[line-height percentage(%) / values]
expected: FAIL
[text-indent length(in) / values]
expected: FAIL
[text-indent length(em) / values]
expected: FAIL
[border-top-width length(pt) / values]
expected: FAIL
@ -1043,9 +1022,6 @@
[border-bottom-width length(pc) / values]
expected: FAIL
[text-indent percentage(%) / values]
expected: FAIL
[line-height length(pc) / values]
expected: FAIL

View file

@ -74,9 +74,6 @@
[opacity end]
expected: FAIL
[border-top-width end]
expected: FAIL
[border-right-width end]
[outline-width end]
expected: FAIL

View file

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

View file

@ -21,3 +21,15 @@
[Set HTTP URL frame location.protocol to x]
expected: FAIL
[Set HTTP URL frame location.protocol to data]
expected: FAIL
[Set HTTP URL frame location.protocol to gopher]
expected: FAIL
[Set HTTP URL frame location.protocol to http+x]
expected: FAIL
[Set HTTP URL frame location.protocol to ftp]
expected: FAIL

View file

@ -2,10 +2,10 @@
type: testharness
expected: TIMEOUT
[picture: source (max-width:500px) broken image, img valid image, resize to wide]
expected: TIMEOUT
expected: FAIL
[picture: source (max-width:500px) valid image, img valid image, resize to wide]
expected: TIMEOUT
expected: FAIL
[picture: source (max-width:500px) valid image, img broken image, resize to narrow]
expected: TIMEOUT

View file

@ -0,0 +1,10 @@
[non-active-document.html]
[DOMParser]
expected: FAIL
[createHTMLDocument]
expected: FAIL
[<template>]
expected: FAIL

View file

@ -9,6 +9,3 @@
[document.open should throw an InvalidStateError with XML document even when the ignore-opens-during-unload counter is greater than 0 (during pagehide event)]
expected: FAIL
[document.open should throw an InvalidStateError with XML document even when there is an active parser executing script]
expected: FAIL

View file

@ -0,0 +1,283 @@
[no-quirks.html]
[top: -\\31 .5]
expected: FAIL
[bottom: -1A]
expected: FAIL
[bottom: -1a]
expected: FAIL
[top: @1]
expected: FAIL
[top: "1a"]
expected: FAIL
[top: @a]
expected: FAIL
[bottom: "1"]
expected: FAIL
[bottom: -/**/1]
expected: FAIL
[top: +/**/1]
expected: FAIL
[bottom: @1a]
expected: FAIL
[top: 1\\31 ]
expected: FAIL
[top: url('1')]
expected: FAIL
[bottom: -\\31 ]
expected: FAIL
[top: calc(1)]
expected: FAIL
[top: \\31 ]
expected: FAIL
[bottom: +1\\31 ]
expected: FAIL
[bottom: 1\\31 .5]
expected: FAIL
[bottom: #0001]
expected: FAIL
[top: calc(2 * 2px)]
expected: FAIL
[bottom: 1a]
expected: FAIL
[bottom: A]
expected: FAIL
[bottom: #01]
expected: FAIL
[top: +\\31 .5]
expected: FAIL
[bottom: #1]
expected: FAIL
[top: -/**/1]
expected: FAIL
[bottom: +\\31 .5]
expected: FAIL
[bottom: \\31 ]
expected: FAIL
[bottom: calc(1)]
expected: FAIL
[top: #001]
expected: FAIL
[top: +\\31 ]
expected: FAIL
[bottom: +\\31 ]
expected: FAIL
[top: +1.5]
expected: FAIL
[top: +1\\31 ]
expected: FAIL
[bottom: @a]
expected: FAIL
[bottom: @1]
expected: FAIL
[top: #1]
expected: FAIL
[top: 1a]
expected: FAIL
[bottom: +1a]
expected: FAIL
[bottom: +1A]
expected: FAIL
[bottom: "a"]
expected: FAIL
[top: #00001]
expected: FAIL
[bottom: -1\\31 .5]
expected: FAIL
[top: "1"]
expected: FAIL
[bottom: 1.5]
expected: FAIL
[bottom: -\\31 .5]
expected: FAIL
[bottom: url('1')]
expected: FAIL
[bottom: -1.5]
expected: FAIL
[top: \\31 .5]
expected: FAIL
[bottom: "1a"]
expected: FAIL
[bottom: calc(2 * 2px)]
expected: FAIL
[bottom: +1\\31 .5]
expected: FAIL
[bottom: 1\\31 ]
expected: FAIL
[bottom: +/**/1]
expected: FAIL
[bottom: #00001]
expected: FAIL
[top: url(1)]
expected: FAIL
[bottom: #001]
expected: FAIL
[top: +1\\31 .5]
expected: FAIL
[top: -1a]
expected: FAIL
[top: -1A]
expected: FAIL
[bottom: url(1)]
expected: FAIL
[top: a]
expected: FAIL
[top: A]
expected: FAIL
[top: #000001]
expected: FAIL
[top: 1]
expected: FAIL
[top: 1\\31 .5]
expected: FAIL
[bottom: a]
expected: FAIL
[bottom: 1]
expected: FAIL
[bottom: +1]
expected: FAIL
[bottom: #000001]
expected: FAIL
[bottom: +a]
expected: FAIL
[bottom: +A]
expected: FAIL
[top: 1.5]
expected: FAIL
[top: +A]
expected: FAIL
[top: +a]
expected: FAIL
[top: +1]
expected: FAIL
[top: -1.5]
expected: FAIL
[top: -1\\31 .5]
expected: FAIL
[top: +1a]
expected: FAIL
[top: +1A]
expected: FAIL
[top: @1a]
expected: FAIL
[bottom: \\31 .5]
expected: FAIL
[top: "a"]
expected: FAIL
[top: #01]
expected: FAIL
[bottom: +1.5]
expected: FAIL
[bottom: -A]
expected: FAIL
[bottom: -a]
expected: FAIL
[bottom: -1\\31 ]
expected: FAIL
[top: #0001]
expected: FAIL
[bottom: -1]
expected: FAIL
[top: -\\31 ]
expected: FAIL
[top: -A]
expected: FAIL
[top: -a]
expected: FAIL
[top: -1]
expected: FAIL
[top: -1\\31 ]
expected: FAIL

View file

@ -1,5 +1,4 @@
[realtimeanalyser-fft-scaling.html]
expected: TIMEOUT
[X 2048-point FFT peak position is not equal to 64. Got 0.]
expected: FAIL

View file

@ -6,6 +6,12 @@
[W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed]
expected: NOTRUN
[Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened]
expected: FAIL
[Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed]
expected: NOTRUN
[Create-Secure-extensions-empty.any.worker.html]
expected: TIMEOUT
@ -15,3 +21,9 @@
[W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed]
expected: NOTRUN
[Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened]
expected: FAIL
[Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed]
expected: NOTRUN

View file

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

View file

@ -51,3 +51,6 @@
[Multiple non-UTF-8 charset parameters deduplicate, bogus parameter dropped]
expected: FAIL
[charset with leading space that is UTF-8 does change]
expected: FAIL

View file

@ -1,6 +1,7 @@
# This is the configuration file for Azure Pipelines, used to run tests on
# macOS. Documentation to help understand this setup:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables
trigger: none # disable builds for branches
@ -41,6 +42,14 @@ jobs:
displayName: 'Install web-platform.test certificate'
condition: variables.run_wptrunner_infrastructure
- script: HOMEBREW_NO_AUTO_UPDATE=1 brew cask install Homebrew/homebrew-cask-versions/google-chrome-dev
displayName: 'Install Chrome Dev'
condition: variables.run_wptrunner_infrastructure
- script: HOMEBREW_NO_AUTO_UPDATE=1 brew cask install Homebrew/homebrew-cask-versions/firefox-nightly
displayName: 'Install Firefox Nightly'
condition: variables.run_wptrunner_infrastructure
- script: |
# Pin to STP 67, as SafariDriver isn't working in 68:
# https://github.com/web-platform-tests/wpt/issues/13800
@ -59,6 +68,14 @@ jobs:
displayName: 'Update manifest'
condition: variables.run_wptrunner_infrastructure
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --channel=preview safari_webdriver infrastructure/
displayName: 'Run infrastructure/ tests'
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --channel=dev chrome infrastructure/
displayName: 'Run infrastructure/ tests (Chrome Dev)'
condition: variables.run_wptrunner_infrastructure
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --channel=nightly firefox infrastructure/
displayName: 'Run infrastructure/ tests (Firefox Nightly)'
condition: variables.run_wptrunner_infrastructure
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --channel=preview safari_webdriver infrastructure/
displayName: 'Run infrastructure/ tests (Safari Technology Preview)'
condition: variables.run_wptrunner_infrastructure

View file

@ -7,16 +7,31 @@ search: False
# default: empty
# allowed: list
requirements:
- tools/requirements_flake8.txt:
update: all
pin: True
- tools/wpt/requirements.txt:
update: all
pin: True
- tools/wptrunner/requirements.txt:
update: all
pin: True
- tools/wptrunner/requirements_chrome.txt:
update: all
pin: True
- tools/wptrunner/requirements_chrome_android.txt:
update: all
pin: True
- tools/wptrunner/requirements_edge.txt:
update: all
pin: True
- tools/wptrunner/requirements_opera.txt:
- tools/wptrunner/requirements_firefox.txt:
update: all
pin: True
- tools/wptrunner/requirements_servo.txt:
- tools/wptrunner/requirements_ie.txt:
update: all
pin: True
- tools/wptrunner/requirements_opera.txt:
update: all
pin: True
- tools/wptrunner/requirements_safari.txt:
@ -25,18 +40,6 @@ requirements:
- tools/wptrunner/requirements_sauce.txt:
update: all
pin: True
- tools/wptrunner/requirements_ie.txt:
update: all
pin: True
- tools/wptrunner/requirements.txt:
update: all
pin: True
- tools/wptrunner/requirements_firefox.txt:
update: all
pin: True
- tools/wptrunner/requirements_chrome.txt:
update: all
pin: True
- tools/wpt/requirements.txt:
- tools/wptrunner/requirements_servo.txt:
update: all
pin: True

View file

@ -1,3 +1,4 @@
spec: https://w3c.github.io/mediacapture-output/
suggested_reviewers:
- guidou
- jan-ivar

View file

@ -0,0 +1,22 @@
<!DOCTYPE HTML>
<html>
<head>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
</head>
<body>
<!-- This tests that a report only policy is not treated as enforcing when
inherited by a worker. This manifests in particular for `unsafe-eval`
in this bug crbug.com/777076 -->
<script nonce="abc">
var t1 = async_test("Check that inline is allowed since the inherited policy is report only");
var t2 = async_test("Check that eval is allowed since the inherited policy is report only");
var w = new Worker("support/eval.js");
w.onmessage = function(e) {
if (e.data == "unsafe-inline allowed") t1.done();
else if (e.data == "unsafe-eval allowed") t2.done();
}
</script>
</body>
</html>

View file

@ -0,0 +1 @@
Content-Security-Policy-Report-Only: script-src 'self' 'nonce-abc';

View file

@ -0,0 +1,2 @@
postMessage('unsafe-inline allowed');
eval("postMessage('unsafe-eval allowed')");

View file

@ -12,5 +12,5 @@
assert_equals(e.data.result, 'success');
});
</script>
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27self%27%3B%20form-action%20%27self%27%3B&action=post_message_to_frame_owner.html&report_id=dummy">
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27self%27%3B%20form-action%20%27self%27%3B&action=post_message_to_frame_owner.html&report_id={{uuid()}}">
</body>

View file

@ -12,5 +12,5 @@
assert_equals(e.data.result, 'success');
});
</script>
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27none%27%3B%20form-action%20%27self%27%3B&action=post_message_to_frame_owner.html&report_id=dummy">
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27none%27%3B%20form-action%20%27self%27%3B&action=post_message_to_frame_owner.html&report_id={{uuid()}}">
</body>

View file

@ -13,5 +13,5 @@
assert_equals(e.data.violatedDirective, 'form-action');
});
</script>
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27self%27%3B%20form-action%20%27none%27%3B&action=post_message_to_frame_owner.html&report_id=dummy">
</body>
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27self%27%3B%20form-action%20%27none%27%3B&action=post_message_to_frame_owner.html&report_id={{uuid()}}"">
</body>

View file

@ -13,5 +13,5 @@
assert_equals(e.data.violatedDirective, 'form-action');
});
</script>
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27none%27%3B%20form-action%20%27none%27%3B&action=post_message_to_frame_owner.html&report_id=dummy">
<iframe src="../support/form_action_navigation.sub.html?csp=navigate-to%20%27none%27%3B%20form-action%20%27none%27%3B&action=post_message_to_frame_owner.html&report_id={{uuid()}}">
</body>

View file

@ -0,0 +1,19 @@
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- Content-Security-Policy-Report-Only: script-src 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}} -->
</head>
<body>
<script>
var t = async_test("Eval is allowed because the CSP is report-only");
try {
eval("t.done()");
} catch {
t.step(function() { assert_true(false, "The eval should have execute succesfully"); })
}
</script>
<script async defer src="../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27unsafe-inline%27"></script>
</body>
</html>

View file

@ -0,0 +1,2 @@
Set-Cookie: eval-allowed-in-report-only-mode-and-sends-report={{$id:uuid()}}; Path=/content-security-policy/script-src
Content-Security-Policy-Report-Only: script-src 'unsafe-inline'; report-uri ../support/report.py?op=put&reportID={{$id}}

View file

@ -0,0 +1,17 @@
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- Content-Security-Policy-Report-Only: script-src 'unsafe-inline' -->
</head>
<body>
<script>
var t = async_test("Eval is allowed because the CSP is report-only");
try {
eval("t.done()");
} catch {
t.step(function() { assert_true(false, "The eval should have execute succesfully"); })
}
</script>
</body>
</html>

View file

@ -0,0 +1 @@
Content-Security-Policy-Report-Only: script-src 'unsafe-inline'

View file

@ -0,0 +1,239 @@
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// basic tests.
test(function() {
assert_throws(TypeError(),
function() { new SecurityPolicyViolationEvent(); });
}, "SecurityPolicyViolationEvent constructor should throw with no parameters");
test(function() {
assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
}), undefined);
}, "SecurityPolicyViolationEvent constructor works with an init dict");
// missing required members
test(function() {
assert_throws(TypeError(),
function() { new SecurityPolicyViolationEvent("securitypolicyviolation", {
// documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
})});
}, "SecurityPolicyViolationEvent constructor requires documentURI");
test(function() {
assert_throws(TypeError(),
function() { new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
// violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
})});
}, "SecurityPolicyViolationEvent constructor requires violatedDirective");
test(function() {
assert_throws(TypeError(),
function() { new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
// effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
})});
}, "SecurityPolicyViolationEvent constructor requires effectiveDirective");
test(function() {
assert_throws(TypeError(),
function() { new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
// originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
})});
}, "SecurityPolicyViolationEvent constructor requires originalPolicy");
test(function() {
assert_throws(TypeError(),
function() { new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
// disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
})});
}, "SecurityPolicyViolationEvent constructor requires disposition");
test(function() {
assert_throws(TypeError(),
function() { new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
// statusCode: 200,
lineNumber: 1,
columnNumber: 1,
})});
}, "SecurityPolicyViolationEvent constructor requires statusCode");
// missing optional members
test(function() {
assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
// referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
}), undefined);
}, "SecurityPolicyViolationEvent constructor does not require referrer");
test(function() {
assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
// blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
}), undefined);
}, "SecurityPolicyViolationEvent constructor does not require blockedURI");
test(function() {
assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
// sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
}), undefined);
}, "SecurityPolicyViolationEvent constructor does not require sourceFile");
test(function() {
assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
// sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
columnNumber: 1,
}), undefined);
}, "SecurityPolicyViolationEvent constructor does not require sample");
test(function() {
assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
// lineNumber: 1,
columnNumber: 1,
}), undefined);
}, "SecurityPolicyViolationEvent constructor does not require lineNumber");
test(function() {
assert_not_equals(new SecurityPolicyViolationEvent("securitypolicyviolation", {
documentURI: "http://example.com",
referrer: "http://example.com",
blockedURI: "http://example.com",
violatedDirective: "default-src",
effectiveDirective: "default-src",
originalPolicy: "default-src 'none'",
sourceFile: "example.js",
sample: "<script>alert('1');</scr" + "ipt>",
disposition: "enforce",
statusCode: 200,
lineNumber: 1,
// columnNumber: 1,
}), undefined);
}, "SecurityPolicyViolationEvent constructor does not require columnNumber");
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#containing-block-details">
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#anonymous-block-level">
<p>There should be a green square below, and no red.</p>
<div style="position:relative; width:100px; height:100px; background:red;">
<span>
<span id="posMe">
<div id="removeMe"></div>
</span>
</span>
<span>
<div>
<div id="target" style="position:absolute; width:100%; height:100%; background:green;"></div>
</div>
</span>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(()=> {
document.body.offsetTop;
removeMe.style.display = "none";
document.body.offsetTop;
posMe.style.position = "relative";
assert_equals(document.getElementById("target").offsetWidth, 100);
assert_equals(document.getElementById("target").offsetHeight, 100);
assert_equals(document.getElementById("target").offsetLeft, 0);
assert_equals(document.getElementById("target").offsetTop, 0);
}, "Make sure that we're sized by the right ancestor");
</script>

View file

@ -15,9 +15,9 @@
runPropertyTests('pointer-events', [
{ syntax: 'bounding-box' },
{ syntax: 'visiblePainted' },
{ syntax: 'visibleFill' },
{ syntax: 'visibleStroke' },
{ syntax: 'visiblepainted' },
{ syntax: 'visiblefill' },
{ syntax: 'visiblestroke' },
{ syntax: 'visible' },
{ syntax: 'painted' },
{ syntax: 'fill' },

View file

@ -13,7 +13,7 @@
<link
rel="author"
title="François REMY"
href="mailto:fremycompany.developer@yahoo.fr"
href="mailto:francois.remy.pub@outlook.com"
/ >
<link rel="help" href="http://www.w3.org/TR/css3-values/#viewport-relative-lengths">
@ -25,7 +25,7 @@
<style type="text/css">
html, body { margin: 0px; padding: 0px; }
html, body { margin: 0px; padding: 0px; height: 100%; }
html { background: green; }
#target { background: red; width: 100%; height: 100%; margin-left: -100vw; margin-top: -100vh; }

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Motion Path Module Level 1: getComputedValue().offsetRotate</title>
<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org">
<link rel="help" href="https://drafts.fxtf.org/motion-1/#offset-rotate-property">
<meta name="assert" content="offset-rotate reverse is auto 180deg.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("offset-rotate", "auto", "auto 0deg");
test_computed_value("offset-rotate", "reverse", "auto 180deg");
test_computed_value("offset-rotate", "calc(90deg - 0.5turn - 300grad + 0rad)", "-360deg");
test_computed_value("offset-rotate", "auto 5turn", "auto 1800deg");
test_computed_value("offset-rotate", "reverse -50grad", "auto 135deg");
</script>
</body>
</html>

View file

@ -0,0 +1,65 @@
<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/feature-policy/resources/featurepolicy.js></script>
<!-- Feature-Policy: fullscreen cross_origin https://www.example.com; -->
<script>
'use strict';
var same_origin = 'https://{{domains[]}}:{{ports[https][0]}}';
var cross_origin = 'https://{{domains[www]}}:{{ports[https][0]}}';
var same_origin_src = '/feature-policy/resources/feature-policy-allowedfeatures.html';
var cross_origin_src = cross_origin + same_origin_src;
var header_policy = 'Feature-Policy: fullscreen \'self\' ' + cross_origin +
' https://www.example.com;';
// Test that fullscreen's allowlist is [same_origin, cross_origin, 'https://www.example.com']
test(function() {
assert_array_equals(
document.policy.getAllowlistForFeature('fullscreen'),
[cross_origin, 'https://www.example.com']);
}, header_policy + ' -- test allowlist is [cross_origin, https://www.example.com]');
// Test that fullscreen is disallowed on same_origin, allowed on some cross_origin subframes.
test_disallowed_feature_for_subframe(
header_policy + ' -- test fullscreen is allowed on same-origin subframe',
'fullscreen',
same_origin_src);
test_allowed_feature_for_subframe(
header_policy + ' -- test fullscreen is allowed on cross-origin ' + cross_origin_src + ' subframe',
'fullscreen',
cross_origin_src);
var cross_origin_src1 = 'https://{{domains[www1]}}:{{ports[https][0]}}' + same_origin_src;
test_disallowed_feature_for_subframe(
header_policy + ' -- test fullscreen is disallowed on cross-origin ' + cross_origin_src1 + ' subframe',
'fullscreen',
cross_origin_src1);
// dynamically update sub frame's container policy
var disallow = "fullscreen 'none';"
test_disallowed_feature_for_subframe(
header_policy + ', iframe.allow = ' + disallow + ' -- test fullscreen is disallowed on same-origin subframe',
'fullscreen',
same_origin_src,
disallow);
test_disallowed_feature_for_subframe(
header_policy + 'iframe.allow = ' + disallow + ' -- test fullscreen is allowed on specific cross-origin subframe',
'fullscreen',
cross_origin_src,
disallow);
var allow = "fullscreen " + cross_origin;
test_disallowed_feature_for_subframe(
header_policy + ', iframe.allow = ' + allow + ' -- test fullscreen is disallowed on same-origin subframe',
'fullscreen',
same_origin_src,
allow);
test_allowed_feature_for_subframe(
header_policy + 'iframe.allow = ' + allow + ' -- test fullscreen is allowed on specific cross-origin subframe',
'fullscreen',
cross_origin_src,
allow);
</script>
</body>

View file

@ -0,0 +1 @@
Feature-Policy: fullscreen https://{{domains[www]}}:{{ports[https][0]}} https://www.example.com;

View file

@ -10,31 +10,34 @@ enum SecurityPolicyViolationEventDisposition {
[Constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict),
Exposed=(Window,Worker)]
interface SecurityPolicyViolationEvent : Event {
readonly attribute USVString documentURI;
readonly attribute USVString documentURL;
readonly attribute USVString documentURI; // historical alias of documentURL
readonly attribute USVString referrer;
readonly attribute USVString blockedURI;
readonly attribute DOMString violatedDirective;
readonly attribute USVString blockedURL;
readonly attribute USVString blockedURI; // historical alias of blockedURL
readonly attribute DOMString effectiveDirective;
readonly attribute DOMString violatedDirective; // historical alias of effectiveDirective
readonly attribute DOMString originalPolicy;
readonly attribute USVString sourceFile;
readonly attribute DOMString sample;
readonly attribute SecurityPolicyViolationEventDisposition disposition;
readonly attribute unsigned short statusCode;
readonly attribute unsigned long lineNumber;
readonly attribute unsigned long columnNumber;
readonly attribute unsigned long lineno;
readonly attribute unsigned long lineNumber; // historical alias of lineno
readonly attribute unsigned long colno;
readonly attribute unsigned long columnNumber; // historical alias of colno
};
dictionary SecurityPolicyViolationEventInit : EventInit {
required USVString documentURI;
required USVString documentURL;
USVString referrer = "";
USVString blockedURI = "";
required DOMString violatedDirective;
USVString blockedURL = "";
required DOMString effectiveDirective;
required DOMString originalPolicy;
USVString sourceFile = "";
DOMString sample = "";
required SecurityPolicyViolationEventDisposition disposition;
required unsigned short statusCode;
unsigned long lineNumber = 0;
unsigned long columnNumber = 0;
unsigned long lineno = 0;
unsigned long colno = 0;
};

View file

@ -3,7 +3,7 @@
// (https://github.com/tidoust/reffy-reports)
// Source: Screen Capture (https://w3c.github.io/mediacapture-screen-share/)
partial interface Navigator {
partial interface MediaDevices {
Promise<MediaStream> getDisplayMedia(optional MediaStreamConstraints constraints);
};

View file

@ -5,3 +5,4 @@ suggested_reviewers:
- dontcallmedom
- eric-carlson
- youennf
- jan-ivar

View file

@ -48,7 +48,7 @@ promise_test(async t => {
await promise_rejects(t, "AbortError", acceptPromise);
// As request is now "closed", trying to show it will fail
await promise_rejects(t, "InvalidStateError", request.show());
});
}, "The same request cannot be shown multiple times.");
promise_test(async t => {
// request is in "created" state.
@ -70,7 +70,7 @@ promise_test(async t => {
// The request is now "closed", so...
await promise_rejects(t, "InvalidStateError", request.abort());
await promise_rejects(t, "AbortError", acceptPromise);
});
}, "Aborting a request before it is shown doesn't prevent it from being shown later.");
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);

View file

@ -8,7 +8,9 @@
<script src="/resources/testdriver.js"></script>
<script>
const basicCard = Object.freeze({ supportedMethods: "basic-card" });
const applePay = Object.freeze({ supportedMethods: "https://apple.com/apple-pay" });
const applePay = Object.freeze({
supportedMethods: "https://apple.com/apple-pay",
});
const defaultMethods = Object.freeze([basicCard, applePay]);
const defaultDetails = Object.freeze({
total: {
@ -20,15 +22,23 @@ const defaultDetails = Object.freeze({
},
});
const unsupportedMethods = [
{ supportedMethods: "this-is-not-supported" },
{ supportedMethods: "https://not.supported" },
];
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
assert_true(await request.canMakePayment(), "one of the methods should be supported");
}, `If payment method identifier and serialized parts are supported, resolve promise with true.`);
assert_true(
await request.canMakePayment(),
"one of the methods should be supported"
);
}, `If payment method identifier are supported, resolve promise with true.`);
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise = test_driver.bless("show payment request", () => {
request.show() // Sets state to "interactive"
request.show(); // Sets state to "interactive"
});
const canMakePaymentPromise = request.canMakePayment();
try {
@ -50,7 +60,7 @@ promise_test(async t => {
promise_test(async t => {
const request = new PaymentRequest(defaultMethods, defaultDetails);
const acceptPromise = test_driver.bless("show payment request", () => {
request.show() // Sets state to "interactive"
request.show(); // Sets state to "interactive"
});
acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools.
await request.abort(); // The state is now "closed"
@ -91,52 +101,20 @@ promise_test(async t => {
}, `If request.[[state]] is "created", then return a promise that resolves to true for known method.`);
promise_test(async t => {
const unsupportedMethods = [
"this-is-not-supported",
"https://not.supported",
"e",
"n6jzof05mk2g4lhxr-u-q-w1-c-i-pa-ty-bdvs9-ho-ae7-p-md8-s-wq3-h-qd-e-q-sa",
"a-b-q-n-s-pw0",
"m-u",
"s-l5",
"k9-f",
"m-l",
"u4-n-t",
"i488jh6-g18-fck-yb-v7-i",
"x-x-t-t-c34-o",
"https://wpt",
"https://wpt.fyi/",
"https://wpt.fyi/payment",
"https://wpt.fyi/payment-request",
"https://wpt.fyi/payment-request?",
"https://wpt.fyi/payment-request?this=is",
"https://wpt.fyi/payment-request?this=is&totally",
"https://wpt.fyi:443/payment-request?this=is&totally",
"https://wpt.fyi:443/payment-request?this=is&totally#fine",
"https://:@wpt.fyi:443/payment-request?this=is&totally#👍",
" \thttps://wpt\n ",
"https://xn--c1yn36f",
"https://點看",
];
for (const method of unsupportedMethods) {
try {
const request = new PaymentRequest(
[{ supportedMethods: method }],
defaultDetails
);
assert_false(
await request.canMakePayment(),
`method "${method}" must not be supported`
);
} catch (err) {
assert_equals(
err.name,
"NotAllowedError",
"if it throws, then it must be a NotAllowedError."
);
}
}
}, `If payment method identifier is unknown, resolve promise with false.`);
const noneSupported = new PaymentRequest(
unsupportedMethods,
defaultDetails
).canMakePayment();
assert_false(await noneSupported, `methods must not be supported`);
}, "All methods are unsupported");
promise_test(async t => {
const someSupported = new PaymentRequest(
[...unsupportedMethods, ...defaultMethods],
defaultDetails
).canMakePayment();
assert_true(await someSupported, `At least one method is expected to be supported.`);
}, `Mix of supported and unsupported methods, at least one method is supported.`);
</script>
<small>

View file

@ -283,9 +283,6 @@ test(() => {
[
{
supportedMethods: "https://wpt.fyi/payment-request",
data: {
supportedTypes: ["debit"],
},
},
],
{

View file

@ -10,13 +10,16 @@
var testMouseUp = async_test('Tests that when pointer is locked, the mouseup is preventable.');
var received_back = false;
var received_forward = false;
const left_button = 0;
const back_button = 3;
const forward_button = 4;
window.addEventListener('mouseup', function(e) {
if (e.button == 0) {
if (e.button == left_button) {
document.body.requestPointerLock();
} else if (e.button == 3) {
} else if (e.button == back_button) {
received_back = true;
e.preventDefault();
} else if (e.button == 4) {
} else if (e.button == forward_button) {
received_forward = true;
e.preventDefault();
}

View file

@ -94,13 +94,31 @@
await eventWatcher2.wait_for('close');
assert_equals(connection2.state, 'closed', 'The presentation connection is successfully closed.');
const c1 = await request1.reconnect(connection1.id);
assert_equals(c1, connection1, 'The promise is resolved with the existing presentation connection.');
const c11 = await request1.reconnect(connection1.id);
assert_equals(c11, connection1, 'The promise is resolved with the existing presentation connection.');
const c22 = await request2.reconnect(connection2.id);
assert_equals(c22, connection2, 'The promise is resolved with the existing presentation connection.');
await Promise.all([
eventWatcher1.wait_for('connect'),
eventWatcher2.wait_for('connect')
]);
assert_equals(connection1.state, 'connected', 'The presentation connection is successfully reconnected.');
assert_equals(connection2.state, 'connected', 'The presentation connection is successfully reconnected.');
// Reconnecting a presentation via a different presentation request with the same presentation
// URLs will succeed
const c2 = await request1.reconnect(connection2.id);
assert_equals(c2, connection2, 'The promise is resolved with the existing presentation connection.');
connection2.close();
await eventWatcher2.wait_for('close');
const c12 = await request1.reconnect(connection2.id);
assert_equals(c12, connection2, 'The promise is resolved with the existing presentation connection.');
connection1.close();
await eventWatcher1.wait_for('close');
const c21 = await request2.reconnect(connection1.id);
assert_equals(c21, connection1, 'The promise is resolved with the existing presentation connection.');
await Promise.all([
eventWatcher1.wait_for('connect'),

View file

@ -3,3 +3,4 @@ suggested_reviewers:
- alvestrand
- martinthomson
- uysalere
- jan-ivar

View file

@ -7,8 +7,8 @@
'use strict';
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
const stream = await navigator.getDisplayMedia({video: true});
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({video: true});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
assert_equals(stream.getTracks().length, 1);
@ -22,8 +22,8 @@ promise_test(async t => {
// Note that this results in some non-intuitive cases returning a video track,
// i.e. {video: false}.
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
const stream = await navigator.getDisplayMedia();
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia();
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
assert_equals(stream.getTracks().length, 1);
@ -32,8 +32,8 @@ promise_test(async t => {
}, 'getDisplayMedia() with no constraints');
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
const stream = await navigator.getDisplayMedia({video: false});
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({video: false});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
assert_equals(stream.getTracks().length, 1);
@ -42,8 +42,8 @@ promise_test(async t => {
}, 'getDisplayMedia() with video false');
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
const stream = await navigator.getDisplayMedia({audio: false});
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({audio: false});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
assert_equals(stream.getTracks().length, 1);
@ -52,8 +52,8 @@ promise_test(async t => {
}, 'getDisplayMedia() with audio false');
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
const stream = await navigator.getDisplayMedia({audio: true});
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({audio: true});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
assert_equals(stream.getTracks().length, 1);
@ -62,10 +62,10 @@ promise_test(async t => {
}, 'getDisplayMedia() with audio true');
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
try {
const stream =
await navigator.getDisplayMedia({video: {advanced: [{zoom: 1}]}});
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {advanced: [{zoom: 1}]}});
} catch (err) {
assert_equals(err.name, 'TypeError');
return;
@ -74,10 +74,10 @@ promise_test(async t => {
}, 'getDisplayMedia() with advanced constraint');
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
try {
const stream =
await navigator.getDisplayMedia({video: {width: {min: 360}}});
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {width: {min: 360}}});
} catch (err) {
assert_equals(err.name, 'TypeError');
return;
@ -86,10 +86,10 @@ promise_test(async t => {
}, 'getDisplayMedia() with min constraint');
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
try {
const stream =
await navigator.getDisplayMedia({video: {width: {exact: 360}}});
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {width: {exact: 360}}});
} catch (err) {
assert_equals(err.name, 'TypeError');
return;
@ -98,10 +98,10 @@ promise_test(async t => {
}, 'getDisplayMedia() with exact constraint');
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const maxWidth = 360;
const stream =
await navigator.getDisplayMedia({video: {width: {max: maxWidth}}});
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {width: {max: maxWidth}}});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
assert_equals(stream.getVideoTracks().length, 1);
@ -111,10 +111,10 @@ promise_test(async t => {
}, 'getDisplayMedia() with max constraint');
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const maxWidth = 360;
const maxFrameRate = 4;
const stream = await navigator.getDisplayMedia(
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {width: {max: maxWidth}, frameRate: {max: maxFrameRate}}});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
@ -126,9 +126,10 @@ promise_test(async t => {
}, 'getDisplayMedia() with constraints applied');
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
try {
const stream = await navigator.getDisplayMedia({video: {width: {max: 0}}});
const stream = await navigator.mediaDevices.getDisplayMedia(
{video: {width: {max: 0}}});
} catch (err) {
assert_equals(err.name, 'OverconstrainedError');
return;
@ -138,8 +139,8 @@ promise_test(async t => {
// Content shell picks a fake desktop device by default.
promise_test(async t => {
assert_idl_attribute(navigator, 'getDisplayMedia');
const stream = await navigator.getDisplayMedia({video: true});
assert_idl_attribute(navigator.mediaDevices, 'getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({video: true});
const [track] = stream.getTracks();
t.add_cleanup(() => track.stop());
assert_equals(stream.getVideoTracks().length, 1);

View file

@ -7,10 +7,10 @@
idl_test(
['screen-capture'],
['mediacapture-streams', 'html'],
['mediacapture-streams', 'html', 'dom'],
idl_array => {
idl_array.add_objects({
Navigator: ['navigator'],
MediaDevices: ['navigator.mediaDevices'],
});
}
);

View file

@ -4,35 +4,26 @@
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<script>
var base_url = 'resources/blank.html'; // This is out-of-scope.
var scope = base_url + '?clients-matchAll-includeUncontrolled';
var frames = [];
const base_url = 'resources/blank.html'; // This is out-of-scope.
const scope = base_url + '?clients-matchAll-includeUncontrolled';
let frames = [];
// Creates 3 iframes, 2 for in-scope and 1 for out-of-scope.
// The frame opened for scope + '#2' is returned via a promise.
function create_iframes(scope) {
return with_iframe(base_url)
.then(function(frame0) {
frames.push(frame0);
return with_iframe(scope + '#1');
})
.then(function(frame1) {
frames.push(frame1);
return with_iframe(scope + '#2');
})
.then(function(frame2) {
frames.push(frame2);
return frame2;
})
// Creates 3 iframes, 2 for in-scope and 1 for out-of-scope. Returns the frame
// opened for scope + '#2'.
async function create_iframes(scope) {
frames.push(await with_iframe(base_url));
frames.push(await with_iframe(scope + '#1'));
frames.push(await with_iframe(scope + '#2'));
return frames[2];
}
var expected_without_include_uncontrolled = [
const expected_without_include_uncontrolled = [
// visibilityState, focused, url, type, frameType
['visible', false, new URL(scope + '#1', location).toString(), 'window', 'nested'],
['visible', true, new URL(scope + '#2', location).toString(), 'window', 'nested']
];
var expected_with_include_uncontrolled = [
const expected_with_include_uncontrolled = [
// visibilityState, focused, url, type, frameType
['visible', true, location.href, 'window', 'top-level'],
['visible', false, new URL(scope + '#1', location).toString(), 'window', 'nested'],
@ -44,21 +35,21 @@ function test_matchall(frame, expected, query_options) {
// Make sure we have focus for '#2' frame and its parent window.
frame.focus();
frame.contentWindow.focus();
expected.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
return new Promise(function(resolve, reject) {
var channel = new MessageChannel();
channel.port1.onmessage = function(e) {
expected.sort((a, b) => a[2] > b[2] ? 1 : -1);
return new Promise((resolve, reject) => {
const channel = new MessageChannel();
channel.port1.onmessage = e => {
// Ignore hidden clients which may be coming from background tabs, or
// clients unrelated to this test.
var data = e.data.filter(function(info) {
const data = e.data.filter(info => {
return info[0] == 'visible' &&
info[2].indexOf('service-worker') > -1;
});
data.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
data.sort((a, b) => a[2] > b[2] ? 1 : -1);
assert_equals(data.length, expected.length);
for (var i = 0; i < data.length; i++)
for (let i = 0; i < data.length; i++)
assert_array_equals(data[i], expected[i]);
resolve(frame);
resolve();
};
frame.contentWindow.navigator.serviceWorker.controller.postMessage(
{port:channel.port2, options:query_options},
@ -69,27 +60,15 @@ function test_matchall(frame, expected, query_options) {
// Run clients.matchAll without and with includeUncontrolled=true.
// (We want to run the two tests sequentially in the same promise_test
// so that we can use the same set of iframes without intefering each other.
promise_test(function(t) {
return service_worker_unregister_and_register(
t, 'resources/clients-matchall-worker.js', scope)
.then(function(registration) {
t.add_cleanup(function() {
return service_worker_unregister(t, scope);
});
return wait_for_state(t, registration.installing, 'activated');
})
.then(function() { return create_iframes(scope); })
.then(function(frame) {
return test_matchall(frame, expected_without_include_uncontrolled);
})
.then(function(frame) {
return test_matchall(frame, expected_with_include_uncontrolled,
{includeUncontrolled:true});
})
.then(function() {
frames.forEach(function(f) { f.remove() });
});
}, 'Verify matchAll() respect includeUncontrolled');
promise_test(async t => {
const registration =
await service_worker_unregister_and_register(
t, 'resources/clients-matchall-worker.js', scope);
t.add_cleanup(() => service_worker_unregister(t, scope));
await wait_for_state(t, registration.installing, 'activated');
const frame = await create_iframes(scope);
await test_matchall(frame, expected_without_include_uncontrolled);
await test_matchall(frame, expected_with_include_uncontrolled,
{includeUncontrolled:true});
}, 'Verify matchAll() respect includeUncontrolled');
</script>

View file

@ -5,50 +5,38 @@
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<script>
promise_test(t => {
var script = 'resources/postmessage-to-client-worker.js';
var scope = 'resources/blank.html';
var w;
promise_test(async t => {
const script = 'resources/postmessage-to-client-worker.js';
const scope = 'resources/blank.html';
return service_worker_unregister_and_register(t, script, scope)
.then(registration => {
t.add_cleanup(() => registration.unregister());
return wait_for_state(t, registration.installing, 'activated');
})
.then(() => with_iframe(scope))
.then(frame => {
t.add_cleanup(() => frame.remove());
const registration =
await service_worker_unregister_and_register(t, script, scope);
t.add_cleanup(() => registration.unregister());
await wait_for_state(t, registration.installing, 'activated');
const frame = await with_iframe(scope);
t.add_cleanup(() => frame.remove());
const w = frame.contentWindow;
return new Promise(resolve => {
w = frame.contentWindow;
w.navigator.serviceWorker.onmessage = resolve;
w.navigator.serviceWorker.controller.postMessage('ping');
});
})
.then(e => {
var message = e.data;
assert_equals(e.constructor, w.MessageEvent,
'message events should use MessageEvent interface.');
assert_equals(e.type, 'message', 'type should be "message".');
assert_equals(e.bubbles, false, 'message events should not bubble.');
assert_equals(e.cancelable, false,
'message events should not be cancelable.');
assert_equals(
e.origin, location.origin,
'origin of message should be origin of Service Worker.');
assert_equals(e.lastEventId, '',
'lastEventId should be an empty string.');
assert_equals(e.source.constructor, w.ServiceWorker,
'source should use ServiceWorker interface.');
assert_equals(
e.source, w.navigator.serviceWorker.controller,
'source should be the service worker that sent the message.');
assert_equals(e.ports.length, 0, 'ports should be an empty array.');
assert_equals(message, 'Sending message via clients');
return new Promise(resolve => {
w.navigator.serviceWorker.onmessage = resolve;
});
})
.then(e => { assert_equals(e.data, 'quit'); });
}, 'postMessage from ServiceWorker to Client.');
w.navigator.serviceWorker.controller.postMessage('ping');
let e = await new Promise(r => w.navigator.serviceWorker.onmessage = r);
assert_equals(e.constructor, w.MessageEvent,
'message events should use MessageEvent interface.');
assert_equals(e.type, 'message', 'type should be "message".');
assert_false(e.bubbles, 'message events should not bubble.');
assert_false(e.cancelable, 'message events should not be cancelable.');
assert_equals(e.origin, location.origin,
'origin of message should be origin of Service Worker.');
assert_equals(e.lastEventId, '',
'lastEventId should be an empty string.');
assert_equals(e.source.constructor, w.ServiceWorker,
'source should use ServiceWorker interface.');
assert_equals(e.source, w.navigator.serviceWorker.controller,
'source should be the service worker that sent the message.');
assert_equals(e.ports.length, 0, 'ports should be an empty array.');
assert_equals(e.data, 'Sending message via clients');
e = await new Promise(r => w.navigator.serviceWorker.onmessage = r);
assert_equals(e.data, 'quit');
}, 'postMessage from ServiceWorker to Client.');
</script>

View file

@ -1,9 +1,7 @@
[flake8]
# flake8 config used in tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini
select = E,W,F,N
# E128: continuation line under-indented for visual indent
# E129: visually indented line with same indent as next logical line
# E221: multiple spaces before operator
# E226: missing whitespace around arithmetic operator
# E231: missing whitespace after ,, ;, or :
# E251: unexpected spaces around keyword / parameter equals
@ -13,11 +11,10 @@ select = E,W,F,N
# E305: expected 2 blank lines after end of function or class
# E402: module level import not at top of file
# E731: do not assign a lambda expression, use a def
# E901: SyntaxError or IndentationError
# W601: .has_key() is deprecated, use in
# N801: class names should use CapWords convention
# N802: function name should be lowercase
ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802
ignore = E128,E129,E226,E231,E251,E265,E302,E303,E305,E402,E731,W601,N801,N802
exclude =
.tox,
pywebsocket,

View file

@ -0,0 +1,24 @@
[flake8]
select = E,W,F,N
# E128: continuation line under-indented for visual indent
# E129: visually indented line with same indent as next logical line
# E226: missing whitespace around arithmetic operator
# E231: missing whitespace after ,, ;, or :
# E251: unexpected spaces around keyword / parameter equals
# E265: block comment should start with #
# E302: expected 2 blank lines, found 0
# E303: too many blank lines (3)
# E305: expected 2 blank lines after end of function or class
# E402: module level import not at top of file
# E731: do not assign a lambda expression, use a def
# N801: class names should use CapWords convention
# N802: function name should be lowercase
ignore = E128,E129,E226,E231,E251,E265,E302,E303,E305,E402,E731,N801,N802
exclude =
.tox,
pywebsocket,
third_party,
wptrunner,
wptserve/docs/conf.py,
wptserve/tests/functional/docroot/invalid.py
max-line-length = 141

View file

@ -1,5 +1,5 @@
[tox]
envlist = py27,py36,pypy,py27-flake8
envlist = py27,py36,pypy,{py27,py36}-flake8
skipsdist=True
[testenv]
@ -16,5 +16,9 @@ passenv =
HYPOTHESIS_PROFILE
[testenv:py27-flake8]
deps = -r{toxinidir}/requirements_flake8.txt
commands = flake8 --append-config={toxinidir}/flake8.ini {posargs}
deps = -r requirements_flake8.txt
commands = flake8 --append-config=py27-flake8.ini {posargs}
[testenv:py36-flake8]
deps = -r requirements_flake8.txt
commands = flake8 --append-config=py36-flake8.ini {posargs}

View file

@ -58,8 +58,8 @@ def run(venv, **kwargs):
channel = get_channel(browser, kwargs["channel"])
if channel != kwargs["channel"]:
print "Interpreting channel '%s' as '%s'" % (kwargs["channel"],
channel)
print("Interpreting channel '%s' as '%s'" % (kwargs["channel"],
channel))
if destination is None:
if venv:

View file

@ -1,3 +1,5 @@
from functools import reduce
def format_comment_title(product):
"""Produce a Markdown-formatted string based on a given "product"--a string
containing a browser identifier optionally followed by a colon and a

View file

@ -3,6 +3,7 @@ import os
import platform
import sys
from distutils.spawn import find_executable
from six.moves import input
wpt_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
sys.path.insert(0, os.path.abspath(os.path.join(wpt_root, "tools")))
@ -154,7 +155,7 @@ class BrowserSetup(object):
if not self.prompt:
return True
while True:
resp = raw_input("Download and install %s [Y/n]? " % component).strip().lower()
resp = input("Download and install %s [Y/n]? " % component).strip().lower()
if not resp or resp == "y":
return True
elif resp == "n":

View file

@ -443,9 +443,9 @@ def test_serve():
assert False, "server did not start responding within 60s"
try:
resp = urllib2.urlopen("http://web-platform.test:8000")
print resp
print(resp)
except urllib2.URLError:
print "URLError"
print("URLError")
time.sleep(1)
else:
assert resp.code == 200

View file

@ -39,7 +39,7 @@ class Virtualenv(object):
def activate(self):
path = os.path.join(self.bin_path, "activate_this.py")
execfile(path, {"__file__": path})
execfile(path, {"__file__": path}) # noqa: F821
def start(self):
if not self.exists:

View file

@ -1,3 +1,21 @@
var callback = arguments[arguments.length - 1];
window.opener.testdriver_callback = callback;
window.opener.testdriver_callback = function(results) {
/**
* The current window and its opener belong to the same domain, making it
* technically possible for data structures to be shared directly.
* Unfortunately, some browser/WebDriver implementations incorrectly
* serialize Arrays from foreign realms [1]. This issue does not extend to
* the behavior of `JSON.stringify` and `JSON.parse` in these
* implementations. Use that API to re-create the data structure in the local
* realm to avoid the problem in the non-conforming browsers.
*
* [1] This has been observed in Edge version 17 and/or the corresponding
* release of Edgedriver
*/
try {
results = JSON.parse(JSON.stringify(results));
} catch (error) {}
callback(results);
};
window.opener.process_next_event();

View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<script src="/resources/testharness.js" ></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helper.sub.js"></script>
<body>
<script>
//Policy name test
test(t => {
assert_throws("InvalidStateError", _ => {
let policy = window.TrustedTypes.createPolicy('default', { createHTML: s => s } );
});
}, "default policy has to be exposed");
</script>

View file

@ -8,4 +8,10 @@
let factory = window.TrustedTypes;
assert_true(factory instanceof TrustedTypePolicyFactory);
}, "factory = window.TrustedTypes");
test(t => {
assert_throws(new TypeError(), _ => {
let factory = new TrustedTypePolicyFactory();
});
}, "factory construction fails");
</script>

View file

@ -30,4 +30,19 @@
var doc = parser.parseFromString(null, "text/html");
});
}, "'document.innerText = null' throws");
// After default policy creation string assignment implicitly calls createHTML.
test(t => {
let p = window.TrustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
let parser = new DOMParser();
let doc = parser.parseFromString(INPUTS.HTML, "text/html");
assert_equals(doc.body.innerText, RESULTS.HTML);
}, "'document.innerText = string' assigned via default policy (successful HTML transformation).");
// After default policy creation null assignment implicitly calls createHTML.
test(t => {
var parser = new DOMParser();
var doc = parser.parseFromString(null, "text/html");
assert_equals(doc.body.innerText, "null");
}, "'document.innerText = null' assigned via default policy does not throw");
</script>

View file

@ -53,4 +53,17 @@
setInterval(null);
});
}, "`window.setInterval(null)` throws.");
// After default policy creation string assignment implicitly calls createScript.
test(t => {
let policy = window.TrustedTypes.createPolicy("default", { createScript: createScriptJS }, true);
setTimeout(INPUTS.SCRIPT);
setInterval(INPUTS.SCRIPT);
}, "`setTimeout(string)`, `setInterval(string)` via default policy (successful Script transformation).");
// After default policy creation null assignment implicitly calls createScript.
test(t => {
setTimeout(null);
setInterval(null);
}, "`setTimeout(null)`, `setInterval(null)` via default policy (successful Script transformation).");
</script>

View file

@ -9,6 +9,14 @@
</head>
<body>
<script>
// TrustedHTML assignments do not throw.
test(t => {
let p = createHTML_policy(window, 1);
let html = p.createHTML(INPUTS.HTML);
document.write(html);
assert_equals(document.body.innerText, RESULTS.HTML);
}, "document.write with html assigned via policy (successful URL transformation).");
// String assignments throw.
test(t => {
assert_throws(new TypeError(), _ => {

View file

@ -90,6 +90,58 @@
assert_equals(d.lastChild, null);
assert_equals(d.nextSibling, null);
}, "`insertAdjacentHTML(null)` throws.");
// After default policy creation string assignment implicitly calls createHTML.
test(t => {
let p = window.TrustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
var d = document.createElement('div');
container.appendChild(d);
d.insertAdjacentHTML('beforebegin', INPUTS.HTML);
assert_equals(d.previousSibling.nodeType, Node.TEXT_NODE);
assert_equals(d.previousSibling.data, RESULTS.HTML);
d.insertAdjacentHTML('afterbegin', INPUTS.HTML);
assert_equals(d.firstChild.nodeType, Node.TEXT_NODE);
assert_equals(d.firstChild.data, RESULTS.HTML);
d.insertAdjacentHTML('beforeend', INPUTS.HTML);
assert_equals(d.lastChild.nodeType, Node.TEXT_NODE);
assert_equals(d.lastChild.data, RESULTS.HTML);
d.insertAdjacentHTML('afterend', INPUTS.HTML);
assert_equals(d.nextSibling.nodeType, Node.TEXT_NODE);
assert_equals(d.nextSibling.data, RESULTS.HTML);
while (container.firstChild)
container.firstChild.remove();
}, "`insertAdjacentHTML(string)` assigned via default policy (successful HTML transformation).");
// After default policy creation null assignment implicitly calls createHTML.
test(t => {
var d = document.createElement('div');
container.appendChild(d);
d.insertAdjacentHTML('beforebegin', null);
assert_equals(d.previousSibling.nodeType, Node.TEXT_NODE);
assert_equals(d.previousSibling.data, "null");
d.insertAdjacentHTML('afterbegin', null);
assert_equals(d.firstChild.nodeType, Node.TEXT_NODE);
assert_equals(d.firstChild.data, "null");
d.insertAdjacentHTML('beforeend', null);
assert_equals(d.lastChild.nodeType, Node.TEXT_NODE);
assert_equals(d.lastChild.data, "null");
d.insertAdjacentHTML('afterend', null);
assert_equals(d.nextSibling.nodeType, Node.TEXT_NODE);
assert_equals(d.nextSibling.data, "null");
while (container.firstChild)
container.firstChild.remove();
}, "`insertAdjacentHTML(null)` assigned via default policy does not throw.");
</script>
</body>
</html>

View file

@ -49,6 +49,30 @@
while (container.firstChild)
container.firstChild.remove();
}, "`outerHTML = null` throws.");
// After default policy creation string assignment implicitly calls createHTML.
test(t => {
let p = window.TrustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
var d = document.createElement('div');
document.querySelector('#container').appendChild(d);
d.outerHTML = INPUTS.HTML;
assert_equals(container.innerText, RESULTS.HTML);
while (container.firstChild)
container.firstChild.remove();
}, "`outerHTML = string` assigned via default policy (successful HTML transformation).");
// After default policy creation null assignment implicitly calls createHTML.
test(t => {
var d = document.createElement('div');
container.appendChild(d);
d.outerHTML = null;
assert_equals(container.innerText, "null");
while (container.firstChild)
container.firstChild.remove();
}, "`outerHTML = null` assigned via default policy does not throw");
</script>
</body>
</html>

View file

@ -10,7 +10,7 @@
<body>
<script>
// TrustedURL Assignments
let testCases = [
const URLTestCases = [
[ 'a', 'href' ],
[ 'area', 'href' ],
[ 'base', 'href' ],
@ -26,7 +26,7 @@
[ 'track', 'src' ]
];
testCases.forEach(c => {
URLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_url_explicit_set(window, c, t, c[0], c[1], RESULTS.URL);
assert_throws_no_trusted_type_explicit_set(c[0], c[1], 'A string');
@ -35,12 +35,12 @@
});
// TrustedScriptURL Assignments
let scriptTestCases = [
const scriptURLTestCases = [
[ 'embed', 'src' ],
[ 'script', 'src' ]
];
scriptTestCases.forEach(c => {
scriptURLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_script_url_explicit_set(window, c, t, c[0], c[1], RESULTS.SCRIPTURL);
assert_throws_no_trusted_type_explicit_set(c[0], c[1], 'A string');
@ -49,7 +49,7 @@
});
// TrustedHTML Assignments
let HTMLTestCases = [
const HTMLTestCases = [
[ 'iframe', 'srcdoc' ]
];
@ -61,6 +61,35 @@
}, c[0] + "." + c[1] + " accepts only TrustedHTML");
});
// After default policy creation string and null assignments implicitly call createXYZ
let p = window.TrustedTypes.createPolicy("default", { createURL: createURLJS, createScriptURL: createScriptURLJS, createHTML: createHTMLJS }, true);
URLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_type(c[0], c[1], INPUTS.URL, RESULTS.URL);
// Properties that actually parse the URLs will resort to the base URL
// when given a null or empty URL.
assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location);
}, c[0] + "." + c[1] + " accepts string and null after default policy was created.");
});
scriptURLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_type(c[0], c[1], INPUTS.SCRIPTURL, RESULTS.SCRIPTURL);
// Properties that actually parse the URLs will resort to the base URL
// when given a null or empty URL.
assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location);
}, c[0] + "." + c[1] + " accepts string and null after default policy was created.");
});
HTMLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_type(c[0], c[1], INPUTS.HTML, RESULTS.HTML);
assert_element_accepts_trusted_type(c[0], c[1], null, "null");
}, c[0] + "." + c[1] + " accepts string and null after default policy was created.");
});
// Other attributes can be assigned with TrustedTypes or strings or null values
test(t => {
assert_element_accepts_trusted_url_explicit_set(window, 'arel', t, 'a', 'rel', RESULTS.URL);

View file

@ -11,7 +11,7 @@
<script>
var testnb = 0;
// TrustedURL Assignments
let testCases = [
const URLTestCases = [
[ 'a', 'href' ],
[ 'area', 'href' ],
[ 'base', 'href' ],
@ -27,7 +27,7 @@
[ 'track', 'src' ]
];
testCases.forEach(c => {
URLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_url(window, ++testnb, t, c[0], c[1], RESULTS.URL);
assert_throws_no_trusted_type(c[0], c[1], 'A string');
@ -36,13 +36,13 @@
});
// TrustedScriptURL Assignments
let scriptTestCases = [
const scriptURLTestCases = [
[ 'embed', 'src' ],
[ 'script', 'src' ]
];
testnb = 0;
scriptTestCases.forEach(c => {
scriptURLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_script_url(window, ++testnb, t, c[0], c[1], RESULTS.SCRIPTURL);
assert_throws_no_trusted_type(c[0], c[1], 'A string');
@ -51,7 +51,7 @@
});
// TrustedHTML Assignments
let HTMLTestCases = [
const HTMLTestCases = [
[ 'div', 'innerHTML' ],
[ 'iframe', 'srcdoc' ]
];
@ -64,4 +64,29 @@
assert_throws_no_trusted_type(c[0], c[1], null);
}, c[0] + "." + c[1] + " accepts only TrustedHTML");
});
// After default policy creation string and null assignments implicitly call createHTML
let p = window.TrustedTypes.createPolicy("default", { createURL: createURLJS, createScriptURL: createScriptURLJS, createHTML: createHTMLJS }, true);
URLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_type(c[0], c[1], INPUTS.URL, RESULTS.URL);
assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location);
}, c[0] + "." + c[1] + " accepts string and null after default policy was created");
});
scriptURLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_type(c[0], c[1], INPUTS.SCRIPTURL, RESULTS.SCRIPTURL);
assert_element_accepts_trusted_type(c[0], c[1], null, "" + window.location);
}, c[0] + "." + c[1] + " accepts string and null after default policy was created");
});
HTMLTestCases.forEach(c => {
test(t => {
assert_element_accepts_trusted_type(c[0], c[1], INPUTS.HTML, RESULTS.HTML);
assert_element_accepts_trusted_type(c[0], c[1], null, "null");
}, c[0] + "." + c[1] + " accepts string and null after default policy was created");
});
</script>

View file

@ -30,4 +30,20 @@
location.assign(null);
});
}, "`location.assign = null` throws");
// Create default policy. Applies to all subsequent tests.
let p = window.TrustedTypes.createPolicy("default",
{ createURL: createLocationURLJS }, true);
// After default policy creation string assignment implicitly calls createURL.
test(t => {
location.assign("abcdefg");
assert_true(location.href.endsWith("#abcdefg"));
}, "`location.assign = string` via default policy (successful URL transformation).");
// After default policy creation null assignment implicitly calls createURL.
test(t => {
location.assign(null);
assert_true(location.href.endsWith("#null"));
}, "`location.assign = null` via default policy does not throw.");
</script>

View file

@ -30,4 +30,21 @@
location.href = null;
});
}, "`location.href = null` throws");
// Create default policy. Applies to all subsequent tests.
let p = window.TrustedTypes.createPolicy("default",
{ createURL: createLocationURLJS }, true);
// After default policy creation string assignment implicitly calls createURL.
test(t => {
location.href = "xxxx";
assert_true(location.href.endsWith("#xxxx"));
}, "`location.href = string` via default policy (successful URL transformation).");
// After default policy creation null assignment implicitly calls createURL.
test(t => {
location.href = null;
assert_true(location.href.endsWith("#null"));
}, "`location.href = null` assigned via default policy does not throw.");
</script>

View file

@ -30,4 +30,20 @@
location.replace(null);
});
}, "`location.replace = null` throws");
// Create default policy. Applies to all subsequent tests.
let p = window.TrustedTypes.createPolicy("default",
{ createURL: createLocationURLJS }, true);
// After default policy creation string assignment implicitly calls createURL.
test(t => {
location.replace("potato");
assert_true(location.href.endsWith("#potato"));
}, "`location.replace = string` via default policy (successful URL transformation).");
// After default policy creation null assignment implicitly calls createURL.
test(t => {
location.replace(null);
assert_true(location.href.endsWith("#null"));
}, "`location.replace = null` via default policy (successful URL transformation).");
</script>

View file

@ -33,4 +33,21 @@
var result = range.createContextualFragment(null);
});
}, "`range.createContextualFragment(null)` throws.");
// After default policy creation string assignment implicitly calls createHTML
test(t => {
let p = window.TrustedTypes.createPolicy("default", { createHTML: createHTMLJS }, true);
var range = document.createRange();
range.selectNodeContents(document.documentElement);
var result = range.createContextualFragment(INPUTS.HTML);
assert_equals(result.textContent, RESULTS.HTML);
}, "`range.createContextualFragment(string)` assigned via default policy (successful HTML transformation).");
// After default policy creation null assignment implicitly calls createHTML
test(t => {
var range = document.createRange();
range.selectNodeContents(document.documentElement);
var result = range.createContextualFragment(null);
assert_equals(result.textContent, "null");
}, "`range.createContextualFragment(null)` assigned via default policy does not throw.");
</script>

View file

@ -29,6 +29,14 @@
});
}
function testWindowDoesntThrow(t, url, expected, win) {
let child_window = win.open(url, "", "");
child_window.onload = t.step_func_done(_ => {
assert_equals(child_window.location.href, expected);
child_window.close();
});
}
// TrustedURL assignments do not throw.
test(t => {
testWindowOpen(t, window, ++testnb);
@ -55,6 +63,24 @@
test(t => {
testWindowThrows(t, null, document, ++testnb);
}, "`document.open(null)` throws.");
// After default policy creation string assignment implicitly calls createURL.
let p = window.TrustedTypes.createPolicy("default", { createURL: createURLJS }, true);
test(t => {
testWindowDoesntThrow(t, INPUTS.URL, RESULTS.URL, window);
}, "'window.open(string)' assigned via default policy (successful URL transformation).");
test(t => {
testWindowDoesntThrow(t, INPUTS.URL, RESULTS.URL, document);
}, "'document.open(string)' assigned via default policy (successful URL transformation).");
test(t => {
testWindowDoesntThrow(t, null, "null", window);
}, "'window.open(null)' assigned via default policy does not throw.");
test(t => {
testWindowDoesntThrow(t, null, "null", document);
}, "'document.open(null)' assigned via default policy does not throw.");
</script>
</body>
</html>

View file

@ -1,11 +1,11 @@
var INPUTS = {
const INPUTS = {
HTML: "Hi, I want to be transformed!",
SCRIPT: "Hi, I want to be transformed!",
SCRIPTURL: "http://this.is.a.scripturl.test/",
URL: "http://hello.i.am.an.url/"
};
var RESULTS = {
const RESULTS = {
HTML: "Quack, I want to be a duck!",
SCRIPT: "Meow, I want to be a cat!",
SCRIPTURL: "http://this.is.a.successful.test/",
@ -31,6 +31,14 @@ function createURLJS(url) {
.replace("an.url", "successfully.transformed");
}
// When testing location.href (& friends), we have the problem that assigning
// to the new location will navigate away from the test. To fix this, we'll
// have a policy that will just stick the argument into the fragment identifier
// of the current location.href.
function createLocationURLJS(value) {
return location.href.replace(/#.*/g, "") + "#" + value;
}
function createHTML_policy(win, c) {
return win.TrustedTypes.createPolicy('SomeHTMLPolicyName' + c, { createHTML: createHTMLJS });
}

View file

@ -10,11 +10,13 @@
var testMouseUp = async_test('Tests that the mouseup is preventable.');
var received_back = false;
var received_forward = false;
const backButton = 3;
const forwardButton = 4;
window.addEventListener('mouseup', function(e) {
if (e.button == 3) {
if (e.button == backButton) {
received_back = true;
e.preventDefault();
} else if (e.button == 4) {
} else if (e.button == forwardButton) {
received_forward = true;
e.preventDefault();
}

View file

@ -3,6 +3,7 @@ import pytest
from tests.support.asserts import assert_error, assert_success
from tests.support.inline import inline
def element_click(session, element):
return session.transport.send(
"POST", "session/{session_id}/element/{element_id}/click".format(
@ -10,6 +11,38 @@ def element_click(session, element):
element_id=element.id))
def test_display_none(session):
session.url = inline("""<button style="display: none">foobar</button>""")
element = session.find.css("button", all=False)
response = element_click(session, element)
assert_error(response, "element not interactable")
def test_visibility_hidden(session):
session.url = inline("""<button style="visibility: hidden">foobar</button>""")
element = session.find.css("button", all=False)
response = element_click(session, element)
assert_error(response, "element not interactable")
def test_hidden(session):
session.url = inline("<button hidden>foobar</button>")
element = session.find.css("button", all=False)
response = element_click(session, element)
assert_error(response, "element not interactable")
def test_disabled(session):
session.url = inline("""<button disabled>foobar</button>""")
element = session.find.css("button", all=False)
response = element_click(session, element)
assert_success(response)
@pytest.mark.parametrize("transform", ["translate(-100px, -100px)", "rotate(50deg)"])
def test_element_not_interactable_css_transform(session, transform):
session.url = inline("""

View file

@ -1,3 +1,5 @@
import pytest
from tests.support.asserts import assert_error, assert_files_uploaded, assert_success
from tests.support.inline import inline
@ -140,3 +142,87 @@ def test_single_file_appends_with_multiple_attribute(session, create_files):
assert_success(response)
assert_files_uploaded(session, element, files)
def test_transparent(session, create_files):
files = create_files(["foo"])
session.url = inline("""<input type=file style="opacity: 0">""")
element = session.find.css("input", all=False)
response = element_send_keys(session, element, str(files[0]))
assert_success(response)
assert_files_uploaded(session, element, files)
def test_obscured(session, create_files):
files = create_files(["foo"])
session.url = inline("""
<style>
div {
position: absolute;
width: 100vh;
height: 100vh;
background: blue;
top: 0;
left: 0;
}
</style>
<input type=file>
<div></div>
""")
element = session.find.css("input", all=False)
response = element_send_keys(session, element, str(files[0]))
assert_success(response)
assert_files_uploaded(session, element, files)
def test_outside_viewport(session, create_files):
files = create_files(["foo"])
session.url = inline("""<input type=file style="margin-left: -100vh">""")
element = session.find.css("input", all=False)
response = element_send_keys(session, element, str(files[0]))
assert_success(response)
assert_files_uploaded(session, element, files)
def test_hidden(session, create_files):
files = create_files(["foo"])
session.url = inline("<input type=file hidden>")
element = session.find.css("input", all=False)
response = element_send_keys(session, element, str(files[0]))
assert_success(response)
assert_files_uploaded(session, element, files)
def test_display_none(session, create_files):
files = create_files(["foo"])
session.url = inline("""<input type=file style="display: none">""")
element = session.find.css("input", all=False)
response = element_send_keys(session, element, str(files[0]))
assert_success(response)
assert_files_uploaded(session, element, files)
@pytest.mark.capabilities({"strictFileInteractability": True})
def test_strict_hidden(session, create_files):
files = create_files(["foo"])
session.url = inline("<input type=file hidden>")
element = session.find.css("input", all=False)
response = element_send_keys(session, element, str(files[0]))
assert_error(response, "element not interactable")
@pytest.mark.capabilities({"strictFileInteractability": True})
def test_strict_display_none(session, create_files):
files = create_files(["foo"])
session.url = inline("""<input type=file style="display: none">""")
element = session.find.css("input", all=False)
response = element_send_keys(session, element, str(files[0]))
assert_error(response, "element not interactable")

View file

@ -111,7 +111,7 @@ def test_not_a_focusable_element(session):
assert_error(response, "element not interactable")
def test_not_displayed_element(session):
def test_display_none(session):
session.url = inline("""<input style="display: none">""")
element = session.find.css("input", all=False)
@ -119,7 +119,7 @@ def test_not_displayed_element(session):
assert_error(response, "element not interactable")
def test_hidden_element(session):
def test_visibility_hidden(session):
session.url = inline("""<input style="visibility: hidden">""")
element = session.find.css("input", all=False)
@ -127,7 +127,15 @@ def test_hidden_element(session):
assert_error(response, "element not interactable")
def test_disabled_element(session):
def test_hidden(session):
session.url = inline("<input hidden>")
element = session.find.css("input", all=False)
response = element_send_keys(session, element, "foo")
assert_error(response, "element not interactable")
def test_disabled(session):
session.url = inline("""<input disabled>""")
element = session.find.css("input", all=False)

View file

@ -0,0 +1,114 @@
import pytest
from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
def execute_script(session, script, args=None):
if args is None:
args = []
body = {"script": script, "args": args}
return session.transport.send(
"POST", "/session/{session_id}/execute/sync".format(
session_id=session.session_id),
body)
def test_promise_resolve(session):
response = execute_script(session, """
return Promise.resolve('foobar');
""")
assert_success(response, "foobar")
def test_promise_resolve_delayed(session):
response = execute_script(session, """
return new Promise(
(resolve) => setTimeout(
() => resolve('foobar'),
50
)
);
""")
assert_success(response, "foobar")
def test_promise_all_resolve(session):
response = execute_script(session, """
return Promise.all([
Promise.resolve(1),
Promise.resolve(2)
]);
""")
assert_success(response, [1, 2])
def test_await_promise_resolve(session):
response = execute_script(session, """
const res = await Promise.resolve('foobar');
return res;
""")
assert_success(response, "foobar")
def test_promise_reject(session):
response = execute_script(session, """
return Promise.reject(new Error('my error'));
""")
assert_error(response, "javascript error")
def test_promise_reject_delayed(session):
response = execute_script(session, """
return new Promise(
(resolve, reject) => setTimeout(
() => reject(new Error('my error')),
50
)
);
""")
assert_error(response, "javascript error")
def test_promise_all_reject(session):
response = execute_script(session, """
return Promise.all([
Promise.resolve(1),
Promise.reject(new Error('error'))
]);
""")
assert_error(response, "javascript error")
def test_await_promise_reject(session):
response = execute_script(session, """
await Promise.reject(new Error('my error'));
return 'foo';
""")
assert_error(response, "javascript error")
def test_promise_resolve_timeout(session):
session.timeouts.script = .1
response = execute_script(session, """
return new Promise(
(resolve) => setTimeout(
() => resolve(),
1000
)
);
""")
assert_error(response, "timeout error")
def test_promise_reject_timeout(session):
session.timeouts.script = .1
response = execute_script(session, """
return new Promise(
(resolve, reject) => setTimeout(
() => reject(new Error('my error')),
1000
)
);
""")
assert_error(response, "timeout error")

View file

@ -21,6 +21,7 @@ def test_sessionid(new_session, add_browser_capabilities):
("proxy", dict),
("setWindowRect", bool),
("timeouts", dict),
("strictFileInteractability", bool),
("unhandledPromptBehavior", basestring),
])
def test_capability_type(session, capability, type):
@ -35,6 +36,7 @@ def test_capability_type(session, capability, type):
("proxy", {}),
("setWindowRect", True),
("timeouts", {"implicit": 0, "pageLoad": 300000, "script": 30000}),
("strictFileInteractability", False),
("unhandledPromptBehavior", "dismiss and notify"),
])
def test_capability_default_value(session, capability, default_value):

View file

@ -27,6 +27,9 @@ valid_data = [
{"script": 50, "pageLoad": 25},
{"script": 500},
]),
("strictFileInteractability", [
True, False, None,
]),
("unhandledPromptBehavior", [
"dismiss",
"accept",
@ -95,6 +98,9 @@ invalid_data = [
{"pageLoad": {"value": 10}},
{"pageLoad": 10, "invalid": 10},
]),
("strictFileInteractability", [
1, [], {}, "false",
]),
("unhandledPromptBehavior", [
1, [], {}, False,
"DISMISS",
@ -106,25 +112,25 @@ invalid_data = [
]
invalid_extensions = [
"automaticInspection",
"automaticProfiling",
"browser",
"chromeOptions",
"ensureCleanSession",
"firefox",
"firefox_binary",
"firefoxOptions",
"chromeOptions",
"automaticInspection",
"automaticProfiling",
"platform",
"version",
"browser",
"platformVersion",
"javascriptEnabled",
"nativeEvents",
"seleniumProtocol",
"profile",
"trustAllSSLCertificates",
"initialBrowserUrl",
"requireWindowFocus",
"javascriptEnabled",
"logFile",
"logLevel",
"nativeEvents",
"platform",
"platformVersion",
"profile",
"requireWindowFocus",
"safari.options",
"ensureCleanSession",
"seleniumProtocol",
"trustAllSSLCertificates",
"version",
]

View file

@ -1,3 +1,4 @@
spec: https://github.com/w3c/webrtc-identity
suggested_reviewers:
- martinthomson
- jan-ivar

View file

@ -2,3 +2,4 @@ spec: https://w3c.github.io/webrtc-stats/
suggested_reviewers:
- henbos
- vr000m
- jan-ivar

View file

@ -9,3 +9,4 @@ suggested_reviewers:
- phoglund
- youennf
- rwaldron
- jan-ivar

View file

@ -58,7 +58,7 @@
assert_true(dtlsTransport instanceof RTCDtlsTransport,
'Expect sctp.transport to be an RTCDtlsTransport');
const iceTransport = dtlsTransport.transport;
const iceTransport = dtlsTransport.iceTransport;
assert_true(iceTransport instanceof RTCIceTransport,
'Expect dtlsTransport.transport to be an RTCIceTransport');

View file

@ -34,7 +34,7 @@
5.5. RTCDtlsTransport Interface
interface RTCDtlsTransport {
readonly attribute RTCIceTransport transport;
readonly attribute RTCIceTransport iceTransport;
readonly attribute RTCDtlsTransportState state;
...
};
@ -121,7 +121,7 @@
assert_equals(dtlsTransport.state, 'connected',
'Expect DTLS transport to be in connected state');
const iceTransport = dtlsTransport.transport
const iceTransport = dtlsTransport.iceTransport
assert_true(iceTransport.state === 'connected' ||
iceTransport.state === 'completed',
'Expect ICE transport to be in connected or completed state');

View file

@ -115,9 +115,12 @@
'Second ontrack\'s stream ID matches local stream.');
assert_array_equals(firstTrackEvent.streams, secondTrackEvent.streams,
'ontrack was fired with the same streams both times.');
assert_array_equals(firstTrackEvent.streams[0].getTracks(),
[firstTrackEvent.track, secondTrackEvent.track],
'The remote stream == [first track, second track].');
assert_equals(firstTrackEvent.streams[0].getTracks().length, 2, "stream should have two tracks");
assert_true(firstTrackEvent.streams[0].getTracks().includes(firstTrackEvent.track), "remoteStream should have the first track");
assert_true(firstTrackEvent.streams[0].getTracks().includes(secondTrackEvent.track), "remoteStream should have the second track");
assert_equals(ontrackEventsFired, 2, 'Unexpected number of track events.');
assert_equals(ontrackEventsFired, 2, 'Unexpected number of track events.');
}, 'addTrack() with two tracks and one stream makes ontrack fire twice with the tracks and shared stream.');

View file

@ -67,7 +67,9 @@ function asyncInitTransports() {
'Expect sctpTransport.transport to be instance of RTCDtlsTransport');
idlTestObjects.dtlsTransport = dtlsTransport;
const iceTransport = dtlsTransport.transport;
const iceTransport = dtlsTransport.iceTransport;
assert_true(iceTransport instanceof RTCIceTransport,
'Expect sctpTransport.transport to be instance of RTCDtlsTransport');
idlTestObjects.iceTransport = iceTransport;
});
}

View file

@ -101,9 +101,9 @@
var onRemoteTrack = test.step_func(function(event) {
var videoTag = document.getElementById('remote-view');
if (!videoTag.srcObject) {
videoTag.srcObject = event.streams[0];
}
if (!videoTag.srcObject)
videoTag.srcObject = new MediaStream();
videoTag.srcObject.addTrack(event.track);
});
// Returns a suitable error callback.

View file

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
var testOpen = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - Connection should be opened");
var testClose = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed");
var testOpen = async_test("Create WebSocket - Close the Connection - Connection should be opened");
var testClose = async_test("Create WebSocket - Close the Connection - close(1000, reason) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed");
var wsocket = CreateWebSocket(false, false, false);
var isOpenCalled = false;

View file

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
var testOpen = async_test("W3C WebSocket API - Create WebSocket - Connection should be opened");
var testClose = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed");
var testOpen = async_test("Create WebSocket - Connection should be opened");
var testClose = async_test("Create WebSocket - Close the Connection - close(1000) - readyState should be in CLOSED state and wasClean is TRUE - Connection should be closed");
var wsocket = CreateWebSocket(false, false, false);
var isOpenCalled = false;

View file

@ -1,6 +1,6 @@
// META: script=websocket.sub.js
var test = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(code, 'reason more than 123 bytes') - SYNTAX_ERR is thrown");
var test = async_test("Create WebSocket - Close the Connection - close(code, 'reason more than 123 bytes') - SYNTAX_ERR is thrown");
var wsocket = CreateWebSocket(false, false, false);
var isOpenCalled = false;

View file

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
var testOpen = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get opened");
var testClose = async_test("W3C WebSocket API - Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed");
var testOpen = async_test("Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get opened");
var testClose = async_test("Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed");
var wsocket = CreateWebSocket(false, false, false);
var isOpenCalled = false;

View file

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened");
var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed");
var testOpen = async_test("Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened");
var testClose = async_test("Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed");
var wsocket = CreateWebSocket(true, false, false);
var isOpenCalled = false;

View file

@ -6,4 +6,4 @@ test(function() {
assert_throws("SYNTAX_ERR", function() {
wsocket = CreateWebSocketWithSpaceInUrl(spaceUrl)
});
}, "W3C WebSocket API - Create Secure WebSocket - Pass a URL with a space - SYNTAX_ERR should be thrown")
}, "Create Secure WebSocket - Pass a URL with a space - SYNTAX_ERR should be thrown")

View file

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened");
var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed");
var testOpen = async_test("Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened");
var testClose = async_test("Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed");
var wsocket = CreateWebSocket(true, false, true);
var isOpenCalled = false;

View file

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be opened");
var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be closed");
var testOpen = async_test("Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be opened");
var testClose = async_test("Create Secure WebSocket - wsocket.binaryType should be set to 'blob' after connection is established - Connection should be closed");
var wsocket = CreateWebSocket(true, false, false);
var isOpenCalled = false;

View file

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - protocol should be set correctly - Connection should be opened");
var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed");
var testOpen = async_test("Create Secure WebSocket - Pass a valid URL and protocol string - protocol should be set correctly - Connection should be opened");
var testClose = async_test("Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed");
var wsocket = CreateWebSocket(true, true, false);
var isOpenCalled = false;

View file

@ -1,7 +1,7 @@
// META: script=websocket.sub.js
var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Check readyState is 1");
var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed");
var testOpen = async_test("Create Secure WebSocket - Check readyState is 1");
var testClose = async_test("Create Secure WebSocket - Pass a valid URL and protocol string - Connection should be closed");
var wsocket = CreateWebSocket(true, true, false);
var isOpenCalled = false;

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