Skip to content
Snippets Groups Projects
Commit 6ae5234a authored by Jason Mulligan's avatar Jason Mulligan
Browse files

Synchronizing the validation of `addEventListener()`

parent 14a9a911
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ var fs = require("fs");
var path = require("path");
var vm = require("vm");
var noop = require(path.join(__dirname, "noop.js"));
var events = /^(error|message)$/;
function trim(arg) {
return arg.replace(/^(\s+|\t+|\n+)|(\s+|\t+|\n+)$/g, "");
......@@ -34,7 +35,9 @@ process.once("message", function (obj) {
onmessage: void 0,
onerror: void 0,
addEventListener: function addEventListener(event, fn) {
global["on" + event] = global.self["on" + event] = fn;
if (events.test(event)) {
global["on" + event] = global.self["on" + event] = fn;
}
}
};
......
{
"name": "tiny-worker",
"version": "1.1.3",
"version": "1.1.4",
"description": "Tiny WebWorker for Server",
"main": "lib/index.js",
"scripts": {
......
......@@ -2,6 +2,7 @@ const fs = require("fs");
const path = require("path");
const vm = require("vm");
const noop = require(path.join(__dirname, "noop.js"));
const events = /^(error|message)$/;
function trim (arg) {
return arg.replace(/^(\s+|\t+|\n+)|(\s+|\t+|\n+)$/g, "");
......@@ -32,7 +33,9 @@ process.once("message", obj => {
onmessage: void 0,
onerror: void 0,
addEventListener: (event, fn) => {
global["on" + event] = global.self["on" + event] = fn;
if (events.test(event)) {
global["on" + event] = global.self["on" + event] = fn;
}
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment