Merge pull request #10 from pyoor/master

Multiple Bug Fixes
This commit is contained in:
Christoph Diehl 2017-04-24 20:06:43 +03:00 committed by GitHub
commit f6eda46d60
6 changed files with 72 additions and 30 deletions

View file

@ -47,7 +47,7 @@ make.fonts = {
} }
s += make.fonts.fontSize(); s += make.fonts.fontSize();
s += " "; s += " ";
s += Make.fonts.fontFamily(); s += make.fonts.fontFamily();
return "'" + s + "'"; return "'" + s + "'";
} }
}; };

View file

@ -3,28 +3,70 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
make.mime = { make.mime = {
type: function () { types: function () {
return random.pick([
make.mime.standard,
make.mime.xml,
make.mime.image,
make.mime.media,
make.mime.form
]);
},
standard: function () {
return random.pick([ return random.pick([
"text/html", "text/html",
"text/html; charset=utf-8",
"text/plain", "text/plain",
"text/css", "text/css",
"text/javascript", "text/javascript",
"image/jpeg", "foo/bar",
"image/gif",
"image/png",
"application/rss+xml",
"application/vnd.mozilla.xul+xml",
"application/xhtml+xml",
"application/octet-stream", "application/octet-stream",
"application/x-shockwave-flash", "application/x-shockwave-flash",
"application/x-test", "application/x-test",
]);
},
xml: function () {
return random.pick([
"application/xml",
"text/xml",
"application/xhtml+xml",
"image/svg+xml",
"application/vnd.mozilla.xul+xml",
"application/rss+xml",
"application/rdf+xml",
"application/xslt+xml",
]);
},
image: function () {
return random.pick([
"image/jpeg",
"image/gif",
"image/png",
"image/mng",
"image/*",
]);
},
media: function () {
return random.pick([
"audio/mpeg", "audio/mpeg",
"audio/ogg", "audio/ogg",
"audio/ogg; codecs=vorbis", "audio/ogg; codecs=vorbis",
"video/ogg", "video/ogg",
'video/ogg; codecs="theora,vorbis"', "video/ogg; codecs=\"theora, vorbis\"",
"video/mp4", "video/mp4",
'video/mp4; codecs="avc1.42E01E,mp4a.40.2"' "video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"",
]); ]);
} },
form: function () {
return random.pick([
"application/x-www-form-urlencoded",
"multipart/form-data",
"text/plain"
]);
},
}; };

View file

@ -39,7 +39,7 @@ make.network = {
].join("\n"); ].join("\n");
}, },
PeerConnectionProtocols: function () { PeerConnectionProtocols: function () {
return ["turn", "turns", "stun", "stuns"] return ["turn", "turns", "stun", "stuns"];
}, },
randomIPv4: function () { randomIPv4: function () {
return random.pick([random.number(255), make.numbers.number]) + "." + return random.pick([random.number(255), make.numbers.number]) + "." +
@ -48,15 +48,15 @@ make.network = {
random.pick([random.number(255), make.numbers.number]); random.pick([random.number(255), make.numbers.number]);
}, },
randomIPv6: function () { randomIPv6: function () {
return "[" + make.stringFromBlocks([":", function () { return "[" + make.strings.stringFromBlocks([":", function () {
return make.strings.digitsHex(random.range(1, 4)) return make.strings.digitsHex(random.range(1, 4));
}]) + "]" }]) + "]";
}, },
goodHostnames: function () { goodHostnames: function () {
return [ return [
"0.0.0.0", "0.0.0.0",
"127.0.0.1:8080", "127.0.0.1:8080",
] ];
}, },
badHostnames: function () { badHostnames: function () {
return [ return [
@ -71,7 +71,7 @@ make.network = {
"::ffff:192.0.2.128", "::ffff:192.0.2.128",
"2001:db8::1:2", "2001:db8::1:2",
"2001:db8::1:1:1:1:1" "2001:db8::1:1:1:1:1"
] ];
}, },
randomBitmask: function (list) { randomBitmask: function (list) {
if (list.length <= 1) { if (list.length <= 1) {

View file

@ -44,13 +44,13 @@ make.numbers = {
return Math.pow(2, random.number(65)) + random.number(3) - 1; return Math.pow(2, random.number(65)) + random.number(3) - 1;
}, },
evenNumber: function (number) { evenNumber: function (number) {
return number % 2 == 1 ? ++number : number; return number % 2 === 1 ? ++number : number;
}, },
number: function () { number: function () {
let value = random.choose([ let value = random.choose([
[10, make.numbers.float], [10, make.numbers.float],
[10, [make.numbers.rangeNumber, make.numbers.tinyNumber]], [10, [make.numbers.rangeNumber, make.numbers.tinyNumber]],
[1, Make.numbers.unsignedNumber] [1, make.numbers.unsignedNumber]
]); ]);
return random.chance(10) ? -value : value; return random.chance(10) ? -value : value;
} }

View file

@ -4,7 +4,7 @@
make.strings = { make.strings = {
toString: function (object) { toString: function (object) {
return object ? object.toSource() : '' + object return object ? object.toSource() : '' + object;
}, },
string: function (maxlen) { string: function (maxlen) {
let s = ""; let s = "";
@ -15,7 +15,7 @@ make.strings = {
for (let i = 0; i < maxlen; i++) { for (let i = 0; i < maxlen; i++) {
//s += String.fromCodePoint(Random.pick(make.fonts.layoutCharCodes)); //s += String.fromCodePoint(Random.pick(make.fonts.layoutCharCodes));
s += "A" s += "A";
} }
return s; return s;

View file

@ -120,13 +120,13 @@ make.text = {
[0x1D17B, 0x1D18B], [0x1D17B, 0x1D18B],
[0x1D1AA, 0x1D1AD], [0x1D1AA, 0x1D1AD],
[0x1D242, 0x1D244] [0x1D242, 0x1D244]
]) ]);
}, },
unicodeBMP: function () { unicodeBMP: function () {
return random.item([ return random.item([
// BMP = Basic Multilingual Plane // BMP = Basic Multilingual Plane
[0x0000, 0xFFFF] [0x0000, 0xFFFF]
]) ]);
}, },
unicodeSMP: function () { unicodeSMP: function () {
return random.item([ return random.item([
@ -136,20 +136,20 @@ make.text = {
[0x1B000, 0x1BFFF], [0x1B000, 0x1BFFF],
[0x1D000, 0x1DFFF], [0x1D000, 0x1DFFF],
[0x1F000, 0x1FFFF] [0x1F000, 0x1FFFF]
]) ]);
}, },
unicodeSIP: function () { unicodeSIP: function () {
return random.item([ return random.item([
// SIP = Supplementary Ideographic Plane // SIP = Supplementary Ideographic Plane
[0x20000, 0x2BFFF], [0x20000, 0x2BFFF],
[0x2F000, 0x2FFFF] [0x2F000, 0x2FFFF]
]) ]);
}, },
unicodeSSP: function () { unicodeSSP: function () {
return random.item([ return random.item([
// SSP = Supplementary Special-purpose Plane // SSP = Supplementary Special-purpose Plane
[0xE0000, 0xE0FFF] [0xE0000, 0xE0FFF]
]) ]);
}, },
registeredFontFeatures: function () { registeredFontFeatures: function () {
return random.pick([ return random.pick([
@ -168,23 +168,23 @@ make.text = {
'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20', 'subs', 'sups', 'ss14', 'ss15', 'ss16', 'ss17', 'ss18', 'ss19', 'ss20', 'subs', 'sups',
'swsh', 'titl', 'tjmo', 'tnam', 'tnum', 'trad', 'twid', 'unic', 'valt', 'swsh', 'titl', 'tjmo', 'tnam', 'tnum', 'trad', 'twid', 'unic', 'valt',
'vatu', 'vert', 'vhal', 'vjmo', 'vkna', 'vkrn', 'vpal', 'vrt2', 'zero' 'vatu', 'vert', 'vhal', 'vjmo', 'vkna', 'vkrn', 'vpal', 'vrt2', 'zero'
]) ]);
}, },
assignmentOperator: function () { assignmentOperator: function () {
return random.pick([ return random.pick([
"=", "-=", "+=", "*=", "/=" "=", "-=", "+=", "*=", "/="
]) ]);
}, },
arithmeticOperator: function () { arithmeticOperator: function () {
return random.pick([ return random.pick([
"%", "-", "+", "*", "/" "%", "-", "+", "*", "/"
]) ]);
}, },
currency: function () { currency: function () {
return random.pick([ return random.pick([
// https://en.wikipedia.org/wiki/ISO_4217 // https://en.wikipedia.org/wiki/ISO_4217
"USD", "USS", "USN", "EUR", "CHF", "GBP", "XAG", "XBA", "XBB", "XBC", "USD", "USS", "USN", "EUR", "CHF", "GBP", "XAG", "XBA", "XBB", "XBC",
"XBD", "XSU", "XTS", "XXX", "XBD", "XSU", "XTS", "XXX",
]) ]);
}, },
}; };