apache / cordova-plugin-inappbrowser

Apache Cordova InAppBrowser Plugin
https://cordova.apache.org/
Apache License 2.0
1.11k stars 2.14k forks source link

executeScript not working in colab #1042

Closed limingzxf closed 4 months ago

limingzxf commented 5 months ago

IMG_20231213_222706

when i open https://limingzxf.github.io/test/index.html will success alert

but fail in colab

breautek commented 5 months ago

We will require more information other than it "fails".

If you're using Android, please use the chrome web inspector to see the JS console. On iOS, Safari web inspector can be used.

limingzxf commented 5 months ago

12-14 15:25:20.559 22155 22155 D InAppBrowser: in blank 12-14 15:25:20.559 22155 22155 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.yc.cl activity: com.yc.cl.MainActivity@176be2 12-14 15:25:20.567 22155 22155 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.yc.cl activity: com.yc.cl.MainActivity@176be2 12-14 15:25:20.592 22155 22155 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.yc.cl activity: com.yc.cl.MainActivity@176be2 12-14 15:25:20.596 22155 22155 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.yc.cl activity: com.yc.cl.MainActivity@176be2 12-14 15:25:20.603 22155 22155 D EgretLoader: EgretLoader(Context context) 12-14 15:25:20.604 22155 22155 D EgretLoader: The context is not activity 12-14 15:25:20.613 22155 22155 D ForceDarkHelper: updateByCheckExcludeList: pkg: com.yc.cl activity: com.yc.cl.MainActivity@176be2 12-14 15:25:22.789 22155 22206 D NetworkSecurityConfig: No Network Security Config specified, using platform default 12-14 15:25:24.914 22155 22155 I chromium: [INFO:CONSOLE(196)] "initResin", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/external_polymer_binary.js (196) 12-14 15:25:25.293 22155 22155 I chromium: [INFO:CONSOLE(1655)] "Experiment flags: ai_unsubscribed_warning: true, aida_cell_button: false, aida_complete_code_model_id: "", aida_do_conversation_model_id: "", aida_generate_code_model_id: "", aida_in_editor: false, allowed_public_url_domains: ["huggingface.co","dagshub.com","storage.googleapis.com"], backend_version: "next", bq_tid: true, cell_tags: false, chat: true, classified_generate: false, classroom_iframe_parent_origin: "", client_text_compose: false, client_trim_completion_text: 100, cloud_origin: "", commands_in_toolbar: false, comment_poll_long: 900000, comment_poll_short: 60000, converse_temp: "", crawler: false, dbu: "", debug_external: "external", debug_prod: "prod", development: false, document_change_poll_interval: 30000, drive_anon_api_key: "AIzaSyB10s2vWUTwP0pj20wZoxmpZIt3rRodYeg", drive_api_key: "AIzaSyCN_sSPJMpYrAzC5AtTrltNC8oRmLtoqBk", drive_background_save_project_number: "948411933973", drive_realtime_project_number: "", embedded_connection_poll: false, enable_adhoc_backends: false, explain_cell: false, explain_error: true, external_trusted_github_org_repos_quick_add: "GoogleChrome/CrUX,google/generative-ai-docs", first_party_auth: true, generate_code: true, generate_code_prompt: true, generate_df: true, generate_fix: true, generate_temp: "", get_started: false, gis_auth: true, github_client_id: "5036cf6d81e65aaa6340", gpu_utilization_check_interval_ms: 600000, hats_surveys: true, ids: [20730129,20730159,20730150,20730177], import_data: false, internal_schedule: false, is_prober: false, jsraw: "compiled", key_promoter: false, local_cloud_apis: false, local_service_worker: false, log_hover_type: false, lsp_diagnostics_reporting: false, lsrp: 0, ml_banner: false, ml_enabled: false, ml_suggest_on_empty_lines: true, mlpp: false, mlpp_multiline: false, mlpp_on_by_default: true, mlpp_trim_completion_text: 100, mobile: true, next_steps: false, no_fun: false, og_dark: false, outage_notification: "", outage_notification_link: "", outputframe_version: "", override_suf_params_for_test: false, quickchart_button: true, recaptcha_polling_frequency_ms: 300000, recaptcha_v2_site_key: "6LfQttQUAAAAADuPanA_VZMaZgBAOnHZNuuqUewp", recaptcha_v3_site_key: "6LfQPtEUAAAAAHBpAdFng54jyuB1V5w5dofknpip", reconnect_max_delay_seconds: 300, require_ai_consent: true, resource_poll_interval_ms: 10000, rp_kxhr: false, rp_lsp: false, rp_term: false, rp_token_refresh_headroom_millis: 300000, rt: false, runtime_env_overrides: "\n [\n [\"ENABLE_DIRECTORYPREFETCHER\", \"1\"]\n ]\n ", runtime_type_for_test: "", server_execution_queue: true, session_resume_coalesce: true, sheets_paste: true, show_payments_interstitial: false, show_relnotes_on_open: true, show_signup_survey: true, show_subscription_renewal_time: false, show_switch_to_prod_link: false, sql_cell: false, sql_cell_buttons: false, suspicious_code_matches: "", suspicious_code_regexs: "", term4all: false, text_compose_report_changes_millis: 10000, text_span_comments: false, unified_compose: false, unmanaged_vm_min_label_block: "", unmanaged_vm_min_label_warn: "", unmanaged_vm_min_release_tag_block: "", unmanaged_vm_min_release_tag_warn: "", use_corplogin: true, use_dm_sql_lsp: false, uxr_survey: false, verbose_warnings: false, vertex_autopush: false, vertex_staging: false, waffle: false, workstations: false", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/external_polymer_binary.js (1655) 12-14 15:25:25.403 22155 22155 I chromium: [INFO:CONSOLE(3028)] "Loading...", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/external_polymer_binary.js (3028) 12-14 15:25:25.405 22155 22155 I chromium: [INFO:CONSOLE(4285)] "Loading notebook. /v2/external/notebooks/intro.ipynb", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/external_polymer_binary.js (4285) 12-14 15:25:26.383 22155 22155 I chromium: [INFO:CONSOLE(4826)] "Origin trial controlled feature not enabled: 'serial'.", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/external_polymer_binary.js (4826) 12-14 15:25:26.383 22155 22155 I chromium: [INFO:CONSOLE(4826)] "Unrecognized feature: 'xr-spatial-tracking'.", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/external_polymer_binary.js (4826) 12-14 15:25:26.383 22155 22155 I chromium: [INFO:CONSOLE(4826)] "Unrecognized feature: 'clipboard-write'.", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/external_polymer_binary.js (4826) 12-14 15:25:28.475 22155 22155 E chromium: [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported. 12-14 15:25:28.475 22155 22155 E chromium: [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported. 12-14 15:25:28.489 22155 22205 W cr_media: Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording 12-14 15:25:28.495 22155 22219 I CameraManagerGlobal: Connecting to camera service 12-14 15:25:28.511 22155 22155 D CordovaActivity: Paused the activity. 12-14 15:25:28.512 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.512 22155 22219 I chatty : uid=11686(com.yc.cl) ThreadPoolSingl identical 1 line 12-14 15:25:28.512 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.512 22155 22219 W CameraManagerGlobal: [soar.cts] ignore the status update of camera: 2 12-14 15:25:28.512 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.512 22155 22219 W CameraManagerGlobal: [soar.cts] ignore the status update of camera: 3 12-14 15:25:28.512 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.512 22155 22219 W CameraManagerGlobal: [soar.cts] ignore the status update of camera: 4 12-14 15:25:28.513 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.513 22155 22219 W CameraManagerGlobal: [soar.cts] ignore the status update of camera: 5 12-14 15:25:28.513 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.513 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.518 22155 22175 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.518 22155 22175 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.518 22155 22175 W CameraManagerGlobal: ignore the torch status update of camera: 2 12-14 15:25:28.518 22155 22175 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.518 22155 22175 W CameraManagerGlobal: ignore the torch status update of camera: 3 12-14 15:25:28.519 22155 22175 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.519 22155 22175 W CameraManagerGlobal: ignore the torch status update of camera: 4 12-14 15:25:28.531 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.535 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.542 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.544 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.550 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.555 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.604 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.606 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.608 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.611 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.615 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.618 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.622 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.632 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:28.636 22155 22219 E libc : Access denied finding property "camera.aux.packagelist" 12-14 15:25:29.110 22155 22155 D CordovaActivity: Stopped the activity. 12-14 15:25:29.289 22155 22155 D CordovaActivity: Started the activity. 12-14 15:25:29.290 22155 22155 D CordovaActivity: Resumed the activity. 12-14 15:25:29.971 22155 22181 W RenderInspector: DequeueBuffer time out on com.yc.cl/com.yc.cl.MainActivity, count=1, avg=16 ms, max=16 ms. 12-14 15:25:30.648 22155 22155 I chromium: [INFO:CONSOLE(215)] "Service worker state: installed", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/output_binary.js (215) 12-14 15:25:30.648 22155 22155 I chromium: [INFO:CONSOLE(215)] "Service worker state: activating", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/output_binary.js (215) 12-14 15:25:30.650 22155 22155 I chromium: [INFO:CONSOLE(215)] "Service worker state: activated", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/output_binary.js (215) 12-14 15:25:30.721 22155 22155 I chromium: [INFO:CONSOLE(215)] "Service worker state: installed", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/output_binary.js (215) 12-14 15:25:30.721 22155 22155 I chromium: [INFO:CONSOLE(215)] "Service worker state: activating", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/output_binary.js (215) 12-14 15:25:30.721 22155 22155 I chromium: [INFO:CONSOLE(215)] "Service worker state: activated", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/output_binary.js (215) 12-14 15:25:33.882 22155 22181 D OpenGLRenderer: endAllActiveAnimators on 0x7c08424a00 (RippleDrawable) with handle 0x7bab28b9e0 12-14 15:25:33.912 22155 22155 I chromium: [INFO:CONSOLE(2160)] "Skipping recording uncaught error from XHR: unknown name [object ErrorEvent]", source: https://ssl.gstatic.com/colaboratory-static/common/f5275e00f2f8758bce9440e8e82b56e9/external_polymer_binary.js (2160) 12-14 15:25:33.912 22155 22155 I chromium: [INFO:CONSOLE(1)] "Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'nonce-oHc4ttw40AD+/t+5hk5ldw==' 'strict-dynamic' 'report-sample' https: http: 'unsafe-inline' https://www.google.com/js/bg/ https://support.google.com/inapp/ https://www.google.com/tools/feedback/ https://www.gstatic.com/inproduct_help/ https://www.gstatic.com/support/content/ https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/". 12-14 15:25:33.912 22155 22155 I chromium: ", source: https://colab.research.google.com/ (1) 12-14 15:25:34.502 22155 22155 D CordovaActivity: Paused the activity. 12-14 15:25:35.016 22155 22155 D CordovaActivity: Stopped the activity. 12-14 15:25:36.693 22155 22175 I com.yc.cl: Explicit concurrent copying GC freed 58141(3063KB) AllocSpace objects, 1(24KB) LOS objects, 24% free, 3957KB/5276KB, paused 107us total 81.499ms

I don't know how to debug use chrome web i use logcat

limingzxf commented 5 months ago

Content-Security-Policy: script-src 'self'; This should be the cause of the problem

breautek commented 4 months ago

"Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'nonce-oHc4ttw40AD+/t+5hk5ldw==' 'strict-dynamic' 'report-sample' https: http: 'unsafe-inline' https://www.google.com/js/bg/ https://support.google.com/inapp/ https://www.google.com/tools/feedback/ https://www.gstatic.com/inproduct_help/ https://www.gstatic.com/support/content/ https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/".

This indicates that you're trying to use eval (which makes sense because I think behind the scenes, executeScript invokes eval to run JS) but the page does not allow unsafe-eval.

If you control the page or the server, the CSP policy needs to be updated so that the script-src includes the 'unsafe-eval' policy. If you do not control the page / server, then you won't be able to inject JS into that page.

Closing because this doesn't appear to be a bug with the in app browser plugin.