How to implement JavaScriptCore debugger? - javascript

JavaScriptCore contains debugger package which is written in c++.
This is the link of debugger package.
Can we use this debugger for debugging java script from eclipse or xocde,
Any reference or sample implementation will be helpful.
Thanks

The WebKit folks have recently moved the JavaScriptCore-specific portion of the WebKit Web Inspector (aka Safari's Web Inspector) into JavaScriptCore itself with the intent to allow remote debugging JSContext objects in iOS apps the same way you can debug UIWebView objects now. This feature is supposed to ship with iOS 8.
JavaScript debugging in the Web Inspector is actually built on top of JSC::Debugger so you can either adapt it or use it as a reference implementation. The code lives here, but it seems that it won't work as-is without iOS 8 or OS X 10.10. Still, it seems like a good starting place if you want to build your own debugger interface.

Related

How to Get Full JavaScript/TypeScript Debugging in Chrome with Visual Studio (Like IE)

Is there a method for interactive debugging JavaScript and TypeScript in Visual Studio using Chrome similar to the functionality currently provided with Internet Explorer? With IE I can set a breakpoint in JavaScript or TypeScript in the IDE and step through the code within the IDE. I cannot get that same behavior with Chrome in Visual Studio.
For a fully integrated debugging experience with any JavaScript/browser based application and Visual Studio, you'll need to use Internet Explorer today. As TypeScript compiles to JavaScript, the integrated debugging also requires Internet Explorer.
The "trick" I often use if I want to use another browser is to add a debugger; statement somewhere in my TypeScript/JavaScript code and have the development tools open in Chrome ..., and execution will then stop on that instruction. As long as you have source-maps enabled, you should see your original TypeScript code in the Chrome debugging window. You can then use Chrome debugging tools to set further breakpoints. If the file doesn't change, the breakpoints will be retained from a "refresh" of the page.
This does not allow me to set breakpoints within Visual Studio though, but it's still effective and works well enough for my development.
Update April 2016
As a few in comments have pointed out, there's a path to making this work a little better, although the experience isn't nearly as complete as it is for Internet Explorer. Follow the steps outlined here. It involves starting Chrome with a custom command line (to enable remote debugging):
chrome.exe --remote-debugging-port=9222
And then attaching to the Chrome process with WebKit debugging enabled. You can add a custom browser to make it easy to launch Chrome.
(But, I will add that I haven't been able to get this to work in a way that I find useful and consistent, especially as I use Chrome for most other web browsing.)

Use Chrome/Firefox while debugging client-side

I am using camera with getUserMedia and I get a few errors I want to fix. The thing is Visual Studio only allows me to debug JavaScript (I mean hitting breakpoints) with IE, and IE does not support getUserMedia.
If you want to debug in a browser other than Internet Explorer then you will need to use the Developer Tools of that individual browser and set your breakpoints accordingly. Alternatively you could use console.log() and/or console.warn() to get the state of your objects in code. Visual Studio does not and cannot understand the implementations of different JavaScript and rendering engines (V8, Blink, Gecko etc.) - nor should it ever attempt to do so. These engines move so rapidly with six week release cycles the IDE would be a totally misleading proxy for the actual the platform you're supposed to be testing against.
Both Firefox and Chrome allow you to retain console contents beyond a page reload/navigation and there are tools like Browser Link in Visual Studio will allow you to test in multiple browsers simultaneously - inspecting the console results afterwards for errors (interactions will have to be tested individually in each browser).
If you are testing mobile devices Adobe Shadow that would potentially allow you to test on multiple tablets and/or phone simultaneously whilst using Dev Tools (I believe Chrome) on your laptop or desktop. Otherwise desktop browsers dev tools allow you to debug page running on a connected mobile device using the same browser, or - in the case of Firefox - also Chrome instances on the device.
It is well worth getting to know browser dev tools for front end debugging and troubleshooting, as these are much more powerful for this purpose than those provided with Visual Studio. The free CodeSchool course Discover DevTools (focussed on the Chrome DevTools and sponsored by Google/Chrome) may help you discover some of the features of client developer tooling, and many of the interfaces and techniques will be broadly applicable to other browser dev tools.
If you want to test on devices that are not available to you, browsers that you cannot install on your system (e.g. Safari on Windows) or simply a newer or legacy version which you cannot install alongside the one already installed locally then there are services like Browserstack which allow you to do so in hosted virtual machines. There is a Visual Studio extension available for BrowserStack to help connect to projects running locally.

javascript engine before nitro (in Mobile Safari)

Lots of articles deal with the "new" js engine nitro on iOS.
For developing and comfortable testing for older iOS devices, I would like to install an outdated browser on windows or ubuntu which is using the same js interpreter?
It's so sad that the js interpreter or js engine differs so much, even with parsing scripts.
To find the right WebKit port, I have to know the name of the "old" js engine. Where to find it?
Thanks
In the case of the pastebin example, there is a syntax error because class is a reserved word and can not be written (with strict js settings like on the old ios webkit).
Use .className instead!
To test with different JavaScript engines and browsers I would recommend using the genius Browserstack. It offers emulators for iOS 3.2 to 6.0 for either the iPhone or iPad. With a comprehensive unit testing suite for your app it should be easy to find engine specific errors.

Javascript debugger which works with Android webkit

I was wondering if you could suggest a javascript debugger which works on Android webkit.
I was trying to inject the following code into Android Webkit but for some strange reason could not do it in the begining (i think it might have to do something with specificity but not sure)
document.body.style.color='#ff00ff';
you might want to take a look at weinre:
Try jsHybugger: http://www.jshybugger.org/
It lets you set breakpoints, singlestep, catch exceptions, and interact with the JS/DOM environment. You can use it from Eclipse or from a Chrome or Chrome-compatible debugger on the remote desktop. It can be used with apps that create their own webView.
However, you have to install a few files -- but probably no more complicated to use than weinre. it does extensively modify the JS files (on the fly, transparently to the user) to enable all this debugging -- webKit really should support javascript debugging natively.
Your question shows an issue with altering CSS, which weinre does well. I didn't see that weinre supported debugging javascript (ie breakpoints and singlestepping)

JavaScript Debugging

I am using Visual Studio 2010 Express Developer edition. Developing a Website. I'm using JavaScript in my .aspx pages. How to put breakpoints in Javascript.
Any help is highly appreciated.
Thank You
If you are using Web Developer Express you can do this within Visual Studio - here are the instructions.
If you are using a different Express edition, you will have to use a browser tool for client side debugging - for example Firebug. IE and Chrome have built in developer tools that have this kind of functionality.
You can use your browser's debugger :
For Firefox, you can use Firebug (http://getfirebug.com).
Chrome contains an embedded debugger.
From memory you will need to do the following to get JS debugging in Visual Studio:
Ensure that Internet Explorer has script debugging enabled (somewhere in tools -> options) - this is the bit most people don't know about.
Then go into the .aspx and add a breakpoint by clicking in the left margin of the line of Javascript you want to debug.
Launch the website project in debug mode (F5) and hit the page using IE - your breakpoint should then hit.
As noted by other people you can use a host of other (usually better) tools that come with other browsers.
If you're debugging IE, use the following links:
http://aspnetlive.blogspot.com/2010/02/debugging-java-script-in-visual-studio.html
http://msdn.microsoft.com/en-us/library/7seh8d72.aspx
For Firefox, I recommend Firebug.
http://getfirebug.com/
For Chrome, you can use the Developer's Tools debugger.
Update
Here's a comprehensive list of debugging JavaScript in each browser:
http://siliconforks.com/doc/debugging-javascript/
I like Firebug, plugin for Firefox.
I think the idea is to use the Attach to process option of the Debug menu; but to be honest, I've never had much luck getting VS to do this fluidly (though I remember it working at times, success is spasmodic at best), maybe tabbed browsing has made this an issue - I'm unsure.
One thing I can recommend, however, and we might get a few hecklers, are the Developer Tools of IE9. If nothing else, IE9 has become an invaluable tool for me recently simply because of its Javascript debugging capabilities. Here's an MSDN article to get you started with this.
Using FireBug & Internet Explorer Debuging tool let you debug and put breakpoint on your javascript files

Categories

Resources