From 5c3e6f6a8c58f40116c9af98aefc3663160dfca6 Mon Sep 17 00:00:00 2001 From: "Randall E. Barker" Date: Fri, 12 Jun 2020 16:07:40 -0700 Subject: [PATCH] Update FxR codebase to use inclusive language. Fixes #3492 (#3493) --- .../org/mozilla/vrbrowser/VRBrowserActivity.java | 8 ++++---- .../org/mozilla/vrbrowser/audio/AudioEngine.java | 8 ++++---- .../vrbrowser/ui/viewmodel/WindowViewModel.java | 4 ++-- .../mozilla/vrbrowser/ui/widgets/Windows.java | 6 +++--- .../org/mozilla/vrbrowser/utils/ServoUtils.java | 16 ++++++++-------- .../{ServoWhiteList.java => ServoAllowList.java} | 6 +++--- 6 files changed, 24 insertions(+), 24 deletions(-) rename servo/src/main/java/org/mozilla/servo/{ServoWhiteList.java => ServoAllowList.java} (88%) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java index f56b767a7..3b04eb0ad 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java @@ -191,7 +191,7 @@ public void run() { private boolean mConnectionAvailable = true; private AudioManager mAudioManager; private Widget mActiveDialog; - private Set mPoorPerformanceWhiteList; + private Set mPoorPerformanceAllowList; private float mCurrentCylinderDensity = 0; private boolean mHideWebXRIntersitial = false; @@ -311,7 +311,7 @@ protected void onCreate(Bundle savedInstanceState) { GeolocationWrapper.INSTANCE.update(this); mConnectivityReceiver = new ConnectivityReceiver(); - mPoorPerformanceWhiteList = new HashSet<>(); + mPoorPerformanceAllowList = new HashSet<>(); checkForCrash(); mLifeCycle.setCurrentState(Lifecycle.State.CREATED); @@ -1199,7 +1199,7 @@ private void handlePoorPerformance() { return; } final String originalUri = window.getSession().getCurrentUri(); - if (mPoorPerformanceWhiteList.contains(originalUri)) { + if (mPoorPerformanceAllowList.contains(originalUri)) { return; } window.getSession().loadHomePage(); @@ -1209,7 +1209,7 @@ private void handlePoorPerformance() { buttons, (index, isChecked) -> { if (index == PromptDialogWidget.NEGATIVE) { - mPoorPerformanceWhiteList.add(originalUri); + mPoorPerformanceAllowList.add(originalUri); window.getSession().loadUri(originalUri); } }); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/audio/AudioEngine.java b/app/src/common/shared/org/mozilla/vrbrowser/audio/AudioEngine.java index 2f437a30c..aaf3afd7f 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/audio/AudioEngine.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/audio/AudioEngine.java @@ -15,7 +15,7 @@ public class AudioEngine { private Context mContext; private AudioEngineImpl mEngine; private ConcurrentHashMap mSourceIds; - private float mMasterVolume = 1.0f; + private float mMainVolume = 1.0f; private static ConcurrentHashMap mEngines = new ConcurrentHashMap<>(); private boolean mEnabled; private static final String LOGTAG = SystemUtils.createLogtag(AudioEngine.class); @@ -123,13 +123,13 @@ public void playSound(Sound aSound) { playSound(aSound, 1.0f,false); } - public void setMasterVolume(float aVolume) { - mMasterVolume = aVolume; + public void setMainVolume(float aVolume) { + mMainVolume = aVolume; } public void playSound(Sound aSound, float aVolume, boolean aLoop) { if (mEnabled && mEngine != null) { - mEngine.playSound(aSound, aVolume * mMasterVolume, aLoop); + mEngine.playSound(aSound, aVolume * mMainVolume, aLoop); } } diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/viewmodel/WindowViewModel.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/viewmodel/WindowViewModel.java index ae2fa92b9..87d3316df 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/viewmodel/WindowViewModel.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/viewmodel/WindowViewModel.java @@ -238,8 +238,8 @@ public void onChanged(ObservableBoolean o) { @Override public void onChanged(Spannable url) { boolean isPrefEnabled = SettingsStore.getInstance(getApplication()).isServoEnabled(); - boolean isUrlWhiteListed = ServoUtils.isUrlInServoWhiteList(getApplication(), url.toString()); - isServoAvailable.postValue(new ObservableBoolean(isPrefEnabled && isUrlWhiteListed)); + boolean isUrlAllowListed = ServoUtils.isUrlInServoAllowList(getApplication(), url.toString()); + isServoAvailable.postValue(new ObservableBoolean(isPrefEnabled && isUrlAllowListed)); } }; diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java index e595ae46a..a12d6f90c 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java @@ -69,8 +69,8 @@ public class Windows implements TrayListener, TopBarWidget.Delegate, TitleBarWid private static final int TAB_SENT_NOTIFICATION_ID = 1; private static final int BOOKMARK_ADDED_NOTIFICATION_ID = 2; - // Restore URLs blacklist - private static final List SAVE_BLACKLIST = Stream.of( + // Restore URLs blocklist + private static final List SAVE_BLOCKLIST = Stream.of( "https://accounts.firefox.com/oauth/" ).collect(Collectors.toList()); @@ -208,7 +208,7 @@ public void saveState() { ArrayList sessions = SessionStore.get().getSortedSessions(false); state.tabs = sessions.stream() .map(Session::getSessionState) - .filter(sessionState -> SAVE_BLACKLIST.stream().noneMatch(uri -> + .filter(sessionState -> SAVE_BLOCKLIST.stream().noneMatch(uri -> sessionState.mUri != null && sessionState.mUri.startsWith(uri) )) .collect(Collectors.toCollection(ArrayList::new)); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/utils/ServoUtils.java b/app/src/common/shared/org/mozilla/vrbrowser/utils/ServoUtils.java index 7449aec61..282aa26c9 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/utils/ServoUtils.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/utils/ServoUtils.java @@ -12,9 +12,9 @@ public class ServoUtils { private static final String SESSION_CLASSNAME = "org.mozilla.servo.ServoSession"; - private static final String WHITELIST_CLASSNAME = "org.mozilla.servo.ServoWhiteList"; + private static final String ALLOWLIST_CLASSNAME = "org.mozilla.servo.ServoAllowList"; private static final String LOGTAG = "ServoUtils"; - private static Object mServoWhiteList = null; + private static Object mServoAllowList = null; private static long mVRContext; public static boolean isServoAvailable() { @@ -50,18 +50,18 @@ public static GeckoSession createServoSession(Context context) { } } - public static boolean isUrlInServoWhiteList(Context context, String url) { + public static boolean isUrlInServoAllowList(Context context, String url) { if (isServoAvailable()) { try { - Class clazz = Class.forName(WHITELIST_CLASSNAME); - if (mServoWhiteList == null) { + Class clazz = Class.forName(ALLOWLIST_CLASSNAME); + if (mServoAllowList == null) { Constructor constructor = clazz.getConstructor(Context.class); - mServoWhiteList = constructor.newInstance(context); + mServoAllowList = constructor.newInstance(context); } Method isAllowed = clazz.getMethod("isAllowed", String.class); - return (boolean) isAllowed.invoke(mServoWhiteList, url); + return (boolean) isAllowed.invoke(mServoAllowList, url); } catch (Exception e) { - Log.e(LOGTAG, "Failed to call ServoWhiteList::isAllowed: " + e); + Log.e(LOGTAG, "Failed to call ServoAllowList::isAllowed: " + e); return false; } } else { diff --git a/servo/src/main/java/org/mozilla/servo/ServoWhiteList.java b/servo/src/main/java/org/mozilla/servo/ServoAllowList.java similarity index 88% rename from servo/src/main/java/org/mozilla/servo/ServoWhiteList.java rename to servo/src/main/java/org/mozilla/servo/ServoAllowList.java index dd0220475..ac1936a0d 100644 --- a/servo/src/main/java/org/mozilla/servo/ServoWhiteList.java +++ b/servo/src/main/java/org/mozilla/servo/ServoAllowList.java @@ -8,10 +8,10 @@ import java.util.regex.Pattern; import java.util.stream.Stream; -public class ServoWhiteList { +public class ServoAllowList { private final Pattern[] mRules; - public ServoWhiteList(Context context) { + public ServoAllowList(Context context) { Resources res = context.getResources(); Stream rules = Stream.of(res.getStringArray(R.array.servo_white_list)); mRules = rules.map(Pattern::compile).toArray(Pattern[]::new); @@ -20,4 +20,4 @@ public ServoWhiteList(Context context) { public boolean isAllowed(String url) { return url != null && Stream.of(mRules).anyMatch(r -> r.matcher(url).matches()); } -} \ No newline at end of file +}