From 84d2204d966342fa03635b4b8a860bb48a418bc0 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Tue, 15 Aug 2017 21:51:48 -0700 Subject: firefox fixes --- ext/bg/js/api.js | 8 ++------ ext/bg/js/util.js | 4 ++++ 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'ext/bg/js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 8b4c3896..4b6729ad 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -18,15 +18,11 @@ async function apiOptionsSet(options) { - // In Firefox, setting options from the options UI somehow carries references - // to the DOM across to the background page, causing the options object to - // become a "DeadObject" after the options page is closed. The workaround used - // here is to create a deep copy of the options object. - utilBackend().onOptionsUpdated(JSON.parse(JSON.stringify(options))); + utilBackend().onOptionsUpdated(utilIsolate(options)); } async function apiOptionsGet() { - return utilBackend().options; + return utilIsolate(utilBackend().options); } async function apiTermsFind(text) { diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 11ec23eb..a92fd0bc 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -22,6 +22,10 @@ function utilAsync(func) { }; } +function utilIsolate(data) { + return JSON.parse(JSON.stringify(data)); +} + function utilBackend() { return chrome.extension.getBackgroundPage().yomichan_backend; } -- cgit v1.2.3