remy / jsconsole Goto Github PK
View Code? Open in Web Editor NEWWeb based console - for presentations and workshops
Home Page: http://jsconsole.com
License: MIT License
Web based console - for presentations and workshops
Home Page: http://jsconsole.com
License: MIT License
I needed jsconsole for testing on Android and it's perfect. Love it.
I very nearly wrote it off as non-functional, however, as the inject script in the latest Firefox (10.0.2) returned this error:
Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMHistory.pushState]
[Break On This Error]
window.history.pushState(cmd, cmd, '?' + encodeURIComponent(cmd));
Confirmed this on Ubuntu and Windows. Not sure why it would disallow that but a simple try/catch block may be in order. The main site works fine.
The log messages on jsconsole.com, do not show up in the same order, as my app fired them.
The only way to use {} is from the SYM menu. Selecting any symbols from the menu does nothing.
Would be nice to have :lo<tab>
must complete to :load
?
/me is not able to recall, if this was there on jsconsole before ๐ด
'use strict';
const fs = require('fs');
process.env.PORT = process.argv[2] || 8000;
fs.readFile('lib/app.js', (err, data) => {
if (err) throw err;
if (data.indexOf('"use strict"') !== 0) {
fs.writeFileSync('lib/app.js', '"use strict";\n' + data);
}
require('./lib/app');
setTimeout(function() {
let address = 'http://127.0.0.1:' + process.env.PORT;
require('child_process').exec('start ' + address);
console.log('start browser at ' + address);
});
});
I'm trying to fix a weird bug that appear just in the facebook in-app browser, and jsconsole is very handy in this situation. Basically after a successfull :listen
i trigger a function onClick where i put a logger on the suspicious piece of code, and what i get back is:
That as you can imagine is not very helpful. Looking deeper, (not 100% this is related) i see this in my console:
Uncaught RangeError: Maximum call stack size exceeded. remote?myID:30
Can be something related to the bug i'm facing, so something that belongs to my implementation or is related to jsconsole remote.js
itself?
/cc @remy
Thank you
Stefano
Here's an interesting quirk I found. You've attached the error
event using addEventListener
in your remote.js script but when an error occurs all the arguments are undefined, but only in firefox.
I did some testing and found attaching the event using DOM0 event handler works and passes through the information.
See DOM0 example here (click the result panel to trigger an error): http://jsfiddle.net/ryanseddon/3Nm5x/11/
See DOM2 event handler here: http://jsfiddle.net/ryanseddon/3Nm5x/10/
User types:
:help
Gets a response in the console with keyboard shortcuts, shift+up/down, meta+shift+del, etc.
@remy was kind enough to share a temporary URL to support SSL.
jsconsole doesn't seem ready for it as it tries to load content over http once it fires in the running app.
Chrome will output an error like this when it happens:
[blocked] The page at 'https://foobar.com' was loaded over HTTPS, but ran insecure content from 'http://remote.html/?BD7C07A2-C379-4D43-B34B-33C9C0825E37': this content should also be loaded over HTTPS.
In jsconsole
undefined:undefinedlink
undefined
in Chrome Dev Tools Console
Uncaught TypeError: Object # has no method 'GetMAC'
Is it possible to show error in more convenient way instead of undefined?
When loading over http:
(index):45 Uncaught (in promise) DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).(anonymous function) @ (index):45
When loading the page over https, a 404 error when getting sw.js is raised instead.
GET https://jsconsole.com/sw.js net::ERR_FILE_EXISTS
I have not tried the locally hosted version yet, but I have been unable to get remote debugging or injection to work thus far.
When running jsconsole from the downloaded source. the script tag that gets spit out always points to jsconsole.com when starting a listener.
Can this be changed to wherever it's being accessed from?
For instance: when running
node server.js 1337
to get
localhost:1337/?%3Alisten
<script src="http://localhost:1337/remote.js?SOME-LONG-RANDOM-ID"></script>
Thanks!
What do you mean exactly by "Permalink to session"?
A session persistant across different browsers/computers or... a session persistent through page reloading / tab duplication / etc. ?
For the later, you could use WebStorage / WebSQL API in browsers that support them to allow sessions to be saved.
Ala Webkit console.
Switch to using a div, -webkit-user-modify prop for cursor - Q: anything like this for other browsers? Perhaps PE? Perhaps contenteditable?
Read keys when focused creating index of objects that match the string being entered. Need to re-read all objects on global space after new code is submitted (in case they create new variables).
Tab and escape autocompletes.
When the user hits a dot, navigate down that object and offer nested objects for autocomplete. Don't preview function calls though (I think Webkit /is/ doing this).
Tried to install it by cloning this repository, running npm install and then the node server.js.
The page loads up, and I can get a key but when including the script in a remote page it never seems to connect to the server. I can see in the network tabs that both the dashboard and the remote page are connected to port 8000. When I debug it seems that both pages get a 'session' with the same id and they overwrite each other.
I am using chrome though I doubt it will matter.
Orange [shift] + y ['('] gets first command in command history list instead of expected "(", cannot type function names or anything containing a parens
I'm probably missing something obvious, but: when you type e.g. window
into http://jsconsole.com, you get a sweet pretty-printed representation. Near as a I can tell this is implemented in the public/js/prettify.packed.js
TLOB; is the unminified source code available?
When performing a remote listen I encounter some strange behavior. At first it seemed like it does not connect at all. Then I realized the communication is very, very slow. It takes about 2 minutes until the message "Connected to xxxxxxxxxx" appears. Each log from the remote page again takes minutes to appear in the console in a random order.
This happens in different browsers: Opera, Firefox, Chrome. I don't know how to replicate it. At my workmate's computer it works just fine.
Hello,
I have to wait about 2 minutes before to see the console populated ? This is a normal duration ? by looking the video, i can see that the result is almost immediat. However my network connection is fast.... any explanation?
Regards,
Johnny
The call stack maximum exceeds instead. Example:
a = { val:1 };
b = { a:a };
a.circular = b;
Hey, I use this magnificent tool whenever I need to track down an issue on iOS mobile. But it isn't working today.
I open http://jsconsole.com on Safari, it redirects to https, but then it doesn't connect. Chrome on safari returns ERR_SSL_PROTOCOL_ERROR. With IP it's the same thing.
Also, it fails SSL validation: https://www.ssllabs.com/ssltest/analyze.html?d=jsconsole.com
The remote script is breaking the Internet Explorer on old Windows Mobile devices. I tested it on the "HTC Touch Diamond 2" and the "Windows Mobile 6.5 Emulator". IE is crashing with error 80004004 - whatever that means...
I really don't think you should care, but I wanted to let you know.
Getting 'Application Error'
Just letting you know...
This was working fine earlier, but now on running :listen in jsconsole prompt, no connection is created at all (tried in chrome / ff / safari).
The remote callback seems to be in a waiting state, and the remote log is still pending after minutes and hours, i.e., doesn't ever complete.
Any clues ? I love this tool, and would be a shame to not have it working.
Maybe it's just me, but it seems that this only works for console.log, and not for the other methods. Can those be added?
Hi,
Can jsconsole log to a file instead of relying on an open browser?
Thanks
In order to use jsconsole for providing support, It would usefull to have this workfow:
Basically, this is the way how teamviewer and other products work (it's easier to read the key from device and give it to support, than having support giving you the key and having to enter it).
BTW, on the client, you can generate a numeric random key with:
var supportPassword = GenerateRandomString(6, '0123456789');
function GenerateRandomString(length, chars) {
var result = '';
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
return result;
}
and then activate the connection with:
(function(s){s.src='http://imatronix.com:60701/remote.js?' + supportPassword;document.body.appendChild(s)})(document.createElement('script'));
The problem is that you need to wait that support executes the :listen command with the key, before activating the connection on the client device.
This could be done with an alert("Please wait...") before trying to activate the connection.
If you could do something to detect a connection failure (because support didn't :listen yet) and retry, it would be usefull to.
Could shift+enter insert a newline, rather than trigger evaluation?
:load underscore
results in:
Failed to load http://documentcloud.github.com/underscore/underscore-min.js
The following libraries are also out of date:
rightjs: Failed to load http://rightjs.org/hotlink/right.js coffeescript: Failed to load http://jashkenas.github.com/coffee-script/extras/coffee-script.js
I want to make a fork of this. I noticed on the jsbin repo, you have a license specified and pledgie. I'd love to see both on this repo. Thanks!
Small bug I just noticed:
x = '<'
and press enteractual result: x = '<'
appears
expected result: x = '<'
appears
Haven't tested, but I expect > and & produce similar output. I haven't looked at the jsconsole code at all, but I wouldn't mind helping fix this, especially if I got a hint of how to do it.
Migrated from: jsbin/jsbin#2086 (comment)
IMO the console should quit putting quotes around strings similar to how Firefox's devtools do and follow Chrome's example. Putting quotes around outputted strings is misleading as users could take them to be string literals when they're not.
Here's an example where Chrome's quote free method shines:
'as\\"df' // console input
"as\"df" // Firefox output | The value changes when evaluated as a string literal: as"df
"as\\"df" // jsconsole output (evaluated as a string literal this throws a syntax error)
as\"df // Chrome output
When performing a remote listen I'm getting the following error on Mobile Safari (iOS 4.3) when I include console.js - here's the error in full (limited due to a rubbish developer tool in the browser):
Javascript Error on Line 564
TypeError: Result of expression 'exec' [null] is not an object.
That's probably useless, but I imagine the issue is easy to replicate..
i clone jsconsole, and just run server.js , which give me errors below:
geimatoMacBook-Air:neekey-jsconsole-2ad9248 neekey$ node server.js
Listening on 80
node.js:207
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: listen EACCESS
at errnoException (net_uv.js:566:11)
at Array. (net_uv.js:632:26)
at EventEmitter._tickCallback (node.js:199:26)
any idea?
Because of the following line origin = document.location.protocol + '//' + lastSrc.substr(7).replace(/\/.*$/, ''),
origin becomes an empty string if lastSrc was for example = "https://jsconsole.com/js/remote.js?xxx-xxx-xxx".
_get = function(e,c){
var _isClass,_isId,newEle;
typeof e=="string"&&(_isClass = e.indexOf(".")>=0,_isId = e.indexOf("#")>=0,newEle = e.substring(1));
//get frist argument
if(_isClass&&_isId) return;
if(_isId){
var obj = typeof newEle=="string"?document.getElementById(newEle):false;
}else if(_isClass){
var obj = _class(newEle),
_isArr = obj.constructor==Array;
}else{
return;
}
//get class
function _class(c,o){
var oDom = o?o:document,
cParent = oDom.getElementsByTagName("*"),
classAry = [],
leng = cParent.length;
for(var i=0;i<leng;i++){
var allC = cParent[i].className,
word = allC.split(" ");
for(var z=0,len=word.length;z<len;z++){
word[z]==c&&classAry.push(cParent[i])
}
}
return classAry.length==1?classAry[0]:classAry;
}
//second argument
if(!!c){
if(_isArr){
for(var j=0,len=obj.length;j<len;j++){
var ele = obj[j].getElementsByTagName(c);
obj[j] = ele.length==1?ele[0]:ele;
}
}else{
obj = obj.getElementsByTagName(c);
}
}
if(obj)return obj.length==1?obj[0]:obj;
}
Hello,
as first i must say is a very nice tool, i have test it for few weeks.
But now i will debug again and it work not more :(
i get this errors on my browser:
GET https://jsconsole.com/remote/5d3bcc15-a686-4250-bd87-cc1d8e09777f/run net::ERR_CONNECTION_CLOSED
https://jsconsole.com/remote/5d3bcc15-a686-4250-bd87-cc1d8e09777f/log Failed to load resource: net::ERR_CONNECTION_CLOSED
i hope you can fix or help.
Best regards,
Stefan
As alluded to in #66 (comment), requesting http://jsconsole.com/inject.js or https://jsconsole.com/inject.js yields a 404 response, with the body:
{"code":"ResourceNotFound","message":"/inject.js"}
This makes it so the bookmarklet is no longer functional.
I created a new application under Default Web Site in my IIS. I had setup reverseproxy Any requests made to this application will be redirected to jsconsole running on my local at port 8080. Anyone able to do this?
When I run jsconsole locally, using node server.js 8080
, and the command :listen
should produce the script url as
<script src="http://MYIP:8080/remote.js?UNIQUEID"></script>
But it is pointing to http://jsconsole.com/remote.js
. Copy pasting the script link is not possible because of this.
Hi, sorry to trouble you,
I followed the video on youtube but when I type ":listen" to get the id, it says: "Creating Connection" but that's it. I never get to see the next message with the Id.
I tried firefox 4, safari and chrome. I suppose is some feature in my windows 7 that is wrong? Or does it works only on OSX?
[Error] Failed to load resource: The requested URL was not found on this server. (remote.html, line 0):
file:///remote.html?e6916321-8659-4720-a028-1114d9eb2bce
There should probably be a check if the file is on file://
I forked the repo to allow the ID that you can listen on to be dynamically generated in remote.js and then shared with the client as both a string and as a QR code that points to the URL that can be used to launch the console. So tha I don't submit an unsolicited PR, is this something you'd be interested in merging?
Here is a screenshot of how this can be used:
I've install the package,and then there's not a file named server.js.How could I run the server locally ?
$ node server.js 8888
module.js:340
throw err;
^
Error: Cannot find module 'D:\cc\jsconsole\jsconsole-master\server.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
at node.js:963:3
When you are trying to use jsconsole in IE7 it does not support addEventListener. You get the following exception:
Object doesn't support property or method 'addEventListener'
I am trying to click certain list elements on my mobile website and proceed to the next page.
$('#id').click() . The function works perfectly fine when I try it on my web browser however some how its not working on mobile Browsers.
I have been able to fill fields , change CSS etc . I am stuck on this . Any ideas?
Thanks
BTW i think this tool has great potential .
Are there any technical limitations why jsconsole can't be an offline webapp with a manifest file?
In Ruby on Rails I use this http://github.com/wycats/rack-offline to generate the manifest file.
Shift + up/down shortcut does not work in my portable version of Chrome 11.0.696.65 as well as Chrome 12 Beta.
Although it works without any issues in Portable Firefox 4.0 and Internet Explorer 8.
Any console.log methods output to the jsconsole. However, this is not escaped, so console.log(document.body.innerHTML) does not show the HTML of the document in jsconsole, but puts that HTML into the jsconsole page.
console.log("<script>alert('hi');</script>"); would make an alert happen on the jsconsole.com page as well. I'm not sure if XSS is a problem here, but it still makes it difficult to use console.log with html text.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.