blob: 404779a621d843d69f1498cd9a88790eae437be7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Injects 'injected' object into the inspectable page.
*/
/**
* Dispatches host calls into the injected function calls.
*/
goog.require('devtools.Injected');
/**
* Injected singleton.
*/
var devtools$$obj = new devtools.Injected();
/**
* Main dispatch method, all calls from the host go through this one.
* @param {string} functionName Function to call
* @param {Node} node Node context of the call.
* @param {string} json_args JSON-serialized call parameters.
* @return {string} JSON-serialized result of the dispatched call.
*/
function devtools$$dispatch(functionName, node, json_args) {
var params = JSON.parse(json_args);
params.splice(0, 0, node);
var result = devtools$$obj[functionName].apply(devtools$$obj, params);
return JSON.stringify(result);
};
/**
* This is called by the InspectorFrontend for serialization.
* We serialize the call and send it to the client over the IPC
* using dispatchOut bound method.
*/
var dispatch = function(method, var_args) {
// Handle all messages with non-primitieve arguments here.
// TODO(pfeldman): Add more.
if (method == 'inspectedWindowCleared') {
return;
}
var call = JSON.stringify(Array.prototype.slice.call(arguments));
RemoteWebInspector.dispatch(call);
};
|