OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
| 3 if ((typeof chrome == "undefined") || (typeof chrome.extension == "undefined")
) |
| 4 chrome = browser; |
3 var backgroundPage = chrome.extension.getBackgroundPage(); | 5 var backgroundPage = chrome.extension.getBackgroundPage(); |
4 window.ext = Object.create(backgroundPage.ext); | 6 window.ext = Object.create(backgroundPage.ext); |
5 | 7 |
6 ext.closePopup = function() | 8 ext.closePopup = function() |
7 { | 9 { |
8 window.close(); | 10 window.close(); |
9 }; | 11 }; |
10 | 12 |
11 // We have to override ext.backgroundPage, because in order | 13 // We have to override ext.backgroundPage, because in order |
12 // to send messages the local "chrome" namespace must be used. | 14 // to send messages the local "chrome" namespace must be used. |
13 ext.backgroundPage = { | 15 ext.backgroundPage = { |
14 sendMessage: chrome.runtime.sendMessage, | 16 sendMessage: chrome.runtime.sendMessage, |
15 | 17 |
16 getWindow: function() | 18 getWindow: function() |
17 { | 19 { |
18 return backgroundPage; | 20 return backgroundPage; |
19 } | 21 } |
20 }; | 22 }; |
21 })(); | 23 })(); |
OLD | NEW |