Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DOMException 105 only during UI Tests

I am intermittently getting an unhandled DOMException 105. It only happens when running my UI tests.

If I comment out the use of loadHTMLString:baseURL call of UIWebView, then the exception no longer happens.

This is making my tests very unreliable. Any suggestions on how to work around this?

Stack trace:

2017-01-05 16:57:01.431 Allhomes[64245:4871703] *** Terminating app due to uncaught exception 'DOMException', reason: '*** DOMException 105'
*** First throw call stack:
(

0   CoreFoundation                      0x0000000110e4dd4b __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00000001104b721e objc_exception_throw + 48
2   CoreFoundation                      0x0000000110e4dc99 -[NSException raise] + 9
3   WebCore                             0x000000011785a542 _ZN7WebCore17raiseDOMExceptionEi + 370
4   WebCore                             0x000000011785a55e _ZN7WebCore23raiseTypeErrorExceptionEv + 14
5   WebCore                             0x00000001177e311e -[DOMRange setStart:offset:] + 158
6   UIKit                               0x000000010d92edab -[UIWebDocumentView text] + 292
7   UIKit                               0x000000010d6afcde _UIViewDescriptionAppendTextIfApplicable + 96
8   UIKit                               0x000000010d6afe91 -[UIView(UIDebugging) description] + 147
9   CoreFoundation                      0x0000000110e2374a -[NSArray descriptionWithLocale:indent:] + 362
10  Foundation                          0x000000010ff80a9e _NSDescriptionWithLocaleFunc + 66
11  CoreFoundation                      0x0000000110d8b7d7 __CFStringAppendFormatCore + 10983
12  CoreFoundation                      0x0000000110d88cc7 _CFStringCreateWithFormatAndArgumentsAux2 + 263
13  AccessibilityUtilities              0x000000012544e38f _AXStringForArgs + 333
14  UIAccessibility                     0x0000000125f29fe2 -[UIView(UIAccessibilityElementTraversal) _accessibilitySubviewsForGettingElementsWithOptions:] + 199
15  UIAccessibility                     0x0000000125f2ae3b -[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 743
16  UIAccessibility                     0x0000000125f2aec6 -[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 882
17  UIAccessibility                     0x0000000125f2aec6 -[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 882
18  UIAccessibility                     0x0000000125f2aec6 -[UIView(UIAccessibilityElementTraversal) _addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 882
19  UIAccessibility                     0x0000000125f2b3e4 +[UIView(UIAccessibilityElementTraversal) _accessibilityElementsAndContainersDescendingFromViews:options:sorted:] + 472
20  UIAccessibility                     0x0000000125f2b599 -[UIView(UIAccessibilityElementTraversal) _accessibilityViewChildrenWithOptions:] + 186
21  UIKit                               0x0000000125db20ab -[UITableViewCellAccessibility _accessibilityRetrieveTableViewCellText] + 1551
22  UIKit                               0x0000000125db2ed1 -[UITableViewCellAccessibility _accessibilityChildren] + 1534
23  UIKit                               0x0000000125dac175 -[UITableViewCellAccessibility _accessibilityUserTestingChildren] + 82
24  UIKit                               0x0000000125dac0f7 -[UITableViewCellAccessibility _accessibilityUserTestingChildrenCount] + 24
25  UIKit                               0x0000000125dc0d24 -[UITableViewCellAccessibilityElement _accessibilityUserTestingChildrenCount] + 48
26  UIAccessibility                     0x0000000125f3890b -[NSObject(AXPrivCategory) accessibilityAttributeValue:] + 5720
27  UIAccessibility                     0x0000000125f53636 -[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotDescendantsWithAttributes:maxDepth:maxChildren:maxArrayCount:] + 1814
28  UIAccessibility                     0x0000000125f54f96 -[NSObject(UIAccessibilityAutomation) _accessibilityUserTestingSnapshotWithOptions:] + 557
29  UIAccessibility                     0x0000000125f36c0a -[NSObject(AXPrivCategory) accessibilityAttributeValue:forParameter:] + 7903
30  UIAccessibility                     0x0000000125f20856 _copyParameterizedAttributeValueCallback + 211
31  AXRuntime                           0x000000012558f532 _AXXMIGCopyParameterizedAttributeValue + 216
32  AXRuntime                           0x0000000125589f1c _XCopyParameterizedAttributeValue + 440
33  AXRuntime                           0x0000000125598de5 mshMIGPerform + 266
34  CoreFoundation                      0x0000000110ddf3d9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
35  CoreFoundation                      0x0000000110ddf351 __CFRunLoopDoSource1 + 465
36  CoreFoundation                      0x0000000110dd7435 __CFRunLoopRun + 2389
37  CoreFoundation                      0x0000000110dd6884 CFRunLoopRunSpecific + 420
38  GraphicsServices                    0x00000001151ada6f GSEventRunModal + 161
39  UIKit                               0x000000010d5e8c68 UIApplicationMain + 159
40  Appname                             0x000000010c127a33 main + 99
41  libdyld.dylib                       0x000000011261068d start + 1
)
 libc++abi.dylib: terminating with uncaught exception of type NSException
like image 617
zorro2b Avatar asked Jan 05 '17 06:01

zorro2b


2 Answers

Same problem here using an UIWebView with voiceover. I've added my view controller as the delegate of the webview and added the following code (to indicate that the tree has changed) and I don't have the bug anymore:

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
}

Does it work for you as well ?

UPDATE 1

The bug appears less often, but still appears sometimes ...

UPDATE 2

Making the webview not visible by voiceover while it is loading its content seems to work so far ... :

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    self.webView.accessibilityElementsHidden  = YES;
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    self.webView.accessibilityElementsHidden  = NO;
}
like image 188
François Avatar answered Oct 15 '22 01:10

François


Swift 3 version: Add these lines in UIWebViewDelegate:

// Prevent Accessibility Crash
func webViewDidStartLoad(_ webView: UIWebView) {
    self.webView.accessibilityElementsHidden = true
}

func webViewDidFinishLoad(_ webView: UIWebView) {
    self.webView.accessibilityElementsHidden = false
}

Note : Considering use a WKWebview instead of a UIWebView.

like image 4
Sébastien REMY Avatar answered Oct 15 '22 01:10

Sébastien REMY