Skip to content

Commit

Permalink
Use setPrototypeOf() after setting other properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Mar 10, 2019
1 parent a0b1d4d commit dd7d96f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/util/prepare-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ function init() {
}

if (typeof realmBuiltin === "function") {
setPrototypeOf(realmBuiltin, getPrototypeOf(builtin))

if (has(realmBuiltin, "prototype")) {
const { prototype } = realmBuiltin

Expand All @@ -159,6 +157,8 @@ function init() {
setPrototypeOf(prototype, builtinProto)
}
}

setPrototypeOf(realmBuiltin, getPrototypeOf(builtin))
}
})

Expand Down
4 changes: 2 additions & 2 deletions src/util/to-external-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ function init() {
const ExFuncProtoSuper = getPrototypeOf(ExFunction.prototype)

function toExternalFunction(func) {
setPrototypeOf(func, ExFuncSuper)

if (has(func, "prototype")) {
const { prototype } = func

Expand All @@ -20,6 +18,8 @@ function init() {
}
}

setPrototypeOf(func, ExFuncSuper)

return func
}

Expand Down

0 comments on commit dd7d96f

Please sign in to comment.