[Pkg-mozext-commits] [greasemonkey] 02/24: Update storageFront.js

David Prévot taffit at moszumanska.debian.org
Sat May 30 13:32:04 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository greasemonkey.

commit a2e54cb22dd41c4aa798fb8f39f25d77f9a6b9c6
Author: janekptacijarabaci <janekptacijarabaci at users.noreply.github.com>
Date:   Sun May 17 08:15:06 2015 +0200

    Update storageFront.js
---
 modules/storageFront.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/storageFront.js b/modules/storageFront.js
index 075ca51..4c59012 100644
--- a/modules/storageFront.js
+++ b/modules/storageFront.js
@@ -14,9 +14,10 @@ var EXPORTED_SYMBOLS = ['GM_ScriptStorageFront'];
 
 // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ // \\ //
 
-function GM_ScriptStorageFront(aScript, aMessageManager) {
+function GM_ScriptStorageFront(aScript, aMessageManager, aSandbox) {
   this._db = null;
   this._messageManager = aMessageManager;
+  this._sandbox = aSandbox;
   this._script = aScript;
   this.stringBundle = Components
     .classes["@mozilla.org/intl/stringbundle;1"]
@@ -64,7 +65,12 @@ GM_ScriptStorageFront.prototype.getValue = function(name, defVal) {
   if (value === undefined || value === null) return defVal;
 
   try {
-    return JSON.parse(value);
+    value = JSON.parse(value);
+    // JSON (JavaScript Object Notation) is not designed for serializing
+    // DOM Nodes. But maybe in the future...
+    value = Components.utils.cloneInto(value,
+            this._sandbox, { wrapReflectors: true });
+    return value;
   } catch (e) {
     dump('JSON parse error? ' + uneval(e) + '\n');
     return defVal;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git



More information about the Pkg-mozext-commits mailing list