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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 chrome.runtime.onMessage.addListener(function(message, rawSender, sendResponse
) | 494 chrome.runtime.onMessage.addListener(function(message, rawSender, sendResponse
) |
495 { | 495 { |
496 var sender = {}; | 496 var sender = {}; |
497 | 497 |
498 // Add "page" and "frame" if the message was sent by a content script. | 498 // Add "page" and "frame" if the message was sent by a content script. |
499 // If sent by popup or the background page itself, there is no "tab". | 499 // If sent by popup or the background page itself, there is no "tab". |
500 if ("tab" in rawSender) | 500 if ("tab" in rawSender) |
501 { | 501 { |
502 sender.page = new Page(rawSender.tab); | 502 sender.page = new Page(rawSender.tab); |
503 sender.frame = { | 503 sender.frame = { |
504 url: new URL(rawSender.url), | 504 url: rawSender.url ? new URL(rawSender.url): '', |
505 get parent() | 505 get parent() |
506 { | 506 { |
507 var frames = framesOfTabs[rawSender.tab.id]; | 507 var frames = framesOfTabs[rawSender.tab.id]; |
508 | 508 |
509 if (!frames) | 509 if (!frames) |
510 return null; | 510 return null; |
511 | 511 |
512 if ("frameId" in rawSender) | 512 if ("frameId" in rawSender) |
513 { | 513 { |
514 // Chrome 41+ | 514 // Chrome 41+ |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 afterTabLoaded(callback)(createdWindow.tabs[0]); | 600 afterTabLoaded(callback)(createdWindow.tabs[0]); |
601 }); | 601 }); |
602 } | 602 } |
603 else | 603 else |
604 { | 604 { |
605 ext.pages.open(createData.url, callback); | 605 ext.pages.open(createData.url, callback); |
606 } | 606 } |
607 } | 607 } |
608 }; | 608 }; |
609 })(); | 609 })(); |
OLD | NEW |