appium-ios-device 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/build/lib/afc/index.js +1 -1
  2. package/build/lib/afc/protocol.js +1 -1
  3. package/build/lib/afc/streams.js +1 -1
  4. package/build/lib/afc/transformer/afcdecoder.js +1 -1
  5. package/build/lib/afc/transformer/afcencoder.js +1 -1
  6. package/build/lib/installation-proxy/index.js +1 -1
  7. package/build/lib/instrument/headers.js +31 -14
  8. package/build/lib/instrument/index.js +1 -1
  9. package/build/lib/instrument/transformer/dtx-decode.js +1 -1
  10. package/build/lib/instrument/transformer/dtx-encode.js +1 -1
  11. package/build/lib/instrument/transformer/nskeyed.js +1 -1
  12. package/build/lib/lockdown/index.js +1 -1
  13. package/build/lib/logger.js +1 -1
  14. package/build/lib/mcinstall/index.js +1 -1
  15. package/build/lib/notification-proxy/index.js +1 -1
  16. package/build/lib/plist-service/index.js +1 -1
  17. package/build/lib/plist-service/transformer/plist-service-decoder.js +1 -1
  18. package/build/lib/plist-service/transformer/plist-service-encoder.js +1 -1
  19. package/build/lib/services.js +1 -1
  20. package/build/lib/ssl-helper.js +1 -1
  21. package/build/lib/syslog/transformer/syslog-decoder.js +1 -1
  22. package/build/lib/usbmux/index.js +1 -1
  23. package/build/lib/usbmux/transformer/usbmux-decoder.js +1 -1
  24. package/build/lib/usbmux/transformer/usbmux-encoder.js +1 -1
  25. package/build/lib/util/transformer/length-based-splitter.js +1 -1
  26. package/build/lib/util/transformer/stream-logger.js +1 -1
  27. package/build/lib/utilities.js +1 -1
  28. package/build/lib/webinspector/index.js +1 -1
  29. package/build/lib/webinspector/transformer/webinspector-decoder.js +1 -1
  30. package/build/lib/webinspector/transformer/webinspector-encoder.js +1 -1
  31. package/lib/instrument/headers.js +31 -15
  32. package/package.json +1 -1
@@ -10,12 +10,14 @@ const DTX_MESSAGE_AUX_HEADER = 0x01F0;
10
10
  const DTX_AUXILIARY_MAGIC = 0xa;
11
11
 
12
12
  const FLAG_TYPES = Object.freeze({
13
+ push: 0,
13
14
  recv: 1,
14
15
  send: 2,
15
16
  reply: 3
16
17
  });
17
18
 
18
19
  const AUX_TYPES = Object.freeze({
20
+ Text: 1,
19
21
  NSKeyed: 2,
20
22
  UInt32LE: 3,
21
23
  BigUInt64LE: 4,
@@ -116,7 +118,7 @@ class DTXMessagePayloadHeader {
116
118
 
117
119
  /**
118
120
  * @param headerBuffer
119
- * @returns {{flags: number, totalLength: bigint, auxLength: number}}
121
+ * @returns {DTXMessagePayloadHeaderObject}
120
122
  */
121
123
  static parse (headerBuffer) {
122
124
  return {
@@ -159,22 +161,33 @@ class DTXMessageAux {
159
161
 
160
162
  /**
161
163
  * Parses nskeyed Buffer into js array
162
- * @param headerBuffer
164
+ * @param {Buffer} headerBuffer
165
+ * @param {DTXMessagePayloadHeaderObject} payloadHeader
163
166
  * @returns {Array}
164
167
  */
165
- static parse (headerBuffer) {
168
+ static parse (headerBuffer, payloadHeader) {
166
169
  let cursor = 0;
167
170
  const data = [];
168
171
  const length = headerBuffer.readBigInt64LE(8);
169
172
  cursor += 16;
170
173
  while (cursor <= length) {
171
- const m = headerBuffer.readUInt32LE(cursor);
172
- if (m !== DTX_AUXILIARY_MAGIC) {
173
- throw new Error(`incorrect auxiliary magic: ${m}`);
174
+ if (payloadHeader.flags !== FLAG_TYPES.push) {
175
+ const m = headerBuffer.readUInt32LE(cursor);
176
+ cursor += 4;
177
+ if (m !== DTX_AUXILIARY_MAGIC) {
178
+ throw new Error(`incorrect auxiliary magic: ${m}`);
179
+ }
174
180
  }
175
- const type = headerBuffer.readUInt32LE(cursor + 4);
176
- cursor += 8;
181
+ const type = headerBuffer.readUInt32LE(cursor);
182
+ cursor += 4;
177
183
  switch (type) {
184
+ case AUX_TYPES.Text: {
185
+ const strLen = headerBuffer.readUInt32LE(cursor);
186
+ cursor += 4;
187
+ data.push(headerBuffer.slice(cursor, cursor + strLen));
188
+ cursor += strLen;
189
+ break;
190
+ }
178
191
  case AUX_TYPES.NSKeyed: {
179
192
  const strLen = headerBuffer.readUInt32LE(cursor);
180
193
  cursor += 4;
@@ -399,17 +412,20 @@ class DTXMessage {
399
412
  return ret;
400
413
  }
401
414
  if (ret._payloadHeader.auxLength > 0) {
402
- ret.auxiliaries = DTXMessageAux.parse(payloadBuf.slice(cursor, cursor + ret._payloadHeader.auxLength));
415
+ ret.auxiliaries = DTXMessageAux.parse(payloadBuf.slice(cursor, cursor + ret._payloadHeader.auxLength), ret._payloadHeader);
403
416
  cursor += ret._payloadHeader.auxLength;
404
417
  }
405
418
 
406
419
  const data = payloadBuf.slice(cursor, cursor + payloadBuf.length);
407
- for (const fun of [unarchive, plistlib.parseBuffer]) {
408
- try {
409
- ret.selector = fun(data);
410
- break;
411
- } catch (e) {
412
- ret.selector = new InstrumentRPCParseError(data);
420
+ ret.selector = data;
421
+ if (data.length > 0) {
422
+ for (const fun of [unarchive, plistlib.parseBuffer]) {
423
+ try {
424
+ ret.selector = fun(data);
425
+ break;
426
+ } catch (e) {
427
+ ret.selector = new InstrumentRPCParseError(data);
428
+ }
413
429
  }
414
430
  }
415
431
  return ret;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "appium"
6
6
  ],
7
- "version": "2.4.1",
7
+ "version": "2.4.2",
8
8
  "author": "appium",
9
9
  "license": "Apache-2.0",
10
10
  "repository": {