Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: create primordials in every context #27171

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
lib: use primordials in domexception.js
  • Loading branch information
joyeecheung committed Apr 12, 2019
commit 81ee19d2f9cb74284bb96da6b4b0c13b3230cab4
13 changes: 8 additions & 5 deletions lib/internal/per_context/domexception.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
'use strict';

// `per_context` scripts are executed before creating the primordials so we
// cannot use them here.
/* eslint-disable no-restricted-globals */
const {
SafeWeakMap,
SafeMap,
Object,
Symbol
} = primordials;

class ERR_INVALID_THIS extends TypeError {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a side note, we'd probably want to make the Errors part of primordials too, but I am not yet sure how this would work for e.g. error-serdes, or if how it works with our internal errors (because we do need to assign properties to the instances dynamically, they probably can't be frozen).

constructor(type) {
@@ -12,9 +15,9 @@ class ERR_INVALID_THIS extends TypeError {
get code() { return 'ERR_INVALID_THIS'; }
}

const internalsMap = new WeakMap();
const internalsMap = new SafeWeakMap();

const nameToCodeMap = new Map();
const nameToCodeMap = new SafeMap();

class DOMException extends Error {
constructor(message = '', name = 'Error') {