Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Bug 827341: Fix relative icon path #7327

Merged
merged 1 commit into from

3 participants

apps/homescreen/js/grid.js
@@ -808,6 +808,13 @@ const GridManager = (function() {
url.indexOf('https://') == 0)
return url;
+ if (url[0] != '/') {
@julienw Owner
julienw added a note

I'd use url.charAt(0) instead, it's not much longer and it is ES3 compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/homescreen/js/grid.js
@@ -808,6 +808,13 @@ const GridManager = (function() {
url.indexOf('https://') == 0)
return url;
+ if (url[0] != '/') {
+ console.warn('`' + manifest.name + '` app icon is invalid. ' +
+ 'Manifest `icons` attribute should contain absolute ' +
+ 'paths from the origin.');
@julienw Owner
julienw added a note

'or data url' ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@julienw
Owner

some nit

otherwise, seems good.

I'll try the patch later and I'll r+ only then.

@ochameau
Collaborator

Comments adressed.

@vingtetun vingtetun merged commit 8e85602 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 0 deletions.
  1. +7 −0 apps/homescreen/js/grid.js
View
7 apps/homescreen/js/grid.js
@@ -808,6 +808,13 @@ const GridManager = (function() {
url.indexOf('https://') == 0)
return url;
+ if (url.charAt(0) != '/') {
+ console.warn('`' + manifest.name + '` app icon is invalid. ' +
+ 'Manifest `icons` attribute should contain URLs -or- ' +
+ 'absolute paths from the origin field.');
+ return getDefaultIcon(app);
+ }
+
if (app.origin.slice(-1) == '/')
return app.origin.slice(0, -1) + url;
Something went wrong with that request. Please try again.