mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Make payload limit configurable by tests
This commit is contained in:
@@ -199,6 +199,8 @@ export class ApcParser implements IApcParser {
|
||||
* as APC handlers.
|
||||
*/
|
||||
export class ApcHandler implements IApcHandler {
|
||||
private static PAYLOAD_LIMIT = PAYLOAD_LIMIT;
|
||||
|
||||
private _data = '';
|
||||
private _hitLimit: boolean = false;
|
||||
|
||||
@@ -214,7 +216,7 @@ export class ApcHandler implements IApcHandler {
|
||||
return;
|
||||
}
|
||||
this._data += utf32ToString(data, start, end);
|
||||
if (this._data.length > PAYLOAD_LIMIT) {
|
||||
if (this._data.length > ApcHandler.PAYLOAD_LIMIT) {
|
||||
this._data = '';
|
||||
this._hitLimit = true;
|
||||
}
|
||||
|
||||
@@ -138,6 +138,8 @@ EMPTY_PARAMS.addParam(0);
|
||||
* Note: The payload is currently limited to 50 MB (hardcoded).
|
||||
*/
|
||||
export class DcsHandler implements IDcsHandler {
|
||||
private static PAYLOAD_LIMIT = PAYLOAD_LIMIT;
|
||||
|
||||
private _data = '';
|
||||
private _params: IParams = EMPTY_PARAMS;
|
||||
private _hitLimit: boolean = false;
|
||||
@@ -159,7 +161,7 @@ export class DcsHandler implements IDcsHandler {
|
||||
return;
|
||||
}
|
||||
this._data += utf32ToString(data, start, end);
|
||||
if (this._data.length > PAYLOAD_LIMIT) {
|
||||
if (this._data.length > DcsHandler.PAYLOAD_LIMIT) {
|
||||
this._data = '';
|
||||
this._hitLimit = true;
|
||||
}
|
||||
|
||||
@@ -192,6 +192,8 @@ export class OscParser implements IOscParser {
|
||||
* as OSC handlers.
|
||||
*/
|
||||
export class OscHandler implements IOscHandler {
|
||||
private static PAYLOAD_LIMIT = PAYLOAD_LIMIT;
|
||||
|
||||
private _data = '';
|
||||
private _hitLimit: boolean = false;
|
||||
|
||||
@@ -207,7 +209,7 @@ export class OscHandler implements IOscHandler {
|
||||
return;
|
||||
}
|
||||
this._data += utf32ToString(data, start, end);
|
||||
if (this._data.length > PAYLOAD_LIMIT) {
|
||||
if (this._data.length > OscHandler.PAYLOAD_LIMIT) {
|
||||
this._data = '';
|
||||
this._hitLimit = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user