Bug 1426244 - 2. Fix javadoc comments; r=droeh
Add some missing lines and fix some mistakes in our javadoc comments.
MozReview-Commit-ID: 9Q7qWJJ51Vo
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfile.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoProfile.java
@@ -429,17 +429,17 @@ public final class GeckoProfile {
return new File(f, aFile);
}
/**
* Retrieves the Gecko client ID from the filesystem. If the client ID does not exist, we attempt to migrate and
* persist it from FHR and, if that fails, we attempt to create a new one ourselves.
*
* This method assumes the client ID is located in a file at a hard-coded path within the profile. The format of
- * this file is a JSONObject which at the bottom level contains a String -> String mapping containing the client ID.
+ * this file is a JSONObject which at the bottom level contains a String -> String mapping containing the client ID.
*
* WARNING: the platform provides a JSM to retrieve the client ID [1] and this would be a
* robust way to access it. However, we don't want to rely on Gecko running in order to get
* the client ID so instead we access the file this module accesses directly. However, it's
* possible the format of this file (and the access calls in the jsm) will change, leaving
* this code to fail. There are tests in TestGeckoProfile to verify the file format but be
* warned: THIS IS NOT FOOLPROOF.
*
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSession.java
@@ -1158,91 +1158,91 @@ public class GeckoSession extends LayerS
subjectName = identityData.getString("subjectName");
issuerCommonName = identityData.getString("issuerCommonName");
issuerOrganization = identityData.getString("issuerOrganization");
}
}
/**
* A View has started loading content from the network.
- * @param view The GeckoSession that initiated the callback.
+ * @param session GeckoSession that initiated the callback.
* @param url The resource being loaded.
*/
void onPageStart(GeckoSession session, String url);
/**
* A View has finished loading content from the network.
- * @param view The GeckoSession that initiated the callback.
+ * @param session GeckoSession that initiated the callback.
* @param success Whether the page loaded successfully or an error occurred.
*/
void onPageStop(GeckoSession session, boolean success);
/**
* The security status has been updated.
- * @param view The GeckoSession that initiated the callback.
+ * @param session GeckoSession that initiated the callback.
* @param securityInfo The new security information.
*/
void onSecurityChange(GeckoSession session, SecurityInformation securityInfo);
}
public interface ContentListener {
/**
* A page title was discovered in the content or updated after the content
* loaded.
- * @param view The GeckoSession that initiated the callback.
+ * @param session The GeckoSession that initiated the callback.
* @param title The title sent from the content.
*/
void onTitleChange(GeckoSession session, String title);
/**
* A page has entered or exited full screen mode. Typically, the implementation
* would set the Activity containing the GeckoSession to full screen when the page is
* in full screen mode.
*
- * @param view The GeckoSession that initiated the callback.
+ * @param session The GeckoSession that initiated the callback.
* @param fullScreen True if the page is in full screen mode.
*/
void onFullScreen(GeckoSession session, boolean fullScreen);
/**
* A user has initiated the context menu via long-press.
* This event is fired on links, (nested) images and (nested) media
* elements.
*
- * @param view The GeckoSession that initiated the callback.
+ * @param session The GeckoSession that initiated the callback.
* @param screenX The screen coordinates of the press.
* @param screenY The screen coordinates of the press.
* @param uri The URI of the pressed link, set for links and
* image-links.
* @param elementSrc The source URI of the pressed element, set for
* (nested) images and media elements.
*/
void onContextMenu(GeckoSession session, int screenX, int screenY,
String uri, String elementSrc);
}
public interface NavigationListener {
/**
* A view has started loading content from the network.
- * @param view The GeckoSession that initiated the callback.
+ * @param session The GeckoSession that initiated the callback.
* @param url The resource being loaded.
*/
void onLocationChange(GeckoSession session, String url);
/**
* The view's ability to go back has changed.
- * @param view The GeckoSession that initiated the callback.
+ * @param session The GeckoSession that initiated the callback.
* @param canGoBack The new value for the ability.
*/
void onCanGoBack(GeckoSession session, boolean canGoBack);
/**
* The view's ability to go forward has changed.
- * @param view The GeckoSession that initiated the callback.
+ * @param session The GeckoSession that initiated the callback.
* @param canGoForward The new value for the ability.
*/
void onCanGoForward(GeckoSession session, boolean canGoForward);
enum TargetWindow {
DEFAULT(0),
CURRENT(1),
NEW(2);
@@ -1283,17 +1283,17 @@ public class GeckoSession extends LayerS
private LoadUriResult(int value) {
mValue = value;
}
}
/**
* A request to open an URI.
- * @param view The GeckoSession that initiated the callback.
+ * @param session The GeckoSession that initiated the callback.
* @param uri The URI to be loaded.
* @param where The target window.
*
* @return True if the URI loading has been handled, false if Gecko
* should handle the loading.
*/
boolean onLoadUri(GeckoSession session, String uri, TargetWindow where);
}
@@ -1317,66 +1317,74 @@ public class GeckoSession extends LayerS
void dismiss();
/**
* Return whether the prompt shown should include a checkbox. For example, if
* a page shows multiple prompts within a short period of time, the next
* prompt will include a checkbox to let the user disable future prompts.
* Although the API allows checkboxes for all prompts, in practice, only
* alert/button/text/auth prompts will possibly have a checkbox.
+ *
+ * @return True if prompt includes a checkbox.
*/
boolean hasCheckbox();
/**
* Return the message label for the optional checkbox.
+ *
+ * @return Checkbox message or null if none.
*/
String getCheckboxMessage();
/**
* Return the initial value for the optional checkbox.
+ *
+ * @return Initial checkbox value.
*/
boolean getCheckboxValue();
/**
* Set the current value for the optional checkbox.
+ *
+ * @param value New checkbox value.
*/
void setCheckboxValue(boolean value);
}
/**
* Display a simple message prompt.
*
- * @param view The GeckoSession that triggered the prompt
- * or null if the prompt is a global prompt.
+ * @param session GeckoSession that triggered the prompt
* @param title Title for the prompt dialog.
* @param msg Message for the prompt dialog.
* @param callback Callback interface.
*/
void alert(GeckoSession session, String title, String msg, AlertCallback callback);
/**
* Callback interface for notifying the result of a button prompt.
*/
interface ButtonCallback extends AlertCallback {
/**
* Called by the prompt implementation when the button prompt is dismissed by
* the user pressing one of the buttons.
+ *
+ * @param button Button result; one of BUTTON_TYPE_* constants.
*/
void confirm(int button);
}
static final int BUTTON_TYPE_POSITIVE = 0;
static final int BUTTON_TYPE_NEUTRAL = 1;
static final int BUTTON_TYPE_NEGATIVE = 2;
/**
* Display a prompt with up to three buttons.
*
- * @param view The GeckoSession that triggered the prompt
- * or null if the prompt is a global prompt.
+ * @param session GeckoSession that triggered the prompt
* @param title Title for the prompt dialog.
* @param msg Message for the prompt dialog.
* @param btnMsg Array of 3 elements indicating labels for the individual buttons.
* btnMsg[BUTTON_TYPE_POSITIVE] is the label for the "positive" button.
* btnMsg[BUTTON_TYPE_NEUTRAL] is the label for the "neutral" button.
* btnMsg[BUTTON_TYPE_NEGATIVE] is the label for the "negative" button.
* The button is hidden if the corresponding label is null.
* @param callback Callback interface.
@@ -1387,46 +1395,52 @@ public class GeckoSession extends LayerS
/**
* Callback interface for notifying the result of prompts that have text results,
* including color and date/time pickers.
*/
interface TextCallback extends AlertCallback {
/**
* Called by the prompt implementation when the text prompt is confirmed by
* the user, for example by pressing the "OK" button.
+ *
+ * @param text Text result.
*/
void confirm(String text);
}
/**
* Display a prompt for inputting text.
*
- * @param view The GeckoSession that triggered the prompt
- * or null if the prompt is a global prompt.
+ * @param session GeckoSession that triggered the prompt
* @param title Title for the prompt dialog.
* @param msg Message for the prompt dialog.
* @param value Default input text for the prompt.
* @param callback Callback interface.
*/
void promptForText(GeckoSession session, String title, String msg,
String value, TextCallback callback);
/**
* Callback interface for notifying the result of authentication prompts.
*/
interface AuthCallback extends AlertCallback {
/**
* Called by the prompt implementation when a password-only prompt is
* confirmed by the user.
+ *
+ * @param password Entered password.
*/
void confirm(String password);
/**
* Called by the prompt implementation when a username/password prompt is
* confirmed by the user.
+ *
+ * @param username Entered username.
+ * @param password Entered password.
*/
void confirm(String username, String password);
}
/**
* The auth prompt is for a network host.
*/
static final int AUTH_FLAG_HOST = 1;
@@ -1458,18 +1472,17 @@ public class GeckoSession extends LayerS
/**
* The auth request encrypts both password and data.
*/
static final int AUTH_LEVEL_SECURE = 2;
/**
* Display a prompt for authentication credentials.
*
- * @param view The GeckoSession that triggered the prompt
- * or null if the prompt is a global prompt.
+ * @param session GeckoSession that triggered the prompt
* @param title Title for the prompt dialog.
* @param msg Message for the prompt dialog.
* @param options Bundle containing options for the prompt with keys,
* "flags": int, bit field of AUTH_FLAG_* flags;
* "uri": String, URI for the auth request or null if unknown;
* "level": int, one of AUTH_LEVEL_* indicating level of encryption;
* "username": String, initial username or null if password-only;
* "password": String, intiial password;
@@ -1530,18 +1543,17 @@ public class GeckoSession extends LayerS
/**
* Display choices in a list that allows multiple selections.
*/
static final int CHOICE_TYPE_MULTIPLE = 3;
/**
* Display a menu prompt or list prompt.
*
- * @param view The GeckoSession that triggered the prompt
- * or null if the prompt is a global prompt.
+ * @param session GeckoSession that triggered the prompt
* @param title Title for the prompt dialog, or null for no title.
* @param msg Message for the prompt dialog, or null for no message.
* @param type One of CHOICE_TYPE_* indicating the type of prompt.
* @param choices Array of bundles each representing an item or group, with keys,
* "disabled": boolean, true if the item should not be selectable;
* "icon": String, URI of the item icon or null if none
* (only valid for menus);
* "id": String, ID of the item or group;
@@ -1555,18 +1567,17 @@ public class GeckoSession extends LayerS
* @param callback Callback interface.
*/
void promptForChoice(GeckoSession session, String title, String msg, int type,
GeckoBundle[] choices, ChoiceCallback callback);
/**
* Display a color prompt.
*
- * @param view The GeckoSession that triggered the prompt
- * or null if the prompt is a global prompt.
+ * @param session GeckoSession that triggered the prompt
* @param title Title for the prompt dialog.
* @param value Initial color value in HTML color format.
* @param callback Callback interface; the result passed to confirm() must be in
* HTML color format.
*/
void promptForColor(GeckoSession session, String title, String value,
TextCallback callback);
@@ -1593,18 +1604,17 @@ public class GeckoSession extends LayerS
/**
* Prompt for year, month, day, hour, and minute, without timezone.
*/
static final int DATETIME_TYPE_DATETIME_LOCAL = 5;
/**
* Display a date/time prompt.
*
- * @param view The GeckoSession that triggered the prompt
- * or null if the prompt is a global prompt.
+ * @param session GeckoSession that triggered the prompt
* @param title Title for the prompt dialog; currently always null.
* @param type One of DATETIME_TYPE_* indicating the type of prompt.
* @param value Initial date/time value in HTML date/time format.
* @param min Minimum date/time value in HTML date/time format.
* @param max Maximum date/time value in HTML date/time format.
* @param callback Callback interface; the result passed to confirm() must be in
* HTML date/time format.
*/
@@ -1635,18 +1645,17 @@ public class GeckoSession extends LayerS
}
static final int FILE_TYPE_SINGLE = 1;
static final int FILE_TYPE_MULTIPLE = 2;
/**
* Display a file prompt.
*
- * @param view The GeckoSession that triggered the prompt
- * or null if the prompt is a global prompt.
+ * @param session GeckoSession that triggered the prompt
* @param title Title for the prompt dialog.
* @param type One of FILE_TYPE_* indicating the prompt type.
* @param mimeTypes Array of permissible MIME types for the selected files, in
* the form "type/subtype", where "type" and/or "subtype" can be
* "*" to indicate any value.
* @param callback Callback interface.
*/
void promptForFile(GeckoSession session, String title, int type,
@@ -1656,17 +1665,17 @@ public class GeckoSession extends LayerS
/**
* GeckoSession applications implement this interface to handle content scroll
* events.
**/
public interface ScrollListener {
/**
* The scroll position of the content has changed.
*
- * @param view The GeckoSession that initiated the callback.
+ * @param session GeckoSession that initiated the callback.
* @param scrollX The new horizontal scroll position in pixels.
* @param scrollY The new vertical scroll position in pixels.
*/
public void onScrollChanged(GeckoSession session, int scrollX, int scrollY);
}
/**
* GeckoSession applications implement this interface to handle requests for permissions
@@ -1693,30 +1702,30 @@ public class GeckoSession extends LayerS
* implementation must call either grant() or reject() for every request.
*/
void reject();
}
/**
* Request Android app permissions.
*
- * @param view GeckoSession instance requesting the permissions.
+ * @param session GeckoSession instance requesting the permissions.
* @param permissions List of permissions to request; possible values are,
* android.Manifest.permission.ACCESS_FINE_LOCATION
* android.Manifest.permission.CAMERA
* android.Manifest.permission.RECORD_AUDIO
* @param callback Callback interface.
*/
void requestAndroidPermissions(GeckoSession session, String[] permissions,
Callback callback);
/**
* Request content permission.
*
- * @param view GeckoSession instance requesting the permission.
+ * @param session GeckoSession instance requesting the permission.
* @param uri The URI of the content requesting the permission.
* @param type The type of the requested permission; possible values are,
* "geolocation": permission for using the geolocation API
* "desktop-notification": permission for using the notifications API
* @param access Not used.
* @param callback Callback interface.
*/
void requestContentPermission(GeckoSession session, String uri, String type,
@@ -1757,17 +1766,17 @@ public class GeckoSession extends LayerS
*/
void reject();
}
/**
* Request content media permissions, including request for which video and/or
* audio source to use.
*
- * @param view GeckoSession instance requesting the permission.
+ * @param session GeckoSession instance requesting the permission.
* @param uri The URI of the content requesting the permission.
* @param video List of video sources, or null if not requesting video.
* Each bundle represents a video source, with keys,
* "id": String, the origin-specific source identifier;
* "rawId": String, the non-origin-specific source identifier;
* "name": String, the name of the video source from the system
* (for example, "Camera 0, Facing back, Orientation 90");
* may be empty;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SysInfo.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/SysInfo.java
@@ -35,22 +35,19 @@ public final class SysInfo {
// these.
private static volatile int cpuCount = -1;
private static volatile int totalRAM = -1;
/**
* Get the number of cores on the device.
*
- * We can't use a nice tidy API call, because they're all wrong:
- *
- * <http://stackoverflow.com/questions/7962155/how-can-you-detect-a-dual-core-
- * cpu-on-an-android-device-from-code>
- *
- * This method is based on that code.
+ * We can't use a nice tidy API call, <a
+ * href="https://stackoverflow.com/q/7962155">because they're all
+ * wrong</a>. This method is based on that code.
*
* @return the number of CPU cores, or 1 if the number could not be
* determined.
*/
public static int getCPUCount() {
if (cpuCount > 0) {
return cpuCount;
}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/TextInputController.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/TextInputController.java
@@ -113,24 +113,23 @@ public final class TextInputController {
}
/**
* Get a Handler for the background input method thread. In order to use a background
* thread for input method operations on systems prior to Nougat, first override
* {@code View.getHandler()} for the View returning the InputConnection instance, and
* then call this method from the overridden method.
*
- * For example: <pre>{@code
- * @Override
+ * For example:<pre>
+ * @Override
* public Handler getHandler() {
- * if (Build.VERSION.SDK_INT >= 24) {
+ * if (Build.VERSION.SDK_INT >= 24) {
* return super.getHandler();
* }
* return getSession().getTextInputController().getHandler(super.getHandler());
- * }
* }</pre>
*
* @param defHandler Handler returned by the system {@code getHandler} implementation.
* @return Handler to return to the system through {@code getHandler}.
*/
public @NonNull Handler getHandler(final @NonNull Handler defHandler) {
// May be called on any thread.
if (mInputConnection != null) {
@@ -180,17 +179,17 @@ public final class TextInputController {
}
mEditable.setListener((EditableListener) mInputConnection);
}
/**
* Get an InputConnection instance. For full functionality, call {@link
* #setView(View)} first before calling this method.
*
- * @param outAttrs EditorInfo instance to be filled on return.
+ * @param attrs EditorInfo instance to be filled on return.
* @return InputConnection instance or null if input method is not active.
*/
public @Nullable InputConnection onCreateInputConnection(final @NonNull EditorInfo attrs) {
// May be called on any thread.
if (!ensureInputConnection()) {
return null;
}
return mInputConnection.onCreateInputConnection(attrs);
@@ -255,16 +254,17 @@ public final class TextInputController {
}
return mInputConnection.onKeyLongPress(keyCode, event);
}
/**
* Process a KeyEvent as a multiple-press event.
*
* @param keyCode Key code.
+ * @param repeatCount Key repeat count.
* @param event KeyEvent instance.
* @return True if the event was handled.
*/
public boolean onKeyMultiple(final int keyCode, final int repeatCount,
final @NonNull KeyEvent event) {
ThreadUtils.assertOnUiThread();
if (!ensureInputConnection()) {
return false;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DynamicToolbarAnimator.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DynamicToolbarAnimator.java
@@ -77,17 +77,19 @@ public final class DynamicToolbarAnimato
if ((mToolbarChromeProxy != null) && mToolbarChromeProxy.isToolbarChromeVisible()) {
return mMaxToolbarHeight;
}
return 0;
}
/**
- * If true, scroll changes will not affect translation.
+ * Return whether the toolbar is pinned and cannot be hidden.
+ *
+ * @return True if the toolbar is pinned.
*/
public boolean isPinned() {
ThreadUtils.assertOnUiThread();
return !mPinFlags.isEmpty();
}
public boolean isPinnedBy(PinReason reason) {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerSession.java
@@ -314,17 +314,17 @@ public class LayerSession {
/**
* Get the bounds of the client area in client coordinates. The returned top-left
* coordinates are always (0, 0). Use the matrix from {@link
* #getClientToSurfaceMatrix(Matrix)} or {@link #getClientToScreenMatrix(Matrix)} to
* map these bounds to surface or screen coordinates, respectively.
*
* @param rect RectF to be replaced by the client bounds in client coordinates.
- * @see getSurfaceBounds(Rect)
+ * @see #getSurfaceBounds(Rect)
*/
public void getClientBounds(@NonNull final RectF rect) {
ThreadUtils.assertOnUiThread();
rect.set(0.0f, 0.0f, (float) mWidth / mViewportZoom,
(float) mClientHeight / mViewportZoom);
}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/NativePanZoomController.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/NativePanZoomController.java
@@ -144,17 +144,17 @@ public final class NativePanZoomControll
/* package */ NativePanZoomController(final LayerSession session) {
mSession = session;
}
/**
* Set the current scroll factor. The scroll factor is the maximum scroll amount that
* one scroll event may generate, in device pixels.
*
- * @return Scroll factor.
+ * @param factor Scroll factor.
*/
public void setScrollFactor(final float factor) {
ThreadUtils.assertOnUiThread();
mPointerScrollFactor = factor;
}
/**
* Get the current scroll factor.
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ContextUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/ContextUtils.java
@@ -13,18 +13,16 @@ import android.text.TextUtils;
public class ContextUtils {
private static final String INSTALLER_GOOGLE_PLAY = "com.android.vending";
private ContextUtils() {}
/**
* @return {@link android.content.pm.PackageInfo#firstInstallTime} for the context's package.
- * @throws PackageManager.NameNotFoundException Unexpected - we get the package name from the context so
- * it's expected to be found.
*/
public static PackageInfo getCurrentPackageInfo(final Context context) {
try {
return context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
throw new AssertionError("Should not happen: Can't get package info of own package");
}
}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/DateUtil.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/DateUtil.java
@@ -40,16 +40,16 @@ public class DateUtil {
return getTimezoneOffsetInMinutesForGivenDate(Calendar.getInstance(timezone));
}
/**
* Returns the time zone offset for the given date in minutes. The date makes a difference due to daylight
* savings time in some regions. We return minutes because we can accurately represent time zones that are
* offset by non-integer hour values, e.g. parts of New Zealand at UTC+12:45.
*
- * @param calendar A calendar with the appropriate time zone & date already set.
+ * @param calendar A calendar with the appropriate time zone & date already set.
*/
public static int getTimezoneOffsetInMinutesForGivenDate(@NonNull final Calendar calendar) {
// via Date.getTimezoneOffset deprecated docs (note: it had incorrect order of operations).
// Also, we cast to int because we should never overflow here - the max should be GMT+14 = 840.
return (int) TimeUnit.MILLISECONDS.toMinutes(calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET));
}
}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/FileUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/FileUtils.java
@@ -136,17 +136,17 @@ public class FileUtils {
/**
* A generic solution to read from an input stream in UTF-8. This function will read from the stream until it
* is finished and close the stream - this is necessary to close the wrapping resources.
*
* For a higher-level method, see {@link #readStringFromFile(File)}.
*
* Since this is generic, it may not be the most performant for your use case.
*
- * @param bufferSize Size of the underlying buffer for read optimizations - must be > 0.
+ * @param bufferSize Size of the underlying buffer for read optimizations - must be > 0.
*/
public static String readStringFromInputStreamAndCloseStream(final InputStream inputStream, final int bufferSize)
throws IOException {
InputStreamReader reader = null;
try {
if (bufferSize <= 0) {
throw new IllegalArgumentException("Expected buffer size larger than 0. Got: " + bufferSize);
}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/IntentUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/IntentUtils.java
@@ -26,22 +26,19 @@ public class IntentUtils {
public static final String ENV_VAR_IN_AUTOMATION = "MOZ_IN_AUTOMATION";
private static final String ENV_VAR_REGEX = "(.+)=(.*)";
private IntentUtils() {}
/**
* Returns a list of environment variables and their values. These are parsed from an Intent extra
- * with the key -> value format:
- * env# -> ENV_VAR=VALUE
+ * with the key -> value format: env# -> ENV_VAR=VALUE, where # is an integer starting at 0.
*
- * # in env# is expected to be increasing from 0.
- *
- * @return A Map of environment variable name to value, e.g. ENV_VAR -> VALUE
+ * @return A Map of environment variable name to value, e.g. ENV_VAR -> VALUE
*/
public static HashMap<String, String> getEnvVarMap(@NonNull final SafeIntent intent) {
// Optimization: get matcher for re-use. Pattern.matcher creates a new object every time so it'd be great
// to avoid the unnecessary allocation, particularly because we expect to be called on the startup path.
final Pattern envVarPattern = Pattern.compile(ENV_VAR_REGEX);
final Matcher matcher = envVarPattern.matcher(""); // argument does not matter here.
// This is expected to be an external intent so we should use SafeIntent to prevent crashing.
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/StringUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/StringUtils.java
@@ -226,17 +226,17 @@ public class StringUtils {
return url;
}
public static String encodeUserEnteredUrl(String url) {
return Uri.fromParts("user-entered", url, null).toString();
}
/**
- * Compatibility layer for API < 11.
+ * Compatibility layer for API < 11.
*
* Returns a set of the unique names of all query parameters. Iterating
* over the set will return the names in order of their first occurrence.
*
* @param uri
* @throws UnsupportedOperationException if this isn't a hierarchical URI
*
* @return a set of decoded names
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/publicsuffix/PublicSuffix.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/publicsuffix/PublicSuffix.java
@@ -26,18 +26,18 @@ import java.util.Set;
* Some parts of the implementation of this class are based on InternetDomainName class of the Guava
* project: https://github.com/google/guava
*/
public class PublicSuffix {
/**
* Strip the public suffix from the domain. Returns the original domain if no public suffix
* could be found.
*
- * www.mozilla.org -> www.mozilla
- * independent.co.uk -> independent
+ * www.mozilla.org -> www.mozilla
+ * independent.co.uk -> independent
*/
@NonNull
@WorkerThread // This method might need to load data from disk
public static String stripPublicSuffix(Context context, @NonNull String domain) {
if (domain.length() == 0) {
return domain;
}