New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 667894 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

exponentiation operator (**) causes pretty print option in Dev Tools to fail.

Reported by crj.wal...@gmail.com, Nov 22 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36

Steps to reproduce the problem:
1. Visit a website that uses the exponentiation operator (**) in a JS file.
2. Open Dev Tools.
3. Within Dev Tools, inspect the JS file that contains "**".
4. Press {} to "pretty print" the file.

What is the expected behavior?
A new tab in Dev Tools should show a reformatted version of the JS file.

What went wrong?
The new tab opens, but it does not show a reformatted version of the JS file.
I have seen two behaviors:
a) Sometimes the tab is empty.
b) Sometimes the tab show the entire file with no reformatting.
Neither behavior matches the expected results.

Did this work before? No 

Chrome version: 54.0.2840.99  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 23.0 r0
 
// e.g. consider this one line JS file:
(function(){console.log("hello world 3x3="+3**2);})();

//It should get reformatted (via pretty print) to look something like this:
(function() {
    console.log("hello world 3x3=" + 3 ** 2);
})();

Cc: ligim...@chromium.org
Labels: M-54 Needs-Triage-M54
The problem also manifests itself with inline javascript inside an HTML file.
I am attempting to upload two html files.
One file uses "Math.pow";  the other file uses "**".

The file that uses "**" can not be reformatted using pretty print in Dev Tools.
exponentiation_with_math_pow.html
438 bytes View Download
exponentiation_with_star_star.html
429 bytes View Download
Owner: lushnikov@chromium.org
Status: Assigned (was: Unconfirmed)
Current source formatter supports ECMAScript 6 while exponentiation operator (**) is a ECMAScript 7 feature. @lushnikov, is there any plan to support es7 or I can just add this and start moving es7?
Labels: Hotlist-Polish
@Ahmet: we rely on acorn for js pretty-printing: https://github.com/ternjs/acorn

As far as the project supports particular es7 feature, feel free to submit patch for pretty-print!
It looks to me like support for the exponentiation operator was added to acorn back in January of this year.

Owner: allada@chromium.org
Project Member

Comment 10 by bugdroid1@chromium.org, Dec 6 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1f78e2d88c8ad8d25e52176c4b76481b383625cb

commit 1f78e2d88c8ad8d25e52176c4b76481b383625cb
Author: allada <allada@chromium.org>
Date: Tue Dec 06 00:54:22 2016

[Devtools] Update Acorn

This patch simply updates acorn to 4.0.3.

NOPRESUBMIT=true
R=lushnikov
BUG= 667894 

Review-Url: https://codereview.chromium.org/2556503002
Cr-Commit-Position: refs/heads/master@{#436474}

[modify] https://crrev.com/1f78e2d88c8ad8d25e52176c4b76481b383625cb/third_party/WebKit/Source/devtools/front_end/formatter_worker/acorn/acorn.js

Status: Started (was: Assigned)
I just tested with Chrome Canary build 57.0.2948.0.
Pretty Print now works as expected on files containing "**".
Thank you.


Status: Fixed (was: Started)

Sign in to add a comment