Skip to content

Commit

Permalink
Detect conflicts with native extension and show appropriate error mes…
Browse files Browse the repository at this point in the history
…sage. #1627
  • Loading branch information
ccd0 committed Jul 26, 2019
1 parent 5f4ae32 commit 53f2252
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/Main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Main =

# Fresh install
else if !items.previousversion?
Main.isFirstRun = true
Main.ready ->
$.set 'previousversion', g.VERSION
Settings.open()
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/site/SW.yotsuba.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,7 @@ SW.yotsuba =

isLinkified: (link) ->
ImageHost.test(link.hostname)

testNativeExtension: ->
$.global ->
@enabled = 'true' if window.Parser.postMenuIcon

0 comments on commit 53f2252

Please # to comment.