diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 68be03d..cf4f1f6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,14 +13,14 @@ jobs: extension-mv2: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: 'reference-tests' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: 'duckduckgo/duckduckgo-privacy-extension' path: 'extension' - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18 cache: 'npm' @@ -39,14 +39,14 @@ jobs: ddg2dnr: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: 'reference-tests' - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: repository: 'duckduckgo/duckduckgo-privacy-extension' path: 'extension' - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 18 cache: 'npm' @@ -64,18 +64,18 @@ jobs: BrowserServicesKit: name: BSK unit tests - runs-on: macos-13 + runs-on: macos-14-xlarge timeout-minutes: 30 steps: - name: Check out the code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: 'duckduckgo/BrowserServicesKit' path: 'BrowserServicesKit' submodules: recursive - name: Check out the tests - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: 'BrowserServicesKit/Tests/BrowserServicesKitTests/Resources/privacy-reference-tests' @@ -91,7 +91,7 @@ jobs: - name: Cache SPM if: env.cache_key_hash - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ./BrowserServicesKit/build key: ${{ runner.os }}-spm-${{ env.cache_key_hash }} @@ -110,7 +110,7 @@ jobs: run: set -o pipefail && swift test | tee build-log.txt | xcbeautify --report junit --report-path . --junit-report-filename tests.xml - name: Publish Unit Tests Report - uses: mikepenz/action-junit-report@v3 + uses: mikepenz/action-junit-report@v4 if: always() with: check_name: BSK Test Report @@ -118,7 +118,7 @@ jobs: require_tests: true - name: Upload logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: build-log.txt diff --git a/fingerprinting-protections/README.md b/fingerprinting-protections/README.md index 11a3eb5..961b80b 100644 --- a/fingerprinting-protections/README.md +++ b/fingerprinting-protections/README.md @@ -24,6 +24,9 @@ Test suite specific fields: ## Pseudo-code implementation ``` +$page.injectOnLoad('init.js') +$page.injectOnLoad('C-S-S') + for $testSet in test.json loadReferenceConfig('config_reference.json') @@ -35,8 +38,6 @@ for $testSet in test.json siteURL = $test.siteURL, ) - $page.load('init.js') - $value = $page.eval($test.property) if ($value instanceof Promise) diff --git a/fingerprinting-protections/init.js b/fingerprinting-protections/init.js index 9e0f422..0367325 100644 --- a/fingerprinting-protections/init.js +++ b/fingerprinting-protections/init.js @@ -20,10 +20,12 @@ function init(window) { Object.defineProperty(window.Screen.prototype, 'colorDepth', { get: () => 12345, configurable: true }); Object.defineProperty(window.Screen.prototype, 'pixelDepth', { get: () => 12345, configurable: true }); - window.navigator.webkitTemporaryStorage = { - queryUsageAndQuota: callback => { - callback(0, 9999999999) - } + if (!window.navigator.webkitTemporaryStorage) { + window.navigator.webkitTemporaryStorage = {}; + } + + window.navigator.webkitTemporaryStorage.queryUsageAndQuota = function queryUsageAndQuota(callback, _) { + callback(0, 9999999999); }; window.DeviceOrientationEvent = window.Event; // we only need the constructor in tests