Web developers do not currently have a way to view JavaScript logs from Chrome on iOS. It is currently very difficult to troubleshoot issues on the production version of iOS Chrome. At a minimum, JavaScript console logs should be exposed.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9636a22df4ceeaa34bf2f3e13feec612719bb66e commit 9636a22df4ceeaa34bf2f3e13feec612719bb66e Author: Mike Dougherty <michaeldo@chromium.org> Date: Mon Oct 29 21:58:53 2018 Call native JS console methods. The native console methods must be called in order for messages to be logged to Safari Developer Tools. Bug: 899851 Change-Id: I3c1222ad890d490cb6b2212dc6783dcadc1da7f6 Reviewed-on: https://chromium-review.googlesource.com/c/1306114 Reviewed-by: Eugene But <eugenebut@chromium.org> Commit-Queue: Mike Dougherty <michaeldo@chromium.org> Cr-Commit-Position: refs/heads/master@{#603643} [modify] https://crrev.com/9636a22df4ceeaa34bf2f3e13feec612719bb66e/ios/web/web_state/js/resources/console.js
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/760679c3166983f4bafd23ae546385ec114cbe4a commit 760679c3166983f4bafd23ae546385ec114cbe4a Author: Mike Dougherty <michaeldo@chromium.org> Date: Wed Nov 28 03:28:50 2018 Move handling of Javascript console logs out of CRWWebController. This CL moves the handling of Javascript console logs to an improved architecture, but is a no-op in terms of functionality. This will allow Javascript logs to be exposed in non-debug builds (instead of printing them to the device console as is done currently). Bug: 899851 Change-Id: I25eedc1f450df48acf66e4306f8846e0f761276f Reviewed-on: https://chromium-review.googlesource.com/c/1338946 Commit-Queue: Mike Dougherty <michaeldo@chromium.org> Reviewed-by: Eugene But <eugenebut@chromium.org> Cr-Commit-Position: refs/heads/master@{#611547} [modify] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/tabs/tab_helper_util.mm [modify] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/web/BUILD.gn [add] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/web/java_script_console/java_script_console_message.cc [add] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/web/java_script_console/java_script_console_message.h [add] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper.h [add] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper.mm [add] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper_delegate.h [add] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper_unittest.mm [modify] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/web/resources/chrome_bundle_all_frames.js [rename] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/browser/web/resources/console.js [modify] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/test/fakes/BUILD.gn [add] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/test/fakes/fake_java_script_console_tab_helper_delegate.cc [add] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/chrome/test/fakes/fake_java_script_console_tab_helper_delegate.h [modify] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/web/BUILD.gn [modify] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/web/web_state/js/resources/main_frame_web_bundle.js [modify] https://crrev.com/760679c3166983f4bafd23ae546385ec114cbe4a/ios/web/web_state/ui/crw_web_controller.mm
Issue 228377 has been merged into this issue.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/dadcf582438d2e0af4f697be4d68dac6b35e6e3f commit dadcf582438d2e0af4f697be4d68dac6b35e6e3f Author: Mike Dougherty <michaeldo@chromium.org> Date: Fri Dec 14 17:57:06 2018 [iOS] Add chrome://inspect webUI page. Remove the Debug only "Log JS" switch from the Settings page. Add a new chrome://inspect webUI page with a button to enable and disable JavaScript console logging. Messages are still logged in the same manner to the Xcode console, but will be moved to be displayed on the chrome://inspect page in a follow-up CL. The new UI of the chrome://inspect page can be seen here: https://drive.google.com/file/d/1IdEHPYCaEhgNyRZ82_cygJVQVbhT5rNL/view?usp=sharing Bug: 899851 Change-Id: I653c1e31f95cf15d5acfe453d92c56f5e5e0431e Reviewed-on: https://chromium-review.googlesource.com/c/1363632 Reviewed-by: Eugene But <eugenebut@chromium.org> Commit-Queue: Mike Dougherty <michaeldo@chromium.org> Cr-Commit-Position: refs/heads/master@{#616736} [add] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/app/resources/inspect/inspect.css [add] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/app/resources/inspect/inspect.html [add] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/app/resources/inspect/inspect.js [modify] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/app/resources/ios_resources.grd [modify] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/app/strings/ios_strings.grd [add] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INSPECT_UI_CONSOLE_NOTICE.png.sha1 [modify] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/browser/chrome_url_constants.cc [modify] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/browser/chrome_url_constants.h [modify] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm [modify] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/browser/ui/webui/BUILD.gn [modify] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.mm [add] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/browser/ui/webui/inspect/inspect_ui.h [add] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/browser/ui/webui/inspect/inspect_ui.mm [add] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/browser/ui/webui/inspect/inspect_ui_egtest.mm [modify] https://crrev.com/dadcf582438d2e0af4f697be4d68dac6b35e6e3f/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper.mm
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a2ec50cfcc12cdbe2ff160520e7b92acd509710a commit a2ec50cfcc12cdbe2ff160520e7b92acd509710a Author: Mike Dougherty <michaeldo@chromium.org> Date: Wed Jan 09 01:29:12 2019 [iOS] Translate Start and Stop Logging buttons on chrome://inspect page. Although the notice at the top of the page was localized, translation entries were missing for the strings on the buttons themselves. Bug: 899851 Change-Id: I819aeee7ed7b776fc8a3c36f841e195a9a965133 Reviewed-on: https://chromium-review.googlesource.com/c/1401515 Reviewed-by: Eugene But <eugenebut@chromium.org> Commit-Queue: Mike Dougherty <michaeldo@chromium.org> Cr-Commit-Position: refs/heads/master@{#620983} [modify] https://crrev.com/a2ec50cfcc12cdbe2ff160520e7b92acd509710a/ios/chrome/app/resources/inspect/inspect.html [modify] https://crrev.com/a2ec50cfcc12cdbe2ff160520e7b92acd509710a/ios/chrome/app/strings/ios_strings.grd [add] https://crrev.com/a2ec50cfcc12cdbe2ff160520e7b92acd509710a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INSPECT_UI_CONSOLE_START_LOGGING.png.sha1 [add] https://crrev.com/a2ec50cfcc12cdbe2ff160520e7b92acd509710a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_INSPECT_UI_CONSOLE_STOP_LOGGING.png.sha1 [modify] https://crrev.com/a2ec50cfcc12cdbe2ff160520e7b92acd509710a/ios/chrome/browser/ui/webui/inspect/inspect_ui.mm
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8c83b795f3c092b2a2e4b328a0af327af2ba1527 commit 8c83b795f3c092b2a2e4b328a0af327af2ba1527 Author: Mike Dougherty <michaeldo@chromium.org> Date: Wed Jan 09 23:39:11 2019 Display console messages on chrome://inspect. Stop logging messages to the Xcode console and instead display them directly on the chrome://inspect page. Bug: 899851 Change-Id: I4a364c7188d2879258063e89b8e6ee108f87acb2 Reviewed-on: https://chromium-review.googlesource.com/c/1385493 Commit-Queue: Mike Dougherty <michaeldo@chromium.org> Reviewed-by: Peter Lee <pkl@chromium.org> Reviewed-by: Eugene But <eugenebut@chromium.org> Cr-Commit-Position: refs/heads/master@{#621370} [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/app/resources/inspect/inspect.css [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/app/resources/inspect/inspect.html [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/app/resources/inspect/inspect.js [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/browser/ui/webui/inspect/inspect_ui.mm [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/browser/web/java_script_console/java_script_console_message.cc [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/browser/web/java_script_console/java_script_console_message.h [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper.h [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper.mm [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper_delegate.h [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/browser/web/java_script_console/java_script_console_tab_helper_unittest.mm [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/browser/web/resources/console.js [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/test/fakes/fake_java_script_console_tab_helper_delegate.cc [modify] https://crrev.com/8c83b795f3c092b2a2e4b328a0af327af2ba1527/ios/chrome/test/fakes/fake_java_script_console_tab_helper_delegate.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0772554c067f66c6ea6734edfd9873b2fd2092a6 commit 0772554c067f66c6ea6734edfd9873b2fd2092a6 Author: Mike Dougherty <michaeldo@chromium.org> Date: Thu Jan 10 22:03:49 2019 [iOS] Add metrics for actions take on chrome://inspect page. Log a User Action when the user navigates to the chrome://inspect page and when they take action on the page by Starting and Stopping log collection. Bug: 899851 Change-Id: Id10d6e113bf5248f853841f7f631568c0b532ea6 Reviewed-on: https://chromium-review.googlesource.com/c/1404740 Commit-Queue: Mike Dougherty <michaeldo@chromium.org> Reviewed-by: Mark Pearson <mpearson@chromium.org> Reviewed-by: Eugene But <eugenebut@chromium.org> Cr-Commit-Position: refs/heads/master@{#621769} [modify] https://crrev.com/0772554c067f66c6ea6734edfd9873b2fd2092a6/ios/chrome/browser/ui/webui/inspect/inspect_ui.mm [modify] https://crrev.com/0772554c067f66c6ea6734edfd9873b2fd2092a6/tools/metrics/actions/actions.xml [modify] https://crrev.com/0772554c067f66c6ea6734edfd9873b2fd2092a6/tools/metrics/histograms/enums.xml [modify] https://crrev.com/0772554c067f66c6ea6734edfd9873b2fd2092a6/tools/metrics/histograms/histograms.xml
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/00a6f7ddaf5078954fae8f07fc192109c795062f commit 00a6f7ddaf5078954fae8f07fc192109c795062f Author: Mike Dougherty <michaeldo@chromium.org> Date: Thu Jan 17 23:19:13 2019 Add EarlGrey tests for chrome://inspect page. Bug: 899851 Change-Id: Ia5f1191f6fff25ec16938b542443f27a17bd8d2f Reviewed-on: https://chromium-review.googlesource.com/c/1414290 Commit-Queue: Mike Dougherty <michaeldo@chromium.org> Reviewed-by: Eugene But <eugenebut@chromium.org> Cr-Commit-Position: refs/heads/master@{#623899} [modify] https://crrev.com/00a6f7ddaf5078954fae8f07fc192109c795062f/ios/chrome/browser/ui/webui/inspect/inspect_ui_egtest.mm [modify] https://crrev.com/00a6f7ddaf5078954fae8f07fc192109c795062f/ios/chrome/test/app/web_view_interaction_test_util.h [modify] https://crrev.com/00a6f7ddaf5078954fae8f07fc192109c795062f/ios/chrome/test/app/web_view_interaction_test_util.mm [modify] https://crrev.com/00a6f7ddaf5078954fae8f07fc192109c795062f/ios/testing/BUILD.gn [add] https://crrev.com/00a6f7ddaf5078954fae8f07fc192109c795062f/ios/testing/data/http_server_files/console.html [add] https://crrev.com/00a6f7ddaf5078954fae8f07fc192109c795062f/ios/testing/data/http_server_files/console_with_iframe.html
Comment 1 by bugdroid1@chromium.org
, Oct 29