Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tracekit

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tracekit - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

jsdoc.conf.json

2

bower.json
{
"name": "tracekit",
"main": "tracekit.js",
"version": "0.3.2",
"version": "0.3.3",
"homepage": "https://github.com/csnover/TraceKit",

@@ -6,0 +6,0 @@ "description": "Cross browser stack traces",

@@ -25,2 +25,12 @@ /*global module:false*/

}
},
jsdoc : {
dist : {
src: ['tracekit.js'],
options: {
destination: 'doc',
readme: 'README.md',
configure: 'jsdoc.conf.json'
}
}
}

@@ -30,6 +40,8 @@ });

grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('doc', ['jsdoc']);
grunt.registerTask('test', ['jasmine']);
grunt.registerTask('default', ['jshint:lint']);
};
{
"name": "tracekit",
"main": "./tracekit.js",
"version": "0.3.2",
"version": "0.3.3",
"homepage": "https://github.com/csnover/TraceKit",

@@ -21,10 +21,11 @@ "description": "Cross browser stack traces",

"grunt": "0.4.5",
"grunt-cli": "0.1.13",
"grunt-cli": "1.2.0",
"grunt-contrib-jasmine": "1.0.0",
"grunt-contrib-jshint": "0.12.0",
"grunt-contrib-jshint": "1.0.0",
"grunt-jsdoc": "1.1.0",
"jasmine": "2.4.1",
"jasmine-core": "2.4.1",
"karma": "0.13.19",
"karma-chrome-launcher": "0.2.2",
"karma-jasmine": "0.3.7"
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-jasmine": "0.3.8"
},

@@ -31,0 +32,0 @@ "scripts": {

@@ -227,2 +227,20 @@ /* exported CapturedExceptions */

// Internal errors sometimes thrown by Firefox
// More here: https://developer.mozilla.org/en-US/docs/Mozilla/Errors
//
// Note that such errors are instanceof "Exception", not "Error"
CapturedExceptions.FIREFOX_44_NS_EXCEPTION = {
message: "",
name: "NS_ERROR_FAILURE",
stack: "[2]</Bar.prototype._baz/</<@http://path/to/file.js:703:28\n" +
"App.prototype.foo@file:///path/to/file.js:15:2\n" +
"bar@file:///path/to/file.js:20:3\n" +
"@file:///path/to/index.html:23:1\n" + // inside <script> tag
"",
fileName: "http://path/to/file.js",
columnNumber: 0,
lineNumber: 703,
result: 2147500037
};
CapturedExceptions.SAFARI_6 = {

@@ -229,0 +247,0 @@ message: "'null' is not an object (evaluating 'x.undef')",

@@ -107,2 +107,12 @@ (function() {

it('should parse Firefox 44 ns exceptions', function () {
var stackFrames = TraceKit.computeStackTrace(CapturedExceptions.FIREFOX_44_NS_EXCEPTION);
expect(stackFrames).toBeTruthy();
expect(stackFrames.stack.length).toBe(4);
expect(stackFrames.stack[0]).toEqual({ url: 'http://path/to/file.js', func: '[2]</Bar.prototype._baz/</<', args: [], line: 703, column: 28, context: null });
expect(stackFrames.stack[1]).toEqual({ url: 'file:///path/to/file.js', func: 'App.prototype.foo', args: [], line: 15, column: 2, context: null });
expect(stackFrames.stack[2]).toEqual({ url: 'file:///path/to/file.js', func: 'bar', args: [], line: 20, column: 3, context: null });
expect(stackFrames.stack[3]).toEqual({ url: 'file:///path/to/index.html', func: '?', args: [], line: 23, column: 1, context: null });
});
it('should parse Chrome error with no location', function () {

@@ -109,0 +119,0 @@ var stackFrames = TraceKit.computeStackTrace({stack: "error\n at Array.forEach (native)"});

@@ -85,3 +85,3 @@ declare module TraceKit {

*/
(ex:Error);
(ex:Error): void;

@@ -92,3 +92,3 @@ /**

*/
subscribe(handler:(stackTrace:TraceKit.StackTrace, options?:any) => void);
subscribe(handler:(stackTrace:TraceKit.StackTrace, options?:any) => void): void;

@@ -99,3 +99,3 @@ /**

*/
unsubscribe(handler:() => void);
unsubscribe(handler:() => void): void;
}

@@ -102,0 +102,0 @@

@@ -1,6 +0,6 @@

/*
TraceKit - Cross browser stack traces - github.com/csnover/TraceKit
MIT license
*/
/**
* https://github.com/csnover/TraceKit
* @license MIT
* @namespace TraceKit
*/
(function(window, undefined) {

@@ -18,9 +18,9 @@ if (!window) {

/**
* _has, a better form of hasOwnProperty
* Example: _has(MainHostObject, property) === true/false
* A better form of hasOwnProperty<br/>
* Example: `_has(MainHostObject, property) === true/false`
*
* @param {Object} object to check property
* @param {string} key to check
* @return {Boolean} true if the object has the key and it is not inherited
*/

@@ -31,2 +31,9 @@ function _has(object, key) {

/**
* Returns true if the parameter is undefined<br/>
* Example: `_isUndefined(val) === true/false`
*
* @param {*} what Value to check
* @return {Boolean} true if undefined and false otherwise
*/
function _isUndefined(what) {

@@ -37,4 +44,6 @@ return typeof what === 'undefined';

/**
* TraceKit.noConflict: Export TraceKit out to another variable
* Example: var TK = TraceKit.noConflict()
* Export TraceKit out to another variable<br/>
* Example: `var TK = TraceKit.noConflict()`
* @return {Object} The TraceKit object
* @memberof TraceKit
*/

@@ -47,7 +56,8 @@ TraceKit.noConflict = function noConflict() {

/**
* TraceKit.wrap: Wrap any function in a TraceKit reporter
* Example: func = TraceKit.wrap(func);
* Wrap any function in a TraceKit reporter<br/>
* Example: `func = TraceKit.wrap(func);`
*
* @param {Function} func Function to be wrapped
* @return {Function} The wrapped func
* @memberof TraceKit
*/

@@ -67,5 +77,6 @@ TraceKit.wrap = function traceKitWrapper(func) {

/**
* TraceKit.report: cross-browser processing of unhandled exceptions
* Cross-browser processing of unhandled exceptions
*
* Syntax:
* ```js
* TraceKit.report.subscribe(function(stackInfo) { ... })

@@ -75,12 +86,13 @@ * TraceKit.report.unsubscribe(function(stackInfo) { ... })

* try { ...code... } catch(ex) { TraceKit.report(ex); }
* ```
*
* Supports:
* - Firefox: full stack trace with line numbers, plus column number
* on top frame; column number is not guaranteed
* - Opera: full stack trace with line and column numbers
* - Chrome: full stack trace with line and column numbers
* - Safari: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
* - IE: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
* on top frame; column number is not guaranteed
* - Opera: full stack trace with line and column numbers
* - Chrome: full stack trace with line and column numbers
* - Safari: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
* - IE: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
*

@@ -104,4 +116,7 @@ * In theory, TraceKit should work on all of the following versions:

*
* Handlers receive a stackInfo object as described in the
* Handlers receive a TraceKit.StackTrace object as described in the
* TraceKit.computeStackTrace docs.
*
* @memberof TraceKit
* @namespace
*/

@@ -117,2 +132,3 @@ TraceKit.report = (function reportModuleWrapper() {

* @param {Function} handler
* @memberof TraceKit.report
*/

@@ -127,2 +143,3 @@ function subscribe(handler) {

* @param {Function} handler
* @memberof TraceKit.report
*/

@@ -139,3 +156,6 @@ function unsubscribe(handler) {

* Dispatch stack information to all handlers.
* @param {Object.<string, *>} stack
* @param {TraceKit.StackTrace} stack
* @param {boolean} isWindowError Is this a top-level window error?
* @memberof TraceKit.report
* @throws An exception if an error occurs while calling an handler.
*/

@@ -169,7 +189,6 @@ function notifyHandlers(stack, isWindowError) {

* @param {string} url URL of script that generated the exception.
* @param {(number|string)} lineNo The line number at which the error
* occurred.
* @param {?(number|string)} columnNo The column number at which the error
* occurred.
* @param {?Error} errorObj The actual Error object.
* @param {(number|string)} lineNo The line number at which the error occurred.
* @param {(number|string)=} columnNo The column number at which the error occurred.
* @param {Error=} errorObj The actual Error object.
* @memberof TraceKit.report
*/

@@ -209,2 +228,6 @@ function traceKitWindowOnError(message, url, lineNo, columnNo, errorObj) {

/**
* Install a global onerror handler
* @memberof TraceKit.report
*/
function installGlobalHandler () {

@@ -219,2 +242,6 @@ if (_onErrorHandlerInstalled === true) {

/**
* Process the most recent exception
* @memberof TraceKit.report
*/
function processLastException() {

@@ -228,5 +255,8 @@ var _lastExceptionStack = lastExceptionStack,

}
/**
* Reports an unhandled Error to TraceKit.
* @param {Error} ex
* @memberof TraceKit.report
* @throws An exception if an incomplete stack trace is detected (old IE browsers).
*/

@@ -266,17 +296,31 @@ function report(ex) {

/**
* An object representing a single stack frame.
* @typedef {Object} StackFrame
* @property {string} url The JavaScript or HTML file URL.
* @property {string} func The function name, or empty for anonymous functions (if guessing did not work).
* @property {string[]?} args The arguments passed to the function, if known.
* @property {number=} line The line number, if known.
* @property {number=} column The column number, if known.
* @property {string[]} context An array of source code lines; the middle element corresponds to the correct line#.
* @memberof TraceKit
*/
/**
* An object representing a JavaScript stack trace.
* @typedef {Object} StackTrace
* @property {string} name The name of the thrown exception.
* @property {string} message The exception error message.
* @property {TraceKit.StackFrame[]} stack An array of stack frames.
* @property {string} mode 'stack', 'stacktrace', 'multiline', 'callers', 'onerror', or 'failed' -- method used to collect the stack trace.
* @memberof TraceKit
*/
/**
* TraceKit.computeStackTrace: cross-browser stack traces in JavaScript
*
* Syntax:
* ```js
* s = TraceKit.computeStackTrace.ofCaller([depth])
* s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below)
* Returns:
* s.name - exception name
* s.message - exception message
* s.stack[i].url - JavaScript or HTML file URL
* s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work)
* s.stack[i].args - arguments passed to the function, if known
* s.stack[i].line - line number, if known
* s.stack[i].column - column number, if known
* s.stack[i].context - an array of source code lines; the middle element corresponds to the correct line#
* s.mode - 'stack', 'stacktrace', 'multiline', 'callers', 'onerror', or 'failed' -- method used to collect the stack trace
* ```
*

@@ -320,2 +364,3 @@ * Supports:

* Tracing example:
* ```js
* function trace(message) {

@@ -333,2 +378,5 @@ * var stackInfo = TraceKit.computeStackTrace.ofCaller();

* }
* ```
* @memberof TraceKit
* @namespace
*/

@@ -344,2 +392,3 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {

* @return {string} Source contents.
* @memberof TraceKit.computeStackTrace
*/

@@ -373,2 +422,3 @@ function loadSource(url) {

* @return {Array.<string>} Source contents.
* @memberof TraceKit.computeStackTrace
*/

@@ -403,2 +453,3 @@ function getSource(url) {

* @return {string} The function name, if discoverable.
* @memberof TraceKit.computeStackTrace
*/

@@ -440,2 +491,3 @@ function guessFunctionName(url, lineNo) {

* @return {?Array.<string>} Lines of source code.
* @memberof TraceKit.computeStackTrace
*/

@@ -475,2 +527,3 @@ function gatherContext(url, line) {

* @return {string} The escaped string literal.
* @memberof TraceKit.computeStackTrace
*/

@@ -487,2 +540,3 @@ function escapeRegExp(text) {

* @return {string} The escaped string.
* @memberof TraceKit.computeStackTrace
*/

@@ -499,2 +553,3 @@ function escapeCodeAsRegExpForMatchingInsideHTML(body) {

* the url, line, and column number of the defined function.
* @memberof TraceKit.computeStackTrace
*/

@@ -531,2 +586,3 @@ function findSourceInUrls(re, urls) {

* @return {?number} The column number.
* @memberof TraceKit.computeStackTrace
*/

@@ -553,2 +609,3 @@ function findSourceInLine(fragment, url, line) {

* the url, line, and column number of the defined function.
* @memberof TraceKit.computeStackTrace
*/

@@ -660,3 +717,4 @@ function findSourceByFunctionBody(func) {

* @param {Error} ex
* @return {?Object.<string, *>} Stack trace information.
* @return {?TraceKit.StackTrace} Stack trace information.
* @memberof TraceKit.computeStackTrace
*/

@@ -669,3 +727,3 @@ function computeStackTraceFromStackProp(ex) {

var chrome = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,
gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|\[).*?)(?::(\d+))?(?::(\d+))?\s*$/i,
gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|\[native).*?)(?::(\d+))?(?::(\d+))?\s*$/i,
winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:ms-appx|https?|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,

@@ -744,3 +802,4 @@ lines = ex.stack.split('\n'),

* @param {Error} ex
* @return {?Object.<string, *>} Stack trace information.
* @return {?TraceKit.StackTrace} Stack trace information.
* @memberof TraceKit.computeStackTrace
*/

@@ -819,3 +878,4 @@ function computeStackTraceFromStacktraceProp(ex) {

* @param {Error} ex
* @return {?Object.<string, *>} Stack information.
* @return {?TraceKit.StackTrace} Stack information.
* @memberof TraceKit.computeStackTrace
*/

@@ -930,3 +990,3 @@ function computeStackTraceFromOperaMultiLineMessage(ex) {

* Safari and IE require this to get complete data on the first frame.
* @param {Object.<string, *>} stackInfo Stack trace information from
* @param {TraceKit.StackTrace} stackInfo Stack trace information from
* one of the compute* methods.

@@ -940,2 +1000,3 @@ * @param {string} url The URL of the script that caused an error.

* augmented.
* @memberof TraceKit.computeStackTrace
*/

@@ -993,3 +1054,4 @@ function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) {

* @param {Error} ex
* @return {?Object.<string, *>} Stack trace information.
* @return {TraceKit.StackTrace=} Stack trace information.
* @memberof TraceKit.computeStackTrace
*/

@@ -1074,2 +1136,3 @@ function computeStackTraceByWalkingCallerChain(ex, depth) {

* @param {(string|number)=} depth
* @memberof TraceKit.computeStackTrace
*/

@@ -1135,3 +1198,4 @@ function computeStackTrace(ex, depth) {

* @param {(number|string)=} depth How many frames deep to trace.
* @return {Object.<string, *>} Stack trace information.
* @return {TraceKit.StackTrace} Stack trace information.
* @memberof TraceKit.computeStackTrace
*/

@@ -1159,2 +1223,3 @@ function computeStackTraceOfCaller(depth) {

* functions. Adopted from Closure Library's errorhandler.js
* @memberof TraceKit
*/

@@ -1161,0 +1226,0 @@ TraceKit.extendToAsynchronousCallbacks = function () {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc