Skip to content

Commit fcab7b2

Browse files
chore: revert revert of locker flag (#5230)
1 parent 76cfad1 commit fcab7b2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/@lwc/engine-core/src/framework/invoker.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { addErrorComponentStack } from '../shared/error';
1111
import { evaluateTemplate, setVMBeingRendered, getVMBeingRendered } from './template';
1212
import { runWithBoundaryProtection } from './vm';
1313
import { logOperationStart, logOperationEnd, OperationId } from './profiler';
14-
import { LightningElement } from './base-lightning-element';
14+
import type { LightningElement } from './base-lightning-element';
1515
import type { Template } from './template';
1616
import type { VM } from './vm';
1717
import type { LightningElementConstructor } from './base-lightning-element';
@@ -58,9 +58,12 @@ export function invokeComponentConstructor(vm: VM, Ctor: LightningElementConstru
5858
// the "instanceof" operator would not work here since Locker Service provides its own
5959
// implementation of LightningElement, so we indirectly check if the base constructor is
6060
// invoked by accessing the component on the vm.
61-
const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
62-
? vmBeingConstructed.component !== result
63-
: !(result instanceof LightningElement);
61+
62+
// TODO [W-17769475]: Restore this fix when we can reliably detect Locker enabled
63+
// const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
64+
// ? vmBeingConstructed.component !== result
65+
// : !(result instanceof LightningElement);
66+
const isInvalidConstructor = vmBeingConstructed.component !== result;
6467

6568
if (isInvalidConstructor) {
6669
throw new TypeError(

packages/@lwc/integration-karma/test/component/LightningElement/index.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ it("[W-6981076] shouldn't throw when a component with an invalid child in unmoun
8181
expect(() => document.body.removeChild(elm)).not.toThrow();
8282
});
8383

84-
it('should fail when the constructor returns something other than an instance of itself', () => {
84+
// TODO [W-17769475]: Restore this test when we can reliably detect Locker enabled
85+
xit('should fail when the constructor returns something other than an instance of itself', () => {
8586
expect(() => {
8687
createElement('x-returning-bad', { is: ReturningBad });
8788
}).toThrowError(

0 commit comments

Comments
 (0)