Bug 1401208 - Change default web app scope to the start_url r=esawin
authorJames Willcox <snorp@snorp.net>
Tue, 19 Sep 2017 09:45:04 -0500
changeset 433707 50d08bf45f3df9a5eacfc4531aafd85fd32875fd
parent 433706 df4f51e1809091f05384bf2a5e18512201b42416
child 433708 40b3b10f78c2d5a72356d21532add0848fc928b2
push id1567
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 12:36:05 +0000
treeherdermozilla-release@e512c14a0406 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1401208
milestone57.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 1401208 - Change default web app scope to the start_url r=esawin MozReview-Commit-ID: Jvbru5oRYDH
mobile/android/base/java/org/mozilla/gecko/webapps/WebAppManifest.java
--- a/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppManifest.java
+++ b/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppManifest.java
@@ -100,18 +100,18 @@ public class WebAppManifest {
     public String getOrientation() {
         return mOrientation;
     }
 
     private void readManifest(final JSONObject manifest, final JSONObject manifestField) {
         mThemeColor = readThemeColor(manifestField);
         mName = readName(manifestField);
         mIcon = readIcon(manifest);
+        mStartUri = readStartUrl(manifestField);
         mScope = readScope(manifestField);
-        mStartUri = readStartUrl(manifestField);
 
         mDisplayMode = manifestField.optString("display", null);
         mOrientation = manifestField.optString("orientation", null);
     }
 
     private Integer readThemeColor(final JSONObject manifest) {
         final String colorStr = manifest.optString("theme_color", null);
         if (colorStr != null) {
@@ -182,24 +182,25 @@ public class WebAppManifest {
         for (int i = 0; i < (segments.size() - 1); i++) {
             builder.appendPath(segments.get(i));
         }
 
         return builder.build();
     }
 
     private Uri readScope(final JSONObject manifest) {
+        final Uri defaultScope = stripLastPathSegment(mStartUri);
         final String scopeStr = manifest.optString("scope", null);
         if (scopeStr == null) {
-            return null;
+            return defaultScope;
         }
 
         Uri scope = Uri.parse(scopeStr);
         if (scope == null) {
-            return null;
+            return defaultScope;
         }
 
         if (scope.isRelative()) {
             scope = buildRelativeUrl(stripLastPathSegment(mManifestUri), scope);
         }
 
         return scope;
     }