aboutsummaryrefslogtreecommitdiffstats
path: root/pages/options.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'pages/options.coffee')
-rw-r--r--pages/options.coffee15
1 files changed, 7 insertions, 8 deletions
diff --git a/pages/options.coffee b/pages/options.coffee
index 0038c3f9..416b3ea7 100644
--- a/pages/options.coffee
+++ b/pages/options.coffee
@@ -333,15 +333,14 @@ DomUtils?.documentReady ->
backup = {}
for option in Option.all
backup[option.field] = option.readValueFromElement()
- blob = new Blob [ JSON.stringify backup ]
- url = window.URL.createObjectURL blob
- a = document.createElement "a"
- document.body.appendChild a
- a.style = "display: none"
+ # Create the blob in the background page so it isn't garbage collected when the page closes in FF.
+ bgWin = chrome.extension.getBackgroundPage()
+ blob = new bgWin.Blob [ JSON.stringify backup ]
+ url = bgWin.URL.createObjectURL blob
+ a = $ "backupLink"
a.href = url
- a.download = "vimium-options-#{new Date().toISOString().split("T")[0]}.json"
- a.click()
- document.body.removeChild a
+ a.style.display = ""
+ a.click() unless Utils.isFirefox()
$("chooseFile").addEventListener "change", (event) ->
document.activeElement?.blur()