| OLD | NEW |
| 1 JSON.parse = function() { |
| 2 return "JSON.parse clobbered by content script."; |
| 3 } |
| 4 |
| 5 JSON.stringify = function() { |
| 6 return "JSON.stringify clobbered by content script."; |
| 7 } |
| 8 |
| 9 Array.prototype.toJSON = function() { |
| 10 return "Array.prototype.toJSON clobbered by content script."; |
| 11 } |
| 12 |
| 13 Object.prototype.toJSON = function() { |
| 14 return "Object.prototype.toJSON clobbered by content script."; |
| 15 } |
| 16 |
| 1 // For complex connect tests. | 17 // For complex connect tests. |
| 2 chrome.extension.onConnect.addListener(function(port) { | 18 chrome.extension.onConnect.addListener(function(port) { |
| 3 console.log('connected'); | 19 console.log('connected'); |
| 4 port.onMessage.addListener(function(msg) { | 20 port.onMessage.addListener(function(msg) { |
| 5 console.log('got ' + msg); | 21 console.log('got ' + msg); |
| 6 if (msg.testPostMessage) { | 22 if (msg.testPostMessage) { |
| 7 port.postMessage({success: true}); | 23 port.postMessage({success: true}); |
| 8 } else if (msg.testPostMessageFromTab) { | 24 } else if (msg.testPostMessageFromTab) { |
| 9 testPostMessageFromTab(port); | 25 testPostMessageFromTab(port); |
| 10 } else if (msg.testSendRequestFromTab) { | 26 } else if (msg.testSendRequestFromTab) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 console.log('testSendRequestFromTab sent'); | 54 console.log('testSendRequestFromTab sent'); |
| 39 chrome.extension.sendRequest({step: 2}); | 55 chrome.extension.sendRequest({step: 2}); |
| 40 } | 56 } |
| 41 }); | 57 }); |
| 42 } | 58 } |
| 43 | 59 |
| 44 // For test sendRequest. | 60 // For test sendRequest. |
| 45 chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { | 61 chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { |
| 46 sendResponse({success: (request.step2 == 1)}); | 62 sendResponse({success: (request.step2 == 1)}); |
| 47 }); | 63 }); |
| OLD | NEW |