Make Chrome extension reload warning work when chrome.runtime.getManifest() throws an error.

This commit is contained in:
ccd0 2019-03-24 06:36:51 -07:00
parent 0c286e7a68
commit a2a4600be0

View File

@ -419,16 +419,16 @@ $.sync = (key, cb) ->
$.forceSync = -> return $.forceSync = -> return
$.crxWorking = -> $.crxWorking = ->
if chrome.runtime.getManifest() try
true if chrome.runtime.getManifest()
else return true
unless $.crxWarningShown unless $.crxWarningShown
msg = $.el 'div', msg = $.el 'div',
<%= html('4chan X seems to have been updated. You will need to <a href="javascript:;">reload</a> the page.') %> <%= html('4chan X seems to have been updated. You will need to <a href="javascript:;">reload</a> the page.') %>
$.on $('a', msg), 'click', -> location.reload() $.on $('a', msg), 'click', -> location.reload()
new Notice 'warning', msg new Notice 'warning', msg
$.crxWarningShown = true $.crxWarningShown = true
false false
$.get = $.oneItemSugar (data, cb) -> $.get = $.oneItemSugar (data, cb) ->
return unless $.crxWorking() return unless $.crxWorking()