OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <body> |
| 4 This is a body |
| 5 <span id="status"></span> |
| 6 </body> |
| 7 <script> |
| 8 var error = ''; |
| 9 var addError = function(newError) { |
| 10 error += newError; |
| 11 var status = error.length == 0 ? 'success' : error; |
| 12 document.getElementById('status').textContent = status; |
| 13 }; |
| 14 |
| 15 Object.defineProperty(Object.prototype, |
| 16 'handleResponse', |
| 17 {configurable: true, set: function(v) { |
| 18 addError('Intercepted handleResponse\n'); |
| 19 Object.defineProperty( |
| 20 this, "handleResponse", {configurable: true, value: v}); |
| 21 }}); |
| 22 |
| 23 Object.defineProperty(Object.prototype, |
| 24 "$set", |
| 25 {configurable: true, set: function(v) { |
| 26 addError('Intercepted $set\n'); |
| 27 Object.defineProperty(this, "$set", {configurable: true, value: v}); |
| 28 }}); |
| 29 |
| 30 Object.defineProperty(Object.prototype, |
| 31 "clear", |
| 32 {configurable: true, set: function(v) { |
| 33 addError('Intercepted clear\n'); |
| 34 Object.defineProperty(this, 'clear', {configurable: true, value: v}); |
| 35 }}); |
| 36 |
| 37 // Bindings are lazily initialized. Poke it. |
| 38 chrome.runtime; |
| 39 // If the runtime bindings aren't created, we didn't test anything. |
| 40 if (!chrome.runtime) |
| 41 addError('chrome.runtime was not created.\n'); |
| 42 |
| 43 addError(''); |
| 44 </script> |
OLD | NEW |