From baedf97049f6bc36271fa243edfd24d436cfbe43 Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Thu, 25 Apr 2024 01:51:44 +0200 Subject: [PATCH] lib: fix DOMException property descriptors after being lazy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/46799 Reviewed-By: James M Snell Reviewed-By: Chengzhong Wu Reviewed-By: Joyee Cheung Reviewed-By: Tobias Nießen --- graal-nodejs/lib/internal/bootstrap/browser.js | 6 +++++- graal-nodejs/test/common/wpt.js | 1 + graal-nodejs/test/wpt/test-domexception.js | 11 +---------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/graal-nodejs/lib/internal/bootstrap/browser.js b/graal-nodejs/lib/internal/bootstrap/browser.js index 9e63e0679ac..bffdadbe84e 100644 --- a/graal-nodejs/lib/internal/bootstrap/browser.js +++ b/graal-nodejs/lib/internal/bootstrap/browser.js @@ -26,7 +26,11 @@ exposeInterface(globalThis, 'URL', URL); exposeInterface(globalThis, 'URLSearchParams', URLSearchParams); exposeGetterAndSetter(globalThis, 'DOMException', - lazyDOMExceptionClass, + () => { + const DOMException = lazyDOMExceptionClass(); + exposeInterface(globalThis, 'DOMException', DOMException); + return DOMException; + }, (value) => { exposeInterface(globalThis, 'DOMException', value); }); diff --git a/graal-nodejs/test/common/wpt.js b/graal-nodejs/test/common/wpt.js index f33911ea784..f7511f3c068 100644 --- a/graal-nodejs/test/common/wpt.js +++ b/graal-nodejs/test/common/wpt.js @@ -503,6 +503,7 @@ class WPTRunner { loadLazyGlobals() { const lazyProperties = [ + 'DOMException', 'Performance', 'PerformanceEntry', 'PerformanceMark', 'PerformanceMeasure', 'PerformanceObserver', 'PerformanceObserverEntryList', 'PerformanceResourceTiming', 'Blob', 'atob', 'btoa', diff --git a/graal-nodejs/test/wpt/test-domexception.js b/graal-nodejs/test/wpt/test-domexception.js index ea68c8562ae..7900d1ca9a7 100644 --- a/graal-nodejs/test/wpt/test-domexception.js +++ b/graal-nodejs/test/wpt/test-domexception.js @@ -4,15 +4,6 @@ const { WPTRunner } = require('../common/wpt'); const runner = new WPTRunner('webidl/ecmascript-binding/es-exceptions'); -runner.setFlags(['--expose-internals']); -runner.setInitScript(` - const { internalBinding } = require('internal/test/binding'); - const { DOMException } = internalBinding('messaging'); - Object.defineProperty(global, 'DOMException', { - writable: true, - configurable: true, - value: DOMException, - }); -`); +runner.loadLazyGlobals(); runner.runJsTests();