Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/@lwc/shared/src/__tests__/context.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ describe('context', () => {
expect(isTrustedContext({})).toBe(false);
});

it('should return true for all calls when trustedContexts is not set', () => {
expect(isTrustedContext({})).toBe(true);
it('should return false for all calls when trustedContexts is not set', () => {
expect(isTrustedContext({})).toBe(false);
});
});
});
4 changes: 2 additions & 2 deletions packages/@lwc/shared/src/__tests__/signals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ describe('signals', () => {
expect(isTrustedSignal({})).toBe(false);
});

it('should return true for all calls when trustedSignals is not set', () => {
expect(isTrustedSignal({})).toBe(true);
it('should return false for all calls when trustedSignals is not set', () => {
expect(isTrustedSignal({})).toBe(false);
});
});
});
6 changes: 2 additions & 4 deletions packages/@lwc/shared/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ export function setTrustedContextSet(context: WeakSet<object>) {
}

export function addTrustedContext(contextParticipant: object) {
// This should be a no-op when the trustedSignals set isn't set by runtime
// This should be a no-op when the trustedContext set isn't set by runtime
trustedContext?.add(contextParticipant);
}

export function isTrustedContext(target: object): boolean {
if (!trustedContext) {
// The runtime didn't set a trustedContext set
// this check should only be performed for runtimes that care about filtering context participants to track
return true;
return false;
}
return trustedContext.has(target);
}
5 changes: 1 addition & 4 deletions packages/@lwc/shared/src/signals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ export function addTrustedSignal(signal: object) {

export function isTrustedSignal(target: object): boolean {
if (!trustedSignals) {
// The runtime didn't set a trustedSignals set
// this check should only be performed for runtimes that care about filtering signals to track
// our default behavior should be to track all signals
return true;
return false;
}
return trustedSignals.has(target);
}