Auto merge of #24588 - servo-wpt-sync:wpt_update_30-10-2019, r=servo-wpt-sync

Sync WPT with upstream (30-10-2019)

Automated downstream sync of changes from upstream as of 30-10-2019.
[no-wpt-sync]
r? @servo-wpt-sync
This commit is contained in:
bors-servo 2019-10-30 09:50:03 -04:00 committed by GitHub
commit d671010e46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
145 changed files with 2705 additions and 367 deletions

View file

@ -14,9 +14,6 @@
[Revoke blob URL after creating Request, will fetch]
expected: FAIL
[Revoke blob URL after calling fetch, fetch should succeed]
expected: FAIL
[url-with-fetch.any.html]
[Untitled]
@ -37,6 +34,3 @@
[Revoke blob URL after creating Request, will fetch]
expected: FAIL
[Revoke blob URL after calling fetch, fetch should succeed]
expected: FAIL

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
[word-break-min-content-001.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[word-break-min-content-002.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[word-break-min-content-004.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[word-break-min-content-005.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[word-break-min-content-006.html]
expected: FAIL

View file

@ -1,4 +1,5 @@
[perspective-interpolation.html]
expected: CRASH
[ perspective interpolation]
expected: FAIL

View file

@ -3,9 +3,6 @@
[throws if handleEvent is falsy and not callable]
expected: NOTRUN
[looks up handleEvent method on every event dispatch]
expected: FAIL
[rethrows errors when getting handleEvent]
expected: TIMEOUT

View file

@ -2,6 +2,6 @@
[listeners are called when <iframe> is resized]
expected: FAIL
[listeners are called correct number of times]
[listener that was added twice is called only once]
expected: FAIL

View file

@ -0,0 +1,4 @@
[HTMLCollection-own-props.html]
[Setting array index while indexed property doesn't exist (strict)]
expected: FAIL

View file

@ -0,0 +1,2 @@
[contenttype_txt.html]
expected: CRASH

View file

@ -0,0 +1,112 @@
[aria-attribute-reflection.tentative.html]
[aria-relevant attribute reflects.]
expected: FAIL
[aria-required attribute reflects.]
expected: FAIL
[aria-busy attribute reflects.]
expected: FAIL
[aria-current attribute reflects.]
expected: FAIL
[aria-valuetext attribute reflects.]
expected: FAIL
[aria-atomic attribute reflects.]
expected: FAIL
[aria-label attribute reflects.]
expected: FAIL
[aria-setsize attribute reflects.]
expected: FAIL
[aria-rowcount attribute reflects.]
expected: FAIL
[aria-valuemax attribute reflects.]
expected: FAIL
[role attribute reflects.]
expected: FAIL
[aria-sort attribute reflects.]
expected: FAIL
[aria-placeholder attribute reflects.]
expected: FAIL
[aria-live attribute reflects.]
expected: FAIL
[aria-valuenow attribute reflects.]
expected: FAIL
[aria-colcount attribute reflects.]
expected: FAIL
[aria-checked attribute reflects.]
expected: FAIL
[aria-rowspan attribute reflects.]
expected: FAIL
[aria-pressed attribute reflects.]
expected: FAIL
[aria-hidden attribute reflects.]
expected: FAIL
[aria-multiselectable attribute reflects.]
expected: FAIL
[aria-autocomplete attribute reflects.]
expected: FAIL
[aria-posinset attribute reflects.]
expected: FAIL
[aria-rowindex attribute reflects.]
expected: FAIL
[aria-valuemin attribute reflects.]
expected: FAIL
[aria-level attribute reflects.]
expected: FAIL
[aria-disabled attribute reflects.]
expected: FAIL
[aria-orientation attribute reflects.]
expected: FAIL
[aria-colspan attribute reflects.]
expected: FAIL
[aria-colindex attribute reflects.]
expected: FAIL
[aria-roledescription attribute reflects.]
expected: FAIL
[aria-haspopup attribute reflects.]
expected: FAIL
[aria-readonly attribute reflects.]
expected: FAIL
[aria-expanded attribute reflects.]
expected: FAIL
[aria-modal attribute reflects.]
expected: FAIL
[aria-keyshortcuts attribute reflects.]
expected: FAIL
[aria-multiline attribute reflects.]
expected: FAIL

View file

@ -318,21 +318,18 @@
[<iframe>: separate response Content-Type: text/plain */*;charset=gbk]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*]
expected: FAIL
[<iframe>: combined response Content-Type: */* text/html]
[<iframe>: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*;charset=gbk]
[<iframe>: combined response Content-Type: text/html */*]
expected: FAIL
[<iframe>: separate response Content-Type: text/plain */*]
[<iframe>: separate response Content-Type: text/html;x=" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;" \\" text/plain]
[<iframe>: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL

View file

@ -53,9 +53,6 @@
[combined text/javascript ]
expected: FAIL
[separate text/javascript x/x]
expected: FAIL
[separate text/javascript;charset=windows-1252 text/javascript]
expected: FAIL

View file

@ -11,3 +11,6 @@
[X-Content-Type-Options%3A%20nosniff%0C]
expected: FAIL
[X-Content-Type-Options%3A%20%40%23%24%23%25%25%26%5E%26%5E*()()11!%2Cnosniff]
expected: FAIL

View file

@ -1,5 +1,6 @@
[embedded-credentials.tentative.sub.html]
type: testharness
expected: TIMEOUT
[Embedded credentials are treated as network errors.]
expected: FAIL
@ -10,5 +11,11 @@
expected: FAIL
[Embedded credentials matching the top-level are treated as network errors for cross-origin URLs.]
expected: FAIL
expected: TIMEOUT
[Embedded credentials matching the top-level are not treated as network errors for same-origin URLs.]
expected: TIMEOUT
[Embedded credentials matching the top-level are not treated as network errors for relative URLs.]
expected: TIMEOUT

View file

@ -1,4 +0,0 @@
[navigation-unload-same-origin-fragment.html]
[Tests that a fragment navigation in the unload handler will not block the initial navigation]
expected: FAIL

View file

@ -0,0 +1,4 @@
[scroll-to-top.html]
[Fragment Navigation: When fragid is TOP scroll to the top of the document]
expected: FAIL

View file

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

View file

@ -1,4 +1,4 @@
[traverse_the_history_3.html]
[traverse_the_history_2.html]
[Multiple history traversals, last would be aborted]
expected: FAIL

View file

@ -0,0 +1,4 @@
[sandbox-new-execution-context.html]
[iframe with sandbox should load with new execution context]
expected: FAIL

View file

@ -0,0 +1,4 @@
[creating_browsing_context_test_01.html]
[first argument: absolute url]
expected: FAIL

View file

@ -1,5 +1,24 @@
[open-features-negative-innerwidth-innerheight.html]
type: testharness
expected: TIMEOUT
[HTML: window.open `features`: negative values for legacy `innerwidth`, `innerheight`]
expected: FAIL
[features "innerheight=-404.5" should NOT set "height=404"]
expected: TIMEOUT
[features "innerwidth=-404.5" should NOT set "width=404"]
expected: TIMEOUT
[features "innerwidth=-404" should NOT set "width=404"]
expected: TIMEOUT
[features "innerheight=-404e1" should NOT set "height=404"]
expected: TIMEOUT
[features "innerheight=-404" should NOT set "height=404"]
expected: TIMEOUT
[features "innerwidth=-404e1" should NOT set "width=404"]
expected: TIMEOUT

View file

@ -1,5 +1,24 @@
[open-features-negative-width-height.html]
type: testharness
expected: TIMEOUT
[HTML: window.open `features`: negative values for `width`, `height`]
expected: FAIL
[features "height=-404" should NOT set "height=404"]
expected: TIMEOUT
[features "height=-404e1" should NOT set "height=404"]
expected: TIMEOUT
[features "height=-404.5" should NOT set "height=404"]
expected: TIMEOUT
[features "width=-404" should NOT set "width=404"]
expected: TIMEOUT
[features "width=-404e1" should NOT set "width=404"]
expected: TIMEOUT
[features "width=-404.5" should NOT set "width=404"]
expected: TIMEOUT

View file

@ -1,32 +1,48 @@
[open-features-non-integer-height.html]
type: testharness
expected: TIMEOUT
[HTML: window.open `features`: non-integer values for feature `height`]
expected: FAIL
[features "height=405*3" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "height=405.32" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "height=405e1" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "height=405/5" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "height=405^4" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "height=405.5" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "height=405e-1" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "height=405 " should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "height=405LLl" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "height=/404" should NOT set "height=404"]
expected: TIMEOUT
[top=0,left=0,width=401,: absence of feature "height" should be treated same as "height=0"]
expected: TIMEOUT
[top=0,left=0: absence of feature "height" should be treated same as "height=0"]
expected: TIMEOUT
[features "height=_404" should NOT set "height=404"]
expected: TIMEOUT
[features "height=L404" should NOT set "height=404"]
expected: TIMEOUT

View file

@ -1,32 +1,42 @@
[open-features-non-integer-innerheight.html]
type: testharness
expected: TIMEOUT
[HTML: window.open `features`: non-integer values for legacy feature `innerheight`]
expected: FAIL
[features "innerheight=405e-1" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "innerheight=405LLl" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "innerheight=405^4" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "innerheight=405e1" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "innerheight=405 " should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "innerheight=405/5" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "innerheight=405.32" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "innerheight=405.5" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "innerheight=405*3" should set "height=405"]
expected: FAIL
expected: TIMEOUT
[features "innerheight=_404" should NOT set "height=404"]
expected: TIMEOUT
[features "innerheight=L404" should NOT set "height=404"]
expected: TIMEOUT
[features "innerheight=/404" should NOT set "height=404"]
expected: TIMEOUT

View file

@ -1,32 +1,42 @@
[open-features-non-integer-innerwidth.html]
type: testharness
expected: TIMEOUT
[HTML: window.open `features`: non-integer values for legacy feature `innerwidth`]
expected: FAIL
[features "innerwidth=405e-1" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "innerwidth=405*3" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "innerwidth=405.5" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "innerwidth=405e1" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "innerwidth=405.32" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "innerwidth=405 " should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "innerwidth=405LLl" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "innerwidth=405/5" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "innerwidth=405^4" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "innerwidth=/404" should NOT set "width=404"]
expected: TIMEOUT
[features "innerwidth=_404" should NOT set "width=404"]
expected: TIMEOUT
[features "innerwidth=L404" should NOT set "width=404"]
expected: TIMEOUT

View file

@ -1,32 +1,42 @@
[open-features-non-integer-left.html]
type: testharness
expected: TIMEOUT
[HTML: window.open `features`: non-integer values for feature `left`]
expected: FAIL
[features "left=105e1" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "left=105 " should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "left=105/5" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "left=105e-1" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "left=105^4" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "left=105LLl" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "left=105.32" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "left=105*3" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "left=105.5" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "left=L104" should NOT set "left=104"]
expected: TIMEOUT
[features "left=/104" should NOT set "left=104"]
expected: TIMEOUT
[features "left=_104" should NOT set "left=104"]
expected: TIMEOUT

View file

@ -1,16 +1,17 @@
[open-features-non-integer-screenx.html]
type: testharness
expected: TIMEOUT
[HTML: window.open `features`: non-integer values for legacy feature `screenx`]
expected: FAIL
[features "screenx=105.5" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "screenx=105e1" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "screenx=105 " should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "screenx=105*3" should set "left=105"]
expected: FAIL
@ -19,14 +20,20 @@
expected: FAIL
[features "screenx=105^4" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "screenx=105LLl" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "screenx=105/5" should set "left=105"]
expected: FAIL
expected: TIMEOUT
[features "screenx=105.32" should set "left=105"]
expected: FAIL
[features "screenx=L104" should NOT set "left=104"]
expected: TIMEOUT
[features "screenx=/104" should NOT set "left=104"]
expected: TIMEOUT

View file

@ -1,32 +1,42 @@
[open-features-non-integer-top.html]
type: testharness
expected: TIMEOUT
[HTML: window.open `features`: non-integer values for feature `top`]
expected: FAIL
[features "top=105/5" should set "top=105"]
expected: FAIL
expected: TIMEOUT
[features "top=105*3" should set "top=105"]
expected: FAIL
expected: TIMEOUT
[features "top=105LLl" should set "top=105"]
expected: FAIL
expected: TIMEOUT
[features "top=105e-1" should set "top=105"]
expected: FAIL
expected: TIMEOUT
[features "top=105.32" should set "top=105"]
expected: FAIL
expected: TIMEOUT
[features "top=105e1" should set "top=105"]
expected: FAIL
expected: TIMEOUT
[features "top=105 " should set "top=105"]
expected: FAIL
expected: TIMEOUT
[features "top=105^4" should set "top=105"]
expected: FAIL
expected: TIMEOUT
[features "top=105.5" should set "top=105"]
expected: FAIL
expected: TIMEOUT
[features "top=/104" should NOT set "top=104"]
expected: TIMEOUT
[features "top=_104" should NOT set "top=104"]
expected: TIMEOUT
[features "top=L104" should NOT set "top=104"]
expected: TIMEOUT

View file

@ -1,32 +1,48 @@
[open-features-non-integer-width.html]
type: testharness
expected: TIMEOUT
[HTML: window.open `features`: non-integer values for feature `width`]
expected: FAIL
[features "width=405^4" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "width=405.5" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "width=405e1" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "width=405 " should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "width=405.32" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "width=405LLl" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "width=405*3" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "width=405e-1" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[features "width=405/5" should set "width=405"]
expected: FAIL
expected: TIMEOUT
[top=0,left=0: absence of feature "width" should be treated same as "width=0"]
expected: TIMEOUT
[features "width=_404" should NOT set "width=404"]
expected: TIMEOUT
[top=0,left=0,height=401,: absence of feature "width" should be treated same as "width=0"]
expected: TIMEOUT
[features "width=/404" should NOT set "width=404"]
expected: TIMEOUT
[features "width=L404" should NOT set "width=404"]
expected: TIMEOUT

View file

@ -1,5 +1,4 @@
[embedded-opener-remove-frame.html]
expected: CRASH
[opener and "removed" embedded documents]
expected: FAIL
@ -7,5 +6,5 @@
expected: FAIL
[opener of discarded auxiliary browsing context]
expected: TIMEOUT
expected: FAIL

View file

@ -1,7 +1,11 @@
[supported-elements.html]
expected: TIMEOUT
[Contenteditable element should support autofocus]
expected: FAIL
[Element with tabindex should support autofocus]
expected: FAIL
expected: TIMEOUT
[Non-HTMLElement should not support autofocus]
expected: NOTRUN

View file

@ -1,5 +1,6 @@
[iframe_sandbox_popups_escaping-3.html]
type: testharness
expected: TIMEOUT
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
expected: FAIL
expected: TIMEOUT

View file

@ -1,5 +1,6 @@
[iframe_sandbox_popups_nonescaping-2.html]
type: testharness
expected: TIMEOUT
[Check that popups from a sandboxed iframe do not escape the sandbox]
expected: FAIL
expected: NOTRUN

View file

@ -1,5 +1,6 @@
[iframe_sandbox_popups_nonescaping-3.html]
type: testharness
expected: TIMEOUT
[Check that popups from a sandboxed iframe do not escape the sandbox]
expected: FAIL
expected: NOTRUN

View file

@ -1,5 +1,5 @@
[form-double-submit-2.html]
expected: ERROR
[preventDefault should allow onclick submit() to succeed]
expected: TIMEOUT
expected: FAIL

View file

@ -1,5 +1,5 @@
[form-double-submit.html]
expected: ERROR
[default submit action should supersede onclick submit()]
expected: TIMEOUT
expected: FAIL

View file

@ -1,11 +1,7 @@
[form-submission-algorithm.html]
expected: TIMEOUT
[If form's firing submission events is true, then return; 'submit' event]
expected: FAIL
[If form's firing submission events is true, then return; 'invalid' event]
expected: FAIL
[Cannot navigate (after constructing the entry list)]
expected: TIMEOUT

View file

@ -0,0 +1,5 @@
[checkbox-detached-change-event.html]
expected: TIMEOUT
[This test will pass if <input type=checkbox> emits change events while detached from document.body]
expected: TIMEOUT

View file

@ -0,0 +1,5 @@
[radio-detached-change-event.html]
expected: TIMEOUT
[This test will pass if <input type=radio> emits change events while detached from document.body]
expected: TIMEOUT

View file

@ -1,4 +0,0 @@
[DOMContentLoaded-defer.html]
[The end: DOMContentLoaded and defer scripts]
expected: FAIL

View file

@ -1,5 +1,5 @@
[nested-context-navigations-iframe.html]
expected: CRASH
expected: TIMEOUT
[Test that iframe navigations are not observable by the parent, even after history navigations by the parent]
expected: FAIL

View file

@ -1050,3 +1050,6 @@
[URL: Setting <ssh://me@example.net>.protocol = 'https']
expected: FAIL
[<area>: Setting <http://example.net>.host = '[2001:db8::2\]:4002' IPv6 literal address with port, crbug.com/1012416]
expected: FAIL

View file

@ -0,0 +1,5 @@
[018.html]
expected: TIMEOUT
[origin of the script that invoked the method, javascript:]
expected: TIMEOUT

View file

@ -170,3 +170,12 @@
[WebGLRenderingContext includes WebGLRenderingContextBase: member names are unique]
expected: FAIL
[XRSession interface: attribute onsqueeze]
expected: FAIL
[XRSession interface: attribute onsqueezestart]
expected: FAIL
[XRSession interface: attribute onsqueezeend]
expected: FAIL

View file

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

View file

@ -1,5 +1,6 @@
[003.html]
type: testharness
expected: ERROR
[shared]
expected: FAIL

View file

@ -106,7 +106,7 @@
do {
await new Promise(window.requestAnimationFrame);
let current_local_time = animation.effect.getComputedTiming().localTime;
if (last_local_time == current_local_time)
if (approxEquals(last_local_time, current_local_time))
++frame_count;
else
frame_count = 0;
@ -121,7 +121,7 @@
const LOCAL_TIME_RESET_CHECK = 3;
do {
await new Promise(window.requestAnimationFrame);
if (0 == animation.effect.getComputedTiming().localTime)
if (approxEquals(0, animation.effect.getComputedTiming().localTime))
++reset_count;
} while (reset_count < LOCAL_TIME_RESET_CHECK);
}
@ -136,8 +136,8 @@
// effect.localTime should be correctly increased upon global scope
// switches for stateful animators.
await waitForAnimationFrameWithCondition(_ => {
return animation.effect.getComputedTiming().localTime ==
EXPECTED_FRAMES_TO_A_SCOPE_SWITCH;
return approxEquals(animation.effect.getComputedTiming().localTime,
EXPECTED_FRAMES_TO_A_SCOPE_SWITCH);
});
animation.cancel();
@ -165,7 +165,8 @@
animation.play();
await waitForAnimationFrameWithCondition(_ => {
return animation.effect.getComputedTiming().localTime == EXPECTED_FRAMES_TO_A_SCOPE_SWITCH;
return approxEquals(animation.effect.getComputedTiming().localTime,
EXPECTED_FRAMES_TO_A_SCOPE_SWITCH);
});
animation.cancel();
@ -179,7 +180,7 @@
animation.play();
await waitForAnimationFrameWithCondition(_ => {
return animation.effect.getComputedTiming().localTime == 10000;
return approxEquals(animation.effect.getComputedTiming().localTime, 10000);
});
animation.cancel();

View file

@ -2705,8 +2705,8 @@ document.viewport = {
getScrollOffsets: function() {
return Element._returnOffset(
window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
window.pageXOffset || document.scrollingElement.scrollLeft,
window.pageYOffset || document.scrollingElement.scrollTop);
}
};
/* Portions of the Selector class are derived from Jack Slocumâs DomQuery,
@ -3751,10 +3751,8 @@ Event.Methods = (function() {
pointer: function(event) {
return {
x: event.pageX || (event.clientX +
(document.documentElement.scrollLeft || document.body.scrollLeft)),
y: event.pageY || (event.clientY +
(document.documentElement.scrollTop || document.body.scrollTop))
x: event.pageX || (event.clientX + document.scrollingElement.scrollLeft),
y: event.pageY || (event.clientY + document.scrollingElement.scrollTop)
};
},
@ -4034,12 +4032,10 @@ var Position = {
// page is scrolled
prepare: function() {
this.deltaX = window.pageXOffset
|| document.documentElement.scrollLeft
|| document.body.scrollLeft
|| document.scrollingElement.scrollLeft
|| 0;
this.deltaY = window.pageYOffset
|| document.documentElement.scrollTop
|| document.body.scrollTop
|| document.scrollingElement.scrollTop
|| 0;
},

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<style>
div {
text-indent: 3ch;
}
</style>
<body>
<div>123456</div>
</body>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<title>CSS Test: Line wrapping after leading out-of-flow objects</title>
<link rel="author" title="Koji Ishii" href="mailto:kojii@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css2/visuren.html#propdef-position">
<style>
div {
width: 5ch;
/* When the line was broken after the leading OOF, it is hardly visible
because it is an empty line box.
Applying `text-indent` can make it visible; if the line is indented,
it is the first line, proving the line did not wrap. */
text-indent: 3ch;
}
</style>
<body>
<div><span style="position: absolute"></span>123456</div>
</body>

View file

@ -32,8 +32,8 @@
<body>
<p>
Test passes if there is a filled color square with 'Filler Text',
whose color gradually changes in the order:
YELLOW to GREEN to BLUE.
whose color gradually changes in the order: YELLOW to GREEN.
After the animation is finished, the color goes back to BLUE.
</p>
<div>Filler Text</div>
</body>

View file

@ -37,8 +37,8 @@
<body>
<p>
Test passes if there is a filled color square with 'Filler Text',
whose color gradually changes in the order:
YELLOW to GREEN to BLUE.
whose color gradually changes in the order: YELLOW to GREEN.
After the animation is finished, the color goes back to BLUE.
</p>
<div>Filler Text</div>
</body>

View file

@ -0,0 +1,125 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Reference: Symbol markers with unicode-bidi</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<style>
section {
float: left;
}
.inside {
list-style-position: inside;
}
span {
float: right;
}
</style>
<section>
<ul dir="ltr">
<li class="outside embed-none">text</li>
<li class="outside embed-item">text</li>
<li class="outside embed-marker">text</li>
<li class="outside embed-both">text</li>
<li class="inside embed-none">text</li>
<li class="inside embed-item">text</li>
<li class="inside embed-marker">text</li>
<li class="inside embed-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside isolate-none">text</li>
<li class="outside isolate-item">text</li>
<li class="outside isolate-marker">text</li>
<li class="outside isolate-both">text</li>
<li class="inside isolate-none">text</li>
<li class="inside isolate-item">text</li>
<li class="inside isolate-marker">text</li>
<li class="inside isolate-both">text</li>
</ul>
</section>
<section>
<ul dir="ltr">
<li class="outside isolate-none">text</li>
<li class="outside isolate-item">text</li>
<li class="outside isolate-marker">text</li>
<li class="outside isolate-both">text</li>
<li class="inside isolate-none">text</li>
<li class="inside isolate-item">text</li>
<li class="inside isolate-marker">text</li>
<li class="inside isolate-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside isolate-none">text</li>
<li class="outside isolate-item">text</li>
<li class="outside isolate-marker">text</li>
<li class="outside isolate-both">text</li>
<li class="inside isolate-none">text</li>
<li class="inside isolate-item">text</li>
<li class="inside isolate-marker">text</li>
<li class="inside isolate-both">text</li>
</ul>
</section>
<section>
<ul dir="ltr">
<li class="outside override-none">text</li>
<li class="outside override-item">text</li>
<li class="outside override-marker">text</li>
<li class="outside override-both">text</li>
<li class="inside override-none">text</li>
<li class="inside override-item">text</li>
<li class="inside override-marker">text</li>
<li class="inside override-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside override-none">text</li>
<li class="outside override-item">txet</li>
<li class="outside override-marker">text</li>
<li class="outside override-both">txet</li>
<li class="inside override-none">text</li>
<li class="inside override-item">txet</li>
<li class="inside override-marker">text</li>
<li class="inside override-both">txet</li>
</ul>
</section>
<section>
<ul dir="ltr">
<li class="outside isolateoverride-none">text</li>
<li class="outside isolateoverride-item">text</li>
<li class="outside isolateoverride-marker">text</li>
<li class="outside isolateoverride-both">text</li>
<li class="inside isolateoverride-none">text</li>
<li class="inside isolateoverride-item">text</li>
<li class="inside isolateoverride-marker">text</li>
<li class="inside isolateoverride-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside isolateoverride-none">text</li>
<li class="outside isolateoverride-item">txet</li>
<li class="outside isolateoverride-marker">text</li>
<li class="outside isolateoverride-both">txet</li>
<li class="inside isolateoverride-none">text</li>
<li class="inside isolateoverride-item">txet</li>
<li class="inside isolateoverride-marker">text</li>
<li class="inside isolateoverride-both">txet</li>
</ul>
</section>
<section>
<ul dir="ltr">
<li class="outside plaintext-none">text</li>
<li class="outside plaintext-item">text</li>
<li class="outside plaintext-marker">text</li>
<li class="outside plaintext-both">text</li>
<li class="inside plaintext-none">text</li>
<li class="inside plaintext-item">text</li>
<li class="inside plaintext-marker">text</li>
<li class="inside plaintext-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside plaintext-none">text</li>
<li class="outside plaintext-item">text</li>
<li class="outside plaintext-marker">text</li>
<li class="outside plaintext-both">text</li>
<li class="inside plaintext-none">text</li>
<li class="inside plaintext-item"><span>text</span></li>
<li class="inside plaintext-marker">text</li>
<li class="inside plaintext-both"><span>text</span></li>
</ul>
</section>

View file

@ -0,0 +1,147 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Symbol markers with unicode-bidi</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-lists/#markers" title="3. Markers">
<link rel="match" href="list-marker-symbol-bidi-ref.html">
<meta name="assert" content="This test checks that symbol markers are painted independently of unicode-bidi.">
<style>
section {
float: left;
}
.inside {
list-style-position: inside;
}
.embed-item, .embed-both {
unicode-bidi: embed;
}
.isolate-item, .isolate-both {
unicode-bidi: isolate;
}
.override-item, .override-both {
unicode-bidi: bidi-override;
}
.isolateoverride-item, .isolateoverride-both {
unicode-bidi: isolate-override;
}
.plaintext-item, .plaintext-both {
unicode-bidi: plaintext;
}
.embed-item::marker, .embed-none::marker,
.isolate-item::marker, .isolate-none::marker,
.override-item::marker, .override-none::marker,
.paintext-item::marker, .paintext-none::marker,
.isolateoverride-item::marker, .isolateoverride-none::marker {
unicode-bidi: normal;
}
</style>
<section>
<ul dir="ltr">
<li class="outside embed-none">text</li>
<li class="outside embed-item">text</li>
<li class="outside embed-marker">text</li>
<li class="outside embed-both">text</li>
<li class="inside embed-none">text</li>
<li class="inside embed-item">text</li>
<li class="inside embed-marker">text</li>
<li class="inside embed-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside isolate-none">text</li>
<li class="outside isolate-item">text</li>
<li class="outside isolate-marker">text</li>
<li class="outside isolate-both">text</li>
<li class="inside isolate-none">text</li>
<li class="inside isolate-item">text</li>
<li class="inside isolate-marker">text</li>
<li class="inside isolate-both">text</li>
</ul>
</section>
<section>
<ul dir="ltr">
<li class="outside isolate-none">text</li>
<li class="outside isolate-item">text</li>
<li class="outside isolate-marker">text</li>
<li class="outside isolate-both">text</li>
<li class="inside isolate-none">text</li>
<li class="inside isolate-item">text</li>
<li class="inside isolate-marker">text</li>
<li class="inside isolate-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside isolate-none">text</li>
<li class="outside isolate-item">text</li>
<li class="outside isolate-marker">text</li>
<li class="outside isolate-both">text</li>
<li class="inside isolate-none">text</li>
<li class="inside isolate-item">text</li>
<li class="inside isolate-marker">text</li>
<li class="inside isolate-both">text</li>
</ul>
</section>
<section>
<ul dir="ltr">
<li class="outside override-none">text</li>
<li class="outside override-item">text</li>
<li class="outside override-marker">text</li>
<li class="outside override-both">text</li>
<li class="inside override-none">text</li>
<li class="inside override-item">text</li>
<li class="inside override-marker">text</li>
<li class="inside override-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside override-none">text</li>
<li class="outside override-item">text</li>
<li class="outside override-marker">text</li>
<li class="outside override-both">text</li>
<li class="inside override-none">text</li>
<li class="inside override-item">text</li>
<li class="inside override-marker">text</li>
<li class="inside override-both">text</li>
</ul>
</section>
<section>
<ul dir="ltr">
<li class="outside isolateoverride-none">text</li>
<li class="outside isolateoverride-item">text</li>
<li class="outside isolateoverride-marker">text</li>
<li class="outside isolateoverride-both">text</li>
<li class="inside isolateoverride-none">text</li>
<li class="inside isolateoverride-item">text</li>
<li class="inside isolateoverride-marker">text</li>
<li class="inside isolateoverride-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside isolateoverride-none">text</li>
<li class="outside isolateoverride-item">text</li>
<li class="outside isolateoverride-marker">text</li>
<li class="outside isolateoverride-both">text</li>
<li class="inside isolateoverride-none">text</li>
<li class="inside isolateoverride-item">text</li>
<li class="inside isolateoverride-marker">text</li>
<li class="inside isolateoverride-both">text</li>
</ul>
</section>
<section>
<ul dir="ltr">
<li class="outside plaintext-none">text</li>
<li class="outside plaintext-item">text</li>
<li class="outside plaintext-marker">text</li>
<li class="outside plaintext-both">text</li>
<li class="inside plaintext-none">text</li>
<li class="inside plaintext-item">text</li>
<li class="inside plaintext-marker">text</li>
<li class="inside plaintext-both">text</li>
</ul>
<ul dir="rtl">
<li class="outside plaintext-none">text</li>
<li class="outside plaintext-item">text</li>
<li class="outside plaintext-marker">text</li>
<li class="outside plaintext-both">text</li>
<li class="inside plaintext-none">text</li>
<li class="inside plaintext-item">text</li>
<li class="inside plaintext-marker">text</li>
<li class="inside plaintext-both">text</li>
</ul>
</section>

View file

@ -19,6 +19,11 @@ li {
</li>
</ul>
<script type="text/javascript">
setup({ single_test: true });
// TODO(jugglinmike): If accepted, WPT RFC #33 will introduce a new test
// type intended to simplify tests like this one. Refactor this test to the
// new test type following its acceptance.
// https://github.com/web-platform-tests/rfcs/pull/33
done();
</script>
</body>

View file

@ -3,7 +3,7 @@
<title>CSS Pseudo-Elements Test: Parsing tree-abiding pseudo-elements</title>
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#treelike">
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<meta name="assert" content="This test checks that gutters adjacent to collapsed tracks don't reduce the space available for aligning adjacent grid items." />
<meta name="assert" content="This test checks the validity of various selectors containing tree-abiding pseudo-elements." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang=en>
<meta charset="utf-8">
<title>word-break: break-all on inline element</title>
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
<link rel="help" title="5.2. Breaking Rules for Letters: the word-break property" href="https://drafts.csswg.org/css-text-3/#word-break-property">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-all">
<meta name="flags" content="Ahem">
<link rel="match" href="reference/word-break-break-all-010-ref.html">
<meta name="assert" content="break-all doesn't allow breaking around punctuation characters">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 50px / 1 Ahem;
}
.fail {
background: green;
position: absolute;
color: red;
height: 100px;
z-index: -1;
}
.test {
color: green;
width: 1em;
word-break: break-all;
}
</style>
<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
<div class="fail">XX</div>
<div class="test"><span>X</span><span>.</span></div>

View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text Test: word-break: break-word and intrinsic sizing</title>
<link rel="author" title="Florian Rivoal" href="http://florian.rivoal.net/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#word-break-property">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
<meta name="flags" content="">
<link rel="match" href="../overflow-wrap/reference/overflow-wrap-min-content-size-001-ref.html">
<meta name="assert" content="word-break: break-word should behave as overflow-wrap: anywhere, so breaking opportunities **are** considered when calculating min-content intrinsic sizes.">
<style>
table {
word-break: break-word;
max-width: 0;
border: 0;
border-collapse: collapse;
}
td {
padding: 0;
background: green;
color: transparent;
}
#red {
position: absolute;
z-index: -1;
background: red;
color: transparent;
}
</style>
<p>Test passes if there is a green box below and no red.
<div id=red>X<br>X<br>X<br>X</div>
<table><tr><td>XXXX</table>
<!--
width:min-content on the div directly without using a table
would achieve the goal of this test, and be a lot simpler.
However, width:min-content is not yet widely supported.
Using a table, and forcing it to be as small as possible
will achieve min-content sizing of the div in all browsers.
-->

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text Test: word-break: break-word and intrinsic sizing</title>
<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
<link rel="help" href="https://drafts.csswg.org/css-text-3/#word-break-property">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
<meta name="flags" content="ahem">
<link rel="match" href="../overflow-wrap/reference/overflow-wrap-min-content-size-003-ref.html">
<meta name="assert" content="word-break: break-word should behave as overflow-wrap: anywhere, so breaks at edge of inline elements.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
#wrapper {
width: 0px;
font: 16px / 1 Ahem;
word-break: break-word;
color: green;
}
#test {
float: left;
}
#reference {
position: absolute;
width: 16px;
height: 128px;
background: red;
z-index: -1;
}
</style>
<p>Test passes if there is a vertical green bar below.
<div id="wrapper">
<div id="reference"></div>
<div id="test"><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span></div>
</div>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text Test: word-break: break-word and intrinsic sizing</title>
<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
<link rel="help" href="https://drafts.csswg.org/css-text-3/#word-break-property">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
<meta name="flags" content="ahem">
<link rel="match" href="reference/word-break-break-all-010-ref.html">
<meta name="assert" content="word-break: break-all shouldn't allow breaking before punctuation characters.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 50px / 1 Ahem;
}
.fail {
background: red;
position: absolute;
color: green;
z-index: -1;
}
.test {
color: green;
width: min-content;
word-break: break-all;
}
</style>
<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
<div class="fail"><br>XX</div>
<div class="test"><span>X</span><span>.</span></div>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text Test: word-break: break-word and intrinsic sizing</title>
<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
<link rel="help" href="https://drafts.csswg.org/css-text-3/#word-break-property">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
<meta name="flags" content="ahem">
<link rel="match" href="reference/word-break-break-all-010-ref.html">
<meta name="assert" content="word-break: break-word allows breaking before punctuation characters and it should be considered when computing the min-content size.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
div {
font: 50px / 1 Ahem;
}
.fail {
background: green;
position: absolute;
color: red;
width: 100px;
z-index: -1;
}
.test {
color: green;
width: min-content;
word-break: break-word;
}
</style>
<p>Test passes if there is a <strong>filled green square</strong> and <strong>no red</strong>.</p>
<div class="fail">X<br>X</div>
<div class="test"><span>X</span><span>.</span></div>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text Test: word-break: break-word and intrinsic sizing</title>
<link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com" />
<link rel="help" href="https://drafts.csswg.org/css-text-3/#word-break-property">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-break-word">
<meta name="flags" content="ahem">
<link rel="match" href="../overflow-wrap/reference/overflow-wrap-min-content-size-003-ref.html">
<meta name="assert" content="word-break: break-word should behave as overflow-wrap: anywhere, so breaks at edge of inline elements.">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style>
#wrapper {
width: 0px;
font: 16px / 1 Ahem;
word-break: break-word;
color: green;
}
#test {
float: left;
}
#reference {
position: absolute;
width: 16px;
height: 128px;
background: red;
z-index: -1;
}
</style>
<p>Test passes if there is a vertical green bar below.
<div id="wrapper">
<div id="reference"></div>
<div id="test"><span>XX</span><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span><span>X</span></div>
</div>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Text Test: overflow-wrap: anywhere and intrinsic sizing</title>
<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org/">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#overflow-wrap-property">
<meta name="flags" content="">
<link rel="match" href="../overflow-wrap/reference/overflow-wrap-min-content-size-002-ref.html">
<meta name="assert" content="overflow-wrap:anywhere doesn't break grapheme cluster and min-content intrinsic size should take that into account.">
<style>
#wrapper {
width: 0px;
word-break: break-word;
}
#test {
float: left;
border: 2px solid blue;
}
</style>
<p>Test passes if the glyphs are completely inside the blue box.
<div id="wrapper">
<div id="test">&#x0ba8;&#x0bbf;&#x0bbf;&#x0bbf;&#x0bbf;&#x0ba8;&#x0bbf;&#x0bbf;&#x0bbf;&#x0bbf;</div>
</div>

View file

@ -41,7 +41,7 @@
<div>01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 00</div>
<script>
document.documentElement.scrollLeft=document.documentElement.scrollWidth;
document.scrollingElement.scrollLeft=document.scrollingElement.scrollWidth;
</script>
</body>
</html>

View file

@ -101,7 +101,7 @@
</div>
<script>
document.documentElement.scrollLeft=document.documentElement.scrollWidth;
document.scrollingElement.scrollLeft=document.scrollingElement.scrollWidth;
</script>
</body>
</html>

View file

@ -75,7 +75,7 @@
</table>
<script>
document.documentElement.scrollLeft=document.documentElement.scrollWidth;
document.scrollingElement.scrollLeft=document.scrollingElement.scrollWidth;
</script>
</body>
</html>

View file

@ -18,19 +18,19 @@
<body>
<script>
test(function() {
assert_equals(document.documentElement.scrollLeft, 0, "scrollLeft should be 0.");
assert_equals(document.scrollingElement.scrollLeft, 0, "scrollLeft should be 0.");
}, "Check initial scroll position of viewport.");
test(function() {
document.documentElement.scrollLeft = -1000;
assert_equals(document.documentElement.scrollLeft, 0, "scrollLeft should be 0.");
document.scrollingElement.scrollLeft = -1000;
assert_equals(document.scrollingElement.scrollLeft, 0, "scrollLeft should be 0.");
}, "Scroll to scrollLeft = -1000 should not be possible.");
test(function() {
document.documentElement.scrollLeft = 1000;
assert_equals(document.documentElement.scrollLeft, 1000, "scrollLeft should be 1000.");
document.scrollingElement.scrollLeft = 1000;
assert_equals(document.scrollingElement.scrollLeft, 1000, "scrollLeft should be 1000.");
}, "Scroll to scrollLeft = 1000 should be possible.");
// Reset back to horizontal-tb to make the result readable on-screen.
document.documentElement.className = "result-wm";
document.scrollingElement.className = "result-wm";
</script>

View file

@ -18,19 +18,19 @@
<body>
<script>
test(function() {
assert_equals(document.documentElement.scrollLeft, 0, "scrollLeft should be 0.");
assert_equals(document.scrollingElement.scrollLeft, 0, "scrollLeft should be 0.");
}, "Check initial scroll position of viewport.");
test(function() {
document.documentElement.scrollLeft = -1000;
assert_equals(document.documentElement.scrollLeft, -1000, "scrollLeft should be -1000.");
document.scrollingElement.scrollLeft = -1000;
assert_equals(document.scrollingElement.scrollLeft, -1000, "scrollLeft should be -1000.");
}, "Scroll to scrollLeft = -1000 should be possible.");
test(function() {
document.documentElement.scrollLeft = 1000;
assert_equals(document.documentElement.scrollLeft, 0, "scrollLeft should be 0.");
document.scrollingElement.scrollLeft = 1000;
assert_equals(document.scrollingElement.scrollLeft, 0, "scrollLeft should be 0.");
}, "Scroll to scrollLeft = 1000 should not be possible.");
// Reset back to horizontal-tb to make the result readable on-screen.
document.documentElement.className = "result-wm";
document.scrollingElement.className = "result-wm";
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View file

@ -26,6 +26,7 @@ There's also a load of [general guidelines](general-guidelines) that apply to al
testdriver
testdriver-tutorial
testharness
testharness-tutorial
tools
visual
wdspec

View file

@ -0,0 +1,393 @@
# testharness.js tutorial
<!--
Note to maintainers:
This tutorial is designed to be an authentic depiction of the WPT contribution
experience. It is not intended to be comprehensive; its scope is intentionally
limited in order to demonstrate authoring a complete test without overwhelming
the reader with features. Because typical WPT usage patterns change over time,
this should be updated periodically; please weigh extensions against the
demotivating effect that a lengthy guide can have on new contributors.
-->
Let's say you've discovered that WPT doesn't have any tests for how [the Fetch
API](https://fetch.spec.whatwg.org/) sets cookies from an HTTP response. This
tutorial will guide you through the process of writing a test for the
web-platform, verifying it, and submitting it back to WPT. Although it includes
some very brief instructions on using git, you can find more guidance in [the
tutorial for git and GitHub](github-intro).
WPT's testharness.js is a framework designed to help people write tests for the
web platform's JavaScript APIs. [The testharness.js reference
page](testharness) describes the framework in the abstract, but for the
purposes of this guide, we'll only consider the features we need to test the
behavior of `fetch`.
```eval_rst
.. contents::
:local:
```
## Setting up your workspace
To make sure you have the latest code, first type the following into a terminal
located in the root of the WPT git repository:
$ git fetch git@github.com:web-platform-tests/wpt.git
Next, we need a place to store the change set we're about to author. Here's how
to create a new git branch named `fetch-cookie` from the revision of WPT we
just downloaded:
$ git checkout -b fetch-cookie FETCH_HEAD
The tests we're going to write will rely on special abilities of the WPT
server, so you'll also need to [configure your system to run
WPT](../running-tests/from-local-system) before you continue.
With that out of the way, you're ready to create your patch.
## Writing a subtest
<!--
Goals of this section:
- demonstrate asynchronous testing with Promises
- motivate non-trivial integration with WPT server
- use web technology likely to be familiar to web developers
- use web technology likely to be supported in the reader's browser
-->
The first thing we'll do is configure the server to respond to a certain request
by setting a cookie. Once that's done, we'll be able to make the request with
`fetch` and verify that it interpreted the response correctly.
We'll configure the server with an "asis" file. That's the WPT convention for
controlling the contents of an HTTP response. [You can read more about it
here](server-features), but for now, we'll save the following text into a file
named `set-cookie.asis` in the `fetch/api/basic/` directory of WPT:
```
HTTP/1.1 204 No Content
Set-Cookie: test1=t1
```
With this in place, any requests to `/fetch/api/basic/set-cookie.asis` will
receive an HTTP 204 response that sets the cookie named `test1`. When writing
more tests in the future, you may want the server to behave more dynamically.
In that case, [you can write Python code to control how the server
responds](python-handlers/index).
Now, we can write the test! Create a new file named `set-cookie.html` in the
same directory and insert the following text:
```html
<!DOCTYPE html>
<meta charset="utf-8">
<title>fetch: setting cookies</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(function() {
return fetch('set-cookie.asis')
.then(function() {
assert_equals(document.cookie, 'test1=t1');
});
});
</script>
```
Let's step through each part of this file.
- ```html
<!DOCTYPE html>
<meta charset="utf-8">
```
We explicitly set the DOCTYPE and character set to be sure that browsers
don't infer them to be something we aren't expecting. We're omitting the
`<html>` and `<head>` tags. That's a common practice in WPT, preferred
because it makes tests more concise.
- ```html
<title>fetch: setting cookies</title>
```
The document's title should succinctly describe the feature under test.
- ```html
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
```
These two `<script>` tags retrieve the code that powers testharness.js. A
testharness.js test can't run without them!
- ```html
<script>
promise_test(function() {
return fetch('thing.asis')
.then(function() {
assert_equals(document.cookie, 'test1=t1');
});
});
</script>
```
This script uses the testharness.js function `promise_test` to define a
"subtest". We're using that because the behavior we're testing is
asynchronous. By returning a Promise value, we tell the harness to wait until
that Promise settles. The harness will report that the test has passed if
the Promise is fulfilled, and it will report that the test has failed if the
Promise is rejected.
We invoke the global `fetch` function to exercise the "behavior under test,"
and in the fulfillment handler, we verify that the expected cookie is set.
We're using the testharness.js `assert_equals` function to verify that the
value is correct; the function will throw an error otherwise. That will cause
the Promise to be rejected, and *that* will cause the harness to report a
failure.
If you run the server according to the instructions in [the guide for local
configuration](../running-tests/from-local-system), you can access the test at
[http://web-platform.test:8000/fetch/api/basic/set-cookie.html](http://web-platform.test:8000/fetch/api/basic/set-cookie.html.).
You should see something like this:
![](../assets/testharness-tutorial-test-screenshot-1.png "screen shot of testharness.js reporting the test results")
## Refining the subtest
<!--
Goals of this section:
- explain the motivation for "clean up" logic and demonstrate its usage
- motivate explicit test naming
-->
We'd like to test a little more about `fetch` and cookies, but before we do,
there are some improvements we can make to what we've written so far.
For instance, we should remove the cookie after the subtest is complete. This
ensures a consistent state for any additional subtests we may add and also for
any tests that follow. We'll use the `add_cleanup` method to ensure that the
cookie is deleted even if the test fails.
```diff
-promise_test(function() {
+promise_test(function(t) {
+ t.add_cleanup(function() {
+ document.cookie = 'test1=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
+ });
+
return fetch('thing.asis')
.then(function() {
assert_equals(document.cookie, 'test1=t1');
});
});
```
Although we'd prefer it if there were no other cookies defined during our test,
we shouldn't take that for granted. As written, the test will fail if the
`document.cookie` includes additional cookies. We'll use slightly more
complicated logic to test for the presence of the expected cookie.
```diff
promise_test(function(t) {
t.add_cleanup(function() {
document.cookie = 'test1=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
});
return fetch('thing.asis')
.then(function() {
- assert_equals(document.cookie, 'test1=t1');
+ assert_true(/(^|; )test1=t1($|;)/.test(document.cookie);
});
});
```
In the screen shot above, the subtest's result was reported using the
document's title, "fetch: setting cookies". Since we expect to add another
subtest, we should give this one a more specific name:
```diff
promise_test(function(t) {
t.add_cleanup(function() {
document.cookie = 'test1=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
});
return fetch('thing.asis')
.then(function() {
assert_true(/(^|; )test1=t1($|;)/.test(document.cookie));
});
-});
+}, 'cookie set for successful request');
```
## Writing a second subtest
<!--
Goals of this section:
- introduce the concept of cross-domain testing and the associated tooling
- demonstrate how to verify promise rejection
- demonstrate additional assertion functions
-->
There are many things we might want to verify about how `fetch` sets cookies.
For instance, it should *not* set a cookie if the request fails due to
cross-origin security restrictions. Let's write a subtest which verifies that.
We'll add another `<script>` tag for a JavaScript support file:
```diff
<!DOCTYPE html>
<meta charset="utf-8">
<title>fetch: setting cookies</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
```
`get-host-info.sub.js` is a general-purpose script provided by WPT. It's
designed to help with testing cross-domain functionality. Since it's stored in
WPT's `common/` directory, tests from all sorts of specifications rely on it.
Next, we'll define the new subtest inside the same `<script>` tag that holds
our first subtest.
```js
promise_test(function(t) {
t.add_cleanup(function() {
document.cookie = 'test1=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
});
const url = get_host_info().HTTP_NOTSAMESITE_ORIGIN +
'/fetch/api/basic/set-cookie.asis';
return fetch(url)
.then(function() {
assert_unreached('The promise for the aborted fetch operation should reject.');
}, function() {
assert_false(/(^|; )test1=t1($|;)/.test(document.cookie));
});
}, 'no cookie is set for cross-domain fetch operations');
```
This may look familiar from the previous subtest, but there are some important
differences.
- ```js
const url = get_host_info().HTTP_NOTSAMESITE_ORIGIN +
'/fetch/api/basic/set-cookie.asis';
```
We're requesting the same resource, but we're referring to it with an
alternate host name. The name of the host depends on how the WPT server has
been configured, so we rely on the helper to provide an appropriate value.
- ```js
return fetch(url)
.then(function() {
assert_unreached('The promise for the aborted fetch operation should reject.');
}, function() {
assert_false(/(^|; )test1=t1($|;)/.test(document.cookie));
});
```
We're returning a Promise value, just like the first subtest. This time, we
expect the operation to fail, so the Promise should be rejected. To express
this, we've used `assert_unreached` *in the fulfillment handler*.
`assert_unreached` is a testharness.js utility function which always throws
an error. With this in place, if fetch does *not* produce an error, then this
subtest will fail.
We've moved the assertion about the cookie to the rejection handler. We also
switched from `assert_true` to `assert_false` because the test should only
pass if the cookie is *not* set. It's a good thing we have the cleanup logic
in the previous subtest, right?
If you run the test in your browser now, you can expect to see both tests
reported as passing with their distinct names.
![](../assets/testharness-tutorial-test-screenshot-2.png "screen shot of testharness.js reporting the test results")
## Verifying our work
We're done writing the test, but we should make sure it fits in with the rest
of WPT before we submit it.
[The lint tool](lint-tool) can detect some of the common mistakes people make
when contributing to WPT. You enabled it when you [configured your system to
work with WPT](../running-tests/from-local-system). To run it, open a
command-line terminal, navigate to the root of the WPT repository, and enter
the following command:
python ./wpt lint fetch/api/basic
If this recognizes any of those common mistakes in the new files, it will tell
you where they are and how to fix them. If you do have changes to make, you can
run the command again to make sure you got them right.
Now, we'll run the test using the automated test runner. This is important for
testharness.js tests because there are subtleties of the automated test runner
which can influence how the test behaves. That's not to say your test has to
pass in all browsers (or even in *any* browser). But if we expect the test to
pass, then running it this way will help us catch other kinds of mistakes.
The tools support running the tests in many different browsers. We'll use
Firefox this time:
python ./wpt run firefox fetch/api/basic/set-cookie.html
We expect this test to pass, so if it does, we're ready to submit it. If we
were testing a web-platform feature that Firefox didn't support, we would
expect the test to fail instead.
There are a few problems to look out for in addition to passing/failing status.
The report will describe fewer tests than we expect if the test isn't run at
all. That's usually a sign of a formatting mistake, so you'll want to make sure
you've used the right file names and metadata. Separately, the web browser
might crash. That's often a sign of a browser bug, so you should consider
[reporting it to the browser's
maintainers](https://rachelandrew.co.uk/archives/2017/01/30/reporting-browser-bugs/)!
## Submitting the test
First, let's stage the new files for committing:
$ git add fetch/api/basic/set-cookie.asis
$ git add fetch/api/basic/set-cookie.html
We can make sure the commit has everything we want to submit (and nothing we
don't) by using `git diff`:
$ git diff --staged
On most systems, you can use the arrow keys to navigate through the changes,
and you can press the `q` key when you're done reviewing.
Next, we'll create a commit with the staged changes:
$ git commit -m '[fetch] Add test for setting cookies'
And now we can push the commit to our fork of WPT:
$ git push origin fetch-cookie
The last step is to submit the test for review. WPT doesn't actually need the
test we wrote in this tutorial, but if we wanted to submit it for inclusion in
the repository, we would create a pull request on GitHub. [The guide on git and
GitHub](github-intro) has all the details on how to do that.
## More practice
Here are some ways you can keep experimenting with WPT using this test:
- Improve the test's readability by defining helper functions like
`cookieIsSet` and `deleteCookie`
- Improve the test's coverage by refactoring it into [a "multi-global"
test](testharness)
- Improve the test's coverage by writing more subtests (e.g. the behavior when
the fetch operation is aborted by `window.stop`, or the behavior when the
HTTP response sets multiple cookies)

View file

@ -25,6 +25,10 @@ documented in two sections:
See [server features](server-features) for advanced testing features that are commonly used
with testharness.js. See also the [general guidelines](general-guidelines) for all test types.
This page describes testharness.js exhaustively; [the tutorial on writing a
testharness.js test](testharness-tutorial) provides a concise guide to writing
a test--a good place to start for newcomers to the project.
## Variants
A test file can have multiple variants by including `meta` elements,

View file

@ -0,0 +1,109 @@
<!doctype html>
<meta charset=utf-8>
<title>HTMLCollection getters and own properties</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
function append(t, tag, name) {
var element = document.createElement(tag);
if (name) {
element.id = name;
}
document.body.appendChild(element);
t.add_cleanup(function() { element.remove(); });
return element;
}
test(function() {
var name = "named", tag = "a";
var c = document.getElementsByTagName(tag);
var element = append(this, tag, name);
assert_equals(c[name], element);
c[name] = "foo";
assert_equals(c[name], element);
}, "Setting non-array index while named property exists (loose)");
test(function() {
"use strict";
var name = "named", tag = "b";
var c = document.getElementsByTagName(tag);
var element = append(this, tag, name);
assert_equals(c[name], element);
assert_throws(new TypeError(), function() {
c[name] = "foo";
});
assert_equals(c[name], element);
}, "Setting non-array index while named property exists (strict)");
test(function() {
var name = "named", tag = "i";
var c = document.getElementsByTagName(tag);
assert_equals(c[name], undefined);
c[name] = "foo";
assert_equals(c[name], "foo");
var element = append(this, tag, name);
assert_equals(c[name], "foo");
assert_equals(c.namedItem(name), element);
}, "Setting non-array index while named property doesn't exist (loose)");
test(function() {
"use strict";
var name = "named", tag = "p";
var c = document.getElementsByTagName(tag);
assert_equals(c[name], undefined);
c[name] = "foo";
assert_equals(c[name], "foo");
var element = append(this, tag, name);
assert_equals(c[name], "foo");
assert_equals(c.namedItem(name), element);
}, "Setting non-array index while named property doesn't exist (strict)");
test(function() {
var tag = "q";
var c = document.getElementsByTagName(tag);
var element = append(this, tag);
assert_equals(c[0], element);
c[0] = "foo";
assert_equals(c[0], element);
}, "Setting array index while indexed property exists (loose)");
test(function() {
"use strict";
var tag = "s";
var c = document.getElementsByTagName(tag);
var element = append(this, tag);
assert_equals(c[0], element);
assert_throws(new TypeError(), function() {
c[0] = "foo";
});
assert_equals(c[0], element);
}, "Setting array index while indexed property exists (strict)");
test(function() {
var tag = "u";
var c = document.getElementsByTagName(tag);
assert_equals(c[0], undefined);
c[0] = "foo";
assert_equals(c[0], undefined);
var element = append(this, tag);
assert_equals(c[0], element);
}, "Setting array index while indexed property doesn't exist (loose)");
test(function() {
"use strict";
var tag = "u";
var c = document.getElementsByTagName(tag);
assert_equals(c[0], undefined);
assert_throws(new TypeError(), function() {
c[0] = "foo";
});
assert_equals(c[0], undefined);
var element = append(this, tag);
assert_equals(c[0], element);
}, "Setting array index while indexed property doesn't exist (strict)");
</script>

View file

@ -0,0 +1,417 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Element Reflection for aria-activedescendant and aria-errormessage</title>
<link rel=help href="https://wicg.github.io/aom/spec/aria-reflection.html">
<link rel="author" title="Meredith Lane" href="meredithl@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<div id="role" role="button"></div>
<script>
test(function(t) {
var element = document.getElementById("role");
assert_equals(element.role, "button");
element.role = "checkbox";
assert_equals(element.getAttribute("role"), "checkbox");
}, "role attribute reflects.");
</script>
<div id="atomic" aria-atomic="true"></div>
<script>
test(function(t) {
var element = document.getElementById("atomic");
assert_equals(element.ariaAtomic, "true");
element.ariaAtomic = "false";
assert_equals(element.getAttribute("aria-atomic"), "false");
}, "aria-atomic attribute reflects.");
</script>
<div id="autocomplete" aria-autocomplete="list"></div>
<script>
test(function(t) {
var element = document.getElementById("autocomplete");
assert_equals(element.ariaAutoComplete, "list");
element.ariaAutoComplete = "inline";
assert_equals(element.getAttribute("aria-autocomplete"), "inline");
}, "aria-autocomplete attribute reflects.");
</script>
<div id="busy" aria-busy="true"></div>
<script>
test(function(t) {
var element = document.getElementById("busy");
assert_equals(element.ariaBusy, "true");
element.ariaBusy = "false";
assert_equals(element.getAttribute("aria-busy"), "false");
}, "aria-busy attribute reflects.");
</script>
<div id="checked" aria-checked="mixed"></div>
<script>
test(function(t) {
var element = document.getElementById("checked");
assert_equals(element.ariaChecked, "mixed");
element.ariaChecked = "true";
assert_equals(element.getAttribute("aria-checked"), "true");
}, "aria-checked attribute reflects.");
</script>
<div id="colcount" aria-colcount="5"></div>
<script>
test(function(t) {
var element = document.getElementById("colcount");
assert_equals(element.ariaColCount, "5");
element.ariaColCount = "6";
assert_equals(element.getAttribute("aria-colcount"), "6");
}, "aria-colcount attribute reflects.");
</script>
<div id="colindex" aria-colindex="1"></div>
<script>
test(function(t) {
var element = document.getElementById("colindex");
assert_equals(element.ariaColIndex, "1");
element.ariaColIndex = "2";
assert_equals(element.getAttribute("aria-colindex"), "2");
}, "aria-colindex attribute reflects.");
</script>
<div id="colspan" aria-colspan="2"></div>
<script>
test(function(t) {
var element = document.getElementById("colspan");
assert_equals(element.ariaColSpan, "2");
element.ariaColSpan = "3";
assert_equals(element.getAttribute("aria-colspan"), "3");
}, "aria-colspan attribute reflects.");
</script>
<div id="current" aria-current="page"></div>
<script>
test(function(t) {
var element = document.getElementById("current");
assert_equals(element.ariaCurrent, "page");
element.ariaCurrent = "step";
assert_equals(element.getAttribute("aria-current"), "step");
}, "aria-current attribute reflects.");
</script>
<div id="disabled" aria-disabled="true"></div>
<script>
test(function(t) {
var element = document.getElementById("disabled");
assert_equals(element.ariaDisabled, "true");
element.ariaDisabled = "false";
assert_equals(element.getAttribute("aria-disabled"), "false");
}, "aria-disabled attribute reflects.");
</script>
<div id="expanded" aria-expanded="true"></div>
<script>
test(function(t) {
var element = document.getElementById("expanded");
assert_equals(element.ariaExpanded, "true");
element.ariaExpanded = "false";
assert_equals(element.getAttribute("aria-expanded"), "false");
}, "aria-expanded attribute reflects.");
</script>
<div id="haspopup" aria-haspopup="menu"></div>
<script>
test(function(t) {
var element = document.getElementById("haspopup");
assert_equals(element.ariaHasPopup, "menu");
element.ariaHasPopup = "listbox";
assert_equals(element.getAttribute("aria-haspopup"), "listbox");
}, "aria-haspopup attribute reflects.");
</script>
<div id="hidden" aria-hidden="true" tabindex="-1"></div>
<script>
test(function(t) {
var element = document.getElementById("hidden");
assert_equals(element.ariaHidden, "true");
element.ariaHidden = "false";
assert_equals(element.getAttribute("aria-hidden"), "false");
}, "aria-hidden attribute reflects.");
</script>
<div id="keyshortcuts" aria-keyshortcuts="x"></div>
<script>
test(function(t) {
var element = document.getElementById("keyshortcuts");
assert_equals(element.ariaKeyShortcuts, "x");
element.ariaKeyShortcuts = "y";
assert_equals(element.getAttribute("aria-keyshortcuts"), "y");
}, "aria-keyshortcuts attribute reflects.");
</script>
<div id="label" aria-label="x"></div>
<script>
test(function(t) {
var element = document.getElementById("label");
assert_equals(element.ariaLabel, "x");
element.ariaLabel = "y";
assert_equals(element.getAttribute("aria-label"), "y");
}, "aria-label attribute reflects.");
</script>
<div id="level" aria-level="1"></div>
<script>
test(function(t) {
var element = document.getElementById("level");
assert_equals(element.ariaLevel, "1");
element.ariaLevel = "2";
assert_equals(element.getAttribute("aria-level"), "2");
}, "aria-level attribute reflects.");
</script>
<div id="live" aria-live="polite"></div>
<script>
test(function(t) {
var element = document.getElementById("live");
assert_equals(element.ariaLive, "polite");
element.ariaLive = "assertive";
assert_equals(element.getAttribute("aria-live"), "assertive");
}, "aria-live attribute reflects.");
</script>
<div id="modal" aria-modal="true"></div>
<script>
test(function(t) {
var element = document.getElementById("modal");
assert_equals(element.ariaModal, "true");
element.ariaModal = "false";
assert_equals(element.getAttribute("aria-modal"), "false");
}, "aria-modal attribute reflects.");
</script>
<div id="multiline" aria-multiline="true"></div>
<script>
test(function(t) {
var element = document.getElementById("multiline");
assert_equals(element.ariaMultiLine, "true");
element.ariaMultiLine = "false";
assert_equals(element.getAttribute("aria-multiline"), "false");
}, "aria-multiline attribute reflects.");
</script>
<div id="multiselectable" aria-multiselectable="true"></div>
<script>
test(function(t) {
var element = document.getElementById("multiselectable");
assert_equals(element.ariaMultiSelectable, "true");
element.ariaMultiSelectable = "false";
assert_equals(element.getAttribute("aria-multiselectable"), "false");
}, "aria-multiselectable attribute reflects.");
</script>
<div id="orientation" aria-orientation="vertical"></div>
<script>
test(function(t) {
var element = document.getElementById("orientation");
assert_equals(element.ariaOrientation, "vertical");
element.ariaOrientation = "horizontal";
assert_equals(element.getAttribute("aria-orientation"), "horizontal");
}, "aria-orientation attribute reflects.");
</script>
<div id="placeholder" aria-placeholder="x"></div>
<script>
test(function(t) {
var element = document.getElementById("placeholder");
assert_equals(element.ariaPlaceholder, "x");
element.ariaPlaceholder = "y";
assert_equals(element.getAttribute("aria-placeholder"), "y");
}, "aria-placeholder attribute reflects.");
</script>
<div id="posinset" aria-posinset="10"></div>
<script>
test(function(t) {
var element = document.getElementById("posinset");
assert_equals(element.ariaPosInSet, "10");
element.ariaPosInSet = "11";
assert_equals(element.getAttribute("aria-posinset"), "11");
}, "aria-posinset attribute reflects.");
</script>
<button id="pressed" aria-pressed="true"></button>
<script>
test(function(t) {
var element = document.getElementById("pressed");
assert_equals(element.ariaPressed, "true");
element.ariaPressed = "false";
assert_equals(element.getAttribute("aria-pressed"), "false");
}, "aria-pressed attribute reflects.");
</script>
<div id="readonly" aria-readonly="true"></div>
<script>
test(function(t) {
var element = document.getElementById("readonly");
assert_equals(element.ariaReadOnly, "true");
element.ariaReadOnly = "false";
assert_equals(element.getAttribute("aria-readonly"), "false");
}, "aria-readonly attribute reflects.");
</script>
<div id="relevant" aria-relevant="text"></div>
<script>
test(function(t) {
var element = document.getElementById("relevant");
assert_equals(element.ariaRelevant, "text");
element.ariaRelevant = "removals";
assert_equals(element.getAttribute("aria-relevant"), "removals");
}, "aria-relevant attribute reflects.");
</script>
<div id="required" aria-required="true"></div>
<script>
test(function(t) {
var element = document.getElementById("required");
assert_equals(element.ariaRequired, "true");
element.ariaRequired = "false";
assert_equals(element.getAttribute("aria-required"), "false");
}, "aria-required attribute reflects.");
</script>
<div id="roledescription" aria-roledescription="x"></div>
<script>
test(function(t) {
var element = document.getElementById("roledescription");
assert_equals(element.ariaRoleDescription, "x");
element.ariaRoleDescription = "y";
assert_equals(element.getAttribute("aria-roledescription"), "y");
}, "aria-roledescription attribute reflects.");
</script>
<div id="rowcount" aria-rowcount="10"></div>
<script>
test(function(t) {
var element = document.getElementById("rowcount");
assert_equals(element.ariaRowCount, "10");
element.ariaRowCount = "11";
assert_equals(element.getAttribute("aria-rowcount"), "11");
}, "aria-rowcount attribute reflects.");
</script>
<div id="rowindex" aria-rowindex="1"></div>
<script>
test(function(t) {
var element = document.getElementById("rowindex");
assert_equals(element.ariaRowIndex, "1");
element.ariaRowIndex = "2";
assert_equals(element.getAttribute("aria-rowindex"), "2");
}, "aria-rowindex attribute reflects.");
</script>
<div id="rowspan" aria-rowspan="2"></div>
<script>
test(function(t) {
var element = document.getElementById("rowspan");
assert_equals(element.ariaRowSpan, "2");
element.ariaRowSpan = "3";
assert_equals(element.getAttribute("aria-rowspan"), "3");
}, "aria-rowspan attribute reflects.");
</script>
<div id="setsize" aria-setsize="10"></div>
<script>
test(function(t) {
var element = document.getElementById("setsize");
assert_equals(element.ariaSelected, "10");
element.ariaSelected = "11";
assert_equals(element.getAttribute("aria-setsize"), "11");
}, "aria-setsize attribute reflects.");
</script>
<div id="sort" aria-sort="descending"></div>
<script>
test(function(t) {
var element = document.getElementById("sort");
assert_equals(element.ariaSort, "descending");
element.ariaSort = "ascending";
assert_equals(element.getAttribute("aria-sort"), "ascending");
}, "aria-sort attribute reflects.");
</script>
<div id="valuemax" aria-valuemax="99"></div>
<script>
test(function(t) {
var element = document.getElementById("valuemax");
assert_equals(element.ariaValueMax, "99");
element.ariaValueMax = "100";
assert_equals(element.getAttribute("aria-valuemax"), "100");
}, "aria-valuemax attribute reflects.");
</script>
<div id="valuemin" aria-valuemin="3"></div>
<script>
test(function(t) {
var element = document.getElementById("valuemin");
assert_equals(element.ariaValueMin, "3");
element.ariaValueMin = "2";
assert_equals(element.getAttribute("aria-valuemin"), "2");
}, "aria-valuemin attribute reflects.");
</script>
<div id="valuenow" aria-valuenow="50"></div>
<script>
test(function(t) {
var element = document.getElementById("valuenow");
assert_equals(element.ariaValueNow, "50");
element.ariaValueNow = "51";
assert_equals(element.getAttribute("aria-valuenow"), "51");
}, "aria-valuenow attribute reflects.");
</script>
<div id="valuetext" aria-valuetext="50%"></div>
<script>
test(function(t) {
var element = document.getElementById("valuetext");
assert_equals(element.ariaValueText, "50%");
element.ariaValueText = "51%";
assert_equals(element.getAttribute("aria-valuetext"), "51%");
}, "aria-valuetext attribute reflects.");
</script>
</html>

View file

@ -25,7 +25,7 @@
// We scroll to the end of the document so that the paragraph becomes visible.
// A user agent could paint the text before or after scrolling, but either way
// it must produce an entry for it.
window.scrollTo(0,document.body.scrollHeight);
window.scrollTo(0,document.scrollingElement.scrollHeight);
};
}, 'Paragraph with elementtiming attribute is observed even when not initially visible.');
</script>

View file

@ -2,50 +2,50 @@
"use strict";
async function assert_request(input, init) {
async function assert_request(test, input, init) {
assert_throws(new TypeError(), () => new Request(input, init), "new Request()");
assert_throws(new TypeError(), async () => await fetch(input, init), "fetch()");
await promise_rejects_js(test, TypeError, fetch(input, init), "fetch()");
}
promise_test(async () => {
promise_test(async (t) => {
const stream = new ReadableStream();
stream.getReader();
await assert_request("...", { method:"POST", body: stream });
await assert_request(t, "...", { method:"POST", body: stream });
}, "Constructing a Request with a stream on which getReader() is called");
promise_test(async () => {
promise_test(async (t) => {
const stream = new ReadableStream();
stream.getReader().read();
await assert_request("...", { method:"POST", body: stream });
await assert_request(t, "...", { method:"POST", body: stream });
}, "Constructing a Request with a stream on which read() is called");
promise_test(async () => {
promise_test(async (t) => {
const stream = new ReadableStream({ pull: c => c.enqueue(new Uint8Array()) }),
reader = stream.getReader();
await reader.read();
reader.releaseLock();
await assert_request("...", { method:"POST", body: stream });
await assert_request(t, "...", { method:"POST", body: stream });
}, "Constructing a Request with a stream on which read() and releaseLock() are called");
promise_test(async () => {
promise_test(async (t) => {
const request = new Request("...", { method: "POST", body: "..." });
request.body.getReader();
await assert_request(request);
await assert_request(t, request);
assert_class_string(new Request(request, { body: "..." }), "Request");
}, "Constructing a Request with a Request on which body.getReader() is called");
promise_test(async () => {
promise_test(async (t) => {
const request = new Request("...", { method: "POST", body: "..." });
request.body.getReader().read();
await assert_request(request);
await assert_request(t, request);
assert_class_string(new Request(request, { body: "..." }), "Request");
}, "Constructing a Request with a Request on which body.getReader().read() is called");
promise_test(async () => {
promise_test(async (t) => {
const request = new Request("...", { method: "POST", body: "..." }),
reader = request.body.getReader();
await reader.read();
reader.releaseLock();
await assert_request(request);
await assert_request(t, request);
assert_class_string(new Request(request, { body: "..." }), "Request");
}, "Constructing a Request with a Request on which read() and releaseLock() are called");

View file

@ -20,6 +20,16 @@
assert_true(responseError.headers.entries().next().done, "Headers should be empty");
}, "Check response returned by static method error()");
test(function() {
const headers = Response.error().headers;
// Avoid false positives if expected API is not available
assert_true(!!headers);
assert_equals(typeof headers.append, 'function');
assert_throws_js(TypeError, function () { headers.append('name', 'value'); });
}, "the 'guard' of the Headers instance should be immutable");
</script>
</body>
</html>

View file

@ -21,8 +21,8 @@ window.onload = function() {
iframes[0].contentDocument.onfullscreenchange = t.step_func(function() {
assert_equals(document.fullscreenElement, iframes[0]);
trusted_request(t, iframes[1].contentDocument.body, iframes[0].contentDocument.body);
iframes[1].contentDocument.onfullscreenchange = t.unreached_func("fullscreenchange event");
iframes[1].contentDocument.onfullscreenerror = t.step_func_done();
iframes[1].contentDocument.onfullscreenerror = t.unreached_func("fullscreenerror event");
iframes[1].contentDocument.onfullscreenchange = t.step_func_done();
});
});
};

View file

@ -6,6 +6,7 @@
<div id=log></div>
<iframe></iframe>
<script>
setup({ single_test: true });
onload = function() {
var fr = document.querySelector("iframe")
fr.contentWindow.location = "support/dummy.html"

View file

@ -6,6 +6,7 @@
<div id=log></div>
<iframe></iframe>
<script>
setup({ single_test: true });
onload = function() {
var fr = document.querySelector("iframe")
fr.src = "about:blank"

View file

@ -15,31 +15,27 @@
var steps = [{
fragid:'has%20two%20spaces',
handler: function(){
assert_equals( scrollPosition(), 100 );
assert_equals( document.scrollingElement.scrollTop, 100 );
}
},{
fragid:'escape%20collision',
handler: function(){
assert_equals( scrollPosition(), 200 );
assert_equals( document.scrollingElement.scrollTop, 200 );
document.getElementById("%20has%20two%20spaces").setAttribute("id", "has%20two%20spaces");
}
},{
fragid:'has%20two%20spaces',
handler: function(){
assert_equals( scrollPosition(), 300 );
assert_equals( document.scrollingElement.scrollTop, 300 );
}
},{
fragid:'do%20not%20go%20here',
handler: function(){
// don't move
assert_equals( scrollPosition(), 400 );
assert_equals( document.scrollingElement.scrollTop, 400 );
}
}];
function scrollPosition(){
return document.documentElement.scrollTop || document.body.scrollTop;
}
function runNextStep(){
if( steps.length > 0 ) {
var step = steps.shift();

View file

@ -11,29 +11,25 @@
var steps = [{
fragid:'not-the-top',
handler: function(){
assert_not_equals( scrollPosition(), 0 );
assert_not_equals( document.scrollingElement.scrollTop, 0 );
}
},{
fragid:'top',
handler: function(){
assert_equals( scrollPosition(), 0 );
assert_equals( document.scrollingElement.scrollTop, 0 );
}
},{
fragid:'not-the-top',
handler: function(){
assert_not_equals( scrollPosition(), 0 );
assert_not_equals( document.scrollingElement.scrollTop, 0 );
}
},{
fragid:'TOP',
handler: function(){
assert_equals( scrollPosition(), 0 );
assert_equals( document.scrollingElement.scrollTop, 0 );
}
}];
function scrollPosition(){
return document.documentElement.scrollTop || document.body.scrollTop;
}
function runNextStep(){
if( steps.length > 0 ) {
var step = steps.shift();

View file

@ -0,0 +1,5 @@
<body>
<script>
document.__proto__.changeFromSandboxedIframe = "change from sandboxed iframe";
</script>
</body>

View file

@ -0,0 +1,40 @@
<!doctype html>
<html>
<head>
<title>Reuse of iframe about:blank document execution context</title>
<link rel="author" title="Dan Clark" href="mailto:daniec@microsoft.com">
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/master/browsers.html#sandboxing">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>Reuse of iframe about:blank document execution context in sandbox="allow-scripts" iframe</h1>
<script type="text/javascript">
var t = async_test("iframe with sandbox should load with new execution context")
let iframe = document.createElement("iframe");
iframe.src = './sandbox-new-execution-context-iframe.html';
document.body.appendChild(iframe);
iframe.sandbox = "allow-scripts";
let iframeAboutBlankDocument = iframe.contentDocument;
assert_equals(iframeAboutBlankDocument.URL, "about:blank");
iframe.onload = t.step_func_done(() => {
assert_equals(iframe.contentDocument, null,
"New document in sandboxed iframe should have opaque origin");
assert_equals(iframeAboutBlankDocument.__proto__.changeFromSandboxedIframe, undefined,
"Sandboxed iframe contents should not have been able to mess with type system of about:blank document");
let iframeAboutBlankContents = iframeAboutBlankDocument.querySelectorAll('body');
assert_equals(iframeAboutBlankContents[0].tagName, "BODY",
"about:blank document's contents should still be accessible");
t.done();
});
</script>
<div id="log"></div>
</body>
</html>

View file

@ -4,6 +4,17 @@
<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#scrollable {
width: 100px;
height: 100px;
overflow: scroll;
}
#scrollable-inner {
width: 1024px;
height: 2048px;
}
</style>
<body>
<input>
<input type="hidden">
@ -26,6 +37,11 @@
<details><summary>summary</summary><summary id="secondsummary">second summary</summary>details</details>
<div id="hostDelegatesFocus"></div>
<div id="hostNonDelegatesFocus"></div>
<div contenteditable="true"></div>
<div id="scrollable"><div id="scrollable-inner"></div></div>
<fieldset></fieldset>
<output></output>
<slot></slot>
<script>
document.getElementById("hostDelegatesFocus").attachShadow({ mode: "open", delegatesFocus: true });
document.getElementById("hostNonDelegatesFocus").attachShadow({ mode: "open", delegatesFocus: false });
@ -55,6 +71,11 @@ const defaultList = [
["summary#secondsummary", -1],
["#hostDelegatesFocus", -1],
["#hostNonDelegatesFocus", -1],
["div[contenteditable]", -1],
["#scrollable", -1],
["fieldset", -1],
["output", -1],
["slot", -1],
];
const tabIndexValue = [-1, 0, 1];
for (const entry of defaultList) {

View file

@ -13,10 +13,10 @@
<script>
"use strict";
const input = document.querySelector("input");
test(() => {
const input = document.querySelector("input");
assert_equals(document.activeElement, document.body);
assert_not_equals(document.activeElement, input);
done();
assert_equals(document.activeElement, document.body);
assert_not_equals(document.activeElement, input);
});
</script>

View file

@ -7,6 +7,7 @@
</style>
<dialog open id=dialog></dialog>
<script>
assert_equals(getComputedStyle(document.getElementById('dialog')).display, 'block');
done();
test(function() {
assert_equals(getComputedStyle(document.getElementById('dialog')).display, 'block');
});
</script>

View file

@ -1,6 +1,7 @@
var testStyle = getComputedStyle(document.getElementById('test'));
var refStyle = getComputedStyle(document.getElementById('ref'));
for (var prop in testStyle) {
assert_equals(testStyle[prop], refStyle[prop], prop);
}
done();
test(function() {
var testStyle = getComputedStyle(document.getElementById('test'));
var refStyle = getComputedStyle(document.getElementById('ref'));
for (var prop in testStyle) {
assert_equals(testStyle[prop], refStyle[prop], prop);
}
});

View file

@ -7,9 +7,10 @@
<table vspace=25 hspace=25><tr><td>x</table>
<div>x</div>
<script>
var style = getComputedStyle(document.querySelector('table'));
['marginTop', 'marginRight', 'marginBottom', 'marginLeft'].forEach(function(m) {
assert_equals(style[m], '0px', m);
test(function() {
var style = getComputedStyle(document.querySelector('table'));
['marginTop', 'marginRight', 'marginBottom', 'marginLeft'].forEach(function(m) {
assert_equals(style[m], '0px', m);
});
});
done();
</script>

View file

@ -7,9 +7,10 @@
<table vspace=25 hspace=25><tr><td>x</table>
<div>x</div> <!-- prevent margin collapsing quirks -->
<script>
var style = getComputedStyle(document.querySelector('table'));
['marginTop', 'marginRight', 'marginBottom', 'marginLeft'].forEach(function(m) {
assert_equals(style[m], '0px', m);
test(function() {
var style = getComputedStyle(document.querySelector('table'));
['marginTop', 'marginRight', 'marginBottom', 'marginLeft'].forEach(function(m) {
assert_equals(style[m], '0px', m);
});
});
done();
</script>

View file

@ -4,6 +4,7 @@
<script src="/resources/testharnessreport.js"></script>
<iframe src="/common/blank.html" marginwidth=0 marginheight=0></iframe>
<script>
setup({ single_test: true });
onload = () => {
assert_equals(window[0].document.body.attributes.length, 0, "Number of attributes on the child document's body");
done();

View file

@ -9,6 +9,7 @@
<script>
"use strict";
setup({ single_test: true });
const sourceIFrame = document.createElement("iframe");
sourceIFrame.setAttribute("sandbox", "allow-same-origin");

View file

@ -9,6 +9,7 @@
<script>
"use strict";
setup({ single_test: true });
const sourceIFrame = document.createElement("iframe");

View file

@ -9,6 +9,7 @@
<script>
"use strict";
setup({ single_test: true });
const iframe = document.createElement("iframe");
let loadCount = 0;

View file

@ -9,6 +9,7 @@
<div id="log"></div>
<script>
"use strict";
setup({ single_test: true });
const iframe = document.createElement("iframe");
iframe.src = "support/ufoo";

View file

@ -9,6 +9,7 @@
<script>
"use strict";
setup({ single_test: true });
const sourceIFrame = document.createElement("iframe");
let sourceLoadCount = 0;

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