Auto merge of #24705 - servo-wpt-sync:wpt_update_11-11-2019, r=jdm
Sync WPT with upstream (11-11-2019) Automated downstream sync of changes from upstream as of 11-11-2019. [no-wpt-sync] r? @servo-wpt-sync
|
@ -7,7 +7,7 @@
|
|||
expected: FAIL
|
||||
|
||||
[Opening a blob URL in a new window immediately before revoking it works.]
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
|
||||
[Opening a blob URL in a noopener about:blank window immediately before revoking it works.]
|
||||
expected: FAIL
|
||||
|
|
|
@ -633571,7 +633571,7 @@
|
|||
"support"
|
||||
],
|
||||
"docs/assets/createpr.png": [
|
||||
"7b232a86d0f6257c451828abbb4ac41b48d2ba85",
|
||||
"4403a95c146c1aaba697a5198852548d948a5461",
|
||||
"support"
|
||||
],
|
||||
"docs/assets/files-changed.png": [
|
||||
|
@ -633599,11 +633599,11 @@
|
|||
"support"
|
||||
],
|
||||
"docs/assets/pullrequestbtn.png": [
|
||||
"0fb15da15387ed4bf32a14e01536c7d2b4f81030",
|
||||
"07d9c6a2e94122c94ae4d3802e09d9bbaea3296d",
|
||||
"support"
|
||||
],
|
||||
"docs/assets/reftest-tutorial-test-screenshot.png": [
|
||||
"611fffbd220b8a8ab56216786dd3f85e2934906b",
|
||||
"8d882822e1274124249be51cc2af26be0c23f340",
|
||||
"support"
|
||||
],
|
||||
"docs/assets/reftest_graph_example.svg": [
|
||||
|
@ -633611,15 +633611,15 @@
|
|||
"support"
|
||||
],
|
||||
"docs/assets/testharness-tutorial-test-screenshot-1.png": [
|
||||
"5195ba25ae647acdc1dc9cd3877d1204abab95df",
|
||||
"c469e94a553c2f780dfd297bf127990674b142cc",
|
||||
"support"
|
||||
],
|
||||
"docs/assets/testharness-tutorial-test-screenshot-2.png": [
|
||||
"0010a57173121330bae8df3c3f851db10cffcb67",
|
||||
"612eda54487bd8e8808e8c8a3e87d0f221e55d00",
|
||||
"support"
|
||||
],
|
||||
"docs/assets/web-platform.png": [
|
||||
"2b14c5ef60dd064b8751151f5b778019fe2431bf",
|
||||
"8547f491835ea2b11c69ff66f834ebc747af7fab",
|
||||
"support"
|
||||
],
|
||||
"docs/conf.py": [
|
||||
|
@ -635095,7 +635095,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"dom/nodes/aria-element-reflection.tentative.html": [
|
||||
"7c8e690a28bbcaa1391878300f143aa1e584fe5e",
|
||||
"1ee896ea1be0cae1613a880fbdea547f1894839f",
|
||||
"testharness"
|
||||
],
|
||||
"dom/nodes/attributes.html": [
|
||||
|
@ -693427,7 +693427,7 @@
|
|||
"support"
|
||||
],
|
||||
"resources/chromium/nfc-mock.js": [
|
||||
"ce22a9c2cfe9c0ae460d6e1eff4aaa99fe6b24e3",
|
||||
"f5666c18f5c57fdc8ee74c1572824f34e346d5ed",
|
||||
"support"
|
||||
],
|
||||
"resources/chromium/sensor.mojom.js": [
|
||||
|
@ -716191,7 +716191,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"web-nfc/NDEFMessage_constructor.https.html": [
|
||||
"ce212136023058dd6597ff925fd68a73e5d2ab95",
|
||||
"f32f179b95798fe590a518603eff35265cd51494",
|
||||
"testharness"
|
||||
],
|
||||
"web-nfc/NDEFReader-document-hidden-manual.https.html": [
|
||||
|
@ -716199,11 +716199,11 @@
|
|||
"manual"
|
||||
],
|
||||
"web-nfc/NDEFReader_options.https.html": [
|
||||
"b1452c0240d176316341a0ab6857433fbc99a5b5",
|
||||
"81b051e28f4723624846d25aa49d16525c81d1a9",
|
||||
"testharness"
|
||||
],
|
||||
"web-nfc/NDEFReader_scan.https.html": [
|
||||
"a26a548c6392d8116e8c188d6dbbe03b4660d87f",
|
||||
"7c78a1c6008429dc348efa2c02c83c47e0a565a4",
|
||||
"testharness"
|
||||
],
|
||||
"web-nfc/NDEFReader_scan_iframe.https.html": [
|
||||
|
@ -716215,7 +716215,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"web-nfc/NDEFRecord_constructor.https.html": [
|
||||
"6028e970b879b1f65dd48d64525995114b5e82e9",
|
||||
"79ce8a076eda26a7657df6eba8b781f711a94abb",
|
||||
"testharness"
|
||||
],
|
||||
"web-nfc/NDEFWriter-document-hidden-manual.https.html": [
|
||||
|
@ -716223,7 +716223,7 @@
|
|||
"manual"
|
||||
],
|
||||
"web-nfc/NDEFWriter_push.https.html": [
|
||||
"f8b461c42d5ee0265f1301458b8e92a812e650da",
|
||||
"57c619f73f84a90de32d33957e4757eca1c8e464",
|
||||
"testharness"
|
||||
],
|
||||
"web-nfc/README.md": [
|
||||
|
@ -716231,7 +716231,7 @@
|
|||
"support"
|
||||
],
|
||||
"web-nfc/idlharness.https.window.js": [
|
||||
"f59ad9b512ed5548b22ff43b84f8404258e9e6c9",
|
||||
"74ffc21b2204ea894dcea32a4aface9bc69739c1",
|
||||
"testharness"
|
||||
],
|
||||
"web-nfc/nfc_insecure_context.html": [
|
||||
|
@ -716239,7 +716239,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"web-nfc/resources/nfc-helpers.js": [
|
||||
"bdd8290d9eb7f9fcae1e46820a64fc6cef8617e5",
|
||||
"f90a050c4cad93e31937bca946f3c250bb64723c",
|
||||
"support"
|
||||
],
|
||||
"web-nfc/resources/support-iframe.html": [
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[perspective-interpolation.html]
|
||||
expected: ERROR
|
||||
expected: CRASH
|
||||
[ perspective interpolation]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[matchMedia-display-none-iframe.html]
|
||||
expected: ERROR
|
|
@ -0,0 +1,2 @@
|
|||
[contenttype_txt.html]
|
||||
expected: CRASH
|
|
@ -312,21 +312,18 @@
|
|||
[<iframe>: separate response Content-Type: */* text/html]
|
||||
expected: FAIL
|
||||
|
||||
[<iframe>: combined response Content-Type: */* text/html]
|
||||
expected: FAIL
|
||||
|
||||
[<iframe>: separate response Content-Type: text/html;x=" text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[<iframe>: separate response Content-Type: text/html;" text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[<iframe>: separate response Content-Type: text/html */*;charset=gbk]
|
||||
expected: FAIL
|
||||
|
||||
[<iframe>: separate response Content-Type: text/plain */*]
|
||||
expected: FAIL
|
||||
|
||||
[<iframe>: separate response Content-Type: text/html;" \\" text/plain]
|
||||
expected: FAIL
|
||||
|
||||
[<iframe>: separate response Content-Type: text/html */*]
|
||||
expected: FAIL
|
||||
|
||||
[<iframe>: separate response Content-Type: text/plain */*;charset=gbk]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -53,9 +53,6 @@
|
|||
[combined text/javascript ]
|
||||
expected: FAIL
|
||||
|
||||
[separate text/javascript x/x]
|
||||
expected: FAIL
|
||||
|
||||
[separate text/javascript;charset=windows-1252 text/javascript]
|
||||
[separate text/javascript;charset=windows-1252 error text/javascript]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
[X-Content-Type-Options%3A%20nosniff%0C]
|
||||
expected: FAIL
|
||||
|
||||
[X-Content-Type-Options%3A%20%2Cnosniff]
|
||||
[X-Content-Type-Options%3A%20no%0D%0AX-Content-Type-Options%3A%20nosniff]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[traverse_the_history_5.html]
|
||||
[traverse_the_history_3.html]
|
||||
[Multiple history traversals, last would be aborted]
|
||||
expected: FAIL
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
[traverse_the_history_4.html]
|
||||
[Multiple history traversals, last would be aborted]
|
||||
expected: FAIL
|
||||
|
|
@ -1,32 +1,48 @@
|
|||
[open-features-non-integer-width.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[HTML: window.open `features`: non-integer values for feature `width`]
|
||||
expected: FAIL
|
||||
|
||||
[features "width=405^4" should set "width=405"]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=405.5" should set "width=405"]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=405e1" should set "width=405"]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=405 " should set "width=405"]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=405.32" should set "width=405"]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=405LLl" should set "width=405"]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=405*3" should set "width=405"]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=405e-1" should set "width=405"]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=405/5" should set "width=405"]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[top=0,left=0: absence of feature "width" should be treated same as "width=0"]
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=_404" should NOT set "width=404"]
|
||||
expected: TIMEOUT
|
||||
|
||||
[top=0,left=0,height=401,: absence of feature "width" should be treated same as "width=0"]
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=/404" should NOT set "width=404"]
|
||||
expected: TIMEOUT
|
||||
|
||||
[features "width=L404" should NOT set "width=404"]
|
||||
expected: TIMEOUT
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[iframe_sandbox_popups_escaping-1.html]
|
||||
type: testharness
|
||||
expected: CRASH
|
||||
expected: TIMEOUT
|
||||
[Check that popups from a sandboxed iframe escape the sandbox if\n allow-popups-to-escape-sandbox is used]
|
||||
expected: TIMEOUT
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[iframe_sandbox_popups_nonescaping-1.html]
|
||||
type: testharness
|
||||
expected: CRASH
|
||||
expected: TIMEOUT
|
||||
[Check that popups from a sandboxed iframe do not escape the sandbox]
|
||||
expected: NOTRUN
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
[form-submission-algorithm.html]
|
||||
expected: TIMEOUT
|
||||
[If form's firing submission events is true, then return; 'submit' event]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -12,9 +11,6 @@
|
|||
[firing an event named submit; clicking a submit button]
|
||||
expected: FAIL
|
||||
|
||||
[Cannot navigate (after constructing the entry list)]
|
||||
expected: TIMEOUT
|
||||
|
||||
[firing an event named submit; form.requestSubmit(null)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[button-submit-children.html]
|
||||
expected: TIMEOUT
|
||||
[This test will pass if a form navigation successfully occurs when clicking a child element of a <button type=submit> element with a onclick event handler which prevents the default form submission and manually calls form.submit() instead.]
|
||||
expected: TIMEOUT
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
[realtimeanalyser-fft-scaling.html]
|
||||
expected: TIMEOUT
|
||||
[X 2048-point FFT peak position is not equal to 64. Got 0.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
[sharedworker-in-worker.html]
|
||||
expected: ERROR
|
||||
[Base URL in workers: new SharedWorker()]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[Worker-constructor.html]
|
||||
expected: ERROR
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 12 KiB |
|
@ -164,20 +164,27 @@
|
|||
<script>
|
||||
|
||||
test(function(t) {
|
||||
// Deleting an element set via the content attribute.
|
||||
const idlAttrElement = document.getElementById("idlAttrElement");
|
||||
|
||||
assert_equals(deletionParent.getAttribute("aria-activedescendant"), "contentAttrElement");
|
||||
assert_equals(deletionParent.ariaActiveDescendantElement, contentAttrElement);
|
||||
|
||||
// Deleting an element set via the content attribute.
|
||||
deletionParent.removeChild(contentAttrElement);
|
||||
assert_equals(deletionParent.getAttribute("aria-activedescendant"), "contentAttrElement");
|
||||
|
||||
// As it was not explitly set, the attr-associated-element is computed from the content attribute,
|
||||
// and since descendant1 has been removed from the DOM, it is not valid.
|
||||
assert_equals(deletionParent.ariaActiveDescendantElement, null);
|
||||
|
||||
// Deleting an element set via the IDL attribute.
|
||||
deletionParent.ariaActiveDescendantElement = idlAttrElement;
|
||||
assert_equals(deletionParent.getAttribute("aria-activedescendant"), "idlAttrElement");
|
||||
|
||||
// The element is still retrieved because it was explicitly set, and was at that point
|
||||
// in a valid scope.
|
||||
deletionParent.removeChild(idlAttrElement);
|
||||
assert_equals(deletionParent.ariaActiveDescendantElement, null);
|
||||
assert_equals(deletionParent.ariaActiveDescendantElement, idlAttrElement);
|
||||
|
||||
// The content attribute will still reflect the id.
|
||||
assert_equals(deletionParent.getAttribute("aria-activedescendant"), "idlAttrElement");
|
||||
|
@ -227,14 +234,16 @@
|
|||
lightParent.ariaActiveDescendantElement = lightElement;
|
||||
assert_equals(lightParent.ariaActiveDescendantElement, lightElement);
|
||||
|
||||
// Move the referenced element into shadow DOM.
|
||||
// Move the referenced element into shadow DOM. As it was explicitly set,
|
||||
// it is still able to be gotten even though it is in a different scope.
|
||||
shadowRoot.appendChild(lightElement);
|
||||
assert_equals(lightParent.ariaActiveDescendantElement, null);
|
||||
assert_equals(lightParent.ariaActiveDescendantElement, lightElement);
|
||||
assert_equals(lightParent.getAttribute("aria-activedescendant"), "lightElement");
|
||||
|
||||
// Move the referenced element back into light DOM.
|
||||
lightParent.appendChild(lightElement);
|
||||
assert_equals(lightParent.ariaActiveDescendantElement, lightElement);
|
||||
assert_equals(lightParent.getAttribute("aria-activedescendant"), "lightElement");
|
||||
}, "Reparenting an element into a descendant shadow scope nullifies the element reference.");
|
||||
</script>
|
||||
|
||||
|
@ -250,6 +259,7 @@
|
|||
|
||||
<script>
|
||||
test(function(t) {
|
||||
const billingElement = document.getElementById("billingElement")
|
||||
assert_array_equals(input1.ariaLabelledByElements, [billingElement, nameElement], "parsed content attribute sets element references.");
|
||||
assert_equals(input2.ariaLabelledByElements, null, "Testing empty content attribute after parsing.");
|
||||
|
||||
|
@ -257,8 +267,10 @@
|
|||
assert_array_equals(input2.ariaLabelledByElements, [billingElement, addressElement], "Testing IDL setter/getter.");
|
||||
assert_equals(input2.getAttribute("aria-labelledby"), "billingElement addressElement");
|
||||
|
||||
// Remove the element from the DOM, but as it was explicitly set whilst in a valid scope
|
||||
// it can still be retrieved.
|
||||
billingElement.remove();
|
||||
assert_array_equals(input2.ariaLabelledByElements, [addressElement]);
|
||||
assert_array_equals(input2.ariaLabelledByElements, [billingElement, addressElement]);
|
||||
|
||||
input2.ariaLabelledByElements = [];
|
||||
assert_array_equals(input2.ariaLabelledByElements, [], "Testing IDL setter/getter for empty array.");
|
||||
|
@ -451,9 +463,9 @@
|
|||
innerShadowRoot.appendChild(description1);
|
||||
innerShadowRoot.appendChild(description2);
|
||||
|
||||
// Explicitly set elements are still present, but are not retrieved.
|
||||
// content attribute is still stale because all elements were in a valid scope when they were set.
|
||||
assert_array_equals(describedElement.ariaDescribedByElements, []);
|
||||
// Explicitly set elements are still retrieved, because they were in a valid scope when they were set.
|
||||
// The content attribute still reflects the ids.
|
||||
assert_array_equals(describedElement.ariaDescribedByElements, [description1, description2]);
|
||||
assert_equals(describedElement.getAttribute("aria-describedby"), "buttonDescription1 buttonDescription2");
|
||||
|
||||
// Move into the same shadow scope as the explicitly set elements to test that the elements are gettable
|
||||
|
@ -494,10 +506,9 @@
|
|||
headingElement.ariaLabelledByElements = [headingLabel1, headingLabel2];
|
||||
assert_equals(headingElement.getAttribute("aria-labelledby"), "headingLabel1 headingLabel2", "Elements are set again, so the content attribute is updated.");
|
||||
|
||||
// Remove the referring element from the DOM, elements are not gettable.
|
||||
// This behaviour is still under discussion.
|
||||
// Remove the referring element from the DOM, elements are gettable.
|
||||
headingElement.remove();
|
||||
assert_array_equals(headingElement.ariaLabelledByElements, [], "Element is no longer in the document, so references should not be gettable.");
|
||||
assert_array_equals(headingElement.ariaLabelledByElements, [headingLabel1, headingLabel2], "Element is no longer in the document, but references should be gettable.");
|
||||
assert_equals(headingElement.getAttribute("aria-labelledby"), "headingLabel1 headingLabel2");
|
||||
|
||||
// Insert it back in.
|
||||
|
@ -505,10 +516,10 @@
|
|||
assert_array_equals(headingElement.ariaLabelledByElements, [headingLabel1, headingLabel2]);
|
||||
assert_equals(headingElement.getAttribute("aria-labelledby"), "headingLabel1 headingLabel2");
|
||||
|
||||
// Remove everything from the DOM, nothing should be gettable.
|
||||
// Remove everything from the DOM, everything is still gettable.
|
||||
headingLabel1.remove();
|
||||
headingLabel2.remove();
|
||||
assert_array_equals(headingElement.ariaLabelledByElements, []);
|
||||
assert_array_equals(headingElement.ariaLabelledByElements, [headingLabel1, headingLabel2]);
|
||||
assert_equals(headingElement.getAttribute("aria-labelledby"), "headingLabel1 headingLabel2");
|
||||
assert_equals(document.getElementById("headingLabel1"), null);
|
||||
assert_equals(document.getElementById("headingLabel2"), null);
|
||||
|
|
|
@ -59,11 +59,11 @@ function toByteArray(data) {
|
|||
function compareNDEFRecords(providedRecord, receivedRecord) {
|
||||
assert_equals(providedRecord.recordType, receivedRecord.recordType);
|
||||
|
||||
// Compares media types without charset.
|
||||
// Charset should be compared when watch method is implemented, in order
|
||||
// to check that written and read strings are equal.
|
||||
assert_equals(providedRecord.mediaType,
|
||||
receivedRecord.mediaType.substring(0, providedRecord.mediaType.length));
|
||||
if (providedRecord.mediaType === undefined) {
|
||||
assert_equals(null, receivedRecord.mediaType);
|
||||
} else {
|
||||
assert_equals(providedRecord.mediaType, receivedRecord.mediaType);
|
||||
}
|
||||
|
||||
assert_not_equals(providedRecord.recordType, 'empty');
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
createMessage([createTextRecord(test_text_data)]));
|
||||
assert_equals(message.records.length, 1, 'one text record');
|
||||
assert_equals(message.records[0].recordType, 'text', 'messageType');
|
||||
assert_equals(message.records[0].mediaType, 'text/plain', 'mediaType');
|
||||
assert_equals(message.records[0].mediaType, null, 'mediaType');
|
||||
assert_equals(message.records[0].encoding, 'utf-8', 'encoding');
|
||||
assert_equals(message.records[0].lang, 'en', 'lang');
|
||||
assert_true(message.records[0].data instanceof DataView,
|
||||
|
|
|
@ -17,7 +17,7 @@ const NDEFReaderOptionTests =
|
|||
" recordType is set to 'empty'.",
|
||||
scanOptions: {recordType: "empty"},
|
||||
unmatchedScanOptions: {recordType: "mime"},
|
||||
message: createMessage([createRecord('empty', '')])
|
||||
message: createMessage([createRecord('empty')])
|
||||
},
|
||||
{
|
||||
desc: "Test that reading data succeed when NDEFScanOptions'" +
|
||||
|
@ -59,8 +59,7 @@ const NDEFReaderOptionTests =
|
|||
" recordType is set to a custom type for external type records.",
|
||||
scanOptions: {recordType: "w3.org:xyz"},
|
||||
unmatchedScanOptions: {recordType: "mime"},
|
||||
message: createMessage([createRecord('w3.org:xyz', 'application/octet-stream',
|
||||
test_buffer_data)])
|
||||
message: createMessage([createRecord('w3.org:xyz', test_buffer_data)])
|
||||
},
|
||||
{
|
||||
desc: "Test that the url of NDEFScanOptions filters relevant data" +
|
||||
|
@ -85,7 +84,7 @@ const ReadMultiMessagesTests =
|
|||
desc: "Test that filtering 'empty' record from different messages" +
|
||||
" correctly with NDEFScanOptions' recordType is set to 'empty'.",
|
||||
scanOptions: {recordType: "empty"},
|
||||
message: createMessage([createRecord('empty', '')]),
|
||||
message: createMessage([createRecord('empty')]),
|
||||
unmatchedMessage: createMessage([createMimeRecordFromJson(test_json_data)]),
|
||||
},
|
||||
{
|
||||
|
@ -127,8 +126,7 @@ const ReadMultiMessagesTests =
|
|||
desc: "Test that filtering external record from different messages" +
|
||||
" correctly with NDEFScanOptions' recordType is set to the custom type.",
|
||||
scanOptions: {recordType: "w3.org:xyz"},
|
||||
message: createMessage([createRecord('w3.org:xyz', 'application/octet-stream',
|
||||
test_buffer_data)]),
|
||||
message: createMessage([createRecord('w3.org:xyz', test_buffer_data)]),
|
||||
unmatchedMessage: createMessage([createTextRecord(test_text_data)])
|
||||
},
|
||||
{
|
||||
|
|
|
@ -190,7 +190,7 @@ nfc_test(async (t, mockNFC) => {
|
|||
|
||||
const payloadMessage = createMessage([createTextRecord(test_text_data)]);
|
||||
const message = createMessage([createRecord('example.com:payloadIsMessage',
|
||||
undefined, payloadMessage)]);
|
||||
payloadMessage)]);
|
||||
mockNFC.setReadingMessage(message);
|
||||
|
||||
reader.scan({signal : controller.signal});
|
||||
|
@ -204,7 +204,7 @@ nfc_test(async (t, mockNFC) => {
|
|||
const embeddedRecords = event.message.records[0].toRecords();
|
||||
assert_equals(embeddedRecords.length, 1);
|
||||
assert_equals(embeddedRecords[0].recordType, 'text', 'recordType');
|
||||
assert_equals(embeddedRecords[0].mediaType, 'text/plain', 'mediaType');
|
||||
assert_equals(embeddedRecords[0].mediaType, null, 'mediaType');
|
||||
const decoder = new TextDecoder();
|
||||
assert_equals(decoder.decode(embeddedRecords[0].data), test_text_data,
|
||||
'data has the same content with the original dictionary');
|
||||
|
|
|
@ -16,10 +16,31 @@
|
|||
'The record has neither type nor data.');
|
||||
}, 'NDEFRecord constructor with null init dict');
|
||||
|
||||
test(() => {
|
||||
assert_throws(new TypeError, () => new NDEFRecord(
|
||||
createRecord('empty', test_text_data, 'text/plain')),
|
||||
'mediaType does not apply for empty record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(
|
||||
createRecord('text', test_text_data, 'text/plain')),
|
||||
'mediaType does not apply for text record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(
|
||||
createRecord('url', test_url_data, 'text/plain')),
|
||||
'mediaType does not apply for url record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(
|
||||
createRecord('absolute-url', test_url_data, 'text/plain')),
|
||||
'mediaType does not apply for absolute-url record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(
|
||||
createRecord('unknown', test_buffer_data, 'application/octet-stream')),
|
||||
'mediaType does not apply for unknown record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(
|
||||
createRecord('foo.example.com:bar', test_buffer_data, 'application/octet-stream')),
|
||||
'mediaType does not apply for external record type.');
|
||||
}, 'NDEFRecord constructor should only accept mediaType for mime record type');
|
||||
|
||||
test(() => {
|
||||
const record = new NDEFRecord(createTextRecord(test_text_data));
|
||||
assert_equals(record.recordType, 'text', 'recordType');
|
||||
assert_equals(record.mediaType, 'text/plain', 'mediaType');
|
||||
assert_equals(record.mediaType, null, 'mediaType');
|
||||
assert_equals(record.encoding, 'utf-8', 'encoding');
|
||||
assert_equals(record.lang, 'en', 'lang');
|
||||
const decoder = new TextDecoder();
|
||||
|
@ -32,7 +53,7 @@
|
|||
const uint8Array = encoder.encode(test_text_data);
|
||||
const record = new NDEFRecord(createTextRecord(uint8Array.buffer));
|
||||
assert_equals(record.recordType, 'text', 'recordType');
|
||||
assert_equals(record.mediaType, 'text/plain', 'mediaType');
|
||||
assert_equals(record.mediaType, null, 'mediaType');
|
||||
assert_equals(record.encoding, 'utf-8', 'encoding');
|
||||
assert_equals(record.lang, 'en', 'lang');
|
||||
const decoder = new TextDecoder();
|
||||
|
@ -45,7 +66,7 @@
|
|||
const uint8Array = encoder.encode(test_text_data);
|
||||
const record = new NDEFRecord(createTextRecord(uint8Array));
|
||||
assert_equals(record.recordType, 'text', 'recordType');
|
||||
assert_equals(record.mediaType, 'text/plain', 'mediaType');
|
||||
assert_equals(record.mediaType, null, 'mediaType');
|
||||
assert_equals(record.encoding, 'utf-8', 'encoding');
|
||||
assert_equals(record.lang, 'en', 'lang');
|
||||
const decoder = new TextDecoder();
|
||||
|
@ -59,7 +80,7 @@
|
|||
const lang = 'fr';
|
||||
const record = new NDEFRecord(createTextRecord(test_text_data, encoding, lang));
|
||||
assert_equals(record.recordType, 'text', 'recordType');
|
||||
assert_equals(record.mediaType, 'text/plain', 'mediaType');
|
||||
assert_equals(record.mediaType, null, 'mediaType');
|
||||
assert_equals(record.encoding, encoding, 'encoding');
|
||||
assert_equals(record.lang, lang, 'lang');
|
||||
const decoder = new TextDecoder();
|
||||
|
@ -77,7 +98,7 @@
|
|||
});
|
||||
const record = new NDEFRecord(createTextRecord(test_text_data));
|
||||
assert_equals(record.recordType, 'text', 'recordType');
|
||||
assert_equals(record.mediaType, 'text/plain', 'mediaType');
|
||||
assert_equals(record.mediaType, null, 'mediaType');
|
||||
assert_equals(record.encoding, 'utf-8', 'encoding');
|
||||
assert_equals(record.lang, test_lang, 'lang');
|
||||
const decoder = new TextDecoder();
|
||||
|
@ -88,7 +109,7 @@
|
|||
test(() => {
|
||||
const record = new NDEFRecord(createUrlRecord(test_url_data));
|
||||
assert_equals(record.recordType, 'url', 'recordType');
|
||||
assert_equals(record.mediaType, 'text/plain', 'mediaType');
|
||||
assert_equals(record.mediaType, null, 'mediaType');
|
||||
const decoder = new TextDecoder();
|
||||
assert_equals(decoder.decode(record.data), test_url_data,
|
||||
'data has the same content with the original dictionary');
|
||||
|
@ -97,7 +118,7 @@
|
|||
test(() => {
|
||||
const record = new NDEFRecord(createUrlRecord(test_url_data, true));
|
||||
assert_equals(record.recordType, 'absolute-url', 'recordType');
|
||||
assert_equals(record.mediaType, 'text/plain', 'mediaType');
|
||||
assert_equals(record.mediaType, null, 'mediaType');
|
||||
const decoder = new TextDecoder();
|
||||
assert_equals(decoder.decode(record.data), test_url_data,
|
||||
'data has the same content with the original dictionary');
|
||||
|
@ -166,9 +187,9 @@
|
|||
let buffer_view = new Uint8Array(buffer);
|
||||
let original_data = new Uint8Array([1, 2, 3, 4]);
|
||||
buffer_view.set(original_data);
|
||||
const record = new NDEFRecord(createRecord('foo.eXamPle.coM:bAr*-', undefined, buffer));
|
||||
const record = new NDEFRecord(createRecord('foo.eXamPle.coM:bAr*-', buffer));
|
||||
assert_equals(record.recordType, 'foo.example.com:bAr*-', 'recordType');
|
||||
assert_equals(record.mediaType, 'application/octet-stream', 'mediaType');
|
||||
assert_equals(record.mediaType, null, 'mediaType');
|
||||
assert_array_equals(new Uint8Array(record.data.buffer), original_data,
|
||||
'data has the same content with the original buffer');
|
||||
}, 'NDEFRecord constructor with external record type');
|
||||
|
@ -176,29 +197,27 @@
|
|||
test(() => {
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('EMptY')),
|
||||
'Unknown record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('TeXt', '', test_text_data)),
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('TeXt', test_text_data)),
|
||||
'Unknown record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('uRL', '', test_url_data)),
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('uRL', test_url_data)),
|
||||
'Unknown record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('jSoN', '', test_json_data)),
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('Mime', test_buffer_data)),
|
||||
'Unknown record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('OpaQUE', '', test_buffer_data)),
|
||||
'Unknown record type.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('sMart-PosTER', '', test_url_data)),
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord('sMart-PosTER', test_url_data)),
|
||||
'Unknown record type.');
|
||||
}, 'NDEFRecord constructor with record type string being treated as case sensitive');
|
||||
|
||||
test(() => {
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
|
||||
':xyz', '', test_buffer_data)), 'The domain should not be empty.');
|
||||
':xyz', test_buffer_data)), 'The domain should not be empty.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
|
||||
'[:xyz', '', test_buffer_data)), '"[" is not a valid FQDN.');
|
||||
'[:xyz', test_buffer_data)), '"[" is not a valid FQDN.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
|
||||
'example.com:', '', test_buffer_data)), 'The type should not be empty.');
|
||||
'example.com:', test_buffer_data)), 'The type should not be empty.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
|
||||
'example.com:xyz~', '', test_buffer_data)), 'The type should not contain \'~\'.');
|
||||
'example.com:xyz~', test_buffer_data)), 'The type should not contain \'~\'.');
|
||||
assert_throws(new TypeError, () => new NDEFRecord(createRecord(
|
||||
'example.com:xyz/', '', test_buffer_data)), 'The type should not contain \'/\'.');
|
||||
'example.com:xyz/', test_buffer_data)), 'The type should not contain \'/\'.');
|
||||
}, 'NDEFRecord constructor with invalid external record type');
|
||||
|
||||
</script>
|
||||
|
|
|
@ -76,25 +76,21 @@ const invalid_type_messages =
|
|||
|
||||
// https://w3c.github.io/web-nfc/#dfn-map-external-data-to-ndef
|
||||
// NDEFRecord must have data.
|
||||
createMessage([createRecord('w3.org:xyz', '', undefined)]),
|
||||
createMessage([createRecord('w3.org:xyz')]),
|
||||
|
||||
// NDEFRecord.data for external record must be ArrayBuffer.
|
||||
createMessage([createRecord('w3.org:xyz', '', test_text_data)]),
|
||||
createMessage([createRecord('w3.org:xyz', '', test_number_data)]),
|
||||
createMessage([createRecord('w3.org:xyz', '', test_json_data)]),
|
||||
createMessage([createRecord('w3.org:xyz', test_text_data)]),
|
||||
createMessage([createRecord('w3.org:xyz', test_number_data)]),
|
||||
createMessage([createRecord('w3.org:xyz', test_json_data)]),
|
||||
|
||||
// https://w3c.github.io/web-nfc/#the-ndefrecordtype-string
|
||||
// The record type is neither a known type ('text', 'mime' etc.) nor a
|
||||
// valid custom type for an external type record.
|
||||
createMessage([createRecord('unmatched_type', '', test_buffer_data)])
|
||||
createMessage([createRecord('unmatched_type', test_buffer_data)])
|
||||
];
|
||||
|
||||
const invalid_syntax_messages =
|
||||
[
|
||||
// NDEFRecord.mediaType for 'text' record must be 'text/*'.
|
||||
createMessage([createRecord('text', 'application/json',
|
||||
test_text_data)]),
|
||||
|
||||
// Data for 'url' or 'absolute-url' record, must be a valid URL.
|
||||
createMessage([createUrlRecord('Invalid URL:// Data')]),
|
||||
createMessage([createUrlRecord('Invalid URL:// Data', true)]),
|
||||
|
@ -294,7 +290,7 @@ nfc_test(async (t, mockNFC) => {
|
|||
createUnknownRecord(test_buffer_data),
|
||||
createUrlRecord(test_url_data),
|
||||
createUrlRecord(test_url_data, true),
|
||||
createRecord('w3.org:xyz', '', test_buffer_data)],
|
||||
createRecord('w3.org:xyz', test_buffer_data)],
|
||||
test_message_origin);
|
||||
await writer.push(message);
|
||||
assertNDEFMessagesEqual(message, mockNFC.pushedMessage());
|
||||
|
@ -412,13 +408,6 @@ nfc_test(async (t, mockNFC) => {
|
|||
}, "Test that recordType should be set to 'mime' if NDEFRecordInit.record's \
|
||||
recordType is undefined and NDEFRecordInit.record's data is not DOMString.");
|
||||
|
||||
nfc_test(async (t, mockNFC) => {
|
||||
const writer = new NDEFWriter();
|
||||
await writer.push({ records: [{ recordType: "text", data: test_text_data }] });
|
||||
assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
|
||||
}, "Test that mediaType should be set to 'text/plain' if NDEFRecordInit.record's \
|
||||
recordType is 'text' and NDEFRecordInit.record's mediaType is undefined.");
|
||||
|
||||
nfc_test(async (t, mockNFC) => {
|
||||
const writer = new NDEFWriter();
|
||||
await writer.push({ records: [{ recordType: "mime", data: test_buffer_data }] });
|
||||
|
@ -427,16 +416,6 @@ nfc_test(async (t, mockNFC) => {
|
|||
NDEFRecordInit.record's recordType is 'mime' and NDEFRecordInit.record's \
|
||||
mediaType is undefined.");
|
||||
|
||||
nfc_test(async (t, mockNFC) => {
|
||||
const writer = new NDEFWriter();
|
||||
await writer.push({ records: [{ recordType: "w3.org:xyz", data: test_buffer_data }] });
|
||||
const message = createMessage([createRecord('w3.org:xyz', 'application/octet-stream',
|
||||
test_buffer_data)]);
|
||||
assertNDEFMessagesEqual(message, mockNFC.pushedMessage());
|
||||
}, "Test that mediaType should be set to 'application/octet-stream' if \
|
||||
NDEFRecordInit.record's recordType is external type and NDEFRecordInit.record's \
|
||||
mediaType is undefined.");
|
||||
|
||||
nfc_test(async (t, mockNFC) => {
|
||||
const writer = new NDEFWriter();
|
||||
mockNFC.setIsNDEFTech(false);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
const record = {
|
||||
recordType: "text",
|
||||
mediaType: "text/plain",
|
||||
data: "Hello World",
|
||||
id: "/custom/path"
|
||||
};
|
||||
|
|
|
@ -84,7 +84,7 @@ function createMessage(records) {
|
|||
}
|
||||
}
|
||||
|
||||
function createRecord(recordType, mediaType, data, encoding, lang) {
|
||||
function createRecord(recordType, data, mediaType, encoding, lang) {
|
||||
let record = {};
|
||||
if (recordType !== undefined)
|
||||
record.recordType = recordType;
|
||||
|
@ -100,28 +100,28 @@ function createRecord(recordType, mediaType, data, encoding, lang) {
|
|||
}
|
||||
|
||||
function createTextRecord(data, encoding, lang) {
|
||||
return createRecord('text', 'text/plain', data, encoding, lang);
|
||||
return createRecord('text', data, undefined, encoding, lang);
|
||||
}
|
||||
|
||||
function createMimeRecordFromJson(json) {
|
||||
return createRecord(
|
||||
'mime', 'application/json',
|
||||
new TextEncoder('utf-8').encode(JSON.stringify(json)));
|
||||
'mime', new TextEncoder('utf-8').encode(JSON.stringify(json)),
|
||||
'application/json');
|
||||
}
|
||||
|
||||
function createMimeRecord(buffer) {
|
||||
return createRecord('mime', 'application/octet-stream', buffer);
|
||||
return createRecord('mime', buffer, 'application/octet-stream');
|
||||
}
|
||||
|
||||
function createUnknownRecord(buffer) {
|
||||
return createRecord('unknown', '', buffer);
|
||||
return createRecord('unknown', buffer);
|
||||
}
|
||||
|
||||
function createUrlRecord(url, isAbsUrl) {
|
||||
if (isAbsUrl) {
|
||||
return createRecord('absolute-url', 'text/plain', url);
|
||||
return createRecord('absolute-url', url);
|
||||
}
|
||||
return createRecord('url', 'text/plain', url);
|
||||
return createRecord('url', url);
|
||||
}
|
||||
|
||||
function createNDEFPushOptions(target, timeout, ignoreRead) {
|
||||
|
|