| <html> |
| <head> |
| <script src="../http/tests/inspector/inspector-test.js"></script> |
| <script> |
| |
| function test() |
| { |
| var object = [6, 28, 496]; |
| var localObject = WebInspector.RemoteObject.fromLocalObject(object); |
| |
| function getItem(index) |
| { |
| return this[index]; |
| } |
| |
| function getItemCallback(result) |
| { |
| InspectorTest.addResult("getItem(1) result: " + result); |
| } |
| |
| function compareAndSwap(index, value, newValue) |
| { |
| if (this[index] !== value) |
| throw "Data corrupted"; |
| this[index] = newValue; |
| return "Done"; |
| } |
| |
| function compareAndSwapCallback(result, wasThrown) |
| { |
| InspectorTest.addResult("compareAndSwap(1, 28, 42) result: " + result.description); |
| } |
| |
| function exceptionCallback(result, wasThrown) |
| { |
| InspectorTest.addResult("compareAndSwap(1, 28, 42) throws exception: " + wasThrown); |
| } |
| |
| function guessWhat() |
| { |
| return 42; |
| } |
| |
| function guessWhatCallback(result, wasThrown) |
| { |
| InspectorTest.addResult("guessWhat() result: " + result.description); |
| } |
| |
| localObject.callFunctionJSON(getItem, [{value: 1}], getItemCallback); |
| localObject.callFunction(compareAndSwap, [{value: 1}, {value: 28}, {value: 42}], compareAndSwapCallback); |
| localObject.callFunction(compareAndSwap, [{value: 1}, {value: 28}, {value: 42}], exceptionCallback); |
| localObject.callFunction(guessWhat, undefined, guessWhatCallback); |
| localObject.callFunction(compareAndSwap, [{value: 0}, {value: 6}, {value: 7}]); |
| InspectorTest.addResult("Final value of object: [" + object.join(", ") + "]"); |
| InspectorTest.completeTest(); |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <p>Tests callFunction on local remote objects.</p> |
| </body> |
| </html> |