Chrome’s Missing De-Obfuscate Option

EDIT: This post is now irrelevant..I’ve since found the new placement of the ‘Pretty Print’ button

Making debugging easier

One of my biggest paints when developing/debugging my HypeMachine extension was that they minify all most of their scripts they use. That’s why it was a pleasant surprise to hear in Chrome 12.X they had inserted the option to de-obfuscate the scripts in the developer tools window since debugging minified JavaScript is almost impossible because it makes stepping and tracing through the code nearly impossible.

Chrome Developer tools is almost identical to Firefox’s firebug.

With Minification

Post De-Obfuscation/Minification

After de-obfuscation

Minificiation is the process of removing all unnecessary characters from source code, without changing its functionality. These unnecessary characters usually include white space characters, new line characters, comments, and sometimes block delimiters, which are used to add readability to the code but are not required for it to execute.

Why was it removed? No worries.

I’ve recently started to use the dev/canary build of Chrome to play around with and have noticed that the context menu offering the option was removed. I’m not sure the option was removed in the latest builds (I tried Googling a reason) however I decided this would be a perfect time to muck around with their developer tools and learn some a lot of new things!

Chrome Developer Tools

So I’ve been recently slowly trekking my way up the JavaScript slope (a very awkward and winding slope) and it was neat to see that the frontend for the Chrome Developer Tools are built using JavaScript allowing modifications to their frontend to be straightforward, easy and you can debug it with another instance of Chrome!

  1. Download front end source files.
  2. Make modifications.
  3. Run Chrome with the following command line flag: –debug-devtools-frontend=”full path to the extracted folder”
  4. Run another instance of chrome with the following command line flag: –remote-debugging-port=9222 –user-data-dir=remote-profile
  5. Navigate to http://localhost:9222 on the second instance.
  6. Debug your new modifications to the window!

I had decided to add a button to the Scripts panel which performed the same de-obfuscation/minification as previously done in the context menu. Prior to the addition of the option in the context menu in version 12, I was using very often the site http://jsbeautifier.org/ which performed the same functionality. The sourcode that the site uses was graciously placed on github . Using their scripts, I included them into the frontend package and was happy to have back my missing functionality!

You can find the little modification I made to the frontend package here. I’m sure the old code for the missing de-obfuscation context menu was still lying around in the package but meh.

N.B. JavaScript is crazy and Google writes some even crazier JavaScript.

5 Replies to “Chrome’s Missing De-Obfuscate Option”

  1. Maybe you’re using a different version of the browser, but here should already be button at the bottom of the page that that looks like “{ }” which does what your button does.

    Still, it was nice of you to show that anyone can hack the Developer Tools.

    1. BudimcicThank you for your quick reply!I’ve already imtelmenped your change with one slight change from your reply there was no file layout.xml file here:app/design/frontend/default/default/layout/inchoo/snowflakes/layout.xmlBUT instead I found/modified the following file:app/design/frontend/default/default/layout/inchoo/snowflakes/snowflakes.xml per your suggestion.It is working great on my Magento CE 1.7.0.2 site!Thanks once again.Sincerely,Don V.

    1. V.Changing handler … to … inapp/design/frontend/default/default/layout/inchoo/snowflakes/layout.xml soluhd display snowflakes only on homepage.

  2. I am looking to join some aiiatlffe programs, and I am part of barnes and noble, but looking for some more to make extra money. What programs have you joined that make money, and do you have any tips on making even more money with aiiatlffe programs?

Leave a Reply

Your email address will not be published. Required fields are marked *