mirror of
https://github.com/hanzoai/Detox.git
synced 2026-09-24 16:55:12 +00:00
fix(android): Catch errors in WebView injection (#4943)
Co-authored-by: mark.dev <[email protected]>
This commit is contained in:
committed by
GitHub
co-authored by
mark.dev
parent
84ce305083
commit
ef9d5b61c4
+5
-1
@@ -19,6 +19,7 @@ import kotlin.coroutines.resume
|
||||
|
||||
private const val GET_HTML_SCRIPT = """
|
||||
(function() {
|
||||
try {
|
||||
const blacklistedTags = ['script', 'style', 'head', 'meta'];
|
||||
const blackListedTagsSelector = blacklistedTags.join(',');
|
||||
|
||||
@@ -38,7 +39,10 @@ private const val GET_HTML_SCRIPT = """
|
||||
var serializedHtml = serializer.serializeToString(clonedDoc);
|
||||
|
||||
// Return the serialized HTML as a string
|
||||
return serializedHtml;
|
||||
return serializedHtml;
|
||||
} catch {
|
||||
return '<html xmlns="http://www.w3.org/1999/xhtml"><body></body></html>';
|
||||
}
|
||||
})();
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user