From 5aafafd50d1f2003249af9864d6c9db94c7e7630 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 18 Jan 2015 11:50:20 -0700 Subject: [PATCH] Fix `set` for Firefox & Safari (don't set non-own properties in for..in loop) --- platform/firefox/vapi-background.js | 3 +++ platform/safari/vapi-background.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index e8a8d28b2..d257f26dc 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -195,6 +195,9 @@ vAPI.storage = { var key, values = [], placeholders = []; for ( key in details ) { + if ( !details.hasOwnProperty(key) ) { + continue; + } values.push(key); values.push(JSON.stringify(details[key])); placeholders.push('?, ?'); diff --git a/platform/safari/vapi-background.js b/platform/safari/vapi-background.js index 02b62f863..6769855fa 100644 --- a/platform/safari/vapi-background.js +++ b/platform/safari/vapi-background.js @@ -126,6 +126,9 @@ vAPI.storage = { set: function(details, callback) { for ( var key in details ) { + if ( !details.hasOwnProperty(key) ) { + continue; + } this._storage.setItem(key, JSON.stringify(details[key])); }