Auto merge of #27889 - servo-wpt-sync:wpt_update_01-12-2020, r=servo-wpt-sync

Sync WPT with upstream (01-12-2020)

Automated downstream sync of changes from upstream as of 01-12-2020.
[no-wpt-sync]
r? @servo-wpt-sync
This commit is contained in:
bors-servo 2020-12-01 06:03:37 -05:00 committed by GitHub
commit a3e9e3f2bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 1313 additions and 302 deletions

View file

@ -0,0 +1,4 @@
[hit-test-floats-002.html]
[Hit test float]
expected: FAIL

View file

@ -1,4 +0,0 @@
[hit-test-floats-003.html]
[Miss float below something else]
expected: FAIL

View file

@ -1,4 +0,0 @@
[hit-test-floats-004.html]
[Miss float below something else]
expected: FAIL

View file

@ -0,0 +1,4 @@
[hit-test-floats-005.html]
[Miss clipped float]
expected: FAIL

View file

@ -0,0 +1,7 @@
[flex-minimum-size-003.html]
[img 1]
expected: FAIL
[img 2]
expected: FAIL

View file

@ -2,3 +2,6 @@
[Hit test intersecting scaled box] [Hit test intersecting scaled box]
expected: FAIL expected: FAIL
[Hit test within unscaled box]
expected: FAIL

View file

@ -17,6 +17,3 @@
[test the top of layer] [test the top of layer]
expected: FAIL expected: FAIL
[test some point of the element: top left corner]
expected: FAIL

View file

@ -0,0 +1,4 @@
[elementsFromPoint-invalid-cases.html]
[The root element is the last element returned for otherwise empty queries within the viewport]
expected: FAIL

View file

@ -309,24 +309,15 @@
[Response: combined response Content-Type: text/html;" \\" text/plain ";charset=GBK] [Response: combined response Content-Type: text/html;" \\" text/plain ";charset=GBK]
expected: NOTRUN expected: NOTRUN
[<iframe>: separate response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: */* text/html]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;x=" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;" \\" text/plain] [<iframe>: separate response Content-Type: text/html;" \\" text/plain]
expected: FAIL expected: FAIL
[<iframe>: separate response Content-Type: text/plain ] [<iframe>: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL expected: FAIL

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
[iframe_sandbox_popups_escaping-3.html] [iframe_sandbox_popups_escaping-3.html]
expected: TIMEOUT
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used] [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,4 +0,0 @@
[form-double-submit-3.html]
[<button> should have the same double-submit protection as <input type=submit>]
expected: FAIL

View file

@ -0,0 +1,4 @@
[activation-behavior.window.html]
[<a> that is not connected should be followed]
expected: FAIL

View file

@ -0,0 +1,4 @@
[module-delayed.html]
[async document.write in a module]
expected: FAIL

View file

@ -3,3 +3,6 @@
[The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document] [The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document]
expected: TIMEOUT expected: TIMEOUT
[The entry settings object while executing the compiled callback via Web IDL's invoke must be that of the node document]
expected: FAIL

View file

@ -0,0 +1,19 @@
[navigator-window-controls-overlay.html]
[getBoundingClientRect should be a method of the windowControlsOverlay object]
expected: FAIL
[visible should be false]
expected: FAIL
[getBoundingClientRect return type should be DOMRect]
expected: FAIL
[visible should be a member of the windowControlsOverlay object]
expected: FAIL
[the windowControlsOverlay object should exist on the navigator object]
expected: FAIL
[getBoundingClientRect should return a empty DOMRect]
expected: FAIL

View file

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

View file

@ -344,3 +344,6 @@
[X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...\] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[28696\]\t1.7388302799288880e-27\t9.3139332532882690e-1\t9.3139332532882690e-1\t1.0000000000000000e+0\t3.8985999999999999e-3\n\t[28697\]\t7.0477002859115601e-1\t9.0675884485244751e-1\t2.0198881626129150e-1\t2.2275913536212616e-1\t3.8985999999999999e-3\n\tMax AbsError of 9.3139332532882690e-1 at index of 28696.\n\tMax RelError of 1.0000000000000000e+0 at index of 28696.\n] [X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...\] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[28696\]\t1.7388302799288880e-27\t9.3139332532882690e-1\t9.3139332532882690e-1\t1.0000000000000000e+0\t3.8985999999999999e-3\n\t[28697\]\t7.0477002859115601e-1\t9.0675884485244751e-1\t2.0198881626129150e-1\t2.2275913536212616e-1\t3.8985999999999999e-3\n\tMax AbsError of 9.3139332532882690e-1 at index of 28696.\n\tMax RelError of 1.0000000000000000e+0 at index of 28696.\n]
expected: FAIL expected: FAIL
[X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...\] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[28696\]\t-2.6532444456922729e-32\t9.3139332532882690e-1\t9.3139332532882690e-1\t1.0000000000000000e+0\t3.8985999999999999e-3\n\t[28697\]\t7.0477002859115601e-1\t9.0675884485244751e-1\t2.0198881626129150e-1\t2.2275913536212616e-1\t3.8985999999999999e-3\n\tMax AbsError of 9.3139332532882690e-1 at index of 28696.\n\tMax RelError of 1.0000000000000000e+0 at index of 28696.\n]
expected: FAIL

View file

@ -1,4 +1,5 @@
[audiocontext-not-fully-active.html] [audiocontext-not-fully-active.html]
expected: TIMEOUT
[frame in navigated remote-site frame] [frame in navigated remote-site frame]
expected: FAIL expected: FAIL

View file

@ -0,0 +1,2 @@
[Worker-constructor.html]
expected: ERROR

View file

@ -370,6 +370,13 @@
] ]
}, },
"css-pseudo": { "css-pseudo": {
"file-selector-button-display-none-overflow-crash.html": [
"81051741c29824bb79460f6dba1b147b9e79de45",
[
null,
{}
]
],
"file-selector-button-display-toggle-crash.tentative.html": [ "file-selector-button-display-toggle-crash.tentative.html": [
"bc9f24ae0194fc3b59a1f0da7e8c2e13cf9eb9c5", "bc9f24ae0194fc3b59a1f0da7e8c2e13cf9eb9c5",
[ [
@ -24102,15 +24109,15 @@
] ]
}, },
"web-nfc": { "web-nfc": {
"NDEFReader-document-hidden-manual.https.html": [ "NDEFReader-read-document-hidden-manual.https.html": [
"ffbd7ebc45618a905b91eaa5a6cfa4f41f8efcd9", "47c1332713eef2069820a2149a79dd667e6a62ad",
[ [
null, null,
{} {}
] ]
], ],
"NDEFWriter-document-hidden-manual.https.html": [ "NDEFReader-write-document-hidden-manual.https.html": [
"1a2839857bb69fc06b6ea779e138b17cf54ca580", "150e5a239cfb6dcb6b05288006e80d401ec762a7",
[ [
null, null,
{} {}
@ -24283,6 +24290,122 @@
"print-reftest": { "print-reftest": {
"css": { "css": {
"css-break": { "css-break": {
"block-001-wm-vlr-print.html": [
"6cd5ea07c7b2a132cef7d26abd4204cb157b5eae",
[
null,
[
[
"/css/css-break/block-001-wm-vlr-ref.html",
"=="
]
],
{
"fuzzy": [
[
null,
[
[
0,
60
],
[
0,
200
]
]
]
]
}
]
],
"block-001-wm-vrl-print.html": [
"6e073121c6acf3b7c5b381e230365fcf4b7e6d56",
[
null,
[
[
"/css/css-break/block-001-wm-vrl-ref.html",
"=="
]
],
{
"fuzzy": [
[
null,
[
[
0,
60
],
[
0,
200
]
]
]
]
}
]
],
"block-002-wm-vlr-print.html": [
"99949623c3923e529687e75ee18e849bfc852180",
[
null,
[
[
"/css/css-break/block-002-wm-vlr-ref.html",
"=="
]
],
{
"fuzzy": [
[
null,
[
[
0,
35
],
[
0,
220
]
]
]
]
}
]
],
"block-002-wm-vrl-print.html": [
"084b5325b7ac40ee5b81f22cd542e5b3f5c16b57",
[
null,
[
[
"/css/css-break/block-002-wm-vrl-ref.html",
"=="
]
],
{
"fuzzy": [
[
null,
[
[
0,
35
],
[
0,
220
]
]
]
]
}
]
],
"break-nested-float-in-table-001-print.html": [ "break-nested-float-in-table-001-print.html": [
"e4e0a578e9a6c6d763fcb9e80d6ff8b91561f3e5", "e4e0a578e9a6c6d763fcb9e80d6ff8b91561f3e5",
[ [
@ -24295,6 +24418,19 @@
], ],
{} {}
] ]
],
"ink-overflow-001-print.html": [
"495153d3d423b014aa40aeed87ea0a899edce1f5",
[
null,
[
[
"about:blank",
"=="
]
],
{}
]
] ]
}, },
"css-flexbox": { "css-flexbox": {
@ -128068,6 +128204,19 @@
{} {}
] ]
], ],
"ink-overflow-002.html": [
"8af605efea87b618007641729bd3b579fcb654eb",
[
null,
[
[
"/css/reference/ref-filled-green-100px-square.xht",
"=="
]
],
{}
]
],
"line-after-unbreakable-float-after-padding.html": [ "line-after-unbreakable-float-after-padding.html": [
"d3a4018cd809fc09eb68c1b25f4dda4736e64131", "d3a4018cd809fc09eb68c1b25f4dda4736e64131",
[ [
@ -161670,6 +161819,19 @@
{} {}
] ]
], ],
"multicol-fill-balance-005.html": [
"ad9a592ec9355ded07383e2071d1dda786ba5f8f",
[
null,
[
[
"/css/reference/ref-filled-green-100px-square.xht",
"=="
]
],
{}
]
],
"multicol-gap-000.xht": [ "multicol-gap-000.xht": [
"88aa17e8b488565dc40398e6e8f1d2e3bf3a97a1", "88aa17e8b488565dc40398e6e8f1d2e3bf3a97a1",
[ [
@ -168602,6 +168764,32 @@
{} {}
] ]
], ],
"first-letter-skip-empty-span-nested.html": [
"e57700bbbd61246c93a5e2bae00659d87a4981dc",
[
null,
[
[
"/css/css-pseudo/first-letter-skip-empty-span-nested-ref.html",
"=="
]
],
{}
]
],
"first-letter-skip-empty-span.html": [
"d3914050ad892a13df3d5caacc238488175ac5c3",
[
null,
[
[
"/css/css-pseudo/first-letter-skip-empty-span-ref.html",
"=="
]
],
{}
]
],
"first-letter-skip-marker.html": [ "first-letter-skip-marker.html": [
"fb9fe258472e3a0e338f12246469e9499b4c2601", "fb9fe258472e3a0e338f12246469e9499b4c2601",
[ [
@ -301493,6 +301681,22 @@
"5c3363562ab196a5c5cdb6e72b471b52e0cc8375", "5c3363562ab196a5c5cdb6e72b471b52e0cc8375",
[] []
], ],
"block-001-wm-vlr-ref.html": [
"b131b0e486084ed3a127ac07c23425f8e50be93a",
[]
],
"block-001-wm-vrl-ref.html": [
"6fb7e7353c7ab73a11c459088d0368f9e96f1484",
[]
],
"block-002-wm-vlr-ref.html": [
"d3193f20c4f69ccbed481829df9d8be57a1238ab",
[]
],
"block-002-wm-vrl-ref.html": [
"8b5ea92af5fd248ae3994d24e19375f301de98d1",
[]
],
"block-end-aligned-abspos-with-overflow-ref.html": [ "block-end-aligned-abspos-with-overflow-ref.html": [
"a8470b09a7d67eb3929c0380eaa45779c2b558ad", "a8470b09a7d67eb3929c0380eaa45779c2b558ad",
[] []
@ -311964,7 +312168,7 @@
[] []
], ],
"masonry-fragmentation-001-ref.html": [ "masonry-fragmentation-001-ref.html": [
"de3fe6f402d31c7256b3f9c36c4db857645beb97", "c9318ae0bba5ba6419bab7d36fd37720af8fb3b1",
[] []
], ],
"masonry-fragmentation-002-ref.html": [ "masonry-fragmentation-002-ref.html": [
@ -315595,6 +315799,14 @@
"38c230045bd0cbec0d94da16b27fd56aa58456a1", "38c230045bd0cbec0d94da16b27fd56aa58456a1",
[] []
], ],
"first-letter-skip-empty-span-nested-ref.html": [
"95c2f94a6b7f35f0c91b5aec314d79e38dc7fe5d",
[]
],
"first-letter-skip-empty-span-ref.html": [
"27a364546e7c56c8aa6baee11615f4950576404d",
[]
],
"first-letter-skip-marker-ref.html": [ "first-letter-skip-marker-ref.html": [
"82c5074fd26aa2dc35c9c8fa77dd3bf1099c5f88", "82c5074fd26aa2dc35c9c8fa77dd3bf1099c5f88",
[] []
@ -359735,7 +359947,7 @@
[] []
], ],
"helpers.js": [ "helpers.js": [
"70808e8db7b11db236b893cfd7147458154f69ce", "0be3add620065a9303bbe6878487f94771c51e0b",
[] []
] ]
} }
@ -368452,12 +368664,12 @@
[] []
], ],
"chromium.py": [ "chromium.py": [
"cef01c4ffc5dd2df67ddfb6ed746d3ea4c5c4d76", "3c52f76965b144ba1845c1f6e60fc6ea0bb63d54",
[] []
], ],
"tests": { "tests": {
"test_chromium.py": [ "test_chromium.py": [
"8f8e732d4736337ccfecbb13f1fb8b590c9df52a", "807f5837f7964e329d05377b34029c6ab727611f",
[] []
] ]
}, },
@ -370230,7 +370442,7 @@
], ],
"resources": { "resources": {
"nfc-helpers.js": [ "nfc-helpers.js": [
"0b26d09c96aa8f29ef6d5646c187af0a2a5100a8", "659f74ed8b128f8fb785eced13f90e21c53439b7",
[] []
], ],
"support-iframe.html": [ "support-iframe.html": [
@ -399428,7 +399640,7 @@
] ]
], ],
"otpcredential-iframe.https.html": [ "otpcredential-iframe.https.html": [
"8af17b599612e3750f3094270be8e9cd9a109290", "da3e572b6b5771fcc55f5bf828a1a0a0a6606fa3",
[ [
null, null,
{} {}
@ -403658,6 +403870,13 @@
{} {}
] ]
], ],
"flex-minimum-size-003.html": [
"95d9e37d0bdcccbc3f418dc007948425577396f2",
[
null,
{}
]
],
"flex-minimum-width-flex-items-014.html": [ "flex-minimum-width-flex-items-014.html": [
"080169b52d7fdf39cbf6ff970c3100480e46d2a3", "080169b52d7fdf39cbf6ff970c3100480e46d2a3",
[ [
@ -442123,6 +442342,13 @@
{} {}
] ]
], ],
"en-euro-windows-1252.tentative.html": [
"c2835e7d98a5c00d530b0b70c9de94d4f153c4ca",
[
null,
{}
]
],
"en-windows-1252.tentative.html": [ "en-windows-1252.tentative.html": [
"ac8cbe83fe201e7c538d17434fdfbab9456e6bff", "ac8cbe83fe201e7c538d17434fdfbab9456e6bff",
[ [
@ -493696,6 +493922,13 @@
{} {}
] ]
], ],
"navigator-window-controls-overlay.html": [
"069ff1602a621f55a9414a383f2ca03875fade15",
[
null,
{}
]
],
"navigator.any.js": [ "navigator.any.js": [
"07bccb788052e7ce2cb722558e416b5c017ed9f0", "07bccb788052e7ce2cb722558e416b5c017ed9f0",
[ [
@ -496688,7 +496921,7 @@
] ]
], ],
"content-visibility-auto-offscreen.html": [ "content-visibility-auto-offscreen.html": [
"8356a340dfb0b515b84ee8c8f14827d362305e30", "af60412a87f0ab5f532c6e4f0aae0e31d6f84bc5",
[ [
null, null,
{} {}
@ -496701,6 +496934,13 @@
{} {}
] ]
], ],
"content-visibility-auto-resize.html": [
"b8de7f52e325e5789a64ff306daf33481078fee7",
[
null,
{}
]
],
"content-visibility-hidden.html": [ "content-visibility-hidden.html": [
"939b1a212233a5be7b0b9611fe07cf062a11ffe0", "939b1a212233a5be7b0b9611fe07cf062a11ffe0",
[ [
@ -543021,14 +543261,21 @@
] ]
], ],
"NDEFReader_scan.https.html": [ "NDEFReader_scan.https.html": [
"b551af0150f068b0794047cdfb08c862ac3bbb4b", "0a8d8cb25a567a795dda572e963d74997de35406",
[ [
null, null,
{} {}
] ]
], ],
"NDEFReader_scan_iframe.https.html": [ "NDEFReader_scan_iframe.https.html": [
"8803c25fb0a54fe13b23eb455e6da09c422aa3d4", "6967c76ecd6d6bf6bfcb26c146931312f224734a",
[
null,
{}
]
],
"NDEFReader_write.https.html": [
"d1541b1b525828ee2f550fdb866365b683f31746",
[ [
null, null,
{} {}
@ -543048,13 +543295,6 @@
{} {}
] ]
], ],
"NDEFWriter_write.https.html": [
"57fd300a34f9b8fddf0489dec6048b4a55273f54",
[
null,
{}
]
],
"idlharness.https.window.js": [ "idlharness.https.window.js": [
"e2000abce8da4e44e793b0f935340b1348033cef", "e2000abce8da4e44e793b0f935340b1348033cef",
[ [
@ -543079,7 +543319,7 @@
] ]
], ],
"nfc_insecure_context.html": [ "nfc_insecure_context.html": [
"9a8e58cf802fceb818fa93000cb5a3db75bddc14", "8c2eb5a14275b7a301ac418b2c5be48bd03705ed",
[ [
null, null,
{} {}

View file

@ -0,0 +1,4 @@
[hit-test-floats-002.html]
[Hit test float]
expected: FAIL

View file

@ -1,4 +0,0 @@
[hit-test-floats-003.html]
[Miss float below something else]
expected: FAIL

View file

@ -1,4 +0,0 @@
[hit-test-floats-004.html]
[Miss float below something else]
expected: FAIL

View file

@ -0,0 +1,4 @@
[hit-test-floats-005.html]
[Miss clipped float]
expected: FAIL

View file

@ -0,0 +1,7 @@
[flex-minimum-size-003.html]
[img 1]
expected: FAIL
[img 2]
expected: FAIL

View file

@ -2,3 +2,6 @@
[Hit test intersecting scaled box] [Hit test intersecting scaled box]
expected: FAIL expected: FAIL
[Hit test within unscaled box]
expected: FAIL

View file

@ -21,6 +21,3 @@
[test the top of layer] [test the top of layer]
expected: FAIL expected: FAIL
[test some point of the element: top left corner]
expected: FAIL

View file

@ -0,0 +1,4 @@
[elementsFromPoint-invalid-cases.html]
[The root element is the last element returned for otherwise empty queries within the viewport]
expected: FAIL

View file

@ -309,24 +309,15 @@
[fetch(): separate response Content-Type: text/plain ] [fetch(): separate response Content-Type: text/plain ]
expected: NOTRUN expected: NOTRUN
[<iframe>: separate response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: */* text/html]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*]
expected: FAIL
[<iframe>: separate response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;x=" text/plain]
expected: FAIL
[<iframe>: separate response Content-Type: text/html;" \\" text/plain] [<iframe>: separate response Content-Type: text/html;" \\" text/plain]
expected: FAIL expected: FAIL
[<iframe>: separate response Content-Type: text/plain ] [<iframe>: combined response Content-Type: text/html;" text/plain]
expected: FAIL
[<iframe>: combined response Content-Type: text/html */*;charset=gbk]
expected: FAIL
[<iframe>: combined response Content-Type: text/html;x=" text/plain]
expected: FAIL expected: FAIL

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,6 @@
[iframe_sandbox_popups_escaping-3.html] [iframe_sandbox_popups_escaping-3.html]
type: testharness type: testharness
expected: TIMEOUT
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used] [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,4 +0,0 @@
[form-double-submit-3.html]
[<button> should have the same double-submit protection as <input type=submit>]
expected: FAIL

View file

@ -0,0 +1,4 @@
[activation-behavior.window.html]
[<a> that is not connected should be followed]
expected: FAIL

View file

@ -0,0 +1,4 @@
[module-delayed.html]
[async document.write in a module]
expected: FAIL

View file

@ -4,3 +4,6 @@
[The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document] [The incumbent settings object while executing the compiled callback via Web IDL's invoke must be that of the node document]
expected: TIMEOUT expected: TIMEOUT
[The entry settings object while executing the compiled callback via Web IDL's invoke must be that of the node document]
expected: FAIL

View file

@ -0,0 +1,19 @@
[navigator-window-controls-overlay.html]
[getBoundingClientRect should be a method of the windowControlsOverlay object]
expected: FAIL
[visible should be false]
expected: FAIL
[getBoundingClientRect return type should be DOMRect]
expected: FAIL
[visible should be a member of the windowControlsOverlay object]
expected: FAIL
[the windowControlsOverlay object should exist on the navigator object]
expected: FAIL
[getBoundingClientRect should return a empty DOMRect]
expected: FAIL

View file

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

View file

@ -572,3 +572,6 @@
[X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...\] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[28696\]\t1.7388302799288880e-27\t9.3139332532882690e-1\t9.3139332532882690e-1\t1.0000000000000000e+0\t3.8985999999999999e-3\n\t[28697\]\t7.0477002859115601e-1\t9.0675884485244751e-1\t2.0198881626129150e-1\t2.2275913536212616e-1\t3.8985999999999999e-3\n\tMax AbsError of 9.3139332532882690e-1 at index of 28696.\n\tMax RelError of 1.0000000000000000e+0 at index of 28696.\n] [X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...\] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[28696\]\t1.7388302799288880e-27\t9.3139332532882690e-1\t9.3139332532882690e-1\t1.0000000000000000e+0\t3.8985999999999999e-3\n\t[28697\]\t7.0477002859115601e-1\t9.0675884485244751e-1\t2.0198881626129150e-1\t2.2275913536212616e-1\t3.8985999999999999e-3\n\tMax AbsError of 9.3139332532882690e-1 at index of 28696.\n\tMax RelError of 1.0000000000000000e+0 at index of 28696.\n]
expected: FAIL expected: FAIL
[X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...\] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[28696\]\t-2.6532444456922729e-32\t9.3139332532882690e-1\t9.3139332532882690e-1\t1.0000000000000000e+0\t3.8985999999999999e-3\n\t[28697\]\t7.0477002859115601e-1\t9.0675884485244751e-1\t2.0198881626129150e-1\t2.2275913536212616e-1\t3.8985999999999999e-3\n\tMax AbsError of 9.3139332532882690e-1 at index of 28696.\n\tMax RelError of 1.0000000000000000e+0 at index of 28696.\n]
expected: FAIL

View file

@ -1,4 +1,5 @@
[audiocontext-not-fully-active.html] [audiocontext-not-fully-active.html]
expected: TIMEOUT
[frame in navigated remote-site frame] [frame in navigated remote-site frame]
expected: FAIL expected: FAIL

View file

@ -0,0 +1,2 @@
[Worker-constructor.html]
expected: ERROR

View file

@ -27,6 +27,19 @@ promise_test(async t => {
}, "Test OTPCredential enabled in same origin iframes"); }, "Test OTPCredential enabled in same origin iframes");
promise_test(async t => {
const messageWatcher = new EventWatcher(t, window, "message");
var iframe = document.createElement("iframe");
iframe.src = remoteBaseURL + "support/otpcredential-iframe.html"
iframe.allow = "otp-credentials";
document.body.appendChild(iframe);
const message = await messageWatcher.wait_for("message");
assert_equals(message.data.result, "Pass");
assert_equals(message.data.code, "ABC123");
}, "OTPCredential enabled in cross origin iframes with permissions policy");
promise_test(async t => { promise_test(async t => {
const messageWatcher = new EventWatcher(t, window, "message"); const messageWatcher = new EventWatcher(t, window, "message");
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");
@ -37,5 +50,5 @@ promise_test(async t => {
assert_equals(message.data.result, "Fail"); assert_equals(message.data.result, "Fail");
assert_equals(message.data.errorType, "NotAllowedError"); assert_equals(message.data.errorType, "NotAllowedError");
}, "Test OTPCredential disabled in cross origin iframes"); }, "OTPCredential disabled in cross origin iframes without permissions policy");
</script> </script>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="help" href="https://www.w3.org/TR/css-break-3/">
<link rel="match" href="block-001-wm-vlr-ref.html">
<meta name="flags" content="paged">
<meta name="fuzzy" content="maxDifference=0-60;totalPixels=0-200">
<html>
<style>
@page {
size: 5in 3in;
margin: 0.5in;
}
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
writing-mode: vertical-lr;
}
html { block-size: 40vw; }
.b {
inline-size: 50vh;
block-size: 210vw;
box-sizing: border-box;
border: 5px solid black;
border-block-start-color: blue;
border-inline-start-color: lime;
margin-inline-start: 20px;
margin-block-end: -20px;
}
</style>
<body>
<div class="b"></div>
</body>
</html>

View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<meta name="flags" content="paged">
<html>
<style>
@page {
size: 5in 3in;
margin: 0.5in;
}
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
writing-mode: vertical-lr;
}
html { block-size: 40vw; }
.b {
box-sizing: border-box;
inline-size: 50vh;
border: 5px solid black;
border-block-start-color: blue;
border-inline-start-color: lime;
margin-inline-start: 20px;
}
.b1 {
block-size: 100vw;
border-block-end-style: none;
}
.b2 {
block-size: 100vw;
border-block-start-style: none;
border-block-end-style: none;
}
.b3 {
block-size: 10vw;
border-block-start-style: none;
margin-block-end: -20px;
}
</style>
<body>
<div class="b b1"></div>
<div class="b b2"></div>
<div class="b b3"></div>
</body>
</html>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="help" href="https://www.w3.org/TR/css-break-3/">
<link rel="match" href="block-001-wm-vrl-ref.html">
<meta name="flags" content="paged">
<meta name="fuzzy" content="maxDifference=0-60;totalPixels=0-200">
<html>
<style>
@page {
size: 5in 3in;
margin: 0.5in;
}
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
writing-mode: vertical-rl;
}
html { block-size: 40vw; }
.b {
inline-size: 50vh;
block-size: 210vw;
box-sizing: border-box;
border: 5px solid black;
border-block-start-color: blue;
border-inline-start-color: lime;
margin-inline-start: 20px;
}
</style>
<body>
<div class="b"></div>
</body>
</html>

View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<meta name="flags" content="paged">
<html>
<style>
@page {
size: 5in 3in;
margin: 0.5in;
}
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
writing-mode: vertical-rl;
}
html { block-size: 40vw; }
.b {
box-sizing: border-box;
inline-size: 50vh;
border: 5px solid black;
border-block-start-color: blue;
border-inline-start-color: lime;
margin-inline-start: 20px;
}
.b1 {
block-size: 100vw;
border-block-end-style: none;
}
.b2 {
block-size: 100vw;
border-block-start-style: none;
border-block-end-style: none;
}
.b3 {
block-size: 10vw;
border-block-start-style: none;
margin-block-end: -20px;
}
</style>
<body>
<div class="b b1"></div>
<div class="b b2"></div>
<div class="b b3"></div>
</body>
</html>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="help" href="https://www.w3.org/TR/css-break-3/">
<link rel="match" href="block-002-wm-vlr-ref.html">
<meta name="flags" content="paged">
<meta name="fuzzy" content="maxDifference=0-35;totalPixels=0-220">
<html>
<style>
@page {
size: 5in 3in;
margin: 0.5in;
}
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
writing-mode: vertical-lr;
}
html { margin-block-start: 80vw; }
* { box-sizing: border-box; }
.b {
inline-size: 50vh;
block-size: 130vw;
border: 5px solid black;
border-block-start-color: blue;
border-inline-start-color: lime;
margin-inline-start: 20px;
}
.b > div {
inline-size: 50vh;
block-size: 150vw;
border: 5px solid grey;
margin-inline-start: 20px;
margin-block-start: -5px;
}
.after {
inline-size: 60vh;
block-size: 30vw;
margin-block-start: 5vw;
border: 5px solid blue;
}
</style>
<body>
<div class="b">
<div></div>
</div>
<div class="after"></div>
</body>
</html>

View file

@ -0,0 +1,73 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<meta name="flags" content="paged">
<html>
<style>
@page {
size: 5in 3in;
margin: 0.5in;
}
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
writing-mode: vertical-lr;
}
html { margin-block-start: 80vw; }
* { box-sizing: border-box; }
.b {
inline-size: 50vh;
border: 5px solid black;
border-block-start-color: blue;
border-inline-start-color: lime;
margin-inline-start: 20px;
}
.b1 {
block-size: 20vw;
border-block-end-style: none;
}
.b2 {
block-size: 100vw;
border-block-start-style: none;
border-block-end-style: none;
}
.b3 {
block-size: 10vw;
border-block-start-style: none;
}
.b > div {
inline-size: 50vh;
block-size: 100vw;
border: 5px solid grey;
margin-inline-start: 20px;
}
.b1 > div {
border-block-end-style: none;
margin-block-start: -5px;
}
.b2 > div {
border-block-start-style: none;
border-block-end-style: none;
}
.b3 > div {
block-size: 30vw;
border-block-start-style: none;
}
.after {
inline-size: 60vh;
block-size: 30vw;
margin-block-start: 5vw;
border: 5px solid blue;
}
</style>
<body>
<div class="b b1"><div></div></div>
<div class="b b2"><div></div></div>
<div class="b b3"><div></div></div>
<div class="after"></div>
</body>
</html>

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="help" href="https://www.w3.org/TR/css-break-3/">
<link rel="match" href="block-002-wm-vrl-ref.html">
<meta name="flags" content="paged">
<meta name="fuzzy" content="maxDifference=0-35;totalPixels=0-220">
<html>
<style>
@page {
size: 5in 3in;
margin: 0.5in;
}
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
writing-mode: vertical-rl;
}
html { margin-block-start: 80vw; }
* { box-sizing: border-box; }
.b {
inline-size: 50vh;
block-size: 130vw;
border: 5px solid black;
border-block-start-color: blue;
border-inline-start-color: lime;
margin-inline-start: 20px;
}
.b > div {
inline-size: 50vh;
block-size: 150vw;
border: 5px solid grey;
margin-inline-start: 20px;
margin-block-start: -5px;
}
.after {
inline-size: 60vh;
block-size: 30vw;
margin-block-start: 5vw;
border: 5px solid blue;
}
</style>
<body>
<div class="b">
<div></div>
</div>
<div class="after"></div>
</body>
</html>

View file

@ -0,0 +1,73 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<meta name="flags" content="paged">
<html>
<style>
@page {
size: 5in 3in;
margin: 0.5in;
}
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
writing-mode: vertical-rl;
}
html { margin-block-start: 80vw; }
* { box-sizing: border-box; }
.b {
inline-size: 50vh;
border: 5px solid black;
border-block-start-color: blue;
border-inline-start-color: lime;
margin-inline-start: 20px;
}
.b1 {
block-size: 20vw;
border-block-end-style: none;
}
.b2 {
block-size: 100vw;
border-block-start-style: none;
border-block-end-style: none;
}
.b3 {
block-size: 10vw;
border-block-start-style: none;
}
.b > div {
inline-size: 50vh;
block-size: 100vw;
border: 5px solid grey;
margin-inline-start: 20px;
}
.b1 > div {
border-block-end-style: none;
margin-block-start: -5px;
}
.b2 > div {
border-block-start-style: none;
border-block-end-style: none;
}
.b3 > div {
block-size: 30vw;
border-block-start-style: none;
}
.after {
inline-size: 60vh;
block-size: 30vw;
margin-block-start: 5vw;
border: 5px solid blue;
}
</style>
<body>
<div class="b b1"><div></div></div>
<div class="b b2"><div></div></div>
<div class="b b3"><div></div></div>
<div class="after"></div>
</body>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="help" href="https://www.w3.org/TR/css-break-3/">
<link rel="match" href="about:blank">
<meta name="flags" content="paged">
<style>
@page {
size: 5in 3in;
margin: 0.5in;
}
html,body {
color:black; background-color:white; font:20px/1 monospace; padding:0; margin:0;
}
body {
width: 100vw;
height: 100vh;
outline: 100px solid red;
box-shadow: 100px 100px 0 #F00;
}
</style>
<body></body>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
<link rel="help" href="https://www.w3.org/TR/css-break-3/">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
.col {
column-width: 100px;
column-rule: 100px solid red;
height: 100px;
column-fill: auto;
gap: 0;
overflow: hidden;
}
.col > div {
display: flow-root;
width: 100px;
height: 100px;
background: green;
}
.col > div > div {
width: 10px;
height: 10px;
margin-top: 80px;
margin-left: 50px;
outline: 30px solid green;
box-shadow: 0 30px 0 30px green;
}
</style>
<body>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div class="col"><div><div></div></div></div>
</body>

View file

@ -0,0 +1,23 @@
<!doctype html>
<link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#min-size-auto">
<link rel="help" href="https://crbug.com/1151608">
<meta name="assert" content="automatic minimum size computation doesn't overflow when multiplying by the aspect ratio" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<body onload="checkLayout('img')">
<div id=log></div>
<div style="display: flex; width: 300px;">
<img src="data:image/svg+xml,%3Csvg viewBox='0 0 1 1' width='8000' height='8000' xmlns='http://www.w3.org/2000/svg' %3E%3C/svg%3E" data-expected-width=8000 style="height: 8000px;">
</div>
<div style="display: flex; flex-direction: column; height: 300px;">
<img src="data:image/svg+xml,%3Csvg viewBox='0 0 1 1' width='8000' height='8000' xmlns='http://www.w3.org/2000/svg' %3E%3C/svg%3E" data-expected-height=8000 style="width: 8000px;">
</div>
</body>

View file

@ -55,7 +55,7 @@ masonry-track {
} }
x,y,z,masonry-track { display: block; } x,y,z,masonry-track { display: block; }
masonry-track > * { margin-bottom:2px; } masonry-track > * { margin-bottom:2px; }
masonry-track.last > :last-child { margin-bottom:0; } .last > masonry-track > :last-child { margin-bottom:0; }
masonry-track:nth-child(1) { width: 10px; } masonry-track:nth-child(1) { width: 10px; }
masonry-track:nth-child(2) { width: 15px; margin-left:2px; } masonry-track:nth-child(2) { width: 15px; margin-left:2px; }
masonry-track:nth-child(3) { width: 20px; margin-left:2px; } masonry-track:nth-child(3) { width: 20px; margin-left:2px; }

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-multicol-1/#filling-columns">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="columns:2; column-gap:0; width:100px; height:20px; max-height:40px; min-height:100px; background:red;">
<div style="height:200px; background:green;"></div>
</div>

View file

@ -0,0 +1,5 @@
<link rel="author" href="mailto:mats@mozilla.com">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1679682">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5049">
<style>input{width:1px}::file-selector-button{display: none;}</style>
<input type="file">

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML>
<title>Reference: The nested empty span should be skipped when finding the ::first-letter content</title>
<link rel="author" title="Jaeyong Bae" href="jdragon.bae@gmail.com">
<style>
first-letter { color: green }
</style>
<div>
<span><first-letter>F</first-letter>irst letter should be green</span>
</div>

View file

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>CSS Test: The nested empty span should be skipped when finding the ::first-letter content</title>
<link rel="author" title="Jaeyong Bae" href="jdragon.bae@gmail.com">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#application-in-css">
<link rel="match" href="first-letter-skip-empty-span-nested-ref.html">
<style>
div::first-letter { color: green }
</style>
<div>
<span></span>
<span><span></span>First letter should be green</span>
</div>

View file

@ -0,0 +1,9 @@
<!DOCTYPE HTML>
<title>Reference: The empty span should be skipped when finding the ::first-letter content</title>
<link rel="author" title="Jaeyong Bae" href="jdragon.bae@gmail.com">
<style>
first-letter { color: green }
</style>
<div>
<span><first-letter>F</first-letter>irst letter should be green</span>
</div>

View file

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<title>CSS Test: The empty span should be skipped when finding the ::first-letter content</title>
<link rel="author" title="Jaeyong Bae" href="jdragon.bae@gmail.com">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#application-in-css">
<link rel="match" href="first-letter-skip-empty-span-ref.html">
<style>
div::first-letter { color: green }
</style>
<div>
<span></span>
<span>First letter should be green</span>
</div>

View file

@ -0,0 +1,14 @@
<!doctype html>
<title>en windows-1252 euro sign</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<p>It costs €9.</p>
<script>
setup({explicit_done:true});
onload = function() {
test(function() {
assert_equals(document.characterSet, "windows-1252", 'Expected windows-1252');
}, "Check detection result");
done();
};
</script>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<meta charset='utf-8'>
<title>navigator.windowControlsOverlay</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script>
test(function(){
assert_idl_attribute(navigator, 'windowControlsOverlay');
}, 'the windowControlsOverlay object should exist on the navigator object');
test(function(){
assert_idl_attribute(navigator.windowControlsOverlay, 'visible');
}, 'visible should be a member of the windowControlsOverlay object');
test(function(){
assert_false(navigator.windowControlsOverlay.visible);
}, 'visible should be false');
test(function(){
assert_idl_attribute(navigator.windowControlsOverlay, 'getBoundingClientRect');
}, 'getBoundingClientRect should be a method of the windowControlsOverlay object');
test(function(){
var rect = navigator.windowControlsOverlay.getBoundingClientRect();
assert_true(rect instanceof DOMRect);
}, 'getBoundingClientRect return type should be DOMRect');
test(function(){
var rect = navigator.windowControlsOverlay.getBoundingClientRect();
assert_equals(rect.x, 0);
assert_equals(rect.y, 0);
assert_equals(rect.width, 0);
assert_equals(rect.height, 0);
}, 'getBoundingClientRect should return a empty DOMRect');
</script>

View file

@ -2,13 +2,16 @@
<title>Layout Instability: off-screen content-visibility:auto content</title> <title>Layout Instability: off-screen content-visibility:auto content</title>
<link rel="help" href="https://wicg.github.io/layout-instability/" /> <link rel="help" href="https://wicg.github.io/layout-instability/" />
<style> <style>
#target { #auto {
content-visibility: auto; content-visibility: auto;
contain-intrinsic-size: 1px; contain-intrinsic-size: 1px;
width: 100px; width: 100px;
} }
</style> </style>
<div id=target style="position: relative; top: 100000px"> <div class=auto>
<div style="width: 100px; height: 100px"></div>
</div>
<div class=auto style="position: relative; top: 100000px">
<div style="width: 100px; height: 100px"></div> <div style="width: 100px; height: 100px"></div>
</div> </div>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
@ -21,7 +24,12 @@ promise_test(async () => {
// Wait for the initial render to complete. // Wait for the initial render to complete.
await waitForAnimationFrames(2); await waitForAnimationFrames(2);
window.scrollTo(0, 100000); window.scrollTo(0, 100000 + 100);
await waitForAnimationFrames(2);
assert_equals(watcher.score, 0);
window.scrollTo(0, 0);
await waitForAnimationFrames(2); await waitForAnimationFrames(2);
assert_equals(watcher.score, 0); assert_equals(watcher.score, 0);

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<title>Layout Instability: resizing content-visibility:auto content</title>
<link rel="help" href="https://wicg.github.io/layout-instability/" />
<style>
.auto {
content-visibility: auto;
contain-intrinsic-size: 10px 3000px;
width: 100px;
}
.contained {
height: 100px;
}
</style>
<div class=a><div class=contained></div></div>
<div class=a ><div class=contained></div></div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/util.js"></script>
<script>
promise_test(async () => {
const watcher = new ScoreWatcher;
// Wait for the initial render to complete.
await waitForAnimationFrames(2);
assert_equals(watcher.score, 0);
}, 'off-screen content-visibility:auto');
</script>

View file

@ -1,4 +1,4 @@
function setInnerHTML(el,content) { function setInnerHTML(el,content) {
const fragment = (new DOMParser()).parseFromString(`<pre>${content}</pre>`, 'text/html', {includeShadowRoots: true}); const fragment = (new DOMParser()).parseFromString(`<pre>${content}</pre>`, 'text/html', {includeShadowRoots: true});
el.replaceChildren(...fragment.body.firstChild.childNodes); (el instanceof HTMLTemplateElement ? el.content : el).replaceChildren(...fragment.body.firstChild.childNodes);
} }

View file

@ -172,7 +172,7 @@ class ChromiumFormatter(base.BaseFormatter):
to the actual status if it's not. to the actual status if it's not.
If the test has multiple statuses, it will have other statuses listed as If the test has multiple statuses, it will have other statuses listed as
"known_intermittent" in |data|. If these exist, they will be appended to "known_intermittent" in |data|. If these exist, they will be added to
the returned status with spaced in between. the returned status with spaced in between.
:param str actual_status: the actual status of the test :param str actual_status: the actual status of the test
@ -181,8 +181,9 @@ class ChromiumFormatter(base.BaseFormatter):
""" """
expected_statuses = self._map_status_name(data["expected"]) if "expected" in data else actual_status expected_statuses = self._map_status_name(data["expected"]) if "expected" in data else actual_status
if data.get("known_intermittent"): if data.get("known_intermittent"):
expected_statuses += " " + " ".join( all_statsues = {self._map_status_name(other_status) for other_status in data["known_intermittent"]}
[self._map_status_name(other_status) for other_status in data["known_intermittent"]]) all_statsues.add(expected_statuses)
expected_statuses = " ".join(sorted(all_statsues))
return expected_statuses return expected_statuses
def suite_start(self, data): def suite_start(self, data):

View file

@ -426,8 +426,8 @@ def test_flaky_test_expected(capfd):
test_obj = output_json["tests"]["t1"] test_obj = output_json["tests"]["t1"]
# The test's statuses are all mapped, changing ERROR->FAIL and OK->PASS # The test's statuses are all mapped, changing ERROR->FAIL and OK->PASS
assert test_obj["actual"] == "FAIL" assert test_obj["actual"] == "FAIL"
# All the possible statuses are concatenated together into expected. # All the possible statuses are merged and sorted together into expected.
assert test_obj["expected"] == "PASS FAIL TIMEOUT" assert test_obj["expected"] == "FAIL PASS TIMEOUT"
# ...this is not a regression or unexpected because the actual status is one # ...this is not a regression or unexpected because the actual status is one
# of the expected ones # of the expected ones
assert "is_regression" not in test_obj assert "is_regression" not in test_obj
@ -462,7 +462,7 @@ def test_flaky_test_unexpected(capfd):
test_obj = output_json["tests"]["t1"] test_obj = output_json["tests"]["t1"]
# The test's statuses are all mapped, changing ERROR->FAIL and OK->PASS # The test's statuses are all mapped, changing ERROR->FAIL and OK->PASS
assert test_obj["actual"] == "FAIL" assert test_obj["actual"] == "FAIL"
# All the possible statuses are concatenated together into expected. # All the possible statuses are merged and sorted together into expected.
assert test_obj["expected"] == "PASS TIMEOUT" assert test_obj["expected"] == "PASS TIMEOUT"
# ...this is a regression and unexpected because the actual status is not # ...this is a regression and unexpected because the actual status is not
# one of the expected ones # one of the expected ones
@ -536,6 +536,39 @@ def test_known_intermittent_empty(capfd):
assert test_obj["expected"] == "PASS" assert test_obj["expected"] == "PASS"
def test_known_intermittent_duplicate(capfd):
# We don't want to have duplicate statuses in the final "expected" field.
# Set up the handler.
output = StringIO()
logger = structuredlog.StructuredLogger("test_a")
logger.add_handler(handlers.StreamHandler(output, ChromiumFormatter()))
# There are two duplications in this input:
# 1. known_intermittent already contains expected;
# 2. both statuses in known_intermittent map to FAIL in Chromium.
# In the end, we should only get one FAIL in Chromium "expected".
logger.suite_start(["t1"], run_info={}, time=123)
logger.test_start("t1")
logger.test_end("t1", status="ERROR", expected="ERROR", known_intermittent=["FAIL", "ERROR"])
logger.suite_end()
# Check nothing got output to stdout/stderr.
# (Note that mozlog outputs exceptions during handling to stderr!)
captured = capfd.readouterr()
assert captured.out == ""
assert captured.err == ""
# Check the actual output of the formatter.
output.seek(0)
output_json = json.load(output)
test_obj = output_json["tests"]["t1"]
assert test_obj["actual"] == "FAIL"
# No duplicate "FAIL" in "expected".
assert test_obj["expected"] == "FAIL"
def test_reftest_screenshots(capfd): def test_reftest_screenshots(capfd):
# reftest_screenshots, if present, should be plumbed into artifacts. # reftest_screenshots, if present, should be plumbed into artifacts.

View file

@ -9,15 +9,15 @@
<script> <script>
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]);
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {
readerWatcher.wait_for("reading").then(event => { ndefWatcher.wait_for("reading").then(event => {
if (document.hidden) reject(); if (document.hidden) reject();
else resolve(); else resolve();
}); });
}); });
await reader.scan(); await ndef.scan();
await promise; await promise;
}, "Test NDEFReader.onreading is not fired when document is hidden"); }, "Test NDEFReader.onreading is not fired when document is hidden");

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="timeout" content="long"> <meta name="timeout" content="long">
<title>NDEFWriter.write respect page visibility changes</title> <title>NDEFReader.write respect page visibility changes</title>
<link rel="help" href="https://w3c.github.io/web-nfc/#visible-document"> <link rel="help" href="https://w3c.github.io/web-nfc/#visible-document">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
@ -9,7 +9,7 @@
<script> <script>
promise_test(async t => { promise_test(async t => {
const writer = new NDEFWriter(); const writer = new NDEFReader();
const p1 = writer.write(test_text_data); const p1 = writer.write(test_text_data);
return await new Promise((resolve, reject) => { return await new Promise((resolve, reject) => {
@ -20,7 +20,7 @@ promise_test(async t => {
reject(); reject();
}); });
}); });
}, "Test NDEFWriter.write operation should be suspend when document is not visible"); }, "Test NDEFReader.write operation should be suspended when document is not visible");
</script> </script>

View file

@ -21,104 +21,136 @@ const invalid_signals = [
]; ];
function waitSyntaxErrorPromise(t, scan_options) { function waitSyntaxErrorPromise(t, scan_options) {
const reader = new NDEFReader(); const ndef = new NDEFReader();
return promise_rejects_dom(t, 'SyntaxError', reader.scan(scan_options)); return promise_rejects_dom(t, 'SyntaxError', ndef.scan(scan_options));
} }
nfc_test(async t => { nfc_test(async t => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const promises = []; const promises = [];
invalid_signals.forEach(invalid_signal => { invalid_signals.forEach(invalid_signal => {
promises.push(promise_rejects_js(t, TypeError, promises.push(promise_rejects_js(t, TypeError,
reader.scan({ signal: invalid_signal }))); ndef.scan({ signal: invalid_signal })));
}); });
await Promise.all(promises); await Promise.all(promises);
}, "Test that NDEFReader.scan rejects if signal is not an AbortSignal."); }, "Test that NDEFReader.scan rejects if signal is not an AbortSignal.");
nfc_test(async t => { nfc_test(async t => {
await test_driver.set_permission({ name: 'nfc' }, 'denied', false); await test_driver.set_permission({ name: 'nfc' }, 'denied', false);
const reader = new NDEFReader(); const ndef = new NDEFReader();
await promise_rejects_dom(t, 'NotAllowedError', reader.scan()); await promise_rejects_dom(t, 'NotAllowedError', ndef.scan());
}, "NDEFReader.scan should fail if user permission is not granted."); }, "NDEFReader.scan should fail if user permission is not granted.");
// We do not provide NFC mock here to simulate that there has no available // We do not provide NFC mock here to simulate that there has no available
// implementation for NFC Mojo interface. // implementation for NFC Mojo interface.
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
mockNFC.simulateClosedPipe(); mockNFC.simulateClosedPipe();
const reader = new NDEFReader(); const ndef = new NDEFReader();
await promise_rejects_dom(t, 'NotSupportedError', reader.scan()); await promise_rejects_dom(t, 'NotSupportedError', ndef.scan());
}, "NDEFReader.scan should faild if no implementation for NFC Mojo interface."); }, "NDEFReader.scan should fail if no implementation for NFC Mojo interface.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
mockNFC.setHWStatus(NFCHWStatus.DISABLED); mockNFC.setHWStatus(NFCHWStatus.DISABLED);
const reader = new NDEFReader(); const ndef = new NDEFReader();
await promise_rejects_dom(t, 'NotReadableError', reader.scan()); await promise_rejects_dom(t, 'NotReadableError', ndef.scan());
}, "NDEFReader.scan should fail if NFC HW is disabled."); }, "NDEFReader.scan should fail if NFC HW is disabled.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED); mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED);
const reader = new NDEFReader(); const ndef = new NDEFReader();
await promise_rejects_dom(t, 'NotSupportedError', reader.scan()); await promise_rejects_dom(t, 'NotSupportedError', ndef.scan());
}, "NDEFReader.scan should fail if NFC HW is not supported."); }, "NDEFReader.scan should fail if NFC HW is not supported.");
nfc_test(async () => {
await new Promise((resolve,reject) => {
const iframe = document.createElement('iframe');
iframe.srcdoc = `<script>
window.onmessage = async (message) => {
if (message.data === "Ready") {
try {
const ndef = new NDEFReader();
await ndef.scan();
parent.postMessage("Failure", "*");
} catch (error) {
if (error.name == "NotAllowedError") {
parent.postMessage("Success", "*");
} else {
parent.postMessage("Failure", "*");
}
}
}
};
<\/script>`;
iframe.onload = () => iframe.contentWindow.postMessage('Ready', '*');
document.body.appendChild(iframe);
window.onmessage = message => {
if (message.data == 'Success') {
resolve();
} else if (message.data == 'Failure') {
reject();
}
}
});
}, 'Test that WebNFC API is not accessible from iframe context.');
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef, ["reading", "readingerror"]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
assert_true(event instanceof NDEFReadingEvent); assert_true(event instanceof NDEFReadingEvent);
controller.abort(); controller.abort();
}); });
await reader.scan({signal : controller.signal}); await ndef.scan({signal : controller.signal});
mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)])); mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)]));
await promise; await promise;
}, "Test that nfc watch success if NFC HW is enabled."); }, "Test that nfc watch success if NFC HW is enabled.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef, ["reading", "readingerror"]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
assert_true(event instanceof NDEFReadingEvent); assert_true(event instanceof NDEFReadingEvent);
controller.abort(); controller.abort();
}); });
await reader.scan({signal : controller.signal}); await ndef.scan({signal : controller.signal});
mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)])); mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)]));
await promise; await promise;
}, "Test that NDEFReader.scan matches any ids if NDEFScanOptions.id is undefined."); }, "Test that NDEFReader.scan matches any ids if NDEFScanOptions.id is undefined.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
controller.abort(); controller.abort();
await promise_rejects_dom(t, 'AbortError', reader.scan({signal: controller.signal})); await promise_rejects_dom(t, 'AbortError', ndef.scan({signal: controller.signal}));
}, "Test that NDEFReader.scan rejects if NDEFScanOptions.signal is already aborted."); }, "Test that NDEFReader.scan rejects if NDEFScanOptions.signal is already aborted.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const promise = reader.scan({signal: controller.signal}); const promise = ndef.scan({signal: controller.signal});
controller.abort(); controller.abort();
await promise_rejects_dom(t, 'AbortError', promise); await promise_rejects_dom(t, 'AbortError', promise);
}, "Test that NDEFReader.scan rejects if NDEFScanOptions.signal aborts right after \ }, "Test that NDEFReader.scan rejects if NDEFScanOptions.signal aborts right after \
the scan invocation."); the scan invocation.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef, ["reading", "readingerror"]);
const message = createMessage([createTextRecord(test_text_data)]); const message = createMessage([createTextRecord(test_text_data)]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
assert_true(event instanceof NDEFReadingEvent); assert_true(event instanceof NDEFReadingEvent);
}); });
await reader.scan({signal : controller.signal}); await ndef.scan({signal : controller.signal});
mockNFC.setReadingMessage(message); mockNFC.setReadingMessage(message);
await promise; await promise;
reader.onreading = t.unreached_func("reading event should not be fired."); ndef.onreading = t.unreached_func("reading event should not be fired.");
mockNFC.setReadingMessage(message); mockNFC.setReadingMessage(message);
controller.abort(); controller.abort();
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
@ -127,10 +159,10 @@ nfc_test(async (t, mockNFC) => {
}, "Test that NDEFReader can not get any reading events once the signal aborts."); }, "Test that NDEFReader can not get any reading events once the signal aborts.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef, ["reading", "readingerror"]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
controller.abort(); controller.abort();
assert_true(event instanceof NDEFReadingEvent); assert_true(event instanceof NDEFReadingEvent);
@ -151,7 +183,7 @@ nfc_test(async (t, mockNFC) => {
assert_equals(decoder.decode(event.message.records[0].toRecords()[0].toRecords()[0].data), assert_equals(decoder.decode(event.message.records[0].toRecords()[0].toRecords()[0].data),
test_text_data, 'data has the same content with the original dictionary'); test_text_data, 'data has the same content with the original dictionary');
}); });
await reader.scan({signal : controller.signal}); await ndef.scan({signal : controller.signal});
// An external type record --contains-> a local type record --contains-> a text record. // An external type record --contains-> a local type record --contains-> a text record.
const messageContainText = createMessage([createTextRecord(test_text_data)]); const messageContainText = createMessage([createTextRecord(test_text_data)]);
@ -164,10 +196,10 @@ nfc_test(async (t, mockNFC) => {
}, "NDEFRecord.toRecords returns its embedded records correctly."); }, "NDEFRecord.toRecords returns its embedded records correctly.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef, ["reading", "readingerror"]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
controller.abort(); controller.abort();
assert_true(event instanceof NDEFReadingEvent); assert_true(event instanceof NDEFReadingEvent);
@ -203,7 +235,7 @@ nfc_test(async (t, mockNFC) => {
assert_array_equals(embedded_record_types.sort(), ['text', 'url'], assert_array_equals(embedded_record_types.sort(), ['text', 'url'],
'smart-poster record\'s contained record types'); 'smart-poster record\'s contained record types');
}); });
await reader.scan({signal : controller.signal}); await ndef.scan({signal : controller.signal});
// A smart-poster record contains a uri record, text record. // A smart-poster record contains a uri record, text record.
const uri_record = createUrlRecord(test_url_data); const uri_record = createUrlRecord(test_url_data);
@ -218,17 +250,17 @@ nfc_test(async (t, mockNFC) => {
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const promises = []; const promises = [];
const reader1 = new NDEFReader(); const ndef1 = new NDEFReader();
const readerWatcher1 = new EventWatcher(t, reader1, ["reading", "readingerror"]); const ndefWatcher1 = new EventWatcher(t, ndef1, ["reading", "readingerror"]);
const promise1 = readerWatcher1.wait_for("readingerror"); const promise1 = ndefWatcher1.wait_for("readingerror");
promises.push(promise1); promises.push(promise1);
await reader1.scan(); await ndef1.scan();
const reader2 = new NDEFReader(); const ndef2 = new NDEFReader();
const readerWatcher2 = new EventWatcher(t, reader2, ["reading", "readingerror"]); const ndefWatcher2 = new EventWatcher(t, ndef2, ["reading", "readingerror"]);
const promise2 = readerWatcher2.wait_for("readingerror"); const promise2 = ndefWatcher2.wait_for("readingerror");
promises.push(promise2); promises.push(promise2);
await reader2.scan(); await ndef2.scan();
mockNFC.simulateNonNDEFTagDiscovered(); mockNFC.simulateNonNDEFTagDiscovered();
await Promise.all(promises); await Promise.all(promises);
@ -236,15 +268,15 @@ nfc_test(async (t, mockNFC) => {
expose NDEF technology."); expose NDEF technology.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef, ["reading", "readingerror"]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
assert_equals(event.serialNumber, fake_tag_serial_number); assert_equals(event.serialNumber, fake_tag_serial_number);
assert_equals(event.message.records.length, 0); assert_equals(event.message.records.length, 0);
controller.abort(); controller.abort();
}); });
await reader.scan({signal : controller.signal}); await ndef.scan({signal : controller.signal});
mockNFC.setReadingMessage({ records: [] }); mockNFC.setReadingMessage({ records: [] });
await promise; await promise;
@ -252,7 +284,7 @@ nfc_test(async (t, mockNFC) => {
with empty records array for NDEFMessage."); with empty records array for NDEFMessage.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const message = createMessage([createTextRecord(test_text_data), const message = createMessage([createTextRecord(test_text_data),
createMimeRecordFromJson(test_json_data), createMimeRecordFromJson(test_json_data),
@ -262,31 +294,31 @@ nfc_test(async (t, mockNFC) => {
createUrlRecord(test_url_data, true), createUrlRecord(test_url_data, true),
createRecord('w3.org:xyz', test_buffer_data)], createRecord('w3.org:xyz', test_buffer_data)],
test_message_origin); test_message_origin);
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef, ["reading", "readingerror"]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
assert_equals(event.serialNumber, fake_tag_serial_number); assert_equals(event.serialNumber, fake_tag_serial_number);
assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message)); assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message));
controller.abort(); controller.abort();
}); });
await reader.scan({signal : controller.signal}); await ndef.scan({signal : controller.signal});
mockNFC.setReadingMessage(message); mockNFC.setReadingMessage(message);
await promise; await promise;
}, "Test that reading message with multiple records should succeed."); }, "Test that reading message with multiple records should succeed.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const promise1 = reader.scan(); const promise1 = ndef.scan();
const promise2 = promise_rejects_dom(t, 'InvalidStateError', reader.scan()); const promise2 = promise_rejects_dom(t, 'InvalidStateError', ndef.scan());
await promise1; await promise1;
await promise2; await promise2;
}, "Test that NDEFReader.scan rejects if there is already an ongoing scan."); }, "Test that NDEFReader.scan rejects if there is already an ongoing scan.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
await reader.scan({signal : controller.signal}); await ndef.scan({signal : controller.signal});
controller.abort(); controller.abort();
await reader.scan(); await ndef.scan();
}, "Test that NDEFReader.scan can be started after the previous scan is aborted."); }, "Test that NDEFReader.scan can be started after the previous scan is aborted.");
</script> </script>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset=utf-8> <meta charset=utf-8>
<title>NDEFWriter.scan with an focused iframe</title> <title>NDEFReader.scan with an focused iframe</title>
<link rel="help" href="https://w3c.github.io/web-nfc/"/> <link rel="help" href="https://w3c.github.io/web-nfc/"/>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
@ -9,15 +9,15 @@
<script> <script>
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef, ["reading", "readingerror"]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
assert_true(event instanceof NDEFReadingEvent); assert_true(event instanceof NDEFReadingEvent);
controller.abort(); controller.abort();
}); });
await reader.scan({ signal: controller.signal }); await ndef.scan({ signal: controller.signal });
const iframe = document.createElement('iframe'); const iframe = document.createElement('iframe');
iframe.src = 'resources/support-iframe.html'; iframe.src = 'resources/support-iframe.html';
@ -37,7 +37,7 @@ nfc_test(async (t, mockNFC) => {
// Remove iframe from main document. // Remove iframe from main document.
iframe.parentNode.removeChild(iframe); iframe.parentNode.removeChild(iframe);
}, 'Test that NDEFWriter.scan is not suspended if iframe gains focus.'); }, 'Test that NDEFReader.scan is not suspended if iframe gains focus.');
</script> </script>
</body> </body>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<meta charset=utf-8> <meta charset=utf-8>
<title>Web NFC: NDEFWriter.write Tests</title> <title>Web NFC: NDEFReader.write Tests</title>
<link rel="author" title="Intel" href="http://www.intel.com"/> <link rel="author" title="Intel" href="http://www.intel.com"/>
<link rel="help" href="https://w3c.github.io/web-nfc/"/> <link rel="help" href="https://w3c.github.io/web-nfc/"/>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
@ -124,21 +124,21 @@ const invalid_signals = [
]; ];
nfc_test(async t => { nfc_test(async t => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
const promises = []; const promises = [];
invalid_type_messages.forEach(message => { invalid_type_messages.forEach(message => {
promises.push( promises.push(
promise_rejects_js(t, TypeError, writer.write(message))); promise_rejects_js(t, TypeError, ndef.write(message)));
}); });
await Promise.all(promises); await Promise.all(promises);
}, "Test that promise is rejected with TypeError if NDEFMessageSource is invalid."); }, "Test that promise is rejected with TypeError if NDEFMessageSource is invalid.");
nfc_test(async t => { nfc_test(async t => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
const promises = []; const promises = [];
invalid_syntax_messages.forEach(message => { invalid_syntax_messages.forEach(message => {
promises.push( promises.push(
promise_rejects_dom(t, 'SyntaxError', writer.write(message))); promise_rejects_dom(t, 'SyntaxError', ndef.write(message)));
}); });
await Promise.all(promises); await Promise.all(promises);
}, "Test that promise is rejected with SyntaxError if NDEFMessageSource contains\ }, "Test that promise is rejected with SyntaxError if NDEFMessageSource contains\
@ -146,25 +146,25 @@ nfc_test(async t => {
nfc_test(async t => { nfc_test(async t => {
await test_driver.set_permission({ name: 'nfc' }, 'denied', false); await test_driver.set_permission({ name: 'nfc' }, 'denied', false);
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await promise_rejects_dom(t, 'NotAllowedError', writer.write(test_text_data)); await promise_rejects_dom(t, 'NotAllowedError', ndef.write(test_text_data));
}, 'NDEFWriter.write should fail if user permission is not granted.'); }, 'NDEFReader.write should fail if user permission is not granted.');
// We do not provide NFC mock here to simulate that there has no available // We do not provide NFC mock here to simulate that there has no available
// implementation for NFC Mojo interface. // implementation for NFC Mojo interface.
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
mockNFC.simulateClosedPipe(); mockNFC.simulateClosedPipe();
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await promise_rejects_dom(t, 'NotSupportedError', writer.write(test_text_data)); await promise_rejects_dom(t, 'NotSupportedError', ndef.write(test_text_data));
}, 'NDEFWriter.write should fail if no implementation for NFC Mojo interface is available.'); }, 'NDEFReader.write should fail if no implementation for NFC Mojo interface is available.');
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
//Make sure push is pending //Make sure push is pending
mockNFC.setPendingPushCompleted(false); mockNFC.setPendingPushCompleted(false);
const p = writer.write(test_text_data, { signal: controller.signal }); const p = ndef.write(test_text_data, { signal: controller.signal });
const rejected = promise_rejects_dom(t, 'AbortError', p); const rejected = promise_rejects_dom(t, 'AbortError', p);
let callback_called = false; let callback_called = false;
await new Promise(resolve => { await new Promise(resolve => {
@ -176,76 +176,71 @@ nfc_test(async (t, mockNFC) => {
}); });
await rejected; await rejected;
assert_true(callback_called, 'timeout should have caused the abort'); assert_true(callback_called, 'timeout should have caused the abort');
}, "NDEFWriter.write should fail if abort write request before write happends."); }, "NDEFReader.write should fail if abort write request before write happends.");
nfc_test(async t => { nfc_test(async t => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
assert_false(controller.signal.aborted); assert_false(controller.signal.aborted);
controller.abort(); controller.abort();
assert_true(controller.signal.aborted); assert_true(controller.signal.aborted);
await promise_rejects_dom(t, 'AbortError', await promise_rejects_dom(t, 'AbortError',
writer.write(test_text_data, { signal: controller.signal })); ndef.write(test_text_data, { signal: controller.signal }));
}, "NDEFWriter.write should fail if signal's aborted flag is set."); }, "NDEFReader.write should fail if signal's aborted flag is set.");
nfc_test(async t => { nfc_test(async t => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
const promises = []; const promises = [];
invalid_signals.forEach(invalid_signal => { invalid_signals.forEach(invalid_signal => {
promises.push(promise_rejects_js(t, TypeError, promises.push(promise_rejects_js(t, TypeError,
writer.write(test_text_data, { signal: invalid_signal }))); ndef.write(test_text_data, { signal: invalid_signal })));
}); });
await Promise.all(promises); await Promise.all(promises);
}, "NDEFWriter.write should fail if signal is not an AbortSignal."); }, "NDEFReader.write should fail if signal is not an AbortSignal.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer1 = new NDEFWriter(); const ndef1 = new NDEFReader();
const writer2 = new NDEFWriter(); const ndef2 = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const p1 = writer1.write(test_text_data, { signal: controller.signal }); const p1 = ndef1.write(test_text_data, { signal: controller.signal });
// Even though write request is grantable, // Even though write request is grantable,
// this abort should be processed synchronously. // this abort should be processed synchronously.
controller.abort(); controller.abort();
await promise_rejects_dom(t, 'AbortError', p1); await promise_rejects_dom(t, 'AbortError', p1);
await writer2.write(test_text_data); await ndef2.write(test_text_data);
assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage()); assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
}, "Synchronously signaled abort."); }, "Synchronously signaled abort.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
mockNFC.setHWStatus(NFCHWStatus.DISABLED); mockNFC.setHWStatus(NFCHWStatus.DISABLED);
await promise_rejects_dom(t, 'NotReadableError', writer.write(test_text_data)); await promise_rejects_dom(t, 'NotReadableError', ndef.write(test_text_data));
}, "NDEFWriter.write should fail when NFC HW is disabled."); }, "NDEFReader.write should fail when NFC HW is disabled.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED); mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED);
await promise_rejects_dom(t, 'NotSupportedError', writer.write(test_text_data)); await promise_rejects_dom(t, 'NotSupportedError', ndef.write(test_text_data));
}, "NDEFWriter.write should fail when NFC HW is not supported."); }, "NDEFReader.write should fail when NFC HW is not supported.");
nfc_test(async () => { nfc_test(async () => {
await new Promise((resolve,reject) => { await new Promise((resolve,reject) => {
const iframe = document.createElement('iframe'); const iframe = document.createElement('iframe');
iframe.srcdoc = `<script> iframe.srcdoc = `<script>
window.onmessage = message => { window.onmessage = async (message) => {
if (message.data === "Ready") { if (message.data === "Ready") {
const onSuccess = () => { try {
const ndef = new NDEFReader();
await ndef.write("Test");
parent.postMessage("Failure", "*"); parent.postMessage("Failure", "*");
}; } catch (error) {
const onError = error => {
if (error.name == "NotAllowedError") { if (error.name == "NotAllowedError") {
parent.postMessage("Success", "*"); parent.postMessage("Success", "*");
} else { } else {
parent.postMessage("Failure", "*"); parent.postMessage("Failure", "*");
} }
};
try {
const writer = new NDEFWriter();
writer.write("Test").then(onSuccess, onError);
} catch(e) {
parent.postMessage("Failure", "*");
} }
} }
}; };
@ -263,12 +258,12 @@ nfc_test(async () => {
}, 'Test that WebNFC API is not accessible from iframe context.'); }, 'Test that WebNFC API is not accessible from iframe context.');
nfc_test(async () => { nfc_test(async () => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(test_text_data); await ndef.write(test_text_data);
}, 'NDEFWriter.write should succeed when NFC HW is enabled'); }, 'NDEFReader.write should succeed when NFC HW is enabled');
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
const message = createMessage([createTextRecord(test_text_data), const message = createMessage([createTextRecord(test_text_data),
createMimeRecordFromJson(test_json_data), createMimeRecordFromJson(test_json_data),
createMimeRecord(test_buffer_data), createMimeRecord(test_buffer_data),
@ -277,9 +272,9 @@ nfc_test(async (t, mockNFC) => {
createUrlRecord(test_url_data, true), createUrlRecord(test_url_data, true),
createRecord('w3.org:xyz', test_buffer_data)], createRecord('w3.org:xyz', test_buffer_data)],
test_message_origin); test_message_origin);
await writer.write(message); await ndef.write(message);
assertNDEFMessagesEqual(message, mockNFC.pushedMessage()); assertNDEFMessagesEqual(message, mockNFC.pushedMessage());
}, "NDEFWriter.write NDEFMessage containing text, mime, unknown, url, absolute-url \ }, "NDEFReader.write NDEFMessage containing text, mime, unknown, url, absolute-url \
and external records with default NDEFWriteOptions."); and external records with default NDEFWriteOptions.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
@ -291,8 +286,8 @@ nfc_test(async (t, mockNFC) => {
// Prepare an external type record that uses |messageContainLocal| as its payload. // Prepare an external type record that uses |messageContainLocal| as its payload.
const message = createMessage([createRecord('example.com:containsLocalRecord', messageContainLocal)]); const message = createMessage([createRecord('example.com:containsLocalRecord', messageContainLocal)]);
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(message); await ndef.write(message);
const pushed_message = mockNFC.pushedMessage(); const pushed_message = mockNFC.pushedMessage();
// The mojom message received by mock nfc contains only the external type record. // The mojom message received by mock nfc contains only the external type record.
@ -311,7 +306,7 @@ nfc_test(async (t, mockNFC) => {
assert_array_equals(pushed_message.data[0].payloadMessage.data[0].data, new Uint8Array(0), assert_array_equals(pushed_message.data[0].payloadMessage.data[0].data, new Uint8Array(0),
'payloadMessage is used instead'); 'payloadMessage is used instead');
assertNDEFMessagesEqual(messageContainText, pushed_message.data[0].payloadMessage.data[0].payloadMessage); assertNDEFMessagesEqual(messageContainText, pushed_message.data[0].payloadMessage.data[0].payloadMessage);
}, "NDEFWriter.write NDEFMessage containing embedded records."); }, "NDEFReader.write NDEFMessage containing embedded records.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
// A smart-poster record contains a uri record, text record. // A smart-poster record contains a uri record, text record.
@ -321,8 +316,8 @@ nfc_test(async (t, mockNFC) => {
const message = createMessage([createRecord( const message = createMessage([createRecord(
'smart-poster', payload_message, "dummy_record_id")]); 'smart-poster', payload_message, "dummy_record_id")]);
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(message); await ndef.write(message);
const pushed_message = mockNFC.pushedMessage(); const pushed_message = mockNFC.pushedMessage();
// The mojom message received by mock nfc contains only the smart-poster record. // The mojom message received by mock nfc contains only the smart-poster record.
@ -350,53 +345,53 @@ nfc_test(async (t, mockNFC) => {
} }
assert_array_equals(embedded_record_types.sort(), ['text', 'url'], assert_array_equals(embedded_record_types.sort(), ['text', 'url'],
'smart-poster record\'s contained record types'); 'smart-poster record\'s contained record types');
}, "NDEFWriter.write NDEFMessage containing smart-poster record."); }, "NDEFReader.write NDEFMessage containing smart-poster record.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(test_text_data); await ndef.write(test_text_data);
assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage()); assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
}, "Test that NDEFWriter.write succeeds when message is DOMString."); }, "Test that NDEFReader.write succeeds when message is DOMString.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(test_buffer_data); await ndef.write(test_buffer_data);
assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage()); assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage());
}, "Test that NDEFWriter.write succeeds when message is ArrayBuffer."); }, "Test that NDEFReader.write succeeds when message is ArrayBuffer.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
let buffer_view = new Uint8Array(test_buffer_data, 2, 5); let buffer_view = new Uint8Array(test_buffer_data, 2, 5);
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(buffer_view); await ndef.write(buffer_view);
assertNDEFMessagesEqual(buffer_view, mockNFC.pushedMessage()); assertNDEFMessagesEqual(buffer_view, mockNFC.pushedMessage());
}, "Test that NDEFWriter.write succeeds when message is ArrayBufferView."); }, "Test that NDEFReader.write succeeds when message is ArrayBufferView.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(createMessage([createRecord('empty')])); await ndef.write(createMessage([createRecord('empty')]));
const receivedMessage = mockNFC.pushedMessage(); const receivedMessage = mockNFC.pushedMessage();
assert_equals(receivedMessage.data.length, 1); assert_equals(receivedMessage.data.length, 1);
assert_equals(receivedMessage.data[0].recordType, 'empty', 'recordType'); assert_equals(receivedMessage.data[0].recordType, 'empty', 'recordType');
}, "NDEFWriter.write with 'empty' record should succeed."); }, "NDEFReader.write with 'empty' record should succeed.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(test_text_data); await ndef.write(test_text_data);
assertNDEFWriteOptionsEqual({overwrite: true}, mockNFC.writeOptions()); assertNDEFWriteOptionsEqual({overwrite: true}, mockNFC.writeOptions());
}, "Check that default NDEFWriteOptions values are correctly set."); }, "Check that default NDEFWriteOptions values are correctly set.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(test_text_data, {overwrite: false}); await ndef.write(test_text_data, {overwrite: false});
assertNDEFWriteOptionsEqual({overwrite: false}, mockNFC.writeOptions()); assertNDEFWriteOptionsEqual({overwrite: false}, mockNFC.writeOptions());
}, "Check that provided NDEFWriteOptions values are correctly converted."); }, "Check that provided NDEFWriteOptions values are correctly converted.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer1 = new NDEFWriter(); const ndef1 = new NDEFReader();
const writer2 = new NDEFWriter(); const ndef2 = new NDEFReader();
const p1 = writer1.write(test_text_data, {overwrite: false}); const p1 = ndef1.write(test_text_data, {overwrite: false});
const p2 = writer2.write(test_url_data, {overwrite: true}); const p2 = ndef2.write(test_url_data, {overwrite: true});
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
// Make first push pending // Make first push pending
@ -414,11 +409,11 @@ nfc_test(async (t, mockNFC) => {
resolve(); resolve();
}); });
}); });
}, "NDEFWriter.write should replace all previously configured write operations."); }, "NDEFReader.write should replace all previously configured write operations.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write({ records: [{ recordType: "mime", data: test_buffer_data }] }); await ndef.write({ records: [{ recordType: "mime", data: test_buffer_data }] });
assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage()); assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage());
}, "Test that mediaType should be set to 'application/octet-stream' if \ }, "Test that mediaType should be set to 'application/octet-stream' if \
NDEFRecordInit.record's recordType is 'mime' and NDEFRecordInit.record's \ NDEFRecordInit.record's recordType is 'mime' and NDEFRecordInit.record's \
@ -428,46 +423,46 @@ nfc_test(async (t, mockNFC) => {
// Make sure the push will be pending in the mock. // Make sure the push will be pending in the mock.
mockNFC.setPendingPushCompleted(false); mockNFC.setPendingPushCompleted(false);
const writer = new NDEFWriter(); const ndef1 = new NDEFReader();
const promise = writer.write(test_text_data); const promise = ndef1.write(test_text_data);
// Just to make sure the write() request has already reached to the mock. // Just to make sure the write() request has already reached to the mock.
const reader = new NDEFReader(); const ndef2 = new NDEFReader();
await reader.scan(); await ndef2.scan();
mockNFC.simulateNonNDEFTagDiscovered(); mockNFC.simulateNonNDEFTagDiscovered();
await promise_rejects_dom(t, 'NotSupportedError', promise); await promise_rejects_dom(t, 'NotSupportedError', promise);
}, "NDEFWriter.write should fail when the NFC device coming up does not expose \ }, "NDEFReader.write should fail when the NFC device coming up does not expose \
NDEF technology."); NDEF technology.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(test_text_data, {overwrite: false}); await ndef.write(test_text_data, {overwrite: false});
assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage()); assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
}, "NDEFWriter.write should succeed to write data to an unformatted NFC device \ }, "NDEFReader.write should succeed to write data to an unformatted NFC device \
when the NDEFWriteOptions.overwrite is false."); when the NDEFWriteOptions.overwrite is false.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
await writer.write(test_buffer_data); await ndef.write(test_buffer_data);
assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage()); assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage());
await writer.write(test_text_data, {overwrite: true}); await ndef.write(test_text_data, {overwrite: true});
assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage()); assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
}, "NDEFWriter.write should succeed to overwrite the existing data \ }, "NDEFReader.write should succeed to overwrite the existing data \
when the NDEFWriteOptions.overwrite is true."); when the NDEFWriteOptions.overwrite is true.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
const p = writer.write(test_text_data, {overwrite: false}); const p = ndef.write(test_text_data, {overwrite: false});
mockNFC.setIsFormattedTag(true); mockNFC.setIsFormattedTag(true);
await promise_rejects_dom(t, 'NotAllowedError', p); await promise_rejects_dom(t, 'NotAllowedError', p);
}, "NDEFWriter.write should fail when there are NDEF records on the NFC device \ }, "NDEFReader.write should fail when there are NDEF records on the NFC device \
and NDEFWriteOptions.overwrite is false."); and NDEFWriteOptions.overwrite is false.");
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const writer = new NDEFWriter(); const ndef = new NDEFReader();
mockNFC.simulateDataTransferFails(); mockNFC.simulateDataTransferFails();
await promise_rejects_dom(t, 'NetworkError', writer.write(test_text_data)); await promise_rejects_dom(t, 'NetworkError', ndef.write(test_text_data));
}, "NDEFWriter.write should fail with NetworkError when NFC data transfer fails."); }, "NDEFReader.write should fail with NetworkError when NFC data transfer fails.");
</script> </script>

View file

@ -15,11 +15,6 @@
"use strict"; "use strict";
test(t => {
assert_false(isSecureContext);
assert_false('NDEFWriter' in window);
}, 'NDEFWriter requires a secure context');
test(t => { test(t => {
assert_false(isSecureContext); assert_false(isSecureContext);
assert_false('NDEFReader' in window); assert_false('NDEFReader' in window);

View file

@ -150,7 +150,7 @@ function createUrlRecord(url, isAbsUrl) {
} }
// Compares NDEFMessageSource that was provided to the API // Compares NDEFMessageSource that was provided to the API
// (e.g. NDEFWriter.write), and NDEFMessage that was received by the // (e.g. NDEFReader.write), and NDEFMessage that was received by the
// mock NFC service. // mock NFC service.
function assertNDEFMessagesEqual(providedMessage, receivedMessage) { function assertNDEFMessagesEqual(providedMessage, receivedMessage) {
// If simple data type is passed, e.g. String or ArrayBuffer or // If simple data type is passed, e.g. String or ArrayBuffer or
@ -174,7 +174,7 @@ function assertNDEFMessagesEqual(providedMessage, receivedMessage) {
} }
// Used to compare two NDEFMessage, one that is received from // Used to compare two NDEFMessage, one that is received from
// NDEFWriter.onreading() EventHandler and another that is provided to mock NFC // NDEFReader.onreading() EventHandler and another that is provided to mock NFC
// service. // service.
function assertWebNDEFMessagesEqual(message, expectedMessage) { function assertWebNDEFMessagesEqual(message, expectedMessage) {
assert_equals(message.records.length, expectedMessage.records.length); assert_equals(message.records.length, expectedMessage.records.length);
@ -195,22 +195,22 @@ function assertWebNDEFMessagesEqual(message, expectedMessage) {
function testMultiScanOptions(message, scanOptions, unmatchedScanOptions, desc) { function testMultiScanOptions(message, scanOptions, unmatchedScanOptions, desc) {
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader1 = new NDEFReader(); const ndef1 = new NDEFReader();
const reader2 = new NDEFReader(); const ndef2 = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
// Reading from unmatched reader will not be triggered // Reading from unmatched ndef will not be triggered
reader1.onreading = t.unreached_func("reading event should not be fired."); ndef1.onreading = t.unreached_func("reading event should not be fired.");
unmatchedScanOptions.signal = controller.signal; unmatchedScanOptions.signal = controller.signal;
await reader1.scan(unmatchedScanOptions); await ndef1.scan(unmatchedScanOptions);
const readerWatcher = new EventWatcher(t, reader2, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef2, ["reading", "readingerror"]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
controller.abort(); controller.abort();
assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message)); assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message));
}); });
scanOptions.signal = controller.signal; scanOptions.signal = controller.signal;
await reader2.scan(scanOptions); await ndef2.scan(scanOptions);
mockNFC.setReadingMessage(message); mockNFC.setReadingMessage(message);
await promise; await promise;
@ -219,15 +219,15 @@ function testMultiScanOptions(message, scanOptions, unmatchedScanOptions, desc)
function testMultiMessages(message, scanOptions, unmatchedMessage, desc) { function testMultiMessages(message, scanOptions, unmatchedMessage, desc) {
nfc_test(async (t, mockNFC) => { nfc_test(async (t, mockNFC) => {
const reader = new NDEFReader(); const ndef = new NDEFReader();
const controller = new AbortController(); const controller = new AbortController();
const readerWatcher = new EventWatcher(t, reader, ["reading", "readingerror"]); const ndefWatcher = new EventWatcher(t, ndef, ["reading", "readingerror"]);
const promise = readerWatcher.wait_for("reading").then(event => { const promise = ndefWatcher.wait_for("reading").then(event => {
controller.abort(); controller.abort();
assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message)); assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message));
}); });
scanOptions.signal = controller.signal; scanOptions.signal = controller.signal;
await reader.scan(scanOptions); await ndef.scan(scanOptions);
// Unmatched message will not be read // Unmatched message will not be read
mockNFC.setReadingMessage(unmatchedMessage); mockNFC.setReadingMessage(unmatchedMessage);