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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 if (url.protocol != "http:" && url.protocol != "https:" && | 578 if (url.protocol != "http:" && url.protocol != "https:" && |
579 url.protocol != "ws:" && url.protocol != "wss:") | 579 url.protocol != "ws:" && url.protocol != "wss:") |
580 return; | 580 return; |
581 | 581 |
582 // We are looking for the frame that contains the element which | 582 // We are looking for the frame that contains the element which |
583 // has triggered this request. For most requests (e.g. images) we | 583 // has triggered this request. For most requests (e.g. images) we |
584 // can just use the request's frame ID, but for subdocument requests | 584 // can just use the request's frame ID, but for subdocument requests |
585 // (e.g. iframes) we must instead use the request's parent frame ID. | 585 // (e.g. iframes) we must instead use the request's parent frame ID. |
586 let {frameId, type} = details; | 586 let {frameId, type} = details; |
587 if (type == "sub_frame") | 587 if (type == "sub_frame") |
588 { | |
589 frameId = details.parentFrameId; | 588 frameId = details.parentFrameId; |
590 type = "SUBDOCUMENT"; | |
591 } | |
592 | 589 |
593 let frame = ext.getFrame(details.tabId, frameId); | 590 let frame = ext.getFrame(details.tabId, frameId); |
594 if (frame) | 591 if (frame) |
595 { | 592 { |
596 let results = ext.webRequest.onBeforeRequest._dispatch( | 593 let results = ext.webRequest.onBeforeRequest._dispatch( |
597 url, type.toUpperCase(), new Page({id: details.tabId}), frame | 594 url, type, new Page({id: details.tabId}), frame |
598 ); | 595 ); |
599 | 596 |
600 if (results.indexOf(false) != -1) | 597 if (results.indexOf(false) != -1) |
601 return {cancel: true}; | 598 return {cancel: true}; |
602 } | 599 } |
603 }, {urls: ["<all_urls>"]}, ["blocking"]); | 600 }, {urls: ["<all_urls>"]}, ["blocking"]); |
604 | 601 |
605 | 602 |
606 /* Message passing */ | 603 /* Message passing */ |
607 | 604 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 ext.windows = { | 728 ext.windows = { |
732 create(createData, callback) | 729 create(createData, callback) |
733 { | 730 { |
734 chrome.windows.create(createData, createdWindow => | 731 chrome.windows.create(createData, createdWindow => |
735 { | 732 { |
736 afterTabLoaded(callback)(createdWindow.tabs[0]); | 733 afterTabLoaded(callback)(createdWindow.tabs[0]); |
737 }); | 734 }); |
738 } | 735 } |
739 }; | 736 }; |
740 }()); | 737 }()); |
OLD | NEW |