3 <script src=
"../http/tests/inspector/inspector-test.js"></script>
8 var object
= [6, 28, 496];
9 var localObject
= WebInspector
.RemoteObject
.fromLocalObject(object
);
11 function getItem(index
)
16 function getItemCallback(result
)
18 InspectorTest
.addResult("getItem(1) result: " + result
);
21 function compareAndSwap(index
, value
, newValue
)
23 if (this[index
] !== value
)
24 throw "Data corrupted";
25 this[index
] = newValue
;
29 function compareAndSwapCallback(result
, wasThrown
)
31 InspectorTest
.addResult("compareAndSwap(1, 28, 42) result: " + result
.description
);
34 function exceptionCallback(result
, wasThrown
)
36 InspectorTest
.addResult("compareAndSwap(1, 28, 42) throws exception: " + wasThrown
);
44 function guessWhatCallback(result
, wasThrown
)
46 InspectorTest
.addResult("guessWhat() result: " + result
.description
);
49 localObject
.callFunctionJSON(getItem
, [{value
: 1}], getItemCallback
);
50 localObject
.callFunction(compareAndSwap
, [{value
: 1}, {value
: 28}, {value
: 42}], compareAndSwapCallback
);
51 localObject
.callFunction(compareAndSwap
, [{value
: 1}, {value
: 28}, {value
: 42}], exceptionCallback
);
52 localObject
.callFunction(guessWhat
, undefined, guessWhatCallback
);
53 localObject
.callFunction(compareAndSwap
, [{value
: 0}, {value
: 6}, {value
: 7}]);
54 InspectorTest
.addResult("Final value of object: [" + object
.join(", ") + "]");
55 InspectorTest
.completeTest();
61 <body onload=
"runTest()">
62 <p>Tests callFunction on local remote objects.
</p>