4***@qq.com
4***@qq.com
  • 发布:2020-10-15 17:58
  • 更新:2020-12-23 11:19
  • 阅读:2337

【报Bug】升级版本2.9.3.20201014 canvasToTempFilePath BUG

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 2.9.3

手机系统: 全部

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

测试过的手机:

google 浏览器 ,苹果11 安卓

操作步骤:

升级版本2.9.3.20201014 canvasToTempFilePath失败回调函数里报canvasToTempFilePath:fail SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported. 切换回上一个版本就好了

预期结果:

升级版本2.9.3.20201014 canvasToTempFilePath失败回调函数里报canvasToTempFilePath:fail SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

实际结果:

升级版本2.9.3.20201014 canvasToTempFilePath失败回调函数里报canvasToTempFilePath:fail SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

bug描述:

【报Bug】升级版本2.9.3.20201014 canvasToTempFilePath失败回调函数里报canvasToTempFilePath:fail SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

2020-10-15 17:58 负责人:无 分享
已邀请:

最佳回复

DCloud_UNI_GSQ

DCloud_UNI_GSQ

HBuilderX alpha 2.9.11 已修复

  • 2***@qq.com

    2.9.5还是有问题,代码都没动,2.8.11优化了canvas之后就出问题了

    2020-10-27 14:38

  • DCloud_UNI_GSQ

    回复 2***@qq.com: 具体描述一下

    2020-10-29 16:18

  • 5***@qq.com

    回复 DCloud_UNI_GSQ: 华为mata 30 pro android版本为10 EMUI版本是11.还是出这个问题

    2020-10-30 09:29

  • 1***@qq.com

    canvasToTempFilePath:fail SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported 这个问题尽快解决啊

    2020-11-05 13:44

  • DCloud_UNI_GSQ

    回复 1***@qq.com: 已解决

    2020-11-05 14:35

  • h***@qq.com

    HBuilderX 2.9.7 华为mate30 pro Android 11 用canvasToTempFilePath创建还是提示“canvasToTempFilePath:fail SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.” 这个呢?

    2020-11-06 11:10

  • 1***@qq.com

    回复 h***@qq.com: 我的也是,求官方解决!!

    2020-11-06 20:15

  • DCloud_UNI_GSQ

    回复 1***@qq.com: 单独发帖,详细反馈一下

    2020-11-09 12:03

  • DCloud_UNI_GSQ

    回复 h***@qq.com: 你也是,附上测试工程

    2020-11-09 12:04

  • E***@foxmail.com

    回复 DCloud_UNI_GSQ: HX 2.9.10 Alpha 抱着个错误,使用设备 华为 Mate 30 Pro

    2020-11-25 13:17

  • 1***@163.com

    回复 DCloud_UNI_GSQ: 解决方案贴出来啊

    2020-12-23 09:22

  • DCloud_UNI_GSQ

    回复 1***@163.com: 更新

    2020-12-23 11:19

chenli

chenli

刚也升级hx2.9.3,现有的功能h5端是正常。

建议提供可复现的简单代码工程示例,方便他人直接复现排查!

chenli

chenli

canvasToTempFilePath:fail SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.
这个报错,污染的画布导致无法输出。大部分是远程图片地址跨域导致的。远程图片先下载转为临时地址,再使用。

[已删除]

[已删除]

承接前端H5、小程序、APP、PC端网站等外包,主要技术栈为vue、uni-app,有意请加微信:13070273424(我是前端。1. 我找有单子的服务端合作人。2. 整个项目外包给我,我这也有个小团队。3. 兼职,公司/团队偶尔丢点小项目或者页面调整等)

4***@qq.com

4***@qq.com (作者)

canvasImage () {
this.canvas.draw(false, setTimeout(() => {
setTimeout(() => {
// #ifndef MP-ALIPAY
uni.canvasToTempFilePath({
x: 0,
y: 0,
width: Number(this.width),
height: Number(this.height),
fileType: 'jpg',
canvasId: 'canvas',
success: (res) => {
this.$emit('canvasImage', res.tempFilePath);
if (this.showPreview) {
this.showPreviewFn(res.tempFilePath);
}
},
fail: (res) => {
console.log(res);
},
complete: () => {
uni.hideLoading();
}
}, this);
// #endif
// #ifdef MP-ALIPAY
// 支付宝的
// #endif
}, 500);
}));
},

//------------------------------------没有使用网络图片,使用的是静态资源里面的;

h***@qq.com

h***@qq.com

请问你解决了吗?我把远程图片下载了也不行。报同样的错!~

DCloud_UNI_GSQ

DCloud_UNI_GSQ

canvas绘制image使用了getImageInfo生成的path吗?

  • tpframe2020

    是的,我升级了也有这个问题,回上一个版本就正常

    还有一个bug,gcanvas nvue下绘制中文问题,地址:https://ask.dcloud.net.cn/question/109283

    2020-10-21 15:08

s***@soian.com

s***@soian.com

华为手机在更新完2020年10月1日的安全补丁包之后还是有这个问题,不更新的话唯有问题,更新前后都做过测试,更新前没有问题,更新后还是报这个错误,希望官方确定一下,我提了问题已经三天了没有人回应https://ask.dcloud.net.cn/question/112058

该问题目前已经被锁定, 无法添加新回复