Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Update FxR codebase to use inclusive language. Fixes #3492 #3493

Merged
merged 1 commit into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public void run() {
private boolean mConnectionAvailable = true;
private AudioManager mAudioManager;
private Widget mActiveDialog;
private Set<String> mPoorPerformanceWhiteList;
private Set<String> mPoorPerformanceAllowList;
private float mCurrentCylinderDensity = 0;
private boolean mHideWebXRIntersitial = false;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -1209,7 +1209,7 @@ private void handlePoorPerformance() {
buttons,
(index, isChecked) -> {
if (index == PromptDialogWidget.NEGATIVE) {
mPoorPerformanceWhiteList.add(originalUri);
mPoorPerformanceAllowList.add(originalUri);
window.getSession().loadUri(originalUri);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class AudioEngine {
private Context mContext;
private AudioEngineImpl mEngine;
private ConcurrentHashMap<Sound, Integer> mSourceIds;
private float mMasterVolume = 1.0f;
private float mMainVolume = 1.0f;
private static ConcurrentHashMap<Context, AudioEngine> mEngines = new ConcurrentHashMap<>();
private boolean mEnabled;
private static final String LOGTAG = SystemUtils.createLogtag(AudioEngine.class);
Expand Down Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> SAVE_BLACKLIST = Stream.of(
// Restore URLs blocklist
private static final List<String> SAVE_BLOCKLIST = Stream.of(
"https://accounts.firefox.com/oauth/"
).collect(Collectors.toList());

Expand Down Expand Up @@ -208,7 +208,7 @@ public void saveState() {
ArrayList<Session> 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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> rules = Stream.of(res.getStringArray(R.array.servo_white_list));
mRules = rules.map(Pattern::compile).toArray(Pattern[]::new);
Expand All @@ -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());
}
}
}