New issue
Advanced search Search tips

Issue 638077 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocking:
issue 609258



Sign in to add a comment

Canonicalize URLs prior to comparing values in Android Manifest and Web Manifest

Project Member Reported by pkotw...@chromium.org, Aug 16 2016

Issue description

Canonicalize URLs prior to comparing values in Android Manifest and Web Manifest

For instance if:
"www.google.com/" is in the Web Manifest and
"www.google.com" is in the Android Manifest

ManifestUpgradeDetector should not request an update 
 

Comment 1 by hanxi@chromium.org, Sep 1 2016

For this specific case, we can remove all tailing "/" before a comparison in the ManifestUpgradeDetector. Is there any other case that needs to canonicalize?
Owner: pkotw...@chromium.org
Status: Assigned (was: Untriaged)
When comparing URLs we must ignore the port. The port will be stripped from the URL when canonicalized by the WebAPK server
Project Member

Comment 4 by bugdroid1@chromium.org, Sep 20 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c0635b4ff44c7ccad4c9c94740dca27945af88cf

commit c0635b4ff44c7ccad4c9c94740dca27945af88cf
Author: pkotwicz <pkotwicz@chromium.org>
Date: Tue Sep 20 21:56:57 2016

Canonicalize URLs prior to comparing in ManifestUpgradeDetector

Chrome and the WebAPK server parse URLs differently. For instance, the WebAPK
server currently does not do URL escaping. The WebAPK server populates the
WebAPK's Android Manifest with the URLs that it has parsed. This CL makes
ManifestUpgradeDetector canonicalize URLs before comparing them.

BUG= 638077 
TEST=ManifestUpgradeDetectorTest.*

Review-Url: https://codereview.chromium.org/2341163002
Cr-Commit-Position: refs/heads/master@{#419863}

[modify] https://crrev.com/c0635b4ff44c7ccad4c9c94740dca27945af88cf/chrome/android/java/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetector.java
[modify] https://crrev.com/c0635b4ff44c7ccad4c9c94740dca27945af88cf/chrome/android/java_sources.gni
[add] https://crrev.com/c0635b4ff44c7ccad4c9c94740dca27945af88cf/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetectorTest.java
[modify] https://crrev.com/c0635b4ff44c7ccad4c9c94740dca27945af88cf/chrome/android/junit/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetectorTest.java
[add] https://crrev.com/c0635b4ff44c7ccad4c9c94740dca27945af88cf/chrome/test/data/banners/manifest_one_icon.json
[add] https://crrev.com/c0635b4ff44c7ccad4c9c94740dca27945af88cf/chrome/test/data/banners/manifest_one_icon_test_page.html

Status: Fixed (was: Assigned)
Tests steps:
1) Enable WebAPKs by following steps in https://docs.google.com/a/google.com/document/d/1gHZ1YXO7QRZO6hgt11uqItNpl5WrZBJYxPYAnuJphXU/edit?usp=sharing
2) "Force Stop" Chrome
3) In Chrome for Android, navigate to https://webapk-test.appspot.com/generated.html?name=Long%20Train%20%F0%9F%9A%82&short_name=Short%20Train%20%F0%9F%9A%8B&scope=%2F&display=standalone&orientation=&start_url=&theme_color=purple&background_color=teal&icons=icon_hexagon_256&update=true&update_name=Long%20Train%20%F0%9F%9A%82&update_short_name=Short%20Train%20%F0%9F%9A%8B&update_scope=%2F&update_display=standalone&update_orientation=&update_start_url=a%2F..&update_theme_color=purple&update_background_color=teal&update_icons=icon_hexagon_256&seed=549

Tip: You can navigate "Chrome for Android" to a long URL by using chrome://inspect on the desktop and selecting the "Devices" tab

4) If a "Reset" button is visible on the web page, press it. (Do not press the "Update" button. If you press the "Update" button by mistake, you can press the "Reset" button to get back to where you were)
5) Select "Add to Home screen" from the app menu. An infobar will show briefly. Press the "Install" button when asked to install the "Short Train" APK
6) With the Chrome device connected to the computer, run "adb logcat | grep WebApkUpdateManager"
7) Launch the newly created APK.
8) Wait till the "adb logcat" command displays a new line with "WebAPK upgrade needed:"
9) Check that the "adb logcat" command displays "WebAPK upgrade needed: false"
10) Press the "Update" button
11) Relaunch the APK
12) Check that the "adb logcat" command displays a new line "WebAPK upgrade needed: false"

Sign in to add a comment