mirror of
https://github.com/servo/servo.git
synced 2025-08-14 18:05:36 +01:00
Update web-platform-tests to revision 424249088dd679888e07bd315dd8ebc98ccf323a
This commit is contained in:
parent
4ad08fff04
commit
bca3835607
93 changed files with 1641 additions and 291 deletions
|
@ -31,14 +31,16 @@ function toMojoNDEFRecord(record) {
|
|||
return nfcRecord;
|
||||
}
|
||||
|
||||
// Converts JS objects to byte array.
|
||||
function toByteArray(data) {
|
||||
// Converts JS objects to byte array.
|
||||
if (data instanceof ArrayBuffer)
|
||||
return new Uint8Array(data);
|
||||
else if (ArrayBuffer.isView(data))
|
||||
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
||||
|
||||
let byteArray = new Uint8Array(0);
|
||||
let tmpData = data;
|
||||
|
||||
if (tmpData instanceof ArrayBuffer)
|
||||
byteArray = new Uint8Array(tmpData);
|
||||
else if (typeof tmpData === 'object' || typeof tmpData === 'number')
|
||||
if (typeof tmpData === 'object' || typeof tmpData === 'number')
|
||||
tmpData = JSON.stringify(tmpData);
|
||||
|
||||
if (typeof tmpData === 'string')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue