Граф коммитов

137 Коммитов

Автор SHA1 Сообщение Дата
Christian Gonzalez 76cbcc4a8a Merge pull request #10 from Microsoft/master
update with master
2016-11-14 11:22:53 -08:00
Christian Gonzalez b4f9d22d83 Add MIT License information to repository (#29)
* Update the API for the source map toolkit to take a StreamReader instead of a string.

* Update the comments for the API interfaces to reflect the new return type.

* Call close on streams when done using them.
Update comments.

* Update documentation (#28)

* Update the API for the source map toolkit to take a StreamReader instead of a string.

* Update the comments for the API interfaces to reflect the new return type.

* Call close on streams when done using them.
Update comments.

* Add some comments to the readme file to describe the APIs of the library

* Update main blurb.

* Update description of API usage.

* Repleace Stream with StremReader to correctly reflect the API

* Replace "input string" with "input callstack string"

* Add MIT license file to root directory

* Add license section to readme

* Add line breaks to license

* Change casing on License.txt

* Change casing on License.txt
2016-10-25 13:34:04 -05:00
Christian Gonzalez 17f376ec76 Add MIT License information to repository (#29)
* Update the API for the source map toolkit to take a StreamReader instead of a string.

* Update the comments for the API interfaces to reflect the new return type.

* Call close on streams when done using them.
Update comments.

* Update documentation (#28)

* Update the API for the source map toolkit to take a StreamReader instead of a string.

* Update the comments for the API interfaces to reflect the new return type.

* Call close on streams when done using them.
Update comments.

* Add some comments to the readme file to describe the APIs of the library

* Update main blurb.

* Update description of API usage.

* Repleace Stream with StremReader to correctly reflect the API

* Replace "input string" with "input callstack string"

* Add MIT license file to root directory

* Add license section to readme

* Add line breaks to license

* Change casing on License.txt

* Change casing on License.txt
2016-10-25 13:30:14 -05:00
Christian Gonzalez 74ba1ccc2b Update documentation (#28)
* Update the API for the source map toolkit to take a StreamReader instead of a string.

* Update the comments for the API interfaces to reflect the new return type.

* Call close on streams when done using them.
Update comments.

* Add some comments to the readme file to describe the APIs of the library

* Update main blurb.

* Update description of API usage.

* Repleace Stream with StremReader to correctly reflect the API

* Replace "input string" with "input callstack string"
2016-10-20 11:39:51 -07:00
Christian Gonzalez 69e524e488 Update documentation (#28)
* Update the API for the source map toolkit to take a StreamReader instead of a string.

* Update the comments for the API interfaces to reflect the new return type.

* Call close on streams when done using them.
Update comments.

* Add some comments to the readme file to describe the APIs of the library

* Update main blurb.

* Update description of API usage.

* Repleace Stream with StremReader to correctly reflect the API

* Replace "input string" with "input callstack string"
2016-10-20 09:52:26 -07:00
Christian Gonzalez 2658b5fe14 Merge pull request #7 from Microsoft/master
Update the public API of the SourceMapToolkit to work with Streams in…
2016-10-14 16:16:45 -07:00
Christian Gonzalez d61c638801 Update the public API of the SourceMapToolkit to work with Streams instead of strings (#27)
* Update the API for the source map toolkit to take a StreamReader instead of a string.

* Update the comments for the API interfaces to reflect the new return type.

* Call close on streams when done using them.
Update comments.
2016-10-14 16:11:07 -07:00
Christian Gonzalez 92fcb01c36 Call close on streams when done using them.
Update comments.
2016-10-14 16:04:27 -07:00
Christian Gonzalez fd9ffaa993 Update the comments for the API interfaces to reflect the new return type. 2016-10-14 15:03:07 -07:00
Christian Gonzalez b438aca156 Update the API for the source map toolkit to take a StreamReader instead of a string. 2016-10-14 14:58:20 -07:00
Christian Gonzalez fa5fe96a27 DeminifyStackFrame should return a stackframe with the original sourc… (#26)
* DeminifyStackFrame should return a stackframe with the original source location of the error instead of one with the the location of the wrapping function.

* Made deminify stack frame never return null. Instead, we will always return a stack frame, which may have null values for the properties.
2016-10-13 19:27:27 -07:00
Christian Gonzalez 2b9fbbc7ad Right now, anonymous methods in Chrome appear as "at http://localhos… (#25)
* Right now, anonymous methods in Chrome appear as  "at http://localhost:19220/crashcauser.min.js:10:13", which breaks our current stack trace parsing since there is no ( character. This change updates the regex to look for the first @,(, or {space} character when matching the url in a stack frame.

Updated the crashcauser to include an anonymous method.

Internet explorer puts "anonymous method" as the method name, which doesn't require changing the parsing logic.

FireFox appears to put a guess at the name of the anonymous method, which means we don't need special parsing logic or unit tests.

* Update regex to look for any whitespace character using \s
2016-10-13 15:35:17 -07:00
Christian Gonzalez 30c93a9b74 Add unit tests to the FunctionMapGenerator to cover the case where an instance method is defined as foo.prototype.bar = function() {} (#24) 2016-10-12 18:02:18 -07:00
Christian Gonzalez a6e6794cfe Make sure the FunctionMapGenerator doesn't crash when the input is null. (#23) 2016-10-12 16:41:40 -07:00
Christian Gonzalez 0f9e754b4d Deminify class name (#22)
* Use resharper to make the function map entry contain an object that wraps the FunctionName and FunctionNameSourcePosition

* Rename FunctionNameInformation to the more generic BindingInformation using ReSharper.

* Perform a mechanical refactoring to allow for a function map entry to have a list of bindings that can be appended to give a complete signature instead of just a single binding

* Refactor the method that gets bindings associated with a function such that it returns a list instead of a single binding

* Add additional information to the bindings for instance methods so that we can get the full signature. For example, foo.prototype = { bar: function() {}} should have a binding for foo and a binding for bar.

* Refactor the StackFrameDeminifier code that interacts with sourcemaps to make it easier to test.

Add support for generating names for methods with multiple bindings.

Move fuzzying logic into GetMappingEntryForGeneratedSourcePosition.

* Tabify SourceMap and SourceMapUnitTests.

* Fill out XML comments for GetMappingEntryForGeneratedSourcePosition
2016-10-12 16:15:03 -07:00
Christian Gonzalez 8f332d48e7 Better method name resolution (#21)
* Add a JavaScript crash causer that will be minified with Google Closure and add end to end tests against callstacks generated with that JavaScript.

* Make GetMappingEntryForGeneratedSourcePosition use a binary chop search to get a matching mapping entry.

* When testing the toolkit against Google Closure, we saw that the column numbers can sometimes be off by 1 in the mappings list. This change adds code in the StackFrameDeminifier to do a second search for mappings with a column number that is one smaller than the desired value if there is no exact match in the mappings list.
2016-10-11 14:52:45 -07:00
Christian Gonzalez 93a835d327 Get the function names when binding functions to objects (#19)
* Add unit tests that should pass when we have support for generating function map entries for functions assigned to object properies or variables

* Refactor the FunctionFinderVisitor so that we can support multiple codepaths for getting the function name and functionNameSourcePosition.

* Add support for functions assigned to a variable.

* Allow for functions bound to an object property to be included in the function map with the correct name.

* Include functions binded to properties against the prototype in the function map.

* In the event that a function is bound to a property name or variable and has a function name (for example var foo = function bar() {}), we should ignore the function's name and instead take note of the name and position of the binding (we'd take foo and not bar in the example). This is to match what will appear in the callstack and also takes into account the fact that some minifiers would strip the function name in this scenario.

* Clean up comments and method names to make them easier to understand
2016-10-11 11:53:32 -07:00
Christian Gonzalez b0135ca628 Include PDB files for the dlls in the NuGet package (#20) 2016-10-10 15:22:40 -07:00
Christian Gonzalez 785a1a2038 Right now if a mapping entry has consecutive semicolons, we only increment the line number once. This was due to the code that removes empty entries when doing the string.split on the semicolon. This change will instead remove the empty entries in the comma split step, which will prevent the call of the segment split code with the empty string as input. (#18) 2016-10-07 11:07:11 -07:00
Christian Gonzalez 1c4fe1ab11 Make the KeyValueCache thread safe. (#17) 2016-10-06 11:45:47 -07:00
Christian Gonzalez 0315642c3d Add null check to ParseSourceMap so that we don't crash when we can't find the source map for a URL. (#16) 2016-10-06 11:03:55 -07:00
Christian Gonzalez a34bcce8ca Fix spacing around PublicKey in the InternalsVisibleTo for Rhino Mocks. (#15) 2016-10-04 15:46:41 -07:00
Christian Gonzalez a7d5ef6f79 Office online integration bug fixes (#14)
* Wrong public key was used for Rhino Mocks.

* The StackFrame should have the full URL of the Javascript file containing the error instead of just the file name. This is especially helpful for consumers of this API that encode the version of the resource in the path of the JavaScript file, like http://foo.com/version1/foo.js
2016-10-04 15:40:06 -07:00
Christian Gonzalez 2c18cf8f47 Dot net version downgrade (#13)
* Downgrade the TargetFrameWorkVersion for the library so that the Office Online applications can consume them.

* In order to use the SourceMapToolkit in Office Online, we need to sign the assemblies with a strong name.
2016-10-04 09:52:59 -07:00
Christian Gonzalez acc1e400ef Stack trace deminify implementation (#12)
* Extract interfaces for StackFrameDeminifier and StackTraceParser

* Function Map should be sorted in decreasing order

We want the wrapping function returned by the functionmap consumer to
contain the closest function to the source position. In order to do
this, we will sort the function map by start source position in
decreasing order so that the first function we encounter that wraps the
source position will be the closest function to the source position.

* Add FunctionNameSourcePosition to FunctionMapEntry

In order to correctly get the original function name from a source map,
we should store the location of the function name.

* Fix unit tests to look for functionName as input to GetMappingEntryForGeneratedSourcePosition

* Implement top level API for stack trace deminification

* Instead of returning a list of DeminifyStackFrameResults for DeminifyStackTrace, wrap the minified and deminified stack traces into a StackTraceDeminifierResult object.

* Extract method that verifies the stack trace deminify end to end test results

* Fix bad merge of comment for functionmapconsumer.cs

* Add comments for Deminify stack trace

* Add comment saying that the stacktracedeminifier constructor throws for null input.
2016-10-03 14:31:09 -07:00
Christian Gonzalez 36319cd766 Stack frame deminifier bug fixes (#11)
* Extract interfaces for StackFrameDeminifier and StackTraceParser

* Function Map should be sorted in decreasing order

We want the wrapping function returned by the functionmap consumer to
contain the closest function to the source position. In order to do
this, we will sort the function map by start source position in
decreasing order so that the first function we encounter that wraps the
source position will be the closest function to the source position.

* Add FunctionNameSourcePosition to FunctionMapEntry

In order to correctly get the original function name from a source map,
we should store the location of the function name.

* Fix unit tests to look for functionName as input to GetMappingEntryForGeneratedSourcePosition

* Update comments for Function Map to reflect new sorting order, convert spaces to tabs in a few files.
2016-09-30 13:51:58 -07:00
Christian Gonzalez d56cd32b4b Add code that deminifies a single stack frame. (#10)
* Implement GetMappingEntryForGeneratedSourcePosition

- Implement a method that will return the first mapping entry that
corresponds to a given line of generated code
- Add unit tests

* Move MappingEntry to it's own file.

* Implement method to deminify a single stack frame

* Add comments to the StackFrameDeminifier

* Throw exception when null stack frame is input.
2016-09-29 20:13:37 -07:00
Christian Gonzalez 853ec88ff8 Stackframedeminify (#9)
* ImplementGetWrappingFunctionForSourceLocation, which finds the FunctionMapEntry corresponding to the function that wraps the given line of code

* Create interfaces for getting the generated code and source map from the consumer of the API

* Add a KeyValueCache that can be used to store source maps and function maps in memory after fetching the backing data from the consumer of the API. Add Rhino Mocks for unit testing

* Implement the FunctionMapStore and SourceMapStore which will be the main API for obtaining source maps and function maps. The source maps and function maps are generated by obtaining the contents of the source map/code file from the consumer of the API. Once the source map and function map has been generated, the value is cached for future use.

* Create a more friendly version of the MappingEntry object that contains the populated Name and Sources fields instead of the indices that currently are presented to the user. In order to minimize code churn, the mappings parser still works with the old object, which was renamed to NumericMappingEntry (+1 squashed commits)

Squashed commits:

[f3f1657] Move SourcePosition into the SourceMapParsingDLL.

* Code cleanup. Clean up empty lines and move interfaces to new files.
2016-09-28 22:43:07 -04:00
Christian Gonzalez 6859324653 Add nuspec file for the toolkit so that we can generate NuGet packages for the library. (#8) 2016-09-21 14:49:43 -07:00
Christian Gonzalez 40311d8782 Function map generator (#7)
* Implement IComparable for Sourceposition

* We'll need code to be able to determine what the location of the function that wraps a given line of code in order to deminify callstacks correctly. Add code that iterates over the JavaScript AST (using AjaxMin) and creates a FunctionMapEntry object that describes the name and location of that function to the FunctionMap.
2016-09-21 11:02:03 -07:00
Christian Gonzalez 01e4ad9692 Ajaxmin testapp (#6)
* Add code to parse stackframes in IE11, Chrome, and FireFox into objects that can be used by the rest of the library. In order to minimize confusion over zero based vs one based line and column numbers, this change ensures that we only ever work with zero based line and column numbers.

* Minify crashcauser.js so we can get minified call stacks in the test app.
2016-09-20 16:05:26 -07:00
Christian Gonzalez 248bb07cfd Callstack parsing (#5)
* Add code to parse stackframes in IE11, Chrome, and FireFox into objects that can be used by the rest of the library. In order to minimize confusion over zero based vs one based line and column numbers, this change ensures that we only ever work with zero based line and column numbers.

* Add unit test for a stackframe with the script in a subfolder.
2016-09-20 15:49:25 -07:00
Christian Gonzalez f9503d6c6e Sourcemap parser full implementation (#4)
* Add code to parse a source map into a SourceMap object. Add Json.NET as a NuGet reference to handle the JSON parsing. (+2 squashed commit)

Implement parsing of Base64 VLQ mapping strings that appear in V3 source maps.

Make the Base64VlQDecoder static.

* Change the MappingListParser implementation to create new immutable state objects instead of mutating the previous state.

* Add input validation to ParseSingleMappingSegment
2016-09-19 21:42:29 -07:00
Christian Gonzalez cb2347d971 Add code to decode strings encoded as Base64 Variable-length quantities (VLQ) (#3)
* Create the SourceMap object that will be generated after parsing a sourcemap.

* Sourcemap mapping entries are encoded using Base64 VLQ. Add a Base64Converter that will handle converting Base64 values into integers.

* Add code to decode strings encoded as Base64 Variable-length quantities (VLQ). This will be used to parse the mappings string that appears in source maps. This implementation is based on the work done in the Closure Compiler repository.

* Convert Base64 encoder to be static. Use Dictionary.TryGetValue to avoid two dictionary lookups.
2016-09-16 09:43:02 -07:00
Christian Gonzalez 8ed59eda6b Call stack test app initial implementation (#2)
* Add a simple html page and unminfied crash callstack that can be used to obtain sample callstacks in different browsers.

* Remove empty line at the end of crashcauser.js
2016-09-15 14:17:24 -07:00
Christian Gonzalez dc31a50c7b Repository setup (#1)
* Add a .gitignore file to ignore the build outputs from Visual Studio. Taken from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

* Create the initial project structure. Add blank Visual Studio templates for the product code and unit tests.

* Prefix all projects with SourcemapToolkit.

* Adjust namespaces and dlls to reflect the change to prefix all projects with "SourcemapToolkit."
2016-09-14 11:39:25 -07:00
Microsoft GitHub User ca229ee139 Initial commit 2016-09-13 18:09:26 -07:00