SIGSEGV加载HTML +闪存成的WebView [英] SIGSEGV loading HTML + Flash into a WebView

查看:112
本文介绍了SIGSEGV加载HTML +闪存成的WebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到SIGSEGV信号,当我尝试加载HTML与嵌入式闪存插件(主要是YouTube)的与loadDataWithBaseURL与PluginState设置为PluginState.ON一个web视图。我可以用一个简单的测试情况下重现错误。请参见下面的code:

 包ians.android2;

进口android.app.Activity;
进口android.os.Bundle;
进口android.webkit.WebView;
进口android.webkit.WebSettings;

公共类TestAndroid延伸活动{
/ **第一次创建活动时调用。 * /
@覆盖
公共无效的onCreate(包savedInstanceState){
    super.onCreate(savedInstanceState);
    的setContentView(R.layout.main);

    的WebView WV =(web视图)findViewById(R.id.webview);
    。wv.getSettings()setPluginState(WebSettings.PluginState.ON);

    字符串的HTML =;
    HTML + =<对象的宽度= \620 \高度= \376 \>中;
    HTML + =&LT; PARAM NAME = \电影\ value=\"http://www.youtube.com/v/C4KdcRHoXOA?fs=1&amp;hl=en_US&amp;rel=0\"></param>";
    HTML + =&LT; PARAM NAME = \的allowFullScreen \价值= \真正的\&GT;&LT; /参数&gt;中;
    HTML + =&LT; PARAM NAME = \allowScriptAccess的\值= \永远\&GT;&LT; /参数&gt;中;
    HTML + =&LT;嵌入SRC = \HTTP://www.youtube.com/v/C4KdcRHoXOA FS = 1&放大器;放大器; HL = EN_US和放大器;放大器;相对= 0 \型= \应用程序/ X-冲击波闪光\的allowScriptAccess = \永远\的allowFullScreen = \真正的\WIDTH = \620 \高度= \376 \&GT;&LT; /嵌入&gt;中;
    HTML + =&LT; /对象&gt;;

    wv.loadDataWithBaseURL(notreal /,HTML,text / html的,UTF-8,NULL);
    }
}
 

解决方案

当一个进程试图引用一个已经被分配到进程的内存段外的内存SIGSEGV信号或段故障发生。从手机上运行和腐败等工序确实安卓本身这prevents过程。

不试图重现自己的问题,我建议你code有可能暴露于HTC运行在Dalvik JVM的缺陷。

一个关于段错误的很酷的事情是,你应该能够得到它描述了在内存中的进程的状态,故障发生时一个核心文件。

核心文件是由GNU调试器GDB可读,并给调用堆栈跟踪到段错误发生时的点。所以,如果你能找到一个对应的核心文件,那么这将是有益的提交以及一个错误请求,Android开发者。研究有点应揭露与否,你可以得到一个HTC从一个进程崩溃的核心文件。

从视图得到我建议尝试不太复杂的HTML,看看是否能工程,然后逐步增加,你需要看看是否在HTML中一个特定的变化暴露了缺陷HTML的code的工作点。这将是Android的开发者,您提交给他们的任何bug报告非常有用。

I'm getting SIGSEGV signals when I try to load HTML into a WebView with embedded flash plugins (mostly youtube) with loadDataWithBaseURL with the PluginState set to PluginState.ON. I'm able to reproduce the error with a simple test case. See the following code:

package ians.android2;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebSettings;

public class TestAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    WebView wv = (WebView)findViewById(R.id.webview);
    wv.getSettings().setPluginState(WebSettings.PluginState.ON);

    String html = "";
    html += "<object width=\"620\" height=\"376\">";
    html += "<param name=\"movie\" value=\"http://www.youtube.com/v/C4KdcRHoXOA?fs=1&amp;hl=en_US&amp;rel=0\"></param>";
    html += "<param name=\"allowFullScreen\" value=\"true\"></param>";
    html += "<param name=\"allowscriptaccess\" value=\"always\"></param>";
    html += "<embed src=\"http://www.youtube.com/v/C4KdcRHoXOA?fs=1&amp;hl=en_US&amp;rel=0\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"620\" height=\"376\"></embed>";
    html += "</object>";

    wv.loadDataWithBaseURL("notreal/", html, "text/html", "utf-8", null);
    }
}

解决方案

SIGSEGV signals or Segmentation Faults occur when a process attempts to reference memory outside the memory segments that have been allocated to the process. This prevents processes from corrupting other processes running on the phone and indeed Android itself.

Without attempting to reproduce the problem myself I would suggest that your code has possibly exposed a defect in the Dalvik JVM running on the HTC.

One of the cool things about Segmentation Faults is that you should be able to get a core file which describes the state of the process in memory when the fault occurred.

Core files are readable by the GNU debugger gdb and will give the call stack trace up to the point where the segmentation fault occurred. So if you could find a corresponding core file then that would be useful to submit along with a bug request to the Android developers. A bit of research should reveal whether or not you can get the core file from a process crash on a HTC.

From the point of view getting your code working I suggest trying less complex HTML to see if that works and then incrementally adding the html that you require to see if a specific change in HTML exposes the defect. This would be useful for the Android developers in any bug report that you submitted to them.

这篇关于SIGSEGV加载HTML +闪存成的WebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆