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

Unified Diff: chrome/renderer/resources/extensions/send_request.js

Issue 10161038: Allow serialization of ArrayBuffer params in extension/apps API methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes for review feedback and browser test failures Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/send_request.js
diff --git a/chrome/renderer/resources/extensions/send_request.js b/chrome/renderer/resources/extensions/send_request.js
index 045e270323f8be406bfcf38c8c9518e990dcecc0..2e79b8a42cbde505a4a1ff6a79beb97fd69fe0dd 100644
--- a/chrome/renderer/resources/extensions/send_request.js
+++ b/chrome/renderer/resources/extensions/send_request.js
@@ -107,8 +107,13 @@ function sendRequest(functionName, args, argSchemas, opt_args) {
if (request.args === undefined)
request.args = null;
- var sargs = opt_args.noStringify ?
- request.args : chromeHidden.JSON.stringify(request.args);
+ // TODO(asargent) - convert all optional native functions to accept raw
+ // v8 values instead of expecting JSON strings.
+ var doStringify = false;
+ if (opt_args.nativeFunction && !opt_args.noStringify)
asargent_no_longer_on_chrome 2012/05/04 22:42:22 FYI, this line fixes browser test failures I was g
+ doStringify = true;
+ var requestArgs = doStringify ?
+ chromeHidden.JSON.stringify(request.args) : request.args;
var nativeFunction = opt_args.nativeFunction || natives.StartRequest;
var requestId = natives.GetNextRequestId();
@@ -116,7 +121,7 @@ function sendRequest(functionName, args, argSchemas, opt_args) {
requests[requestId] = request;
var hasCallback =
(request.callback || opt_args.customCallback) ? true : false;
- return nativeFunction(functionName, sargs, requestId, hasCallback,
+ return nativeFunction(functionName, requestArgs, requestId, hasCallback,
opt_args.forIOThread);
}

Powered by Google App Engine
This is Rietveld 408576698