Replacing V8 version of Chrome with a Debug Build - javascript

I would like to see the assembly and byte code generated by v8, when it's embedded in chrome. The standalone version of d8 does not have DOM support, so it's not sufficient in this case.
Running './chrome --js-flags="--help"' shows that "--print-bytecode" option is supported in this v8 version, but "--print-code" is not.
More precisely, I would like to run chrome like this:
'./chrome -js-flags="--print-code"'
How can I replace the v8 version in google-chrome with a debug version that supports "--print-code"?
I'm using a 64bit linux os.
Thanks.

Google Chrome builds are linked statically, which means you can't easily replace V8 or any other component.
One option is to compile Chromium from scratch (which will take a few hours). When you do so, simply add v8_enable_disassembler = true to your GN args to enable disassembler support in V8 (which includes --print-code support). See the instructions at https://chromium.googlesource.com/chromium/src/+/master/docs/linux_build_instructions.md.
Another option is to download a Debug build of Chromium (which has disassembler support by default) from the continuous integration infrastructure. This isn't officially supported, but it's possible: go to https://ci.chromium.org/p/chromium/g/main/console, click the latest green box in the chromium.linux > debug > builder > 64 column, scroll down to the "package build" step and click the "download" link.
Warning: What both approaches have in common is that the resulting builds may be very buggy, they don't auto-update, and the sandbox probably isn't working out of the box. You should only use these builds for targeted testing, not for regular browsing.

Related

Can I profile NodeJS Applications using Visual Studio Code?

I can successfully connect the VS Code debugger to my remote NodeJS target using the Chrome protocol. I believe that same protocol supports profiling and performance measurements as it is easy to do from Chrome Dev Tools, but I am not sure it is something I can do from VS Code directly.
Is there any support for this feature ? How can I use it ?
Visual Studio Code 1.45 (April 2020) should help, as it integrates Javascript debugging capabilities, including profiling:
New JavaScript debugger
This month we've continued making progress on our new JavaScript debugger.
It's installed by default on Insiders, and can be installed from the Marketplace in VS Code Stable.
You can start using it with your existing launch configurations by enabling the debug.javascript.usePreview setting.
Here are some new features added this month:
Profiling Support
You can capture CPU profiles from your Node.js or browser applications by clicking the new "Profile" button in the Call Stack view, or using the Debug: Take Performance Profile command.
Once you do, you can choose how long the profile will run: until you stop it, for a length of time, or until you hit another breakpoint.
After the profile ends, it's saved in your workspace folder and visualized in VS Code.
When you open the profile, code lenses are added to your files containing performance information at a function level and for certain 'hot' lines.
Unlike profiles captured in many other tools, the recorded profile is sourcemap-aware.
cheesus mentions in the comments having an problem with the line numbers in the profiler output.
Hence microsoft/vscode-js-debug issue 559:
Turns out this is because that location is inside a function that only exists in the compiled code.
We actually do try to source-map it back into the original file, but there's no mapping at that location to use.
If you change your target to es6 or newer -- which you can do nowadays unless you're targeting Internet Explorer or Node versions <= 4 -- TS does not need to generate this stuff and line numbers work.
Your code will also run faster. Here's the latest mappings
This debugger only supports Node 8 and above.
Due to the fact that this bug is only present when targeting old JavaScript versions when using in-place transpilation on code compiled for a version of Node older than what the debugger itself supports, and the complexity involved in fixing this, I will close this issue as out-of-scope.
There is no plugin/support that I am aware of for initiating the profiling, or heap dumps, etc that are available in Chrome's Dev Tools. But, the VS Code debugger can work alongside the dev tools debugger.
Start from VS Code, and start debugging as you would. Then open dev tools from any tab in the Chrome/Chromium browser, and look for the green icon indicating a node.js debugging process is running (manually done via node --inspect):
.
Click this green icon and you'll have many of the browser dev tools features for debugging the node.js process, specifically the memory and profiler tabs.
Yes, There are many ways.
go to package.json and set:
{
\\ other information
"scripts": {
"debug": "node --inspect-brk"
}
}
after, run use command: npm run debug yourFile.js
or
you can execute in oneline node --inspect-brk yourFile.js
after this:
open chrome and go chrome://inspect
wait for a few seconds, to appears a remote target and click inspect
you can use debbuger; in your code to make a breakpoint.
To learn more go to the documentation.
In alternative you can use a plugin for VS code 'Debugger for Chrome' and follow the guide.
I suppose it worth mentioning here that you can profile nodejs app using plain console.profile and console.profileEnd. It will generate .cpuprofile file in the project root folder which you can open then with VSCode. E.g. I used it to profile Mocha tests.

How can I test on IE8 after installing IE11?

I need to test javascript on IE8 but since I updated I cannot install IE8. What do developers do in this situation?
The most reliable way is having multiple virtual machines installed on your computer (or on a testingstation) that run different windows versions and IE versions.
There is no way to install IE8 or multiple IE versions at the same time on one windows installation.
You find all windows versions and IE versions here and also some instructions how to set up the virtual machines.
Another way is to use the tool IETester, which only runs on windows and kind of simulates different IE's. It never really felt reliable to me.
There are also different companies, which provide multi-browser testing suites. They allow you to remotely test browsers (including IE8) remotely on their servers. For example Browserling or Browserstack.
Use a VM! Get something like virtualbox and you can get the box from Microsoft https://dev.windows.com/en-us/microsoft-edge/tools/vms/windows/
You can use the emulator built into 11 but know that it's not a direct emulation and isn't the real thing. A VM will create a new machine that is running a paired down version of windows and the browser.
If you open the developer tools there is a button on the top right corner which allows you to run the browser as an older version of IE:

Development Mode requires the GWT Developer Plugin

My project using GWT. I haved installed GWT plugin for my Chrome Browser before . I am using the newest version of chrome .When run the project, Chrome browser alway announce
Development Mode requires the GWT Developer Plugin
I have attached the image bellow
But when I click to the link. Chrome browser go to page of plugin in the Chrome web Store. But it announce me that my chrome browser haved installed this plugin. I have attached the screenshot bellow
How can I make GWT plugin work with my project ?
Thank for any help
From GWT Website ,http://www.gwtproject.org/release-notes.html#Release_Notes_2_6_1
GWT Development Mode will no longer be available for Chrome sometime in 2014, so we improved alternate ways of debugging. There are improvements to Super Dev Mode, asserts, console logging, and error messages.
This is because of newer chrome version.Use Super Dev Mode
Other Solution is you can enable NPAPI which was disable in chrome 42 version follow the below steps
1.Open New Tab and Enter chrome://flags/#enable-npapi
2.Enable this Enable NPAPI Mac, Windows
3.Then bottom of the page click "Relunch" button.
I had the same issue this morning.
Switching to super dev mode:
select your project in the Project Explorer -> Debug as -> Web Application(Super Dev Mode)
Console will say:
The code server is ready.
Next, visit: http://127.0.0.1:9876/
Do so and follow instructions there.
Quick recap: Firefox nuked APIs that DevMode needed in 27.0, more than a year ago; Chrome announced approximately at the same time that they were deprecating NPAPI, that DevMode needs. They first made it impossible to update extensions containing NPAPI plugins in the Chrome Web Store a year ago, then they removed NPAPI support on Linux, and now they've just disabled NPAPI in Chrome 42, and will remove support entirely in 45, to be released in September.
"Classic" DevMode is deprecated for nearly 1½ year now; it really is time to move to SuperDevMode!
It's very likely that you are following word for word the instructions from Google at this link.
https://developers.google.com/eclipse/docs/getting_started
The instructions are out of date, and not valid for current versions of chrome.
Instead of selecting the option
Debug As > Web Application
use the option
Debug As > Web Application (GWT Super Dev Mode)
Google has "given up" on keeping their documentation up to date. I can only imagine how difficult it must be to ignore so many complaints.
From GWT Website ,http://www.gwtproject.org/release-notes.html#Release_Notes_2_6_1
GWT Development Mode will no longer be available for Chrome sometime in 2014, so we improved alternate ways of debugging. There are improvements to Super Dev Mode, asserts, console logging, and error messages.
This is because of newer chrome version.Use Super Dev Mode
NPAPI can be re-enabled in Chrome but it is going away.
Super dev mode supposed to be the way forward but I prefer the classic dev mode.
I'm using Windows. I installed a version of Chromium to stop this being a problem for me. The version I found to be the last of the 41 series was build 310958 which can be obtained here:
https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win/310958/
You need to download the mini_installer.exe file. This version of Chromium will never update itself.
I recommend also that you make a copy of the GWT Developer Plugin that you can install without using Google's store because I believe it will be removed soon. I don't know how to do that, but one member of my team claims to have done it.
This issue is there, as Google has now completely discarded NPAPI which is required by GWT developer plugin which can been seen here:http://blog.chromium.org/2013/09/saying-goodbye-to-our-old-friend-npapi.html
Google now provides "Super Dev Mode" which does not require NPAPI.
For utilizing that you can check this blog: https://www.sencha.com/blog/getting-started-with-gwt-super-dev-mode/
Firefox Portable 26.0 supports the GWT Developer Plugin needed to work with Classic Dev Mode. You can install that along side an up-to-date browser.
For some reason, Super Dev Mode still does not work with some projects. This workaround has worked best for our team.
To get it working on Mac: download this version (Version 38.0.2084.0 (281482)) and install the plugin from the Chrome Web Store.
I did the same thing as suggested by davtom and it worked. I download the chrome-win32.zip file from https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win/310958/ . I unzipped the files in a temp folder and run chrome.exe from there.
Thanks Davtom. This problem was driving me nuts for the past 3 hours. I rebooted, installed a different JDK, uninstalled and reinstalled the plugin but nothing worked.
To overcome this problem, Install very old version of chrome version 10 and run the app in super-dev mode. It would run as it should. There is no requirement to install GWT plugin for this version of chrome.

Ensuring IE-9 compatibility while end to end testing using phantomJS

I am using PhantomJS (headless end to end testing),selenium webdriver,grunt(task runner) for my application testing. My requirement is that the application should be compatible with IE-9. I have to do headless testing because I'm using jenkins for continuous integration.
How do i make sure that my application will run perfectly on IE-9
while testing on phantomJS ?
You can't use PhantomJS for testing compatibility with Internet Explorer, because it is a Webkit browser.
Since you're using Selenium, you should be able to use the IE WebDriver.
Some thoughts on why you can't even simulate IE in PhantomJS:
They are built on different base technologies. They use different rendering engines and both have different bugs when it comes to adhering to W3C specifications.
JavaScript bugs may be simulatable, but this requires you to go ahead and fix all bugs that PhantomJS has in comparison to your specific IE version by exchanging the implementation of some browser APIs. You would also need to introduce some bugs that are present in your IE version, but not in PhantomJS again by exchanging implementation.
CSS bugs can only be introduced if you change the WebKit implementation and compile it again. You would have to find them first.
Great, you have effectively reverse engineered IE.

Using the IE8 'Developer Tools' to debug earlier IE versions

I am less than satisfied in my HTML/CSS/JS debugging of pages with IE6 and 7 specific bugs.
I am aware that IE8 has a Firebug clone, called 'Developer Tools' installed.
Is it possible to have IE8 installed (maybe on a VM, i don't mind), set it to compatibility mode (is there one for IE6?), then perform JS debugging and live HTML changes, using the IE8 Developer Tools, just like we can in Firebug?
many many thanks
mieze
There are differences between native IE6/7 and the IE8 compatibility mode:
http://blogs.msdn.com/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx
The best option I've found to debug in IE6/7 is to install the Microsoft Script Editor (not Debugger), that is bundled with Microsoft Office. It's an optional install, so you probably have to open Add remove programs in Control panel and go through setup again. Here's a guide to configure IE after you've installed the Microsoft Script Editor.
http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html
The default view doesn't have breakpoints and such, so take a look at the menu to add the views you like. It's not as good as Firebug, but it's a lot better than alert-debugging ;)
I've said it before, and I'll say it again:
Firebug Lite
That'll let you use Firebug features in whatever browser you feel like using that day...
The most satisfying IE6/7/8 javascript debugging experience I've had is with Visual Studio. And you don't have to shell out the beaucoup bucks to get it either since the Express edition has the same debugger as the higher SKUs.
Install Visual Studio Express Edition (Download)
Create a new project
Click debug to start the empty project
You now have an instance of IE running in a world class debugger!
Just point the browser at your test URL and set breakpoints to your hearts content!
You might want to try MS javascript debugger http://www.microsoft.com/downloads/details.aspx?FamilyID=2f465be0-94fd-4569-b3c4-dffdf19ccd99&displaylang=en
Not without its share of problems though
The IE8 dev tools is an upgrade of the IE Developer Toolbar, which is available for 6 & 7. It doesn't do debugging, but will let you inspect the DOM, etc. Combining it with the JS debugger (as in other answers) is as good as you can get, afaik

Categories