Fixed bugs in IE11

This commit is contained in:
Braydon Fuller 2015-01-05 23:27:20 -05:00
parent a801663c6d
commit ff4a6f549d
7 changed files with 14 additions and 6 deletions

View File

@ -100,15 +100,17 @@ function Address(data, network, type) {
* @returns {Object} An "info" object with "type", "network", and "hashBuffer"
*/
Address.prototype._classifyArguments = function(data, network, type) {
var PublicKey = require('./publickey');
var Script = require('./script');
/* jshint maxcomplexity: 10 */
// transform and validate input data
if ((data instanceof Buffer || data instanceof Uint8Array) && data.length === 20) {
return Address._transformHash(data);
} else if ((data instanceof Buffer || data instanceof Uint8Array) && data.length === 21) {
return Address._transformBuffer(data, network, type);
} else if (data.constructor && (data.constructor.name && data.constructor.name === 'PublicKey')) {
} else if (data instanceof PublicKey) {
return Address._transformPublicKey(data);
} else if (data.constructor && (data.constructor.name && data.constructor.name === 'Script')) {
} else if (data instanceof Script) {
return Address._transformScript(data, network);
} else if (typeof(data) === 'string') {
return Address._transformString(data, network, type);

View File

@ -177,7 +177,6 @@ Script.fromString = function(str) {
Script.prototype.toString = function() {
var str = '';
for (var i = 0; i < this.chunks.length; i++) {
var chunk = this.chunks[i];
var opcodenum = chunk.opcodenum;
@ -459,7 +458,7 @@ Script.prototype._addByType = function(obj, prepend) {
this._addOpcode(obj, prepend);
} else if (typeof obj === 'number') {
this._addOpcode(obj, prepend);
} else if (obj.constructor && obj.constructor.name && obj.constructor.name === 'Opcode') {
} else if (obj instanceof Opcode) {
this._addOpcode(obj, prepend);
} else if (BufferUtil.isBuffer(obj)) {
this._addBuffer(obj, prepend);
@ -484,7 +483,7 @@ Script.prototype._addOpcode = function(opcode, prepend) {
var op;
if (typeof opcode === 'number') {
op = opcode;
} else if (opcode.constructor && opcode.constructor.name && opcode.constructor.name === 'Opcode') {
} else if (opcode instanceof Opcode) {
op = opcode.toNumber();
} else {
op = Opcode(opcode).toNumber();

View File

@ -8,6 +8,8 @@ var HDPrivateKey = bitcore.HDPrivateKey;
var xprivkey = 'xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi';
describe('HDKey cache', function() {
this.timeout(10000);
/* jshint unused: false */
var cache = bitcore._HDKeyCache;
var master = new HDPrivateKey(xprivkey);

View File

@ -1 +1,2 @@
--recursive
--timeout 5000

View File

@ -279,6 +279,8 @@ var bitpayRequest = new Buffer(''
describe('PaymentProtocol', function() {
this.timeout(15000);
it('should be able to create class', function() {
should.exist(PaymentProtocol);
});

View File

@ -84,6 +84,7 @@ describe('Transaction', function() {
});
describe('transaction creation test vector', function() {
this.timeout(5000);
var index = 0;
transactionVector.forEach(function(vector) {
index++;

View File

@ -52,7 +52,8 @@ describe('preconditions', function() {
$.checkArgumentType(1, PrivateKey);
} catch (e) {
error = e;
e.message.should.equal('Invalid Argument for (unknown name), expected PrivateKey but got number');
var fail = !(~e.message.indexOf('Invalid Argument for (unknown name)'));
fail.should.equal(false);
}
should.exist(error);
});