| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../http/tests/inspector/inspector-test.js"></script> |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 function test() | 6 function test() |
| 7 { | 7 { |
| 8 var object = [6, 28, 496]; | 8 var object = [6, 28, 496]; |
| 9 var localObject = WebInspector.RemoteObject.fromLocalObject(object); | 9 var localObject = WebInspector.RemoteObject.fromLocalObject(object); |
| 10 | 10 |
| 11 function getItem(index) | 11 function getItem(index) |
| 12 { | 12 { |
| 13 return this[index]; | 13 return this[index]; |
| 14 } | 14 } |
| 15 | 15 |
| 16 function getItemCallback(result) | 16 function getItemCallback(result) |
| 17 { | 17 { |
| 18 InspectorTest.addResult("getItem(1) result: " + result); | 18 InspectorTest.addResult("getItem(1) result: " + result); |
| 19 } | 19 } |
| 20 | 20 |
| 21 function compareAndSwap(index, value, newValue) | 21 function compareAndSwap(index, value, newValue) |
| 22 { | 22 { |
| 23 if (this[index] !== value) | 23 if (this[index] !== value) |
| 24 throw "Data corrupted"; | 24 throw "Data corrupted"; |
| 25 this[index] = newValue; | 25 this[index] = newValue; |
| 26 return "Done"; | 26 return "Done"; |
| 27 } | 27 } |
| 28 | 28 |
| 29 function compareAndSwapCallback(result, wasThrown) | 29 function compareAndSwapCallback(result) |
| 30 { | 30 { |
| 31 InspectorTest.addResult("compareAndSwap(1, 28, 42) result: " + result.de
scription); | 31 InspectorTest.addResult("compareAndSwap(1, 28, 42) result: " + result.de
scription); |
| 32 } | 32 } |
| 33 | 33 |
| 34 function exceptionCallback(result, wasThrown) | 34 function exceptionCallback(result, exceptionDetails) |
| 35 { | 35 { |
| 36 InspectorTest.addResult("compareAndSwap(1, 28, 42) throws exception: " +
wasThrown); | 36 InspectorTest.addResult("compareAndSwap(1, 28, 42) throws exception: " +
!!exceptionDetails); |
| 37 } | 37 } |
| 38 | 38 |
| 39 function guessWhat() | 39 function guessWhat() |
| 40 { | 40 { |
| 41 return 42; | 41 return 42; |
| 42 } | 42 } |
| 43 | 43 |
| 44 function guessWhatCallback(result, wasThrown) | 44 function guessWhatCallback(result) |
| 45 { | 45 { |
| 46 InspectorTest.addResult("guessWhat() result: " + result.description); | 46 InspectorTest.addResult("guessWhat() result: " + result.description); |
| 47 } | 47 } |
| 48 | 48 |
| 49 localObject.callFunctionJSON(getItem, [{value: 1}], getItemCallback); | 49 localObject.callFunctionJSON(getItem, [{value: 1}], getItemCallback); |
| 50 localObject.callFunction(compareAndSwap, [{value: 1}, {value: 28}, {value: 4
2}], compareAndSwapCallback); | 50 localObject.callFunction(compareAndSwap, [{value: 1}, {value: 28}, {value: 4
2}], compareAndSwapCallback); |
| 51 localObject.callFunction(compareAndSwap, [{value: 1}, {value: 28}, {value: 4
2}], exceptionCallback); | 51 localObject.callFunction(compareAndSwap, [{value: 1}, {value: 28}, {value: 4
2}], exceptionCallback); |
| 52 localObject.callFunction(guessWhat, undefined, guessWhatCallback); | 52 localObject.callFunction(guessWhat, undefined, guessWhatCallback); |
| 53 localObject.callFunction(compareAndSwap, [{value: 0}, {value: 6}, {value: 7}
]); | 53 localObject.callFunction(compareAndSwap, [{value: 0}, {value: 6}, {value: 7}
]); |
| 54 InspectorTest.addResult("Final value of object: [" + object.join(", ") + "]"
); | 54 InspectorTest.addResult("Final value of object: [" + object.join(", ") + "]"
); |
| 55 InspectorTest.completeTest(); | 55 InspectorTest.completeTest(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 </script> | 58 </script> |
| 59 </head> | 59 </head> |
| 60 | 60 |
| 61 <body onload="runTest()"> | 61 <body onload="runTest()"> |
| 62 <p>Tests callFunction on local remote objects.</p> | 62 <p>Tests callFunction on local remote objects.</p> |
| 63 </body> | 63 </body> |
| 64 </html> | 64 </html> |
| OLD | NEW |