Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt QWebEngine Remote Debugging: Chrome developer tools no longer work

Recently after some software updates (automated Windows 10 update, and possibly a Chrome auto-update) the developer tools for remote debugging from Qt's QWebEngine stopped working. The JavaScript console shows this:

Uncaught TypeError: document.registerElement is not a function
    at Object.UI.registerCustomElement (shell.js:formatted:18064)
    at shell.js:formatted:18178
    at shell.js:formatted:18266
devtools_app.js:formatted:2606 Uncaught ReferenceError: SDK is not defined
    at devtools_app.js:formatted:2606

The code in question (from shell.js) is this:

UI.registerCustomElement = function(localName, typeExtension, prototype) {
    return document.registerElement(typeExtension, {
        prototype: Object.create(prototype),
        extends: localName
    });
}

What is shell.js and where does it come from? What could be the cause of this problem?

The web page is actually being run in a Qt 5.12.3 web browser, but I'm using Chrome (remotely) for the Developer Tools.

I also upgraded Angular 7.x to Angular 8 at the same time, but no longer believe this is related.

My Chrome is currently version 80.0.3987.116 (Official Build) (64-bit).

UPDATE I just tried downloading an older release of Chromium. (I tried Version 77.0.3823.0 since this dates back to mid-2019.) And debugging there WORKS.

like image 646
Vern Jensen Avatar asked Feb 19 '20 02:02

Vern Jensen


People also ask

What is the Qt WebEngine module?

The Qt WebEngine module provides web developer tools that make it easy to inspect and debug layout and performance issues of any web content. The developer tools are accessed as a local web page using a Chromium or Qt WebEngine based browser, such as the Chrome browser.

How do I enable remote debugging in DevTools?

Remote Debugging lets you inspect a page running on an Android device from your development machine. The workflow below works for most users. See Troubleshooting: DevTools is not detecting the Android device for more help. Open the Developer Options screen on your Android. See Configure On-Device Developer Options. Select Enable USB Debugging.

Is WebAssembly debugging supported in Chrome DevTools?

A year ago, Chrome announced initial support for native WebAssembly debugging in Chrome DevTools. We demonstrated basic stepping support and talked about opportunities usage of DWARF information instead of source maps opens for us in the future: …and much more!

Why doesn't Chrome DevTools detect my Device when plugged in?

See Chrome DevTools Devices does not detect device when plugged in. If you don't see the Allow USB Debugging prompt on your Android device try: Disconnecting and then re-connecting the USB cable while DevTools is in focus on your development machine and your Android homescreen is showing.


2 Answers

https://developer.tizen.org/forums/web-application-development/tizen-studio-debug-tizen-web-application-blank-page-chrome-80

Chrome 80 has deprecated WebComponents v0 which is used by these devtools.

Solution is to launch Chrome with extra parameters re-enabling the feature (while it's still in the engine):

--enable-blink-features=ShadowDOMV0,CustomElementsV0

Or to use a Chromium build corresponding to Chrome 79.x, e.g.

Windows: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win_x64/706915/
Mac: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/706915/
Linux: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/706915/

See: Chrome devtools inspector showing blank white screen while debugging with Samsung TV Tizen Web application

like image 141
bai Avatar answered Sep 20 '22 22:09

bai


Google removed WebComponents V0 from Chrome, but GUI for remote debug uses them. So when you try to launch remote debug on device with old Chrome on board - debugger crashes with

Uncaught TypeError: document.registerElement is not a function

I found two way to fight this

  1. Downgrade Chrome and there is no easy way to do it (if you use mac here link for you https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/668249/)
  2. Upgrade chrome on target device and in most cases it is impossible (
like image 39
Sergey Bargamon Avatar answered Sep 16 '22 22:09

Sergey Bargamon