OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // but sometimes we only have the tab id when we create a Page object. | 88 // but sometimes we only have the tab id when we create a Page object. |
89 // In that case we get the url from top frame of the tab, recorded by | 89 // In that case we get the url from top frame of the tab, recorded by |
90 // the onBeforeRequest handler. | 90 // the onBeforeRequest handler. |
91 let frames = framesOfTabs.get(this.id); | 91 let frames = framesOfTabs.get(this.id); |
92 if (frames) | 92 if (frames) |
93 { | 93 { |
94 let frame = frames.get(0); | 94 let frame = frames.get(0); |
95 if (frame) | 95 if (frame) |
96 return frame.url; | 96 return frame.url; |
97 } | 97 } |
| 98 |
| 99 return undefined; |
98 }, | 100 }, |
99 sendMessage(message, responseCallback) | 101 sendMessage(message, responseCallback) |
100 { | 102 { |
101 browser.tabs.sendMessage(this.id, message, responseCallback); | 103 browser.tabs.sendMessage(this.id, message, responseCallback); |
102 } | 104 } |
103 }; | 105 }; |
104 | 106 |
105 ext.getPage = id => new Page({id: parseInt(id, 10)}); | 107 ext.getPage = id => new Page({id: parseInt(id, 10)}); |
106 | 108 |
107 ext.pages = { | 109 ext.pages = { |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 return frames.get(0) || null; | 601 return frames.get(0) || null; |
600 } | 602 } |
601 }; | 603 }; |
602 } | 604 } |
603 | 605 |
604 return ext.onMessage._dispatch( | 606 return ext.onMessage._dispatch( |
605 message, sender, sendResponse | 607 message, sender, sendResponse |
606 ).includes(true); | 608 ).includes(true); |
607 }); | 609 }); |
608 } | 610 } |
OLD | NEW |