E/cocos js error:: assets/src/project.dev.js line:7260 msg:mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

在真机上调试报 E/cocos js error:: assets/src/project.dev.js line:7260 msg:mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
这个错误,该怎么解决?

代码里都是 cc.Class继承方式,没有引用任何第三方库(原先引了socket.io,后来移除了),根据控制台输出的堆栈找到assets/src/project.dev.js line:7260,是下面的代码
function typedArraySupport () {
try {
var arr = new Uint8Array(1)
arr.proto = {proto: Uint8Array.prototype, foo: function () { return 42 }}
return arr.foo() === 42 && // typed array instances can be augmented
typeof arr.subarray === ‘function’ && // chrome 9-10 lack subarray
arr.subarray(1, 1).byteLength === 0 // ie10 has broken subarray
} catch (e) {
return false
}
}

报错是 arr.proto = {proto: Uint8Array.prototype, foo: function () { return 42 }} 这一行,关键是这是cocos自己生成的吧?这个局怎么破?

creator的版本是最新的1.5.2

我去,这是引用了 querystring和crypto库导至的~~~:innocent:

你是怎么查出来 引用了 其他库的 ?

直接在整个项目中搜索require 关键字,看看你有没有引用第三方的外部库,像我引用的 querystring和crypto都是node.js才有的,在cocos中可以编译通过,但这两个库中可能修改了 对象的__proto__属性,所以会报这个错

[quote=“jare, post:44, topic:35510, full:true”]
Q: 真机或模拟器运行时报错:“Mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create”A: 这是由于某些第三方库,或者项目中用到了 ES2015(ES6)的类继承语法,而 Babel 在转义这个语法时会调用到 SpiderMonkey 不太优化 API,所以 SpiderMonkey 给出了这个报错。
[/quote]