Javascript core crash when using YouTube iframe player in UIWebView in iOS 11.3
Asked Answered
D

0

6

We have an iOS app with a UIWebView that loads YouTube iframe player to play youtube videos. After iOS 11.3 released we found that there are a lot of javascript core crashes. On Fabric crashlytics the crash stcktrace looks like this

Crashed: WebThread
0  JavaScriptCore                 0x18aa48298 JSC::JSLock::DropAllLocks::DropAllLocks(JSC::VM&) + 176
1  JavaScriptCore                 0x18aa4826c JSC::JSLock::DropAllLocks::DropAllLocks(JSC::VM&) + 132
2  WebCore                        0x18b78b794 SendDelegateMessage(NSInvocation*) + 360
3  WebKitLegacy                   0x18cea7c68 CallDelegate(void (*)(), WebView*, objc_object*, objc_selector*, objc_object*, objc_object*, objc_object*) + 144
4  WebKitLegacy                   0x18ce1b8d0 WebFrameLoaderClient::dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long, WebCore::ResourceError const&) + 276
5  WebCore                        0x18b7ba660 WebCore::ResourceLoadNotifier::didFailToLoad(WebCore::ResourceLoader*, WebCore::ResourceError const&) + 128
6  WebCore                        0x18b7ba118 WebCore::ResourceLoader::cancel(WebCore::ResourceError const&) + 464
7  WebCore                        0x18b7b9ea4 WebCore::ResourceLoader::cancel() + 64
8  WebCore                        0x18c6bbe90 WebCore::CachedResource::removeClient(WebCore::CachedResourceClient&) + 264
9  WebCore                        0x18c680558 WebCore::MediaResource::~MediaResource() + 64
10 WebCore                        0x18c680608 WebCore::MediaResource::~MediaResource() + 12
11 libobjc.A.dylib                0x1827daef4 object_cxxDestructFromClass(objc_object*, objc_class*) + 148
12 libobjc.A.dylib                0x1827e8990 objc_destructInstance + 68
13 libobjc.A.dylib                0x1827e89f8 object_dispose + 16
14 WebCore                        0x18cbff8f0 -[WebCoreNSURLSessionDataTask dealloc] + 320
15 CoreFoundation                 0x1834f24e4 -[__NSDictionaryM dealloc] + 164
16 AVFoundation                   0x189130cf8 -[AVAssetCustomURLBridgeForNSURLSession dealloc] + 68
17 AVFoundation                   0x18917ce54 -[AVAssetResourceLoader dealloc] + 356
18 AVFoundation                   0x189060460 -[AVURLAsset dealloc] + 248
19 AVFoundation                   0x189097c34 -[AVPlayerItemTrack dealloc] + 192
20 WebCore                        0x18b8a9fac WebCore::AVTrackPrivateAVFObjCImpl::~AVTrackPrivateAVFObjCImpl() + 92
21 WebCore                        0x18cbf09dc WebCore::VideoTrackPrivateAVFObjC::~VideoTrackPrivateAVFObjC() + 48
22 WebCore                        0x18cbefc7c WebCore::VideoTrack::~VideoTrack() + 96
23 WebCore                        0x18b982390 WebCore::TrackEvent::~TrackEvent() + 72
24 JavaScriptCore                 0x18aa26228 void JSC::MarkedBlock::Handle::specializedSweep<true, (JSC::MarkedBlock::Handle::EmptyMode)1, (JSC::MarkedBlock::Handle::SweepMode)1, (JSC::MarkedBlock::Handle::SweepDestructionMode)1, (JSC::MarkedBlock::Handle::ScribbleMode)0, (JSC::MarkedBlock::Handle::NewlyAllocatedMode)1, (JSC::MarkedBlock::Handle::MarksMode)1, JSC::JSDestructibleObjectDestroyFunc>(JSC::FreeList*, JSC::MarkedBlock::Handle::EmptyMode, JSC::MarkedBlock::Handle::SweepMode, JSC::MarkedBlock::Handle::SweepDestructionMode, JSC::MarkedBlock::Handle::ScribbleMode, JSC::MarkedBlock::Handle::NewlyAllocatedMode, JSC::MarkedBlock::Handle::MarksMode, JSC::JSDestructibleObjectDestroyFunc const&) + 212
25 JavaScriptCore                 0x18aa24950 void JSC::MarkedBlock::Handle::finishSweepKnowingHeapCellType<JSC::JSDestructibleObjectDestroyFunc>(JSC::FreeList*, JSC::JSDestructibleObjectDestroyFunc const&)::'lambda'()::operator()() const + 408
26 JavaScriptCore                 0x18aa2444c void JSC::MarkedBlock::Handle::finishSweepKnowingHeapCellType<JSC::JSDestructibleObjectDestroyFunc>(JSC::FreeList*, JSC::JSDestructibleObjectDestroyFunc const&) + 320
27 JavaScriptCore                 0x18aa24300 JSC::JSDestructibleObjectHeapCellType::finishSweep(JSC::MarkedBlock::Handle&, JSC::FreeList*) + 32
28 JavaScriptCore                 0x18a7ac538 JSC::MarkedBlock::Handle::sweep(JSC::FreeList*) + 372
29 JavaScriptCore                 0x18a7aa6fc JSC::LocalAllocator::tryAllocateIn(JSC::MarkedBlock::Handle*) + 40
30 JavaScriptCore                 0x18a7aa608 JSC::LocalAllocator::tryAllocateWithoutCollecting() + 48
31 JavaScriptCore                 0x18a7aa4c8 JSC::LocalAllocator::allocateSlowCase(JSC::GCDeferralContext*, JSC::AllocationFailureMode) + 292
32 JavaScriptCore                 0x18a78f4b8 JSC::CompleteSubspace::allocateNonVirtual(JSC::VM&, unsigned long, JSC::GCDeferralContext*, JSC::AllocationFailureMode) + 216
33 WebCore                        0x18c171e3c std::__1::enable_if<std::is_same<WebCore::Event, WebCore::Event>::value, WebCore::JSDOMWrapperConverterTraits<WebCore::Event>::WrapperClass*>::type WebCore::createWrapper<WebCore::Event, WebCore::Event>(WebCore::JSDOMGlobalObject*, WTF::Ref<WebCore::Event, WTF::DumbPtrTraits<WebCore::Event> >&&) + 216
34 WebCore                        0x18c170be0 WebCore::toJSNewlyCreated(JSC::ExecState*, WebCore::JSDOMGlobalObject*, WTF::Ref<WebCore::Event, WTF::DumbPtrTraits<WebCore::Event> >&&) + 100
35 WebCore                        0x18c170444 WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext&, WebCore::Event&) + 872
36 WebCore                        0x18c3acbe0 WebCore::EventTarget::fireEventListeners(WebCore::Event&, WTF::Vector<WTF::RefPtr<WebCore::RegisteredEventListener, WTF::DumbPtrTraits<WebCore::RegisteredEventListener> >, 1ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>) + 760
37 WebCore                        0x18c3a8798 WebCore::EventTarget::fireEventListeners(WebCore::Event&) + 596
38 WebCore                        0x18c3a8524 WebCore::EventContext::handleLocalEvents(WebCore::Event&) const + 120
39 WebCore                        0x18c3a9a24 WebCore::dispatchEventInDOM(WebCore::Event&, WebCore::EventPath const&) + 164
40 WebCore                        0x18c3a96e8 WebCore::EventDispatcher::dispatchEvent(WebCore::Node&, WebCore::Event&) + 700
41 WebCore                        0x18b7cce50 WebCore::HTMLImageLoader::dispatchLoadEvent() + 248
42 WebCore                        0x18b7ccd1c WebCore::ImageLoader::dispatchPendingEvent(WebCore::EventSender<WebCore::ImageLoader>*) + 144
43 WebCore                        0x18b7ccb94 WebCore::EventSender<WebCore::ImageLoader>::dispatchPendingEvents() + 128
44 WebCore                        0x18b743ff0 WebCore::ThreadTimers::sharedTimerFiredInternal() + 352
45 WebCore                        0x18b743e7c WebCore::timerFired(__CFRunLoopTimer*, void*) + 28
46 CoreFoundation                 0x1835cbaa8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
47 CoreFoundation                 0x1835cb76c __CFRunLoopDoTimer + 864
48 CoreFoundation                 0x1835cb010 __CFRunLoopDoTimers + 248
49 CoreFoundation                 0x1835c8b60 __CFRunLoopRun + 2168
50 CoreFoundation                 0x1834e8da8 CFRunLoopRunSpecific + 552
51 WebCore                        0x18b775dcc RunWebThread(void*) + 592
52 libsystem_pthread.dylib        0x183249220 _pthread_body + 272
53 libsystem_pthread.dylib        0x183249110 _pthread_body + 290
54 libsystem_pthread.dylib        0x183247b10 thread_start + 4## Heading ##

Any ideas? Is this a YouTube iframe player issue or UIWebView issue?

Thanks.

Door answered 12/4, 2018 at 5:5 Comment(4)
Not sure if it's related or not, but Apple recommends using WKWebView instead of UIWebView for iOS8.0+Bolometer
@Bolometer thx for your advise, but for some technical concerns we have to use UIWebViewDoor
The same problem with my app. This is native Obj-C app which has build-in WebView and shows ads in that webView (we positive that crash only happens when ads served). Only affected iOS 11. We have thousand of crashes daily all with the same WebCore error JSC::JSLock::DropAllLocks::DropAllLocks. Looking for any clues, so far nothing...Footrace
anybody who got this solved?Quintana

© 2022 - 2024 — McMap. All rights reserved.