trezor-link
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -384,3 +384,4 @@ 'use strict'; | ||
value: function () { | ||
var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(session) { | ||
var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(session, onclose) { | ||
var res; | ||
return regeneratorRuntime.wrap(function _callee10$(_context10) { | ||
@@ -390,6 +391,16 @@ while (1) { | ||
case 0: | ||
_context10.next = 2; | ||
return this._post({ url: '/release/' + session }); | ||
res = this._post({ url: '/release/' + session }); | ||
case 2: | ||
if (!onclose) { | ||
_context10.next = 3; | ||
break; | ||
} | ||
return _context10.abrupt('return'); | ||
case 3: | ||
_context10.next = 5; | ||
return res; | ||
case 5: | ||
case 'end': | ||
@@ -402,3 +413,3 @@ return _context10.stop(); | ||
function release(_x8) { | ||
function release(_x8, _x9) { | ||
return _ref10.apply(this, arguments); | ||
@@ -439,3 +450,3 @@ } | ||
function call(_x9, _x10, _x11) { | ||
function call(_x10, _x11, _x12) { | ||
return _ref11.apply(this, arguments); | ||
@@ -442,0 +453,0 @@ } |
@@ -367,3 +367,4 @@ | ||
value: function () { | ||
var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(session) { | ||
var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(session, onclose) { | ||
var res; | ||
return regeneratorRuntime.wrap(function _callee9$(_context9) { | ||
@@ -373,6 +374,16 @@ while (1) { | ||
case 0: | ||
_context9.next = 2; | ||
return this._post({ url: '/release/' + session }); | ||
res = this._post({ url: '/release/' + session }); | ||
case 2: | ||
if (!onclose) { | ||
_context9.next = 3; | ||
break; | ||
} | ||
return _context9.abrupt('return'); | ||
case 3: | ||
_context9.next = 5; | ||
return res; | ||
case 5: | ||
case 'end': | ||
@@ -385,3 +396,3 @@ return _context9.stop(); | ||
function release(_x7) { | ||
function release(_x7, _x8) { | ||
return _ref9.apply(this, arguments); | ||
@@ -439,3 +450,3 @@ } | ||
function call(_x8, _x9, _x10) { | ||
function call(_x9, _x10, _x11) { | ||
return _ref10.apply(this, arguments); | ||
@@ -442,0 +453,0 @@ } |
@@ -450,3 +450,4 @@ 'use strict'; | ||
value: function () { | ||
var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(session) { | ||
var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(session, onclose) { | ||
var res; | ||
return regeneratorRuntime.wrap(function _callee11$(_context11) { | ||
@@ -456,4 +457,3 @@ while (1) { | ||
case 0: | ||
_context11.next = 2; | ||
return this._send({ | ||
res = this._send({ | ||
type: 'release', | ||
@@ -463,3 +463,14 @@ body: maybeParseInt(session) | ||
case 2: | ||
if (!onclose) { | ||
_context11.next = 3; | ||
break; | ||
} | ||
return _context11.abrupt('return'); | ||
case 3: | ||
_context11.next = 5; | ||
return res; | ||
case 5: | ||
case 'end': | ||
@@ -472,3 +483,3 @@ return _context11.stop(); | ||
function release(_x7) { | ||
function release(_x7, _x8) { | ||
return _ref11.apply(this, arguments); | ||
@@ -510,3 +521,3 @@ } | ||
function call(_x8, _x9, _x10) { | ||
function call(_x9, _x10, _x11) { | ||
return _ref12.apply(this, arguments); | ||
@@ -513,0 +524,0 @@ } |
@@ -418,3 +418,3 @@ 'use strict'; | ||
value: function () { | ||
var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(session) { | ||
var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(session, onclose) { | ||
return regeneratorRuntime.wrap(function _callee8$(_context8) { | ||
@@ -424,3 +424,3 @@ while (1) { | ||
case 0: | ||
return _context8.abrupt('return', this.activeTransport.release(session)); | ||
return _context8.abrupt('return', this.activeTransport.release(session, onclose)); | ||
@@ -435,3 +435,3 @@ case 1: | ||
function release(_x6) { | ||
function release(_x6, _x7) { | ||
return _ref8.apply(this, arguments); | ||
@@ -460,3 +460,3 @@ } | ||
function call(_x7, _x8, _x9) { | ||
function call(_x8, _x9, _x10) { | ||
return _ref9.apply(this, arguments); | ||
@@ -463,0 +463,0 @@ } |
@@ -96,8 +96,15 @@ 'use strict'; | ||
if (message.type === 'release-intent') { | ||
if (message.type === 'release-onclose') { | ||
var session = message.session; | ||
waitInQueue(function () { | ||
return handleReleaseIntent(session, id, port); | ||
return handleReleaseOnClose(session); | ||
}); | ||
} | ||
if (message.type === 'release-intent') { | ||
var _session = message.session; | ||
waitInQueue(function () { | ||
return handleReleaseIntent(_session, id, port); | ||
}); | ||
} | ||
if (message.type === 'release-done') { | ||
@@ -112,2 +119,18 @@ handleReleaseDone(id); // port is the same as original | ||
function handleReleaseOnClose(session) { | ||
var path_ = null; | ||
Object.keys(state).forEach(function (kpath) { | ||
if (state[kpath] === session) { | ||
path_ = kpath; | ||
} | ||
}); | ||
if (path_ == null) { | ||
return Promise.resolve(); | ||
} | ||
var path = path_; | ||
delete state[path]; | ||
return Promise.resolve(); | ||
} | ||
function handleReleaseIntent(session, id, port) { | ||
@@ -114,0 +137,0 @@ var path_ = null; |
@@ -72,3 +72,3 @@ 'use strict'; | ||
this.name = 'WebUsbPlugin'; | ||
this.version = "1.2.1"; | ||
this.version = "1.2.2"; | ||
this.debug = false; | ||
@@ -75,0 +75,0 @@ this.allowsWriteAndEnumerate = true; |
@@ -345,3 +345,3 @@ 'use strict'; | ||
value: function () { | ||
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(session) { | ||
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(session, onclose) { | ||
var messback, path; | ||
@@ -352,10 +352,13 @@ return regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
case 0: | ||
_context5.next = 2; | ||
if (onclose) { | ||
this.sendToWorker({ type: 'release-onclose', session: session }); | ||
} | ||
_context5.next = 3; | ||
return this.sendToWorker({ type: 'release-intent', session: session }); | ||
case 2: | ||
case 3: | ||
messback = _context5.sent; | ||
if (!(messback.type === 'double-release')) { | ||
_context5.next = 5; | ||
_context5.next = 6; | ||
break; | ||
@@ -366,5 +369,5 @@ } | ||
case 5: | ||
case 6: | ||
if (!(messback.type !== 'path')) { | ||
_context5.next = 7; | ||
_context5.next = 8; | ||
break; | ||
@@ -375,3 +378,3 @@ } | ||
case 7: | ||
case 8: | ||
path = messback.path; | ||
@@ -381,19 +384,19 @@ | ||
this._releaseCleanup(session); | ||
_context5.prev = 9; | ||
_context5.next = 12; | ||
_context5.prev = 10; | ||
_context5.next = 13; | ||
return this.plugin.disconnect(path); | ||
case 12: | ||
_context5.next = 16; | ||
case 13: | ||
_context5.next = 17; | ||
break; | ||
case 14: | ||
_context5.prev = 14; | ||
_context5.t0 = _context5['catch'](9); | ||
case 15: | ||
_context5.prev = 15; | ||
_context5.t0 = _context5['catch'](10); | ||
case 16: | ||
_context5.next = 18; | ||
case 17: | ||
_context5.next = 19; | ||
return this.sendToWorker({ type: 'release-done' }); | ||
case 18: | ||
case 19: | ||
case 'end': | ||
@@ -403,6 +406,6 @@ return _context5.stop(); | ||
} | ||
}, _callee5, this, [[9, 14]]); | ||
}, _callee5, this, [[10, 15]]); | ||
})); | ||
function release(_x5) { | ||
function release(_x5, _x6) { | ||
return _ref5.apply(this, arguments); | ||
@@ -444,3 +447,3 @@ } | ||
function configure(_x6) { | ||
function configure(_x7) { | ||
return _ref6.apply(this, arguments); | ||
@@ -555,3 +558,3 @@ } | ||
function call(_x7, _x8, _x9) { | ||
function call(_x8, _x9, _x10) { | ||
return _ref7.apply(this, arguments); | ||
@@ -597,3 +600,3 @@ } | ||
function init(_x10) { | ||
function init(_x11) { | ||
return _ref9.apply(this, arguments); | ||
@@ -600,0 +603,0 @@ } |
@@ -353,3 +353,3 @@ 'use strict'; | ||
value: function () { | ||
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(session) { | ||
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(session, onclose) { | ||
var sessionP; | ||
@@ -361,3 +361,3 @@ return regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
sessionP = this._parseName(session); | ||
return _context5.abrupt('return', sessionP.transport.release(sessionP.rest)); | ||
return _context5.abrupt('return', sessionP.transport.release(sessionP.rest, onclose)); | ||
@@ -372,3 +372,3 @@ case 2: | ||
function release(_x4) { | ||
function release(_x4, _x5) { | ||
return _ref6.apply(this, arguments); | ||
@@ -536,3 +536,3 @@ } | ||
function configure(_x5) { | ||
function configure(_x6) { | ||
return _ref7.apply(this, arguments); | ||
@@ -563,3 +563,3 @@ } | ||
function call(_x6, _x7, _x8) { | ||
function call(_x7, _x8, _x9) { | ||
return _ref8.apply(this, arguments); | ||
@@ -695,3 +695,3 @@ } | ||
function init(_x9) { | ||
function init(_x10) { | ||
return _ref9.apply(this, arguments); | ||
@@ -698,0 +698,0 @@ } |
{ | ||
"name": "trezor-link", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Trezor Link for browser", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
393937
6663