Skip to content

Commit 7f55cc0

Browse files
authored
Rename name Click to Load files (#300)
In the configuration, the Click to Load feature name was mistakenly set to "clickToPlay". Now that we have corrected that, let's fix references to "clickToPlay" in this repository, and fix the corresponding filenames. Also, let's remove the "Facebook" vs "Facebook, Inc." workaround, since that inconsistent entity naming was fixed in the configuration too.
1 parent b7f8328 commit 7f55cc0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+11
-16
lines changed

CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
src/features/fingerprinting-* @jonathanKingston @englehardt
55
src/canvas.js @jonathanKingston @englehardt
66
src/element-hiding.js @jonathanKingston @dharb
7-
src/features/click-to-play.js @kzar @ladamski
8-
src/locales/click-to-play/ @kzar @ladamski
7+
src/features/click-to-load.js @kzar @ladamski
8+
src/locales/click-to-load/ @kzar @ladamski
99

1010
# Platform owners
1111
inject/android.js @jonathanKingston @joshliebe

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"copy-sjcl": "node scripts/generateSJCL.js",
1212
"bundle-config": "node scripts/bundleConfig.mjs",
1313
"build": "npm run build-locales && npm run build-firefox && npm run build-chrome && npm run build-apple && npm run build-android && npm run build-windows && npm run build-integration && npm run build-chrome-mv3",
14-
"build-locales": "mkdir -p build/locales && node scripts/buildLocales src/locales/click-to-play > build/locales/ctl-locales.js",
14+
"build-locales": "mkdir -p build/locales && node scripts/buildLocales src/locales/click-to-load > build/locales/ctl-locales.js",
1515
"build-firefox": "mkdir -p build/firefox/ && node scripts/inject.mjs firefox > build/firefox/inject.js",
1616
"build-chrome": "mkdir -p build/chrome/ && node scripts/inject.mjs chrome > build/chrome/inject.js",
1717
"build-chrome-mv3": "mkdir -p build/chrome-mv3/ && node scripts/inject.mjs chrome-mv3 > build/chrome-mv3/inject.js",

src/content-scope-features.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function load (args) {
3636
'fingerprintingScreenSize',
3737
'fingerprintingTemporaryStorage',
3838
'navigatorInterface',
39-
'clickToPlay',
39+
'clickToLoad',
4040
'elementHiding'
4141
]
4242

src/features/click-to-play.js renamed to src/features/click-to-load.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @ts-nocheck
22
import { createCustomEvent, sendMessage, OriginalCustomEvent, originalWindowDispatchEvent } from '../utils.js'
3-
import { logoImg, loadingImages, closeIcon } from './click-to-play/ctl-assets.js'
4-
import { styles, getConfig } from './click-to-play/ctl-config.js'
3+
import { logoImg, loadingImages, closeIcon } from './click-to-load/ctl-assets.js'
4+
import { styles, getConfig } from './click-to-load/ctl-config.js'
55

66
let devMode = false
77
let isYoutubePreviewsEnabled = false
@@ -557,7 +557,7 @@ async function replaceClickToLoadElements (targetElement) {
557557
/**
558558
* @typedef unblockClickToLoadContentRequest
559559
* @property {string} entity
560-
* The entity to unblock requests for (e.g. "Facebook").
560+
* The entity to unblock requests for (e.g. "Facebook, Inc.").
561561
* @property {bool} [isLogin=false]
562562
* True if we should "allow social login", defaults to false.
563563
* @property {string} action
@@ -1343,21 +1343,16 @@ const knownMessageResponseType = Object.prototype.hasOwnProperty.bind(messageRes
13431343

13441344
export function init (args) {
13451345
const websiteOwner = args?.site?.parentEntity
1346-
const settings = args?.featureSettings?.clickToPlay || {}
1346+
const settings = args?.featureSettings?.clickToLoad || {}
13471347
const locale = args?.locale || 'en'
13481348
const localizedConfig = getConfig(locale)
13491349
config = localizedConfig.config
13501350
sharedStrings = localizedConfig.sharedStrings
13511351

13521352
for (const entity of Object.keys(config)) {
1353-
// TODO: Remove this workaround once the privacy-configuration has been
1354-
// updated, and 'Facebook, Inc.' is used consistently in
1355-
// content-scope-scripts too.
1356-
const normalizedEntity = entity === 'Facebook' ? 'Facebook, Inc.' : entity
1357-
13581353
// Strip config entities that are first-party, or aren't enabled in the
1359-
// extension's clickToPlay settings.
1360-
if ((websiteOwner && normalizedEntity === websiteOwner) ||
1354+
// extension's clickToLoad settings.
1355+
if ((websiteOwner && entity === websiteOwner) ||
13611356
!settings[entity] ||
13621357
settings[entity].state !== 'enabled') {
13631358
delete config[entity]

src/features/click-to-play/ctl-config.js renamed to src/features/click-to-load/ctl-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ export function getConfig (locale) {
600600

601601
const sharedStrings = locales[locale]['shared.json']
602602
const config = {
603-
Facebook: {
603+
'Facebook, Inc.': {
604604
informationalModal: {
605605
icon: blockedFBLogo,
606606
messageTitle: fbStrings.informationalModalMessageTitle,

0 commit comments

Comments
 (0)