| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -449,16 +449,8 @@ void ContextifyContext::PropertySetterCallback( | |||
| 449 | 449 | !is_function) | |
| 450 | 450 | return; | |
| 451 | 451 | ||
| 452 | - if (!is_declared_on_global_proxy && is_declared_on_sandbox && | ||
| 453 | - args.ShouldThrowOnError() && is_contextual_store && !is_function) { | ||
| 454 | - // The property exists on the sandbox but not on the global | ||
| 455 | - // proxy. Setting it would throw because we are in strict mode. | ||
| 456 | - // Don't attempt to set it by signaling that the call was | ||
| 457 | - // intercepted. Only change the value on the sandbox. | ||
| 458 | - args.GetReturnValue().Set(false); | ||
| 459 | - } | ||
| 460 | - | ||
| 461 | 452 | USE(ctx->sandbox()->Set(context, property, value)); | |
| 453 | + args.GetReturnValue().Set(value); | ||
| 462 | 454 | } | |
| 463 | 455 | ||
| 464 | 456 | // static | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,32 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const vm = require('vm'); | ||
| 5 | + | ||
| 6 | + const window = createWindow(); | ||
| 7 | + | ||
| 8 | + const descriptor = | ||
| 9 | + Object.getOwnPropertyDescriptor(window.globalProxy, 'onhashchange'); | ||
| 10 | + | ||
| 11 | + assert.strictEqual(typeof descriptor.get, 'function'); | ||
| 12 | + assert.strictEqual(typeof descriptor.set, 'function'); | ||
| 13 | + assert.strictEqual(descriptor.configurable, true); | ||
| 14 | + | ||
| 15 | + // Regression test for GH-42962. This assignment should not throw. | ||
| 16 | + window.globalProxy.onhashchange = () => {}; | ||
| 17 | + | ||
| 18 | + assert.strictEqual(window.globalProxy.onhashchange, 42); | ||
| 19 | + | ||
| 20 | + function createWindow() { | ||
| 21 | + const obj = {}; | ||
| 22 | + vm.createContext(obj); | ||
| 23 | + Object.defineProperty(obj, 'onhashchange', { | ||
| 24 | + get: common.mustCall(() => 42), | ||
| 25 | + set: common.mustCall(), | ||
| 26 | + configurable: true | ||
| 27 | + }); | ||
| 28 | + | ||
| 29 | + obj.globalProxy = vm.runInContext('this', obj); | ||
| 30 | + | ||
| 31 | + return obj; | ||
| 32 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments