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

Issue 596422 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Last visit 29 days ago
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Mapping to network resource not working when file names are different

Reported by damian.t...@gmail.com, Mar 21 2016

Issue description

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

Steps to reproduce the problem:
1. Add folder to workspace with the source files. In this case JS files.

2. Right-click in a file from workspace and "map to network resource...". In the list of files select the one that "matches" by name. In this case the files from the server have a prefix in the name, so names donn't match one by one. Eg. file '/js/011fdd2_clients_controller_1.js' is mapped to 'http://myserver/js/011fdd2_clients_controller_1.js' in the web server.

3. Because names are different, files are not mappped.  

What is the expected behavior?
No. The expected behaviour is to have both files mapped, even if they have different names.

What went wrong?
Files are not mapped. In Settings -> workspace there is an entry where files seem to be mapped but in the sources tab you can still see it (when it is really mapped it disappears from the list from the webserver part). 

Did this work before? Yes Not sure, but in the previous version (48). 

Chrome version: 49.0.2623.87  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 21.0 r0

- with the same names it works.
- tested also in Canary: Versión 51.0.2686.0 canary (64-bit)
 
mapping1.png
22.0 KB View Download
workspace.png
28.6 KB View Download
Cc: dgozman@chromium.org
Owner: pfeldman@chromium.org
Status: Assigned (was: Unconfirmed)
That's right, we do only map files with the same name. Pavel, any ideas?
Yeah, but since Chrome 49 files with source maps presents with postfix sm. For example, instead test.js -> test.js [sm]
And due to this behaviour, I can't mapping remote files to workspace, because different file names.
Labels: -Type-Bug -Pri-2 Pri-1 Type-Bug-Regression
Can you remove [sm] postfix from remote files for fixing regression?
In `WebInspector.SourceMap.prototype._parseMap` method remove:

  if (url === this._compiledURL && hasSource)
    url += WebInspector.UIString(" [sm]");
Any updates if there are plans to implement a fixe for file <==> network resource mapping?

I keep an old version of Chrome 48 around to map a local files to a network resource.  Then when using latest Chrome the file to network resource mapping stays as desired and LiveEdit modifies the local file in place. 

The attached image shows the first two mapped using 48, and the third one is latest version leaving the "/".



596422.PNG
14.4 KB View Download
Chrome 56 broken still!
It even not working with "Persistence 2.0"
WTF?
Now need patch `SDK.TextSourceMap.prototype._parseSources` by removing:

    if (url === this._compiledURL && source)
        url += Common.UIString(' [sm]');

Why you keep this dirty hack, where file name patches with " [sm]" postfix, while you can visualize it with css!
Owner: lushnikov@chromium.org
Status: Started (was: Assigned)
#6: try switching the "Persistence 2.0" experiment on. It should solve your mapping issues.

#7: we'll try to fix the issue under the "Persistence 2.0" experiment.

Started: https://codereview.chromium.org/2698183003/
I enabled Persistence 2.0. The workspace settings now says: "Mappings are inferred automatically via the 'Persistence 2.0' experiment."

When I look at the Sources tree, the Chrome 48 mapping of a network resource to a local file shows, but I don't see where / how to apply new "network resource" to "local file" mappings. 
596422-10.PNG
6.8 KB View Download

Comment 11 Deleted

@caveman: first of all, I'd recommend using experiments on the Chrome Canary - they are better refined.

When you say you don't see where and how to apply new "network resource" to "local file" mappings - what do you mean?

@lushnikov, thanks for the reply.
 
In the old versions of Chrome, you could either:

    1) right click on a local file and "map to a network resource"
      or
    2) right click on a network resource and "map to a local file"

In the image, the little green checkmark was mapped via Chrome 48.  The latest versions respect that mapping that I made using 48, but  in current Chrome, I don't see how to set a mapping for individual network resources to files or vice versa.
 
@cavemansspa: the mappings which you were establishing via "map to a network resource" / "map to a local file" are not used in Persistence2.0. Instead, we try to infer them automatically, based on the file names and certain other factors.

It would be really nice if you try it out and see if it works for your setup!
Could you please give it a shot to Chrome Canary 58?
Project Member

Comment 15 by bugdroid1@chromium.org, Feb 18 2017

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

commit 9614d5a7ab4b1ea2de28ba38edb198c4e7e2a93e
Author: lushnikov <lushnikov@chromium.org>
Date: Sat Feb 18 06:36:45 2017

DevTools: teach automapping to map complex sourcemap setups.

Consider a sourcemap with inlined sources, which has one of the source
urls equals to the compiled url.

In this case, we append the ' [sm]' suffix to the source URL so that
the UISourceCode would not clash in the Workspace. (see  crbug.com/562870 ).
This, however, kills the ability to map this file to the workspace.

This patch exploits the ability of automapping to handle query parameters.
By appending '? [sm]' instead of just ' [sm]', the automapping is able
to establish a binding based on the source size.

BUG= 596422 ,  605548 
R=dgozman

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

[add] https://crrev.com/9614d5a7ab4b1ea2de28ba38edb198c4e7e2a93e/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-nameclash-expected.txt
[add] https://crrev.com/9614d5a7ab4b1ea2de28ba38edb198c4e7e2a93e/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-sourcemap-nameclash.html
[add] https://crrev.com/9614d5a7ab4b1ea2de28ba38edb198c4e7e2a93e/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/sourcemap-name-clash/out.js
[add] https://crrev.com/9614d5a7ab4b1ea2de28ba38edb198c4e7e2a93e/third_party/WebKit/LayoutTests/http/tests/inspector/persistence/resources/sourcemap-name-clash/out.js.map
[modify] https://crrev.com/9614d5a7ab4b1ea2de28ba38edb198c4e7e2a93e/third_party/WebKit/LayoutTests/http/tests/inspector/text-source-map-expected.txt
[modify] https://crrev.com/9614d5a7ab4b1ea2de28ba38edb198c4e7e2a93e/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js

Status: Fixed (was: Started)

Sign in to add a comment