Development questions
What is Lightning Web Security (LWS) and how does it differ from Locker Service?
DevelopmentMedium
Both isolate components from each other for security, but they work differently.
- Locker Service wraps objects in secure proxies (SecureElement, SecureWindow), which can break third-party libraries and adds overhead.
- Lightning Web Security is the newer architecture that isolates each namespace in its own JavaScript sandbox using the standard browser APIs with distortions only where required. It is faster, supports more third-party libraries, and is closer to standard JS behaviour.
Salesforce recommends LWS and it is enabled in Session Settings. Both are designed to stop one namespace from accessing another's DOM or data.
lwcsecuritylwslocker
More Development questions
- What is an Apex Trigger in Salesforce and when should you use it over Flows?
- What is the difference between before triggers and after triggers?
- Explain all Trigger context variables (isInsert, isUpdate, isDelete, isUndelete, isBefore, isAfter, isExecuting, size, operationType).
- What is the difference between Trigger.new and Trigger.old?
- In which trigger events are Trigger.new and Trigger.newMap available?
- In which trigger events are Trigger.old and Trigger.oldMap available?