|
1895 | 1895 |
|
1896 | 1896 | for (const featureName of featureNames) {
|
1897 | 1897 | const filename = featureName.replace(/([a-zA-Z])(?=[A-Z0-9])/g, '$1-').toLowerCase();
|
| 1898 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
1898 | 1899 | const feature = __variableDynamicImportRuntime0__(`./features/${filename}.js`).then(({ init, load, update }) => {
|
1899 | 1900 | if (load) {
|
1900 | 1901 | load(args);
|
|
2973 | 2974 | return { config, sharedStrings }
|
2974 | 2975 | }
|
2975 | 2976 |
|
| 2977 | + // @ts-nocheck |
| 2978 | + |
2976 | 2979 | let devMode = false;
|
2977 | 2980 | let isYoutubePreviewsEnabled = false;
|
2978 | 2981 | let appID;
|
|
4695 | 4698 | case 'closest-empty':
|
4696 | 4699 | // hide the outermost empty node so that we may unhide if ad loads
|
4697 | 4700 | if (isDomNodeEmpty(element)) {
|
| 4701 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
4698 | 4702 | collapseDomNode(element.parentNode, rule, element);
|
4699 | 4703 | } else if (previousElement) {
|
4700 | 4704 | hideNode(previousElement);
|
|
4729 | 4733 | } else if (type === 'closest-empty') {
|
4730 | 4734 | // iterate upwards from matching DOM elements until we arrive at previously
|
4731 | 4735 | // hidden element. Unhide element if it contains visible content.
|
| 4736 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
4732 | 4737 | expandNonEmptyDomNode(element.parentNode, rule);
|
4733 | 4738 | }
|
4734 | 4739 | break
|
|
4832 | 4837 | // check at 750ms, 1500ms, 2250ms, 3000ms
|
4833 | 4838 | unhideTimeouts.forEach((timeout) => {
|
4834 | 4839 | setTimeout(() => {
|
| 4840 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
4835 | 4841 | unhideLoadedAds();
|
4836 | 4842 | }, timeout);
|
4837 | 4843 | });
|
|
4905 | 4911 | rules.forEach((rule) => {
|
4906 | 4912 | const matchingElementArray = [...document.querySelectorAll(rule.selector)];
|
4907 | 4913 | matchingElementArray.forEach((element) => {
|
| 4914 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
4908 | 4915 | collapseDomNode(element, rule);
|
4909 | 4916 | });
|
4910 | 4917 | });
|
|
5069 | 5076 | const channelData = DDGReflect.apply(target, thisArg, args);
|
5070 | 5077 | // Anything we do here should be caught and ignored silently
|
5071 | 5078 | try {
|
| 5079 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
5072 | 5080 | transformArrayData(channelData, domainKey, sessionKey, thisArg, args);
|
5073 | 5081 | } catch {
|
5074 | 5082 | }
|
|
5084 | 5092 | DDGReflect.apply(target, thisArg, args);
|
5085 | 5093 | // Anything we do here should be caught and ignored silently
|
5086 | 5094 | try {
|
| 5095 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
5087 | 5096 | transformArrayData(args[0], domainKey, sessionKey, thisArg, args);
|
5088 | 5097 | } catch {
|
5089 | 5098 | }
|
|
5104 | 5113 | * as well as prevent any script from listening to events.
|
5105 | 5114 | */
|
5106 | 5115 | function init$b (args) {
|
| 5116 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
5107 | 5117 | if (globalThis.navigator.getBattery) {
|
5108 | 5118 | const BatteryManager = globalThis.BatteryManager;
|
5109 | 5119 |
|
|
6461 | 6471 |
|
6462 | 6472 | overrideProperty('keyboard', {
|
6463 | 6473 | object: Navigator.prototype,
|
| 6474 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6464 | 6475 | origValue: navigator.keyboard,
|
6465 | 6476 | targetValue: getFeatureAttr(featureName$2, args, 'keyboard')
|
6466 | 6477 | });
|
|
6471 | 6482 | });
|
6472 | 6483 | overrideProperty('deviceMemory', {
|
6473 | 6484 | object: Navigator.prototype,
|
| 6485 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6474 | 6486 | origValue: navigator.deviceMemory,
|
6475 | 6487 | targetValue: getFeatureAttr(featureName$2, args, 'deviceMemory', 8)
|
6476 | 6488 | });
|
|
6571 | 6583 |
|
6572 | 6584 | origPropertyValues.availTop = overrideProperty('availTop', {
|
6573 | 6585 | object: Screen.prototype,
|
| 6586 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6574 | 6587 | origValue: screen.availTop,
|
6575 | 6588 | targetValue: getFeatureAttr(featureName$1, args, 'availTop', 0)
|
6576 | 6589 | });
|
6577 | 6590 | origPropertyValues.availLeft = overrideProperty('availLeft', {
|
6578 | 6591 | object: Screen.prototype,
|
| 6592 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6579 | 6593 | origValue: screen.availLeft,
|
6580 | 6594 | targetValue: getFeatureAttr(featureName$1, args, 'availLeft', 0)
|
6581 | 6595 | });
|
|
6620 | 6634 | * This will limit the max storage to 4GB without completely disabling the
|
6621 | 6635 | * feature.
|
6622 | 6636 | */
|
| 6637 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6623 | 6638 | if (navigator.webkitTemporaryStorage) {
|
6624 | 6639 | try {
|
| 6640 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6625 | 6641 | const org = navigator.webkitTemporaryStorage.queryUsageAndQuota;
|
| 6642 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6626 | 6643 | const tStorage = navigator.webkitTemporaryStorage;
|
6627 | 6644 | tStorage.queryUsageAndQuota = function queryUsageAndQuota (callback, err) {
|
6628 | 6645 | const modifiedCallback = function (usedBytes, grantedBytes) {
|
6629 | 6646 | const maxBytesGranted = 4 * 1024 * 1024 * 1024;
|
6630 | 6647 | const spoofedGrantedBytes = Math.min(grantedBytes, maxBytesGranted);
|
6631 | 6648 | callback(usedBytes, spoofedGrantedBytes);
|
6632 | 6649 | };
|
| 6650 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6633 | 6651 | org.call(navigator.webkitTemporaryStorage, modifiedCallback, err);
|
6634 | 6652 | };
|
6635 | 6653 | defineProperty(Navigator.prototype, 'webkitTemporaryStorage', { get: () => tStorage });
|
|
6677 | 6695 | try {
|
6678 | 6696 | // If GPC on, set DOM property prototype to true if not already true
|
6679 | 6697 | if (args.globalPrivacyControlValue) {
|
| 6698 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6680 | 6699 | if (navigator.globalPrivacyControl) return
|
6681 | 6700 | defineProperty(Navigator.prototype, 'globalPrivacyControl', {
|
6682 | 6701 | get: () => true,
|
|
6686 | 6705 | } else {
|
6687 | 6706 | // If GPC off & unsupported by browser, set DOM property prototype to false
|
6688 | 6707 | // this may be overwritten by the user agent or other extensions
|
| 6708 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6689 | 6709 | if (typeof navigator.globalPrivacyControl !== 'undefined') return
|
6690 | 6710 | defineProperty(Navigator.prototype, 'globalPrivacyControl', {
|
6691 | 6711 | get: () => false,
|
|
6705 | 6725 |
|
6706 | 6726 | function init$4 (args) {
|
6707 | 6727 | try {
|
| 6728 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
6708 | 6729 | if (navigator.duckduckgo) {
|
6709 | 6730 | return
|
6710 | 6731 | }
|
|
7083 | 7104 |
|
7084 | 7105 | function safariObjectFix () {
|
7085 | 7106 | try {
|
| 7107 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7086 | 7108 | if (window.safari) {
|
7087 | 7109 | return
|
7088 | 7110 | }
|
|
7092 | 7114 | configurable: true,
|
7093 | 7115 | enumerable: true
|
7094 | 7116 | });
|
| 7117 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7095 | 7118 | defineProperty(window.safari, 'pushNotification', {
|
7096 | 7119 | value: {
|
7097 | 7120 | },
|
7098 | 7121 | configurable: true,
|
7099 | 7122 | enumerable: true
|
7100 | 7123 | });
|
| 7124 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7101 | 7125 | defineProperty(window.safari.pushNotification, 'toString', {
|
7102 | 7126 | value: () => { return '[object SafariRemoteNotification]' },
|
7103 | 7127 | configurable: true,
|
|
7109 | 7133 | this.permission = 'denied';
|
7110 | 7134 | }
|
7111 | 7135 | }
|
| 7136 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7112 | 7137 | defineProperty(window.safari.pushNotification, 'permission', {
|
7113 | 7138 | value: (name) => {
|
7114 | 7139 | return new SafariRemoteNotificationPermission()
|
7115 | 7140 | },
|
7116 | 7141 | configurable: true,
|
7117 | 7142 | enumerable: true
|
7118 | 7143 | });
|
| 7144 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7119 | 7145 | defineProperty(window.safari.pushNotification, 'requestPermission', {
|
7120 | 7146 | value: (name, domain, options, callback) => {
|
7121 | 7147 | if (typeof callback === 'function') {
|
|
7172 | 7198 | const isFrameInsideFrame = window.self !== window.top && window.parent !== window.top;
|
7173 | 7199 |
|
7174 | 7200 | function windowsPostMessage (name, data) {
|
| 7201 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7175 | 7202 | window.chrome.webview.postMessage({
|
7176 | 7203 | Feature: 'Permissions',
|
7177 | 7204 | Name: name,
|
|
7184 | 7211 | console.debug(`Permission '${permission}' is ${status}`);
|
7185 | 7212 | }
|
7186 | 7213 |
|
| 7214 | + let pauseWatchedPositions = false; |
7187 | 7215 | const watchedPositions = new Set();
|
7188 | 7216 | // proxy for navigator.geolocation.watchPosition -> show red geolocation indicator
|
7189 | 7217 | const watchPositionProxy = new DDGProxy(featureName, Geolocation.prototype, 'watchPosition', {
|
|
7195 | 7223 |
|
7196 | 7224 | const successHandler = args[0];
|
7197 | 7225 | args[0] = function (position) {
|
7198 |
| - signalPermissionStatus(Permission.Geolocation, Status.Active); |
7199 |
| - successHandler?.(position); |
| 7226 | + if (pauseWatchedPositions) { |
| 7227 | + signalPermissionStatus(Permission.Geolocation, Status.Paused); |
| 7228 | + } else { |
| 7229 | + signalPermissionStatus(Permission.Geolocation, Status.Active); |
| 7230 | + successHandler?.(position); |
| 7231 | + } |
7200 | 7232 | };
|
7201 | 7233 | const id = DDGReflect.apply(target, thisArg, args);
|
7202 | 7234 | watchedPositions.add(id);
|
|
7251 | 7283 | }
|
7252 | 7284 |
|
7253 | 7285 | function pause (permission) {
|
7254 |
| - const streamTracks = getTracks(permission); |
7255 |
| - streamTracks?.forEach(track => { |
7256 |
| - track.enabled = false; |
7257 |
| - }); |
| 7286 | + switch (permission) { |
| 7287 | + case Permission.Camera: |
| 7288 | + case Permission.Microphone: { |
| 7289 | + const streamTracks = getTracks(permission); |
| 7290 | + streamTracks?.forEach(track => { |
| 7291 | + track.enabled = false; |
| 7292 | + }); |
| 7293 | + break |
| 7294 | + } |
| 7295 | + case Permission.Geolocation: |
| 7296 | + pauseWatchedPositions = true; |
| 7297 | + signalPermissionStatus(Permission.Geolocation, Status.Paused); |
| 7298 | + break |
| 7299 | + } |
7258 | 7300 | }
|
7259 | 7301 |
|
7260 | 7302 | function resume (permission) {
|
7261 |
| - const streamTracks = getTracks(permission); |
7262 |
| - streamTracks?.forEach(track => { |
7263 |
| - track.enabled = true; |
7264 |
| - }); |
| 7303 | + switch (permission) { |
| 7304 | + case Permission.Camera: |
| 7305 | + case Permission.Microphone: { |
| 7306 | + const streamTracks = getTracks(permission); |
| 7307 | + streamTracks?.forEach(track => { |
| 7308 | + track.enabled = true; |
| 7309 | + }); |
| 7310 | + break |
| 7311 | + } |
| 7312 | + case Permission.Geolocation: |
| 7313 | + pauseWatchedPositions = false; |
| 7314 | + signalPermissionStatus(Permission.Geolocation, Status.Active); |
| 7315 | + break |
| 7316 | + } |
7265 | 7317 | }
|
7266 | 7318 |
|
7267 | 7319 | function stop (permission) {
|
|
7273 | 7325 | stopTracks(audioTracks);
|
7274 | 7326 | break
|
7275 | 7327 | case Permission.Geolocation:
|
| 7328 | + pauseWatchedPositions = false; |
7276 | 7329 | clearAllGeolocationWatch();
|
7277 | 7330 | break
|
7278 | 7331 | }
|
|
7438 | 7491 |
|
7439 | 7492 | const videoRequested = args[0]?.video;
|
7440 | 7493 | const audioRequested = args[0]?.audio;
|
| 7494 | + |
| 7495 | + if (videoRequested && (videoRequested.pan || videoRequested.tilt || videoRequested.zoom)) { |
| 7496 | + // WebView2 doesn't support acquiring pan-tilt-zoom from its API at the moment |
| 7497 | + return Promise.reject(new DOMException('Pan-tilt-zoom is not supported')) |
| 7498 | + } |
| 7499 | + |
7441 | 7500 | return DDGReflect.apply(target, thisArg, args).then(function (stream) {
|
7442 | 7501 | console.debug(`User stream ${stream.id} has been acquired`);
|
7443 | 7502 | userMediaStreams.add(stream);
|
|
7480 | 7539 | }
|
7481 | 7540 |
|
7482 | 7541 | // handle actions from browser
|
| 7542 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7483 | 7543 | window.chrome.webview.addEventListener('message', function ({ data }) {
|
7484 | 7544 | if (data?.action && data?.permission) {
|
7485 | 7545 | performAction(data?.action, data?.permission);
|
|
7488 | 7548 |
|
7489 | 7549 | // these permissions cannot be disabled using WebView2 or DevTools protocol
|
7490 | 7550 | const permissionsToDisable = [
|
| 7551 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7491 | 7552 | { name: 'Bluetooth', prototype: Bluetooth.prototype, method: 'requestDevice' },
|
| 7553 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7492 | 7554 | { name: 'USB', prototype: USB.prototype, method: 'requestDevice' },
|
| 7555 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7493 | 7556 | { name: 'Serial', prototype: Serial.prototype, method: 'requestPort' },
|
7494 |
| - { name: 'HID', prototype: HID.prototype, method: 'requestDevice' } |
| 7557 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
| 7558 | + { name: 'HID', prototype: HID.prototype, method: 'requestDevice' }, |
| 7559 | + { name: 'Protocol handler', prototype: Navigator.prototype, method: 'registerProtocolHandler' } |
7495 | 7560 | ];
|
7496 | 7561 | for (const { name, prototype, method } of permissionsToDisable) {
|
7497 | 7562 | try {
|
|
7522 | 7587 |
|
7523 | 7588 |
|
7524 | 7589 | function init () {
|
| 7590 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7525 | 7591 | const processedConfig = processConfig($CONTENT_SCOPE$, $USER_UNPROTECTED_DOMAINS$, $USER_PREFERENCES$);
|
7526 | 7592 | if (isGloballyDisabled(processedConfig)) {
|
7527 | 7593 | return
|
7528 | 7594 | }
|
7529 |
| - |
| 7595 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7530 | 7596 | contentScopeFeatures.load({
|
7531 | 7597 | platform: processedConfig.platform
|
7532 | 7598 | });
|
7533 |
| - |
| 7599 | + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f |
7534 | 7600 | contentScopeFeatures.init(processedConfig);
|
7535 | 7601 |
|
7536 | 7602 | // Not supported:
|
|
0 commit comments