Skip to content

Commit

Permalink
chore:bundle android-for-frames separately
Browse files Browse the repository at this point in the history
  • Loading branch information
dbajpeyi committed Sep 19, 2024
1 parent 4204c31 commit f87a061
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"build-chrome": "node scripts/inject.js --platform chrome",
"build-chrome-mv3": "node scripts/inject.js --platform chrome-mv3",
"build-apple": "node scripts/inject.js --platform apple && node scripts/inject.js --platform apple-isolated",
"build-android-for-frames": "node scripts/inject.js --platform android-for-frames --for-frames",
"build-android": "node scripts/inject.js --platform android",
"build-windows": "node scripts/inject.js --platform windows",
"build-integration": "node scripts/inject.js --platform integration",
Expand Down
4 changes: 4 additions & 0 deletions scripts/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ const builds = {
input: 'inject/apple.js',
output: ['Sources/ContentScopeScripts/dist/contentScopeIsolated.js']
},
'android-for-frames': {
input: 'inject/android.js',
output: ['Sources/ContentScopeScripts/dist/androidForFrames.js']
},
android: {
input: 'inject/android.js',
output: ['build/android/contentScope.js']
Expand Down
4 changes: 4 additions & 0 deletions src/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const baseFeatures = /** @type {const} */([
'fingerprintingBattery',
'fingerprintingCanvas',
'googleRejected',
'googlePasswordImport',
'gpc',
'fingerprintingHardware',
'referrer',
Expand Down Expand Up @@ -39,6 +40,9 @@ export const platformSupport = {
'performanceMetrics',
'clickToLoad'
],
'android-for-frames': [
'googlePasswordImport',

Check failure on line 44 in src/features.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Unexpected trailing comma
],
android: [
...baseFeatures,
'webCompat',
Expand Down
32 changes: 32 additions & 0 deletions src/features/google-password-import.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import ContentFeature from '../content-feature'
import { getElement } from './broker-protection/utils';

Check failure on line 2 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Extra semicolon

export default class GooglePasswordImport extends ContentFeature {
init () {
document.addEventListener('DOMContentLoaded', (event) => {

Check failure on line 6 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

'event' is defined but never used
var xpath = "//div[text()='Export passwords']/ancestor::li"; // Should be configurable

Check warning on line 7 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Unexpected var, use let or const instead

Check failure on line 7 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Extra semicolon
const exportElement = getElement(document, xpath);

Check failure on line 8 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Extra semicolon
if (exportElement) {
exportElement.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center'
}); // Scroll into view

Check failure on line 14 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Extra semicolon
var keyframes = [

Check warning on line 15 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Unexpected var, use let or const instead
{ backgroundColor: 'transparent' },
{ backgroundColor: 'lightblue' },
{ backgroundColor: 'transparent' },

Check failure on line 18 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Unexpected trailing comma
];

Check failure on line 19 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Extra semicolon

Check failure on line 20 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Trailing spaces not allowed
// Define the animation options
var options = {

Check warning on line 22 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Unexpected var, use let or const instead
duration: 1000, // 1 seconds, should be configurable
iterations: 3 // Max 3 blinks, should be configurable
};

Check failure on line 25 in src/features/google-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-20.04)

Extra semicolon

// Apply the animation to the element
exportElement.animate(keyframes, options);
}
});
}
}
2 changes: 1 addition & 1 deletion src/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface ImportMeta {
env: 'production' | 'development'
platform?: 'windows' | 'macos' | 'android' | 'ios'
// this represents the different build artifact names
injectName?: 'firefox' | 'apple' | 'apple-isolated' | 'android' | 'windows' | 'integration' | 'chrome-mv3' | 'chrome'
injectName?: 'firefox' | 'apple' | 'apple-isolated' | 'android' | 'android-for-frames' | 'windows' | 'integration' | 'chrome-mv3' | 'chrome'
trackerLookup?: Record<string, unknown>
pageName?: string
}
Expand Down

0 comments on commit f87a061

Please sign in to comment.