From affb41f8da970f1ec83872533dc12a6e8d5969aa Mon Sep 17 00:00:00 2001 From: Favour Ohanekwu Date: Mon, 22 May 2023 07:22:25 +0100 Subject: [PATCH] fix: Update list of global worker identifiers (#23440) ## Description Global identifiers present in the worker context should not be valid entity names. This PR updates the list of global identifiers present in the worker context. #### PR fixes following issue(s) Fixes #23172 #### Type of change - Bug fix (non-breaking change which fixes an issue) ## Testing > #### How Has This Been Tested? - [x] Jest - [x] Manual #### Test Plan > Change object name to restricted keyword `performance` and check that it's handled correctly > > #### Issues raised during DP testing > > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change) have been covered - [x] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [x] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --- app/client/src/constants/WidgetValidation.ts | 7 +++++++ app/client/src/utils/helpers.test.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/app/client/src/constants/WidgetValidation.ts b/app/client/src/constants/WidgetValidation.ts index 3f51bb8902..9edf9b0dfc 100644 --- a/app/client/src/constants/WidgetValidation.ts +++ b/app/client/src/constants/WidgetValidation.ts @@ -200,6 +200,7 @@ export const DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS = { FinalizationRegistry: "FinalizationRegistry", Float32Array: "Float32Array", Float64Array: "Float64Array", + fonts: "fonts", FontFace: "FontFace", FormData: "FormData", Function: "Function", @@ -253,8 +254,12 @@ export const DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS = { NetworkInformation: "NetworkInformation", Notification: "Notification", Number: "Number", + onerror: "onerror", onmessage: "onmessage", onmessageerror: "onmessageerror", + onlanguagechange: "onlanguagechange", + onrejectionhandled: "onrejectionhandled", + onunhandledrejection: "onunhandledrejection", origin: "origin", Object: "Object", OffscreenCanvas: "OffscreenCanvas", @@ -263,6 +268,7 @@ export const DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS = { parseInt: "parseInt", Path2D: "Path2D", PaymentInstruments: "PaymentInstruments", + performance: "performance", Performance: "Performance", PerformanceEntry: "PerformanceEntry", PerformanceMark: "PerformanceMark", @@ -300,6 +306,7 @@ export const DEDICATED_WORKER_GLOBAL_SCOPE_IDENTIFIERS = { Request: "Request", requestAnimationFrame: "requestAnimationFrame", Response: "Response", + scheduler: "scheduler", Scheduler: "Scheduler", SecurityPolicyViolationEvent: "SecurityPolicyViolationEvent", Serial: "Serial", diff --git a/app/client/src/utils/helpers.test.ts b/app/client/src/utils/helpers.test.ts index 1196b04c87..6345e822ea 100644 --- a/app/client/src/utils/helpers.test.ts +++ b/app/client/src/utils/helpers.test.ts @@ -580,6 +580,7 @@ describe("isNameValid()", () => { "clearTimeout", "parseInt", "eval", + "performance", ]; // Some window object methods and properties names should be valid entity names since evaluation is done // in the worker thread, and some of the window methods and properties are not available there.