Bug 99729 - Web Inspector: Invalid Regex in SASSSourceMapping/didRequestContent, breaks Support for Sass experiment
Summary: Web Inspector: Invalid Regex in SASSSourceMapping/didRequestContent, breaks S...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-18 09:45 PDT by Damir Zekić
Modified: 2012-10-19 03:09 PDT (History)
8 users (show)

See Also:


Attachments
Patch (2.37 KB, patch)
2012-10-19 02:55 PDT, Alexander Pavlov (apavlov)
vsevik: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Damir Zekić 2012-10-18 09:45:55 PDT
To reproduce the issue:

1. Create a Sass file with last rule on line 180 or further
1. Compile Sass with debug-info
3. Load a document that references compiled CSS — the feature will be broken. Even Sass files with less than 180 and more than100 lines will display wrong line numbers be wrong.

It seems that the regex on the following line replaces too much:
var line = parseInt(decodeURI(match[2].replace(/(..)/g, "%$1")), 10);

see http://trac.webkit.org/browser/trunk/Source/WebCore/inspector/front-end/SASSSourceMapping.js?rev=129862#L86

The regex replaces value like "3170" with "%31%70" which decodes to "1p" whereas "170" was intended. Decoding value like "%31%83" throws URIError.

A simple fix seems to be to replace "/(..)/g" with "/(.)/".
Comment 1 Alexander Pavlov (apavlov) 2012-10-19 02:55:37 PDT
Created attachment 169584 [details]
Patch
Comment 2 Alexander Pavlov (apavlov) 2012-10-19 03:09:21 PDT
Committed r131883: <http://trac.webkit.org/changeset/131883>