Skip to content

Commit

Permalink
revert tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
khrj committed Nov 23, 2022
1 parent 31026f3 commit a570884
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 32 deletions.
19 changes: 4 additions & 15 deletions cli/tsc/99_main_compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,11 @@
// that is created when Deno needs to type check TypeScript, and in some
// instances convert TypeScript to JavaScript.

// Disables setting `__proto__` and emits a warning instead, for security reasons.
// Removes the `__proto__` for security reasons.
// https://tc39.es/ecma262/#sec-get-object.prototype.__proto__
// deno-lint-ignore prefer-primordials
Object.defineProperty(Object.prototype, "__proto__", {
configurable: true,
enumerable: false,
get() {
// deno-lint-ignore prefer-primordials
return Object.getPrototypeOf(this);
},
set(_) {
console.warn(
"Prototype access via __proto__ attempted; __proto__ is not implemented in Deno due to security reasons. Use Object.setPrototypeOf instead.",
);
},
})((window) => {
delete Object.prototype.__proto__;

((window) => {
/** @type {DenoCore} */
const core = window.Deno.core;
const ops = core.ops;
Expand Down
34 changes: 17 additions & 17 deletions runtime/js/99_main.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
"use strict";

// Disables setting `__proto__` and emits a warning instead, for security reasons.
// https://tc39.es/ecma262/#sec-get-object.prototype.__proto__
// deno-lint-ignore prefer-primordials
Object.defineProperty(Object.prototype, "__proto__", {
configurable: true,
enumerable: false,
get() {
// deno-lint-ignore prefer-primordials
return Object.getPrototypeOf(this);
},
set(_) {
console.warn(
"Prototype access via __proto__ attempted; __proto__ is not implemented in Deno due to security reasons. Use Object.setPrototypeOf instead.",
);
},
});

// Remove Intl.v8BreakIterator because it is a non-standard API.
delete Intl.v8BreakIterator;

Expand All @@ -38,6 +21,8 @@ delete Intl.v8BreakIterator;
ObjectDefineProperty,
ObjectDefineProperties,
ObjectFreeze,
ObjectGetPrototypeOf,
ObjectPrototype,
ObjectPrototypeIsPrototypeOf,
ObjectSetPrototypeOf,
PromiseResolve,
Expand Down Expand Up @@ -86,6 +71,21 @@ delete Intl.v8BreakIterator;
setLanguage,
} = window.__bootstrap.globalScope;

// Disables setting `__proto__` and emits a warning instead, for security reasons.
// https://tc39.es/ecma262/#sec-get-object.prototype.__proto__
ObjectDefineProperty(ObjectPrototype, "__proto__", {
configurable: true,
enumerable: false,
get() {
return ObjectGetPrototypeOf(this);
},
set(_) {
console.warn(
"Prototype access via __proto__ attempted; __proto__ is not implemented in Deno due to security reasons. Use Object.setPrototypeOf instead.",
);
},
});

let windowIsClosing = false;

function windowClose() {
Expand Down

0 comments on commit a570884

Please sign in to comment.