| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bca6dcc commit 62707a9
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -609,11 +609,14 @@ void ContextifyContext::PropertyDefinerCallback( | |||
| 609 | 609 | bool read_only = | |
| 610 | 610 | static_cast<int>(attributes) & | |
| 611 | 611 | static_cast<int>(PropertyAttribute::ReadOnly); | |
| 612 | + bool dont_delete = static_cast<int>(attributes) & | ||
| 613 | + static_cast<int>(PropertyAttribute::DontDelete); | ||
| 612 | 614 | ||
| 613 | - // If the property is set on the global as read_only, don't change it on | ||
| 614 | - // the global or sandbox. | ||
| 615 | - if (is_declared && read_only) | ||
| 615 | + // If the property is set on the global as neither writable nor | ||
| 616 | + // configurable, don't change it on the global or sandbox. | ||
| 617 | + if (is_declared && read_only && dont_delete) { | ||
| 616 | 618 | return; | |
| 619 | + } | ||
| 617 | 620 | ||
| 618 | 621 | Local<Object> sandbox = ctx->sandbox(); | |
| 619 | 622 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,15 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + // https://github.com/nodejs/node/issues/47799 | ||
| 3 | + | ||
| 4 | + require('../common'); | ||
| 5 | + const assert = require('assert'); | ||
| 6 | + const vm = require('vm'); | ||
| 7 | + | ||
| 8 | + const ctx = vm.createContext(); | ||
| 9 | + | ||
| 10 | + const window = vm.runInContext('this', ctx); | ||
| 11 | + | ||
| 12 | + Object.defineProperty(window, 'x', { value: '1', configurable: true }); | ||
| 13 | + assert.strictEqual(window.x, '1'); | ||
| 14 | + Object.defineProperty(window, 'x', { value: '2', configurable: true }); | ||
| 15 | + assert.strictEqual(window.x, '2'); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments