From 168944277c503f112e2675301f21e1e3aff9e37e Mon Sep 17 00:00:00 2001 From: Mayhem Date: Tue, 13 Aug 2013 03:03:50 +0200 Subject: [PATCH] 4chan X should attempt to handle this Chrome db corruption bug. This'll warn users about this bug and show them how to fix it. --- src/General/Main.coffee | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 039ad745d..60e4d026c 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -1,5 +1,5 @@ Main = - init: (items) -> + init: -> pathname = location.pathname.split '/' g.BOARD = new Board pathname[1] return if g.BOARD.ID in ['z', 'fk'] @@ -30,13 +30,25 @@ Main = Conf[db] = boards: {} Conf['selectedArchives'] = {} Conf['archives'] = Redirect.archives - $.get Conf, Main.initFeatures + $.get Conf, (items) -> + $.extend Conf, items + <% if (type === 'crx') { %> + unless items + new Notification 'error', $.el 'span', + innerHTML: """ + It seems like your <%= meta.name %> settings became corrupted due to a Chrome bug.
+ Unfortunately, you'll have to fix it yourself. + """ + # Track resolution of this bug. + Main.logError + message: 'Chrome Storage API bug' + error: new Error chrome.runtime.lastError.message or 'no lastError.message' + <% } %> + Main.initFeatures() $.on d, '4chanMainInit', Main.initStyle - initFeatures: (items) -> - Conf = items - + initFeatures: -> switch location.hostname when 'api.4chan.org' return