добавил возможность отладки eval функций

This commit is contained in:
vgoma 2017-11-29 15:16:02 +03:00
parent 1b4c840d55
commit e038629878
4 changed files with 581 additions and 581 deletions

1129
dist/crypto-pro.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -18,7 +18,7 @@ Certificate.prototype.isValid = function isValid() {
var cert = this._cert;
return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function isValid() {
var result;
try {
@ -41,7 +41,7 @@ Certificate.prototype.getProp = function (propName) {
var cert = this._cert;
return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function getProp() {
var result;
try {
@ -63,7 +63,7 @@ Certificate.prototype.exportBase64 = function exportBase64() {
var cert = this._cert;
return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function exportBase64() {
var base64;
try {
@ -85,7 +85,7 @@ Certificate.prototype.getAlgorithm = function getAlgorithm() {
var cert = this._cert;
return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function getAlgorithm() {
var result = {},
algorithm;
@ -128,7 +128,7 @@ Certificate.prototype.getExtendedKeyUsage = function getExtendedKeyUsage() {
var cert = this._cert;
return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function getExtendedKeyUsage() {
var OIDS = [],
count,
item;
@ -169,7 +169,7 @@ Certificate.prototype.hasExtendedKeyUsage = cryptoCommon.hasExtendedKeyUsage;
* */
function isValidEDSSettings() {
return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function isValidEDSSettings() {
var result;
try {
@ -188,7 +188,7 @@ function isValidEDSSettings() {
* */
function getCadesCert(hash) {
return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function getCadesCert() {
var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'),
certs,
certCnt,
@ -253,7 +253,7 @@ function getCertInfo(tags, propName) {
var cert = this._cert;
return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function getCertInfo() {
var propInfo;
try {
@ -281,7 +281,7 @@ function getCertsList(resetCache) {
return;
}
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function getCertsList() {
var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'),
result = [],
certs,
@ -398,7 +398,7 @@ function signData(hash, dataBase64, signType) {
return new Promise(function (resolve, reject) {
getCadesCert(hash).then(function (cert) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function signData() {
var clientTime = new Date(),
oAttrs = 'yield' + cryptoCommon.createObj('CADESCOM.CPAttribute'),
oSignedData = 'yield' + cryptoCommon.createObj('CAdESCOM.CadesSignedData'),
@ -456,7 +456,7 @@ function signData(hash, dataBase64, signType) {
function signDataXML(hash, dataXML) {
return new Promise(function (resolve, reject) {
getCadesCert(hash).then(function (cert) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function signDataXML() {
var oSigner = 'yield' + cryptoCommon.createObj('CAdESCOM.CPSigner'),
signerXML = 'yield' + cryptoCommon.createObj('CAdESCOM.SignedXML'),
cnts = cryptoConstants,
@ -498,7 +498,7 @@ function getSystemInfo() {
var sysInfo = cryptoCommon.getEnvInfo();
return new Promise(function (resolve, reject) {
eval(cryptoCommon.generateAsyncFn(function () {
eval(cryptoCommon.generateAsyncFn(function getSystemInfo() {
var e;
try {

View File

@ -39,10 +39,11 @@ var subjectNameTagsTranslations = [
function generateAsyncFn(cb) {
var canAsync = cadesplugin.CreateObjectAsync;
var dynamicScriptName = cb.name || 'asyncFn';
cb = String(cb);
var args = cb.match(/^function\s*?\((.*?)\)/);
var args = cb.match(/^function[\s\w]*?\((.*?)\)/);
args = (args && args[1]) || '';
@ -61,9 +62,9 @@ function generateAsyncFn(cb) {
cb = cb.replace(/propset_(.*?)\((.*?)\)/gm, '$1 = $2');
}
return canAsync ?
return (canAsync ?
'cadesplugin.async_spawn(' + cb + ');'
: '(' + cb + ')();';
: '(' + cb + ')();') + '//# sourceURL=evaled-' + dynamicScriptName + '.js';
}
/**