Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/renderer/resources/extensions/storage_custom_bindings.js

Issue 10890002: Make V8ValueConverter.FromV8Value behave similarly to JSON.stringify (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ignore -> omit Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Custom bindings for the storage API. 5 // Custom bindings for the storage API.
6 6
7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
8 var normalizeArgumentsAndValidate = 8 var normalizeArgumentsAndValidate =
9 require('schemaUtils').normalizeArgumentsAndValidate 9 require('schemaUtils').normalizeArgumentsAndValidate
10 var sendRequest = require('sendRequest').sendRequest; 10 var sendRequest = require('sendRequest').sendRequest;
(...skipping 15 matching lines...) Expand all
26 // callers of registerCustomType(). 26 // callers of registerCustomType().
27 var self = this; 27 var self = this;
28 function bindApiFunction(functionName) { 28 function bindApiFunction(functionName) {
29 self[functionName] = function() { 29 self[functionName] = function() {
30 var funSchema = this.functionSchemas[functionName]; 30 var funSchema = this.functionSchemas[functionName];
31 var args = Array.prototype.slice.call(arguments); 31 var args = Array.prototype.slice.call(arguments);
32 args = normalizeArgumentsAndValidate(args, funSchema); 32 args = normalizeArgumentsAndValidate(args, funSchema);
33 return sendRequest( 33 return sendRequest(
34 'storage.' + functionName, 34 'storage.' + functionName,
35 [namespace].concat(args), 35 [namespace].concat(args),
36 extendSchema(funSchema.definition.parameters)); 36 extendSchema(funSchema.definition.parameters),
37 {preserveNullInObjects: true});
37 }; 38 };
38 } 39 }
39 var apiFunctions = ['get', 'set', 'remove', 'clear', 'getBytesInUse']; 40 var apiFunctions = ['get', 'set', 'remove', 'clear', 'getBytesInUse'];
40 apiFunctions.forEach(bindApiFunction); 41 apiFunctions.forEach(bindApiFunction);
41 } 42 }
42 43
43 return StorageArea; 44 return StorageArea;
44 }); 45 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698