mirror of
https://github.com/servo/servo.git
synced 2025-09-01 18:48:23 +01:00
Update web-platform-tests to revision 3cb5a99e5521936fb8819de8aaba806050b84184
This commit is contained in:
parent
1d2c0ba0bc
commit
c700482629
204 changed files with 5112 additions and 1445 deletions
|
@ -85,11 +85,11 @@ jobs:
|
|||
- template: tools/ci/azure/install_safari.yml
|
||||
- template: tools/ci/azure/update_hosts.yml
|
||||
- template: tools/ci/azure/update_manifest.yml
|
||||
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl $(Build.ArtifactStagingDirectory)/chrome.tbpl.log --log-tbpl-level info --channel dev chrome infrastructure/
|
||||
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl - --log-tbpl-level info --channel dev chrome infrastructure/
|
||||
displayName: 'Run tests: Chrome Dev'
|
||||
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl $(Build.ArtifactStagingDirectory)/firefox.tbpl.log --log-tbpl-level info --channel nightly firefox infrastructure/
|
||||
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl - --log-tbpl-level info --channel nightly firefox infrastructure/
|
||||
displayName: 'Run tests: Firefox Nightly'
|
||||
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl $(Build.ArtifactStagingDirectory)/safari.tbpl.log --log-tbpl-level info --channel preview safari infrastructure/
|
||||
- script: no_proxy='*' ./wpt run --yes --no-manifest-update --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl - --log-tbpl-level info --channel preview safari infrastructure/
|
||||
displayName: 'Run tests: Safari Technology Preview'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish results'
|
||||
|
@ -223,7 +223,7 @@ jobs:
|
|||
- template: tools/ci/azure/install_edge.yml
|
||||
- template: tools/ci/azure/update_hosts.yml
|
||||
- template: tools/ci/azure/update_manifest.yml
|
||||
- script: python ./wpt run --yes --no-manifest-update --install-fonts --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl $(Build.ArtifactStagingDirectory)/edge.tbpl.log --log-tbpl-level info --channel dev edgechromium infrastructure/
|
||||
- script: python ./wpt run --yes --no-manifest-update --install-fonts --manifest MANIFEST.json --metadata infrastructure/metadata/ --log-tbpl - --log-tbpl-level info --channel dev edgechromium infrastructure/
|
||||
displayName: 'Run tests: Edge Dev'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish results'
|
||||
|
@ -256,7 +256,7 @@ jobs:
|
|||
- template: tools/ci/azure/install_edge.yml
|
||||
- template: tools/ci/azure/update_hosts.yml
|
||||
- template: tools/ci/azure/update_manifest.yml
|
||||
- script: python ./wpt run --yes --no-manifest-update --no-restart-on-unexpected --no-fail-on-unexpected --install-fonts --this-chunk $(System.JobPositionInPhase) --total-chunks $(System.TotalJobsInPhase) --chunk-type hash --log-tbpl - --log-tbpl-level info --log-wptreport $(Build.ArtifactStagingDirectory)/wpt_report_$(System.JobPositionInPhase).json --log-wptscreenshot $(Build.ArtifactStagingDirectory)/wpt_screenshot_$(System.JobPositionInPhase).txt --channel dev edgechromium
|
||||
- script: python ./wpt run --yes --no-manifest-update --no-restart-on-unexpected --no-fail-on-unexpected --install-fonts --this-chunk $(System.JobPositionInPhase) --total-chunks $(System.TotalJobsInPhase) --chunk-type hash --log-wptreport $(Build.ArtifactStagingDirectory)/wpt_report_$(System.JobPositionInPhase).json --log-wptscreenshot $(Build.ArtifactStagingDirectory)/wpt_screenshot_$(System.JobPositionInPhase).txt --log-tbpl - --log-tbpl-level info --channel dev edgechromium
|
||||
displayName: 'Run tests: Edge Dev'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish results'
|
||||
|
@ -293,7 +293,7 @@ jobs:
|
|||
- script: |
|
||||
# TODO: drop this when `safaridriver --version` is supported.
|
||||
SAFARI_VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' /Applications/Safari.app/Contents/Info.plist) ($(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' /Applications/Safari.app/Contents/Info.plist))"
|
||||
no_proxy='*' ./wpt run --no-manifest-update --no-restart-on-unexpected --no-fail-on-unexpected --this-chunk=$(System.JobPositionInPhase) --total-chunks=$(System.TotalJobsInPhase) --chunk-type hash --log-wptreport $(Build.ArtifactStagingDirectory)/wpt_report_$(System.JobPositionInPhase).json --log-wptscreenshot $(Build.ArtifactStagingDirectory)/wpt_screenshot_$(System.JobPositionInPhase).txt --browser-version "$SAFARI_VERSION" safari
|
||||
no_proxy='*' ./wpt run --no-manifest-update --no-restart-on-unexpected --no-fail-on-unexpected --this-chunk=$(System.JobPositionInPhase) --total-chunks=$(System.TotalJobsInPhase) --chunk-type hash --log-wptreport $(Build.ArtifactStagingDirectory)/wpt_report_$(System.JobPositionInPhase).json --log-wptscreenshot $(Build.ArtifactStagingDirectory)/wpt_screenshot_$(System.JobPositionInPhase).txt --log-tbpl - --log-tbpl-level info --browser-version "$SAFARI_VERSION" safari
|
||||
displayName: 'Run tests'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish results'
|
||||
|
@ -324,7 +324,7 @@ jobs:
|
|||
- template: tools/ci/azure/install_safari.yml
|
||||
- template: tools/ci/azure/update_hosts.yml
|
||||
- template: tools/ci/azure/update_manifest.yml
|
||||
- script: no_proxy='*' ./wpt run --no-manifest-update --no-restart-on-unexpected --no-fail-on-unexpected --this-chunk=$(System.JobPositionInPhase) --total-chunks=$(System.TotalJobsInPhase) --chunk-type hash --log-wptreport $(Build.ArtifactStagingDirectory)/wpt_report_$(System.JobPositionInPhase).json --log-wptscreenshot $(Build.ArtifactStagingDirectory)/wpt_screenshot_$(System.JobPositionInPhase).txt --channel preview safari
|
||||
- script: no_proxy='*' ./wpt run --no-manifest-update --no-restart-on-unexpected --no-fail-on-unexpected --this-chunk=$(System.JobPositionInPhase) --total-chunks=$(System.TotalJobsInPhase) --chunk-type hash --log-wptreport $(Build.ArtifactStagingDirectory)/wpt_report_$(System.JobPositionInPhase).json --log-wptscreenshot $(Build.ArtifactStagingDirectory)/wpt_screenshot_$(System.JobPositionInPhase).txt --log-tbpl - --log-tbpl-level info --channel preview safari
|
||||
displayName: 'Run tests'
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish results'
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
<script src=support.js></script>
|
||||
|
||||
<script>
|
||||
var open_rq = createdb(async_test(), 'database_name', 13);
|
||||
var database_name = document.location + '-database_name';
|
||||
var open_rq = createdb(async_test(), database_name, 13);
|
||||
|
||||
open_rq.onupgradeneeded = function(e) {};
|
||||
open_rq.onsuccess = function(e) {
|
||||
var db = e.target.result;
|
||||
assert_equals(db.name, 'database_name', 'db.name');
|
||||
assert_equals(db.name, database_name, 'db.name');
|
||||
assert_equals(db.version, 13, 'db.version');
|
||||
this.done();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<script src=support.js></script>
|
||||
|
||||
<script>
|
||||
var open_rq = createdb(async_test(), 'database_name');
|
||||
var open_rq = createdb(async_test(), document.location + '-database_name');
|
||||
|
||||
open_rq.onupgradeneeded = function(e) {
|
||||
assert_equals(e.target.result.version, 1, "db.version");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<script src=support.js></script>
|
||||
|
||||
<script>
|
||||
var open_rq = createdb(async_test(), 'database_name');
|
||||
var open_rq = createdb(async_test(), document.location + '-database_name');
|
||||
|
||||
open_rq.onupgradeneeded = function() {};
|
||||
open_rq.onsuccess = function(e) {
|
||||
|
|
|
@ -7,12 +7,19 @@
|
|||
<script src='/resources/testharnessreport.js'></script>
|
||||
<script nonce='abc'>
|
||||
var t_spv = async_test("Should fire violation events for every failed violation");
|
||||
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
|
||||
assert_equals(e.violatedDirective, "script-src");
|
||||
}));
|
||||
window.addEventListener(
|
||||
"securitypolicyviolation", t_spv.unreached_func("securitypolicyviolation should not be emitted"));
|
||||
|
||||
window.addEventListener("load", function() {
|
||||
t_spv.done();
|
||||
});
|
||||
</script>
|
||||
<script src='positiveTest.js'></script>
|
||||
<script nonce='abc'>t_spv.done();</script>
|
||||
<script nonce='abc'>
|
||||
test(function() {
|
||||
assert_true(window.cspPositiveTest);
|
||||
}, "Allows scripts from the same host.");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>'self' keyword positive test</h1>
|
||||
|
|
|
@ -9,17 +9,16 @@
|
|||
<script>
|
||||
var t = async_test("Test that script does not fire violation event");
|
||||
window.addEventListener("securitypolicyviolation", t.unreached_func("Should not have fired a violation event"));
|
||||
|
||||
window.addEventListener("load", t.step_func(function() {
|
||||
assert_true(window.wildcardHostTestRan);
|
||||
t.done();
|
||||
}));
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = "http://www." + location.hostname + ":" + location.port + "/content-security-policy/generic/wildcardHostTestSuceeds.js";
|
||||
head.appendChild(script);
|
||||
</script>
|
||||
|
||||
<script>
|
||||
t.done();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>test wildcard host name matching (asterisk as a subdomain of the current domain)</h1>
|
||||
|
|
|
@ -8,8 +8,13 @@
|
|||
<script src='wildcardHostTestFailure.js'></script>
|
||||
<script>
|
||||
var t_spv = async_test("Should fire violation events for every failed violation");
|
||||
window.addEventListener("securitypolicyviolation", t_spv.step_func_done(function(e) {
|
||||
assert_equals(e.violatedDirective, "script-src-elem");
|
||||
var spvEvent;
|
||||
window.addEventListener("securitypolicyviolation", t_spv.step_func(function(e) {
|
||||
spvEvent = e;
|
||||
}));
|
||||
addEventListener("load", t_spv.step_func_done(function() {
|
||||
assert_true(!!spvEvent);
|
||||
assert_equals(spvEvent.violatedDirective, "script-src-elem");
|
||||
}));
|
||||
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
<script>
|
||||
var t = async_test("Test that script does not fire violation event");
|
||||
window.addEventListener("securitypolicyviolation", t.unreached_func("Should not have fired a violation event"));
|
||||
window.addEventListener("load", function() {
|
||||
t.done();
|
||||
});
|
||||
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var script = document.createElement('script');
|
||||
|
@ -16,10 +19,6 @@
|
|||
script.src = "http://" + location.hostname + ":{{ports[http][1]}}/content-security-policy/generic/wildcardPortTestSuceeds.js";
|
||||
head.appendChild(script);
|
||||
</script>
|
||||
|
||||
<script>
|
||||
t.done();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>test wildcard port number matching</h1>
|
||||
|
|
|
@ -18,11 +18,24 @@
|
|||
<br>
|
||||
<img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKgAAABACAIAAAABPqsMAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1QoMCC8h3if5rgAAAB10RVh0Q29tbWVudABDcmVhdGVkIHdpdGggVGhlIEdJTVDvZCVuAAAGD0lEQVR42u2aa0yTVxiA39ILxa4KIkKrVCCIitzrqkAXQiXDSFjQHyZDBRRdtoDzgooao5uaoInID4hRJFC8RBOzxQuKigyYokuDSB0WlaJQlQrITRCwte1+nKVhpbT9aGUue59fb84573dO+uR7v/drS4OfAPkf4oQfAYpHUDyC4hEUj6B4BMUjKB5B8QiKR1A8guIRFI+geATFIygeQfEIikdQPEIVxmd1GsN+w9hBrV7bN9Kn7FHWqmqLHxY3vW2ycIWtS7Yeiz9G4h0VO47eO2rj1p4cz7WhayW+kuCZwdNdpjsznIe0Q53vO1X9qsbOxrr2uprWmrb+Nofn/lvQPqs/W5oVb0KBrCDrVpZGpzE7++iHR8Ezg0ms6FIsPL7Qho+Ali3O3h+zn81gW1n5M82BuVjqqZEpyjyVeMrs1CL+IqN1AAj0CBTNElm9YGFiYc7SHKvmHJ6Lpd7K/cF0YvK5/KV+S3eLd/tP9weAlNAUaYO0qrXKJGtd2DoS6A16J5oTGZG9llnYKDEgcUPEBhI/636WL8uvelHV1t82rB1mM9geHA8fV58QzxAhTxjjE+PAXCz15ku92cLIZXFr1tWEe4UDwLk/z635dc3oWWe6s3q72o3tBgD7qvYdiD0AAH0jfbxc3sjHkfF2LF9dvsx/GQDcbLmZdCHJwkrH5mKpp8CAZiC7IpvEUd5RJrMrFqwg1pU9ykO/H2rpbQEAV7brygUrLVxz8ezFJNh2cxtVc/bkonhq3Ht5jwReX3iNV+elDVIDGKQNUpNxs0x1nkoCZY+S6mHsyUXxE30oGP7R/3tP9Y7ziyNP91J5KQCUNpTqDXoAkPhKBNME412ne6ibBEEzg6iewZ5cFE8NY4XveN8xejw1LJV0cxXPK169ewUAL9+9vP38NgA40ZxSQ1OtlpDCxMI50+ZMrPxMIBfFU4DD5ByOO2zyoRPSwtJIUPyw2DhojNPC0mhg/jU67488AxgAQMgTNv/YfPXbq5miTNEskQvDxep57MnFrt56V890YvK4vFif2D1f7QlwDyCDcafjKl9UkjhmTkx1WjUA9Az38HP5H3Qfxvb5saWx1a3VZjfdsmRL7te5pGAY0Rl0ii7FnbY7l55cqnxRSZ4ajs1F8WbEW8bkXU6aJCXFvEBWsKl80+iVBcsLMr7MAIDT8tOpl8Yt+JGzIw9KDkp8JWYLg7JHmXUr68rTKw7PRfEUxJ98cHJz+Wbjbc1lcdXb1RwmBwCEhcJ6df3oxUKesO67OgAY0g55HfUa0AxYuLJgmmD53OVigTiCFxHgHkCn0UfP7rq960jtkU+Ri+LH/ZGmf6S/pbelVlVb0lDS2Nk4ejY9PL3omyIAkHfIw06EjU2Xfy8P8QwBgI1XNxbVF9l4EheGi5AvTJibkB6R7jHFAwAMYBAXi016C4fn4jPe1p807q6/G+0dbWMTHl0cTfVIbmy3suQy8jZxUXFx1cVVk5OLXb0lAtwDbLROXgWNvaHt9I70ZlzPILFYIJ60XBRvCcvfytm/ntDU9fc/AEjdnrTcTwrjv2udTqOnhKaQOOlC0uWnl8dbmTA3oSy5DABSQlP2/rZXZ9BR2mjejHkksNwbOjwX73jzxPvH87l8AOh433Gt+ZqFlTeUN9SDagDgc/nx/vGUdpnCnJIXn0fiB+0PJi0X73jrdfvso7Mf9R8trNQZdGfkZ3ZG7yRZ15uvG6dUW1W1qtp6db2iS9HW36YeUA9qBrV6LYfJ8XPzk/hKMkWZfm5+ZLHJS4E9udjVT7Crd3dxb89qZ9FZABB0POhx12PL6+fPmN+U0QQAGp2Gn8vvHu6m9JWR2bbcnlws9RNkdchqYl32WmbVOgA8efvk/qv7AMCis5KDkyntpdFpcu7mJP+SPIFz2pOLpd5SnS9pKLExpeRhSeTsSABYH74+X5ZPBgV5gijvqAheRKBHoI+rD4/L47K4TDpzWDv8ZvCNoktR3Vp9vvF8+0D72Avak4ulHsFSj6B4BMUjKB5B8QiKR1A8guIRFI+geATFo3gExSMoHkHxCIpHUDyC4hEUj6B45HPmL9so2ZKs94sNAAAAAElFTkSuQmCC'>
|
||||
<script>
|
||||
var allowedScriptRan = true;
|
||||
setup({ explicit_done: true });
|
||||
|
||||
test(function() {
|
||||
assert_true(window.cspPositiveTest);
|
||||
}, "Allows scripts from the same host.");
|
||||
</script>
|
||||
|
||||
<div id='log'></div>
|
||||
|
||||
<script async defer src='../support/checkReport.sub.js?reportExists=false'></script>
|
||||
<script>
|
||||
var script = document.createElement('script');
|
||||
script.src = '../support/checkReport.sub.js?reportExists=false';
|
||||
script.async = true;
|
||||
script.defer = true;
|
||||
script.addEventListener('load', function() {
|
||||
done();
|
||||
});
|
||||
document.body.appendChild(script);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1 @@
|
|||
onload = function() {
|
||||
test(function() {
|
||||
assert_true(true, 'Script ran.')},
|
||||
"Allows scripts from the same host."
|
||||
);
|
||||
}
|
||||
window.cspPositiveTest = true;
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Security-Policy" content="base-uri {{location[scheme]}}://{{domains[]}}:{{ports[http][0]}}/base/">
|
||||
|
||||
<title>base-uri works correctly inside a sandboxed iframe.</title>
|
||||
<script src='/resources/testharness.js'></script>
|
||||
<script src='/resources/testharnessreport.js'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>self is derived correctly inside inside a sandboxed iframe.</h1>
|
||||
<div id='log'></div>
|
||||
|
||||
<script>
|
||||
window.addEventListener('securitypolicyviolation', function(e) {
|
||||
assert_unreached('No CSP violation report should have been fired.');
|
||||
});
|
||||
|
||||
async_test(function(t) {
|
||||
var i = document.createElement('iframe');
|
||||
i.sandbox = 'allow-scripts';
|
||||
i.style.display = 'none';
|
||||
i.srcdoc = `
|
||||
<meta http-equiv="Content-Security-Policy" content="img-src 'self'">
|
||||
<body>
|
||||
<script>
|
||||
|
||||
var img = document.createElement('img');
|
||||
img.src = '../support/fail.png';
|
||||
img.onerror = function() {
|
||||
top.postMessage('FAIL', '*');
|
||||
};
|
||||
img.onload = function() {
|
||||
top.postMessage('PASS', '*');
|
||||
};
|
||||
document.body.appendChild(img);
|
||||
</sc` + `ript></body>`;
|
||||
|
||||
window.addEventListener('message', t.step_func(function(e) {
|
||||
if (e.source === i.contentWindow) {
|
||||
assert_equals(e.data, 'PASS');
|
||||
t.done();
|
||||
}
|
||||
}));
|
||||
|
||||
document.body.appendChild(i);
|
||||
}, 'img-src \'self\' works when specified in a meta tag.');
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -34,6 +34,12 @@
|
|||
script.defer = true;
|
||||
script.src = '../support/checkReport.sub.js?reportExists=false'
|
||||
document.body.appendChild(script);
|
||||
|
||||
// Immediately declare a test so that the harness does not infer
|
||||
// completion if the image loads before the script.
|
||||
var checkReportTest = async_test("checkReport tests loaded");
|
||||
script.onload = checkReportTest.step_func_done();
|
||||
script.onerror = checkReportTest.unreached_func();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<script nonce="abc">
|
||||
var t1 = async_test("Check that we received a message from the child frame");
|
||||
|
||||
window.onmessage = function(e) {
|
||||
if (e.data == 'cookie set') {
|
||||
var s = document.createElement('script');
|
||||
|
@ -17,8 +15,6 @@
|
|||
s.defer = true;
|
||||
s.src = '../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27self%27%20%27nonce-abc%27&reportCookieName=generate-csp-report';
|
||||
document.body.appendChild(s);
|
||||
|
||||
t1.done();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
try {
|
||||
importScripts("/content-security-policy/support/post-message.js");
|
||||
postMessage("importScripts allowed");
|
||||
} catch (e) {
|
||||
postMessage("importScripts blocked");
|
||||
}
|
||||
|
|
|
@ -8,11 +8,21 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
setup({ explicit_done: true });
|
||||
|
||||
var t = async_test("Test that violation report event was fired");
|
||||
window.addEventListener("securitypolicyviolation", t.step_func_done(function(e) {
|
||||
assert_equals(e.violatedDirective, "style-src");
|
||||
}));
|
||||
window.onload = function() {
|
||||
try {
|
||||
runTests();
|
||||
} finally {
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
||||
function runTests() {
|
||||
window.nodes = document.getElementById('nodes');
|
||||
window.node1 = document.getElementById('node1');
|
||||
window.node1.style.background = "yellow";
|
||||
|
@ -101,7 +111,7 @@
|
|||
test(function() {
|
||||
assert_equals(ops.id, clonedOps.id)
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
|
|
@ -9,12 +9,18 @@ self.addEventListener('install', (event) => {
|
|||
// The subscribeToChanges calls are not done in parallel on purpose. Having
|
||||
// multiple in-flight requests introduces failure modes aside from the
|
||||
// cookie change logic that this test aims to cover.
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ name: 'cookie-name1', matchType: 'equals', url: '/scope/path1' }]);
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ }, // Test the default values for subscription properties.
|
||||
{ name: 'cookie-prefix', matchType: 'starts-with' },
|
||||
]);
|
||||
try {
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ name: 'cookie-name1', matchType: 'equals', url: '/scope/path1' }]);
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ }, // Test the default values for subscription properties.
|
||||
{ name: 'cookie-prefix', matchType: 'starts-with' },
|
||||
]);
|
||||
|
||||
// If the worker enters the "redundant" state, the UA may terminate it
|
||||
// before all tests have been reported to the client. Stifle errors in
|
||||
// order to avoid this and ensure all tests are consistently reported.
|
||||
} catch (err) {}
|
||||
})());
|
||||
});
|
||||
|
||||
|
|
|
@ -6,8 +6,14 @@ importScripts("/resources/testharness.js");
|
|||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil((async () => {
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);
|
||||
try {
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);
|
||||
|
||||
// If the worker enters the "redundant" state, the UA may terminate it
|
||||
// before all tests have been reported to the client. Stifle errors in
|
||||
// order to avoid this and ensure all tests are consistently reported.
|
||||
} catch (err) {}
|
||||
})());
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,13 @@ importScripts("/resources/testharness.js");
|
|||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil((async () => {
|
||||
await cookieStore.subscribeToChanges([]);
|
||||
try {
|
||||
await cookieStore.subscribeToChanges([]);
|
||||
|
||||
// If the worker enters the "redundant" state, the UA may terminate it
|
||||
// before all tests have been reported to the client. Stifle errors in
|
||||
// order to avoid this and ensure all tests are consistently reported.
|
||||
} catch (err) {}
|
||||
})());
|
||||
});
|
||||
|
||||
|
|
|
@ -6,8 +6,14 @@ importScripts("/resources/testharness.js");
|
|||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil((async () => {
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);
|
||||
try {
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);
|
||||
|
||||
// If the worker enters the "redundant" state, the UA may terminate it
|
||||
// before all tests have been reported to the client. Stifle errors in
|
||||
// order to avoid this and ensure all tests are consistently reported.
|
||||
} catch (err) {}
|
||||
})());
|
||||
});
|
||||
|
||||
|
|
|
@ -6,8 +6,14 @@ importScripts("/resources/testharness.js");
|
|||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil((async () => {
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);
|
||||
try {
|
||||
await cookieStore.subscribeToChanges([
|
||||
{ name: 'cookie-name', matchType: 'equals', url: '/scope/path' }]);
|
||||
|
||||
// If the worker enters the "redundant" state, the UA may terminate it
|
||||
// before all tests have been reported to the client. Stifle errors in
|
||||
// order to avoid this and ensure all tests are consistently reported.
|
||||
} catch (err) {}
|
||||
})());
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://crbug.com/972904">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div style="margin-top:-100000000px;">
|
||||
<div style="margin-bottom:-100000000px; padding-top: 1px;"></div>
|
||||
text <!-- "text" is placed at the highest possible location due to saturated margin top values. -->
|
||||
<div style="float: left; width: 60px; height: 20px;"></div>
|
||||
<div style="margin-top: 10px;">
|
||||
<div style="float: left; width: 10px;"></div>
|
||||
<div style="float: left; width: 100px; height: 100px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
test(() => { }, 'test passes if it does not crash');
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<title>List item taller than the first opportunity should not crash</title>
|
||||
<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
|
||||
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#float-position" title="9.5.1 Positioning the float: the 'float' property">
|
||||
<link rel="help" href="http://crbug.com/967997">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<div style="float: left; width: 5px; height: 5px;"></div>
|
||||
<div style="clear: left; float: left; width: 10px; height: 5px;"></div>
|
||||
<ul>
|
||||
<li></li>
|
||||
</ul>
|
||||
<script>
|
||||
test(() => {}, "Layout should not crash");
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="author" title="Google LLC" href="http://www.google.com" />
|
||||
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#line-sizing" />
|
||||
<title>css-flexbox: Tests that we use the aspect ratio, clamped by min/max, to compute the main size</title>
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht" />
|
||||
|
||||
<style>
|
||||
.flex {
|
||||
display: flex;
|
||||
width: 100px;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
width: 500px;
|
||||
min-height: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
|
||||
|
||||
<div class="flex">
|
||||
<img src="support/100x100-green.png">
|
||||
</div>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<title>CSS Flexbox: min-height: auto with nested flexboxes and percentages</title>
|
||||
<link rel="author" title="Google LLC" href="https://www.google.com/" />
|
||||
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#min-size-auto" />
|
||||
<link rel="issue" href="https://bugs.chromium.org/p/chromium/issues/detail?id=973924" />
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht" />
|
||||
|
||||
<style>
|
||||
.overlapped-green {
|
||||
position: absolute;
|
||||
background-color: green;
|
||||
width: 100px;
|
||||
height: 80px;
|
||||
z-index: 1;
|
||||
}
|
||||
.outer {
|
||||
display: flex;
|
||||
width: 100px;
|
||||
background: green;
|
||||
}
|
||||
.inner {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
.flex-item {
|
||||
height: 100%;
|
||||
margin-bottom: 20px;
|
||||
background: red;
|
||||
}
|
||||
|
||||
.inside-of-item {
|
||||
height: 100%;
|
||||
width: 100px;
|
||||
min-height: 80px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
|
||||
|
||||
<div class="overlapped-green"></div>
|
||||
<div class="outer">
|
||||
<div class="inner">
|
||||
<a class="flex-item">
|
||||
<div class="inside-of-item"></div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html>
|
||||
<div style="width: 100px; height: 100px; background: green"></div>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-multicol">
|
||||
<link rel="match" href="composited-under-clip-under-multicol-ref.html">
|
||||
<meta name="assert" content="Test that clip under multicol is correctly applied on composited child">
|
||||
<style>
|
||||
.columns {
|
||||
columns: 2;
|
||||
column-gap: 20px;
|
||||
width: 220px;
|
||||
height: 100px;
|
||||
}
|
||||
.clip {
|
||||
height: 100px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.composited {
|
||||
will-change: transform;
|
||||
margin-top: -20px;
|
||||
margin-left: -20px;
|
||||
border: 20px solid red;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<div class="columns">
|
||||
<div class="clip">
|
||||
<div class="composited"></div>
|
||||
</div>
|
||||
<div class="clip"></div>
|
||||
</div>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://crbug.com/974760">
|
||||
<meta name="assert" content="fixed children inside inline container do not crash">
|
||||
<style>
|
||||
#container {
|
||||
position: relative;
|
||||
overflow: auto;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
}
|
||||
#inline-fixed-container {
|
||||
filter:url("");
|
||||
}
|
||||
#fixed-container {
|
||||
position: fixed;
|
||||
}
|
||||
#target {
|
||||
position: fixed;
|
||||
}
|
||||
</style>
|
||||
<div id="container">
|
||||
<span id="inline-fixed-container">
|
||||
<div id="fixed-container">
|
||||
<div id="target"></div>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<script>
|
||||
test(() => {
|
||||
document.body.offsetTop;
|
||||
document.querySelector("#target").appendChild(
|
||||
document.createTextNode("foo"));
|
||||
document.body.offsetTop;
|
||||
}, 'this test passes if it does not crash');
|
||||
</script>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<title>CSS Test: Check computing min-/max-content does not cause crash</title>
|
||||
<link rel="help" href="https://crbug.com/976859">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#sizing-values">
|
||||
<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
body {
|
||||
width: fit-content;
|
||||
}
|
||||
#target {
|
||||
display: block;
|
||||
writing-mode: vertical-lr;
|
||||
columns: 2;
|
||||
}
|
||||
.after #target {
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test(() => {
|
||||
const body = document.body;
|
||||
body.offsetTop;
|
||||
body.classList.add("after");
|
||||
});
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Parsing of `appearance`</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#appearance-switching">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test(function() {
|
||||
var input = document.createElement('input');
|
||||
input.setAttribute('style', 'appearance: none;');
|
||||
|
||||
assert_equals(input.style.getPropertyValue('appearance'), 'none');
|
||||
}, 'parsing via attribute change steps of CSS declaration block\'s owner node');
|
||||
|
||||
test(function() {
|
||||
var input = document.createElement('input');
|
||||
input.style.cssText = 'appearance: none;';
|
||||
|
||||
assert_equals(input.style.getPropertyValue('appearance'), 'none');
|
||||
}, 'parsing via modification of cssText');
|
||||
|
||||
test(function(t) {
|
||||
var style = document.createElement('style');
|
||||
style.appendChild(
|
||||
document.createTextNode('#foo { appearance: none; }')
|
||||
);
|
||||
document.body.appendChild(style);
|
||||
t.add_cleanup(function() {
|
||||
document.body.removeChild(style);
|
||||
});
|
||||
|
||||
assert_equals(style.sheet.cssRules.length, 1);
|
||||
assert_equals(
|
||||
style.sheet.cssRules[0].style.getPropertyValue('appearance'),
|
||||
'none'
|
||||
);
|
||||
}, 'parsing via creation of CSS declaration block');
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Property references to `appearance`</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#appearance-switching">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function create(initialValue) {
|
||||
var style = document.createElement('input').style;
|
||||
|
||||
style.setProperty('appearance', initialValue);
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
test(function() {
|
||||
var style = create('');
|
||||
|
||||
style.setProperty('appearance', 'none');
|
||||
|
||||
assert_equals(style.appearance, 'none');
|
||||
}, 'setProperty');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
style.removeProperty('appearance');
|
||||
|
||||
assert_equals(style.appearance, '');
|
||||
}, 'removeProperty');
|
||||
|
||||
test(function() {
|
||||
var style = create('');
|
||||
|
||||
style['appearance'] = 'none';
|
||||
|
||||
assert_equals(style.appearance, 'none');
|
||||
}, 'property assignment');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
assert_equals(style.getPropertyValue('appearance'), 'none');
|
||||
}, 'getPropertyValue');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
assert_equals(style['appearance'], 'none');
|
||||
}, 'property access');
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Serialization of `appearance`</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#appearance-switching">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test(function() {
|
||||
var input = document.createElement('input');
|
||||
input.style.setProperty('appearance', 'none');
|
||||
|
||||
assert_equals(input.style.cssText, 'appearance: none;');
|
||||
}, 'serialization via CSSStyleDeclaration');
|
||||
|
||||
test(function(t) {
|
||||
var style = document.createElement('style');
|
||||
document.body.appendChild(style);
|
||||
t.add_cleanup(function() {
|
||||
document.body.removeChild(style);
|
||||
});
|
||||
style.sheet.insertRule('#foo {}', 0);
|
||||
style.sheet.cssRules[0].style.setProperty('appearance', 'none');
|
||||
|
||||
assert_equals(
|
||||
style.sheet.cssRules[0].cssText, '#foo { appearance: none; }'
|
||||
);
|
||||
}, 'serialization via CSSStyleRule');
|
||||
|
||||
test(function(t) {
|
||||
var style = document.createElement('style');
|
||||
document.body.appendChild(style);
|
||||
t.add_cleanup(function() {
|
||||
document.body.removeChild(style);
|
||||
});
|
||||
style.sheet.insertRule('@media print { #foo {} }', 0);
|
||||
style.sheet.cssRules[0].cssRules[0].style.setProperty('appearance', 'none');
|
||||
|
||||
assert_equals(
|
||||
style.sheet.cssRules[0].cssText,
|
||||
'@media print {\n #foo { appearance: none; }\n}'
|
||||
);
|
||||
}, 'serialization via CSSMediaRule');
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Parsing of `-webkit-appearance`</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#appearance-switching">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test(function() {
|
||||
var input = document.createElement('input');
|
||||
input.setAttribute('style', '-webkit-appearance: none;');
|
||||
|
||||
assert_equals(input.style.getPropertyValue('appearance'), 'none');
|
||||
}, 'parsing via attribute change steps of CSS declaration block\'s owner node');
|
||||
|
||||
test(function() {
|
||||
var input = document.createElement('input');
|
||||
input.style.cssText = '-webkit-appearance: none;';
|
||||
|
||||
assert_equals(input.style.getPropertyValue('appearance'), 'none');
|
||||
}, 'parsing via modification of cssText');
|
||||
|
||||
test(function(t) {
|
||||
var style = document.createElement('style');
|
||||
style.appendChild(
|
||||
document.createTextNode('#foo { -webkit-appearance: none; }')
|
||||
);
|
||||
document.body.appendChild(style);
|
||||
t.add_cleanup(function() {
|
||||
document.body.removeChild(style);
|
||||
});
|
||||
|
||||
assert_equals(style.sheet.cssRules.length, 1);
|
||||
assert_equals(
|
||||
style.sheet.cssRules[0].style.getPropertyValue('appearance'),
|
||||
'none'
|
||||
);
|
||||
}, 'parsing via creation of CSS declaration block');
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,128 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Property references to `-webkit-appearance`</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#appearance-switching">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
function create(initialValue) {
|
||||
var style = document.createElement('input').style;
|
||||
|
||||
style.setProperty('appearance', initialValue);
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
test(function() {
|
||||
var style = create('');
|
||||
|
||||
style.setProperty('-webkit-appearance', 'none');
|
||||
|
||||
assert_equals(style.appearance, 'none');
|
||||
}, 'setProperty - CSS property name');
|
||||
|
||||
test(function() {
|
||||
var style = create('');
|
||||
|
||||
style.setProperty('WebkitAppearance', 'none');
|
||||
|
||||
assert_equals(style.appearance, '');
|
||||
}, 'setProperty - camel-cased property name (ignored)');
|
||||
|
||||
test(function() {
|
||||
var style = create('');
|
||||
|
||||
style.setProperty('webkitAppearance', 'none');
|
||||
|
||||
assert_equals(style.appearance, '');
|
||||
}, 'setProperty - webkit-cased property name (ignored)');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
style.removeProperty('-webkit-appearance');
|
||||
|
||||
assert_equals(style.appearance, '');
|
||||
}, 'removeProperty - CSS property name');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
style.removeProperty('WebkitAppearance');
|
||||
|
||||
assert_equals(style.appearance, 'none');
|
||||
}, 'removeProperty - camel-cased property name (ignored)');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
style.removeProperty('webkitAppearance');
|
||||
|
||||
assert_equals(style.appearance, 'none');
|
||||
}, 'removeProperty - webkit-cased property name (ignored)');
|
||||
|
||||
test(function() {
|
||||
var style = create('');
|
||||
|
||||
style['-webkit-appearance'] = 'none';
|
||||
|
||||
assert_equals(style.appearance, 'none');
|
||||
}, 'property assignment - CSS property name');
|
||||
|
||||
test(function() {
|
||||
var style = create('');
|
||||
|
||||
style['WebkitAppearance'] = 'none';
|
||||
|
||||
assert_equals(style.appearance, 'none');
|
||||
}, 'property assignment - camel-cased property name');
|
||||
|
||||
test(function() {
|
||||
var style = create('');
|
||||
|
||||
style['webkitAppearance'] = 'none';
|
||||
|
||||
assert_equals(style.appearance, 'none');
|
||||
}, 'property assignment - webkit-cased property name');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
assert_equals(style.getPropertyValue('-webkit-appearance'), 'none');
|
||||
}, 'getPropertyValue - CSS property name');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
assert_equals(style.getPropertyValue('WebkitAppearance'), '');
|
||||
}, 'getPropertyValue - camel-cased property name (ignored)');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
assert_equals(style.getPropertyValue('webkitAppearance'), '');
|
||||
}, 'getPropertyValue - webkit-cased property name (ignored)');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
assert_equals(style['-webkit-appearance'], 'none');
|
||||
}, 'property access - CSS property name');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
assert_equals(style['WebkitAppearance'], 'none');
|
||||
}, 'property access - camel-cased property name');
|
||||
|
||||
test(function() {
|
||||
var style = create('none');
|
||||
|
||||
assert_equals(style['webkitAppearance'], 'none');
|
||||
}, 'property access - webkit-cased property name');
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Serialization of `-webkit-appearance`</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#appearance-switching">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test(function() {
|
||||
var input = document.createElement('input');
|
||||
input.style.setProperty('-webkit-appearance', 'none');
|
||||
|
||||
assert_equals(input.style.cssText, 'appearance: none;');
|
||||
}, 'serialization via CSSStyleDeclaration');
|
||||
|
||||
test(function(t) {
|
||||
var style = document.createElement('style');
|
||||
document.body.appendChild(style);
|
||||
t.add_cleanup(function() {
|
||||
document.body.removeChild(style);
|
||||
});
|
||||
style.sheet.insertRule('#foo {}', 0);
|
||||
style.sheet.cssRules[0].style.setProperty('-webkit-appearance', 'none');
|
||||
|
||||
assert_equals(
|
||||
style.sheet.cssRules[0].cssText, '#foo { appearance: none; }'
|
||||
);
|
||||
}, 'serialization via CSSStyleRule');
|
||||
|
||||
test(function(t) {
|
||||
var style = document.createElement('style');
|
||||
document.body.appendChild(style);
|
||||
t.add_cleanup(function() {
|
||||
document.body.removeChild(style);
|
||||
});
|
||||
style.sheet.insertRule('@media print { #foo {} }', 0);
|
||||
style.sheet.cssRules[0].cssRules[0].style.setProperty('-webkit-appearance', 'none');
|
||||
|
||||
assert_equals(
|
||||
style.sheet.cssRules[0].cssText,
|
||||
'@media print {\n #foo { appearance: none; }\n}'
|
||||
);
|
||||
}, 'serialization via CSSMediaRule');
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Verify that colors with var() references apply in visited link context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-variables/#using-variables">
|
||||
<style>
|
||||
div {
|
||||
min-height: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.color { color: green; }
|
||||
.background_color { background-color: green; }
|
||||
.border { border: medium solid green; }
|
||||
.outline { outline: medium solid green; }
|
||||
.text_decoration { text-decoration: solid underline green; }
|
||||
.column_rule { columns: 2; column-rule: medium solid green; }
|
||||
.stroke { stroke: green; fill: white; }
|
||||
.fill { fill: green; }
|
||||
</style>
|
||||
<a href="">
|
||||
<div class="color">Text should be green</div>
|
||||
<div class="background_color"></div>
|
||||
<div class="border"></div>
|
||||
<div class="border"></div>
|
||||
<div class="border"></div>
|
||||
<div class="border"></div>
|
||||
<div class="outline"></div>
|
||||
<div class="outline"></div>
|
||||
<div class="text_decoration">Underline should be green</div>
|
||||
<div class="text_decoration">Underline should be green</div>
|
||||
<div class="column_rule"><div style="height: 20px"></div></div>
|
||||
<div class="column_rule"><div style="height: 20px"></div></div>
|
||||
<svg width="20" height="50">
|
||||
<rect class="stroke" x="5" y="5" width="10" height="10" />
|
||||
<rect class="fill" x="5" y="20" width="10" height="10" />
|
||||
</svg>
|
||||
</a>
|
|
@ -0,0 +1,93 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Verify that colors with var() references apply in visited link context</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-variables/#using-variables">
|
||||
<link rel="match" href="variable-reference-visited-ref.html">
|
||||
<style>
|
||||
:root { --color: green; }
|
||||
|
||||
div {
|
||||
min-height: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.color {
|
||||
color: var(--color);
|
||||
}
|
||||
.background_color {
|
||||
background-color: var(--color);
|
||||
}
|
||||
.border_color_longhand{
|
||||
border-style: solid;
|
||||
border-width: medium;
|
||||
border-left-color: var(--color);
|
||||
border-top-color: var(--color);
|
||||
border-right-color: var(--color);
|
||||
border-bottom-color: var(--color);
|
||||
}
|
||||
.border_shorthand {
|
||||
border: medium solid var(--color);
|
||||
}
|
||||
.border_color_longhand_logical {
|
||||
border-style: solid;
|
||||
border-width: medium;
|
||||
border-inline-start-color: var(--color);
|
||||
border-inline-end-color: var(--color);
|
||||
border-block-start-color: var(--color);
|
||||
border-block-end-color: var(--color);
|
||||
}
|
||||
.border_shorthand_logical {
|
||||
border-inline: medium solid var(--color);
|
||||
border-block: medium solid var(--color);
|
||||
}
|
||||
.outline_color_longhand {
|
||||
outline-color: var(--color);
|
||||
outline-style: solid;
|
||||
outline-width: medium;
|
||||
}
|
||||
.outline_shorthand {
|
||||
outline: medium solid var(--color);
|
||||
}
|
||||
.text_decoration_color_longhand {
|
||||
text-decoration-line: underline;
|
||||
text-decoration-style: solid;
|
||||
text-decoration-color: var(--color);
|
||||
}
|
||||
.text_decoration_shorthand {
|
||||
text-decoration: solid underline var(--color);
|
||||
}
|
||||
.column_rule_color_longhand {
|
||||
columns: 2;
|
||||
column-rule-width: medium;
|
||||
column-rule-style: solid;
|
||||
column-rule-color: var(--color);
|
||||
}
|
||||
.column_rule_shorthand {
|
||||
columns: 2;
|
||||
column-rule: medium solid var(--color);
|
||||
}
|
||||
.stroke {
|
||||
stroke: var(--color);
|
||||
fill: white;
|
||||
}
|
||||
.fill {
|
||||
fill: var(--color);
|
||||
}
|
||||
</style>
|
||||
<a href="">
|
||||
<div class="color">Text should be green</div>
|
||||
<div class="background_color"></div>
|
||||
<div class="border_color_longhand"></div>
|
||||
<div class="border_shorthand"></div>
|
||||
<div class="border_color_longhand_logical"></div>
|
||||
<div class="border_shorthand_logical"></div>
|
||||
<div class="outline_color_longhand"></div>
|
||||
<div class="outline_shorthand"></div>
|
||||
<div class="text_decoration_color_longhand">Underline should be green</div>
|
||||
<div class="text_decoration_shorthand">Underline should be green</div>
|
||||
<div class="column_rule_color_longhand"><div style="height: 20px"></div></div>
|
||||
<div class="column_rule_shorthand"><div style="height: 20px"></div></div>
|
||||
<svg width="20" height="50">
|
||||
<rect class="stroke" x="5" y="5" width="10" height="10" />
|
||||
<rect class="fill" x="5" y="20" width="10" height="10" />
|
||||
</svg>
|
||||
</a>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>backdrop-filter: Correctly apply masks/clips to backdrop-filter content</title>
|
||||
<link rel="author" title="Mason Freed" href="mailto:masonfreed@chromium.org">
|
||||
|
||||
|
||||
|
||||
<p>Expected: A black circle.</p>
|
||||
|
||||
<div></div>
|
||||
|
||||
<style>
|
||||
div {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 50px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background: black;
|
||||
border-radius: 100px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>backdrop-filter: Correctly apply masks/clips to backdrop-filter content</title>
|
||||
<link rel="author" title="Mason Freed" href="mailto:masonfreed@chromium.org">
|
||||
<link rel="help" href="https://drafts.fxtf.org/filter-effects-2/#BackdropFilterProperty">
|
||||
<link rel="match" href="backdrop-filter-plus-mask-ref.html">
|
||||
|
||||
<p>Expected: A black circle.</p>
|
||||
|
||||
<div></div>
|
||||
|
||||
<style>
|
||||
div {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: 50px;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
backdrop-filter: invert(1);
|
||||
clip-path: circle(100px at center);
|
||||
}
|
||||
</style>
|
|
@ -90,6 +90,23 @@ test(function () {
|
|||
assert_attribute_log_entry(logEntries.last(), {name: 'r', oldValue: '100', newValue: null, namespace: 'http://www.w3.org/2000/svg'});
|
||||
}, 'setAttributeNode and removeAttributeNS must enqueue and invoke attributeChangedCallback for an SVG attribute');
|
||||
|
||||
test(function () {
|
||||
const instance = document.createElement(customElement.name);
|
||||
assert_array_equals(customElement.takeLog().types(), ['constructed']);
|
||||
|
||||
instance.toggleAttribute('title', true);
|
||||
assert_equals(instance.hasAttribute('title'), true);
|
||||
var logEntries = customElement.takeLog();
|
||||
assert_array_equals(logEntries.types(), ['attributeChanged']);
|
||||
assert_attribute_log_entry(logEntries.last(), {name: 'title', oldValue: null, newValue: '', namespace: null});
|
||||
|
||||
instance.toggleAttribute('title');
|
||||
assert_equals(instance.hasAttribute('title'), false);
|
||||
var logEntries = customElement.takeLog();
|
||||
assert_array_equals(logEntries.types(), ['attributeChanged']);
|
||||
assert_attribute_log_entry(logEntries.last(), {name: 'title', oldValue: '', newValue: null, namespace: null});
|
||||
}, 'toggleAttribute must enqueue and invoke attributeChangedCallback');
|
||||
|
||||
test(function () {
|
||||
const callsToOld = [];
|
||||
const callsToNew = [];
|
||||
|
|
|
@ -47,6 +47,31 @@ test(function () {
|
|||
|
||||
}, 'setAttribute and removeAttribute must enqueue and invoke attributeChangedCallback');
|
||||
|
||||
test(function () {
|
||||
var instance = document.createElement('my-custom-element');
|
||||
var anotherInstance = document.createElement('my-custom-element');
|
||||
|
||||
var callbackOrder = [];
|
||||
instance.handler = function () {
|
||||
callbackOrder.push([this, 'begin']);
|
||||
anotherInstance.toggleAttribute('data-title');
|
||||
callbackOrder.push([this, 'end']);
|
||||
}
|
||||
anotherInstance.handler = function () {
|
||||
callbackOrder.push([this, 'begin']);
|
||||
callbackOrder.push([this, 'end']);
|
||||
}
|
||||
|
||||
instance.toggleAttribute('title');
|
||||
assert_equals(callbackOrder.length, 4);
|
||||
|
||||
assert_array_equals(callbackOrder[0], [instance, 'begin']);
|
||||
assert_array_equals(callbackOrder[1], [anotherInstance, 'begin']);
|
||||
assert_array_equals(callbackOrder[2], [anotherInstance, 'end']);
|
||||
assert_array_equals(callbackOrder[3], [instance, 'end']);
|
||||
|
||||
}, 'toggleAttribute must enqueue and invoke attributeChangedCallback');
|
||||
|
||||
test(function () {
|
||||
var shouldCloneAnotherInstance = false;
|
||||
var anotherInstanceClone;
|
||||
|
|
|
@ -35,6 +35,15 @@ testAttributeRemover(function (element, name) {
|
|||
element.removeAttributeNS(null, name);
|
||||
}, 'removeAttributeNS on Element');
|
||||
|
||||
testAttributeRemover(function (element, name, value) {
|
||||
if (element.hasAttribute(name))
|
||||
element.toggleAttribute(name);
|
||||
}, 'toggleAttribute (only removes) on Element');
|
||||
|
||||
testAttributeRemover(function (element, name, value) {
|
||||
element.toggleAttribute(name, false);
|
||||
}, 'toggleAttribute (force false) on Element');
|
||||
|
||||
testAttributeAdder(function (element, name, value) {
|
||||
var attr = document.createAttribute(name);
|
||||
attr.value = value;
|
||||
|
|
3
tests/wpt/web-platform-tests/docs/.gitignore
vendored
3
tests/wpt/web-platform-tests/docs/.gitignore
vendored
|
@ -1 +1,4 @@
|
|||
_build/
|
||||
|
||||
# This directory is created to store symbolic links to additional input
|
||||
tools/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXOPTS = -W -n
|
||||
SPHINXBUILD = sphinx-build
|
||||
SOURCEDIR = .
|
||||
BUILDDIR = _build
|
||||
|
@ -13,7 +13,11 @@ help:
|
|||
|
||||
.PHONY: help Makefile
|
||||
|
||||
tools/wptserve:
|
||||
mkdir -p $(shell dirname $@)
|
||||
ln -s ../../tools/wptserve $@
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
%: Makefile tools/wptserve
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# WPT documentation
|
||||
# Project documentation tooling
|
||||
|
||||
The documentation for the web-platform-tests project is built using [the Sphinx
|
||||
documentation generator](http://www.sphinx-doc.org). [The GitHub Actions
|
||||
|
|
|
@ -3,6 +3,21 @@
|
|||
This section documents all the information necessary to administer the
|
||||
infrastructure which makes the project possible.
|
||||
|
||||
## Tooling
|
||||
|
||||
```eval_rst
|
||||
.. toctree::
|
||||
:titlesonly:
|
||||
|
||||
../README
|
||||
../tools/wptserve/docs/index.rst
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
../tools/wptserve/README
|
||||
```
|
||||
|
||||
## Secrets
|
||||
|
||||
Some aspects of the infrastructure are only accessible to administrators.
|
||||
|
|
|
@ -42,9 +42,10 @@ If you are a first-time GitHub user, read on for more details of the workflow.
|
|||
|
||||
## Fork the test repository
|
||||
|
||||
Now that you have Git set up, you will need to fork the test repository. This
|
||||
will enable you to [submit](#submit) your tests using a pull request (more on this
|
||||
[below](#submit)).
|
||||
Now that you have Git set up, you will need to "fork" the test repository. Your
|
||||
fork will be a completely independent version of the repository, hosted on
|
||||
GitHub.com. This will enable you to [submit](#submit) your tests using a pull
|
||||
request (more on this [below](#submit)).
|
||||
|
||||
1. In the browser, go to [web-platform-tests on GitHub][main-repo].
|
||||
|
||||
|
@ -61,22 +62,26 @@ will enable you to [submit](#submit) your tests using a pull request (more on th
|
|||
|
||||
If your [fork](#fork) was successful, the next step is to clone (download a copy of the files).
|
||||
|
||||
### Clone the test repo
|
||||
At the command prompt, cd into the directory where you want to keep the tests.
|
||||
### Clone the test repository
|
||||
|
||||
$ git clone https://github.com/username/wpt.git
|
||||
Open a command prompt in the directory where you want to keep the tests. Then
|
||||
execute the following command:
|
||||
|
||||
_This will download the tests into a directory named for the repo:_ `wpt/`.
|
||||
$ git clone https://github.com/username/wpt.git
|
||||
|
||||
* You should now have a full copy of the test repository on your local
|
||||
machine. Feel free to browse the directories on your hard drive. You can also
|
||||
browse them on [github.com][github-w3c] and see the full history of contributions
|
||||
there.
|
||||
This will download the tests into a directory named for the repository: `wpt/`.
|
||||
|
||||
You should now have a full copy of the test repository on your local
|
||||
machine. Feel free to browse the directories on your hard drive. You can also
|
||||
[browse them on github.com][main-repo] and see the full history of
|
||||
contributions there.
|
||||
|
||||
## Configure Remote / Upstream
|
||||
Synchronizing your forked repository with the W3C repository will enable you to
|
||||
keep your forked local copy up-to-date with the latest commits in the W3C
|
||||
repository.
|
||||
|
||||
Your forked repository is completely independent of the canonical repository,
|
||||
which is commonly referred to as the "upstream" repository. Synchronizing your
|
||||
forked repository with the upstream repository will keep your forked local copy
|
||||
up-to-date with the latest commits.
|
||||
|
||||
1. On the command line, navigate to to the directory where your forked copy of
|
||||
the repository is located.
|
||||
|
@ -127,8 +132,7 @@ At the command line:
|
|||
This will create a branch named `topic` and immediately
|
||||
switch this to be your active working branch.
|
||||
|
||||
_The branch name should describe specifically what you are testing.
|
||||
For Example:_
|
||||
The branch name should describe specifically what you are testing. For example:
|
||||
|
||||
$ git checkout -b flexbox-flex-direction-prop
|
||||
|
||||
|
@ -139,13 +143,13 @@ You're ready to start writing tests! Come back to this page you're ready to
|
|||
## Commit
|
||||
|
||||
Before you submit your tests for review and contribution to the main test
|
||||
repo, you'll need to first commit them locally, where you now have your own
|
||||
personal version control system with git. In fact, as you are writing your
|
||||
repository, you'll need to first commit them locally, where you now have your
|
||||
own personal version control system with git. In fact, as you are writing your
|
||||
tests, you may want to save versions of your work as you go before you submit
|
||||
them to be reviewed and merged.
|
||||
|
||||
1. When you're ready to save a version of your work, go to the command
|
||||
prompt and cd to the directory where your files are.
|
||||
1. When you're ready to save a version of your work, open a command
|
||||
prompt and change to the directory where your files are.
|
||||
|
||||
2. First, ask git what new or modified files you have:
|
||||
|
||||
|
@ -163,17 +167,16 @@ them to be reviewed and merged.
|
|||
$ git add [directory_of_files]
|
||||
|
||||
4. Run `git status` again to see what you have on the 'Changes to be
|
||||
committed' list. These files are now 'staged'.
|
||||
committed' list. These files are now 'staged'. Alternatively, you can run
|
||||
`git diff --staged` to see a visual representation of the changes to be
|
||||
committed.
|
||||
|
||||
5. Alternatively, you can run `git diff --staged`, which will show you the
|
||||
diff of things to be committed.
|
||||
|
||||
6. Once you've added everything, you can commit and add a message to this
|
||||
5. Once you've added everything, you can commit and add a message to this
|
||||
set of changes:
|
||||
|
||||
$ git commit -m "Tests for indexed getters in the HTMLExampleInterface"
|
||||
|
||||
7. Repeat these steps as many times as you'd like before you submit.
|
||||
6. Repeat these steps as many times as you'd like before you submit.
|
||||
|
||||
## Verify
|
||||
|
||||
|
@ -181,10 +184,8 @@ The Web Platform Test project has an automated tool
|
|||
to verify that coding conventions have been followed,
|
||||
and to catch a number of common mistakes.
|
||||
|
||||
You can and should run this tool locally.
|
||||
It will be run on your submissions anyway,
|
||||
and any failure will be grounds for rejection,
|
||||
so you might as well fix them first.
|
||||
We recommend running this tool locally. That will help you discover and fix
|
||||
issues that would make it hard for us to accept your contribution.
|
||||
|
||||
1. On the command line, navigate to to the directory where your clone
|
||||
of the repository is located.
|
||||
|
@ -201,21 +202,21 @@ If you're here now looking for more instructions, that means you've written
|
|||
some awesome tests and are ready to submit them. Congratulations and welcome
|
||||
back!
|
||||
|
||||
1. The first thing you do before submitting them to the W3C repo is to push
|
||||
them back up to the server:
|
||||
1. The first thing you do before submitting them to the web-platform-tests
|
||||
repository is to push them back up to your fork:
|
||||
|
||||
$ git push origin topic
|
||||
|
||||
_Note: Here,_ `origin` _refers to remote repo from which you cloned
|
||||
_Note: Here,_ `origin` _refers to remote repository from which you cloned
|
||||
(downloaded) the files after you forked, referred to as
|
||||
web-platform-tests.git in the previous example;_
|
||||
`topic` _refers to the name of your local branch that
|
||||
you want to push_.
|
||||
you want to share_.
|
||||
|
||||
2. Now you can send a message that you have changes or additions you'd like
|
||||
to be reviewed and merged into the main (original) test repository. You do
|
||||
this by using a pull request. In a browser, open the GitHub page for your
|
||||
forked repository: **https://github.com/username/wpt**.
|
||||
this by creating a pull request. In a browser, open the GitHub page for
|
||||
your forked repository: **https://github.com/username/wpt**.
|
||||
|
||||
3. Now create the pull request. There are several ways to create a PR in the
|
||||
GitHub UI. Below is one method and others can be found on
|
||||
|
@ -223,17 +224,16 @@ GitHub UI. Below is one method and others can be found on
|
|||
|
||||
1. Click the  button.
|
||||
|
||||
2. On the left, you should see the base repo is the
|
||||
2. On the left, you should see the base repository is the
|
||||
web-platform-tests/wpt. On the right, you should see your fork of that
|
||||
repo. In the branch menu of your forked repo, switch to `topic`
|
||||
repository. In the branch menu of your forked repository, switch to `topic`
|
||||
|
||||
**Note:** If you see _'There isn't anything to compare'_,
|
||||
make sure your fork and your `topic`
|
||||
branch is selected on the right side.
|
||||
If you see "There isn't anything to compare", make sure your fork and
|
||||
your `topic` branch is selected on the right side.
|
||||
|
||||
3. Select the  button at the top.
|
||||
|
||||
4. Scroll down and review the diff
|
||||
4. Scroll down and review the summary of changes.
|
||||
|
||||
5. Scroll back up and in the Title field, enter a brief description for
|
||||
your submission.
|
||||
|
@ -251,12 +251,11 @@ accepted, delete your branch (see '[When Pull Request is Accepted](#cleanup)').
|
|||
|
||||
That's it! Your pull request will go into a queue and will be reviewed soon.
|
||||
|
||||
## Modify
|
||||
## Refine
|
||||
|
||||
Once you submit your pull request, a reviewer will check your proposed changes
|
||||
for correctness and style. It is likely that this process will lead to some
|
||||
comments asking for modifications to your code. When you are ready to make the
|
||||
changes, follow these steps:
|
||||
for correctness and style. They may ask you to modify your code. When you are
|
||||
ready to make the changes, follow these steps:
|
||||
|
||||
1. Check out the branch corresponding to your changes e.g. if your branch was
|
||||
called `topic`
|
||||
|
@ -280,11 +279,11 @@ platform.
|
|||
|
||||
## Cleanup
|
||||
Once your pull request has been accepted, you will be notified in the GitHub
|
||||
UI and you may get an email. At this point, your changes have been merged
|
||||
user interface, and you may get an email. At this point, your changes have been merged
|
||||
into the main test repository. You do not need to take any further action
|
||||
on the test but you should delete your branch. This can easily be done in
|
||||
the GitHub UI by navigating to the pull requests and clicking the
|
||||
'Delete Branch' button.
|
||||
the GitHub user interface by navigating to the pull request and clicking the
|
||||
"Delete Branch" button.
|
||||
|
||||

|
||||
|
||||
|
@ -391,7 +390,6 @@ you may also discard your connection to their repo:
|
|||
[git]: https://git-scm.com/downloads
|
||||
[git-book]: https://git-scm.com/book
|
||||
[github]: https://github.com/
|
||||
[github-w3c]: https://github.com/w3c
|
||||
[github-fork-docs]: https://help.github.com/articles/fork-a-repo
|
||||
[github-createpr]: https://help.github.com/articles/creating-a-pull-request
|
||||
[help]: https://help.github.com/
|
||||
|
|
|
@ -11,7 +11,12 @@ delimit text to be replaced and `#` represents a digit.
|
|||
|
||||
### Test
|
||||
|
||||
``` html
|
||||
<!--
|
||||
Syntax highlighting cannot be enabled for the following template because it
|
||||
contains invalid CSS.
|
||||
-->
|
||||
|
||||
```
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>${1:Test title}</title>
|
||||
|
@ -28,7 +33,12 @@ Filename: `{test-topic}-###.html`
|
|||
|
||||
### Reference:
|
||||
|
||||
``` html
|
||||
<!--
|
||||
Syntax highlighting cannot be enabled for the following template because it
|
||||
contains invalid CSS.
|
||||
-->
|
||||
|
||||
```
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>${1:Reference title}</title>
|
||||
|
|
|
@ -58,6 +58,11 @@ source_suffix = '.rst'
|
|||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# These values are used in the documentation of wptserve but are not recognized
|
||||
# by Sphinx.
|
||||
# https://stackoverflow.com/questions/51824453/how-to-document-parameter-of-type-function-in-sphinx
|
||||
nitpick_ignore = [('py:class', 'Callable'), ('py:obj', 'None')]
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
|
@ -71,10 +76,7 @@ language = None
|
|||
exclude_patterns = [
|
||||
'_build',
|
||||
'Thumbs.db',
|
||||
'.DS_Store',
|
||||
'tools/.tox',
|
||||
'tools/third_party',
|
||||
'_venv'
|
||||
'.DS_Store'
|
||||
]
|
||||
|
||||
# Enable inline reStructured Text within Markdown-formatted files
|
||||
|
|
|
@ -76,7 +76,7 @@ expectations:
|
|||
expected. They get their name from the JavaScript harness that's used to
|
||||
execute them.
|
||||
|
||||
* [wdspec]() tests are written in Python and test [the WebDriver browser
|
||||
* [wdspec][] tests are written in Python and test [the WebDriver browser
|
||||
automation protocol](https://w3c.github.io/webdriver/)
|
||||
|
||||
* [Manual tests][manual] rely on a human to run them and determine their
|
||||
|
|
|
@ -25,6 +25,10 @@ if errorlevel 9009 (
|
|||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist tools\ ( mkdir tools )
|
||||
|
||||
if not exist tools\wptserve\ ( mklink /d tools\wptserve ..\..\tools\wptserve )
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
|
||||
goto end
|
||||
|
||||
|
|
|
@ -48,6 +48,16 @@ python wpt make-hosts-file | Out-File %SystemRoot%\System32\drivers\etc\hosts -E
|
|||
If you are behind a proxy, you also need to make sure the domains above are
|
||||
excluded from your proxy lookups.
|
||||
|
||||
[The Ahem font](../writing-tests/ahem) is used to test precise rendering
|
||||
behavior. [Download the font][download-ahem] and install it using the
|
||||
appropriate steps for your platform:
|
||||
|
||||
- On Windows, right-click the downloaded file in File Explorer/Windows Explorer
|
||||
(depending on Windows version) and select "Install" from the menu.
|
||||
- On macOS, open the downloaded file in Font Book (the default application for
|
||||
font files) and then click install.
|
||||
- On Linux, copy the file to `~/.local/share/fonts` and then run `fc-cache`.
|
||||
|
||||
### Windows Notes
|
||||
|
||||
Generally Windows Subsystem for Linux will provide the smoothest user
|
||||
|
@ -115,6 +125,13 @@ customising the test run:
|
|||
[A complete listing of the command-line arguments is available
|
||||
here](command-line-arguments).
|
||||
|
||||
```eval_rst
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
command-line-arguments
|
||||
```
|
||||
|
||||
Additional browser-specific documentation:
|
||||
|
||||
```eval_rst
|
||||
|
@ -124,3 +141,5 @@ Additional browser-specific documentation:
|
|||
chrome_android
|
||||
safari
|
||||
```
|
||||
|
||||
[download-ahem]: https://github.com/web-platform-tests/wpt/raw/master/fonts/Ahem.ttf
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
A font called [Ahem][ahem-readme] has been developed which consists of
|
||||
some very well defined glyphs of precise sizes and shapes; it is
|
||||
especially useful for testing font and text properties.
|
||||
especially useful for testing font and text properties. Installation
|
||||
instructions are available in [Running Tests from the Local
|
||||
System](../running-tests/from-local-system).
|
||||
|
||||
The font's em-square is exactly square. Its ascent and descent
|
||||
combined is exactly the size of the em square; this means that the
|
||||
|
@ -73,20 +75,4 @@ div {
|
|||
}
|
||||
```
|
||||
|
||||
## Installing Ahem
|
||||
|
||||
After [downloading][download-ahem] the font, installation instructions
|
||||
vary between platforms:
|
||||
|
||||
On Windows, right-click the downloaded file in File Explorer/Windows
|
||||
Explorer (depending on Windows version) and select "Install" from the
|
||||
menu.
|
||||
|
||||
On macOS, open the downloaded file in Font Book (the default
|
||||
application for font files) and then click install.
|
||||
|
||||
On Linux, copy the file to `~/.local/share/fonts` and then run
|
||||
`fc-cache`.
|
||||
|
||||
[ahem-readme]: https://www.w3.org/Style/CSS/Test/Fonts/Ahem/README
|
||||
[download-ahem]: https://github.com/web-platform-tests/wpt/raw/master/fonts/Ahem.ttf
|
||||
|
|
|
@ -51,36 +51,15 @@ href="https://www.w3.org/TR/CSS21/colors.html#background-properties" />
|
|||
<th>Token</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>animated</td>
|
||||
<td>Test is animated in final state. (Cannot be verified using
|
||||
reftests/screenshots.)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>asis</td>
|
||||
<td>The test has particular markup formatting requirements and
|
||||
cannot be re-serialized.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>font</td>
|
||||
<td>Requires a specific font to be installed at the OS level. (A link to the
|
||||
font to be installed must be provided; this is not needed if only web
|
||||
fonts are used.)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>history</td>
|
||||
<td>User agent session history is required. Testing :visited is a
|
||||
good example where this may be used.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HTMLonly</td>
|
||||
<td>Test case is only valid for HTML</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>interact</td>
|
||||
<td>Requires human interaction (such as for testing scrolling
|
||||
behavior)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>invalid</td>
|
||||
<td>Tests handling of invalid CSS. Note: This case contains CSS
|
||||
|
@ -109,6 +88,38 @@ href="https://www.w3.org/TR/CSS21/colors.html#background-properties" />
|
|||
<td>Behavior tested is RECOMMENDED, but not REQUIRED. <a
|
||||
href="https://www.ietf.org/rfc/rfc2119.txt">[RFC2119]</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
The following flags are **deprecated** and should not be declared by new tests.
|
||||
Tests which satisfy the described criteria should simply be designated as
|
||||
"manual" using [the `-manual` file name flag][file-name-flags].
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Token</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>animated</td>
|
||||
<td>Test is animated in final state. (Cannot be verified using
|
||||
reftests/screenshots.)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>font</td>
|
||||
<td>Requires a specific font to be installed at the OS level. (A link to the
|
||||
font to be installed must be provided; this is not needed if only web
|
||||
fonts are used.)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>history</td>
|
||||
<td>User agent session history is required. Testing :visited is a
|
||||
good example where this may be used.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>interact</td>
|
||||
<td>Requires human interaction (such as for testing scrolling
|
||||
behavior)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>speech</td>
|
||||
<td>Device supports audio output. Text-to-speech (TTS) engine
|
||||
|
@ -130,7 +141,7 @@ Example 1 (one token applies):
|
|||
Example 2 (multiple tokens apply):
|
||||
|
||||
``` html
|
||||
<meta name="flags" content="ahem image scroll" />
|
||||
<meta name="flags" content="asis HTMLonly may" />
|
||||
```
|
||||
|
||||
Example 3 (no tokens apply):
|
||||
|
@ -178,3 +189,5 @@ Examples of good test assertions:
|
|||
* "This test checks that 'text-indent' affects only the first line
|
||||
of a block container if that line is also the first formatted line
|
||||
of an element."
|
||||
|
||||
[file-name-flags]: {{ site.baseurl }}{% link _writing-tests/file-names.md %}
|
||||
|
|
|
@ -16,7 +16,7 @@ The wptserver implements a number of Python APIs for controlling traffic.
|
|||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
request
|
||||
response
|
||||
stash
|
||||
/tools/wptserve/docs/request
|
||||
/tools/wptserve/docs/response
|
||||
/tools/wptserve/docs/stash
|
||||
```
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
```eval_rst
|
||||
.. include:: ../../../tools/wptserve/docs/request.rst
|
||||
```
|
|
@ -1,3 +0,0 @@
|
|||
```eval_rst
|
||||
.. include:: ../../../tools/wptserve/docs/response.rst
|
||||
```
|
|
@ -1,3 +0,0 @@
|
|||
```eval_rst
|
||||
.. include:: ../../../tools/wptserve/docs/stash.rst
|
||||
```
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Element Timing: observe generated CSS text</title>
|
||||
<style>
|
||||
p::before {
|
||||
content: "Generated text prefix";
|
||||
}
|
||||
body {
|
||||
margin: 20px;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/element-timing-helpers.js"></script>
|
||||
<p elementtiming='my_text' id='text_id'></p>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
const beforeRender = performance.now();
|
||||
if (!window.PerformanceElementTiming) {
|
||||
assert_unreached("PerformanceElementTiming is not implemented");
|
||||
}
|
||||
const observer = new PerformanceObserver(
|
||||
t.step_func_done(function(entryList) {
|
||||
assert_equals(entryList.getEntries().length, 1);
|
||||
const entry = entryList.getEntries()[0];
|
||||
checkTextElement(entry, 'my_text', 'text_id', beforeRender, document.getElementById('text_id'));
|
||||
assert_equals(entry.intersectionRect.left, 20, 'left should be 20.');
|
||||
assert_equals(entry.intersectionRect.top, 20, 'top should be 20.');
|
||||
// Try a lower bound of height=10, width=80 for the generated text.
|
||||
assert_greater_than_equal(entry.intersectionRect.right, 100);
|
||||
assert_greater_than_equal(entry.intersectionRect.bottom, 30);
|
||||
})
|
||||
);
|
||||
observer.observe({type: 'element', buffered: true});
|
||||
}, 'Generated text content is observable.');
|
||||
</script>
|
||||
</body>
|
|
@ -1,50 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Element Timing: observe large elements</title>
|
||||
<body>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/element-timing-helpers.js"></script>
|
||||
<script>
|
||||
let beforeRender;
|
||||
let img;
|
||||
async_test(function (t) {
|
||||
if (!window.PerformanceElementTiming) {
|
||||
assert_unreached("PerformanceElementTiming is not implemented");
|
||||
}
|
||||
const observer = new PerformanceObserver(
|
||||
t.step_func_done(function(entryList) {
|
||||
assert_equals(entryList.getEntries().length, 1);
|
||||
const entry = entryList.getEntries()[0];
|
||||
const index = window.location.href.lastIndexOf('/');
|
||||
const pathname = window.location.href.substring(0, index) +
|
||||
'/resources/square20.jpg';
|
||||
checkElement(entry, pathname, '', 'large_one', beforeRender, img);
|
||||
// Assume viewport hasn't changed, so the element occupies all of it.
|
||||
checkRect(entry,
|
||||
[0, document.documentElement.clientWidth, 0, document.documentElement.clientHeight]);
|
||||
checkNaturalSize(entry, 20, 20);
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ['element']});
|
||||
// We add the image during onload to be sure that the observer is registered
|
||||
// in time for it to observe the element timing.
|
||||
window.onload = () => {
|
||||
// Add an image setting width and height equal to viewport.
|
||||
img = document.createElement('img');
|
||||
img.src = 'resources/square20.jpg';
|
||||
img.width = document.documentElement.clientWidth;
|
||||
img.height = document.documentElement.clientHeight;
|
||||
img.setAttribute('id', 'large_one');
|
||||
document.body.appendChild(img);
|
||||
beforeRender = performance.now();
|
||||
};
|
||||
}, 'Large img element is observable.');
|
||||
</script>
|
||||
|
||||
</body>
|
|
@ -11,8 +11,6 @@ body {
|
|||
<script src="resources/element-timing-helpers.js"></script>
|
||||
<div id='target'></div>
|
||||
<script>
|
||||
let beforeRender;
|
||||
let img;
|
||||
async_test(function (t) {
|
||||
if (!window.PerformanceElementTiming) {
|
||||
assert_unreached("PerformanceElementTiming is not implemented");
|
||||
|
@ -27,13 +25,12 @@ body {
|
|||
// in time for it to observe the element timing.
|
||||
window.onload = () => {
|
||||
// Add image of width equal to 100 and height equal to 100.
|
||||
img = document.createElement('img');
|
||||
const img = document.createElement('img');
|
||||
img.src = 'resources/square100.png';
|
||||
img.setAttribute('elementtiming', 'my_image');
|
||||
img.setAttribute('id', 'my_id');
|
||||
const shadowRoot = document.getElementById('target').attachShadow({mode: 'closed'});
|
||||
const shadowRoot = document.getElementById('target').attachShadow({mode: 'open'});
|
||||
shadowRoot.appendChild(img);
|
||||
beforeRender = performance.now();
|
||||
t.step_timeout(() => {
|
||||
// Assume entry was not dispatched, so test passes.
|
||||
t.done();
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Element Timing: do not observe text in shadow tree</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/element-timing-helpers.js"></script>
|
||||
<div id='target'></div>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
if (!window.PerformanceElementTiming) {
|
||||
assert_unreached("PerformanceElementTiming is not implemented");
|
||||
}
|
||||
const observer = new PerformanceObserver(
|
||||
t.step_func_done(function(entryList) {
|
||||
assert_unreached('Should not observe text elements in shadow trees!');
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ['element']});
|
||||
// We add the text during onload to be sure that the observer is registered
|
||||
// in time for it to observe the element timing.
|
||||
window.onload = () => {
|
||||
// Add text of width equal to 100 and height equal to 100.
|
||||
const text = document.createElement('p');
|
||||
text.innerHTML = 'Text';
|
||||
text.setAttribute('elementtiming', 'my_text');
|
||||
const shadowRoot = document.getElementById('target').attachShadow({mode: 'open'});
|
||||
shadowRoot.appendChild(text);
|
||||
t.step_timeout(() => {
|
||||
// Assume entry was not dispatched, so test passes.
|
||||
t.done();
|
||||
}, 500);
|
||||
};
|
||||
}, 'Text in shadow tree with elementtiming attribute is not observable.');
|
||||
</script>
|
|
@ -25,11 +25,11 @@ p {
|
|||
assert_equals(entryList.getEntries().length, 1);
|
||||
const entry = entryList.getEntries()[0];
|
||||
checkTextElement(entry, 'my_text', 'text_id', beforeRender, paragraph);
|
||||
assert_equals(entry.intersectionRect.left, 20);
|
||||
assert_equals(entry.intersectionRect.left, 20, 'left should be 20.');
|
||||
// Text box size will vary from device to device, so try lower bounding height by 12, width by 100.
|
||||
assert_greater_than_equal(entry.intersectionRect.right, 120);
|
||||
|
||||
assert_equals(entry.intersectionRect.top, 20);
|
||||
assert_equals(entry.intersectionRect.top, 20, 'top should be 20.');
|
||||
assert_greater_than_equal(entry.intersectionRect.bottom, 32);
|
||||
})
|
||||
);
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/fetch/sec-metadata/resources/helper.js></script>
|
||||
<script src=/fetch/sec-metadata/resources/redirectTestHelper.sub.js></script>
|
||||
<script src=/common/security-features/resources/common.js></script>
|
||||
<script src=/common/utils.js></script>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: myDowngradeUpgradeFont;
|
||||
src: url(https://{{host}}:{{ports[https][0]}}/fetch/api/resources/redirect.py?location=http%3A%2F%2F{{host}}%3A{{ports[http][0]}}%2Ffetch%2Fapi%2Fresources%2Fredirect.py%3Flocation%3Dhttps%253A%252F%252F{{host}}%253A{{ports[https][0]}}%252Ffetch%252Fsec-metadata%252Fresources%252Frecord-header.py%253Ffile%253Dfont-https-downgrade-upgrade);
|
||||
}
|
||||
#fontTest {
|
||||
font-family: myDowngradeUpgradeFont;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="fontTest">Downgraded then upgraded font</div>
|
||||
<script>
|
||||
let nonce = token();
|
||||
let expected = { "dest": "", "site": "same-site", "user": "", "mode": "" };
|
||||
|
||||
// Validate various scenarios handle a request that redirects from https => http
|
||||
// correctly and avoids disclosure of any Sec- headers.
|
||||
RunCommonRedirectTests("Https downgrade-upgrade", MultipleRedirectTo, expected);
|
||||
|
||||
document.fonts.ready.then(function () {
|
||||
promise_test(t => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let key = "font-https-downgrade-upgrade";
|
||||
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
|
||||
.then(response => response.text())
|
||||
.then(text => assert_header_equals(text, expected))
|
||||
.then(_ => resolve())
|
||||
.catch(e => reject(e));
|
||||
});
|
||||
}, "Https downgrade-upgrade font => No headers");
|
||||
});
|
||||
|
||||
promise_test(() =>
|
||||
requestViaImage(secureRedirectURL + encodeURIComponent(insecureRedirectURL + encodeURIComponent("https://{{host}}:{{ports[https][0]}}/common/security-features/subresource/image.py")))
|
||||
.then(result => {
|
||||
headers = result.headers;
|
||||
got = {
|
||||
"dest": headers["sec-fetch-dest"],
|
||||
"mode": headers["sec-fetch-mode"],
|
||||
"site": headers["sec-fetch-site"],
|
||||
"user": headers["sec-fetch-user"]
|
||||
};
|
||||
assert_header_equals(got, {
|
||||
// Note that we're using `undefined` here, as opposed to "" elsewhere because of the way
|
||||
// that `image.py` encodes data.
|
||||
"dest": undefined,
|
||||
"site": "same-site",
|
||||
"user": undefined,
|
||||
"mode": undefined,
|
||||
});
|
||||
}), "Https downgrade-upgrade image => No headers");
|
||||
</script>
|
||||
<script src="https://{{host}}:{{ports[https][0]}}/fetch/api/resources/redirect.py?location=http%3A%2F%2F{{host}}%3A{{ports[http][0]}}%2Ffetch%2Fapi%2Fresources%2Fredirect.py%3Flocation%3Dhttps%253A%252F%252F{{host}}%253A{{ports[https][0]}}%252Ffetch%252Fsec-metadata%252Fresources%252Fecho-as-script.py"></script>
|
||||
<script>
|
||||
test(t => {
|
||||
t.add_cleanup(_ => { header = null; });
|
||||
assert_header_equals(header, expected);
|
||||
}, "Https downgrade-upgrade script => No headers");
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/fetch/sec-metadata/resources/helper.js></script>
|
||||
<script src=/fetch/sec-metadata/resources/redirectTestHelper.sub.js></script>
|
||||
<script src=/common/security-features/resources/common.js></script>
|
||||
<script src=/common/utils.js></script>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: myUpgradedFont;
|
||||
src: url(http://{{host}}:{{ports[http][0]}}/fetch/api/resources/redirect.py?location=https%3A%2F%2F{{host}}%3A{{ports[https][0]}}%2Ffetch%2Fsec-metadata%2Fresources%2Frecord-header.py%3Ffile%3Dfont-https-upgrade);
|
||||
}
|
||||
#fontTest {
|
||||
font-family: myUpgradedFont;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="fontTest">Upgraded font</div>
|
||||
<script>
|
||||
let nonce = token();
|
||||
let expected = { "dest": "", "site": "same-site", "user": "", "mode": "" };
|
||||
|
||||
// Validate various scenarios handle a request that redirects from http => https correctly and add the proper Sec- headers.
|
||||
RunCommonRedirectTests("Http upgrade", upgradeRedirectTo, expected);
|
||||
|
||||
document.fonts.ready.then(function () {
|
||||
promise_test(t => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let key = "font-https-upgrade";
|
||||
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
|
||||
.then(response => response.text())
|
||||
.then(text => assert_header_equals(text, expected))
|
||||
.then(_ => resolve())
|
||||
.catch(e => reject(e));
|
||||
});
|
||||
}, "Http upgrade font => No headers");
|
||||
});
|
||||
|
||||
promise_test(() =>
|
||||
requestViaImage(insecureRedirectURL + encodeURIComponent("https://{{host}}:{{ports[https][0]}}/common/security-features/subresource/image.py"))
|
||||
.then(result => {
|
||||
headers = result.headers;
|
||||
got = {
|
||||
"dest": headers["sec-fetch-dest"],
|
||||
"mode": headers["sec-fetch-mode"],
|
||||
"site": headers["sec-fetch-site"],
|
||||
"user": headers["sec-fetch-user"]
|
||||
};
|
||||
assert_header_equals(got, {
|
||||
// Note that we're using `undefined` here, as opposed to "" elsewhere because of the way
|
||||
// that `image.py` encodes data.
|
||||
"dest": undefined,
|
||||
"site": "same-site",
|
||||
"user": undefined,
|
||||
"mode": undefined,
|
||||
});
|
||||
}), "Http upgrade image => No headers");
|
||||
</script>
|
||||
<script src="http://{{host}}:{{ports[http][0]}}/fetch/api/resources/redirect.py?location=https%3A%2F%2F{{host}}%3A{{ports[https][0]}}%2Ffetch%2Fsec-metadata%2Fresources%2Fecho-as-script.py"></script>
|
||||
<script>
|
||||
test(t => {
|
||||
t.add_cleanup(_ => { header = null; });
|
||||
assert_header_equals(header, expected);
|
||||
}, "Http upgrade script => No headers");
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/fetch/sec-metadata/resources/helper.js></script>
|
||||
<script src=/fetch/sec-metadata/resources/redirectTestHelper.sub.js></script>
|
||||
<script src=/common/security-features/resources/common.js></script>
|
||||
<script src=/common/utils.js></script>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: myDowngradedFont;
|
||||
src: url(https://{{host}}:{{ports[https][0]}}/fetch/api/resources/redirect.py?location=http%3A%2F%2F{{host}}%3A{{ports[http][0]}}%2Ffetch%2Fsec-metadata%2Fresources%2Frecord-header.py%3Ffile%3Dfont-https-downgrade);
|
||||
}
|
||||
#fontTest {
|
||||
font-family: myDowngradedFont;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="fontTest">Downgraded font</div>
|
||||
<script>
|
||||
let nonce = token();
|
||||
let expected = { "dest": "", "site": "", "user": "", "mode": "" };
|
||||
|
||||
// Validate various scenarios handle a request that redirects from https => http correctly and avoids disclosure of any Sec- headers.
|
||||
RunCommonRedirectTests("Https downgrade", downgradeRedirectTo, expected);
|
||||
|
||||
document.fonts.ready.then(function () {
|
||||
promise_test(t => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let key = "font-https-downgrade";
|
||||
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
|
||||
.then(response => response.text())
|
||||
.then(text => assert_header_equals(text, expected))
|
||||
.then(_ => resolve())
|
||||
.catch(e => reject(e));
|
||||
});
|
||||
}, "Https downgrade font => No headers");
|
||||
});
|
||||
|
||||
promise_test(() =>
|
||||
requestViaImage(secureRedirectURL + encodeURIComponent("http://{{host}}:{{ports[http][0]}}/common/security-features/subresource/image.py"))
|
||||
.then(result => {
|
||||
headers = result.headers;
|
||||
got = {
|
||||
"dest": headers["sec-fetch-dest"],
|
||||
"mode": headers["sec-fetch-mode"],
|
||||
"site": headers["sec-fetch-site"],
|
||||
"user": headers["sec-fetch-user"]
|
||||
};
|
||||
assert_header_equals(got, {
|
||||
// Note that we're using `undefined` here, as opposed to "" elsewhere because of the way
|
||||
// that `image.py` encodes data.
|
||||
"dest": undefined,
|
||||
"site": undefined,
|
||||
"user": undefined,
|
||||
"mode": undefined,
|
||||
});
|
||||
}), "Https downgrade image => No headers");
|
||||
</script>
|
||||
|
||||
<script src="https://{{host}}:{{ports[https][0]}}/fetch/api/resources/redirect.py?location=http%3A%2F%2F{{host}}%3A{{ports[http][0]}}%2Ffetch%2Fsec-metadata%2Fresources%2Fecho-as-script.py"></script>
|
||||
<script>
|
||||
test(t => {
|
||||
t.add_cleanup(_ => { header = null; });
|
||||
assert_header_equals(header, expected);
|
||||
}, "Https downgrade script => No headers");
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,181 @@
|
|||
function createVideoElement() {
|
||||
let el = document.createElement('video');
|
||||
el.src = "/media/movie_5.mp4";
|
||||
el.setAttribute("controls", "");
|
||||
el.setAttribute("crossorigin", "");
|
||||
return el;
|
||||
}
|
||||
|
||||
function createTrack() {
|
||||
let el = document.createElement("track");
|
||||
el.setAttribute("default", "");
|
||||
el.setAttribute("kind", "captions");
|
||||
el.setAttribute("srclang", "en");
|
||||
return el;
|
||||
}
|
||||
|
||||
let secureRedirectURL = "https://{{host}}:{{ports[https][0]}}/fetch/api/resources/redirect.py?location=";
|
||||
let insecureRedirectURL = "http://{{host}}:{{ports[http][0]}}/fetch/api/resources/redirect.py?location=";
|
||||
let secureTestURL = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/";
|
||||
let insecureTestURL = "http://{{host}}:{{ports[http][0]}}/fetch/sec-metadata/";
|
||||
|
||||
// Helper to craft an URL that will go from HTTPS => HTTP => HTTPS to
|
||||
// simulate us downgrading then upgrading again during the same redirect chain.
|
||||
function MultipleRedirectTo(partialPath) {
|
||||
let finalURL = insecureRedirectURL + encodeURIComponent(secureTestURL + partialPath);
|
||||
return insecureRedirectURL + encodeURIComponent(finalURL);
|
||||
}
|
||||
|
||||
// Helper to craft an URL that will go from HTTP => HTTPS to simulate upgrading a
|
||||
// given request.
|
||||
function upgradeRedirectTo(partialPath) {
|
||||
return insecureRedirectURL + encodeURIComponent(secureTestURL + partialPath);
|
||||
}
|
||||
|
||||
// Helper to craft an URL that will go from HTTPS => HTTP to simulate downgrading a
|
||||
// given request.
|
||||
function downgradeRedirectTo(partialPath) {
|
||||
return secureRedirectURL + encodeURIComponent(insecureTestURL + partialPath);
|
||||
}
|
||||
|
||||
// Helper to run common redirect test cases that don't require special setup on
|
||||
// the test page itself.
|
||||
function RunCommonRedirectTests(testNamePrefix, urlHelperMethod, expectedResults) {
|
||||
async_test(t => {
|
||||
let i = document.createElement('iframe');
|
||||
i.src = urlHelperMethod("resources/post-to-owner.py");
|
||||
window.addEventListener('message', t.step_func(e => {
|
||||
if (e.source != i.contentWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert_header_equals(e.data, expectedResults);
|
||||
t.done();
|
||||
}));
|
||||
|
||||
document.body.appendChild(i);
|
||||
}, testNamePrefix + " iframe => No headers");
|
||||
|
||||
async_test(t => {
|
||||
let testWindow = window.open(urlHelperMethod("resources/post-to-owner.py"));
|
||||
t.add_cleanup(_ => testWindow.close());
|
||||
window.addEventListener('message', t.step_func(e => {
|
||||
if (e.source != testWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert_header_equals(e.data, expectedResults);
|
||||
t.done();
|
||||
}));
|
||||
}, testNamePrefix + " top level navigation => No headers");
|
||||
|
||||
promise_test(t => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let key = "embed-redirect-redirect" + nonce;
|
||||
|
||||
let e = document.createElement('embed');
|
||||
e.src = urlHelperMethod("resources/record-header.py?file=" + key);
|
||||
e.onload = e => {
|
||||
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
|
||||
.then(response => response.text())
|
||||
.then(text => assert_header_equals(text, expectedResults))
|
||||
.then(_ => resolve())
|
||||
.catch(e => reject(e));
|
||||
};
|
||||
|
||||
document.body.appendChild(e);
|
||||
});
|
||||
}, testNamePrefix + " embed => No headers");
|
||||
|
||||
promise_test(t => {
|
||||
let key = "fetch-redirect" + nonce;
|
||||
return fetch(urlHelperMethod("resources/echo-as-json.py?" + key))
|
||||
.then(r => r.json())
|
||||
.then(j => {assert_header_equals(j, expectedResults);});
|
||||
}, testNamePrefix + " fetch() api => No headers");
|
||||
|
||||
promise_test(t => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let key = "object-https-redirect" + nonce;
|
||||
let e = document.createElement('object');
|
||||
e.data = urlHelperMethod("resources/record-header.py?file=" + key);
|
||||
e.onload = e => {
|
||||
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
|
||||
.then(response => response.text())
|
||||
.then(text => assert_header_equals(text, expectedResults))
|
||||
.then(_ => resolve())
|
||||
.catch(e => reject(e));
|
||||
};
|
||||
document.body.appendChild(e);
|
||||
});
|
||||
}, testNamePrefix + " object => No headers");
|
||||
|
||||
if (document.createElement('link').relList.supports('prefetch')) {
|
||||
async_test(t => {
|
||||
let key = "prefetch" + nonce;
|
||||
let e = document.createElement('link');
|
||||
e.rel = "prefetch";
|
||||
e.href = urlHelperMethod("resources/record-header.py?file=" + key) + "&simple=true";
|
||||
e.onload = t.step_func(e => {
|
||||
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
|
||||
.then(t.step_func(response => response.text()))
|
||||
.then(t.step_func_done(text => assert_header_equals(text, expectedResults)))
|
||||
.catch(t.unreached_func("Fetching and verifying the results should succeed."));
|
||||
});
|
||||
e.onerror = t.unreached_func();
|
||||
document.head.appendChild(e);
|
||||
}, testNamePrefix + " prefetch => No headers");
|
||||
}
|
||||
|
||||
if (document.createElement('link').relList.supports('preload')) {
|
||||
async_test(t => {
|
||||
let key = "preload" + nonce;
|
||||
let e = document.createElement('link');
|
||||
e.rel = "preload";
|
||||
e.href = urlHelperMethod("resources/record-header.py?file=" + key);
|
||||
e.setAttribute("as", "track");
|
||||
e.onload = e.onerror = t.step_func_done(e => {
|
||||
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
|
||||
.then(t.step_func(response => response.text()))
|
||||
.then(t.step_func(text => assert_header_equals(text, expectedResults)))
|
||||
.then(t.step_func_done(_ => resolve()))
|
||||
.catch(t.unreached_func());
|
||||
});
|
||||
document.head.appendChild(e);
|
||||
}, testNamePrefix + " preload => No headers");
|
||||
}
|
||||
|
||||
promise_test(t => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let key = "style-https-redirect" + nonce;
|
||||
let e = document.createElement('link');
|
||||
e.rel = "stylesheet";
|
||||
e.href = urlHelperMethod("resources/record-header.py?file=" + key);
|
||||
e.onload = e => {
|
||||
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
|
||||
.then(response => response.text())
|
||||
.then(text => assert_header_equals(text, expectedResults))
|
||||
.then(_ => resolve())
|
||||
.catch(e => reject(e));
|
||||
};
|
||||
document.body.appendChild(e);
|
||||
});
|
||||
}, testNamePrefix + " stylesheet => No headers");
|
||||
|
||||
promise_test(t => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let key = "track-https-redirect" + nonce;
|
||||
let video = createVideoElement();
|
||||
let el = createTrack();
|
||||
el.src = urlHelperMethod("resources/record-header.py?file=" + key);
|
||||
el.onload = t.step_func(_ => {
|
||||
fetch("/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key)
|
||||
.then(response => response.text())
|
||||
.then(text => assert_header_equals(text, expectedResults))
|
||||
.then(_ => resolve());
|
||||
});
|
||||
video.appendChild(el);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
}, testNamePrefix + " track => No headers");
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<!doctype html>
|
||||
<title>API availability following history traversal</title>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<p>Test requires popup blocker disabled</p>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var hasNavigated = false;
|
||||
var child;
|
||||
t.step(function() {
|
||||
child = window.open("resources/api-availability-1.html");
|
||||
t.add_cleanup(function() {
|
||||
child.close();
|
||||
});
|
||||
});
|
||||
navigate = t.step_func(function() {
|
||||
hasNavigated = true;
|
||||
child.location = child.location.href.replace("api-availability-1.html", "api-availability-2.html");
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<title>API availability following history traversal - 1</title>
|
||||
<script>
|
||||
var controller = opener;
|
||||
var t = controller.t;
|
||||
var assert_not_equals = controller.assert_not_equals;
|
||||
|
||||
t.step(function() {
|
||||
// If this document is discarded as a result of navigation, then this script
|
||||
// will be executed a second time. The semantics this test intends to verify
|
||||
// cannot be observed under these conditions, the discarding is not itself a
|
||||
// violation. Silently pass the test in that case.
|
||||
if (controller.hasNavigated) {
|
||||
t.done();
|
||||
return;
|
||||
}
|
||||
|
||||
t.step_timeout(function() {
|
||||
assert_not_equals(window.history, null, 'history');
|
||||
assert_not_equals(window.localStorage, null, 'localStorage');
|
||||
assert_not_equals(window.location, null, 'location');
|
||||
assert_not_equals(window.navigator, null, 'navigator');
|
||||
assert_not_equals(window.opener, null, 'opener');
|
||||
assert_not_equals(window.sessionStorage, null, 'sessionStorage');
|
||||
|
||||
t.done();
|
||||
}, 1000);
|
||||
|
||||
controller.navigate();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<title>API availability following history traversal - 2</title>
|
||||
<body onload="history.back()"></body>
|
|
@ -23,6 +23,8 @@
|
|||
var frameWin = document.getElementById("srcdoc-iframe").contentWindow;
|
||||
assert_equals(frameWin.location.href, "about:srcdoc");
|
||||
assert_equals(frameWin.scrollY, 0, "Should not have scrolled yet");
|
||||
frameWin.location.hash = "";
|
||||
assert_equals(frameWin.location.href, "about:srcdoc#", "Setting an empty hash should result in an empty fragment, not no fragment.");
|
||||
frameWin.location.hash = "test";
|
||||
assert_equals(frameWin.location.href, "about:srcdoc#test");
|
||||
assert_true(frameWin.scrollY > frameWin.innerHeight,
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
const SAME_ORIGIN = {origin: get_host_info().HTTP_ORIGIN, name: "SAME_ORIGIN"};
|
||||
const SAME_SITE = {origin: get_host_info().HTTP_REMOTE_ORIGIN, name: "SAME_SITE"};
|
||||
const CROSS_ORIGIN = {origin: get_host_info().HTTP_NOTSAMESITE_ORIGIN, name: "CROSS_ORIGIN"}
|
||||
|
||||
function coop_test(t, host, coop, channelName, hasOpener) {
|
||||
let bc = new BroadcastChannel(channelName);
|
||||
bc.onmessage = t.step_func_done((event) => {
|
||||
let payload = event.data;
|
||||
assert_equals(payload.name, hasOpener ? channelName : "");
|
||||
assert_equals(payload.opener, hasOpener);
|
||||
});
|
||||
|
||||
let w = window.open(`${host.origin}/html/cross-origin-opener/resources/coop_window.py?path=window.sub.html&coop=${escape(coop)}&channel=${channelName}`, channelName);
|
||||
|
||||
// w will be closed by its postback iframe. When out of process,
|
||||
// window.close() does not work.
|
||||
t.add_cleanup(() => w.close());
|
||||
}
|
||||
|
||||
function run_coop_tests(mainTest, testArray) {
|
||||
for (let test of tests) {
|
||||
async_test(t => {
|
||||
coop_test(t, test[0], test[1],
|
||||
`${mainTest}_to_${test[0].name}_${test[1].replace(/ /g,"-")}`,
|
||||
test[2]);
|
||||
}, `${mainTest} document opening popup to ${test[0].origin} with COOP: "${test[1]}"`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", true],
|
||||
[SAME_ORIGIN, "jibberish", true],
|
||||
[SAME_ORIGIN, "same-site", false],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_ORIGIN, "same-origin", false],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[SAME_SITE, "", true],
|
||||
[SAME_SITE, "jibberish", true],
|
||||
[SAME_SITE, "same-site", false],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", true],
|
||||
[CROSS_ORIGIN, "jibberish", true],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("null", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", false],
|
||||
[SAME_ORIGIN, "jibberish", false],
|
||||
[SAME_ORIGIN, "same-site", false],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_ORIGIN, "same-origin", true],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[SAME_SITE, "", false],
|
||||
[SAME_SITE, "jibberish", false],
|
||||
[SAME_SITE, "same-site", false],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", false],
|
||||
[CROSS_ORIGIN, "jibberish", false],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("same-origin", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
Cross-Origin-Opener-Policy: same-origin
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", true],
|
||||
[SAME_ORIGIN, "jibberish", true],
|
||||
[SAME_ORIGIN, "same-site", false],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_ORIGIN, "same-origin", false],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", true],
|
||||
|
||||
[SAME_SITE, "", true],
|
||||
[SAME_SITE, "jibberish", true],
|
||||
[SAME_SITE, "same-site", false],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", true],
|
||||
[CROSS_ORIGIN, "jibberish", true],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("same-origin_unsafe-allow-outgoing", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
Cross-Origin-Opener-Policy: same-origin unsafe-allow-outgoing
|
|
@ -1,26 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
const CHANNEL_NAME = "new_window_same_site";
|
||||
|
||||
async_test(t => {
|
||||
let w = window.open(`${get_host_info().HTTP_REMOTE_ORIGIN}/html/cross-origin-opener/resources/window.sub.html?channel=${CHANNEL_NAME}`, "window_name", "height=200,width=250");
|
||||
|
||||
// w will be closed by its postback iframe. When out of process,
|
||||
// window.close() does not work.
|
||||
t.add_cleanup(() => w.close());
|
||||
|
||||
let bc = new BroadcastChannel(CHANNEL_NAME);
|
||||
bc.onmessage = t.step_func_done((event) => {
|
||||
let payload = event.data;
|
||||
assert_equals(payload.name, "window_name");
|
||||
assert_equals(payload.opener, true);
|
||||
});
|
||||
}, "same-site policy works");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", false],
|
||||
[SAME_ORIGIN, "jibberish", false],
|
||||
[SAME_ORIGIN, "same-site", true],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_ORIGIN, "same-origin", false],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[SAME_SITE, "", false],
|
||||
[SAME_SITE, "jibberish", false],
|
||||
[SAME_SITE, "same-site", true],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", false],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", false],
|
||||
[CROSS_ORIGIN, "jibberish", false],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("same-site", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
|
||||
<script src="common.sub.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script>
|
||||
|
||||
let tests = [
|
||||
// popup Origin, popup COOP, expect opener
|
||||
[SAME_ORIGIN, "", true],
|
||||
[SAME_ORIGIN, "jibberish", true],
|
||||
[SAME_ORIGIN, "same-site", false],
|
||||
[SAME_ORIGIN, "same-site unsafe-allow-outgoing", true],
|
||||
[SAME_ORIGIN, "same-origin", false],
|
||||
[SAME_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[SAME_SITE, "", true],
|
||||
[SAME_SITE, "jibberish", true],
|
||||
[SAME_SITE, "same-site", false],
|
||||
[SAME_SITE, "same-site unsafe-allow-outgoing", true],
|
||||
[SAME_SITE, "same-origin", false],
|
||||
[SAME_SITE, "same-origin unsafe-allow-outgoing", false],
|
||||
|
||||
[CROSS_ORIGIN, "", true],
|
||||
[CROSS_ORIGIN, "jibberish", true],
|
||||
[CROSS_ORIGIN, "same-site", false],
|
||||
[CROSS_ORIGIN, "same-site unsafe-allow-outgoing", false],
|
||||
[CROSS_ORIGIN, "same-origin", false],
|
||||
[CROSS_ORIGIN, "same-origin unsafe-allow-outgoing", false],
|
||||
];
|
||||
|
||||
run_coop_tests("same-site_unsafe-allow-outgoing", tests);
|
||||
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
Cross-Origin-Opener-Policy: same-site unsafe-allow-outgoing
|
|
@ -0,0 +1,10 @@
|
|||
import urllib
|
||||
import os.path
|
||||
|
||||
def main(request, response):
|
||||
coop = request.GET.first('coop')
|
||||
if coop:
|
||||
response.headers.set('Cross-Origin-Opener-Policy', urllib.unquote(coop))
|
||||
|
||||
path = os.path.join(os.path.dirname(__file__), request.GET.first('path'))
|
||||
response.content = open(path, mode='rb').read()
|
|
@ -2,17 +2,17 @@
|
|||
<meta charset=utf-8>
|
||||
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<div id="status"> </div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.onload = () => {
|
||||
let payload = { name: self.name, opener: !!self.opener };
|
||||
iframe.contentWindow.postMessage(payload, "*");
|
||||
};
|
||||
let channelName = new URL(location).searchParams.get("channel");
|
||||
iframe.src = `${get_host_info().HTTP_ORIGIN}/html/cross-origin-opener/resources/postback.sub.html?channel=${channelName}`;
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.onload = () => {
|
||||
let payload = { name: self.name, opener: !!self.opener };
|
||||
iframe.contentWindow.postMessage(payload, "*");
|
||||
};
|
||||
let channelName = new URL(location).searchParams.get("channel");
|
||||
iframe.src = `${get_host_info().HTTP_ORIGIN}/html/cross-origin-opener/resources/postback.sub.html?channel=${channelName}`;
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
expected:
|
||||
if product == "safari": ERROR
|
||||
|
||||
|
||||
[TestDriver actions: actions with key pressed]
|
||||
expected:
|
||||
if product == "firefox": FAIL
|
||||
|
||||
if os == "mac" and product == "chrome": FAIL
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
[elementPosition.html]
|
||||
expected:
|
||||
if os == "mac" and product == "chrome": TIMEOUT
|
||||
|
||||
[TestDriver actions: element position]
|
||||
expected:
|
||||
if product == "safari": FAIL
|
||||
|
|
|
@ -23,9 +23,10 @@ enum MediaSessionAction {
|
|||
"nexttrack",
|
||||
"skipad",
|
||||
"stop",
|
||||
"seekto"
|
||||
};
|
||||
|
||||
callback MediaSessionActionHandler = void();
|
||||
callback MediaSessionActionHandler = void(MediaSessionActionDetails details);
|
||||
|
||||
[Exposed=Window]
|
||||
interface MediaSession {
|
||||
|
@ -64,3 +65,16 @@ dictionary MediaPositionState {
|
|||
double playbackRate = 1.0;
|
||||
double position = 0.0;
|
||||
};
|
||||
|
||||
dictionary MediaSessionActionDetails {
|
||||
required MediaSessionAction action;
|
||||
};
|
||||
|
||||
dictionary MediaSessionSeekActionDetails : MediaSessionActionDetails {
|
||||
double? seekOffset;
|
||||
};
|
||||
|
||||
dictionary MediaSessionSeekToActionDetails : MediaSessionActionDetails {
|
||||
required double seekTime;
|
||||
bool? fastSeek;
|
||||
};
|
||||
|
|
|
@ -466,6 +466,7 @@ enum RTCIceTransportState {
|
|||
};
|
||||
|
||||
enum RTCIceRole {
|
||||
"unknown",
|
||||
"controlling",
|
||||
"controlled"
|
||||
};
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Largest Contentful Paint: observe image.</title>
|
||||
<body>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
let beforeRender;
|
||||
function computeTimestamp() {
|
||||
beforeRender = performance.now();
|
||||
}
|
||||
async_test(function (t) {
|
||||
if (!window.LargestContentfulPaint) {
|
||||
assert_unreached("LargestContentfulPaint is not implemented");
|
||||
}
|
||||
const observer = new PerformanceObserver(
|
||||
t.step_func_done(function(entryList) {
|
||||
assert_equals(entryList.getEntries().length, 1);
|
||||
const entry = entryList.getEntries()[0];
|
||||
assert_equals(entry.entryType, 'largestContentfulPaint');
|
||||
assert_greater_than_equal(entry.startTime, beforeRender);
|
||||
assert_greater_than_equal(performance.now(), entry.startTime);
|
||||
assert_equals(entry.duration, 0);
|
||||
// blue.png is 133 x 106.
|
||||
assert_equals(entry.size, 14098);
|
||||
})
|
||||
);
|
||||
observer.observe({type: 'largestContentfulPaint', buffered: true});
|
||||
}, 'Element with elementtiming attribute is observable.');
|
||||
</script>
|
||||
|
||||
<img src='/images/blue.png' onload='computeTimestamp()'/>
|
||||
</body>
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Largest Contentful Paint: observe text.</title>
|
||||
<body>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
p {
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
let beforeRender;
|
||||
async_test(function (t) {
|
||||
if (!window.LargestContentfulPaint) {
|
||||
assert_unreached("LargestContentfulPaint is not implemented");
|
||||
}
|
||||
const observer = new PerformanceObserver(
|
||||
t.step_func_done(function(entryList) {
|
||||
assert_equals(entryList.getEntries().length, 1);
|
||||
const entry = entryList.getEntries()[0];
|
||||
assert_equals(entry.entryType, 'largestContentfulPaint');
|
||||
assert_greater_than_equal(entry.startTime, beforeRender);
|
||||
assert_greater_than_equal(performance.now(), entry.startTime);
|
||||
assert_equals(entry.duration, 0);
|
||||
// Some lower bound: height of at least 12 px.
|
||||
// Width of at least 100 px.
|
||||
// TODO: find a good way to bound text width.
|
||||
assert_greater_than_equal(entry.size, 1200);
|
||||
})
|
||||
);
|
||||
observer.observe({type: 'largestContentfulPaint', buffered: true});
|
||||
beforeRender = performance.now();
|
||||
}, 'Element with elementtiming attribute is observable.');
|
||||
</script>
|
||||
|
||||
<p>This is important text! :)</p>
|
||||
</body>
|
|
@ -18,6 +18,33 @@ const StepStatus = {
|
|||
|
||||
var steps_map = new Map();
|
||||
|
||||
function poll_for_result(request_token, step_name, expect_success) {
|
||||
test.step(() => {
|
||||
var iteration = 5;
|
||||
var checkResult = () => {
|
||||
fetch("resources/beacon.py?query&token=" + request_token).then(test.step_func((response) => {
|
||||
var count = response.headers.get("Count");
|
||||
if (count != '0') {
|
||||
// If the server received something we can terminate polling.
|
||||
if (expect_success) {
|
||||
step_success(step_name);
|
||||
} else {
|
||||
step_fail(step_name);
|
||||
}
|
||||
} else if (!expect_success && count == '0' && iteration == 0) {
|
||||
// When we are out of iterations and we aren't expecting success, declare this step complete.
|
||||
// Should be 125 ms looking to make sure server didn't see the request.
|
||||
step_success(step_name);
|
||||
} else {
|
||||
iteration--;
|
||||
test.step_timeout(checkResult, 25);
|
||||
}
|
||||
}));
|
||||
};
|
||||
test.step_timeout(checkResult, 25);
|
||||
});
|
||||
}
|
||||
|
||||
function add_step(name) {
|
||||
steps_map[name] = StepStatus.ADDED;
|
||||
total_steps++;
|
||||
|
@ -46,4 +73,3 @@ test.step_timeout(() => {
|
|||
}, 1000);
|
||||
|
||||
</script>
|
||||
|
||||
|
|
25
tests/wpt/web-platform-tests/lifecycle/resources/beacon.py
Normal file
25
tests/wpt/web-platform-tests/lifecycle/resources/beacon.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
def main(request, response):
|
||||
|
||||
# |token| should be a unique UUID request parameter for the duration of this
|
||||
# request. It will get stored in the server stash and will be used later in
|
||||
# a query request.
|
||||
# |query| should be a request parameter indicating the request would like
|
||||
# to know how many times the server has seen the request (with the
|
||||
# same token).
|
||||
token = request.GET.first("token", None)
|
||||
is_query = request.GET.first("query", None) is not None
|
||||
with request.server.stash.lock:
|
||||
value = request.server.stash.take(token)
|
||||
count = 0
|
||||
if value is not None:
|
||||
count = int(value)
|
||||
if is_query:
|
||||
request.server.stash.put(token, count)
|
||||
else:
|
||||
count += 1
|
||||
request.server.stash.put(token, count)
|
||||
|
||||
headers = []
|
||||
if is_query:
|
||||
headers = [("Count", count)]
|
||||
return (200, headers, "")
|
|
@ -1 +0,0 @@
|
|||
Sample test file for fetch inside onfreeze.
|
|
@ -3,6 +3,7 @@
|
|||
<head><title>Frozen Window</title></head>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<body>
|
||||
<h1>This window will be frozen</h1>
|
||||
<script>
|
||||
|
@ -10,22 +11,23 @@
|
|||
const freezingStepName = 'testOnFreeze';
|
||||
|
||||
function testFetch(keepalive) {
|
||||
var request_token = token();
|
||||
var name = 'testfetch' + (keepalive ? 'with' : 'without') + 'keepalive';
|
||||
window.opener.add_step(name);
|
||||
|
||||
function handler(expected) {
|
||||
if (expected == true)
|
||||
window.opener.step_success(name);
|
||||
else
|
||||
window.opener.step_fail(name);
|
||||
function handler() {
|
||||
window.opener.step_fail(name);
|
||||
}
|
||||
|
||||
fetch('foo.txt', {
|
||||
fetch('beacon.py?token=' + request_token, {
|
||||
keepalive: keepalive
|
||||
}).then(() => handler(keepalive)).catch(() => handler(!keepalive));
|
||||
}).then(() => handler()).catch(() => handler());
|
||||
|
||||
window.opener.poll_for_result(request_token, name, keepalive);
|
||||
}
|
||||
|
||||
function testXHR(async) {
|
||||
var request_token = token();
|
||||
var name = 'test' + (async ? 'Async' : 'Sync') + 'XHR';
|
||||
window.opener.add_step(name);
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
@ -37,21 +39,26 @@ function testXHR(async) {
|
|||
window.opener.step_fail(name);
|
||||
}
|
||||
}
|
||||
xhr.open('GET', 'foo.txt', async);
|
||||
xhr.open('GET', 'beacon.py?token=' + request_token, async);
|
||||
try {
|
||||
xhr.send(null);
|
||||
if (async) {
|
||||
window.opener.poll_for_result(request_token, name, false);
|
||||
}
|
||||
} catch {
|
||||
window.opener.step_success(name);
|
||||
};
|
||||
}
|
||||
|
||||
function testSendBeacon() {
|
||||
var request_token = token();
|
||||
var name = 'testSendBeacon';
|
||||
window.opener.add_step(name);
|
||||
if (navigator.sendBeacon("foo.txt", "data=1"))
|
||||
window.opener.step_success(name);
|
||||
else
|
||||
if (navigator.sendBeacon("beacon.py?token=" + request_token, "")) {
|
||||
window.opener.poll_for_result(request_token, name, true);
|
||||
} else {
|
||||
window.opener.step_fail(name);
|
||||
}
|
||||
}
|
||||
|
||||
window.document.addEventListener("freeze", () => {
|
||||
|
@ -73,4 +80,4 @@ onload = function() {
|
|||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -7,6 +7,7 @@ promise_test(async t => {
|
|||
const writer = await handle.createWriter();
|
||||
|
||||
await writer.write(0, new Blob([]));
|
||||
await writer.close();
|
||||
|
||||
assert_equals(await getFileContents(handle), '');
|
||||
assert_equals(await getFileSize(handle), 0);
|
||||
|
@ -17,6 +18,7 @@ promise_test(async t => {
|
|||
const writer = await handle.createWriter();
|
||||
|
||||
await writer.write(0, new Blob(['1234567890']));
|
||||
await writer.close();
|
||||
|
||||
assert_equals(await getFileContents(handle), '1234567890');
|
||||
assert_equals(await getFileSize(handle), 10);
|
||||
|
@ -28,6 +30,7 @@ promise_test(async t => {
|
|||
|
||||
await writer.write(0, new Blob(['1234567890']));
|
||||
await writer.write(4, new Blob(['abc']));
|
||||
await writer.close();
|
||||
|
||||
assert_equals(await getFileContents(handle), '1234abc890');
|
||||
assert_equals(await getFileSize(handle), 10);
|
||||
|
@ -38,6 +41,7 @@ promise_test(async t => {
|
|||
const writer = await handle.createWriter();
|
||||
|
||||
await promise_rejects(t, 'InvalidStateError', writer.write(4, new Blob(['abc'])));
|
||||
await writer.close();
|
||||
|
||||
assert_equals(await getFileContents(handle), '');
|
||||
assert_equals(await getFileSize(handle), 0);
|
||||
|
@ -48,6 +52,7 @@ promise_test(async t => {
|
|||
const writer = await handle.createWriter();
|
||||
|
||||
await writer.write(0, '');
|
||||
await writer.close();
|
||||
assert_equals(await getFileContents(handle), '');
|
||||
assert_equals(await getFileSize(handle), 0);
|
||||
}, 'write() with an empty string to an empty file');
|
||||
|
@ -57,6 +62,7 @@ promise_test(async t => {
|
|||
const writer = await handle.createWriter();
|
||||
|
||||
await writer.write(0, 'foo🤘');
|
||||
await writer.close();
|
||||
assert_equals(await getFileContents(handle), 'foo🤘');
|
||||
assert_equals(await getFileSize(handle), 7);
|
||||
}, 'write() with a valid utf-8 string');
|
||||
|
@ -66,6 +72,7 @@ promise_test(async t => {
|
|||
const writer = await handle.createWriter();
|
||||
|
||||
await writer.write(0, 'foo\n');
|
||||
await writer.close();
|
||||
assert_equals(await getFileContents(handle), 'foo\n');
|
||||
assert_equals(await getFileSize(handle), 4);
|
||||
}, 'write() with a string with unix line ending preserved');
|
||||
|
@ -75,6 +82,7 @@ promise_test(async t => {
|
|||
const writer = await handle.createWriter();
|
||||
|
||||
await writer.write(0, 'foo\r\n');
|
||||
await writer.close();
|
||||
assert_equals(await getFileContents(handle), 'foo\r\n');
|
||||
assert_equals(await getFileSize(handle), 5);
|
||||
}, 'write() with a string with windows line ending preserved');
|
||||
|
@ -85,6 +93,7 @@ promise_test(async t => {
|
|||
|
||||
let buf = new ArrayBuffer(0);
|
||||
await writer.write(0, buf);
|
||||
await writer.close();
|
||||
assert_equals(await getFileContents(handle), '');
|
||||
assert_equals(await getFileSize(handle), 0);
|
||||
}, 'write() with an empty array buffer to an empty file');
|
||||
|
@ -99,6 +108,7 @@ promise_test(async t => {
|
|||
intView[1] = 0x6f;
|
||||
intView[2] = 0x6f;
|
||||
await writer.write(0, buf);
|
||||
await writer.close();
|
||||
assert_equals(await getFileContents(handle), 'foo');
|
||||
assert_equals(await getFileSize(handle), 3);
|
||||
}, 'write() with a valid typed array buffer');
|
||||
|
@ -109,6 +119,7 @@ promise_test(async t => {
|
|||
|
||||
await writer.write(0, new Blob(['1234567890']));
|
||||
await writer.truncate(5);
|
||||
await writer.close();
|
||||
|
||||
assert_equals(await getFileContents(handle), '12345');
|
||||
assert_equals(await getFileSize(handle), 5);
|
||||
|
@ -120,6 +131,7 @@ promise_test(async t => {
|
|||
|
||||
await writer.write(0, new Blob(['abc']));
|
||||
await writer.truncate(5);
|
||||
await writer.close();
|
||||
|
||||
assert_equals(await getFileContents(handle), 'abc\0\0');
|
||||
assert_equals(await getFileSize(handle), 5);
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
|
||||
function verifyTimingEventOrder(eventOrder, timingEntry) {
|
||||
for (var i = 0; i < eventOrder.length - 1; i++) {
|
||||
assert_true(timingEntry[eventOrder[i]] < timingEntry[eventOrder[i + 1]],
|
||||
"Expected " + eventOrder[i] + " to be no greater than " + eventOrder[i + 1] + ".");
|
||||
}
|
||||
}
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var frame_performance = document.getElementById("frameContext").contentWindow.performance;
|
||||
assert_equals(frame_performance.getEntriesByType("navigation")[0].type,
|
||||
"navigate",
|
||||
"Expected navigation type to be navigate.");
|
||||
assert_equals(frame_performance.getEntriesByType("navigation")[0].redirectCount, 1, "Expected redirectCount to be 1.");
|
||||
|
||||
var timgingEvents = [
|
||||
'startTime',
|
||||
'redirectStart',
|
||||
'redirectEnd',
|
||||
];
|
||||
verifyTimingEventOrder(timgingEvents, frame_performance.getEntriesByType("navigation")[0]);
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the values of the window.performance.getEntriesByType("navigation")[0].redirectCount and the
|
||||
window.performance.getEntriesByType("navigation")[0].redirectStart/End times for a cross-origin server side redirect navigation when the redirect chooses to opt-in.</p>
|
||||
|
||||
<iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe>
|
||||
<script>
|
||||
// combine the page origin and redirect origin into the IFRAME's src URL
|
||||
var destUrl = make_absolute_url({subdomain: "www",
|
||||
path: "/common/redirect-opt-in.py",
|
||||
query: "location=" + make_absolute_url(
|
||||
{path: "/navigation-timing/resources/blank_page_green.html"})
|
||||
});
|
||||
var frameContext = document.getElementById("frameContext");
|
||||
frameContext.onload = onload_test;
|
||||
frameContext.src = destUrl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,36 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var frame = document.getElementById("frameContext");
|
||||
|
||||
assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].type,
|
||||
"navigate",
|
||||
"Expected navigation type to be navigate.");
|
||||
|
||||
assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].unloadEventStart, 0,
|
||||
"Expected unloadEventStart to be 0.");
|
||||
assert_equals(frame.contentWindow.performance.getEntriesByType("navigation")[0].unloadEventEnd, 0,
|
||||
"Expected unloadEventEnd to be 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the unload event times are 0 when there is no previous document.</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1,45 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
var reload_frame = document.getElementById("frameContext");
|
||||
reload_frame.onload = do_test;
|
||||
reload_frame.contentWindow.location.href = "resources/blank_page_green.html";
|
||||
}
|
||||
|
||||
function do_test()
|
||||
{
|
||||
var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0];
|
||||
assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate.");
|
||||
assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0.");
|
||||
assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a navigation on top of a cross-origin document.</p>
|
||||
|
||||
<p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
|
||||
and then verified that
|
||||
<ul>
|
||||
<li>The window.performance.getEntriesByType("navigation").type = "navigate"</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventStart = 0</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventEnd = 0</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="{{location[scheme]}}://{{domains[www2]}}:{{ports[http][0]}}/common/blank.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1,61 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
|
||||
let reload_frame;
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
reload_frame = document.getElementById("frameContext");
|
||||
reload_frame.onload = do_test;
|
||||
setTimeout("reload_the_frame();", 100);
|
||||
}
|
||||
|
||||
function reload_the_frame()
|
||||
{
|
||||
const destUrl_first = make_absolute_url({subdomain: "www",
|
||||
path: "/common/redirect-opt-in.py",
|
||||
query: "location=" + make_absolute_url(
|
||||
{path: "/navigation-timing/resources/blank_page_yellow.html"})
|
||||
});
|
||||
const destUrl = make_absolute_url({subdomain: "www",
|
||||
path: "/common/redirect.py",
|
||||
query: "location=" + destUrl_first
|
||||
});
|
||||
reload_frame.contentWindow.location.href = destUrl;
|
||||
}
|
||||
|
||||
function do_test()
|
||||
{
|
||||
const newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0];
|
||||
assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate.");
|
||||
assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0.");
|
||||
assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p>
|
||||
|
||||
<p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
|
||||
and then verified that
|
||||
<ul>
|
||||
<li>The window.performance.getEntriesByType("navigation").type = "navigate"</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventStart == 0</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventEnd == 0</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1,57 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
|
||||
let reload_frame;
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
reload_frame = document.getElementById("frameContext");
|
||||
reload_frame.onload = do_test;
|
||||
setTimeout("reload_the_frame();", 100);
|
||||
}
|
||||
|
||||
function reload_the_frame()
|
||||
{
|
||||
const destUrl = make_absolute_url({subdomain: "www",
|
||||
path: "/common/redirect-opt-in.py",
|
||||
query: "location=" + make_absolute_url(
|
||||
{path: "/navigation-timing/resources/blank_page_yellow.html"})
|
||||
});
|
||||
reload_frame.contentWindow.location.href = destUrl;
|
||||
}
|
||||
|
||||
function do_test()
|
||||
{
|
||||
const newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0];
|
||||
assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate.");
|
||||
assert_not_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to not be 0.");
|
||||
assert_not_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to not be 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p>
|
||||
|
||||
<p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
|
||||
and then verified that
|
||||
<ul>
|
||||
<li>The window.performance.getEntriesByType("navigation").type = "navigate"</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventStart == 0</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventEnd == 0</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -1,57 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Navigation Timing 2 WPT</title>
|
||||
<link rel="author" title="Google" href="http://www.google.com/" />
|
||||
<link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/utils.js"></script>
|
||||
<script>
|
||||
|
||||
var reload_frame;
|
||||
|
||||
function onload_test()
|
||||
{
|
||||
reload_frame = document.getElementById("frameContext");
|
||||
reload_frame.onload = do_test;
|
||||
setTimeout("reload_the_frame();", 100);
|
||||
}
|
||||
|
||||
function reload_the_frame()
|
||||
{
|
||||
var destUrl = make_absolute_url({subdomain: "www",
|
||||
path: "/common/redirect.py",
|
||||
query: "location=" + make_absolute_url(
|
||||
{path: "/navigation-timing/resources/blank_page_yellow.html"})
|
||||
});
|
||||
reload_frame.contentWindow.location.href = destUrl;
|
||||
}
|
||||
|
||||
function do_test()
|
||||
{
|
||||
var newNavTiming = document.getElementById("frameContext").contentWindow.performance.getEntriesByType("navigation")[0];
|
||||
assert_equals(newNavTiming.type, "navigate", "Expected navigation type to be navigate.");
|
||||
assert_equals(newNavTiming.unloadEventStart, 0, "Expected unloadEventStart to be 0.");
|
||||
assert_equals(newNavTiming.unloadEventEnd, 0, "Expected unloadEventEnd to be 0.");
|
||||
done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Description</h1>
|
||||
<p>This test validates the value of window.performance.getEntriesByType("navigation")[0].(type/unloadEventEnd/unloadEventStart) with a reloaded navigation.</p>
|
||||
|
||||
<p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
|
||||
and then verified that
|
||||
<ul>
|
||||
<li>The window.performance.getEntriesByType("navigation").type = "navigate"</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventStart == 0</li>
|
||||
<li>The window.performance.getEntriesByType("navigation").unloadEventEnd == 0</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<iframe id="frameContext" onload="onload_test();" src="resources/blank_page_green.html" style="width: 250px; height: 250px;"></iframe>
|
||||
</body>
|
||||
</html>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue