Bug 197309 - Uncaught Exception: Uncaught ReferenceError: InspectorFrontendHost is not defined
Summary: Uncaught Exception: Uncaught ReferenceError: InspectorFrontendHost is not def...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac macOS 10.14
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-26 04:47 PDT by Arpit Jain
Modified: 2019-09-13 11:55 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arpit Jain 2019-04-26 04:47:21 PDT
-------
Inspected URL:        (unknown)
Loading completed:    false
Frontend User Agent:  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36

Uncaught Exceptions:
 - Uncaught ReferenceError: InspectorFrontendHost is not defined (at Platform.js:27:11)
    ? @ ReferenceError: InspectorFrontendHost is not defined
    ? @ Platform.js:27:11
 - Uncaught ReferenceError: InspectorFrontendHost is not defined (at LoadLocalizedStrings.js:30:31)
    ? @ ReferenceError: InspectorFrontendHost is not defined
    ? @ LoadLocalizedStrings.js:30:31
    ? @ LoadLocalizedStrings.js:34:3
 - Uncaught ReferenceError: InspectorFrontendHost is not defined (at Setting.js:63:31)
    ? @ ReferenceError: InspectorFrontendHost is not defined
    ? @ Setting.js:63:31)
    ? @ Setting.js:40:44)
    ? @ Setting.js:128:40
 - Uncaught TypeError: Cannot read property 'autoLogProtocolMessages' of undefined (at InspectorBackend.js:48:21)
    ? @ TypeError: Cannot read property 'autoLogProtocolMessages' of undefined
    ? @ InspectorBackend.js:48:21)
    ? @ InspectorBackend.js:238:20
 - Uncaught ReferenceError: InspectorBackend is not defined (at Connection.js:33:1)
    ? @ ReferenceError: InspectorBackend is not defined
    ? @ Connection.js:33:1
 - Uncaught ReferenceError: InspectorFrontendHost is not defined (at LoadInspectorBackendCommands.js:27:30)
    ? @ ReferenceError: InspectorFrontendHost is not defined
    ? @ LoadInspectorBackendCommands.js:27:30
    ? @ LoadInspectorBackendCommands.js:29:3
 - Uncaught ReferenceError: InspectorFrontendHost is not defined (at Setting.js:63:31)
    ? @ ReferenceError: InspectorFrontendHost is not defined
    ? @ Setting.js:63:31)
    ? @ Setting.js:40:44)
    ? @ Resource.js:1194:36
 - Uncaught TypeError: Cannot read property 'name' of undefined (at CodeMirrorAdditions.js:603:27)
    ? @ TypeError: Cannot read property 'name' of undefined
    ? @ CodeMirrorAdditions.js:603:27
    ? @ CodeMirrorAdditions.js:644:3
 - Uncaught ReferenceError: InspectorFrontendHost is not defined (at AppController.js:40:20)
    ? @ ReferenceError: InspectorFrontendHost is not defined
    ? @ AppController.js:40:20)
    ? @ AppController.js:33:46)
    ? @ 119258F2245D3CD992093638CEAC68B9:897:24
-------

* STEPS TO REPRODUCE
1. Trying to get devtools frontend to debug websites on iOS Device (using ios_webkit_debug_proxy)
- Git clone
- Open Workspace in XCode 10.2.1 (10E1001)
- File > Workspace Settings >..>... Relative to Workspace
- Build
- Stop the test after build complete
- cd to WebKitBuild⁩ ▸ ⁨WebInspectorUI.build⁩ ▸ ⁨Debug⁩ ▸ ⁨WebInspectorUI.build⁩ ▸ ⁨DerivedSources⁩
- run static file server
- go to localhost:8080/Main.html


* NOTES
Expected to see blank devtools ui
Changing to ?ws=websocket_debug_host to get debug site on safari on iPhone

Building Blink and using inscpector.html works
Comment 1 Devin Rousso 2019-04-26 08:16:51 PDT
If you're trying to build/run Web Inspector, please follow these instructions <https://trac.webkit.org/wiki/HackingWebInspector>.  You may also find <https://trac.webkit.org/wiki/WebInspectorDebugging> useful.
Comment 2 Arpit Jain 2019-04-28 14:15:12 PDT
I tried the steps and got it to build from the CLI.

But I cant actually use it to debug a Safari tab, I expected
- Blank devtools ui
- Adding ?ws=websocket_debug_host to get debug site on safari on iPhone (like in chrome)
Comment 3 Arpit Jain 2019-06-21 05:01:41 PDT
@Devin Rousso any updates
Comment 4 Devin Rousso 2019-06-21 09:17:46 PDT
Loading Web Inspector from a web page is not currently supported.

You need to run your local build of Webkit <https://webkit.org/running-webkit/> and open Web Inspector as you would in Safari (Develop > Show Web Inspector).

If you want to inspect an a page in Safari on iOS:
1. enable Web Inspector on iOS (Settings > Safari > Advanced > Web Inspector)
2. connect your iOS device to your Mac
3. open a page in Safari on your iOS device
4. launch Safari on your Mac (follow the steps in the link above)
5. select Develop > [your device] > [your page in Safari]
Comment 5 Arpit Jain 2019-09-13 03:15:18 PDT
Thee doubts
1. No way to Extract standalone Webkit WebInspector frontend from Webkit sources ?

2. So there is no way to connect to a Safari page on iOS without the step: 
`Dvelop > [your device] > [your page in Safari]` ?

3. No way to utilise ios_webkit_debug_proxy and get the debuggable pages and then debug them in a standalone Safari Tab ?
Comment 6 Joseph Pecoraro 2019-09-13 11:54:15 PDT
(In reply to Arpit Jain from comment #5)
> Thee doubts
> 1. No way to Extract standalone Webkit WebInspector frontend from Webkit sources ?

You can extract the frontend as you have attempted. But if you are using it, then you must just provide your own "InspectorFrontendHost" global object to fill in the APIs that the Web Inspector frontend uses.

In the past we included a Stub, but we don't anymore. You could provide your own stub. This is when we removed it:
https://trac.webkit.org/changeset/217924/webkit
https://trac.webkit.org/browser/webkit/trunk/Source/WebInspectorUI/UserInterface/Base/InspectorFrontendHostStub.js?rev=216602


> 2. So there is no way to connect to a Safari page on iOS without the step: 
> `Dvelop > [your device] > [your page in Safari]` ?

Correct. That is the only supported way.

> 3. No way to utilise ios_webkit_debug_proxy and get the debuggable pages and
> then debug them in a standalone Safari Tab ?

Correct. That approach has never been a supported way.