sidorares / crconsole

Remote JavaScript console for Chrome/Webkit
MIT License
262 stars 23 forks source link

Execution error #10

Closed outaTiME closed 9 years ago

outaTiME commented 9 years ago

Hi pal,

When i run the comman i get the following error:

$ crconsole 
https://www.google.com.ar/?gfe_rd=cr&ei=nqPrVNtH04CpBbusgKAC&gws_rd=ssl
www.google.com.ar> repl.js:400
  this.prompt(preserveCursor);
       ^
TypeError: string is not a function
    at REPLServer.displayPrompt (repl.js:400:8)
    at null.<anonymous> (/usr/local/lib/node_modules/crconsole/index.js:256:17)
    at emit (events.js:104:17)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/crconsole/node_modules/chrome-remote-interface/index.js:54:48)
    at EventEmitter.emit (events.js:107:17)
    at WebSocket.<anonymous> (/usr/local/lib/node_modules/crconsole/node_modules/chrome-remote-interface/lib/chrome.js:114:23)
    at WebSocket.emit (events.js:104:17)
    at WebSocket.establishConnection (/usr/local/lib/node_modules/crconsole/node_modules/chrome-remote-interface/node_modules/ws/lib/WebSocket.js:714:8)
    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/crconsole/node_modules/chrome-remote-interface/node_modules/ws/lib/WebSocket.js:627:25)
    at ClientRequest.g (events.js:199:16)

im running node 0.12 version on macos

sidorares commented 9 years ago

thanks, I can reproduce it. I was using undocumented repl.prompt() and it seems that API has changed

sidorares commented 9 years ago

iojs and 0.12 only - 0.10 does not give error. On it

fakedrake commented 9 years ago

+1

sidorares commented 9 years ago

hm, I thought I fixed this

sidorares commented 9 years ago

oh, that was https://github.com/sidorares/node-vim-debugger/issues/17

sidorares commented 9 years ago

same fix should apply here. I'll try to fix tomorrow unless you can try before me @outaTiME @fakedrake

sidorares commented 9 years ago

published as v1.0.0

outaTiME commented 9 years ago

Hi pal,

Now it works but i get a new error, here the stack:

$ crconsole
http://localhost:9000/desktop/dashboard.html
url.js:110
    throw new TypeError("Parameter 'url' must be a string, not " + typeof url)
          ^
TypeError: Parameter 'url' must be a string, not undefined
    at Url.parse (url.js:110:11)
    at Object.urlParse [as parse] (url.js:104:5)
    at WebSocket.initAsClient (/usr/local/lib/node_modules/crconsole/node_modules/chrome-remote-interface/node_modules/ws/lib/WebSocket.js:475:23)
    at new WebSocket (/usr/local/lib/node_modules/crconsole/node_modules/chrome-remote-interface/node_modules/ws/lib/WebSocket.js:59:18)
    at Chrome.connectToWebSocket (/usr/local/lib/node_modules/crconsole/node_modules/chrome-remote-interface/lib/chrome.js:131:15)
    at Object.ChromeREPL.setTab (/usr/local/lib/node_modules/crconsole/index.js:236:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/crconsole/index.js:23:12)
    at /usr/local/lib/node_modules/crconsole/index.js:172:7
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/crconsole/node_modules/chrome-remote-interface/lib/chrome.js:123:13)
    at IncomingMessage.emit (events.js:129:20)

something wired, here nooup ??

thks !!

sidorares commented 9 years ago

can't reproduce. What is your chrome version?

Could you add console.log(tab) before https://github.com/sidorares/crconsole/blob/master/index.js#L236 ? For some reason webSocketDebuggerUrl property is not set for you

outaTiME commented 9 years ago

Hi pal, there my chrome version:

screen shot 2015-04-29 at 22 30 49

i could try, give me few minutes ...

outaTiME commented 9 years ago

yay, im clone the repo and running locally ...

the '>>>' are console.log('>>>', tab); in:

https://github.com/sidorares/crconsole/blob/master/index.js#L236

here the trace:

[0] chrome-devtools://devtools/bundled/devtools.html?&can_dock=true&dockSide=undocked&toolbarColor=rgba(230,230,230,1)&textColor=rgba(0,0,0,1)
[1] chrome-devtools://devtools/bundled/toolbox.html?&can_dock=true&dockSide=undocked&toolbarColor=rgba(230,230,230,1)&textColor=rgba(0,0,0,1)
[2] http://localhost:9000/desktop/dashboard.html
[3] https://github.com/sidorares/crconsole
[4] chrome-extension://pafkbggdmjlpgkdkcbjmhmfcdpncadgh/_generated_background_page.html
[5] chrome-extension://onhbegdkgonhlokobjefolhpoidcnida/background.html
[6] chrome-extension://jnihajbhpnppcggbcgedagnkighmdlei/_generated_background_page.html
[7] chrome-extension://gmlllbghnfkpflemihljekbapjopfjik/_generated_background_page.html
[8] chrome-extension://cjpalhdlnbpafiamejdnhcphjbkeiagm/background.html
[9] chrome-extension://chklaanhfefbnpoihckbnefhakgolnmc/_generated_background_page.html
[10] chrome-extension://aomjjhallfgjeglblehebfpbcfeobpgk/_generated_background_page.html
[11] https://docs.google.com/offline/backgroundshell#ouid=u1b9d54c15874ee64
[12] https://docs.google.com/fe/s/fe.s.ClientModule.nocache.js?ouid=u1b9d54c15874ee64
localhost> .switch 2
>>> { description: '',
  faviconUrl: 'http://localhost:9000/skyweb/assets/images/favicon.png?_swc=1430320877323',
  id: '79F92A9E-09A4-4D42-AECA-8175874B4C7A',
  title: 'Dashboard',
  type: 'page',
  url: 'http://localhost:9000/desktop/dashboard.html' }
url.js:110
    throw new TypeError("Parameter 'url' must be a string, not " + typeof url)
          ^
TypeError: Parameter 'url' must be a string, not undefined
    at Url.parse (url.js:110:11)
    at Object.urlParse [as parse] (url.js:104:5)
    at WebSocket.initAsClient (/Users/outaTiME/Code/crconsole/node_modules/chrome-remote-interface/node_modules/ws/lib/WebSocket.js:475:23)
    at new WebSocket (/Users/outaTiME/Code/crconsole/node_modules/chrome-remote-interface/node_modules/ws/lib/WebSocket.js:59:18)
    at Chrome.connectToWebSocket (/Users/outaTiME/Code/crconsole/node_modules/chrome-remote-interface/lib/chrome.js:131:15)
    at Object.ChromeREPL.setTab (/Users/outaTiME/Code/crconsole/index.js:237:17)
    at Object.<anonymous> (/Users/outaTiME/Code/crconsole/index.js:359:14)
    at IncomingMessage.<anonymous> (/Users/outaTiME/Code/crconsole/node_modules/chrome-remote-interface/lib/chrome.js:123:13)
    at IncomingMessage.emit (events.js:129:20)
    at _stream_readable.js:908:16
sidorares commented 9 years ago

ok, I think I know what is the problem. You already have devtools open and chrome does not allow to connect external client ( that's why your tab is missing webSocketDebuggerUrl ). Close devtools and try again

Probably need to add better error handling for this

outaTiME commented 9 years ago

mmm, but i like to display the output in developer tools in crconsole, its not possible ??

sidorares commented 9 years ago

you can try to use https://github.com/sidorares/crmux

outaTiME commented 9 years ago

mmm, i trying crmux ... but i want to display the developer tools output in my terminal not in a remote window it could be possible ??

sidorares commented 9 years ago

Which output? console messages are redirected back to terminal, you should be able to see them

outaTiME commented 9 years ago

with the crmux ??

There is my scenario:

  1. Running app in localhost.
  2. App generate output in dev tools console (console.log)
  3. I want to show this log (the dev tools console) in terminal.

Which is the step by step to perform this ?? maybe i doing something wrong ...

thks!

sidorares commented 9 years ago

no, you don't need crmux. Just attach crconsole (make sure there is no devtools attached ) messages should automatically appear in your crconsole session. No extra steps required

outaTiME commented 9 years ago

mmmm, but only displays the console.log not all messages right ???

i got a lot of console.info and these data not shown =( it possible ??

outaTiME commented 9 years ago

the console output not are really identically =(

sidorares commented 9 years ago

You are right, it's ignored - the code is here https://github.com/sidorares/crconsole/blob/master/index.js#L250

outaTiME commented 9 years ago

ooups, some reason for that ?? our it will be updated ??

sidorares commented 9 years ago

not sure, probably no reason. Can you try to disable filtering? Just comment out https://github.com/sidorares/crconsole/blob/master/index.js#L250-L251

outaTiME commented 9 years ago

jejeje, great ... i try to update the code locally and try ...

i give you my feedback if found any side effect ^^

thks !

sidorares commented 9 years ago

probably would be nice to display logs in different color based on the level

outaTiME commented 9 years ago

yup, probably it will very usefull ... BTW if i comment the filtering all goes fine ... no exceptions ^^

but expressions in logs are not resolved =(

like:

[Platform.Desktop.Modules.Dashboard] Incoming message: %s record(s) updated in: %sms

outaTiME commented 9 years ago

Some limitation in Chrome REPL ??

sidorares commented 9 years ago

can you post exactly your code which outputs log? Whith console.log('test') or console.info('test') I can see messages ( filtering is commented out )

outaTiME commented 9 years ago

The simple logging works, but if you put something like:

console.log('Today is: %s', new Date())

the crconsole displays:

'Today is: %s'without the replacement, it understands ??

sidorares commented 9 years ago

yes, but you'll need to process parameters manually. Uncomment https://github.com/sidorares/crconsole/blob/master/index.js#L248 to see payload, it's in message.parameters

sidorares commented 9 years ago

added #13 to track progress