Skip to content

Commit 76fda8a

Browse files
authored
revert: temporarily undo Locker-specific logic @W-17769475 (#5198)
* revert: temporarily undo Locker-specific logic * chore: revert test
1 parent 306a8f0 commit 76fda8a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

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

Lines changed: 6 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,11 @@ 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+
// TODO [W-17769475]: Restore this fix when we can reliably detect Locker enabled
62+
// const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
63+
// ? vmBeingConstructed.component !== result
64+
// : !(result instanceof LightningElement);
65+
const isInvalidConstructor = vmBeingConstructed.component !== result;
6466

6567
if (isInvalidConstructor) {
6668
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)