Skip to content

Commit be63500

Browse files
authored
Fix Facebook Click to Load logins and add related JSDoc comment (#226)
There was a typo in one of the calls to `enableSocialTracker` which caused Facebook requests to not be allowed properly when the user clicked to login via Facebook. That in turn broke the "Log in via Facebook" functionality. Let's fix that typo, but also add a JSDoc comment to make the function easier to use correctly in the future.
1 parent 0c93b7a commit be63500

File tree

8 files changed

+148
-8
lines changed

8 files changed

+148
-8
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

+21-1
Original file line numberDiff line numberDiff line change
@@ -3538,12 +3538,32 @@
35383538
/*********************************************************
35393539
* Messaging to surrogates & extension
35403540
*********************************************************/
3541+
3542+
/**
3543+
* @typedef enableSocialTrackerRequest
3544+
* @property {string} entity
3545+
* The entity to unblock requests for (e.g. "Facebook").
3546+
* @property {bool} [isLogin=false]
3547+
* True if we should "allow social login", defaults to false.
3548+
* @property {string} action
3549+
* The Click to Load blocklist rule action (e.g. "block-ctl-fb") that should
3550+
* be allowed. Important since in the future there might be multiple types of
3551+
* embedded content from the same entity that the user can allow
3552+
* independently.
3553+
*/
3554+
3555+
/**
3556+
* Send a message to the background to unblock requests for the given entity for
3557+
* the page.
3558+
* @param {enableSocialTrackerRequest} message
3559+
* @see {@event ddg-ctp-enableSocialTracker-complete} for the response handler.
3560+
*/
35413561
function enableSocialTracker (message) {
35423562
sendMessage('enableSocialTracker', message);
35433563
}
35443564

35453565
function runLogin (entity) {
3546-
enableSocialTracker(entity);
3566+
enableSocialTracker({ entity, isLogin: true });
35473567
originalWindowDispatchEvent(
35483568
createCustomEvent('ddg-ctp-run-login', {
35493569
detail: {

build/android/contentScope.js

+21-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/chrome-mv3/inject.js

+21-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/chrome/inject.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/firefox/inject.js

+21-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/integration/contentScope.js

+21-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/windows/contentScope.js

+21-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/features/click-to-play.js

+21-1
Original file line numberDiff line numberDiff line change
@@ -1583,12 +1583,32 @@ async function replaceClickToLoadElements (config, targetElement) {
15831583
/*********************************************************
15841584
* Messaging to surrogates & extension
15851585
*********************************************************/
1586+
1587+
/**
1588+
* @typedef enableSocialTrackerRequest
1589+
* @property {string} entity
1590+
* The entity to unblock requests for (e.g. "Facebook").
1591+
* @property {bool} [isLogin=false]
1592+
* True if we should "allow social login", defaults to false.
1593+
* @property {string} action
1594+
* The Click to Load blocklist rule action (e.g. "block-ctl-fb") that should
1595+
* be allowed. Important since in the future there might be multiple types of
1596+
* embedded content from the same entity that the user can allow
1597+
* independently.
1598+
*/
1599+
1600+
/**
1601+
* Send a message to the background to unblock requests for the given entity for
1602+
* the page.
1603+
* @param {enableSocialTrackerRequest} message
1604+
* @see {@event ddg-ctp-enableSocialTracker-complete} for the response handler.
1605+
*/
15861606
function enableSocialTracker (message) {
15871607
sendMessage('enableSocialTracker', message)
15881608
}
15891609

15901610
function runLogin (entity) {
1591-
enableSocialTracker(entity, true)
1611+
enableSocialTracker({ entity, isLogin: true })
15921612
originalWindowDispatchEvent(
15931613
createCustomEvent('ddg-ctp-run-login', {
15941614
detail: {

0 commit comments

Comments
 (0)