Closed Bug 1251010 Opened 8 years ago Closed 3 years ago

Rename/migrate existing url metadata table

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: mcomella, Unassigned)

References

Details

And potentially remove it if it's not useful. It gets in the way of the namespace for the new url metadata table, bug 1250707.
It stores some data for microsoft live tiles [1][2]:

4095       case "DOMMetaAdded":
4096         let target = aEvent.originalTarget;
4097         let browser = BrowserApp.getBrowserForDocument(target.ownerDocument);
4098 
4099         switch (target.name) {
4100           case "msapplication-TileImage":
4101             this.addMetadata("tileImage", browser.currentURI.resolve(target.content), this.METADATA_GOOD_MATCH);
4102             break;
4103           case "msapplication-TileColor":
4104             this.addMetadata("tileColor", target.content, this.METADATA_GOOD_MATCH);
4105             break;
4106         }

as well as apple touch icon metadata [3]:

4110       case "DOMLinkAdded":
4111       case "DOMLinkChanged": {
             ...
4123         if (list.indexOf("[icon]") != -1) {
4124           jsonMessage = this.makeFaviconMessage(target);
4125         } else if (list.indexOf("[apple-touch-icon]") != -1 ||
4126             list.indexOf("[apple-touch-icon-precomposed]") != -1) {
4127           let message = this.makeFaviconMessage(target);
4128           this.addMetadata("touchIconList", message.href, message.size);

This gets sent with DOMContentLoaded [4]:

4056         Messaging.sendRequest({
4057           type: "DOMContentLoaded",
4058           tabID: this.id,
4059           bgColor: backgroundColor,
4060           errorType: errorType,
4061           metadata: this.metatags,
4062         });

Which gets captured in Tabs.java which calls Tab.setMetadata, which writes to the DB.

[1]: https://msdn.microsoft.com/en-us/library/dn255024%28v=vs.85%29.aspx#msapplication-TileColor
[2]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#4101
[3]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#4128
[4]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#4061
The table is read from in GeckoAppShell.createShortcut to create homescreen shortcuts [1]:

823     public static void createShortcut(final String aTitle, final String aURI) {
824         ThreadUtils.assertOnBackgroundThread();
825         final BrowserDB db = GeckoProfile.get(getApplicationContext()).getDB();
826 
827         final ContentResolver cr = getContext().getContentResolver();
828         final Map<String, Map<String, Object>> metadata = db.getURLMetadata().getForURLs(cr,
829                 Collections.singletonList(aURI),
830                 Collections.singletonList(URLMetadataTable.TOUCH_ICON_COLUMN)
831         );

And to create thumbnails in TopSitesPanel.ThumbnailsLoader.doInBackground [2]: 

810         public Map<String, ThumbnailInfo> loadInBackground() {
811             final Map<String, ThumbnailInfo> thumbnails = new HashMap<String, ThumbnailInfo>();
812             if (mUrls == null || mUrls.size() == 0) {
813                 return thumbnails;
814             }
815 
816             // Query the DB for tile images.
817             final ContentResolver cr = getContext().getContentResolver();
818             final Map<String, Map<String, Object>> metadata = mDB.getURLMetadata().getForURLs(cr, mUrls, COLUMNS);
819 
820             // Keep a list of urls that don't have tiles images. We'll use thumbnails for them instead.

Sounds useful – we should keep it.

[1]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java#828
[2]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/home/TopSitesPanel.java#818
Blocks: 1250707
It looks like the schema is:

id  url  tile_image_url_col  tile_color_col  touch_icon_col

I wonder if we were to re-use this table by adding in the fields from bug 1250707 as new columns. However, we won't have a touch icon, a tile image, and a tile color for each url so there are some fields that would go unused. Perhaps we should migrate this into the design from bug 1250707 instead.
So either we'll migrate it into the new table (bug 1250707) or re-name it to make it more obvious it stores thumbnail metadata.

My initial thoughts are against migrating it to the new table to avoid putting too many entries into the table (e.g. there can conceivably be an apple touch icon for every site the user visits), which could hurt performance.
No longer blocks: 1250707
Depends on: 1250707
Summary: Investigate existing url metadata table → Rename/migrate existing url metadata table
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.