OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 event.message = ext.webRequest.onBeforeRequest._dispatch( | 608 event.message = ext.webRequest.onBeforeRequest._dispatch( |
609 event.message.url, | 609 event.message.url, |
610 event.message.type, | 610 event.message.type, |
611 page, | 611 page, |
612 page._frames[event.message.frameId] | 612 page._frames[event.message.frameId] |
613 ); | 613 ); |
614 break; | 614 break; |
615 case "proxy": | 615 case "proxy": |
616 event.message = backgroundPageProxy.handleMessage(event.message); | 616 event.message = backgroundPageProxy.handleMessage(event.message); |
617 break; | 617 break; |
| 618 case "request": |
| 619 var page = pages[event.message.pageId]; |
| 620 var sender = {page: page, frame: page._frames[event.message.frameId]
}; |
| 621 |
| 622 var response = null; |
| 623 var sendResponse = function(message) { response = message; }; |
| 624 |
| 625 ext.onMessage._dispatch(event.message.payload, sender, sendResponse)
; |
| 626 |
| 627 event.message = response; |
| 628 break; |
618 } | 629 } |
619 break; | 630 break; |
620 case "request": | 631 case "request": |
621 var page = pages[event.message.pageId]; | 632 var page = pages[event.message.pageId]; |
622 var sender = {page: page, frame: page._frames[event.message.frameId]}; | 633 var sender = {page: page, frame: page._frames[event.message.frameId]}; |
623 page._messageProxy.handleRequest(event.message, sender); | 634 page._messageProxy.handleRequest(event.message, sender); |
624 break; | 635 break; |
625 case "response": | 636 case "response": |
626 pages[event.message.pageId]._messageProxy.handleResponse(event.message); | 637 pages[event.message.pageId]._messageProxy.handleResponse(event.message); |
627 break; | 638 break; |
628 case "replaced": | 639 case "replaced": |
629 // when a prerendered page is shown, forget the previous page | 640 // when a prerendered page is shown, forget the previous page |
630 // associated with its tab, and reset the toolbar item if necessary. | 641 // associated with its tab, and reset the toolbar item if necessary. |
631 // Note that it wouldn't be sufficient to do that when the old | 642 // Note that it wouldn't be sufficient to do that when the old |
632 // page is unloading, because Safari dispatches window.onunload | 643 // page is unloading, because Safari dispatches window.onunload |
633 // only when reloading the page or following links, but not when | 644 // only when reloading the page or following links, but not when |
634 // the current page is replaced with a prerendered page. | 645 // the current page is replaced with a prerendered page. |
635 replacePage(pages[event.message.pageId]); | 646 replacePage(pages[event.message.pageId]); |
636 break; | 647 break; |
637 } | 648 } |
638 }); | 649 }); |
639 | 650 |
640 | 651 |
641 /* Storage */ | 652 /* Storage */ |
642 | 653 |
643 ext.storage = safari.extension.settings; | 654 ext.storage = safari.extension.settings; |
644 })(); | 655 })(); |
OLD | NEW |