外部接口调用使浏览器崩溃
在 Actionscript 3 中,我使用以下方法调用 Javascript:
ExternalInterface.call('javascriptFunction');
如果在 Javascript 中出现错误或阻塞调用,则整个浏览器将冻结。我无法使用 Firefox 中的 Firebug 来调试它,因为单步执行回调的行为也会使浏览器崩溃。我该如何调试这个?
function javascriptFunction() {
alert('called from AS3');
// OR
nonExistent.madeUp();
}
在 Actionscript 3 中,我使用以下方法调用 Javascript:
ExternalInterface.call('javascriptFunction');
如果在 Javascript 中出现错误或阻塞调用,则整个浏览器将冻结。我无法使用 Firefox 中的 Firebug 来调试它,因为单步执行回调的行为也会使浏览器崩溃。我该如何调试这个?
function javascriptFunction() {
alert('called from AS3');
// OR
nonExistent.madeUp();
}
你好!希望这些添加的信息将有助于让这个问题继续存在:)。我将 Actionscript 2 与 Flash Multimedia Professional 8 结合使用,并且在使用 Firefox 时也遇到此崩溃错误。我正在导入 flash.external.ExternalInterface,我使用的两个函数是
//confirmation dialog
function confirmationDialog(mesg:String) {
return ExternalInterface.call("confirm", mesg);
}
//alert dialog
function alertDialog(mesg) {
return ExternalInterface.call("alert", mesg);
}
我调用每个函数的代码总是看起来像这样..
//if i need an alert to continue on the page
if (abc == ''){
alertDialog("Message Here");
return;
}
//if the user has the option of continuing or returning
if (abc2 == 'hello') {
var response = confirmationDialog("New Message Here");
if (colorChoise == false){
return;
}else{
//do nothing and continue forward
}
}
我使用的是装有 Windows 7、Firefox 5.0、IE9 和 Chrome 12.0.742.122 的 HP 桌面。任一警报调用都会随机导致 Firefox 冻结...实际上通常会成群发生,它会连续冻结几次(显然每次都会重新启动 Firefox)..然后停止几个小时就没事了。它尚未使 IE9 或 Chrome 崩溃,尽管我还没有使用 Chrome 对其进行广泛的测试。使用 Firefox 控制台并没有帮助,因为 Firefox 会一起崩溃。如果有人能阐明这一点,那就太好了!
In Actionscript 3, I make a call to Javascript using:
ExternalInterface.call('javascriptFunction');
If in Javascript, there's an error or a blocking call, the entire browser will freeze. I can't use Firebug in Firefox to debug it because the act of stepping through the callback also crashes the browser. How do I go about debugging this?
function javascriptFunction() {
alert('called from AS3');
// OR
nonExistent.madeUp();
}
In Actionscript 3, I make a call to Javascript using:
ExternalInterface.call('javascriptFunction');
If in Javascript, there's an error or a blocking call, the entire browser will freeze. I can't use Firebug in Firefox to debug it because the act of stepping through the callback also crashes the browser. How do I go about debugging this?
function javascriptFunction() {
alert('called from AS3');
// OR
nonExistent.madeUp();
}
Hello! Hopefully this added info will help keep this question alive :). I am using Actionscript 2 with Flash Multimedia Professional 8, and I am also getting this crash error with Firefox. I am importing flash.external.ExternalInterface, and the two functions I use are
//confirmation dialog
function confirmationDialog(mesg:String) {
return ExternalInterface.call("confirm", mesg);
}
//alert dialog
function alertDialog(mesg) {
return ExternalInterface.call("alert", mesg);
}
My code calling each function always looks something like this..
//if i need an alert to continue on the page
if (abc == ''){
alertDialog("Message Here");
return;
}
//if the user has the option of continuing or returning
if (abc2 == 'hello') {
var response = confirmationDialog("New Message Here");
if (colorChoise == false){
return;
}else{
//do nothing and continue forward
}
}
I'm on an HP desktop with Windows 7, Firefox 5.0, IE9, and Chrome 12.0.742.122. Either alert call will randomly cause Firefox to freeze...it actually usually happens in bunches, where it'll freeze for a few times continuously (obviously restarting Firefox each time)..and then stop for a few hours and be alright. It has yet to crash IE9 or Chrome, though I haven't tested it as extensively with Chrome. Using the Firefox console doesn't help since Firefox just crashes all together. If anyone could shed some light on that, that'd be great!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚遇到了这个错误,看来是Firefox本身的一个bug。下一个补丁版本可能会解决这个问题。请参阅Firefox Bug 648935。
我会遵循上面 Martin 的建议,同样在 IE9 中,您可以使用 F12 调出“开发人员工具箱”来访问控制台,就像 Firebug 一样。
I just encountered this error, and it seems that it is a bug in Firefox itself. It probably will be remedied with the next patch release. Consult Firefox Bug 648935.
I'd follow Martin's advice above, also in IE9 you can use F12 to bring up the "Developer Toolbox" to access the console much like Firebug.
您是否在其他具有调试功能的浏览器(例如 chrome 或 safari)中尝试过?如果它们不像 Firefox 那样崩溃,这可能会说明您的问题。
您还可以尝试另一个版本的 Firefox,也许是在虚拟机上安装的旧版本,也许......也许不会崩溃。
您也可以尝试使用其他版本的 Flash,看看是否可以解决该问题。
一般来说,在多个浏览器和多个版本的 Flash 上测试您的代码将使您和您网站的用户受益。
在许多版本中安装许多浏览器,并在一堆小型虚拟机中安装许多插件版本,一旦您喜欢,或者在类似的情况下,您可以将其拉出来测试运行您的代码,这是一个很好的做法:)
如果这些都没有帮助,忘记单步执行,只需console.log记录所有可能发生的事情,看看浏览器崩溃之前最后会出现什么——它至少应该给你一个提示,告诉你哪里出了问题,如果没有,实际上是什么让它崩溃;)
Have you tried it in other browser with debugging capabilities like chrome or safari? That might shed some light on your problem, if they don't crash like firefox.
You could also try another version of firefox, maybe an older one installed on virtual machine maybe... maybe that won't crash.
You could also try another version of flash and see if that fixes it.
In general, testing you code on multiple browsers and on multiple versions of flash will benefit both you and the users of your website.
Having many browsers in many versions with many plugin versions installed in a bunch of small virtual machines that you can pull out to test-run your code once you like it, or in situations like this, is good practice :)
If none of this helps, forget about stepping through, just console.log the shit out of everything that might happen, and see what comes out last before the browser crashes - it should at least give you a hint as to where it goes wrong, if not, what actually makes it crash ;)