Detect conflicts with native extension and show appropriate error message. #1627

This commit is contained in:
ccd0 2019-07-25 18:49:57 -07:00
parent 5f4ae3231f
commit 53f2252f38
2 changed files with 15 additions and 0 deletions

View File

@ -99,6 +99,7 @@ Main =
# Fresh install
else if !items.previousversion?
Main.isFirstRun = true
Main.ready ->
$.set 'previousversion', g.VERSION
Settings.open()
@ -502,6 +503,16 @@ Main =
new Notice 'error', 'Error: Multiple copies of 4chan X are enabled.'
$.addClass doc, 'tainted'
# Detect conflicts with native extension
if g.SITE.testNativeExtension and not $.hasClass(doc, 'tainted')
{enabled} = g.SITE.testNativeExtension()
if enabled
$.addClass doc, 'tainted'
if Conf['Disable Native Extension'] and !Main.isFirstRun
msg = $.el 'div',
<%= html('Failed to disable the native extension. You may need to <a href="' + meta.faq + '#blocking-native-extension" target="_blank">block it</a>.') %>
new Notice 'error', msg
unless errors instanceof Array
error = errors
else if errors.length is 1

View File

@ -225,3 +225,7 @@ SW.yotsuba =
isLinkified: (link) ->
ImageHost.test(link.hostname)
testNativeExtension: ->
$.global ->
@enabled = 'true' if window.Parser.postMenuIcon