Skip to content

Commit d64f9f1

Browse files
Merge branch 'main' into jkt/overridenTaintMethods
2 parents 9ebc0d2 + 472a32a commit d64f9f1

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@canvas/image-data": "^1.0.0",
5858
"@fingerprintjs/fingerprintjs": "^3.4.1",
5959
"@rollup/plugin-commonjs": "^25.0.0",
60-
"@rollup/plugin-node-resolve": "^15.0.2",
60+
"@rollup/plugin-node-resolve": "^15.1.0",
6161
"@rollup/plugin-replace": "^5.0.2",
6262
"@types/chrome": "^0.0.237",
6363
"@types/jasmine": "^4.3.1",

src/features/click-to-load.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { logoImg, loadingImages, closeIcon } from './click-to-load/ctl-assets.js
33
import { getStyles, getConfig } from './click-to-load/ctl-config.js'
44
import ContentFeature from '../content-feature.js'
55
import { DDGCtlPlaceholderBlockedElement } from './click-to-load/components/ctl-placeholder-blocked.js'
6+
import { registerCustomElements } from './click-to-load/components'
67

78
/**
89
* @typedef {'darkMode' | 'lightMode' | 'loginMode' | 'cancelMode'} displayMode
@@ -1751,6 +1752,13 @@ export default class ClickToLoad extends ContentFeature {
17511752
styles = getStyles(this.assetConfig)
17521753
isMobileApp = this.platform.name === 'ios' || this.platform.name === 'android'
17531754

1755+
/**
1756+
* Register Custom Elements only when Click to Load is initialized, to ensure it is only
1757+
* called when config is ready and any previous context have been appropriately invalidated
1758+
* prior when applicable (ie Firefox when hot reloading the Extension)
1759+
*/
1760+
registerCustomElements()
1761+
17541762
for (const entity of Object.keys(config)) {
17551763
// Strip config entities that are first-party, or aren't enabled in the
17561764
// extension's clickToLoad settings.

src/features/click-to-load/components/ctl-placeholder-blocked.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,5 +298,3 @@ export class DDGCtlPlaceholderBlockedElement extends HTMLElement {
298298
}
299299
}
300300
}
301-
302-
customElements.define(DDGCtlPlaceholderBlockedElement.CUSTOM_TAG_NAME, DDGCtlPlaceholderBlockedElement)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { DDGCtlPlaceholderBlockedElement } from './ctl-placeholder-blocked.js'
2+
3+
/**
4+
* Register custom elements in this wrapper function to be called only when we need to
5+
* and also to allow remote-config later if needed.
6+
*/
7+
export function registerCustomElements () {
8+
if (!customElements.get(DDGCtlPlaceholderBlockedElement.CUSTOM_TAG_NAME)) {
9+
customElements.define(DDGCtlPlaceholderBlockedElement.CUSTOM_TAG_NAME, DDGCtlPlaceholderBlockedElement)
10+
}
11+
}

0 commit comments

Comments
 (0)