AngleSharp.Js
AngleSharp.Js copied to clipboard
Wrong Version Jinit requested
when try to loading Configuration.Default.WithJs() on .net core 3.1 it will say "Could not load file or assembly" jinit Version = 2.10.4.0 ... The located assembly's manifest definition dose not match the assembly reference.
Atm is installed Jinit 2.11.58 on system (it installed by it self when installed AngleSharp.Js from nuget)
@FlorianRappl Do you plan to switch to new version of jint?
Yes, but so far a lot of internal things changed. So my intention was to change to 3.0.0 once available.
But I'm happy to have another look at the last 2.x version, too - if really urgent.
I probably could have a look at this at some point. This seems like an interesting case of integrating the engine and 3.x series of Jint indeed has tons more functionality and fixes.
Fully agreed @lahma !
I've created a PR on Jint side which tries to build better support for your use case, basically ability to have custom BrowserHost
or something similar that's more plug&play solution allowing you to redefine Global (as Window in this case).
I'll use AngleSharp.Js as guinea pig for testing the API and possibilities. This might take some time before completion as it's only a side projects among many others...
That sounds really great. I'd love to help you there. Is there something I can do out of the box (can also be some stories that are left to pick up at Jint's side; maybe I can get into that project a bit)?
Thanks for everything @lahma ! 🍻
If you have usage stories about what is currently missing/impossible that would of course help. At this first stage I'm trying to build the current functionality on top of this new host/realm concept and everything that might affect API + needed functionality will always help.
Probably best scenario is emulate a real "chrome" browser need to add missing class on anglesharp.js (navigator, history, window) not need real behaviour just emulation to bypass javascript scripts
Probably best scenario is emulate a real "chrome" browser need to add missing class on anglesharp.js (navigator, history, window) not need real behaviour just emulation to bypass javascript scripts
We have this in most parts. The largest missing part is the layouting API, which is also hard to emulate (we can always spit out some values here, but usually the JS libs that call these APIs have some constraints in mind and wouldn't be tricked so easily).
We've also improved c# interop quite a lot so at times might help to expose plain object instance too (and then open a lot of bugs when things go wrong).
just example of some test that you can check that not work as should be (compared with chrome results), other user case is bypass akam (https://github.com/OXDBXKXO/akamai-toolkit/blob/master/scripts/akamai-1.68-nike.js) If js can bypass all this test I think not exist any issue in normal scenario, cause all this tests are to check if is real js client :D
/**
* Canvas Fingerprint
*/
var _getCanvasFingerprint = function () {
try {
var canvas = document.createElement("canvas");
if (canvas.getContext && canvas.getContext("2d")) {
canvas.width = 300,
canvas.height = 200,
canvas.style.display = "inline";
var ctxContext = "2d";
var ctx = canvas.getContext(ctxContext);
// Create Shapes
ctx.rect(0, 0, 10, 10),
ctx.rect(2, 2, 6, 6),
ctx.textBaseline = "alphabetic",
ctx.fillStyle = "#f60",
ctx.fillRect(125, 1, 62, 20);
// Create Text
ctx.fillStyle = "#069",
ctx.font = "11pt Arial",
ctx.fillText("F1f4 Ult1m@t3 Team, \u26bd", 2, 15);
ctx.fillStyle = "rgba(102, 204, 0, 0.2)",
ctx.font = "18pt Arial",
ctx.fillText("F1f4 Ult1m@t3 Team, \u26bd", 4, 45);
ctx.globalCompositeOperation = "multiply",
ctx.fillStyle = "rgb(255,0,255)";
// Create Shapes
ctx.beginPath(),
ctx.arc(50, 50, 50, 0, Math.PI * 2, true),
ctx.closePath(),
ctx.fill(),
ctx.fillStyle = "rgb(0,255,255)";
ctx.beginPath(),
ctx.arc(100, 50, 50, 0, Math.PI * 2, true),
ctx.closePath(),
ctx.fill(),
ctx.fillStyle = "rgb(255,255,0)";
ctx.beginPath(),
ctx.arc(75, 100, 50, 0, Math.PI * 2, true),
ctx.closePath(),
ctx.fill(),
ctx.fillStyle = "rgb(255,0,255)";
return ((canvas.toDataURL())) || -1;
}
} catch (e) {
// Error when creating the Canvas objects
return "-1";
}
// Canvas not available in the browser
return "-2";
};
/**
* VM Detection based on Performance Speed
*/
var _getPerformanceSpeed = function () {
function e(n, t) {
if (n < 1e-8) {
return t;
} else if (n < t) {
return e(t - Math.floor(t / n) * n, n);
} else if (n == t) {
return n;
} else {
return e(t, n);
}
}
try {
for (var n = performance.now() / 1000, t = performance.now() / 1000 - n, r = 0; r < 10; r++) {
t = e(t, performance.now() / 1000 - n);
}
return Math.round(1 / t);
} catch (e) {
return -1;
}
};
/**
* GPU Vendor and Renderer Information
*/
var _getGpuInformation = function () {
try {
var canvas = document.createElement("canvas");
if (canvas.getContext && canvas.getContext("webgl")) {
var gl = canvas.getContext("webgl");
var debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
return {
"v": gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL),
"r": gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL)
};
} else {
return {
"v": "-2",
"r": "-2"
};
}
} catch (e) {
return {
"v": "-1",
"r": "-1"
};
}
};
/**
* Browser Information
*/
var _getBrowserInformation = function () {
var windowSize = [
window.innerHeight || -1,
window.outerHeight || -1,
window.outerWidth || -1,
window.innerWidth || -1,
window.screenX || -1,
document.body.clientWidth || -1,
document.body.clientHeight || -1,
screen.width || -1,
screen.height || -1,
screen.availWidth || -1,
screen.availHeight || -1,
screen.colorDepth || -1,
screen.pixelDepth || -1,
window.devicePixelRatio || -1
];
return {
"ua": navigator.userAgent || -1,
"hc": navigator.hardwareConcurrency || -1,
"ps": navigator.productSub || -1,
"tz": (new Date).getTimezoneOffset(),
"ev": (window.eval && window.eval.toString().length) || -1,
"hi": (window.history && window.history.length) || -1,
"ws": windowSize.join(",")
};
};
/**
* Supported Browser Font List
*/
var _getSupportedFontList = function () {
var baseFonts = ["monospace", "sans-serif", "serif"];
var fontList = [
"Andale Mono", "Arial", "Arial Black", "Arial Hebrew", "Arial MT", "Arial Narrow", "Arial Rounded MT Bold", "Arial Unicode MS",
"Bitstream Vera Sans Mono", "Book Antiqua", "Bookman Old Style",
"Calibri", "Cambria", "Cambria Math", "Century", "Century Gothic", "Century Schoolbook", "Comic Sans", "Comic Sans MS", "Consolas", "Courier", "Courier New",
"Geneva", "Georgia",
"Helvetica", "Helvetica Neue",
"Impact",
"Lucida Bright", "Lucida Calligraphy", "Lucida Console", "Lucida Fax", "LUCIDA GRANDE", "Lucida Handwriting", "Lucida Sans", "Lucida Sans Typewriter", "Lucida Sans Unicode",
"Microsoft Sans Serif", "Monaco", "Monotype Corsiva", "MS Gothic", "MS Outlook", "MS PGothic", "MS Reference Sans Serif", "MS Sans Serif", "MS Serif", "MYRIAD", "MYRIAD PRO",
"Palatino", "Palatino Linotype",
"Segoe Print", "Segoe Script", "Segoe UI", "Segoe UI Light", "Segoe UI Semibold", "Segoe UI Symbol",
"Tahoma", "Times", "Times New Roman", "Times New Roman PS", "Trebuchet MS",
"Verdana", "Wingdings", "Wingdings 2", "Wingdings 3",
"Abadi MT Condensed Light", "Academy Engraved LET", "ADOBE CASLON PRO", "Adobe Garamond", "ADOBE GARAMOND PRO", "Agency FB", "Aharoni", "Albertus Extra Bold", "Albertus Medium", "Algerian", "Amazone BT", "American Typewriter",
"American Typewriter Condensed", "AmerType Md BT", "Andalus", "Angsana New", "AngsanaUPC", "Antique Olive", "Aparajita", "Apple Chancery", "Apple Color Emoji", "Apple SD Gothic Neo", "Arabic Typesetting", "ARCHER",
"ARNO PRO", "Arrus BT", "Aurora Cn BT", "AvantGarde Bk BT", "AvantGarde Md BT", "AVENIR", "Ayuthaya", "Bandy", "Bangla Sangam MN", "Bank Gothic", "BankGothic Md BT", "Baskerville",
"Baskerville Old Face", "Batang", "BatangChe", "Bauer Bodoni", "Bauhaus 93", "Bazooka", "Bell MT", "Bembo", "Benguiat Bk BT", "Berlin Sans FB", "Berlin Sans FB Demi", "Bernard MT Condensed", "BernhardFashion BT", "BernhardMod BT", "Big Caslon", "BinnerD",
"Blackadder ITC", "BlairMdITC TT", "Bodoni 72", "Bodoni 72 Oldstyle", "Bodoni 72 Smallcaps", "Bodoni MT", "Bodoni MT Black", "Bodoni MT Condensed", "Bodoni MT Poster Compressed",
"Bookshelf Symbol 7", "Boulder", "Bradley Hand", "Bradley Hand ITC", "Bremen Bd BT", "Britannic Bold", "Broadway", "Browallia New", "BrowalliaUPC", "Brush Script MT", "Californian FB", "Calisto MT", "Calligrapher", "Candara",
"CaslonOpnface BT", "Castellar", "Centaur", "Cezanne", "CG Omega", "CG Times", "Chalkboard", "Chalkboard SE", "Chalkduster", "Charlesworth", "Charter Bd BT", "Charter BT", "Chaucer",
"ChelthmITC Bk BT", "Chiller", "Clarendon", "Clarendon Condensed", "CloisterBlack BT", "Cochin", "Colonna MT", "Constantia", "Cooper Black", "Copperplate", "Copperplate Gothic", "Copperplate Gothic Bold",
"Copperplate Gothic Light", "CopperplGoth Bd BT", "Corbel", "Cordia New", "CordiaUPC", "Cornerstone", "Coronet", "Cuckoo", "Curlz MT", "DaunPenh", "Dauphin", "David", "DB LCD Temp", "DELICIOUS", "Denmark",
"DFKai-SB", "Didot", "DilleniaUPC", "DIN", "DokChampa", "Dotum", "DotumChe", "Ebrima", "Edwardian Script ITC", "Elephant", "English 111 Vivace BT", "Engravers MT", "EngraversGothic BT", "Eras Bold ITC", "Eras Demi ITC", "Eras Light ITC", "Eras Medium ITC",
"EucrosiaUPC", "Euphemia", "Euphemia UCAS", "EUROSTILE", "Exotc350 Bd BT", "FangSong", "Felix Titling", "Fixedsys", "FONTIN", "Footlight MT Light", "Forte",
"FrankRuehl", "Fransiscan", "Freefrm721 Blk BT", "FreesiaUPC", "Freestyle Script", "French Script MT", "FrnkGothITC Bk BT", "Fruitger", "FRUTIGER",
"Futura", "Futura Bk BT", "Futura Lt BT", "Futura Md BT", "Futura ZBlk BT", "FuturaBlack BT", "Gabriola", "Galliard BT", "Gautami", "Geeza Pro", "Geometr231 BT", "Geometr231 Hv BT", "Geometr231 Lt BT", "GeoSlab 703 Lt BT",
"GeoSlab 703 XBd BT", "Gigi", "Gill Sans", "Gill Sans MT", "Gill Sans MT Condensed", "Gill Sans MT Ext Condensed Bold", "Gill Sans Ultra Bold", "Gill Sans Ultra Bold Condensed", "Gisha", "Gloucester MT Extra Condensed", "GOTHAM", "GOTHAM BOLD",
"Goudy Old Style", "Goudy Stout", "GoudyHandtooled BT", "GoudyOLSt BT", "Gujarati Sangam MN", "Gulim", "GulimChe", "Gungsuh", "GungsuhChe", "Gurmukhi MN", "Haettenschweiler", "Harlow Solid Italic", "Harrington", "Heather", "Heiti SC", "Heiti TC", "HELV",
"Herald", "High Tower Text", "Hiragino Kaku Gothic ProN", "Hiragino Mincho ProN", "Hoefler Text", "Humanst 521 Cn BT", "Humanst521 BT", "Humanst521 Lt BT", "Imprint MT Shadow", "Incised901 Bd BT", "Incised901 BT",
"Incised901 Lt BT", "INCONSOLATA", "Informal Roman", "Informal011 BT", "INTERSTATE", "IrisUPC", "Iskoola Pota", "JasmineUPC", "Jazz LET", "Jenson", "Jester", "Jokerman", "Juice ITC", "Kabel Bk BT", "Kabel Ult BT", "Kailasa", "KaiTi", "Kalinga", "Kannada Sangam MN",
"Kartika", "Kaufmann Bd BT", "Kaufmann BT", "Khmer UI", "KodchiangUPC", "Kokila", "Korinna BT", "Kristen ITC", "Krungthep", "Kunstler Script", "Lao UI", "Latha", "Leelawadee", "Letter Gothic", "Levenim MT", "LilyUPC", "Lithograph", "Lithograph Light", "Long Island",
"Lydian BT", "Magneto", "Maiandra GD", "Malayalam Sangam MN", "Malgun Gothic",
"Mangal", "Marigold", "Marion", "Marker Felt", "Market", "Marlett", "Matisse ITC", "Matura MT Script Capitals", "Meiryo", "Meiryo UI", "Microsoft Himalaya", "Microsoft JhengHei", "Microsoft New Tai Lue", "Microsoft PhagsPa", "Microsoft Tai Le",
"Microsoft Uighur", "Microsoft YaHei", "Microsoft Yi Baiti", "MingLiU", "MingLiU_HKSCS", "MingLiU_HKSCS-ExtB", "MingLiU-ExtB", "Minion", "Minion Pro", "Miriam", "Miriam Fixed", "Mistral", "Modern", "Modern No. 20", "Mona Lisa Solid ITC TT", "Mongolian Baiti",
"MONO", "MoolBoran", "Mrs Eaves", "MS LineDraw", "MS Mincho", "MS PMincho", "MS Reference Specialty", "MS UI Gothic", "MT Extra", "MUSEO", "MV Boli",
"Nadeem", "Narkisim", "NEVIS", "News Gothic", "News GothicMT", "NewsGoth BT", "Niagara Engraved", "Niagara Solid", "Noteworthy", "NSimSun", "Nyala", "OCR A Extended", "Old Century", "Old English Text MT", "Onyx", "Onyx BT", "OPTIMA", "Oriya Sangam MN",
"OSAKA", "OzHandicraft BT", "Palace Script MT", "Papyrus", "Parchment", "Party LET", "Pegasus", "Perpetua", "Perpetua Titling MT", "PetitaBold", "Pickwick", "Plantagenet Cherokee", "Playbill", "PMingLiU", "PMingLiU-ExtB",
"Poor Richard", "Poster", "PosterBodoni BT", "PRINCETOWN LET", "Pristina", "PTBarnum BT", "Pythagoras", "Raavi", "Rage Italic", "Ravie", "Ribbon131 Bd BT", "Rockwell", "Rockwell Condensed", "Rockwell Extra Bold", "Rod", "Roman", "Sakkal Majalla",
"Santa Fe LET", "Savoye LET", "Sceptre", "Script", "Script MT Bold", "SCRIPTINA", "Serifa", "Serifa BT", "Serifa Th BT", "ShelleyVolante BT", "Sherwood",
"Shonar Bangla", "Showcard Gothic", "Shruti", "Signboard", "SILKSCREEN", "SimHei", "Simplified Arabic", "Simplified Arabic Fixed", "SimSun", "SimSun-ExtB", "Sinhala Sangam MN", "Sketch Rockwell", "Skia", "Small Fonts", "Snap ITC", "Snell Roundhand", "Socket",
"Souvenir Lt BT", "Staccato222 BT", "Steamer", "Stencil", "Storybook", "Styllo", "Subway", "Swis721 BlkEx BT", "Swiss911 XCm BT", "Sylfaen", "Synchro LET", "System", "Tamil Sangam MN", "Technical", "Teletype", "Telugu Sangam MN", "Tempus Sans ITC",
"Terminal", "Thonburi", "Traditional Arabic", "Trajan", "TRAJAN PRO", "Tristan", "Tubular", "Tunga", "Tw Cen MT", "Tw Cen MT Condensed", "Tw Cen MT Condensed Extra Bold",
"TypoUpright BT", "Unicorn", "Univers", "Univers CE 55 Medium", "Univers Condensed", "Utsaah", "Vagabond", "Vani", "Vijaya", "Viner Hand ITC", "VisualUI", "Vivaldi", "Vladimir Script", "Vrinda", "Westminster", "WHITNEY", "Wide Latin",
"ZapfEllipt BT", "ZapfHumnst BT", "ZapfHumnst Dm BT", "Zapfino", "Zurich BlkEx BT", "Zurich Ex BT", "ZWAdobeF"
];
var testString = "mmmmwwwwwwlli";
var testSize = "72px";
var h = document.getElementsByTagName("body")[0];
var baseFontsDiv = document.createElement("div");
var defaultWidth = {};
var defaultHeight = {};
var createSpan = function () {
var s = document.createElement("span");
s.style.position = "absolute";
s.style.left = "-9999px";
s.style.fontSize = testSize;
s.style.fontStyle = "normal";
s.style.fontWeight = "normal";
s.style.letterSpacing = "normal";
s.style.lineBreak = "auto";
s.style.lineHeight = "normal";
s.style.textTransform = "none";
s.style.textAlign = "left";
s.style.textDecoration = "none";
s.style.textShadow = "none";
s.style.whiteSpace = "normal";
s.style.wordBreak = "normal";
s.style.wordSpacing = "normal";
s.innerHTML = testString;
return s;
};
var createSpanWithFonts = function (fontToDetect, baseFont) {
var s = createSpan();
s.style.fontFamily = "'" + fontToDetect + "'," + baseFont;
return s;
};
var initializeBaseFontsSpans = function () {
var spans = [];
for (var index = 0, length = baseFonts.length; index < length; index++) {
var s = createSpan();
s.style.fontFamily = baseFonts[index];
baseFontsDiv.appendChild(s);
spans.push(s);
}
return spans;
};
try {
var baseFontsSpans = initializeBaseFontsSpans();
h.appendChild(baseFontsDiv);
for (var index = 0, length = baseFonts.length; index < length; index++) {
defaultWidth[baseFonts[index]] = baseFontsSpans[index].offsetWidth;
defaultHeight[baseFonts[index]] = baseFontsSpans[index].offsetHeight;
}
// Check the available fonts
var available = [];
for (var i = 0, l = fontList.length; i < l; i++) {
var fontsDiv = document.createElement("div");
var fontSpans = [];
for (var j = 0, numDefaultFonts = baseFonts.length; j < numDefaultFonts; j++) {
var s = createSpanWithFonts(fontList[i], baseFonts[j]);
fontsDiv.appendChild(s);
fontSpans.push(s);
}
h.appendChild(fontsDiv);
for (j = 0; j < baseFonts.length; j++) {
if (fontSpans[j].offsetWidth !== defaultWidth[baseFonts[j]] || fontSpans[j].offsetHeight !== defaultHeight[baseFonts[j]]) {
available.push(i);
break;
}
}
h.removeChild(fontsDiv);
}
h.removeChild(baseFontsDiv);
return (available.join(","));
} catch (e) {
return "-1";
}
};
/**
* WebGL Fingerprint
*/
var _doWebGLFingerprint = function () {
var webGlFingerprint = {
"f": "-1",
"e": "-1"
};
try {
var canvas = document.createElement("canvas");
var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
if (!gl) {
return webGlFingerprint;
}
// Create Shaders
var vertexShaderSource = "attribute vec3 position;" +
"attribute vec3 normal;" +
"varying float vDot;" +
"uniform mat4 uProjection;" +
"uniform mat4 uView;" +
"attribute vec3 color;" +
"varying vec3 vColor;" +
"void main()" +
"{" +
" gl_Position = uProjection * uView * vec4(position, 1.0);" +
" vec3 light = normalize(vec3(0.3, 0.9, 0.7));" +
" vDot = max(dot(normalize(normal), light), 0.0); vColor = color;" +
"}";
var fragmentShaderSource = "precision mediump float;" +
"varying vec3 vColor;" +
"varying float vDot;" +
"void main()" +
"{" +
" gl_FragColor = vec4(vColor * vDot, 1.0);" +
"}";
var vShader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vShader, vertexShaderSource);
gl.compileShader(vShader);
var fShader = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fShader, fragmentShaderSource);
gl.compileShader(fShader);
var program = gl.createProgram();
gl.attachShader(program, vShader);
gl.attachShader(program, fShader);
gl.linkProgram(program);
gl.useProgram(program);
// Set Cube Vertices
var indices = new Uint8Array([0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 10, 11, 8, 9, 10]);
var vertices = new Float32Array([0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5]);
var normals = new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0]);
gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
var attributeLocation = gl.getAttribLocation(program, "position");
gl.vertexAttribPointer(attributeLocation, 3, gl.FLOAT, false, 0, 0);
gl.enableVertexAttribArray(attributeLocation);
gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
gl.bufferData(gl.ARRAY_BUFFER, normals, gl.STATIC_DRAW);
attributeLocation = gl.getAttribLocation(program, "normal");
gl.vertexAttribPointer(attributeLocation, 3, gl.FLOAT, false, 0, 0);
gl.enableVertexAttribArray(attributeLocation);
gl.bindBuffer(gl.ARRAY_BUFFER, null);
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, gl.createBuffer());
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);
// Set Camera
var uProjMatrix = gl.getUniformLocation(program, "uProjection");
gl.uniformMatrix4fv(uProjMatrix, false, [1.804047703742981, 0, 0, 0, 0, 1.804047703742981, 0, 0, 0, 0, -1.0004000663757324, -1, 0, 0, -0.20004001259803772, 0]);
var uViewMatrix = gl.getUniformLocation(program, "uView");
gl.uniformMatrix4fv(uViewMatrix, false, [0.7682213187217712, -0.31959936022758484, 0.5547001957893372, 0, 0, 0.8664694428443909, 0.49923014640808105, 0, -0.6401844024658203, -0.3835192322731018, 0.6656402349472046, 0, -1.1102230246251565e-16, -1.6653345369377348e-16, -1.8027756214141846, 1]);
var colorBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0]), gl.STATIC_DRAW);
gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer);
var color = gl.getAttribLocation(program, "color");
gl.vertexAttribPointer(color, 3, gl.FLOAT, false, 0, 0);
gl.enableVertexAttribArray(color);
gl.enable(gl.DEPTH_TEST);
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.drawElements(gl.TRIANGLES, 18, gl.UNSIGNED_BYTE, 0);
try {
return {
"f": gl.canvas.toDataURL(),
"e":(gl.getSupportedExtensions() || []).join(";")
};
} catch (e) {
return {
"f": "-2",
"e": "-2"
};
}
} catch (e) {
return webGlFingerprint;
}
};
Well, you use WebGL and Canvas. As I wrote @bbday layouting APIs are not implemented. Would be good if you read / understand first what I wrote. Its not about window, navigator or such APIs, but really about these painting mechanisms. This will also not change overall, as AngleSharp is just a browser core and not a browser.
We've also improved c# interop quite a lot so at times might help to expose plain object instance too (and then open a lot of bugs when things go wrong).
That's great @lahma, but the issue will be that names are different. We use special attributes to derive the official name (most are straight forward though, e.g., QuerySelector
(AngleSharp, C#) -> querySelector
(Jint, JS). If we would need new attributes (e.g., coming from Jint) then it would be impossible (as AngleSharp itself does not come with a JS engine / any dep). Best scenario is that Jint has something like a name converter, which can be set / overridden from the consuming library. Then AngleSharp.Js could "teach" Jint how to convert / normalize these names.
Thanks for the insights, plug-and-play name matcher has been a request before (whether to allow matching with first-lower or not) so this is a good reminder that there should be option to define such matcher strategy with ability to write the logic however wanted.
Just and update after some hibernation, I haven't forgotten this issue, there's just a lot to do in this world. So far I've tried some migration and opened some PRs to improve the interop story, AngleSharp.JS brilliant this way that it's true interop in JS sense.
- we can now expose members with custom name(s): https://github.com/sebastienros/jint/pull/974
- supporting value coercion which is expected when AngleSharp plays with JS rules: https://github.com/sebastienros/jint/pull/973
So this will definitely take some time, but I think ideally we can get Jint to a point where most things are built-in and needed customizations shouldn't be too hard to provide.
This is superb - thanks for the update @lahma ! Much appreciated!
Latest Jint in preview of the 1.0.0 now.