Merge pull request #3027 from matrix-org/travis/colr-logging
Add some logging for COLR checkspull/21833/head
commit
04c20b6e68
|
@ -28,10 +28,13 @@ async function isColrFontSupported() {
|
||||||
return colrFontSupported;
|
return colrFontSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("Checking for COLR support");
|
||||||
|
|
||||||
// Firefox has supported COLR fonts since version 26
|
// Firefox has supported COLR fonts since version 26
|
||||||
// but doesn't support the check below with content blocking enabled.
|
// but doesn't support the check below with content blocking enabled.
|
||||||
if (navigator.userAgent.includes("Firefox")) {
|
if (navigator.userAgent.includes("Firefox")) {
|
||||||
colrFontSupported = true;
|
colrFontSupported = true;
|
||||||
|
console.log("Browser is Firefox - assuming COLR is supported");
|
||||||
return colrFontSupported;
|
return colrFontSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,12 +65,15 @@ async function isColrFontSupported() {
|
||||||
const wait = ms => new Promise((r, j)=>setTimeout(r, ms));
|
const wait = ms => new Promise((r, j)=>setTimeout(r, ms));
|
||||||
await wait(500);
|
await wait(500);
|
||||||
|
|
||||||
|
console.log("Drawing canvas to detect COLR support");
|
||||||
context.drawImage(img, 0, 0);
|
context.drawImage(img, 0, 0);
|
||||||
colrFontSupported = (context.getImageData(10, 10, 1, 1).data[0] === 200);
|
colrFontSupported = (context.getImageData(10, 10, 1, 1).data[0] === 200);
|
||||||
|
console.log("Canvas check revealed COLR is supported? " + colrFontSupported);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Couldn't load colr font", e);
|
console.error("Couldn't load COLR font", e);
|
||||||
colrFontSupported = false;
|
colrFontSupported = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return colrFontSupported;
|
return colrFontSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue