Index: ext/content.js |
=================================================================== |
--- a/ext/content.js |
+++ b/ext/content.js |
@@ -45,17 +45,20 @@ |
window.addEventListener("message", loadHandler, false); |
global.ext.backgroundPage = { |
+ _sendRawMessage: function(message) |
+ { |
+ if (messageQueue) |
+ messageQueue.push(message); |
+ else |
+ backgroundFrame.contentWindow.postMessage(message, "*"); |
+ }, |
sendMessage: function(message, responseCallback) |
{ |
- var rawMessage = { |
+ this._sendRawMessage({ |
type: "message", |
messageId: ++maxMessageId, |
payload: message |
- }; |
- if (messageQueue) |
- messageQueue.push(rawMessage); |
- else |
- backgroundFrame.contentWindow.postMessage(rawMessage, "*"); |
+ }); |
if (responseCallback) |
{ |