Skip to content

Commit 3c772a7

Browse files
committed
fix these two issues garbo notated
1 parent a5b8b45 commit 3c772a7

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/compiler/jsexecute.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ runtimeFunctions.tan = `const tan = (angle) => {
599599
runtimeFunctions.resolveImageURL = `const resolveImageURL = imgURL =>
600600
typeof imgURL === 'object' && imgURL.type === 'canvas'
601601
? Promise.resolve(imgURL.canvas)
602-
: new Promise(resolve => {
602+
: new Promise(async resolve => {
603+
if (!await vm.securityManager.canFetch(imgUrl)) return resolve(imgURL);
603604
const image = new Image();
604605
image.crossOrigin = "anonymous";
605606
image.onload = resolve(image);

src/extensions/gsa_canvas/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,15 +2249,15 @@ class canvas {
22492249
code += `textMeasure = ${ctx}.measureText(text);\n`;
22502250
code += `${cache}[text + ${ctx}.font] = textMeasure;\n`;
22512251
code += '}\n';
2252-
code += 'return textMeasure.';
2252+
code += 'return textMeasure[';
22532253
switch (node.prop) {
22542254
case 'height':
2255-
code += `actualBoundingBoxAscent + textMeasure.actualBoundingBoxDescent`;
2255+
code += `'actualBoundingBoxAscent'] + textMeasure['actualBoundingBoxDescent'`;
22562256
break;
22572257
default:
2258-
code += node.prop;
2258+
code += JSON.stringify(node.prop);
22592259
}
2260-
code += `;})(${text})`;
2260+
code += `];})(${text})`;
22612261

22622262
return new TypedInput(code, TYPE_NUMBER);
22632263
}

0 commit comments

Comments
 (0)