рефакторинг

This commit is contained in:
vgoma 2017-11-29 12:50:54 +03:00
parent 825b765a86
commit ce55951de8
6 changed files with 35 additions and 31 deletions

20
dist/1.crypto-pro.js vendored
View File

@ -604,18 +604,20 @@ webpackJsonpCryptoPro([1],[
];
function execute(cb) {
cb = String(cb);
var args = cb.match(/^function\s*?\((.*?)\)/);
args = (args && args[1]) || '';
function GeneratorFunction() {
return (new Function('', 'return Object.getPrototypeOf(function*(){}).constructor'))();
}
if (cadesplugin.CreateObjectAsync) {
var GeneratorFunction = (new Function('', 'return Object.getPrototypeOf(function*(){}).constructor'))();
cb = String(cb);
var args = cb.match(/^function\s*?\((.*?)\)/);
args = (args && args[1]) || '';
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
cb = String(new GeneratorFunction(args, cb));
cb = String(new (GeneratorFunction())(args, cb));
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'cadesplugin.CreateObjectAsync$1');
cb = cb.replace(/("|')(yield)(\1)\s*?\+\s*?\b/gm, '$2 ');

File diff suppressed because one or more lines are too long

20
dist/2.crypto-pro.js vendored
View File

@ -47,18 +47,20 @@ webpackJsonpCryptoPro([2],[
];
function execute(cb) {
cb = String(cb);
var args = cb.match(/^function\s*?\((.*?)\)/);
args = (args && args[1]) || '';
function GeneratorFunction() {
return (new Function('', 'return Object.getPrototypeOf(function*(){}).constructor'))();
}
if (cadesplugin.CreateObjectAsync) {
var GeneratorFunction = (new Function('', 'return Object.getPrototypeOf(function*(){}).constructor'))();
cb = String(cb);
var args = cb.match(/^function\s*?\((.*?)\)/);
args = (args && args[1]) || '';
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
cb = String(new GeneratorFunction(args, cb));
cb = String(new (GeneratorFunction())(args, cb));
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'cadesplugin.CreateObjectAsync$1');
cb = cb.replace(/("|')(yield)(\1)\s*?\+\s*?\b/gm, '$2 ');

File diff suppressed because one or more lines are too long

View File

@ -2,8 +2,6 @@
'use strict';
var $certs = document.querySelector('#certList');
window.CryptoPro.call('isValidEDSSettings');
/**
* Пример получения списка сертификатов

View File

@ -38,18 +38,20 @@ var subjectNameTagsTranslations = [
];
function execute(cb) {
cb = String(cb);
var args = cb.match(/^function\s*?\((.*?)\)/);
args = (args && args[1]) || '';
function GeneratorFunction() {
return (new Function('', 'return Object.getPrototypeOf(function*(){}).constructor'))();
}
if (cadesplugin.CreateObjectAsync) {
var GeneratorFunction = (new Function('', 'return Object.getPrototypeOf(function*(){}).constructor'))();
cb = String(cb);
var args = cb.match(/^function\s*?\((.*?)\)/);
args = (args && args[1]) || '';
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
cb = String(new GeneratorFunction(args, cb));
cb = String(new (GeneratorFunction())(args, cb));
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'cadesplugin.CreateObjectAsync$1');
cb = cb.replace(/("|')(yield)(\1)\s*?\+\s*?\b/gm, '$2 ');