Skip to content

Commit c5dc2cf

Browse files
shakyShanegithub-actions[bot]
authored andcommitted
Release build 8.21.0 [ci release]
1 parent 2901b43 commit c5dc2cf

File tree

12 files changed

+178
-17
lines changed

12 files changed

+178
-17
lines changed

CHANGELOG.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
- ntp: fixed the empty state of activity widget when trackers are present (#1677)
2-
- Update YouTube feature description for ad blocking experiment (#1674)
3-
- Skip Duck Player step when ad blocking is enabled (#1673)
4-
- build(deps-dev): bump jasmine from 5.6.0 to 5.7.1 (#1666)
5-
- Onboarding: Send set*() messages to native apps when step is skipped (#1648)
1+
- windows: enabled message bridge (#1663)

Sources/ContentScopeScripts/dist/contentScope.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@
13371337
android: [...baseFeatures, "webCompat", "breakageReporting", "duckPlayer", "messageBridge"],
13381338
"android-broker-protection": ["brokerProtection"],
13391339
"android-autofill-password-import": ["autofillPasswordImport"],
1340-
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting"],
1340+
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting", "messageBridge"],
13411341
firefox: ["cookie", ...baseFeatures, "clickToLoad"],
13421342
chrome: ["cookie", ...baseFeatures, "clickToLoad"],
13431343
"chrome-mv3": ["cookie", ...baseFeatures, "clickToLoad"],

Sources/ContentScopeScripts/dist/contentScopeIsolated.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@
20422042
android: [...baseFeatures, "webCompat", "breakageReporting", "duckPlayer", "messageBridge"],
20432043
"android-broker-protection": ["brokerProtection"],
20442044
"android-autofill-password-import": ["autofillPasswordImport"],
2045-
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting"],
2045+
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting", "messageBridge"],
20462046
firefox: ["cookie", ...baseFeatures, "clickToLoad"],
20472047
chrome: ["cookie", ...baseFeatures, "clickToLoad"],
20482048
"chrome-mv3": ["cookie", ...baseFeatures, "clickToLoad"],

build/android/autofillPasswordImport.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@
509509
android: [...baseFeatures, "webCompat", "breakageReporting", "duckPlayer", "messageBridge"],
510510
"android-broker-protection": ["brokerProtection"],
511511
"android-autofill-password-import": ["autofillPasswordImport"],
512-
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting"],
512+
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting", "messageBridge"],
513513
firefox: ["cookie", ...baseFeatures, "clickToLoad"],
514514
chrome: ["cookie", ...baseFeatures, "clickToLoad"],
515515
"chrome-mv3": ["cookie", ...baseFeatures, "clickToLoad"],

build/android/brokerProtection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,7 @@
20082008
android: [...baseFeatures, "webCompat", "breakageReporting", "duckPlayer", "messageBridge"],
20092009
"android-broker-protection": ["brokerProtection"],
20102010
"android-autofill-password-import": ["autofillPasswordImport"],
2011-
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting"],
2011+
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting", "messageBridge"],
20122012
firefox: ["cookie", ...baseFeatures, "clickToLoad"],
20132013
chrome: ["cookie", ...baseFeatures, "clickToLoad"],
20142014
"chrome-mv3": ["cookie", ...baseFeatures, "clickToLoad"],

build/android/contentScope.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@
13371337
android: [...baseFeatures, "webCompat", "breakageReporting", "duckPlayer", "messageBridge"],
13381338
"android-broker-protection": ["brokerProtection"],
13391339
"android-autofill-password-import": ["autofillPasswordImport"],
1340-
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting"],
1340+
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting", "messageBridge"],
13411341
firefox: ["cookie", ...baseFeatures, "clickToLoad"],
13421342
chrome: ["cookie", ...baseFeatures, "clickToLoad"],
13431343
"chrome-mv3": ["cookie", ...baseFeatures, "clickToLoad"],

build/chrome-mv3/inject.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@
12851285
android: [...baseFeatures, "webCompat", "breakageReporting", "duckPlayer", "messageBridge"],
12861286
"android-broker-protection": ["brokerProtection"],
12871287
"android-autofill-password-import": ["autofillPasswordImport"],
1288-
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting"],
1288+
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting", "messageBridge"],
12891289
firefox: ["cookie", ...baseFeatures, "clickToLoad"],
12901290
chrome: ["cookie", ...baseFeatures, "clickToLoad"],
12911291
"chrome-mv3": ["cookie", ...baseFeatures, "clickToLoad"],

build/firefox/inject.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@
12851285
android: [...baseFeatures, "webCompat", "breakageReporting", "duckPlayer", "messageBridge"],
12861286
"android-broker-protection": ["brokerProtection"],
12871287
"android-autofill-password-import": ["autofillPasswordImport"],
1288-
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting"],
1288+
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting", "messageBridge"],
12891289
firefox: ["cookie", ...baseFeatures, "clickToLoad"],
12901290
chrome: ["cookie", ...baseFeatures, "clickToLoad"],
12911291
"chrome-mv3": ["cookie", ...baseFeatures, "clickToLoad"],

build/integration/contentScope.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2840,7 +2840,7 @@
28402840
android: [...baseFeatures, "webCompat", "breakageReporting", "duckPlayer", "messageBridge"],
28412841
"android-broker-protection": ["brokerProtection"],
28422842
"android-autofill-password-import": ["autofillPasswordImport"],
2843-
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting"],
2843+
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting", "messageBridge"],
28442844
firefox: ["cookie", ...baseFeatures, "clickToLoad"],
28452845
chrome: ["cookie", ...baseFeatures, "clickToLoad"],
28462846
"chrome-mv3": ["cookie", ...baseFeatures, "clickToLoad"],

build/windows/contentScope.js

+167-3
Original file line numberDiff line numberDiff line change
@@ -2829,7 +2829,7 @@
28292829
android: [...baseFeatures, "webCompat", "breakageReporting", "duckPlayer", "messageBridge"],
28302830
"android-broker-protection": ["brokerProtection"],
28312831
"android-autofill-password-import": ["autofillPasswordImport"],
2832-
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting"],
2832+
windows: ["cookie", ...baseFeatures, "windowsPermissionUsage", "duckPlayer", "brokerProtection", "breakageReporting", "messageBridge"],
28332833
firefox: ["cookie", ...baseFeatures, "clickToLoad"],
28342834
chrome: ["cookie", ...baseFeatures, "clickToLoad"],
28352835
"chrome-mv3": ["cookie", ...baseFeatures, "clickToLoad"],
@@ -13875,6 +13875,168 @@
1387513875
}
1387613876
};
1387713877

13878+
// src/features/message-bridge.js
13879+
init_define_import_meta_trackerLookup();
13880+
var MessageBridge = class extends ContentFeature {
13881+
constructor() {
13882+
super(...arguments);
13883+
/** @type {Captured} */
13884+
__publicField(this, "captured", captured_globals_exports);
13885+
/**
13886+
* A mapping of feature names to instances of `Messaging`.
13887+
* This allows the bridge to handle more than 1 feature at a time.
13888+
* @type {Map<string, Messaging>}
13889+
*/
13890+
__publicField(this, "proxies", new Map2());
13891+
/**
13892+
* If any subscriptions are created, we store the cleanup functions
13893+
* for later use.
13894+
* @type {Map<string, () => void>}
13895+
*/
13896+
__publicField(this, "subscriptions", new Map2());
13897+
/**
13898+
* This side of the bridge can only be instantiated once,
13899+
* so we use this flag to ensure we can handle multiple invocations
13900+
*/
13901+
__publicField(this, "installed", false);
13902+
}
13903+
init(args) {
13904+
if (isBeingFramed() || !isSecureContext) return;
13905+
if (!args.messageSecret) return;
13906+
const { captured: captured2 } = this;
13907+
function appendToken(eventName) {
13908+
return `${eventName}-${args.messageSecret}`;
13909+
}
13910+
const reply = (incoming) => {
13911+
if (!args.messageSecret) return this.log("ignoring because args.messageSecret was absent");
13912+
const eventName = appendToken(incoming.name + "-" + incoming.id);
13913+
const event = new captured2.CustomEvent(eventName, { detail: incoming });
13914+
captured2.dispatchEvent(event);
13915+
};
13916+
const accept = (ClassType, callback) => {
13917+
captured2.addEventListener(appendToken(ClassType.NAME), (e) => {
13918+
this.log(`${ClassType.NAME}`, JSON.stringify(e.detail));
13919+
const instance = ClassType.create(e.detail);
13920+
if (instance) {
13921+
callback(instance);
13922+
} else {
13923+
this.log("Failed to create an instance");
13924+
}
13925+
});
13926+
};
13927+
this.log(`bridge is installing...`);
13928+
accept(InstallProxy, (install) => {
13929+
this.installProxyFor(install, args.messagingConfig, reply);
13930+
});
13931+
accept(ProxyNotification, (notification) => this.proxyNotification(notification));
13932+
accept(ProxyRequest, (request) => this.proxyRequest(request, reply));
13933+
accept(SubscriptionRequest, (subscription) => this.proxySubscription(subscription, reply));
13934+
accept(SubscriptionUnsubscribe, (unsubscribe) => this.removeSubscription(unsubscribe.id));
13935+
}
13936+
/**
13937+
* Installing a feature proxy is the act of creating a fresh instance of 'Messaging', but
13938+
* using the same underlying transport
13939+
*
13940+
* @param {InstallProxy} install
13941+
* @param {import('@duckduckgo/messaging').MessagingConfig} config
13942+
* @param {(payload: {name: string; id: string} & Record<string, any>) => void} reply
13943+
*/
13944+
installProxyFor(install, config, reply) {
13945+
const { id, featureName } = install;
13946+
if (this.proxies.has(featureName)) return this.log("ignoring `installProxyFor` because it exists", featureName);
13947+
const allowed = this.getFeatureSettingEnabled(featureName);
13948+
if (!allowed) {
13949+
return this.log("not installing proxy, because", featureName, "was not enabled");
13950+
}
13951+
const ctx = { ...this.messaging.messagingContext, featureName };
13952+
const messaging = new Messaging(ctx, config);
13953+
this.proxies.set(featureName, messaging);
13954+
this.log("did install proxy for ", featureName);
13955+
reply(new DidInstall({ id }));
13956+
}
13957+
/**
13958+
* @param {ProxyRequest} request
13959+
* @param {(payload: {name: string; id: string} & Record<string, any>) => void} reply
13960+
*/
13961+
async proxyRequest(request, reply) {
13962+
const { id, featureName, method, params } = request;
13963+
const proxy = this.proxies.get(featureName);
13964+
if (!proxy) return this.log("proxy was not installed for ", featureName);
13965+
this.log("will proxy", request);
13966+
try {
13967+
const result = await proxy.request(method, params);
13968+
const responseEvent = new ProxyResponse({
13969+
method,
13970+
featureName,
13971+
result,
13972+
id
13973+
});
13974+
reply(responseEvent);
13975+
} catch (e) {
13976+
const errorResponseEvent = new ProxyResponse({
13977+
method,
13978+
featureName,
13979+
error: { message: e.message },
13980+
id
13981+
});
13982+
reply(errorResponseEvent);
13983+
}
13984+
}
13985+
/**
13986+
* @param {SubscriptionRequest} subscription
13987+
* @param {(payload: {name: string; id: string} & Record<string, any>) => void} reply
13988+
*/
13989+
proxySubscription(subscription, reply) {
13990+
const { id, featureName, subscriptionName } = subscription;
13991+
const proxy = this.proxies.get(subscription.featureName);
13992+
if (!proxy) return this.log("proxy was not installed for", featureName);
13993+
this.log("will setup subscription", subscription);
13994+
const prev = this.subscriptions.get(id);
13995+
if (prev) {
13996+
this.removeSubscription(id);
13997+
}
13998+
const unsubscribe = proxy.subscribe(subscriptionName, (data2) => {
13999+
const responseEvent = new SubscriptionResponse({
14000+
subscriptionName,
14001+
featureName,
14002+
params: data2,
14003+
id
14004+
});
14005+
reply(responseEvent);
14006+
});
14007+
this.subscriptions.set(id, unsubscribe);
14008+
}
14009+
/**
14010+
* @param {string} id
14011+
*/
14012+
removeSubscription(id) {
14013+
const unsubscribe = this.subscriptions.get(id);
14014+
this.log(`will remove subscription`, id);
14015+
unsubscribe?.();
14016+
this.subscriptions.delete(id);
14017+
}
14018+
/**
14019+
* @param {ProxyNotification} notification
14020+
*/
14021+
proxyNotification(notification) {
14022+
const proxy = this.proxies.get(notification.featureName);
14023+
if (!proxy) return this.log("proxy was not installed for", notification.featureName);
14024+
this.log("will proxy notification", notification);
14025+
proxy.notify(notification.method, notification.params);
14026+
}
14027+
/**
14028+
* @param {Parameters<console['log']>} args
14029+
*/
14030+
log(...args) {
14031+
if (this.isDebug) {
14032+
console.log("[isolated]", ...args);
14033+
}
14034+
}
14035+
load(_args2) {
14036+
}
14037+
};
14038+
var message_bridge_default = MessageBridge;
14039+
1387814040
// ddg:platformFeatures:ddg:platformFeatures
1387914041
var ddg_platformFeatures_default = {
1388014042
ddg_feature_cookie: CookieFeature,
@@ -13894,7 +14056,8 @@
1389414056
ddg_feature_windowsPermissionUsage: WindowsPermissionUsage,
1389514057
ddg_feature_duckPlayer: DuckPlayerFeature,
1389614058
ddg_feature_brokerProtection: BrokerProtection,
13897-
ddg_feature_breakageReporting: BreakageReporting
14059+
ddg_feature_breakageReporting: BreakageReporting,
14060+
ddg_feature_messageBridge: message_bridge_default
1389814061
};
1389914062

1390014063
// src/url-change.js
@@ -14024,7 +14187,8 @@
1402414187
platform: processedConfig.platform,
1402514188
site: processedConfig.site,
1402614189
bundledConfig: processedConfig.bundledConfig,
14027-
messagingConfig: processedConfig.messagingConfig
14190+
messagingConfig: processedConfig.messagingConfig,
14191+
messageSecret: processedConfig.messageSecret
1402814192
});
1402914193
init(processedConfig);
1403014194
}

injected/entry-points/windows.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function initCode() {
3131
site: processedConfig.site,
3232
bundledConfig: processedConfig.bundledConfig,
3333
messagingConfig: processedConfig.messagingConfig,
34+
messageSecret: processedConfig.messageSecret,
3435
});
3536

3637
init(processedConfig);

injected/src/features.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const platformSupport = {
3737
android: [...baseFeatures, 'webCompat', 'breakageReporting', 'duckPlayer', 'messageBridge'],
3838
'android-broker-protection': ['brokerProtection'],
3939
'android-autofill-password-import': ['autofillPasswordImport'],
40-
windows: ['cookie', ...baseFeatures, 'windowsPermissionUsage', 'duckPlayer', 'brokerProtection', 'breakageReporting'],
40+
windows: ['cookie', ...baseFeatures, 'windowsPermissionUsage', 'duckPlayer', 'brokerProtection', 'breakageReporting', 'messageBridge'],
4141
firefox: ['cookie', ...baseFeatures, 'clickToLoad'],
4242
chrome: ['cookie', ...baseFeatures, 'clickToLoad'],
4343
'chrome-mv3': ['cookie', ...baseFeatures, 'clickToLoad'],

0 commit comments

Comments
 (0)