【发布时间】:2013-02-04 19:22:17
【问题描述】:
Web 应用程序中的 Javascript 运行以下循环:
for (var name in this) {
if(typeof(this[name]) == "function") {
if((/^on_|^do_/).test(name)) {
console.debug("Adding ", name, " to ", this, "(", this[name], ")");
f = this[name].bind;
console.debug(f);
this[name] = this[name].bind(this);
}
}
}
在 Chrome 24.0.1312.56 下,f = this[name].bind 行将 f 正确设置为本机代码 function.bind(),而在我的 QWebKit Qt 应用程序中,它将 f 设置为“未定义”。
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind
知道我如何能够说服 QtWebkit 在这里正常运行吗?
显然,Function.prototype.bind 是 ECMAScript 5 的一部分。它在 webkit 中的实现应包含在(已修复的错误):https://bugs.webkit.org/show_bug.cgi?id=26382
也许有一种模式可以启用我缺少的 ECMAScript 5?
显然我正在为 QtWebkit 使用 534.34 版:
(Pdb) str(QtWebKit.qWebKitVersion()) '534.34'
根据这个: https://trac.webkit.org/changeset/85696/trunk/Source/WebKit/mac/Configurations/Version.xcconfig
对应于修订版 85696。结合上述错误中的注释(“在 r95751 中修复”),似乎我需要一个更新的版本,特别是比 535.5 更好的版本。现在来查找 PyQt 使用的是哪个版本...
谢谢。
【问题讨论】:
标签: qt pyqt qtwebkit ecmascript-5 qwebkit