WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 231138
231375
DOMParser broken in iOS 15
https://bugs.webkit.org/show_bug.cgi?id=231375
Summary
DOMParser broken in iOS 15
erik.witt
Reported
2021-10-07 10:56:11 PDT
As describes in this ticket
https://bugs.webkit.org/show_bug.cgi?id=231138
there is an issue where XHR with response type document does not parse and return a document despite a successful response from the server. The bug however seems to span further. When I tried the workaround to fetch a text response via XHR and parse it with DOMParser, I discovered that this one is broken in some scenarios as well since it seemingly parses parts of the document but not all. This only happens on iOS 15 (iPhone 11 pro max for me) Steps to reproduce: 1. Go to www.decathlon.de on your iOS 15 device 2. Use remote debugging to be able to use the console 2. Execute the following script ``` var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.open('GET', '
https://www.decathlon.de/browse/c0-alle-sportarten-a-z/c1-fahrrad-welt/c3-mountainbike/_/N-obq78x
', true); xhr.responseType = 'text'; xhr.addEventListener('readystatechange', () => { if (xhr.readyState === 4) { console.log('Success') const parsedDocument = new DOMParser().parseFromString(xhr.response, 'text/html'); console.log('Document') var scripts = Array.from(parsedDocument.querySelectorAll('script')).filter(s => !s.src) var lastScript = scripts[scripts.length - 1] console.log(lastScript.textContent); } }); // Handle errors of XHR connection xhr.addEventListener('error', (e) => { console.log('Error', e) }); xhr.send(); ``` The script print the content of the last inline script in the DOM. The script's content that is printed to the console should start with the line `var cube = cube || {};`. On iOS 15 Safari it starts with `window.fux = window.fux || {};` which is not the last inline script in the document! If I print the whole string document to the console, I get the complete HTML text, also when I print the document object to the console, I get the full DOM. Only if I access the DOM by querying all the scripts for example it seems that there is half of the DOM missing. On MAC OS Safari 15 it works without issues.
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2021-10-11 10:04:40 PDT
*** This bug has been marked as a duplicate of
bug 231138
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug