Skip to content

Commit

Permalink
worker: use kEmptyObject
Browse files Browse the repository at this point in the history
PR-URL: #43159
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
LiviaMedeiros authored and danielleadams committed Jun 13, 2022
1 parent 7fc432f commit 44b65d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/internal/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const {
} = workerIo;
const { deserializeError } = require('internal/error_serdes');
const { fileURLToPath, isURLInstance, pathToFileURL } = require('internal/url');
const { kEmptyObject } = require('internal/util');
const { validateArray } = require('internal/validators');

const {
Expand Down Expand Up @@ -118,7 +119,7 @@ function assignEnvironmentData(data) {
}

class Worker extends EventEmitter {
constructor(filename, options = {}) {
constructor(filename, options = kEmptyObject) {
super();
debug(`[${threadId}] create new worker`, filename, options);
if (options.execArgv)
Expand Down
7 changes: 5 additions & 2 deletions lib/internal/worker/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ const {
SymbolFor,
} = primordials;

const { kEnumerableProperty } = require('internal/util');
const {
kEmptyObject,
kEnumerableProperty,
} = require('internal/util');

const {
handle_onclose: handleOnCloseSymbol,
Expand Down Expand Up @@ -123,7 +126,7 @@ class MessageEvent extends Event {
lastEventId = '',
source = null,
ports = [],
} = {}) {
} = kEmptyObject) {
super(type);
this[kData] = data;
this[kOrigin] = `${origin}`;
Expand Down

0 comments on commit 44b65d0

Please sign in to comment.