且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android WebView:网址加载后崩溃

更新时间:2023-02-02 14:59:11

//编辑:找到了!general.css 中第 2540 行的罪魁祸首:

// Edit: Found it! The culprit in on line 2540 in general.css:

#head-search-form{display: block;margin: 30px 0;}

更具体地说,它是 display: block 以某种方式使 WebView 窒息.我不是一个 Web 开发人员,但是用 flexnone 交换值似乎不再导致崩溃(我无法分辨视觉差异在移动设备上).希望有帮助!

More specifically, it's display: block that somehow makes the WebView choke. I'm not much of a web developer, but exchanging the value with flex or none seems to no longer result in a crash (and I couldn't tell the visual difference on a mobile device). Hope that helps!

我已经建立了一个小型测试项目,并且能够在(虚拟)Android 4.1 设备上重现崩溃.它似乎只在页面完全加载后滚动时发生.IE.您可以毫无问题地展开菜单抽屉,只要您不开始滚动...

I've set up a small test project and have been able to reproduce the crash on a (virtual) Android 4.1 device. It only seems to happens upon scrolling, after the page has fully loaded. I.e. you can expand the menu drawer without any issues, as long as you don't start scrolling...

我能够将罪魁祸首缩小到 general.css.只要您不加载该样式表,页面就会正常工作并且可以很好地滚动,但当然看起来不会很漂亮.

I was able to narrow down the culprit to general.css. As soon as you don't load that style sheet, the page will work and scroll just fine, but of course won't look very pretty.

由于 general.css 有 3300 多行,我建议您通过修复 W3C CSS 验证器指示的错误.如果这不能解决问题,请开始禁用与照片网格相关的样式规则,尤其是涉及动画/转换的任何内容.如果我能找到时间,我自己也可以尝试一下.

Since general.css counts 3300+ lines, I'd suggest you start your search for the actual cause by fixing the errors indicated by the W3C CSS Validator. If that doesn't solve the issue, start disabling style rules related to the photo grid, especially anything that involves animation/transformation. If I can find the time, I may have a go at this myself too.

这里有一个更广泛的堆栈跟踪,仅供参考.其他人也可以在那里找到更多的指针.

Just for your information, here's a more extensive stack trace. Someone else may be able to find some more pointers in there too.

mh.test.webview A/libc: Fatal signal 11 (SIGSEGV) at 0x00001f08 (code=1), thread 11949 (WebViewCoreThre)
I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG: Build fingerprint: 'generic/vbox86p/vbox86p:4.1.1/JRO03S/eng.buildbot.20151117.133415:userdebug/test-keys'
I/DEBUG: pid: 11930, tid: 11949, name: WebViewCoreThre  >>> mh.test.webview <<<
I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00001f08
I/DEBUG:     eax b84902e4  ebx 9ba8b488  ecx b804b028  edx b83c0224
I/DEBUG:     esi b8490360  edi b804b028
I/DEBUG:     xcs 00000073  xds 0000007b  xes 0000007b  xfs 00000000  xss 0000007b
I/DEBUG:     eip 00001f08  ebp 997b9748  esp 997b96dc  flags 00010296
I/DEBUG:     #00  pc 00001f08  <unknown>
I/DEBUG:     #01  pc 00344fd6  /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+38)
I/DEBUG:     #02  pc 003454bb  /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+1291)
I/DEBUG:     #03  pc 003454bb  /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+1291)
I/DEBUG:     #04  pc 003454bb  /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+1291)
I/DEBUG:     #05  pc 003454bb  /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+1291)
I/DEBUG:     #06  pc 00346c55  /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::updateCompositingLayers(WebCore::CompositingUpdateType, WebCore::RenderLayer*)+213)
I/DEBUG:     #07  pc 0020e727  /system/lib/libwebcore.so (WebCore::FrameView::layout(bool)+1159)
I/DEBUG:     #08  pc 0068126f  /system/lib/libwebcore.so (WebCore::Document::updateLayout()+127)
I/DEBUG:     #09  pc 0068bbda  /system/lib/libwebcore.so (WebCore::Document::updateLayoutIgnorePendingStylesheets()+90)
I/DEBUG:     #10  pc 005ead53  /system/lib/libwebcore.so (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue(int, WebCore::EUpdateLayout) const+467)
I/DEBUG:     #11  pc 005f35e9  /system/lib/libwebcore.so (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue(int) const+41)
I/DEBUG:     #12  pc 005e68d7  /system/lib/libwebcore.so (WebCore::CSSComputedStyleDeclaration::getPropertyValue(int) const+55)
I/DEBUG:     #13  pc 006297f8  /system/lib/libwebcore.so (WebCore::CSSStyleDeclaration::getPropertyValue(WTF::String const&)+88)
I/DEBUG:     #14  pc 004d9475  /system/lib/libwebcore.so (WebCore::CSSStyleDeclarationInternal::getPropertyValueCallback(v8::Arguments const&)+181)
I/DEBUG:     #15  pc 000efdd4  <unknown>
I/DEBUG:     #16  pc 0005cf6b  <unknown>
I/DEBUG:     #17  pc 000bb32f  <unknown>
I/DEBUG:     #18  pc 00003b41  <unknown>
I/DEBUG:     #19  pc 000f47ce  <unknown>
I/DEBUG:     #20  pc 0001a5a3  <unknown>
I/DEBUG:     #21  pc 000065e3  <unknown>
I/DEBUG:     #22  pc 00003b41  <unknown>
I/DEBUG:     #23  pc 00024c59  <unknown>
I/DEBUG:     #24  pc 00024dad  <unknown>
I/DEBUG:     #25  pc 00003b41  <unknown>
I/DEBUG:     #26  pc 0001a59c  <unknown>
I/DEBUG:     #27  pc 000d7172  <unknown>
I/DEBUG:     #28  pc 0001a5a3  <unknown>
I/DEBUG:     #29  pc 000d40ed  <unknown>
I/DEBUG:     #30  pc 00017bf9  <unknown>
I/DEBUG:     #31  pc 00008c2a  <unknown>
I/DEBUG:          997b969c  00000000  
I/DEBUG:          997b96a0  00000000  
I/DEBUG:          997b96a4  00000000  
I/DEBUG:          997b96a8  00000000  
I/DEBUG:          997b96ac  00000000  
I/DEBUG:          997b96b0  00000000  
I/DEBUG:          997b96b4  00000000  
I/DEBUG:          997b96b8  00000000  
I/DEBUG:          997b96bc  00000000  
I/DEBUG:          997b96c0  00000000  
I/DEBUG:          997b96c4  00000000  
I/DEBUG:          997b96c8  00000000  
I/DEBUG:          997b96cc  00000000  
I/DEBUG:          997b96d0  00000000  
I/DEBUG:          997b96d4  00000000  
I/DEBUG:          997b96d8  00000000  
I/DEBUG:     #00  997b96dc  9ad1cdd4  /system/lib/libwebcore.so (WebCore::RenderLayer::updateLayerPosition()+52)
I/DEBUG:          997b96e0  b84902e4  [heap]
I/DEBUG:          997b96e4  b8490090  [heap]
I/DEBUG:          997b96e8  0000000f  
I/DEBUG:          997b96ec  0000002f  
I/DEBUG:          997b96f0  b8490090  [heap]
I/DEBUG:          997b96f4  00000001  
I/DEBUG:          997b96f8  9ad2204e  /system/lib/libwebcore.so (WebCore::RenderLayer::repaintIncludingNonCompositingDescendants(WebCore::RenderBoxModelObject*)+14)
I/DEBUG:          997b96fc  b827f428  [heap]
I/DEBUG:          997b9700  9ba8b488  /system/lib/libwebcore.so
I/DEBUG:          997b9704  b8490090  [heap]
I/DEBUG:          997b9708  997b9748  [stack:11949]
I/DEBUG:          997b970c  9ad35d38  /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::updateBacking(WebCore::RenderLayer*, WebCore::RenderLayerCompositor::CompositingChangeRepaint)+344)
I/DEBUG:          997b9710  b8490014  [heap]
I/DEBUG:          997b9714  b848fe3c  [heap]
I/DEBUG:          997b9718  00000012  
I/DEBUG:          ........  ........
I/DEBUG:     #01  997b9750  b8490360  [heap]
I/DEBUG:          997b9754  b8490090  [heap]
I/DEBUG:          997b9758  00000000  
I/DEBUG:          997b975c  997b98e0  [stack:11949]
I/DEBUG:          997b9760  997ba84f  [stack:11949]
I/DEBUG:          997b9764  b843a9e4  [heap]
I/DEBUG:          997b9768  00000034  
I/DEBUG:          997b976c  00000180  
I/DEBUG:          997b9770  b848fe3c  [heap]
I/DEBUG:          997b9774  b85257f8  [heap]
I/DEBUG:          997b9778  9ace0300  /system/lib/libwebcore.so (WebCore::RenderBox::dirtyLineBoxes(bool)+80)
I/DEBUG:          997b977c  43400000  
I/DEBUG:          997b9780  b83fe51c  [heap]
I/DEBUG:          997b9784  997b9788  [stack:11949]
I/DEBUG:          997b9788  004a0000  
I/DEBUG:          997b978c  b848feb8  [heap]
I/DEBUG:          ........  ........
I/DEBUG:     #02  997b9aa0  b804b028  [heap]
I/DEBUG:          997b9aa4  b8490360  [heap]
I/DEBUG:          997b9aa8  00000000  
I/DEBUG:          997b9aac  997b9c30  [stack:11949]
I/DEBUG:          997b9ab0  997ba84f  [stack:11949]
I/DEBUG:          997b9ab4  b83fe51c  [heap]
I/DEBUG:          997b9ab8  00000000  
I/DEBUG:          997b9abc  00000001  
I/DEBUG:          997b9ac0  b86fd038  [heap]
I/DEBUG:          997b9ac4  b86fd368  [heap]
I/DEBUG:          997b9ac8  997b9b48  [stack:11949]
I/DEBUG:          997b9acc  9adac54a  /system/lib/libwebcore.so (WebCore::TransformState::move(int, int, WebCore::TransformState::TransformAccumulation)+58)
I/DEBUG:          997b9ad0  b83fe678  [heap]
I/DEBUG:          997b9ad4  b8294d4c  [heap]
I/DEBUG:          997b9ad8  00580b05  
I/DEBUG:          997b9adc  b83fe770  [heap]
I/DEBUG:          ........  ........
I/DEBUG:     (no map below)
I/DEBUG:     (no map for address)
I/DEBUG:     20c1e000-20c1f000