|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 | var $ = require('../internals/export');
|
|---|
| 3 | var globalThis = require('../internals/global-this');
|
|---|
| 4 | var aString = require('../internals/a-string');
|
|---|
| 5 | var anUint8Array = require('../internals/an-uint8-array');
|
|---|
| 6 | var notDetached = require('../internals/array-buffer-not-detached');
|
|---|
| 7 | var $fromHex = require('../internals/uint8-from-hex');
|
|---|
| 8 |
|
|---|
| 9 | // Should not throw an error on length-tracking views over ResizableArrayBuffer
|
|---|
| 10 | // https://issues.chromium.org/issues/454630441
|
|---|
| 11 | function throwsOnLengthTrackingView() {
|
|---|
| 12 | try {
|
|---|
| 13 | // eslint-disable-next-line es/no-resizable-and-growable-arraybuffers -- required for testing
|
|---|
| 14 | var rab = new ArrayBuffer(16, { maxByteLength: 1024 });
|
|---|
| 15 | // eslint-disable-next-line es/no-uint8array-prototype-setfromhex, es/no-typed-arrays -- required for testing
|
|---|
| 16 | new Uint8Array(rab).setFromHex('cafed00d');
|
|---|
| 17 | } catch (error) {
|
|---|
| 18 | return true;
|
|---|
| 19 | }
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | // `Uint8Array.prototype.setFromHex` method
|
|---|
| 23 | // https://tc39.es/ecma262/#sec-uint8array.prototype.setfromhex
|
|---|
| 24 | if (globalThis.Uint8Array) $({ target: 'Uint8Array', proto: true, forced: throwsOnLengthTrackingView() }, {
|
|---|
| 25 | setFromHex: function setFromHex(string) {
|
|---|
| 26 | anUint8Array(this);
|
|---|
| 27 | aString(string);
|
|---|
| 28 | notDetached(this.buffer);
|
|---|
| 29 | var read = $fromHex(string, this).read;
|
|---|
| 30 | return { read: read, written: read / 2 };
|
|---|
| 31 | }
|
|---|
| 32 | });
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.