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.2.1 to 0.3.0

karma.conf.js

2

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

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

@@ -38,5 +38,8 @@ /*global module:false*/

jasmine : {
src: 'tracekit.js',
src: [
'tracekit.js',
'spec/fixtures/captured-errors.js'
],
options: {
specs: 'tracekit-spec.js'
specs: 'spec/*-spec.js'
}

@@ -43,0 +46,0 @@ }

{
"name": "tracekit",
"main": "./tracekit.js",
"version": "0.2.1",
"version": "0.3.0",
"homepage": "https://github.com/csnover/TraceKit",

@@ -22,3 +22,3 @@ "description": "Cross browser stack traces",

"grunt-cli": "~0.1.13",
"grunt-closure-tools": "~0.9.8",
"grunt-closure-tools": "~0.9.9",
"grunt-contrib-jasmine": "^0.8.2",

@@ -25,0 +25,0 @@ "grunt-contrib-jshint": "~0.11.2"

@@ -6,3 +6,3 @@ TraceKit - Cross browser stack traces.

### Supports all major browsers, from IE6 to Opera, the Andriod webview and everywhere in between.
### Supports all major browsers, from IE6 to Opera, the Android webview and everywhere in between.

@@ -9,0 +9,0 @@ Not all browsers support stack traces on error objects, but TraceKit squeezes

@@ -0,0 +0,0 @@ declare module TraceKit {

/*
TraceKit - Cross brower stack traces - github.com/csnover/TraceKit
TraceKit - Cross browser stack traces - github.com/csnover/TraceKit
MIT license

@@ -188,5 +188,3 @@ */

'message': message,
'url': document.location.href,
'stack': [location],
'useragent': navigator.userAgent
'stack': [location]
};

@@ -371,4 +369,5 @@ }

url = url || '';
if (url.indexOf && url.indexOf(document.domain) !== -1) {
var domain = '';
try { domain = document.domain; } catch (e) {}
if (url.indexOf(domain) !== -1) {
source = loadSource(url);

@@ -642,4 +641,4 @@ }

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

@@ -653,24 +652,27 @@ lines = ex.stack.split('\n'),

for (var i = 0, j = lines.length; i < j; ++i) {
if ((parts = gecko.exec(lines[i]))) {
if ((parts = chrome.exec(lines[i]))) {
var isNative = parts[2] && parts[2].indexOf('native') !== -1;
element = {
'url': parts[3],
'url': !isNative ? parts[2] : null,
'func': parts[1] || UNKNOWN_FUNCTION,
'args': parts[2] ? parts[2].split(',') : '',
'line': +parts[4],
'column': parts[5] ? +parts[5] : null
'args': isNative ? [parts[2]] : [],
'line': parts[3] ? +parts[3] : null,
'column': parts[4] ? +parts[4] : null
};
} else if ((parts = chrome.exec(lines[i]))) {
} else if ((parts = winjs.exec(lines[i]))) {
element = {
'url': parts[2],
'func': parts[1] || UNKNOWN_FUNCTION,
'args': [],
'line': +parts[3],
'column': parts[4] ? +parts[4] : null
};
} else if ((parts = winjs.exec(lines[i]))) {
element = {
'url': parts[2],
'func': parts[1] || UNKNOWN_FUNCTION,
'line': +parts[3],
'column': parts[4] ? +parts[4] : null
};
} else if ((parts = gecko.exec(lines[i]))) {
element = {
'url': parts[3],
'func': parts[1] || UNKNOWN_FUNCTION,
'args': parts[2] ? parts[2].split(',') : [],
'line': parts[4] ? +parts[4] : null,
'column': parts[5] ? +parts[5] : null
};
} else {

@@ -708,5 +710,3 @@ continue;

'message': ex.message,
'url': document.location.href,
'stack': stack,
'useragent': navigator.userAgent
'stack': stack
};

@@ -717,3 +717,3 @@ }

* Computes stack trace information from the stacktrace property.
* Opera 10 uses this property.
* Opera 10+ uses this property.
* @param {Error} ex

@@ -727,4 +727,8 @@ * @return {?Object.<string, *>} Stack trace information.

var stacktrace = ex.stacktrace;
if (!stacktrace) {
return;
}
var testRE = / line (\d+), column (\d+) in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i,
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,
opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,
lines = stacktrace.split('\n'),

@@ -734,12 +738,23 @@ stack = [],

for (var i = 0, j = lines.length; i < j; i += 2) {
if ((parts = testRE.exec(lines[i]))) {
var element = {
for (var line = 0; line < lines.length; line += 2) {
var element = null;
if ((parts = opera10Regex.exec(lines[line]))) {
element = {
'url': parts[2],
'line': +parts[1],
'column': null,
'func': parts[3],
'args':[]
};
} else if ((parts = opera11Regex.exec(lines[line]))) {
element = {
'url': parts[6],
'line': +parts[1],
'column': +parts[2],
'func': parts[3] || parts[4],
'args': parts[5] ? parts[5].split(',') : [],
'url': parts[6]
'args': parts[5] ? parts[5].split(',') : []
};
}
if (element) {
if (!element.func && element.line) {

@@ -755,3 +770,3 @@ element.func = guessFunctionName(element.url, element.line);

if (!element.context) {
element.context = [lines[i + 1]];
element.context = [lines[line + 1]];
}

@@ -771,5 +786,3 @@

'message': ex.message,
'url': document.location.href,
'stack': stack,
'useragent': navigator.userAgent
'stack': stack
};

@@ -788,2 +801,3 @@ }

function computeStackTraceFromOperaMultiLineMessage(ex) {
// TODO: Clean this function up
// Opera includes a stack trace into the exception message. An example is:

@@ -814,25 +828,27 @@ //

inlineScriptBlocks = [],
parts,
i,
len,
source;
parts;
for (i in scripts) {
if (_has(scripts, i) && !scripts[i].src) {
inlineScriptBlocks.push(scripts[i]);
for (var s in scripts) {
if (_has(scripts, s) && !scripts[s].src) {
inlineScriptBlocks.push(scripts[s]);
}
}
for (i = 2, len = lines.length; i < len; i += 2) {
for (var line = 2; line < lines.length; line += 2) {
var item = null;
if ((parts = lineRE1.exec(lines[i]))) {
if ((parts = lineRE1.exec(lines[line]))) {
item = {
'url': parts[2],
'func': parts[3],
'line': +parts[1]
'args': [],
'line': +parts[1],
'column': null
};
} else if ((parts = lineRE2.exec(lines[i]))) {
} else if ((parts = lineRE2.exec(lines[line]))) {
item = {
'url': parts[3],
'func': parts[4]
'func': parts[4],
'args': [],
'line': +parts[1],
'column': null // TODO: Check to see if inline#1 (+parts[2]) points to the script number or column number.
};

@@ -842,3 +858,3 @@ var relativeLine = (+parts[1]); // relative to the start of the <SCRIPT> block

if (script) {
source = getSource(item.url);
var source = getSource(item.url);
if (source) {

@@ -852,11 +868,12 @@ source = source.join('\n');

}
} else if ((parts = lineRE3.exec(lines[i]))) {
var url = window.location.href.replace(/#.*$/, ''),
line = parts[1];
var re = new RegExp(escapeCodeAsRegExpForMatchingInsideHTML(lines[i + 1]));
source = findSourceInUrls(re, [url]);
} else if ((parts = lineRE3.exec(lines[line]))) {
var url = window.location.href.replace(/#.*$/, '');
var re = new RegExp(escapeCodeAsRegExpForMatchingInsideHTML(lines[line + 1]));
var src = findSourceInUrls(re, [url]);
item = {
'url': url,
'line': source ? source.line : line,
'func': ''
'func': '',
'args': [],
'line': src ? src.line : parts[1],
'column': null
};

@@ -871,7 +888,7 @@ }

var midline = (context ? context[Math.floor(context.length / 2)] : null);
if (context && midline.replace(/^\s*/, '') === lines[i + 1].replace(/^\s*/, '')) {
if (context && midline.replace(/^\s*/, '') === lines[line + 1].replace(/^\s*/, '')) {
item.context = context;
} else {
// if (context) alert("Context mismatch. Correct midline:\n" + lines[i+1] + "\n\nMidline:\n" + midline + "\n\nContext:\n" + context.join("\n") + "\n\nURL:\n" + item.url);
item.context = [lines[i + 1]];
item.context = [lines[line + 1]];
}

@@ -889,5 +906,3 @@ stack.push(item);

'message': lines[0],
'url': document.location.href,
'stack': stack,
'useragent': navigator.userAgent
'stack': stack
};

@@ -980,2 +995,3 @@ }

'func': UNKNOWN_FUNCTION,
'args': [],
'line': null,

@@ -1030,5 +1046,3 @@ 'column': null

'message': ex.message,
'url': document.location.href,
'stack': stack,
'useragent': navigator.userAgent
'stack': stack
};

@@ -1035,0 +1049,0 @@ augmentStackTraceWithInitialElement(result, ex.sourceURL || ex.fileName, ex.line || ex.lineNumber, ex.message || ex.description);

Sorry, the diff of this file is not supported yet

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