From d5a85076defaff6afcec76b54ab49ee1a11cb9c0 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Fri, 6 Jun 2025 11:24:29 +0100 Subject: [PATCH 01/10] Add enum devices debugging --- injected/src/features/windows-permission-usage.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/injected/src/features/windows-permission-usage.js b/injected/src/features/windows-permission-usage.js index f0eedebe65..5dabe85181 100644 --- a/injected/src/features/windows-permission-usage.js +++ b/injected/src/features/windows-permission-usage.js @@ -350,6 +350,16 @@ export default class WindowsPermissionUsage extends ContentFeature { }, }); getUserMediaProxy.overload(); + + const enumerateDevicesProxy = new DDGProxy(this, MediaDevices.prototype, 'enumerateDevices', { + apply(target, thisArg, args) { + console.debug('Enumerating media devices'); + const devices = DDGReflect.apply(target, thisArg, args); + console.debug(`Found ${devices.length} media devices`, devices); + return devices; + }, + }); + enumerateDevicesProxy.overload(); } function performAction(action, permission) { From f06c3b73b73e177115e053d8c0b1be670e953620 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Fri, 6 Jun 2025 15:35:10 +0100 Subject: [PATCH 02/10] Disable device enumeration remotely --- .../src/features/windows-permission-usage.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/injected/src/features/windows-permission-usage.js b/injected/src/features/windows-permission-usage.js index 5dabe85181..2c703eb01e 100644 --- a/injected/src/features/windows-permission-usage.js +++ b/injected/src/features/windows-permission-usage.js @@ -350,16 +350,15 @@ export default class WindowsPermissionUsage extends ContentFeature { }, }); getUserMediaProxy.overload(); - - const enumerateDevicesProxy = new DDGProxy(this, MediaDevices.prototype, 'enumerateDevices', { - apply(target, thisArg, args) { - console.debug('Enumerating media devices'); - const devices = DDGReflect.apply(target, thisArg, args); - console.debug(`Found ${devices.length} media devices`, devices); - return devices; - }, - }); - enumerateDevicesProxy.overload(); + const disableDeviceEnumeration = this.getFeatureSettingEnabled('disableDeviceEnumeration'); + if (disableDeviceEnumeration) { + const enumerateDevicesProxy = new DDGProxy(this, MediaDevices.prototype, 'enumerateDevices', { + apply(target, thisArg, args) { + return Promise.resolve([]); + }, + }); + enumerateDevicesProxy.overload(); + } } function performAction(action, permission) { From 86d0dc62f0888dd9099aee47e0652b700f2368f3 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Fri, 6 Jun 2025 15:41:01 +0100 Subject: [PATCH 03/10] Fix lint --- injected/src/features/windows-permission-usage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/injected/src/features/windows-permission-usage.js b/injected/src/features/windows-permission-usage.js index 2c703eb01e..11ca82da44 100644 --- a/injected/src/features/windows-permission-usage.js +++ b/injected/src/features/windows-permission-usage.js @@ -353,7 +353,7 @@ export default class WindowsPermissionUsage extends ContentFeature { const disableDeviceEnumeration = this.getFeatureSettingEnabled('disableDeviceEnumeration'); if (disableDeviceEnumeration) { const enumerateDevicesProxy = new DDGProxy(this, MediaDevices.prototype, 'enumerateDevices', { - apply(target, thisArg, args) { + apply() { return Promise.resolve([]); }, }); From 015b68ec7d47078d993d71528f6a0bc86703f24f Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Fri, 6 Jun 2025 16:16:13 +0100 Subject: [PATCH 04/10] Add frame flexibility --- injected/src/features/windows-permission-usage.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/injected/src/features/windows-permission-usage.js b/injected/src/features/windows-permission-usage.js index 11ca82da44..c7a2568001 100644 --- a/injected/src/features/windows-permission-usage.js +++ b/injected/src/features/windows-permission-usage.js @@ -350,7 +350,13 @@ export default class WindowsPermissionUsage extends ContentFeature { }, }); getUserMediaProxy.overload(); - const disableDeviceEnumeration = this.getFeatureSettingEnabled('disableDeviceEnumeration'); + let disableDeviceEnumeration = false; + const isFrame = window.self !== window.top; + if (isFrame) { + disableDeviceEnumeration = this.getFeatureSettingEnabled('disableDeviceEnumerationFrames'); + } else { + disableDeviceEnumeration = this.getFeatureSettingEnabled('disableDeviceEnumeration'); + } if (disableDeviceEnumeration) { const enumerateDevicesProxy = new DDGProxy(this, MediaDevices.prototype, 'enumerateDevices', { apply() { From 6caeb3b0ecb25f74fb6a31de47fa8f60d6d426a0 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Fri, 6 Jun 2025 16:41:25 +0100 Subject: [PATCH 05/10] Move to webCompat --- injected/src/features.js | 2 +- injected/src/features/windows-permission-usage.js | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/injected/src/features.js b/injected/src/features.js index f156d62f27..76ad8fc383 100644 --- a/injected/src/features.js +++ b/injected/src/features.js @@ -59,6 +59,6 @@ export const platformSupport = { ], firefox: ['cookie', ...baseFeatures, 'clickToLoad'], chrome: ['cookie', ...baseFeatures, 'clickToLoad'], - 'chrome-mv3': ['cookie', ...baseFeatures, 'clickToLoad'], + 'chrome-mv3': ['cookie', ...baseFeatures, 'clickToLoad', 'webCompat'], integration: [...baseFeatures, ...otherFeatures], }; diff --git a/injected/src/features/windows-permission-usage.js b/injected/src/features/windows-permission-usage.js index c7a2568001..f0eedebe65 100644 --- a/injected/src/features/windows-permission-usage.js +++ b/injected/src/features/windows-permission-usage.js @@ -350,21 +350,6 @@ export default class WindowsPermissionUsage extends ContentFeature { }, }); getUserMediaProxy.overload(); - let disableDeviceEnumeration = false; - const isFrame = window.self !== window.top; - if (isFrame) { - disableDeviceEnumeration = this.getFeatureSettingEnabled('disableDeviceEnumerationFrames'); - } else { - disableDeviceEnumeration = this.getFeatureSettingEnabled('disableDeviceEnumeration'); - } - if (disableDeviceEnumeration) { - const enumerateDevicesProxy = new DDGProxy(this, MediaDevices.prototype, 'enumerateDevices', { - apply() { - return Promise.resolve([]); - }, - }); - enumerateDevicesProxy.overload(); - } } function performAction(action, permission) { From 47c7bbadcd4848671459eea9d91b730ca39a913b Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Fri, 6 Jun 2025 18:23:08 +0100 Subject: [PATCH 06/10] Conditional frame matching --- injected/src/config-feature.js | 21 +++++++++++++++++++++ injected/src/features/web-compat.js | 23 +++++++---------------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/injected/src/config-feature.js b/injected/src/config-feature.js index 06fd6bee4a..9057173c48 100644 --- a/injected/src/config-feature.js +++ b/injected/src/config-feature.js @@ -119,6 +119,9 @@ export default class ConfigFeature { * @property {object} [experiment] * @property {string} [experiment.experimentName] * @property {string} [experiment.cohort] + * @property {object} [context] + * @property {boolean} [context.frame] - true if the condition applies to frames + * @property {boolean} [context.top] - true if the condition applies to the top frame */ /** @@ -144,6 +147,7 @@ export default class ConfigFeature { /** @type {Record boolean>} */ const conditionChecks = { domain: this._matchDomainConditional, + context: this._matchContextConditional, urlPattern: this._matchUrlPatternConditional, experiment: this._matchExperimentConditional, minSupportedVersion: this._matchMinSupportedVersion, @@ -208,6 +212,23 @@ export default class ConfigFeature { }); } + /** + * Takes a condition block and returns true if the current context matches the context. + * @param {ConditionBlock} conditionBlock + * @returns {boolean} + */ + _matchContextConditional(conditionBlock) { + if (!conditionBlock.context) return false; + const isFrame = window.self !== window.top; + if (conditionBlock.context.frame && isFrame) { + return true; + } + if (conditionBlock.context.top && !isFrame) { + return true; + } + return false; + } + /** * Takes a condtion block and returns true if the current url matches the urlPattern. * @param {ConditionBlock} conditionBlock diff --git a/injected/src/features/web-compat.js b/injected/src/features/web-compat.js index 6741b44b22..8e68a7706c 100644 --- a/injected/src/features/web-compat.js +++ b/injected/src/features/web-compat.js @@ -126,7 +126,7 @@ export class WebCompat extends ContentFeature { if (this.getFeatureSettingEnabled('modifyCookies')) { this.modifyCookies(); } - if (this.getFeatureSettingEnabled('disableDeviceEnumeration') || this.getFeatureSettingEnabled('disableDeviceEnumerationFrames')) { + if (this.getFeatureSettingEnabled('disableDeviceEnumeration')) { this.preventDeviceEnumeration(); } } @@ -761,21 +761,12 @@ export class WebCompat extends ContentFeature { if (!window.MediaDevices) { return; } - let disableDeviceEnumeration = false; - const isFrame = window.self !== window.top; - if (isFrame) { - disableDeviceEnumeration = this.getFeatureSettingEnabled('disableDeviceEnumerationFrames'); - } else { - disableDeviceEnumeration = this.getFeatureSettingEnabled('disableDeviceEnumeration'); - } - if (disableDeviceEnumeration) { - const enumerateDevicesProxy = new DDGProxy(this, MediaDevices.prototype, 'enumerateDevices', { - apply() { - return Promise.resolve([]); - }, - }); - enumerateDevicesProxy.overload(); - } + const enumerateDevicesProxy = new DDGProxy(this, MediaDevices.prototype, 'enumerateDevices', { + apply() { + return Promise.resolve([]); + }, + }); + enumerateDevicesProxy.overload(); } } From 52bdf69519f001db88312289ffee847b856d7d5b Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Sat, 7 Jun 2025 01:20:58 +0100 Subject: [PATCH 07/10] Test case --- .../infra/config/conditional-matching.json | 35 ++++++++++++++++ .../infra/pages/conditional-matching.html | 40 +++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/injected/integration-test/test-pages/infra/config/conditional-matching.json b/injected/integration-test/test-pages/infra/config/conditional-matching.json index 00a588de61..a92b1cf9cd 100644 --- a/injected/integration-test/test-pages/infra/config/conditional-matching.json +++ b/injected/integration-test/test-pages/infra/config/conditional-matching.json @@ -13,6 +13,13 @@ "type": "number", "value": 222 } + }, + "Navigator.prototype.deviceMemory": { + "type": "descriptor", + "getterValue": { + "type": "number", + "value": 1111 + } } }, "conditionalChanges": [ @@ -27,6 +34,34 @@ "value": 333 } ] + }, + { + "condition": { + "context": { + "top": true + } + }, + "patchSettings": [ + { + "op": "replace", + "path": "/apiChanges/Navigator.prototype.deviceMemory/getterValue/value", + "value": 43339 + } + ] + }, + { + "condition": { + "context": { + "frame": true + } + }, + "patchSettings": [ + { + "op": "replace", + "path": "/apiChanges/Navigator.prototype.deviceMemory/getterValue/value", + "value": 43338 + } + ] } ] } diff --git a/injected/integration-test/test-pages/infra/pages/conditional-matching.html b/injected/integration-test/test-pages/infra/pages/conditional-matching.html index 7b11d615c3..9980d205cc 100644 --- a/injected/integration-test/test-pages/infra/pages/conditional-matching.html +++ b/injected/integration-test/test-pages/infra/pages/conditional-matching.html @@ -56,6 +56,46 @@ return results; }); + test('Conditional frame matching', async () => { + const results = []; + const frame = document.createElement('iframe'); + const scriptTag = 'script'; + frame.srcdoc = ` + + + + <${scriptTag}> + window.addEventListener('message', (event) => { + if (event.data === 'getDeviceMemory') { + event.source.postMessage(navigator.deviceMemory, event.origin); + } + }); + + + + `; + document.body.appendChild(frame); + await new Promise(resolve => frame.onload = resolve); + const deviceMemoryPromise = new Promise(resolve => { + window.addEventListener('message', (event) => { + resolve(event.data); + }, { once: true }); + frame.contentWindow.postMessage('getDeviceMemory', '*'); + }); + const deviceMemory = await deviceMemoryPromise; + results.push({ + name: "Ensure iframe changes work", + result: deviceMemory, + expected: 43338 + }); + results.push({ + name: "Expect frame top modification works", + result: navigator.deviceMemory, + expected: 43339 + }); + return results; + }); + // eslint-disable-next-line no-undef renderResults(); From adc51cd929b06a35ecf73d34889d6d4d1a6cc620 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Thu, 19 Jun 2025 11:49:57 +0100 Subject: [PATCH 08/10] Frame test changes, still not working --- injected/entry-points/integration.js | 2 ++ .../infra/pages/conditional-matching.html | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/injected/entry-points/integration.js b/injected/entry-points/integration.js index c7aaf755dd..e89ed48d79 100644 --- a/injected/entry-points/integration.js +++ b/injected/entry-points/integration.js @@ -128,6 +128,8 @@ async function initCode() { async (evt) => { // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f const merged = mergeDeep(processedConfig, evt.detail); + // @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f + window.__testContentScopeArgs = merged; // init features await init(merged); diff --git a/injected/integration-test/test-pages/infra/pages/conditional-matching.html b/injected/integration-test/test-pages/infra/pages/conditional-matching.html index 9980d205cc..6fcf0b8ed7 100644 --- a/injected/integration-test/test-pages/infra/pages/conditional-matching.html +++ b/injected/integration-test/test-pages/infra/pages/conditional-matching.html @@ -70,12 +70,38 @@ event.source.postMessage(navigator.deviceMemory, event.origin); } }); + // In automation, listen for init args and signal complete + document.addEventListener('content-scope-init-args', function (evt) { + // Simulate content-scope init logic, then signal complete + window.parent.postMessage('content-scope-init-complete', '*'); + }); `; document.body.appendChild(frame); await new Promise(resolve => frame.onload = resolve); + + // Send content-scope-init-args to the iframe (use parent's args if available) + const args = window.__testContentScopeArgs || null; + // Ensure args isn't blank here + if (!args) { + throw new Error('args is blank'); + } + frame.contentWindow.document.dispatchEvent( + new CustomEvent('content-scope-init-args', { detail: args }) + ); + + // Wait for the iframe to signal it's ready + await new Promise(resolve => { + window.addEventListener('message', function handler(event) { + if (event.data === 'content-scope-init-complete') { + window.removeEventListener('message', handler); + resolve(); + } + }); + }); + const deviceMemoryPromise = new Promise(resolve => { window.addEventListener('message', (event) => { resolve(event.data); From c1b56d5f9c6d2ed9b3eef0fd02374c318d9a4185 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Fri, 27 Jun 2025 18:36:00 +0100 Subject: [PATCH 09/10] Fix up frame testing --- injected/entry-points/integration.js | 25 ++----- .../infra/pages/conditional-matching.html | 67 +++++++++++++++---- 2 files changed, 61 insertions(+), 31 deletions(-) diff --git a/injected/entry-points/integration.js b/injected/entry-points/integration.js index e89ed48d79..90cbb3c618 100644 --- a/injected/entry-points/integration.js +++ b/injected/entry-points/integration.js @@ -1,21 +1,9 @@ import { load, init } from '../src/content-scope-features.js'; import { TestTransportConfig } from '../../messaging/index.js'; -function getTopLevelURL() { - try { - // FROM: https://stackoverflow.com/a/7739035/73479 - // FIX: Better capturing of top level URL so that trackers in embedded documents are not considered first party - if (window.location !== window.parent.location) { - return new URL(window.location.href !== 'about:blank' ? document.referrer : window.parent.location.href); - } else { - return new URL(window.location.href); - } - } catch (error) { - return new URL(location.href); - } -} +import { getTabUrl } from '../src/utils.js'; function generateConfig() { - const topLevelUrl = getTopLevelURL(); + const topLevelUrl = getTabUrl(); return { debug: false, sessionKey: 'randomVal', @@ -35,8 +23,8 @@ function generateConfig() { }, ], site: { - domain: topLevelUrl.hostname, - url: topLevelUrl.href, + domain: topLevelUrl?.hostname || '', + url: topLevelUrl?.href || '', isBroken: false, allowlisted: false, enabledFeatures: [ @@ -86,7 +74,7 @@ function mergeDeep(target, ...sources) { } async function initCode() { - const topLevelUrl = getTopLevelURL(); + const topLevelUrl = getTabUrl(); const processedConfig = generateConfig(); // mock Messaging and allow for tests to intercept them @@ -116,7 +104,7 @@ async function initCode() { // mark this phase as loaded setStatus('loaded'); - if (!topLevelUrl.searchParams.has('wait-for-init-args')) { + if (!topLevelUrl?.searchParams.has('wait-for-init-args')) { await init(processedConfig); setStatus('initialized'); return; @@ -135,6 +123,7 @@ async function initCode() { // set status to initialized so that tests can resume setStatus('initialized'); + document.dispatchEvent(new CustomEvent('content-scope-init-completed')); }, { once: true }, ); diff --git a/injected/integration-test/test-pages/infra/pages/conditional-matching.html b/injected/integration-test/test-pages/infra/pages/conditional-matching.html index 6fcf0b8ed7..39e84eaae5 100644 --- a/injected/integration-test/test-pages/infra/pages/conditional-matching.html +++ b/injected/integration-test/test-pages/infra/pages/conditional-matching.html @@ -21,11 +21,13 @@ expected: 222 } ]; + const oldPathname = window.location.pathname; const newUrl = new URL(window.location.href); newUrl.pathname = "/test/test/path"; window.history.pushState(null, '', newUrl.href); await new Promise(resolve => requestIdleCallback(resolve)); + results.push({ name: "Expect URL to be changed", result: window.location.pathname, @@ -36,12 +38,14 @@ result: navigator.hardwareConcurrency, expected: 333 }) + const popStatePromise = new Promise(resolve => { window.addEventListener('popstate', resolve, { once: true }); }); // Call pop state to revert the URL window.history.back(); await popStatePromise; + results.push({ name: "Expect URL to be reverted", result: window.location.pathname, @@ -60,20 +64,52 @@ const results = []; const frame = document.createElement('iframe'); const scriptTag = 'script'; + + // Set up listener for iframe-ready-for-init before the iframe loads + const iframeReadyPromise = new Promise(resolve => { + const handler = (event) => { + if (event.data && event.data.type === 'iframe-ready-for-init') { + window.removeEventListener('message', handler); + resolve(); + } + }; + window.addEventListener('message', handler); + }); + frame.srcdoc = ` + <${scriptTag}> + // Wait for parent to signal when to load content scope script + window.addEventListener('message', function handler(event) { + if (event.data && event.data.type === 'load-content-scope') { + window.removeEventListener('message', handler); + + // Now load the content scope script + const script = document.createElement('script'); + script.src = '/build/contentScope.js'; + script.onload = () => { + // Immediately dispatch the init args + document.dispatchEvent(new CustomEvent('content-scope-init-args', { detail: event.data.args })); + }; + document.head.appendChild(script); + } + }); + + // Notify parent we're ready to receive load signal + window.parent.postMessage({ type: 'iframe-ready-for-init' }, '*'); + window.addEventListener('message', (event) => { if (event.data === 'getDeviceMemory') { - event.source.postMessage(navigator.deviceMemory, event.origin); + event.source.postMessage({ type: 'deviceMemory', value: navigator.deviceMemory }, event.origin); } }); - // In automation, listen for init args and signal complete + // Listen for content-scope-init-args event and signal completion document.addEventListener('content-scope-init-args', function (evt) { - // Simulate content-scope init logic, then signal complete - window.parent.postMessage('content-scope-init-complete', '*'); + // Signal complete + window.parent.postMessage('content-scope-init-completed', '*'); }); @@ -81,21 +117,22 @@ `; document.body.appendChild(frame); await new Promise(resolve => frame.onload = resolve); - + // Wait for the iframe to signal it's ready for init + await iframeReadyPromise; + // Send content-scope-init-args to the iframe (use parent's args if available) const args = window.__testContentScopeArgs || null; - // Ensure args isn't blank here if (!args) { throw new Error('args is blank'); } - frame.contentWindow.document.dispatchEvent( - new CustomEvent('content-scope-init-args', { detail: args }) - ); - - // Wait for the iframe to signal it's ready + + // Filter out non-serializable properties for postMessage + const serializableArgs = JSON.parse(JSON.stringify(args)); + frame.contentWindow.postMessage({ type: 'load-content-scope', args: serializableArgs }, '*'); + // Wait for the content-scope script to be initialized in the iframe await new Promise(resolve => { window.addEventListener('message', function handler(event) { - if (event.data === 'content-scope-init-complete') { + if (event.data === 'content-scope-init-completed') { window.removeEventListener('message', handler); resolve(); } @@ -104,11 +141,15 @@ const deviceMemoryPromise = new Promise(resolve => { window.addEventListener('message', (event) => { - resolve(event.data); + // Only resolve for deviceMemory responses + if (event.data && event.data.type === 'deviceMemory') { + resolve(event.data.value); + } }, { once: true }); frame.contentWindow.postMessage('getDeviceMemory', '*'); }); const deviceMemory = await deviceMemoryPromise; + results.push({ name: "Ensure iframe changes work", result: deviceMemory, From b0d01f474cda2eb1bcbd31dc7e45eeb2733fcb81 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Fri, 27 Jun 2025 18:50:28 +0100 Subject: [PATCH 10/10] Simplify test checks --- .prettierignore | 1 + injected/README.md | 24 ++ .../infra/config/conditional-matching.json | 21 +- .../infra/pages/conditional-matching.html | 287 ++++++++++-------- 4 files changed, 200 insertions(+), 133 deletions(-) diff --git a/.prettierignore b/.prettierignore index 161611c702..7aa3708cf6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,5 +7,6 @@ injected/src/features/Scriptlets **/*.json **/*.md **/*.html +!injected/integration-test/test-pages/infra/pages/conditional-matching.html **/*.har **/*.css diff --git a/injected/README.md b/injected/README.md index f9d3cd5486..1d584d4b0d 100644 --- a/injected/README.md +++ b/injected/README.md @@ -188,6 +188,30 @@ Everything within `integration-test` is integration tests controlled by Playwrig npm run test-int ``` +**Running specific tests:** + +To run a specific test or test suite, you can use the `--grep` flag to filter tests by name: + +```shell +# Run tests containing "Test infra" in their name +npx playwright test pages.spec.js --grep "Test infra" + +# Run tests containing "Conditional frame matching" in their name +npx playwright test pages.spec.js --grep "Conditional frame matching" + +# Run tests in headed mode (shows browser window) +npx playwright test pages.spec.js --grep "Test infra" --headed +``` + +**Debugging tests:** + +For debugging, you can run tests in headed mode and add debugging output: + +```shell +# Run with browser visible and debugging enabled +npx playwright test pages.spec.js --grep "Test infra" --headed --debug +``` + #### Feature Build process To produce all artefacts that are used by platforms, just run the `npm run build` command. diff --git a/injected/integration-test/test-pages/infra/config/conditional-matching.json b/injected/integration-test/test-pages/infra/config/conditional-matching.json index a92b1cf9cd..8827b2b573 100644 --- a/injected/integration-test/test-pages/infra/config/conditional-matching.json +++ b/injected/integration-test/test-pages/infra/config/conditional-matching.json @@ -14,12 +14,21 @@ "value": 222 } }, - "Navigator.prototype.deviceMemory": { + "testApi1": { "type": "descriptor", "getterValue": { "type": "number", - "value": 1111 - } + "value": 100 + }, + "define": true + }, + "testApi2": { + "type": "descriptor", + "getterValue": { + "type": "number", + "value": 200 + }, + "define": true } }, "conditionalChanges": [ @@ -44,7 +53,7 @@ "patchSettings": [ { "op": "replace", - "path": "/apiChanges/Navigator.prototype.deviceMemory/getterValue/value", + "path": "/apiChanges/testApi1/getterValue/value", "value": 43339 } ] @@ -58,7 +67,7 @@ "patchSettings": [ { "op": "replace", - "path": "/apiChanges/Navigator.prototype.deviceMemory/getterValue/value", + "path": "/apiChanges/testApi1/getterValue/value", "value": 43338 } ] @@ -68,5 +77,5 @@ } }, "unprotectedTemporary": [] - } +} \ No newline at end of file diff --git a/injected/integration-test/test-pages/infra/pages/conditional-matching.html b/injected/integration-test/test-pages/infra/pages/conditional-matching.html index 39e84eaae5..b4b6182942 100644 --- a/injected/integration-test/test-pages/infra/pages/conditional-matching.html +++ b/injected/integration-test/test-pages/infra/pages/conditional-matching.html @@ -1,82 +1,82 @@ - + - - - - Conditional Matching - - - - -

[Infra]

- -

This page verifies that APIs get modified

- - +

[Infra]

+ +

This page verifies that APIs get modified

+ + - + // eslint-disable-next-line no-undef + renderResults(); + +