firefox fixes

This commit is contained in:
Alex Yatskov 2017-08-15 21:51:48 -07:00
parent 8ed3ca6fd4
commit 84d2204d96
2 changed files with 6 additions and 6 deletions

View File

@ -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) {

View File

@ -22,6 +22,10 @@ function utilAsync(func) {
};
}
function utilIsolate(data) {
return JSON.parse(JSON.stringify(data));
}
function utilBackend() {
return chrome.extension.getBackgroundPage().yomichan_backend;
}