使用 Google App Engine 的通道 API 和开发服务器时出现 JavaScript 错误
我正在编写一个使用 Channel API 的 Python GAE 应用程序,除了在使用开发服务器时在 Firefox 错误控制台中收到非致命浏览器错误之外,一切正常。每个 Channel API 应用程序本质上都是相同的,因此我将展示我在示例 Channel Tac Toe 应用程序中看到的内容。
它以语法错误开始,其中显示的源代码始终只是数字“1”:
Error: syntax error
Source File: http://localhost:8080/_ah/channel/dev?command=connect&channel=channel-2053758219-1329727351-185804764220139124118185804764220139124118
Line: 1, Column: 1
Source Code:1
接下来是“格式不正确”错误(仅在 Channel Tac Toe 中):
Error: not well-formed
Source File: http://localhost:8080/_ah/channel/dev?command=poll&channel=channel-2053758219-1329727351-185804764220139124118185804764220139124118&client=1
Line: 1, Column: 1
Source Code:{"winner": null, "userX": "185804764220139124118", "moveX": true, "winningBoard": null, "board": " ", "userO": ""}
然后我得到一系列无休止的“未找到元素” ”错误,大约每秒三个:
Error: no element found
Source File: http://localhost:8080/_ah/channel/dev?command=poll&channel=channel-2053758219-1329727351-185804764220139124118185804764220139124118&client=1
Line: 1
在此之后,Channel Tac Toe 表现得很糟糕(双方都想成为 X 玩家),尽管我的实际应用程序运行没有问题。
请注意,因为这些都是 JavaScript 错误,所以没有堆栈跟踪。
(a) 是什么导致了这些问题?尽管我的应用程序可以运行,但这些错误降低了我的信心。
(b) 无休止的“找不到元素”消息是一个真正的问题,因为它们使得很难看到其他 JavaScript 错误。
我遇到过关于同一问题的另一份报告,但以下内容是:起来没有帮助。
我的配置:Windows 7、Firefox 10.0.2(禁用附加组件)、GAE 1.6.2
I'm writing a Python GAE app that uses the Channel API, and everything works fine except that I get non-fatal browser errors in the Firefox error console when using the development server. It's essentially the same with every Channel API application, so I'll show what I see with the sample Channel Tac Toe app.
It starts with a syntax error, where the source code shown is always just the digit "1":
Error: syntax error
Source File: http://localhost:8080/_ah/channel/dev?command=connect&channel=channel-2053758219-1329727351-185804764220139124118185804764220139124118
Line: 1, Column: 1
Source Code:1
Next is a "not well-formed" error (only in Channel Tac Toe):
Error: not well-formed
Source File: http://localhost:8080/_ah/channel/dev?command=poll&channel=channel-2053758219-1329727351-185804764220139124118185804764220139124118&client=1
Line: 1, Column: 1
Source Code:{"winner": null, "userX": "185804764220139124118", "moveX": true, "winningBoard": null, "board": " ", "userO": ""}
Then I get an endless series of "no element found" errors, about three a second:
Error: no element found
Source File: http://localhost:8080/_ah/channel/dev?command=poll&channel=channel-2053758219-1329727351-185804764220139124118185804764220139124118&client=1
Line: 1
After this, Channel Tac Toe behaves badly (both sides want to be the X player) although my actual application runs without problems.
Note that because these are all JavaScript errors there's no stack trace.
(a) What's causing these problems? Although my application runs, these errors lower my confidence.
(b) The endless series of "no element found" messages is a real problem, as they make it very difficult to see other JavaScript errors.
I have come across one other report of the same problem, but the follow-up was unhelpful.
My configuration: Windows 7, Firefox 10.0.2 (add-ons disabled), GAE 1.6.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
FWIW,该问题似乎是由 Channel API 的内部轮询机制未从服务器接收包含内容类型的响应引起的。因此,Firefox 似乎将响应的内容类型默认为
text/xml
。当 Firefox 尝试生成
XMLHttpRequest.responseXML
属性[1] 时,可能会引发“未找到元素”错误 - 因为响应正文实际上是空白的,因此未找到根 XML 元素。[1] https://developer.mozilla.org/en- US/docs/Web/API/XMLHttpRequest#responseXML
FWIW, the problem appears to be caused by the Channel API's internal polling mechanism not receiving responses from the server that include a Content-type. As a result, Firefox seems to default the response's content type to
text/xml
.The "no element found" error is likely thrown when Firefox attempts to generate the
XMLHttpRequest.responseXML
property[1] -- because the response body is actually blank and so no root XML element was found.[1] https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#responseXML
这看起来像是 SDK 中的一个错误。您可以在此处报告错误:http://code.google.com/p/googleappengine/issues /条目
This looks like a bug in the SDK. You can report bugs here: http://code.google.com/p/googleappengine/issues/entry