diff --git a/dom/settings/SettingsManager.js b/dom/settings/SettingsManager.js index 1edc16a7d19a..709ee406022f 100644 --- a/dom/settings/SettingsManager.js +++ b/dom/settings/SettingsManager.js @@ -88,10 +88,7 @@ SettingsLock.prototype = { if (DEBUG) debug("store1: " + JSON.stringify(obj)); setReq = store.put(obj); } else { - //Workaround for cloning issues - let defaultVal = JSON.parse(JSON.stringify(defaultValue)); - let userVal = JSON.parse(JSON.stringify(userValue)); - let obj = {settingName: key, defaultValue: defaultVal, userValue: userVal}; + let obj = {settingName: key, defaultValue: defaultValue, userValue: userValue}; if (DEBUG) debug("store2: " + JSON.stringify(obj)); setReq = store.put(obj); } @@ -114,7 +111,7 @@ SettingsLock.prototype = { Services.DOMRequest.fireError(request, setReq.error.name) } }; - } + }; checkKeyRequest.onerror = function(event) { if (!request.error) { Services.DOMRequest.fireError(request, checkKeyRequest.error.name) @@ -127,8 +124,8 @@ SettingsLock.prototype = { : store.mozGetAll(info.name); getReq.onsuccess = function(event) { - if (DEBUG) debug("Request for '" + info.name + "' successful. " + - "Record count: " + event.target.result.length); + if (DEBUG) debug("Request for '" + info.name + "' successful. " + + "Record count: " + event.target.result.length); if (event.target.result.length == 0) { if (DEBUG) debug("MOZSETTINGS-GET-WARNING: " + info.name + " is not in the database.\n"); @@ -214,8 +211,7 @@ SettingsLock.prototype = { if (this._settingsManager.hasWritePrivileges) { let req = Services.DOMRequest.createRequest(this._settingsManager._window); if (DEBUG) debug("send: " + JSON.stringify(aSettings)); - let settings = JSON.parse(JSON.stringify(aSettings)); - this._requests.enqueue({request: req, intent: "set", settings: settings}); + this._requests.enqueue({request: req, intent: "set", settings: aSettings}); this.createTransactionAndProcess(); return req; } else { @@ -312,7 +308,6 @@ SettingsManager.prototype = { switch (aMessage.name) { case "Settings:Change:Return:OK": - if (DEBUG) debug("Settings:Change:Return:OK"); if (this._onsettingchange || this._callbacks) { if (DEBUG) debug('data:' + msg.key + ':' + msg.value + '\n'); @@ -334,7 +329,7 @@ SettingsManager.prototype = { if (DEBUG) debug("no observers stored!"); } break; - default: + default: if (DEBUG) debug("Wrong message: " + aMessage.name); } }, diff --git a/dom/settings/tests/Makefile.in b/dom/settings/tests/Makefile.in index 032ffa43763b..739799ae5699 100644 --- a/dom/settings/tests/Makefile.in +++ b/dom/settings/tests/Makefile.in @@ -16,6 +16,7 @@ MOCHITEST_FILES = \ test_settings_basics.html \ test_settings_events.html \ test_settings_onsettingchange.html \ + test_settings_blobs.html \ $(NULL) _CHROMEMOCHITEST_FILES = \ diff --git a/dom/settings/tests/test_settings_blobs.html b/dom/settings/tests/test_settings_blobs.html new file mode 100644 index 000000000000..9a29a4500e9c --- /dev/null +++ b/dom/settings/tests/test_settings_blobs.html @@ -0,0 +1,128 @@ + + + +
++ ++ +