Commits:
-
9d554099
by Pier Angelo Vendrame at 2024-09-11T22:29:36+02:00
fixup! Bug 42247: Android helpers for the TorProvider
Bug 42628: Remove browser.tor_android.use_new_bootstrap.
-
37d0aa1a
by Pier Angelo Vendrame at 2024-09-11T22:29:36+02:00
fixup! [android] Enable the connect assist experiments on alpha
Bug 42628: Remove browser.tor_android.use_new_bootstrap.
-
40f8455d
by Pier Angelo Vendrame at 2024-09-11T22:29:37+02:00
fixup! Bug 42027: Base Browser migration procedures.
Bug 43124: Implement a migration procedure for Android.
5 changed files:
Changes:
mobile/android/android-components/components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt
... |
... |
@@ -1347,11 +1347,6 @@ class GeckoEngine( |
1347
|
1347
|
localeUpdater.updateValue()
|
1348
|
1348
|
}
|
1349
|
1349
|
}
|
1350
|
|
- override var useNewBootstrap: Boolean
|
1351
|
|
- get() = runtime.settings.useNewBootstrap
|
1352
|
|
- set(value) {
|
1353
|
|
- runtime.settings.useNewBootstrap = value
|
1354
|
|
- }
|
1355
|
1350
|
}.apply {
|
1356
|
1351
|
defaultSettings?.let {
|
1357
|
1352
|
this._javascript_Enabled = it._javascript_Enabled
|
... |
... |
@@ -1380,7 +1375,6 @@ class GeckoEngine( |
1380
|
1375
|
this.emailTrackerBlockingPrivateBrowsing = it.emailTrackerBlockingPrivateBrowsing
|
1381
|
1376
|
this.torSecurityLevel = it.torSecurityLevel
|
1382
|
1377
|
this.spoofEnglish = it.spoofEnglish
|
1383
|
|
- this.useNewBootstrap = it.useNewBootstrap
|
1384
|
1378
|
}
|
1385
|
1379
|
}
|
1386
|
1380
|
|
mobile/android/android-components/components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt
... |
... |
@@ -259,7 +259,6 @@ abstract class Settings { |
259
|
259
|
|
260
|
260
|
open var spoofEnglish: Boolean by UnsupportedSetting()
|
261
|
261
|
|
262
|
|
- open var useNewBootstrap: Boolean by UnsupportedSetting()
|
263
|
262
|
}
|
264
|
263
|
|
265
|
264
|
/**
|
... |
... |
@@ -312,7 +311,6 @@ data class DefaultSettings( |
312
|
311
|
override var emailTrackerBlockingPrivateBrowsing: Boolean = false,
|
313
|
312
|
override var torSecurityLevel: Int = 4,
|
314
|
313
|
override var spoofEnglish: Boolean = false,
|
315
|
|
- override var useNewBootstrap: Boolean = true,
|
316
|
314
|
) : Settings()
|
317
|
315
|
|
318
|
316
|
class UnsupportedSetting<T> {
|
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java
... |
... |
@@ -598,11 +598,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { |
598
|
598
|
getSettings().mSecurityLevel.set(level);
|
599
|
599
|
return this;
|
600
|
600
|
}
|
601
|
|
-
|
602
|
|
- public @NonNull Builder useNewBootstrap(final boolean flag) {
|
603
|
|
- getSettings().mUseNewBootstrap.set(flag);
|
604
|
|
- return this;
|
605
|
|
- }
|
606
|
601
|
}
|
607
|
602
|
|
608
|
603
|
private GeckoRuntime mRuntime;
|
... |
... |
@@ -675,8 +670,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { |
675
|
670
|
/* package */ final Pref<Integer> mSpoofEnglish = new Pref<>("privacy.spoof_english", 0);
|
676
|
671
|
/* package */ final Pref<Integer> mSecurityLevel =
|
677
|
672
|
new Pref<>("browser.security_level.security_slider", 4);
|
678
|
|
- /* package */ final Pref<Boolean> mUseNewBootstrap =
|
679
|
|
- new Pref<>("browser.tor_android.use_new_bootstrap", false);
|
680
|
673
|
|
681
|
674
|
/* package */ int mPreferredColorScheme = COLOR_SCHEME_SYSTEM;
|
682
|
675
|
|
... |
... |
@@ -1725,15 +1718,6 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { |
1725
|
1718
|
return this;
|
1726
|
1719
|
}
|
1727
|
1720
|
|
1728
|
|
- public boolean getUseNewBootstrap() {
|
1729
|
|
- return mUseNewBootstrap.get();
|
1730
|
|
- }
|
1731
|
|
-
|
1732
|
|
- public @NonNull GeckoRuntimeSettings setUseNewBootstrap(final boolean flag) {
|
1733
|
|
- mUseNewBootstrap.commit(flag);
|
1734
|
|
- return this;
|
1735
|
|
- }
|
1736
|
|
-
|
1737
|
1721
|
@Override // Parcelable
|
1738
|
1722
|
public void writeToParcel(final Parcel out, final int flags) {
|
1739
|
1723
|
super.writeToParcel(out, flags);
|
mobile/shared/components/geckoview/GeckoViewStartup.sys.mjs
... |
... |
@@ -261,6 +261,8 @@ export class GeckoViewStartup { |
261
|
261
|
"GeckoView:InitialForeground",
|
262
|
262
|
]);
|
263
|
263
|
|
|
264
|
+ this.#migratePreferences();
|
|
265
|
+
|
264
|
266
|
lazy.TorAndroidIntegration.init();
|
265
|
267
|
lazy.TorDomainIsolator.init();
|
266
|
268
|
|
... |
... |
@@ -370,6 +372,50 @@ export class GeckoViewStartup { |
370
|
372
|
break;
|
371
|
373
|
}
|
372
|
374
|
}
|
|
375
|
+
|
|
376
|
+ /**
|
|
377
|
+ * This is the equivalent of BrowserGlue._migrateUITBB.
|
|
378
|
+ */
|
|
379
|
+ #migratePreferences() {
|
|
380
|
+ const MIGRATION_VERSION = 1;
|
|
381
|
+ const MIGRATION_PREF = "torbrowser.migration_android.version";
|
|
382
|
+
|
|
383
|
+ // We do not have a way to check for new profiles on Android.
|
|
384
|
+ // However, the first version is harmless for new installs, so run it
|
|
385
|
+ // anyway.
|
|
386
|
+ const currentVersion = Services.prefs.getIntPref(MIGRATION_PREF, 0);
|
|
387
|
+ if (currentVersion < 1) {
|
|
388
|
+ // First implementation of the migration on Android (tor-browser#43124,
|
|
389
|
+ // 14.0a5, September 2024).
|
|
390
|
+ const prefToClear = [
|
|
391
|
+ // Old torbutton preferences not used anymore.
|
|
392
|
+ // Some of them should have never been set on Android, as on Android we
|
|
393
|
+ // force PBM... But who knows about very old profiles.
|
|
394
|
+ "browser.cache.disk.enable",
|
|
395
|
+ "places.history.enabled",
|
|
396
|
+ "security.nocertdb",
|
|
397
|
+ "permissions.memory_only",
|
|
398
|
+ "extensions.torbutton.loglevel",
|
|
399
|
+ "extensions.torbutton.logmethod",
|
|
400
|
+ "extensions.torbutton.pref_fixup_version",
|
|
401
|
+ "extensions.torbutton.resize_new_windows",
|
|
402
|
+ "extensions.torbutton.startup",
|
|
403
|
+ "extensions.torlauncher.prompt_for_locale",
|
|
404
|
+ "extensions.torlauncher.loglevel",
|
|
405
|
+ "extensions.torlauncher.logmethod",
|
|
406
|
+ "extensions.torlauncher.torrc_fixup_version",
|
|
407
|
+ // tor-browser#42149: Do not change HTTPS-Only settings in the security
|
|
408
|
+ // level.
|
|
409
|
+ "dom.security.https_only_mode_send_http_background_request",
|
|
410
|
+ ];
|
|
411
|
+ for (const pref of prefToClear) {
|
|
412
|
+ if (Services.prefs.prefHasUserValue(pref)) {
|
|
413
|
+ Services.prefs.clearUserPref(pref);
|
|
414
|
+ }
|
|
415
|
+ }
|
|
416
|
+ }
|
|
417
|
+ Services.prefs.setIntPref(MIGRATION_PREF, MIGRATION_VERSION);
|
|
418
|
+ }
|
373
|
419
|
}
|
374
|
420
|
|
375
|
421
|
GeckoViewStartup.prototype.classID = Components.ID(
|
toolkit/modules/TorAndroidIntegration.sys.mjs
... |
... |
@@ -14,7 +14,6 @@ ChromeUtils.defineESModuleGetters(lazy, { |
14
|
14
|
});
|
15
|
15
|
|
16
|
16
|
const Prefs = Object.freeze({
|
17
|
|
- useNewBootstrap: "browser.tor_android.use_new_bootstrap",
|
18
|
17
|
logLevel: "browser.tor_android.log_level",
|
19
|
18
|
});
|
20
|
19
|
|
... |
... |
@@ -49,15 +48,18 @@ const ListenedEvents = Object.freeze({ |
49
|
48
|
class TorAndroidIntegrationImpl {
|
50
|
49
|
#initialized = false;
|
51
|
50
|
|
52
|
|
- init() {
|
|
51
|
+ async init() {
|
|
52
|
+ if (this.#initialized) {
|
|
53
|
+ logger.warn("Something tried to initilize us again.");
|
|
54
|
+ return;
|
|
55
|
+ }
|
|
56
|
+ this.#initialized = true;
|
|
57
|
+
|
53
|
58
|
lazy.EventDispatcher.instance.registerListener(
|
54
|
59
|
this,
|
55
|
60
|
Object.values(ListenedEvents)
|
56
|
61
|
);
|
57
|
62
|
|
58
|
|
- this.#bootstrapMethodReset();
|
59
|
|
- Services.prefs.addObserver(Prefs.useNewBootstrap, this);
|
60
|
|
-
|
61
|
63
|
Services.obs.addObserver(this, lazy.TorProviderTopics.TorLog);
|
62
|
64
|
|
63
|
65
|
for (const topic in lazy.TorConnectTopics) {
|
... |
... |
@@ -67,13 +69,6 @@ class TorAndroidIntegrationImpl { |
67
|
69
|
for (const topic in lazy.TorSettingsTopics) {
|
68
|
70
|
Services.obs.addObserver(this, lazy.TorSettingsTopics[topic]);
|
69
|
71
|
}
|
70
|
|
- }
|
71
|
|
-
|
72
|
|
- async #initNewBootstrap() {
|
73
|
|
- if (this.#initialized) {
|
74
|
|
- return;
|
75
|
|
- }
|
76
|
|
- this.#initialized = true;
|
77
|
72
|
|
78
|
73
|
lazy.TorProviderBuilder.init().finally(() => {
|
79
|
74
|
lazy.TorProviderBuilder.firstWindowLoaded();
|
... |
... |
@@ -86,13 +81,8 @@ class TorAndroidIntegrationImpl { |
86
|
81
|
}
|
87
|
82
|
}
|
88
|
83
|
|
89
|
|
- observe(subj, topic, data) {
|
|
84
|
+ observe(subj, topic) {
|
90
|
85
|
switch (topic) {
|
91
|
|
- case "nsPref:changed":
|
92
|
|
- if (data === Prefs.useNewBootstrap) {
|
93
|
|
- this.#bootstrapMethodReset();
|
94
|
|
- }
|
95
|
|
- break;
|
96
|
86
|
case lazy.TorConnectTopics.StateChange:
|
97
|
87
|
lazy.EventDispatcher.instance.sendRequest({
|
98
|
88
|
type: EmittedEvents.connectStateChanged,
|
... |
... |
@@ -187,15 +177,6 @@ class TorAndroidIntegrationImpl { |
187
|
177
|
callback?.onError(e);
|
188
|
178
|
}
|
189
|
179
|
}
|
190
|
|
-
|
191
|
|
- #bootstrapMethodReset() {
|
192
|
|
- if (Services.prefs.getBoolPref(Prefs.useNewBootstrap, false)) {
|
193
|
|
- this.#initNewBootstrap();
|
194
|
|
- } else {
|
195
|
|
- Services.prefs.clearUserPref("network.proxy.socks");
|
196
|
|
- Services.prefs.clearUserPref("network.proxy.socks_port");
|
197
|
|
- }
|
198
|
|
- }
|
199
|
180
|
}
|
200
|
181
|
|
201
|
182
|
export const TorAndroidIntegration = new TorAndroidIntegrationImpl(); |
|