Network.getResponseBody fails if content has invalid character
Reported by
supp...@neumetrix.com,
Mar 21 2018
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 Steps to reproduce the problem: 1. Use Devtools->Network on the debugging protocol to access an HTML containing the invalid byte sequence (0xEF 0xBF, 0xBF) 2. Issue a Network.getResponseBody call or use Save As... in Devtools->Network Panel 3. What is the expected behavior? The content should be returned with either the invalid character, a place holder for the invalid character (e.g. ?) or with the invalid character dropped. What went wrong? The Network.getResponseBody never returns. If an attempt is made to use Save As in the Devtools network panel it silently fails Did this work before? N/A Chrome version: 65.0.3325.181 Channel: stable OS Version: 10.0 Flash Version: Although the original file has an invalid UTF8 character the inability to view it in Devtools or through the debugging protocol makes it difficult to debug the page.
,
Mar 21 2018
,
Mar 22 2018
These issues may also be related to this problem: Issue 805887 - Network.getResponseBody fails sporadically Issue 771825 - DevTools: Network.getResponseBody shoult return the same bytes that were sent from server
,
Oct 12
,
Dec 29
support@neumetrix.com I identified a bug with the "Save as..." button not working with your sample invalid_char.htm, but it is not related to Network.getResponseBody. I can see the Network.getResponseBody call go through successfully. Is there any other symptoms you are seeing to indicate there is something wrong with Network.getResponseBody?
,
Dec 31
I've tested again in Chrome 71 and I'm still seeing the problem when accessing the file using Network.getResponseBody from a chrome extension through the chrome.debugger API. You can access the invalid_char.htm file here: https://frametest.httpwatch.com/invalid_char.htm I will put together a simplified extension to demonstrate the issue.
,
Dec 31
To reproduce the problem using an extension: 1. Use the modified version of the live headers extension (attached in a zip file) from the chromium src tree (There's an extra few lines added to display the loadingFinished event and to issue a Network.getResponseBody command 2. Open https://frametest.httpwatch.com/valid_char.htm 3. Open the modified Live Headers extension using green icon 4. Refresh the web page 5. You should see messages in the Live Headers window to show that the getResponseBody command was sent and a response was received (see screenshot1.png) 6. Open https://frametest.httpwatch.com/invalid_char.htm 7. The Live Headers window shows the getResponseBody command being sent but the result callback is never called (see screenshot2.png)
,
Jan 10
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/ff600d044a97519bf05512af5473e3d48c4f615b commit ff600d044a97519bf05512af5473e3d48c4f615b Author: Joey Arhar <jarhar@chromium.org> Date: Thu Jan 10 03:44:53 2019 [DevTools] Prevent JSONReader::Read errors from invalid unicode points Opening a page with an invalid unicode escape sequence prevents extensions using the chrome.debugger interface from receiving Network.getResponseBody responses. Using base::JSON_REPLACE_INVALID_CHARACTERS makes base::JSONReader::Read replace invalid unicode code points with \uFFFD. This will cause us to lose the original invalid code point, but at least getResponseBody will not silently fail in extensions. There is a related problem when using "Save as..." on requests with invalid characters: http://crbug.com/919906 Bug: 824174 Change-Id: I66d528e88bf5a8feb586d39d357190857f75996e Reviewed-on: https://chromium-review.googlesource.com/c/1399538 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Reviewed-by: Alexei Filippov <alph@chromium.org> Reviewed-by: Devlin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/master@{#621445} [modify] https://crrev.com/ff600d044a97519bf05512af5473e3d48c4f615b/chrome/browser/extensions/api/debugger/debugger_api.cc [modify] https://crrev.com/ff600d044a97519bf05512af5473e3d48c4f615b/chrome/test/data/extensions/api_test/debugger/background.js [add] https://crrev.com/ff600d044a97519bf05512af5473e3d48c4f615b/chrome/test/data/extensions/api_test/debugger/invalid_char.html
,
Jan 10
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/6e83997c8bacf3fcb37b751869abd4bacfc7c14f commit 6e83997c8bacf3fcb37b751869abd4bacfc7c14f Author: Lutz Justen <ljusten@chromium.org> Date: Thu Jan 10 09:45:03 2019 [Sheriff] Revert "[DevTools] Prevent JSONReader::Read errors from invalid unicode points" This reverts commit ff600d044a97519bf05512af5473e3d48c4f615b. Reason for revert: getResponseBodyInvalidChar times out on chromium.mac Mac10.12 Tests. Original change's description: > [DevTools] Prevent JSONReader::Read errors from invalid unicode points > > Opening a page with an invalid unicode escape sequence prevents > extensions using the chrome.debugger interface from receiving > Network.getResponseBody responses. > > Using base::JSON_REPLACE_INVALID_CHARACTERS makes base::JSONReader::Read > replace invalid unicode code points with \uFFFD. This will cause us to > lose the original invalid code point, but at least getResponseBody will > not silently fail in extensions. > > There is a related problem when using "Save as..." on requests with > invalid characters: http://crbug.com/919906 > > Bug: 824174 > Change-Id: I66d528e88bf5a8feb586d39d357190857f75996e > Reviewed-on: https://chromium-review.googlesource.com/c/1399538 > Commit-Queue: Joey Arhar <jarhar@chromium.org> > Reviewed-by: Dmitry Gozman <dgozman@chromium.org> > Reviewed-by: Alexei Filippov <alph@chromium.org> > Reviewed-by: Devlin <rdevlin.cronin@chromium.org> > Cr-Commit-Position: refs/heads/master@{#621445} TBR=dgozman@chromium.org,rdevlin.cronin@chromium.org,alph@chromium.org,jarhar@chromium.org Change-Id: If601f8ddfb39db0c03799eae28dc0eac8dd6c860 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 824174 Reviewed-on: https://chromium-review.googlesource.com/c/1404161 Reviewed-by: Lutz Justen <ljusten@chromium.org> Commit-Queue: Lutz Justen <ljusten@chromium.org> Cr-Commit-Position: refs/heads/master@{#621525} [modify] https://crrev.com/6e83997c8bacf3fcb37b751869abd4bacfc7c14f/chrome/browser/extensions/api/debugger/debugger_api.cc [modify] https://crrev.com/6e83997c8bacf3fcb37b751869abd4bacfc7c14f/chrome/test/data/extensions/api_test/debugger/background.js [delete] https://crrev.com/a589b0923807565a2e799b352314118f66d3052b/chrome/test/data/extensions/api_test/debugger/invalid_char.html
,
Jan 10
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/377dadb7a95df94d3f1aa7ce4ef4b14069306464 commit 377dadb7a95df94d3f1aa7ce4ef4b14069306464 Author: Joey Arhar <jarhar@chromium.org> Date: Thu Jan 10 21:44:21 2019 Reland "[DevTools] Prevent JSONReader::Read errors from invalid unicode points" Relanding http://crrev.com/c/1399538 Reverted by http://crrev.com/c/1404161 The original test didn't wait for Network.enable to finish before making a request and expected to see network events, which did work... when network service wasn't turned on. With network service enabled, Network.enable takes longer and needs to be awaited for. browser_tests now passes with --enable-features=NetworkService Bug: 824174 , 920539 , 920544 Change-Id: I3458b08ccce34ec6df6d7c0c65b5b5225ab3debc Reviewed-on: https://chromium-review.googlesource.com/c/1405848 Reviewed-by: Devlin <rdevlin.cronin@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/master@{#621741} [modify] https://crrev.com/377dadb7a95df94d3f1aa7ce4ef4b14069306464/chrome/browser/extensions/api/debugger/debugger_api.cc [modify] https://crrev.com/377dadb7a95df94d3f1aa7ce4ef4b14069306464/chrome/test/data/extensions/api_test/debugger/background.js [add] https://crrev.com/377dadb7a95df94d3f1aa7ce4ef4b14069306464/chrome/test/data/extensions/api_test/debugger/invalid_char.html
,
Jan 10
Thanks for the detailed response! I fixed the issue with the extension, so it should be getting getResponseBody replies for invalid characters now, where the invalid characters are changed to the unicode replacement character, U+FFFD. I didn't end up getting a fix out for the "Save as..." button bug you found, but I filed a separate bug for it here: http://crbug.com/919906
,
Jan 11
Great - thanks for the fix. I'll try it out once it's in the canary build.
,
Jan 11
I can confirm that it's now working correctly in Chrome Canary.
,
Jan 11
Thanks for verifying
,
Jan 11
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a82ca95e0862fc6e12f655982362c54c0d01e9d7 commit a82ca95e0862fc6e12f655982362c54c0d01e9d7 Author: Roman Sorokin [CET] <rsorokin@chromium.org> Date: Fri Jan 11 15:11:32 2019 Revert "Reland "[DevTools] Prevent JSONReader::Read errors from invalid unicode points"" This reverts commit 377dadb7a95df94d3f1aa7ce4ef4b14069306464. Reason for revert: breaks tests on windows (see https://bugs.chromium.org/p/chromium/issues/detail?id=920997) Original change's description: > Reland "[DevTools] Prevent JSONReader::Read errors from invalid unicode points" > > Relanding http://crrev.com/c/1399538 > Reverted by http://crrev.com/c/1404161 > > The original test didn't wait for Network.enable to finish before making > a request and expected to see network events, which did work... when > network service wasn't turned on. With network service enabled, > Network.enable takes longer and needs to be awaited for. > > browser_tests now passes with --enable-features=NetworkService > > Bug: 824174 , 920539 , 920544 > Change-Id: I3458b08ccce34ec6df6d7c0c65b5b5225ab3debc > Reviewed-on: https://chromium-review.googlesource.com/c/1405848 > Reviewed-by: Devlin <rdevlin.cronin@chromium.org> > Reviewed-by: Dmitry Gozman <dgozman@chromium.org> > Commit-Queue: Joey Arhar <jarhar@chromium.org> > Cr-Commit-Position: refs/heads/master@{#621741} TBR=dgozman@chromium.org,rdevlin.cronin@chromium.org,jarhar@chromium.org Change-Id: I2bea5199e19b0eb93394a241a9ec7833848b6c00 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 824174 , 920539 , 920544 Reviewed-on: https://chromium-review.googlesource.com/c/1406685 Reviewed-by: Roman Sorokin [CET] <rsorokin@chromium.org> Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org> Cr-Commit-Position: refs/heads/master@{#622007} [modify] https://crrev.com/a82ca95e0862fc6e12f655982362c54c0d01e9d7/chrome/browser/extensions/api/debugger/debugger_api.cc [modify] https://crrev.com/a82ca95e0862fc6e12f655982362c54c0d01e9d7/chrome/test/data/extensions/api_test/debugger/background.js [delete] https://crrev.com/2f6cbb3b62a89f96cc7a4dccf898215bcf27fb05/chrome/test/data/extensions/api_test/debugger/invalid_char.html
,
Jan 11
Sorry, my fix got reverted due to a testing issue. I will reland it as soon as I can.
,
Jan 16
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/34f1026e238b61092b7d08e02bf22e9ff5e1c173 commit 34f1026e238b61092b7d08e02bf22e9ff5e1c173 Author: Joey Arhar <jarhar@chromium.org> Date: Wed Jan 16 06:07:43 2019 Reland #2 "[DevTools] Prevent JSONReader::Read errors from invalid unicode points" I identified another cause of flakiness in the test and fixed it. This time I also ran repeatedly on windows for hours with network service enabled to make sure it never fails. Bug: 824174 Change-Id: Icbaf26a733c89c8a4cf79cad26ab1d2675da5c8a Reviewed-on: https://chromium-review.googlesource.com/c/1413255 Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Reviewed-by: Devlin <rdevlin.cronin@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/master@{#623129} [modify] https://crrev.com/34f1026e238b61092b7d08e02bf22e9ff5e1c173/chrome/browser/extensions/api/debugger/debugger_api.cc [modify] https://crrev.com/34f1026e238b61092b7d08e02bf22e9ff5e1c173/chrome/test/data/extensions/api_test/debugger/background.js [add] https://crrev.com/34f1026e238b61092b7d08e02bf22e9ff5e1c173/chrome/test/data/extensions/api_test/debugger/fetch.html [add] https://crrev.com/34f1026e238b61092b7d08e02bf22e9ff5e1c173/chrome/test/data/extensions/api_test/debugger/fetch.js [add] https://crrev.com/34f1026e238b61092b7d08e02bf22e9ff5e1c173/chrome/test/data/extensions/api_test/debugger/invalid_char.html
,
Jan 17
(6 days ago)
,
Jan 17
(6 days ago)
The change works for me too in Canary. |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by supp...@neumetrix.com
, Mar 21 201827 bytes
27 bytes View Download