-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: always signal V8 for intercepted properties
Closes: #42962 PR-URL: #42963 Fixes: #42962 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
- Loading branch information
Showing
2 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const vm = require('vm'); | ||
|
||
const window = createWindow(); | ||
|
||
const descriptor = | ||
Object.getOwnPropertyDescriptor(window.globalProxy, 'onhashchange'); | ||
|
||
assert.strictEqual(typeof descriptor.get, 'function'); | ||
assert.strictEqual(typeof descriptor.set, 'function'); | ||
assert.strictEqual(descriptor.configurable, true); | ||
|
||
// Regression test for GH-42962. This assignment should not throw. | ||
window.globalProxy.onhashchange = () => {}; | ||
|
||
assert.strictEqual(window.globalProxy.onhashchange, 42); | ||
|
||
function createWindow() { | ||
const obj = {}; | ||
vm.createContext(obj); | ||
Object.defineProperty(obj, 'onhashchange', { | ||
get: common.mustCall(() => 42), | ||
set: common.mustCall(), | ||
configurable: true | ||
}); | ||
|
||
obj.globalProxy = vm.runInContext('this', obj); | ||
|
||
return obj; | ||
} |