Skip to content

Commit fec7ddf

Browse files
Revert "Add support for non isolated messaging (#1586)"
This reverts commit 8200587.
1 parent 0aa34b5 commit fec7ddf

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

injected/entry-points/apple.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import { load, init } from '../src/content-scope-features.js';
55
import { processConfig, platformSpecificFeatures } from './../src/utils';
6-
import { WebkitMessagingConfig } from '../../messaging/index.js';
6+
import { WebkitMessagingConfig, TestTransportConfig } from '../../messaging/index.js';
77

88
function initCode() {
99
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
@@ -15,17 +15,27 @@ function initCode() {
1515

1616
const processedConfig = processConfig(config, userUnprotectedDomains, userPreferences, platformSpecificFeatures);
1717

18-
const handlerNames = [];
1918
if (import.meta.injectName === 'apple-isolated') {
20-
handlerNames.push('contentScopeScriptsIsolated');
19+
processedConfig.messagingConfig = new WebkitMessagingConfig({
20+
webkitMessageHandlerNames: ['contentScopeScriptsIsolated'],
21+
secret: '',
22+
hasModernWebkitAPI: true,
23+
});
2124
} else {
22-
handlerNames.push('contentScopeScripts');
25+
processedConfig.messagingConfig = new TestTransportConfig({
26+
notify() {
27+
// noop
28+
},
29+
request: async () => {
30+
// noop
31+
},
32+
subscribe() {
33+
return () => {
34+
// noop
35+
};
36+
},
37+
});
2338
}
24-
processedConfig.messagingConfig = new WebkitMessagingConfig({
25-
webkitMessageHandlerNames: handlerNames,
26-
secret: '',
27-
hasModernWebkitAPI: true,
28-
});
2939

3040
load({
3141
platform: processedConfig.platform,

0 commit comments

Comments
 (0)