From dd979ff5ffff013cf32c96fdfa26f4c6d0721ea1 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 11 Mar 2018 10:38:35 -0400 Subject: [PATCH] code review: allow dev build of Firefox to update resources.txt --- src/js/assets.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/js/assets.js b/src/js/assets.js index c67730890..eb2e773db 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -906,13 +906,20 @@ var updaterStatus, noRemoteResources; var updateFirst = function() { - // Firefox extension reviewers do not want uBO/webext to fetch its own - // scriptlets/resources asset from the project's own repo (github.com). - // See: https://github.com/gorhill/uBlock/commit/126110c9a0a0630cd556f5cb215422296a961029 + // https://github.com/gorhill/uBlock/commit/126110c9a0a0630cd556f5cb215422296a961029 + // Firefox extension reviewers do not want uBO/webext to fetch its own + // scriptlets/resources asset from the project's own repo (github.com). + // https://github.com/uBlockOrigin/uAssets/issues/1647#issuecomment-371456830 + // Allow self-hosted dev build to update: if update_url is present but + // null, assume the extension is hosted on AMO. if ( noRemoteResources === undefined ) { + var manifest = chrome.runtime.getManifest(); noRemoteResources = typeof vAPI.webextFlavor === 'string' && - vAPI.webextFlavor.startsWith('Mozilla-Firefox-'); + vAPI.webextFlavor.startsWith('Mozilla-Firefox-') && + manifest.applications instanceof Object && + manifest.applications.gecko instanceof Object && + manifest.applications.gecko.update_url === null; } updaterStatus = 'updating'; updaterFetched.clear();