Created
January 22, 2018 23:09
-
-
Save nolanlawson/ad5f72ce9fff7f27d65e1cc19599e9d4 to your computer and use it in GitHub Desktop.
Repro Edge blob URL non-array as first argument
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Blob test</title> | |
</head> | |
<body> | |
<button type=button onclick="runTest()">Run test</button> | |
<pre id=display></pre> | |
<script src="script.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
function equals$1(x, y) { | |
// Optimization if they are referencially equal | |
if (x === y) { | |
return true; | |
} else if (x == null) { | |
return y == null; | |
} else if (y == null) { | |
return false; | |
} else if (typeof x !== "object" || typeof y !== "object") { | |
return x === y; | |
// Equals override or IEquatable implementation | |
} else if (typeof x.Equals === "function") { | |
return x.Equals(y); | |
} else if (typeof y.Equals === "function") { | |
return y.Equals(x); | |
} else if (Object.getPrototypeOf(x) !== Object.getPrototypeOf(y)) { | |
return false; | |
} else if (Array.isArray(x)) { | |
if (x.length !== y.length) { | |
return false; | |
} | |
for (let i = 0; i < x.length; i++) { | |
if (!equals$1(x[i], y[i])) { | |
return false; | |
} | |
} | |
return true; | |
} else if (ArrayBuffer.isView(x)) { | |
if (x.byteLength !== y.byteLength) { | |
return false; | |
} | |
const dv1 = new DataView(x.buffer); | |
const dv2 = new DataView(y.buffer); | |
for (let i = 0; i < x.byteLength; i++) { | |
if (dv1.getUint8(i) !== dv2.getUint8(i)) { | |
return false; | |
} | |
} | |
return true; | |
} else if (x instanceof Date) { | |
return x.getTime() === y.getTime(); | |
} else { | |
return false; | |
} | |
} | |
function comparePrimitives(x, y) { | |
return x === y ? 0 : x < y ? -1 : 1; | |
} | |
function compare$2(x, y) { | |
// Optimization if they are referencially equal | |
if (x === y) { | |
return 0; | |
} else if (x == null) { | |
return y == null ? 0 : -1; | |
} else if (y == null) { | |
return 1; // everything is bigger than null | |
} else if (typeof x !== "object" || typeof y !== "object") { | |
return x === y ? 0 : x < y ? -1 : 1; | |
// Some types (see Long.ts) may just implement the function and not the interface | |
// else if (hasInterface(x, "System.IComparable")) | |
} else if (typeof x.CompareTo === "function") { | |
return x.CompareTo(y); | |
} else if (typeof y.CompareTo === "function") { | |
return y.CompareTo(x) * -1; | |
} else if (Object.getPrototypeOf(x) !== Object.getPrototypeOf(y)) { | |
return -1; | |
} else if (Array.isArray(x)) { | |
if (x.length !== y.length) { | |
return x.length < y.length ? -1 : 1; | |
} | |
for (let i = 0, j = 0; i < x.length; i++) { | |
j = compare$2(x[i], y[i]); | |
if (j !== 0) { | |
return j; | |
} | |
} | |
return 0; | |
} else if (ArrayBuffer.isView(x)) { | |
if (x.byteLength !== y.byteLength) { | |
return x.byteLength < y.byteLength ? -1 : 1; | |
} | |
const dv1 = new DataView(x.buffer); | |
const dv2 = new DataView(y.buffer); | |
for (let i = 0, b1 = 0, b2 = 0; i < x.byteLength; i++) { | |
b1 = dv1.getUint8(i), b2 = dv2.getUint8(i); | |
if (b1 < b2) { | |
return -1; | |
} | |
if (b1 > b2) { | |
return 1; | |
} | |
} | |
return 0; | |
} else if (x instanceof Date) { | |
return compare$1(x, y); | |
} else if (typeof x === "object") { | |
const xhash = hash(x); | |
const yhash = hash(y); | |
if (xhash === yhash) { | |
return equals$1(x, y) ? 0 : -1; | |
} else { | |
return xhash < yhash ? -1 : 1; | |
} | |
} else { | |
return x < y ? -1 : 1; | |
} | |
} | |
function equalsRecords(x, y) { | |
// Optimization if they are referencially equal | |
if (x === y) { | |
return true; | |
} else { | |
const keys = getPropertyNames(x); | |
for (const key of keys) { | |
if (!equals$1(x[key], y[key])) { | |
return false; | |
} | |
} | |
return true; | |
} | |
} | |
function compareRecords(x, y) { | |
// Optimization if they are referencially equal | |
if (x === y) { | |
return 0; | |
} else { | |
const keys = getPropertyNames(x); | |
for (const key of keys) { | |
const res = compare$2(x[key], y[key]); | |
if (res !== 0) { | |
return res; | |
} | |
} | |
return 0; | |
} | |
} | |
function equalsUnions(x, y) { | |
return x === y || x.tag === y.tag && equals$1(x.data, y.data); | |
} | |
function compareUnions(x, y) { | |
if (x === y) { | |
return 0; | |
} else { | |
const res = x.tag < y.tag ? -1 : x.tag > y.tag ? 1 : 0; | |
return res !== 0 ? res : compare$2(x.data, y.data); | |
} | |
} | |
function ofArray(args, base) { | |
let acc = base || new List$1(); | |
for (let i = args.length - 1; i >= 0; i--) { | |
acc = new List$1(args[i], acc); | |
} | |
return acc; | |
} | |
class List { | |
constructor(head, tail) { | |
this.head = head; | |
this.tail = tail; | |
} | |
ToString() { | |
return "[" + Array.from(this).map(x => toString$1(x)).join("; ") + "]"; | |
} | |
Equals(other) { | |
// Optimization if they are referencially equal | |
if (this === other) { | |
return true; | |
} else { | |
let cur1 = this; | |
let cur2 = other; | |
while (equals$1(cur1.head, cur2.head)) { | |
cur1 = cur1.tail; | |
cur2 = cur2.tail; | |
if (cur1 == null) { | |
return cur2 == null; | |
} | |
} | |
return false; | |
} | |
} | |
CompareTo(other) { | |
// Optimization if they are referencially equal | |
if (this === other) { | |
return 0; | |
} else { | |
let cur1 = this; | |
let cur2 = other; | |
let res = compare$2(cur1.head, cur2.head); | |
while (res === 0) { | |
cur1 = cur1.tail; | |
cur2 = cur2.tail; | |
if (cur1 == null) { | |
return cur2 == null ? 0 : -1; | |
} | |
res = compare$2(cur1.head, cur2.head); | |
} | |
return res; | |
} | |
} | |
get length() { | |
let cur = this; | |
let acc = 0; | |
while (cur.tail != null) { | |
cur = cur.tail; | |
acc++; | |
} | |
return acc; | |
} | |
[Symbol.iterator]() { | |
let cur = this; | |
return { | |
next: () => { | |
const tmp = cur; | |
cur = cur.tail; | |
return { done: tmp.tail == null, value: tmp.head }; | |
} | |
}; | |
} | |
} | |
window.runTest = () => { | |
var list = new List(['hello', 'world']) | |
try { | |
var blob = new Blob(list, {type: 'text/plain'}) | |
var url = URL.createObjectURL(blob) | |
document.getElementById('display').textContent = 'Created URL: ' + url | |
} catch (e) { | |
document.getElementById('display').textContent = e.name + ' ' + e.message | |
} | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment