summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/resources/extensions/send_request.js
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/resources/extensions/send_request.js')
-rw-r--r--chrome/renderer/resources/extensions/send_request.js31
1 files changed, 12 insertions, 19 deletions
diff --git a/chrome/renderer/resources/extensions/send_request.js b/chrome/renderer/resources/extensions/send_request.js
index dacf4af..1d7231f 100644
--- a/chrome/renderer/resources/extensions/send_request.js
+++ b/chrome/renderer/resources/extensions/send_request.js
@@ -77,7 +77,7 @@ function prepareRequest(args, argSchemas) {
}
// Send an API request and optionally register a callback.
-// |optArgs| is an object with optional parameters as follows:
+// |opt_args| is an object with optional parameters as follows:
// - noStringify: true if we should not stringify the request arguments.
// - customCallback: a callback that should be called instead of the standard
// callback.
@@ -85,15 +85,12 @@ function prepareRequest(args, argSchemas) {
// StartRequest if missing.
// - forIOThread: true if this function should be handled on the browser IO
// thread.
-// - preserveNullInObjects: true if it is safe for null to be in objects.
-// - allowFunctionsInObjects: true if functions should be converted to
-// empty objects (apart from the callback parameter!).
-function sendRequest(functionName, args, argSchemas, optArgs) {
- if (!optArgs)
- optArgs = {};
+function sendRequest(functionName, args, argSchemas, opt_args) {
+ if (!opt_args)
+ opt_args = {};
var request = prepareRequest(args, argSchemas);
- if (optArgs.customCallback) {
- request.customCallback = optArgs.customCallback;
+ if (opt_args.customCallback) {
+ request.customCallback = opt_args.customCallback;
}
// JSON.stringify doesn't support a root object which is undefined.
if (request.args === undefined)
@@ -102,23 +99,19 @@ function sendRequest(functionName, args, argSchemas, optArgs) {
// TODO(asargent) - convert all optional native functions to accept raw
// v8 values instead of expecting JSON strings.
var doStringify = false;
- if (optArgs.nativeFunction && !optArgs.noStringify)
+ if (opt_args.nativeFunction && !opt_args.noStringify)
doStringify = true;
var requestArgs = doStringify ?
chromeHidden.JSON.stringify(request.args) : request.args;
- var nativeFunction = optArgs.nativeFunction || natives.StartRequest;
+ var nativeFunction = opt_args.nativeFunction || natives.StartRequest;
var requestId = natives.GetNextRequestId();
request.id = requestId;
requests[requestId] = request;
- var hasCallback = request.callback || optArgs.customCallback;
- return nativeFunction(functionName,
- requestArgs,
- requestId,
- hasCallback,
- optArgs.forIOThread,
- optArgs.preserveNullInObjects,
- optArgs.allowFunctionsInObjects);
+ var hasCallback =
+ (request.callback || opt_args.customCallback) ? true : false;
+ return nativeFunction(functionName, requestArgs, requestId, hasCallback,
+ opt_args.forIOThread);
}
exports.sendRequest = sendRequest;