We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a7f4362 commit c342c5fCopy full SHA for c342c5f
test/jquery.json.test.js
@@ -168,3 +168,25 @@ test( 'Undefined and null', function(){
168
169
170
});
171
+test( 'Prototype inheritance', function(){
172
+
173
+ Object.prototype.AWESOME = 7;
174
175
+ testToJSON(
176
+ { apple: 2, key: 'value' },
177
+ '{"apple":2,"key":"value"}',
178
+ 'Prototype values should not be included in the string'
179
+ );
180
181
+ // Since prototypes are highly dangerous,
182
+ // make sure to remove it as soon as possible
183
+ // Lots of code in jQuery will fail as it is
184
+ // in the policy of jQuery that Object prototypes
185
+ // are not supported.
186
+ try {
187
+ // Might fail in IE. Make sure to not let any exception
188
+ // get out.
189
+ delete Object.prototype.AWESOME;
190
+ } catch(e){}
191
192
+})
0 commit comments