mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision 3840f46213d9a991acc9288e3863530f7502c05e
This commit is contained in:
parent
347d8bdf72
commit
141ba90a6d
58 changed files with 1507 additions and 883 deletions
|
@ -0,0 +1,19 @@
|
|||
<!doctype HTML>
|
||||
<link rel="author" title="Chris Harrelson" href="chrishtr@chromium.org">
|
||||
<style>
|
||||
#one, #two {
|
||||
width: 200px; height: 200px; background: lightblue; position: relative
|
||||
}
|
||||
#one {
|
||||
background: lightblue
|
||||
}
|
||||
#two {
|
||||
background: lightgray;
|
||||
margin-top: -200px;
|
||||
}
|
||||
</style>
|
||||
<div id=scroller style="overflow: scroll; width: 300px; height: 300px; will-change: transform">
|
||||
<div id=one></div>
|
||||
<div id=two></div>
|
||||
<div id=spacer style="width: 50px; height: 5000px"></div>
|
||||
</div>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype HTML>
|
||||
<link rel="author" title="Chris Harrelson" href="chrishtr@chromium.org">
|
||||
<link rel="match" href="composite-change-after-scroll-preserves-stacking-order-ref.html">
|
||||
<link rel="help" href="https://www.w3.org/TR/CSS2/zindex.html"/>
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<script src="/web-animations/testcommon.js"></script>
|
||||
<style>
|
||||
#one, #two {
|
||||
width: 200px; height: 200px; background: lightblue; position: relative
|
||||
}
|
||||
#one {
|
||||
background: lightblue
|
||||
}
|
||||
#two {
|
||||
background: lightgray;
|
||||
margin-top: -200px;
|
||||
}
|
||||
</style>
|
||||
<html class=reftest-wait>
|
||||
<div id=scroller style="overflow: scroll; width: 300px; height: 300px; will-change: transform">
|
||||
<div id=one></div>
|
||||
<div id=two></div>
|
||||
<div id=spacer style="width: 50px; height: 5000px"></div>
|
||||
</div>
|
||||
</html>
|
||||
<script>
|
||||
onload = () => {
|
||||
waitForAnimationFrames(2).then(() => {
|
||||
scroller.scrollBy(0, 1000);
|
||||
waitForAnimationFrames(2).then(() => {
|
||||
one.style = 'will-change: transform';
|
||||
waitForAnimationFrames(2).then(() => {
|
||||
scroller.scrollBy(0, -1000);
|
||||
takeScreenshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
|
@ -11,7 +11,7 @@
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
background: green;
|
||||
border-radius: 50px;
|
||||
border-radius: 99px;
|
||||
}
|
||||
</style>
|
||||
<p>Should be a green circle below</p>
|
||||
|
|
|
@ -40,7 +40,7 @@ container.style.color = currentColor;
|
|||
assert_not_inherited('background-attachment', 'scroll', 'fixed');
|
||||
assert_not_inherited('background-clip', 'border-box', 'padding-box');
|
||||
assert_not_inherited('background-color', transparentColor, 'rgb(42, 53, 64)');
|
||||
assert_not_inherited('background-image', 'none', 'url("https://example.com/")');
|
||||
assert_not_inherited('background-image', 'none', 'url("https://{{host}}/")');
|
||||
assert_not_inherited('background-origin', 'padding-box', 'content-box');
|
||||
assert_not_inherited('background-position', '0% 0%', '10px 20px');
|
||||
assert_not_inherited('background-position-x', '0%', '10px');
|
||||
|
@ -57,7 +57,7 @@ assert_not_inherited('border-bottom-width', mediumWidth, '10px');
|
|||
assert_not_inherited('border-image-outset', '0', '1px 2px 3px 4px');
|
||||
assert_not_inherited('border-image-repeat', 'stretch', 'repeat round');
|
||||
assert_not_inherited('border-image-slice', '100%', '1% 2% 3% 4% fill');
|
||||
assert_not_inherited('border-image-source', 'none', 'url("https://example.com/")');
|
||||
assert_not_inherited('border-image-source', 'none', 'url("https://{{host}}/")');
|
||||
assert_not_inherited('border-image-width', '1', '1px 2px 3px 4px');
|
||||
|
||||
assert_not_inherited('border-left-color', currentColor, 'rgb(42, 53, 64)');
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Containment Test: Size containment on select</title>
|
||||
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-size">
|
||||
<link rel="match" href="reference/contain-size-select-001-ref.html">
|
||||
<meta name=assert content="Check that setting 'contain: size' on a <select> elements causes it to be sized as having no contents.">
|
||||
<style>
|
||||
select {
|
||||
color: white;
|
||||
background: white;
|
||||
}
|
||||
</style>
|
||||
<p>Test passes if it has the same output than the reference.</p>
|
||||
<select id="target">
|
||||
<option>AVeryLongOption</option>
|
||||
<option>Another Option</option>
|
||||
</select>
|
||||
<script>
|
||||
window.requestAnimationFrame( () => {
|
||||
target.style.contain = "size";
|
||||
});
|
||||
</script>
|
|
@ -11,6 +11,7 @@
|
|||
<meta name="assert" content="Test checks that css properties of grid layout exist.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<style>
|
||||
#container {
|
||||
width: 800px;
|
||||
|
@ -34,6 +35,8 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
setup({explicit_done: true});
|
||||
document.fonts.ready.then(()=> {
|
||||
var myDiv = document.getElementById('myDiv')
|
||||
|
||||
test(function(){
|
||||
|
@ -228,6 +231,8 @@
|
|||
'reset': ['auto', 'auto'],
|
||||
},
|
||||
})
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>CSS Reference: min/max-content size on box-decoration-break:clone inline box with bidi text and white-space:nowrap</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<style>
|
||||
html,body {
|
||||
color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 5px solid blue;
|
||||
white-space: pre;
|
||||
}
|
||||
.max > div {
|
||||
width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
span {
|
||||
border: 2px solid gray;
|
||||
padding: 0 10px 0 6px;
|
||||
border-width: 0 8px 0 5px;
|
||||
margin: 0 4px 0 3px;
|
||||
background: yellow;
|
||||
-webkit-box-decoration-break: clone;
|
||||
box-decoration-break: clone;
|
||||
}
|
||||
|
||||
f { margin-right: 30px; float: left; }
|
||||
</style>
|
||||
<body>
|
||||
<f class="max">
|
||||
<div><span>‮a‭bc</span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc </span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span><span> d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc </span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa<span> d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa</div>
|
||||
</f>
|
||||
|
||||
<f class="max">
|
||||
<div><span>‮a‭bc</span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc </span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span><span> d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc </span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa<span> d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa</div>
|
||||
</f>
|
|
@ -0,0 +1,110 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>CSS Test: min/max-content size on box-decoration-break:clone inline box with bidi text and white-space:nowrap</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#valdef-width-min-content">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-break-3/#break-decoration">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1556709">
|
||||
<link rel="match" href="clone-nowrap-intrinsic-size-bidi-ref.html">
|
||||
<style>
|
||||
html,body {
|
||||
color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 5px solid blue;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.max > div {
|
||||
width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: max-content;
|
||||
}
|
||||
.min > div {
|
||||
width: -moz-min-content;
|
||||
width: -webkit-min-content;
|
||||
width: min-content;
|
||||
}
|
||||
|
||||
span {
|
||||
border: 2px solid gray;
|
||||
padding: 0 10px 0 6px;
|
||||
border-width: 0 8px 0 5px;
|
||||
margin: 0 4px 0 3px;
|
||||
background: yellow;
|
||||
-webkit-box-decoration-break: clone;
|
||||
box-decoration-break: clone;
|
||||
}
|
||||
|
||||
f { margin-right: 30px; float: left; }
|
||||
</style>
|
||||
<body>
|
||||
<f class="max">
|
||||
<div>
|
||||
<span>‮a‭bc</span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc </span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span><span> d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc </span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa<span> d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa </div>
|
||||
</f>
|
||||
|
||||
<f class="min">
|
||||
<div>
|
||||
<span>‮a‭bc</span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc </span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span><span> d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc </span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa<span> d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa </div>
|
||||
</f>
|
|
@ -0,0 +1,79 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>CSS Reference: min/max-content size on box-decoration-break:clone inline box w. white-space:nowrap</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<style>
|
||||
html,body {
|
||||
color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 5px solid blue;
|
||||
white-space: pre;
|
||||
}
|
||||
.max > div {
|
||||
width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
span {
|
||||
border: 2px solid gray;
|
||||
padding: 0 10px 0 6px;
|
||||
border-width: 0 8px 0 5px;
|
||||
margin: 0 4px 0 3px;
|
||||
background: yellow;
|
||||
-webkit-box-decoration-break: clone;
|
||||
box-decoration-break: clone;
|
||||
}
|
||||
|
||||
f { margin-right: 30px; float: left; }
|
||||
</style>
|
||||
<body>
|
||||
<f class="max">
|
||||
<div><span>aaa</span><span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span> <span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa </span><span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span><span> aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span> aa<span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa </span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span>aa<span> aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span> aa <span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span>aa <span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span>aa</div>
|
||||
</f>
|
||||
|
||||
<f class="max">
|
||||
<div><span>aaa</span><span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span> <span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa </span><span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span><span> aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span> aa<span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa </span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span>aa<span> aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span> aa <span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span>aa <span>aaa</span>
|
||||
</div>
|
||||
<div><span>aaa</span>aa</div>
|
||||
</f>
|
|
@ -0,0 +1,110 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>CSS Test: min/max-content size on box-decoration-break:clone inline box w. white-space:nowrap</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#valdef-width-min-content">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-break-3/#break-decoration">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1556709">
|
||||
<link rel="match" href="clone-nowrap-intrinsic-size-ref.html">
|
||||
<style>
|
||||
html,body {
|
||||
color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 5px solid blue;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.max > div {
|
||||
width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: max-content;
|
||||
}
|
||||
.min > div {
|
||||
width: -moz-min-content;
|
||||
width: -webkit-min-content;
|
||||
width: min-content;
|
||||
}
|
||||
|
||||
span {
|
||||
border: 2px solid gray;
|
||||
padding: 0 10px 0 6px;
|
||||
border-width: 0 8px 0 5px;
|
||||
margin: 0 4px 0 3px;
|
||||
background: yellow;
|
||||
-webkit-box-decoration-break: clone;
|
||||
box-decoration-break: clone;
|
||||
}
|
||||
|
||||
f { margin-right: 30px; float: left; }
|
||||
</style>
|
||||
<body>
|
||||
<f class="max">
|
||||
<div>
|
||||
<span>aaa</span><span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa </span><span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span><span> aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa </span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa<span> aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> aa <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa </div>
|
||||
</f>
|
||||
|
||||
<f class="min">
|
||||
<div>
|
||||
<span>aaa</span><span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa </span><span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span><span> aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa </span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa<span> aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> aa <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa </div>
|
||||
</f>
|
|
@ -0,0 +1,79 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>CSS Reference: min/max-content size on box-decoration-break:slice inline box with bidi text and white-space:nowrap</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<style>
|
||||
html,body {
|
||||
color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 5px solid blue;
|
||||
white-space: pre;
|
||||
}
|
||||
.max > div {
|
||||
width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
span {
|
||||
border: 2px solid gray;
|
||||
padding: 0 10px 0 6px;
|
||||
border-width: 0 8px 0 5px;
|
||||
margin: 0 4px 0 3px;
|
||||
background: yellow;
|
||||
}
|
||||
|
||||
f { margin-right: 30px; float: left; }
|
||||
.l { margin-right:0; border-right-width:0; padding-right:0 }
|
||||
.r { margin-left:0; border-left-width:0; padding-left:0 }
|
||||
</style>
|
||||
<body>
|
||||
<f class="max">
|
||||
<div><span>‮a‭bc</span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc </span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span><span> d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc </span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa<span> d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa</div>
|
||||
</f>
|
||||
|
||||
<f class="max">
|
||||
<div><span>‮a‭bc</span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc </span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span><span> d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc </span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa<span> d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span> aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div><span>‮a‭bc</span>aa</div>
|
||||
</f>
|
|
@ -0,0 +1,108 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>CSS Test: min/max-content size on box-decoration-break:slice inline box with bidi text and white-space:nowrap</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#valdef-width-min-content">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-break-3/#break-decoration">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1556709">
|
||||
<link rel="match" href="slice-nowrap-intrinsic-size-bidi-ref.html">
|
||||
<style>
|
||||
html,body {
|
||||
color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 5px solid blue;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.max > div {
|
||||
width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: max-content;
|
||||
}
|
||||
.min > div {
|
||||
width: -moz-min-content;
|
||||
width: -webkit-min-content;
|
||||
width: min-content;
|
||||
}
|
||||
|
||||
span {
|
||||
border: 2px solid gray;
|
||||
padding: 0 10px 0 6px;
|
||||
border-width: 0 8px 0 5px;
|
||||
margin: 0 4px 0 3px;
|
||||
background: yellow;
|
||||
}
|
||||
|
||||
f { margin-right: 30px; float: left; }
|
||||
</style>
|
||||
<body>
|
||||
<f class="max">
|
||||
<div>
|
||||
<span>‮a‭bc</span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc </span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span><span> d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc </span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa<span> d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa </div>
|
||||
</f>
|
||||
|
||||
<f class="min">
|
||||
<div>
|
||||
<span>‮a‭bc</span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc </span><span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span><span> d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc </span>aa<span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa<span> d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span> aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa <span>d‮e‭f</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>‮a‭bc</span>aa </div>
|
||||
</f>
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>CSS Reference: min/max-content size on box-decoration-break:slice inline box w. white-space:nowrap</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<style>
|
||||
html,body {
|
||||
color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 5px solid blue;
|
||||
white-space: pre;
|
||||
}
|
||||
.max > div {
|
||||
width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
span {
|
||||
border: 2px solid gray;
|
||||
padding: 0 10px 0 6px;
|
||||
border-width: 0 8px 0 5px;
|
||||
margin: 0 4px 0 3px;
|
||||
background: yellow;
|
||||
}
|
||||
|
||||
f { margin-right: 30px; float: left; }
|
||||
</style>
|
||||
<body>
|
||||
<f class="max">
|
||||
<div><span>aaa</span><span>aaa</span></div>
|
||||
<div><span>aaa</span>aa<span>aaa</span></div>
|
||||
<div><span>aaa</span> <span>aaa</span></div>
|
||||
<div><span>aaa </span><span>aaa</span></div>
|
||||
<div><span>aaa</span><span> aaa</span></div>
|
||||
<div><span>aaa</span> aa<span>aaa</span></div>
|
||||
<div><span>aaa </span>aa<span>aaa</span></div>
|
||||
<div><span>aaa</span>aa<span> aaa</span></div>
|
||||
<div><span>aaa</span> aa <span>aaa</span></div>
|
||||
<div><span>aaa</span>aa <span>aaa</span></div>
|
||||
<div><span>aaa</span>aa</div>
|
||||
</f>
|
||||
|
||||
<f class="max">
|
||||
<div><span>aaa</span><span>aaa</span></div>
|
||||
<div><span>aaa</span>aa<span>aaa</span></div>
|
||||
<div><span>aaa</span> <span>aaa</span></div>
|
||||
<div><span>aaa </span><span>aaa</span></div>
|
||||
<div><span>aaa</span><span> aaa</span></div>
|
||||
<div><span>aaa</span> aa<span>aaa</span></div>
|
||||
<div><span>aaa </span>aa<span>aaa</span></div>
|
||||
<div><span>aaa</span>aa<span> aaa</span></div>
|
||||
<div><span>aaa</span> aa <span>aaa</span></div>
|
||||
<div><span>aaa</span>aa <span>aaa</span></div>
|
||||
<div><span>aaa</span>aa</div>
|
||||
</f>
|
|
@ -0,0 +1,111 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>CSS Test: min/max-content size on box-decoration-break:slice inline box w. white-space:nowrap</title>
|
||||
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#valdef-width-min-content">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-break-3/#break-decoration">
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1556709">
|
||||
<link rel="match" href="slice-nowrap-intrinsic-size-ref.html">
|
||||
<style>
|
||||
html,body {
|
||||
color:black; background-color:white; font:10px/1 monospace; padding:0; margin:0;
|
||||
}
|
||||
|
||||
div {
|
||||
border: 5px solid blue;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.max > div {
|
||||
width: -moz-max-content;
|
||||
width: -webkit-max-content;
|
||||
width: max-content;
|
||||
}
|
||||
.min > div {
|
||||
width: -moz-min-content;
|
||||
width: -webkit-min-content;
|
||||
width: min-content;
|
||||
}
|
||||
|
||||
span {
|
||||
border: 2px solid gray;
|
||||
padding: 0 10px 0 6px;
|
||||
border-width: 0 8px 0 5px;
|
||||
margin: 0 4px 0 3px;
|
||||
background: yellow;
|
||||
/* for clarity: */
|
||||
-webkit-box-decoration-break: slice;
|
||||
box-decoration-break: slice;
|
||||
}
|
||||
|
||||
f { margin-right: 30px; float: left; }
|
||||
</style>
|
||||
<body>
|
||||
<f class="max">
|
||||
<div>
|
||||
<span>aaa</span><span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa </span><span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span><span> aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa </span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa<span> aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> aa <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa </div>
|
||||
</f>
|
||||
|
||||
<f class="min">
|
||||
<div>
|
||||
<span>aaa</span><span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa </span><span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span><span> aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa </span>aa<span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa<span> aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span> aa <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa <span>aaa</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>aaa</span>aa </div>
|
||||
</f>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Text Decoration Test: parsing text-underline-offset computed values</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#underline-offset">
|
||||
<meta name="assert" content="text-underline-offset computed value is as specified.">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/computed-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
test_computed_value("text-underline-offset", "auto");
|
||||
test_computed_value("text-underline-offset", "from-font");
|
||||
test_computed_value("text-underline-offset", "calc(10px - 8px)", "2px");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" title="2.4 Text Underline Offset: the 'text-underline-offset' property"
|
||||
href="https://drafts.csswg.org/css-text-decor-4/#underline-offset" />
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_equals(getComputedStyle(document.body)["text-underline-offset"], "auto", "Must be set to value auto as initial value.");
|
||||
}, "Initial value of text-underline-offset");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Text Decoration Test: parsing text-underline-offset with invalid values</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#underline-offset">
|
||||
<meta name="assert" content="text-underline-offset supports the following values: auto | from-font| <length>">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/parsing-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test_invalid_value("text-underline-offset", "otto");
|
||||
test_invalid_value("text-underline-offset", "asdlflj");
|
||||
test_invalid_value("text-underline-offset", "-10");
|
||||
test_invalid_value("text-underline-offset", "60002020");
|
||||
test_invalid_value("text-underline-offset", "!@#$%^&");
|
||||
test_invalid_value("text-underline-offset", "10e2");
|
||||
test_invalid_value("text-underline-offset", "from font");
|
||||
test_invalid_value("text-underline-offset", "10%");
|
||||
test_invalid_value("text-underline-offset", "-27%");
|
||||
test_invalid_value("text-underline-offset", "calc(40% - 20px)");
|
||||
test_invalid_value("text-underline-offset", "calc(100% - 40em)");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Text Decoration Test: parsing text-underline-offset with valid values</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#underline-offset">
|
||||
<meta name="assert" content="text-underline-offset supports the following values: auto | from-font| <length>">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/css/support/parsing-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test_valid_value("text-underline-offset", "auto");
|
||||
test_valid_value("text-underline-offset", "from-font");
|
||||
test_valid_value("text-underline-offset", "-10px");
|
||||
test_valid_value("text-underline-offset", "2001em");
|
||||
test_valid_value("text-underline-offset", "-49em");
|
||||
test_valid_value("text-underline-offset", "53px");
|
||||
test_valid_value("text-underline-offset", "calc(40em - 10px)");
|
||||
test_valid_value("text-underline-offset", "calc(-13em + 50px)");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -15,6 +15,7 @@
|
|||
-->
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
|
||||
<style>
|
||||
#parent {
|
||||
position: absolute;
|
||||
|
@ -27,9 +28,13 @@
|
|||
</style>
|
||||
<div id=parent> <span id=target> </span></div>
|
||||
<script>
|
||||
test(
|
||||
function() {
|
||||
var e = document.elementFromPoint(125,25);
|
||||
assert_equals(e.id,"target", "the element targeted by a hit on the ellipsis is the elided inline.");
|
||||
}, "Checks hit testing on the ellipsis");
|
||||
setup({explicit_done: true});
|
||||
document.fonts.ready.then(()=> {
|
||||
test(
|
||||
function() {
|
||||
var e = document.elementFromPoint(125,25);
|
||||
assert_equals(e.id,"target", "the element targeted by a hit on the ellipsis is the elided inline.");
|
||||
}, "Checks hit testing on the ellipsis");
|
||||
done();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -29,7 +29,8 @@ body {
|
|||
let beforeRender = performance.now();
|
||||
let numObservedElements = 0;
|
||||
let observedDiv1 = false;
|
||||
let observedDiv2 = false;
|
||||
let observedDiv2Img = false;
|
||||
let observedDiv2Txt = false;
|
||||
const index = window.location.href.lastIndexOf('/');
|
||||
const pathname = window.location.href.substring(0, index) +
|
||||
'/resources/square100.png';
|
||||
|
@ -46,19 +47,29 @@ body {
|
|||
checkNaturalSize(entry, 100, 100);
|
||||
}
|
||||
else if (entry.id == 'div2') {
|
||||
observedDiv2 = true;
|
||||
checkElement(entry, pathname, 'et2', 'div2', beforeRender,
|
||||
// Check image entry.
|
||||
if (entry.name !== 'text-paint') {
|
||||
observedDiv2Img = true;
|
||||
checkElement(entry, pathname, 'et2', 'div2', beforeRender,
|
||||
document.getElementById('div2'));
|
||||
// Div is below div1, on the left.
|
||||
checkRect(entry, [0, 200, 100, 200]);
|
||||
checkNaturalSize(entry, 100, 100);
|
||||
}
|
||||
// Check the text entry.
|
||||
else {
|
||||
observedDiv2Txt = true;
|
||||
checkTextElement(entry, 'et2', 'div2', beforeRender,
|
||||
document.getElementById('div2'));
|
||||
// Div is below div1, on the left.
|
||||
checkRect(entry, [0, 200, 100, 200]);
|
||||
checkNaturalSize(entry, 100, 100);
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert_unreached("Should not observe other elements!");
|
||||
}
|
||||
if (numObservedElements === 2) {
|
||||
if (numObservedElements === 3) {
|
||||
assert_true(observedDiv1);
|
||||
assert_true(observedDiv2);
|
||||
assert_true(observedDiv2Img);
|
||||
assert_true(observedDiv2Txt);
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<meta charset=utf-8>
|
||||
<title>Element Timing: observe text</title>
|
||||
<body>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/element-timing-helpers.js"></script>
|
||||
<script>
|
||||
async_test((t) => {
|
||||
if (!window.PerformanceElementTiming) {
|
||||
assert_unreached("PerformanceElementTiming is not implemented");
|
||||
}
|
||||
let paragraph;
|
||||
let beforeRender;
|
||||
const observer = new PerformanceObserver(
|
||||
t.step_func_done((entryList) => {
|
||||
assert_equals(entryList.getEntries().length, 1);
|
||||
checkTextElement(entryList.getEntries()[0], 'my_text', 'text_id', beforeRender, paragraph);
|
||||
})
|
||||
);
|
||||
observer.observe({entryTypes: ['element']});
|
||||
// We add the iframe during onload to be sure that the observer is registered
|
||||
// in time for it to observe the element timing.
|
||||
window.onload = () => {
|
||||
paragraph = document.createElement('p');
|
||||
paragraph.innerHTML = 'This is text I care about';
|
||||
paragraph.setAttribute('elementtiming', 'my_text');
|
||||
paragraph.setAttribute('id', 'text_id');
|
||||
document.body.appendChild(paragraph);
|
||||
beforeRender = performance.now();
|
||||
};
|
||||
}, 'Paragraph with elementtiming attribute is observed.');
|
||||
</script>
|
||||
|
||||
</body>
|
|
@ -2,7 +2,6 @@
|
|||
function checkElementInternal(entry, expectedUrl, expectedIdentifier, expectedID, beforeRender,
|
||||
expectedElement) {
|
||||
assert_equals(entry.entryType, 'element');
|
||||
assert_equals(entry.name, 'image-paint');
|
||||
assert_equals(entry.url, expectedUrl);
|
||||
assert_equals(entry.identifier, expectedIdentifier);
|
||||
assert_equals(entry.duration, 0);
|
||||
|
@ -19,6 +18,7 @@ function checkElement(entry, expectedUrl, expectedIdentifier, expectedID, before
|
|||
expectedElement) {
|
||||
checkElementInternal(entry, expectedUrl, expectedIdentifier, expectedID, beforeRender,
|
||||
expectedElement);
|
||||
assert_equals(entry.name, 'image-paint');
|
||||
const rt_entries = performance.getEntriesByName(expectedUrl, 'resource');
|
||||
assert_equals(rt_entries.length, 1);
|
||||
assert_equals(rt_entries[0].responseEnd, entry.responseEnd);
|
||||
|
@ -28,6 +28,7 @@ function checkElementWithoutResourceTiming(entry, expectedUrl, expectedIdentifie
|
|||
expectedID, beforeRender, expectedElement) {
|
||||
checkElementInternal(entry, expectedUrl, expectedIdentifier, expectedID, beforeRender,
|
||||
expectedElement);
|
||||
assert_equals(entry.name, 'image-paint');
|
||||
// No associated resource from ResourceTiming, so the responseEnd should be 0.
|
||||
assert_equals(entry.responseEnd, 0);
|
||||
}
|
||||
|
@ -49,3 +50,11 @@ function checkNaturalSize(entry, width, height) {
|
|||
assert_equals(entry.naturalWidth, width);
|
||||
assert_equals(entry.naturalHeight, height);
|
||||
}
|
||||
|
||||
function checkTextElement(entry, expectedIdentifier, expectedID, beforeRender,
|
||||
expectedElement) {
|
||||
checkElementInternal(entry, '', expectedIdentifier, expectedID, beforeRender,
|
||||
expectedElement);
|
||||
assert_equals(entry.name, 'text-paint');
|
||||
assert_equals(entry.responseEnd, 0);
|
||||
}
|
||||
|
|
|
@ -1,132 +0,0 @@
|
|||
// META: script=resources/test-helpers.js
|
||||
promise_test(async t => cleanupSandboxedFileSystem(),
|
||||
'Cleanup to setup test environment');
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
const old_handle = await createFileWithContents(t, 'old-file', '12345', dir);
|
||||
const new_handle = await old_handle.copyTo(dir, 'new-name');
|
||||
t.add_cleanup(() => new_handle.remove());
|
||||
|
||||
// Verify new file.
|
||||
assert_true(new_handle.isFile);
|
||||
assert_false(new_handle.isDirectory);
|
||||
assert_equals(new_handle.name, 'new-name');
|
||||
assert_equals(await getFileContents(new_handle), '12345');
|
||||
|
||||
// And verify old file is still around as well.
|
||||
assert_equals(await getFileContents(old_handle), '12345');
|
||||
|
||||
// Verify directory entries.
|
||||
assert_array_equals(await getSortedDirectoryEntries(dir), ['new-name', 'old-file']);
|
||||
}, 'copyTo() into the same parent directory');
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
const old_handle = await createFileWithContents(t, 'old-file', '12345');
|
||||
const target_dir = await dir.getDirectory('dir-name', { create: true });
|
||||
t.add_cleanup(() => target_dir.removeRecursively());
|
||||
|
||||
const new_handle = await old_handle.copyTo(target_dir);
|
||||
|
||||
// Verify new file.
|
||||
assert_true(new_handle.isFile);
|
||||
assert_false(new_handle.isDirectory);
|
||||
assert_equals(new_handle.name, 'old-file');
|
||||
assert_equals(await getFileContents(new_handle), '12345');
|
||||
|
||||
// And verify old file is still around as well.
|
||||
assert_equals(await getFileContents(old_handle), '12345');
|
||||
|
||||
// Verify directory entries.
|
||||
assert_array_equals(await getSortedDirectoryEntries(dir), ['dir-name/', 'old-file']);
|
||||
assert_array_equals(await getSortedDirectoryEntries(target_dir), ['old-file']);
|
||||
}, 'copyTo() to copy a file into a sub-directory');
|
||||
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
const handle = await createFileWithContents(t, 'old-file', '12345', dir);
|
||||
|
||||
await promise_rejects(t, 'InvalidModificationError', handle.copyTo(dir));
|
||||
await promise_rejects(t, 'InvalidModificationError', handle.copyTo(dir, handle.name));
|
||||
|
||||
// Verify file still exists.
|
||||
assert_equals(await getFileContents(handle), '12345');
|
||||
assert_array_equals(await getSortedDirectoryEntries(dir), ['old-file']);
|
||||
}, 'copyTo() with existing name and parent should fail');
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
const handle = await createFileWithContents(t, 'old-file', '12345', dir);
|
||||
const target_handle = await createFileWithContents(t, 'target', 'abc', dir);
|
||||
|
||||
await handle.copyTo(dir, target_handle.name);
|
||||
|
||||
// Verify state of files.
|
||||
assert_equals(await getFileContents(handle), '12345');
|
||||
assert_equals(await getFileContents(target_handle), '12345');
|
||||
assert_array_equals(await getSortedDirectoryEntries(dir), ['old-file', 'target']);
|
||||
}, 'copyTo() when target file already exists should overwrite target');
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
|
||||
const subdir_name = 'subdir-name';
|
||||
const subdir = await createDirectory(t, subdir_name, /*parent=*/dir);
|
||||
|
||||
const file_name = 'file-name';
|
||||
const file = await createEmptyFile(t, file_name, /*parent=*/subdir);
|
||||
|
||||
// An empty name indicates that the filename should remain unchanged.
|
||||
await file.copyTo(dir, /*name=*/"");
|
||||
await dir.getFile(file_name);
|
||||
}, `copyTo() when target is empty`);
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
|
||||
const subdir_name = 'subdir-name';
|
||||
const subdir = await createDirectory(t, subdir_name, /*parent=*/dir);
|
||||
|
||||
const file_name = 'file-name';
|
||||
const file = await createEmptyFile(t, file_name, /*parent=*/subdir);
|
||||
|
||||
await promise_rejects(t, 'SecurityError', file.copyTo(dir, /*name=*/kCurrentDirectory));
|
||||
}, `copyTo() when target is ${kCurrentDirectory}`);
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
|
||||
const first_subdir_name = 'first-subdir-name';
|
||||
const first_subdir = await createDirectory(t, first_subdir_name, /*parent=*/dir);
|
||||
|
||||
const second_subdir_name = 'second-subdir-name';
|
||||
const second_subdir = await createDirectory(t, second_subdir_name, /*parent=*/first_subdir);
|
||||
|
||||
const file_name = 'file-name';
|
||||
const file = await createEmptyFile(t, file_name, /*parent=*/second_subdir);
|
||||
|
||||
await promise_rejects(t, 'SecurityError', file.copyTo(first_subdir, /*name=*/kParentDirectory));
|
||||
}, `copyTo() when target is ${kParentDirectory}`);
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
|
||||
const file_name = 'file-name';
|
||||
const file = await createEmptyFile(t, file_name, /*parent=*/dir);
|
||||
|
||||
const first_subdir_name = 'first-subdir-name';
|
||||
const first_subdir = await createDirectory(t, first_subdir_name, /*parent=*/dir);
|
||||
|
||||
const second_subdir_name = 'second-subdir-name';
|
||||
const second_subdir = await createDirectory(t, second_subdir_name, /*parent=*/first_subdir);
|
||||
|
||||
for (let i = 0; i < kPathSeparators.length; ++i) {
|
||||
const path_with_separator = `${second_subdir_name}${kPathSeparators[i]}${file_name}`;
|
||||
await promise_rejects(t, 'SecurityError', file.copyTo(first_subdir, path_with_separator),
|
||||
`copyTo() must reject names containing "${kPathSeparators[i]}"`);
|
||||
}
|
||||
}, 'copyTo() when target contains path separator');
|
||||
|
||||
// TODO(mek): Tests to copy directories.
|
|
@ -1,131 +0,0 @@
|
|||
// META: script=resources/test-helpers.js
|
||||
promise_test(async t => cleanupSandboxedFileSystem(),
|
||||
'Cleanup to setup test environment');
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
const old_handle = await createFileWithContents(t, 'old-file', '12345', dir);
|
||||
const new_handle = await old_handle.moveTo(dir, 'new-name');
|
||||
t.add_cleanup(() => new_handle.remove());
|
||||
|
||||
// Verify new file.
|
||||
assert_true(new_handle.isFile);
|
||||
assert_false(new_handle.isDirectory);
|
||||
assert_equals(new_handle.name, 'new-name');
|
||||
assert_equals(await getFileContents(new_handle), '12345');
|
||||
|
||||
// And verify old file is gone.
|
||||
await promise_rejects(t, 'NotFoundError', getFileContents(old_handle));
|
||||
|
||||
// Verify directory entries.
|
||||
assert_array_equals(await getSortedDirectoryEntries(dir), ['new-name']);
|
||||
}, 'moveTo() to rename a file');
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
const old_handle = await createFileWithContents(t, 'old-file', '12345');
|
||||
const target_dir = await dir.getDirectory('dir-name', { create: true });
|
||||
t.add_cleanup(() => target_dir.removeRecursively());
|
||||
|
||||
const new_handle = await old_handle.moveTo(target_dir);
|
||||
|
||||
// Verify new file.
|
||||
assert_true(new_handle.isFile);
|
||||
assert_false(new_handle.isDirectory);
|
||||
assert_equals(new_handle.name, 'old-file');
|
||||
assert_equals(await getFileContents(new_handle), '12345');
|
||||
|
||||
// And verify old file is gone.
|
||||
await promise_rejects(t, 'NotFoundError', getFileContents(old_handle));
|
||||
|
||||
// Verify directory entries.
|
||||
assert_array_equals(await getSortedDirectoryEntries(dir), ['dir-name/']);
|
||||
assert_array_equals(await getSortedDirectoryEntries(target_dir), ['old-file']);
|
||||
}, 'moveTo() to move a file into a sub-directory');
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
const handle = await createFileWithContents(t, 'old-file', '12345', dir);
|
||||
|
||||
await promise_rejects(t, 'InvalidModificationError', handle.moveTo(dir));
|
||||
await promise_rejects(t, 'InvalidModificationError', handle.moveTo(dir, handle.name));
|
||||
|
||||
// Verify file still exists.
|
||||
assert_equals(await getFileContents(handle), '12345');
|
||||
assert_array_equals(await getSortedDirectoryEntries(dir), ['old-file']);
|
||||
}, 'moveTo() with existing name and parent should fail');
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
const handle = await createFileWithContents(t, 'old-file', '12345', dir);
|
||||
const target_handle = await createFileWithContents(t, 'target', 'abc', dir);
|
||||
|
||||
await handle.moveTo(dir, target_handle.name);
|
||||
|
||||
// Verify state of files.
|
||||
await promise_rejects(t, 'NotFoundError', getFileContents(handle));
|
||||
assert_equals(await getFileContents(target_handle), '12345');
|
||||
assert_array_equals(await getSortedDirectoryEntries(dir), ['target']);
|
||||
}, 'moveTo() when target file already exists should overwrite target');
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
|
||||
const subdir_name = 'subdir-name';
|
||||
const subdir = await createDirectory(t, subdir_name, /*parent=*/dir);
|
||||
|
||||
const file_name = 'file-name';
|
||||
const file = await createEmptyFile(t, file_name, /*parent=*/subdir);
|
||||
|
||||
// An empty name indicates that the filename should remain unchanged.
|
||||
await file.moveTo(dir, /*name=*/"");
|
||||
await dir.getFile(file_name);
|
||||
}, `moveTo() when target is empty`);
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
|
||||
const subdir_name = 'subdir-name';
|
||||
const subdir = await createDirectory(t, subdir_name, /*parent=*/dir);
|
||||
|
||||
const file_name = 'file-name';
|
||||
const file = await createEmptyFile(t, file_name, /*parent=*/subdir);
|
||||
|
||||
await promise_rejects(t, 'SecurityError', file.moveTo(dir, /*name=*/kCurrentDirectory));
|
||||
}, `moveTo() when target is ${kCurrentDirectory}`);
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
|
||||
const first_subdir_name = 'first-subdir-name';
|
||||
const first_subdir = await createDirectory(t, first_subdir_name, /*parent=*/dir);
|
||||
|
||||
const second_subdir_name = 'second-subdir-name';
|
||||
const second_subdir = await createDirectory(t, second_subdir_name, /*parent=*/first_subdir);
|
||||
|
||||
const file_name = 'file-name';
|
||||
const file = await createEmptyFile(t, file_name, /*parent=*/second_subdir);
|
||||
|
||||
await promise_rejects(t, 'SecurityError', file.moveTo(first_subdir, /*name=*/kParentDirectory));
|
||||
}, `moveTo() when target is ${kParentDirectory}`);
|
||||
|
||||
promise_test(async t => {
|
||||
const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
|
||||
|
||||
const file_name = 'file-name';
|
||||
const file = await createEmptyFile(t, file_name, /*parent=*/dir);
|
||||
|
||||
const first_subdir_name = 'first-subdir-name';
|
||||
const first_subdir = await createDirectory(t, first_subdir_name, /*parent=*/dir);
|
||||
|
||||
const second_subdir_name = 'second-subdir-name';
|
||||
const second_subdir = await createDirectory(t, second_subdir_name, /*parent=*/first_subdir);
|
||||
|
||||
for (let i = 0; i < kPathSeparators.length; ++i) {
|
||||
const path_with_separator = `${second_subdir_name}${kPathSeparators[i]}${file_name}`;
|
||||
await promise_rejects(t, 'SecurityError', file.moveTo(first_subdir, path_with_separator),
|
||||
`moveTo() must reject names containing "${kPathSeparators[i]}"`);
|
||||
}
|
||||
}, 'moveTo() when target contains path separator');
|
||||
|
||||
// TODO(mek): Tests to move directories.
|
|
@ -88,4 +88,21 @@ async_test(function(t) {
|
|||
.catch(unreached_rejection(t));
|
||||
}, 'Register then Unregister then getRegistration');
|
||||
|
||||
|
||||
promise_test(async function(t) {
|
||||
const scope = 'resources/scope/getregistration/register-unregister';
|
||||
const registration = await service_worker_unregister_and_register(
|
||||
t, 'resources/empty-worker.js', scope
|
||||
);
|
||||
|
||||
const frame = await with_iframe(scope);
|
||||
t.add_cleanup(() => frame.remove());
|
||||
|
||||
const frameNav = frame.contentWindow.navigator;
|
||||
await registration.unregister();
|
||||
const value = await frameNav.serviceWorker.getRegistration(scope);
|
||||
|
||||
assert_equals(value, undefined, 'getRegistration should resolve with undefined');
|
||||
}, 'Register then Unregister then getRegistration in controlled iframe');
|
||||
|
||||
</script>
|
||||
|
|
|
@ -5,180 +5,131 @@
|
|||
<script>
|
||||
var worker_url = 'resources/empty-worker.js';
|
||||
|
||||
async_test(function(t) {
|
||||
var scope = 'resources/scope/unregister-then-register-new-script-that-exists';
|
||||
var new_worker_url = worker_url + '?new';
|
||||
var iframe;
|
||||
var registration;
|
||||
var new_registration;
|
||||
promise_test(async function(t) {
|
||||
const scope = 'resources/scope/unregister-then-register-new-script-that-exists';
|
||||
const registration = await service_worker_unregister_and_register(t, worker_url, scope);
|
||||
t.add_cleanup(() => registration.unregister());
|
||||
|
||||
service_worker_unregister_and_register(t, worker_url, scope)
|
||||
.then(function(r) {
|
||||
registration = r;
|
||||
return wait_for_state(t, r.installing, 'activated');
|
||||
})
|
||||
.then(function() {
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(frame) {
|
||||
iframe = frame;
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
return navigator.serviceWorker.register(new_worker_url,
|
||||
{ scope: scope });
|
||||
})
|
||||
.then(function(r) {
|
||||
new_registration = r;
|
||||
assert_equals(registration.installing.scriptURL,
|
||||
normalizeURL(new_worker_url),
|
||||
'before activated registration.installing');
|
||||
assert_equals(registration.waiting, null,
|
||||
'before activated registration.waiting');
|
||||
assert_equals(registration.active.scriptURL, normalizeURL(worker_url),
|
||||
'before activated registration.active');
|
||||
assert_equals(new_registration.installing.scriptURL,
|
||||
normalizeURL(new_worker_url),
|
||||
'before activated new_registration.installing');
|
||||
assert_equals(new_registration.waiting, null,
|
||||
'before activated new_registration.waiting');
|
||||
assert_equals(new_registration.active.scriptURL,
|
||||
normalizeURL(worker_url),
|
||||
'before activated new_registration.active');
|
||||
iframe.remove();
|
||||
return wait_for_state(t, registration.installing, 'activated');
|
||||
})
|
||||
.then(function() {
|
||||
assert_equals(new_registration.installing, null,
|
||||
'after activated new_registration.installing');
|
||||
assert_equals(new_registration.waiting, null,
|
||||
'after activated new_registration.waiting');
|
||||
assert_equals(new_registration.active.scriptURL,
|
||||
normalizeURL(new_worker_url),
|
||||
'after activated new_registration.active');
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(frame) {
|
||||
assert_equals(
|
||||
frame.contentWindow.navigator.serviceWorker.controller.scriptURL,
|
||||
normalizeURL(new_worker_url),
|
||||
'the new worker should control a new document');
|
||||
frame.remove();
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
t.done();
|
||||
})
|
||||
.catch(unreached_rejection(t));
|
||||
const newWorkerURL = worker_url + '?new';
|
||||
await wait_for_state(t, registration.installing, 'activated');
|
||||
|
||||
const iframe = await with_iframe(scope);
|
||||
t.add_cleanup(() => iframe.remove());
|
||||
|
||||
await registration.unregister();
|
||||
|
||||
const newRegistration = await navigator.serviceWorker.register(newWorkerURL, { scope });
|
||||
t.add_cleanup(() => newRegistration.unregister());
|
||||
|
||||
assert_equals(
|
||||
registration.installing.scriptURL,
|
||||
normalizeURL(newWorkerURL),
|
||||
'before activated registration.installing'
|
||||
);
|
||||
assert_equals(
|
||||
registration.waiting,
|
||||
null,
|
||||
'before activated registration.waiting'
|
||||
);
|
||||
assert_equals(
|
||||
registration.active.scriptURL,
|
||||
normalizeURL(worker_url),
|
||||
'before activated registration.active'
|
||||
);
|
||||
assert_equals(
|
||||
newRegistration.installing.scriptURL,
|
||||
normalizeURL(newWorkerURL),
|
||||
'before activated newRegistration.installing'
|
||||
);
|
||||
assert_equals(
|
||||
newRegistration.waiting,
|
||||
null,
|
||||
'before activated newRegistration.waiting'
|
||||
);
|
||||
assert_equals(
|
||||
newRegistration.active.scriptURL,
|
||||
normalizeURL(worker_url),
|
||||
'before activated newRegistration.active'
|
||||
);
|
||||
iframe.remove();
|
||||
|
||||
await wait_for_state(t, registration.installing, 'activated');
|
||||
|
||||
assert_equals(
|
||||
newRegistration.installing,
|
||||
null,
|
||||
'after activated newRegistration.installing'
|
||||
);
|
||||
assert_equals(
|
||||
newRegistration.waiting,
|
||||
null,
|
||||
'after activated newRegistration.waiting'
|
||||
);
|
||||
assert_equals(
|
||||
newRegistration.active.scriptURL,
|
||||
normalizeURL(newWorkerURL),
|
||||
'after activated newRegistration.active'
|
||||
);
|
||||
|
||||
const newIframe = await with_iframe(scope);
|
||||
t.add_cleanup(() => newIframe.remove());
|
||||
|
||||
assert_equals(
|
||||
newIframe.contentWindow.navigator.serviceWorker.controller.scriptURL,
|
||||
normalizeURL(newWorkerURL),
|
||||
'the new worker should control a new document'
|
||||
);
|
||||
}, 'Registering a new script URL while an unregistered registration is in use');
|
||||
|
||||
async_test(function(t) {
|
||||
var scope = 'resources/scope/unregister-then-register-new-script-that-404s';
|
||||
var iframe;
|
||||
var registration;
|
||||
promise_test(async function(t) {
|
||||
const scope = 'resources/scope/unregister-then-register-new-script-that-404s';
|
||||
const registration = await service_worker_unregister_and_register(t, worker_url, scope);
|
||||
t.add_cleanup(() => registration.unregister());
|
||||
|
||||
service_worker_unregister_and_register(t, worker_url, scope)
|
||||
.then(function(r) {
|
||||
registration = r;
|
||||
return wait_for_state(t, r.installing, 'activated');
|
||||
})
|
||||
.then(function() {
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(frame) {
|
||||
iframe = frame;
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
// Step 5.1 of Register clears the uninstall flag before fetching
|
||||
// the script:
|
||||
//
|
||||
// https://w3c.github.io/ServiceWorker/#register-algorithm
|
||||
var promise = navigator.serviceWorker.register('this-will-404',
|
||||
{ scope: scope });
|
||||
return promise;
|
||||
})
|
||||
.then(
|
||||
function() {
|
||||
assert_unreached('register should reject the promise');
|
||||
},
|
||||
function() {
|
||||
assert_equals(registration.installing, null,
|
||||
'registration.installing');
|
||||
assert_equals(registration.waiting, null,
|
||||
'registration.waiting');
|
||||
assert_equals(registration.active.scriptURL, normalizeURL(worker_url),
|
||||
'registration.active');
|
||||
iframe.remove();
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(frame) {
|
||||
assert_equals(
|
||||
frame.contentWindow.navigator.serviceWorker.controller.scriptURL,
|
||||
normalizeURL(worker_url),
|
||||
'the original worker should control a new document');
|
||||
frame.remove();
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
t.done();
|
||||
})
|
||||
.catch(unreached_rejection(t));
|
||||
}, 'Registering a new script URL that 404s does resurrect an ' +
|
||||
'unregistered registration');
|
||||
await wait_for_state(t, registration.installing, 'activated');
|
||||
|
||||
async_test(function(t) {
|
||||
var scope = 'resources/scope/unregister-then-register-reject-install-worker';
|
||||
var iframe;
|
||||
var registration;
|
||||
const iframe = await with_iframe(scope);
|
||||
t.add_cleanup(() => iframe.remove());
|
||||
|
||||
service_worker_unregister_and_register(t, worker_url, scope)
|
||||
.then(function(r) {
|
||||
registration = r;
|
||||
return wait_for_state(t, r.installing, 'activated');
|
||||
})
|
||||
.then(function() {
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(frame) {
|
||||
iframe = frame;
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
// Step 5.1 of Register clears the uninstall flag before firing
|
||||
// the install event:
|
||||
//
|
||||
// https://w3c.github.io/ServiceWorker/#register-algorithm
|
||||
var promise = navigator.serviceWorker.register(
|
||||
'resources/reject-install-worker.js', { scope: scope });
|
||||
return promise;
|
||||
})
|
||||
.then(function(r) {
|
||||
registration = r;
|
||||
return wait_for_state(t, r.installing, 'redundant');
|
||||
})
|
||||
.then(function() {
|
||||
assert_equals(registration.installing, null,
|
||||
'registration.installing');
|
||||
assert_equals(registration.waiting, null,
|
||||
'registration.waiting');
|
||||
assert_equals(registration.active.scriptURL, normalizeURL(worker_url),
|
||||
'registration.active');
|
||||
iframe.remove();
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(frame) {
|
||||
assert_equals(
|
||||
frame.contentWindow.navigator.serviceWorker.controller.scriptURL,
|
||||
normalizeURL(worker_url),
|
||||
'the original worker should control a new document');
|
||||
frame.remove();
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
t.done();
|
||||
})
|
||||
.catch(unreached_rejection(t));
|
||||
}, 'Registering a new script URL that fails to install does resurrect ' +
|
||||
'an unregistered registration');
|
||||
await registration.unregister();
|
||||
|
||||
await promise_rejects(
|
||||
t, new TypeError(),
|
||||
navigator.serviceWorker.register('this-will-404', { scope })
|
||||
);
|
||||
|
||||
assert_equals(registration.installing, null, 'registration.installing');
|
||||
assert_equals(registration.waiting, null, 'registration.waiting');
|
||||
assert_equals(registration.active.scriptURL, normalizeURL(worker_url), 'registration.active');
|
||||
|
||||
const newIframe = await with_iframe(scope);
|
||||
t.add_cleanup(() => newIframe.remove());
|
||||
|
||||
assert_equals(newIframe.contentWindow.navigator.serviceWorker.controller, null, 'Document should not be controlled');
|
||||
}, 'Registering a new script URL that 404s does not resurrect unregistered registration');
|
||||
|
||||
promise_test(async function(t) {
|
||||
const scope = 'resources/scope/unregister-then-register-reject-install-worker';
|
||||
const registration = await service_worker_unregister_and_register(t, worker_url, scope);
|
||||
t.add_cleanup(() => registration.unregister());
|
||||
|
||||
await wait_for_state(t, registration.installing, 'activated');
|
||||
|
||||
const iframe = await with_iframe(scope);
|
||||
t.add_cleanup(() => iframe.remove());
|
||||
|
||||
await registration.unregister();
|
||||
|
||||
const newRegistration = await navigator.serviceWorker.register(
|
||||
'resources/reject-install-worker.js', { scope }
|
||||
);
|
||||
t.add_cleanup(() => newRegistration.unregister());
|
||||
|
||||
await wait_for_state(t, newRegistration.installing, 'redundant');
|
||||
|
||||
assert_equals(registration.installing, null, 'registration.installing');
|
||||
assert_equals(registration.waiting, null, 'registration.waiting');
|
||||
assert_equals(registration.active, null, 'registration.active');
|
||||
assert_not_equals(registration, newRegistration, 'New registration is different');
|
||||
}, 'Registering a new script URL that fails to install does not resurrect unregistered registration');
|
||||
</script>
|
||||
|
|
|
@ -5,100 +5,40 @@
|
|||
<script>
|
||||
var worker_url = 'resources/empty-worker.js';
|
||||
|
||||
promise_test(function(t) {
|
||||
var scope = 'resources/scope/re-register-resolves-to-new-value';
|
||||
var registration;
|
||||
promise_test(async function(t) {
|
||||
const scope = 'resources/scope/re-register-resolves-to-new-value';
|
||||
const registration = await service_worker_unregister_and_register(t, worker_url, scope);
|
||||
t.add_cleanup(() => registration.unregister());
|
||||
|
||||
return service_worker_unregister_and_register(t, worker_url, scope)
|
||||
.then(function(r) {
|
||||
t.add_cleanup(function() {
|
||||
return service_worker_unregister(t, scope);
|
||||
});
|
||||
await wait_for_state(t, r.installing, 'activated');
|
||||
await registration.unregister();
|
||||
const newRegistration = await navigator.serviceWorker.register(worker_url, { scope });
|
||||
t.add_cleanup(() => newRegistration.unregister());
|
||||
|
||||
registration = r;
|
||||
return wait_for_state(t, r.installing, 'activated');
|
||||
})
|
||||
.then(function() {
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
return navigator.serviceWorker.register(worker_url, { scope: scope });
|
||||
})
|
||||
.then(function(new_registration) {
|
||||
assert_not_equals(registration, new_registration,
|
||||
'register should resolve to a new value');
|
||||
});
|
||||
assert_not_equals(
|
||||
registration, newRegistration,
|
||||
'register should resolve to a new value'
|
||||
);
|
||||
}, 'Unregister then register resolves to a new value');
|
||||
|
||||
promise_test(function(t) {
|
||||
var scope = 'resources/scope/re-register-while-old-registration-in-use';
|
||||
var registration;
|
||||
promise_test(async function(t) {
|
||||
const scope = 'resources/scope/re-register-while-old-registration-in-use';
|
||||
const registration = await service_worker_unregister_and_register(t, worker_url, scope);
|
||||
t.add_cleanup(() => registration.unregister());
|
||||
|
||||
return service_worker_unregister_and_register(t, worker_url, scope)
|
||||
.then(function(r) {
|
||||
t.add_cleanup(function() {
|
||||
return service_worker_unregister(t, scope);
|
||||
});
|
||||
await wait_for_state(t, registration.installing, 'activated');
|
||||
const frame = await with_iframe(scope);
|
||||
t.add_cleanup(() => frame.remove());
|
||||
|
||||
registration = r;
|
||||
return wait_for_state(t, r.installing, 'activated');
|
||||
})
|
||||
.then(function() {
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(frame) {
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
return navigator.serviceWorker.register(worker_url, { scope: scope });
|
||||
})
|
||||
.then(function(new_registration) {
|
||||
assert_equals(registration, new_registration,
|
||||
'new registration should resolve to the same registration');
|
||||
});
|
||||
}, 'Unregister then register resolves to the original value if the ' +
|
||||
'registration is in use.');
|
||||
await registration.unregister();
|
||||
const newRegistration = await navigator.serviceWorker.register(worker_url, { scope });
|
||||
t.add_cleanup(() => newRegistration.unregister());
|
||||
|
||||
promise_test(function(t) {
|
||||
var scope = 'resources/scope/complete-unregistration-followed-by-' +
|
||||
'reloading-controllee-iframe';
|
||||
var registration;
|
||||
var frame;
|
||||
var service_worker;
|
||||
return service_worker_unregister_and_register(t, worker_url, scope)
|
||||
.then(function(r) {
|
||||
t.add_cleanup(function() {
|
||||
return service_worker_unregister(t, scope);
|
||||
});
|
||||
|
||||
registration = r;
|
||||
return wait_for_state(t, r.installing, 'activated');
|
||||
})
|
||||
.then(function() {
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(f) {
|
||||
frame = f;
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
return new Promise(function(resolve) {
|
||||
frame.onload = resolve;
|
||||
frame.contentWindow.location.reload();
|
||||
});
|
||||
})
|
||||
.then(function() {
|
||||
var c = frame.contentWindow.navigator.serviceWorker.controller;
|
||||
assert_equals(c, null, 'a page after unregistration should not be ' +
|
||||
'controlled by service worker');
|
||||
return navigator.serviceWorker.getRegistration(scope);
|
||||
})
|
||||
.then(function(r) {
|
||||
assert_equals(r, undefined, 'getRegistration should return ' +
|
||||
'undefined after unregistration');
|
||||
});
|
||||
}, 'Reloading the last controlled iframe after unregistration should ensure ' +
|
||||
'the deletion of the registration');
|
||||
assert_not_equals(
|
||||
registration, newRegistration,
|
||||
'Unregister and register should always create a new registration'
|
||||
);
|
||||
}, 'Unregister then register does not resolve to the original value even if the registration is in use.');
|
||||
|
||||
promise_test(function(t) {
|
||||
var scope = 'resources/scope/re-register-does-not-affect-existing-controllee';
|
||||
|
@ -109,8 +49,8 @@ promise_test(function(t) {
|
|||
return service_worker_unregister_and_register(t, worker_url, scope)
|
||||
.then(function(r) {
|
||||
t.add_cleanup(function() {
|
||||
return service_worker_unregister(t, scope);
|
||||
});
|
||||
return service_worker_unregister(t, scope);
|
||||
});
|
||||
|
||||
registration = r;
|
||||
return wait_for_state(t, r.installing, 'activated');
|
||||
|
@ -138,39 +78,30 @@ promise_test(function(t) {
|
|||
});
|
||||
}, 'Unregister then register does not affect existing controllee');
|
||||
|
||||
promise_test(function(t) {
|
||||
var scope = 'resources/scope/resurrection';
|
||||
var iframe;
|
||||
var registration;
|
||||
promise_test(async function(t) {
|
||||
const scope = 'resources/scope/resurrection';
|
||||
const altWorkerURL = worker_url + '?alt';
|
||||
const registration = await service_worker_unregister_and_register(t, worker_url, scope);
|
||||
t.add_cleanup(() => registration.unregister());
|
||||
|
||||
return service_worker_unregister_and_register(t, worker_url, scope)
|
||||
.then(function(r) {
|
||||
t.add_cleanup(function() {
|
||||
return service_worker_unregister(t, scope);
|
||||
});
|
||||
await wait_for_state(t, registration.installing, 'activating');
|
||||
const iframe = await with_iframe(scope);
|
||||
t.add_cleanup(() => iframe.remove());
|
||||
|
||||
registration = r;
|
||||
return wait_for_state(t, r.installing, 'activated');
|
||||
})
|
||||
.then(function() {
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(frame) {
|
||||
iframe = frame;
|
||||
return registration.unregister();
|
||||
})
|
||||
.then(function() {
|
||||
return navigator.serviceWorker.register(worker_url, { scope: scope });
|
||||
})
|
||||
.then(function() {
|
||||
iframe.remove();
|
||||
return with_iframe(scope);
|
||||
})
|
||||
.then(function(frame) {
|
||||
assert_not_equals(
|
||||
frame.contentWindow.navigator.serviceWorker.controller, null,
|
||||
'document should have a controller');
|
||||
frame.remove();
|
||||
});
|
||||
}, 'Unregister then register resurrects the registration');
|
||||
await registration.unregister();
|
||||
const newRegistration = await navigator.serviceWorker.register(altWorkerURL, { scope });
|
||||
t.add_cleanup(() => newRegistration.unregister());
|
||||
|
||||
assert_equals(newRegistration.active, null, 'Registration is new');
|
||||
|
||||
await wait_for_state(t, newRegistration.installing, 'activating');
|
||||
|
||||
const newIframe = await with_iframe(scope);
|
||||
t.add_cleanup(() => newIframe.remove());
|
||||
|
||||
const iframeController = iframe.contentWindow.navigator.serviceWorker.controller;
|
||||
const newIframeController = newIframe.contentWindow.navigator.serviceWorker.controller;
|
||||
|
||||
assert_not_equals(iframeController, newIframeController, 'iframes have different controllers');
|
||||
}, 'Unregister then register does not resurrect the registration');
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue