Socket
Socket
Sign inDemoInstall

process

Package Overview
Dependencies
0
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.11.7 to 0.11.8

38

browser.js

@@ -30,13 +30,41 @@ // shim for using process in browser

if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
} else {
return cachedSetTimeout.call(null, fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
clearTimeout(marker);
} else {
cachedClearTimeout.call(null, marker);
//normal enviroments in sane situations
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}

@@ -43,0 +71,0 @@ var queue = [];

8

package.json

@@ -9,5 +9,6 @@ {

"scripts": {
"test": "mocha test.js"
"test": "mocha test.js",
"browser": "zuul --no-coverage --ui mocha-bdd --local 8080 -- test.js"
},
"version": "0.11.7",
"version": "0.11.8",
"repository": {

@@ -24,4 +25,5 @@ "type": "git",

"devDependencies": {
"mocha": "2.2.1"
"mocha": "2.2.1",
"zuul": "^3.10.3"
}
}
var assert = require('assert');
var ourProcess = require('./browser');
describe('test against process', function () {
test(process);
describe('test against our process', function () {
test(ourProcess);
});
if (!process.browser) {
describe('test against our shim', function () {
test(ourProcess);
describe('test against node', function () {
test(process);
});

@@ -40,3 +40,3 @@ vmtest();

});
if (!process.browser) {
describe('test errors', function (t) {

@@ -68,3 +68,3 @@ it ('works', function (done) {

});
}
describe('rename globals', function (t) {

@@ -80,13 +80,20 @@ var oldTimeout = setTimeout;

}
var ran = false;
console.log('clear timeout start');
function cleanup() {
console.log('seccond');
clearTimeout = oldClear;
var err;
try {
assert.ok(ok, 'fake clearTimeout ran');
assert.ok(ran, 'should have run');
} catch (e) {
err = e;
}
done(err);
}
setTimeout(cleanup, 1000);
ourProcess.nextTick(function () {
setTimeout(function () {
clearTimeout = oldClear;
var err;
try {
assert.ok(ok, 'fake clearTimeout ran');
} catch (e) {
err = e;
}
done(err);
}, 50);
console.log('first');
ran = true;
});

@@ -93,0 +100,0 @@ });

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc