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.4.5 to 0.4.6

.github/workflows/nodejs.yml

2

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

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

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

@@ -20,16 +20,17 @@ "description": "Cross browser stack traces",

"devDependencies": {
"grunt": "1.0.1",
"grunt": "1.1.0",
"grunt-bump": "^0.8.0",
"grunt-cli": "1.2.0",
"grunt-contrib-jasmine": "1.1.0",
"grunt-contrib-jshint": "1.1.0",
"grunt-jsdoc": "2.1.0",
"jasmine": "2.6.0",
"jasmine-core": "2.6.4",
"karma": "1.7.0",
"karma-jasmine": "1.1.0",
"grunt-cli": "1.3.2",
"grunt-contrib-jasmine": "2.1.0",
"grunt-contrib-jshint": "2.1.0",
"grunt-jsdoc": "2.4.1",
"jasmine": "3.5.0",
"jasmine-core": "3.5.0",
"karma": "4.4.1",
"karma-jasmine": "3.1.1",
"karma-phantomjs-launcher": "1.0.4",
"phantomjs-prebuilt": "2.1.14"
"phantomjs-prebuilt": "2.1.16"
},
"scripts": {
"build": "grunt default",
"test": "grunt test"

@@ -36,0 +37,0 @@ },

TraceKit - Cross browser stack traces.
=====================================
[![Build status](https://ci.appveyor.com/api/projects/status/t886g3yu29r6yshq/branch/master?svg=true)](https://ci.appveyor.com/project/Exceptionless/tracekit/branch/master)
![Build](https://github.com/csnover/TraceKit/workflows/Node.js%20CI/badge.svg)

@@ -6,0 +6,0 @@ ### Supports all major browsers, from IE6 to Opera, the Android webview and everywhere in between.

@@ -120,3 +120,2 @@ (function () {

beforeEach(function () {
// Prevent the onerror call that's part of our tests from getting to

@@ -130,5 +129,10 @@ // mocha's handler, which would treat it as a test failure.

window.onerror = function (message, url, lineNo, error) {
var shouldLog = message !== "__mocha_ignore__";
shouldLog && console.log("window.onerror(" + message + ", " + url + ", " + lineNo + ", " + error + ")");
if (message === testMessage || lineNo === testLineNo) {
shouldLog && console.log("matches test message and line number");
return true;
}
shouldLog && console.log("Calling previous handler", oldOnErrorHandler)
return oldOnErrorHandler.apply(this, arguments);

@@ -265,3 +269,57 @@ };

});
describe('globalHandlers', function () {
var oldOnErrorHandler;
var oldOnUnhandledRejectionHandler;
var onErrorHandler;
var onUnhandledRejectionHandler;
beforeEach(function () {
oldOnErrorHandler = window.onerror;
oldOnUnhandledRejectionHandler = window.onunhandledrejection;
onErrorHandler = function (){};
onUnhandledRejectionHandler = function (){};
window.onerror = onErrorHandler;
window.onunhandledrejection = onUnhandledRejectionHandler;
});
afterEach(function () {
window.onerror = oldOnErrorHandler;
window.onunhandledrejection = oldOnUnhandledRejectionHandler;
});
describe('cleanup after unsubscribing', function () {
var testHandler;
beforeEach(function () {
testHandler = function () {
return true;
};
});
it('should should restore original `window.onerror` once unsubscribed', function () {
expect(window.onerror).toBe(onErrorHandler);
TraceKit.report.subscribe(testHandler);
expect(window.onerror).not.toBe(onErrorHandler);
TraceKit.report.unsubscribe(testHandler);
expect(window.onerror).toBe(onErrorHandler);
});
it('should should restore original `window.onunhandledrejection` once unsubscribed', function () {
expect(window.onunhandledrejection).toBe(onUnhandledRejectionHandler);
TraceKit.report.subscribe(testHandler);
expect(window.onunhandledrejection).not.toBe(onUnhandledRejectionHandler);
TraceKit.report.unsubscribe(testHandler);
expect(window.onunhandledrejection).toBe(onUnhandledRejectionHandler);
});
});
});
});
})();

@@ -131,2 +131,3 @@ /**

installGlobalHandler();
installGlobalUnhandledRejectionHandler();
handlers.push(handler);

@@ -148,4 +149,4 @@ }

if (handlers.length === 0) {
window.onerror = _oldOnerrorHandler;
_onErrorHandlerInstalled = false;
uninstallGlobalHandler();
uninstallGlobalUnhandledRejectionHandler();
}

@@ -183,2 +184,3 @@ }

var _oldOnerrorHandler, _onErrorHandlerInstalled;
var _oldOnunhandledrejectionHandler, _onUnhandledRejectionHandlerInstalled;

@@ -241,2 +243,14 @@ /**

/**
* Ensures all unhandled rejections are recorded.
* @param {PromiseRejectionEvent} e event.
* @memberof TraceKit.report
* @see https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onunhandledrejection
* @see https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent
*/
function traceKitWindowOnUnhandledRejection(e) {
var stack = TraceKit.computeStackTrace(e.reason);
notifyHandlers(stack, true, e.reason);
}
/**
* Install a global onerror handler

@@ -256,2 +270,38 @@ * @memberof TraceKit.report

/**
* Uninstall the global onerror handler
* @memberof TraceKit.report
*/
function uninstallGlobalHandler() {
if (_onErrorHandlerInstalled) {
window.onerror = _oldOnerrorHandler;
_onErrorHandlerInstalled = false;
}
}
/**
* Install a global onunhandledrejection handler
* @memberof TraceKit.report
*/
function installGlobalUnhandledRejectionHandler() {
if (_onUnhandledRejectionHandlerInstalled === true) {
return;
}
_oldOnunhandledrejectionHandler = window.onunhandledrejection;
window.onunhandledrejection = traceKitWindowOnUnhandledRejection;
_onUnhandledRejectionHandlerInstalled = true;
}
/**
* Uninstall the global onunhandledrejection handler
* @memberof TraceKit.report
*/
function uninstallGlobalUnhandledRejectionHandler() {
if (_onUnhandledRejectionHandlerInstalled) {
window.onunhandledrejection = _oldOnunhandledrejectionHandler;
_onUnhandledRejectionHandlerInstalled = false;
}
}
/**
* Process the most recent exception

@@ -258,0 +308,0 @@ * @memberof TraceKit.report

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