-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds document attribute for disable tcpcheck #4008
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
client/luigi-client.d.ts
Outdated
export function addInitListener(initFn: (context: Context, origin?: string) => void, disableTpcCheck?: boolean): number; | ||
export type addInitListener = ( | ||
initFn: (context: Context, origin?: string) => void, | ||
disableTpcCheck?: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep the disableTcpCheck argument, it should still be possible to disable via js, e.g. in a test environment.
client/src/lifecycleManager.js
Outdated
* @memberof Lifecycle | ||
* @example | ||
* const initListenerId = LuigiClient.addInitListener((context) => storeContextToMF(context)) | ||
*/ | ||
addInitListener(initFn, disableTpcCheck) { | ||
this.disableTpcCheck = disableTpcCheck; | ||
addInitListener(initFn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep the disableTcpCheck argument, it should still be possible to disable via js, e.g. in a test environment.
if it is true, just call document.head.setAttribute('disable-tpc-check') here instead of this.disableTpcCheck=true
client/src/luigi-client.js
Outdated
@@ -26,8 +26,8 @@ class LuigiClient { | |||
} | |||
} | |||
|
|||
addInitListener(initFn, disableTpcCheck) { | |||
return lifecycleManager.addInitListener(initFn, disableTpcCheck); | |||
addInitListener(initFn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
client/src/lifecycleManager.js
Outdated
@@ -140,17 +148,21 @@ class LifecycleManager extends LuigiClientBase { | |||
} | |||
|
|||
_tpcCheck() { | |||
if (this.currentContext?.internal?.thirdPartyCookieCheck?.disabled || this.disableTpcCheck) { | |||
const tpcCheckDisabled = | |||
this._isTpcCheckDisabled() || this.currentContext?.internal?.thirdPartyCookieCheck?.disabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moving the check
this.currentContext?.internal?.thirdPartyCookieCheck?.disabled;
into _isTpcCheckDisabled()
could save one LOC ;)
Description
Changes proposed in this pull request:
disableTpcCheck
prop to keep one source of truthRelated issue(s)
Resolves #4006