Bug 1297117 - Make getUrlFromAboutReader private to avoid erronous usage r=sebastian
authorAndrzej Hunt <ahunt@mozilla.com>
Fri, 02 Sep 2016 12:35:08 -0700
changeset 312753 fa498a368de326969bcd2c87cae1452522f8513d
parent 312752 aeff16129d5a8c9b84dc38e399c33cd1bbceba2e
child 312754 b9de26cf8806eaf7a35b7210fb117e07e479154d
push id30656
push userphilringnalda@gmail.com
push dateTue, 06 Sep 2016 01:05:50 +0000
treeherdermozilla-central@8c9c4e816e86 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1297117
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1297117 - Make getUrlFromAboutReader private to avoid erronous usage r=sebastian getUrlFromAboutReader can return null. There have been crashes caused by not checking this result in the past. stripAboutReaderFromUrl is a safer version which returns the input URL if necessary, and is probably what should be used in new code, hence we can make this method private. MozReview-Commit-ID: Lg7QWrpSE8F
mobile/android/base/java/org/mozilla/gecko/reader/ReaderModeUtils.java
--- a/mobile/android/base/java/org/mozilla/gecko/reader/ReaderModeUtils.java
+++ b/mobile/android/base/java/org/mozilla/gecko/reader/ReaderModeUtils.java
@@ -15,17 +15,17 @@ public class ReaderModeUtils {
     /**
      * Extract the URL from a valid about:reader URL. You may want to use stripAboutReaderUrl
      * instead to always obtain a valid String.
      *
      * @see #stripAboutReaderUrl(String) for a safer version that returns the original URL for malformed/invalid
      *     URLs.
      * @return <code>null</code> if the URL is malformed or doesn't contain a URL parameter.
      */
-    public static String getUrlFromAboutReader(String aboutReaderUrl) {
+    private static String getUrlFromAboutReader(String aboutReaderUrl) {
         return StringUtils.getQueryParameter(aboutReaderUrl, "url");
     }
 
     public static boolean isEnteringReaderMode(String currentUrl, String newUrl) {
         if (currentUrl == null || newUrl == null) {
             return false;
         }