Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 onActivated: new ext._EventTarget(), | 103 onActivated: new ext._EventTarget(), |
104 onRemoved: new ext._EventTarget() | 104 onRemoved: new ext._EventTarget() |
105 }; | 105 }; |
106 | 106 |
107 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) | 107 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) |
108 { | 108 { |
109 if (changeInfo.status == "loading") | 109 if (changeInfo.status == "loading") |
110 ext.pages.onLoading._dispatch(new Page(tab)); | 110 ext.pages.onLoading._dispatch(new Page(tab)); |
111 }); | 111 }); |
112 | 112 |
113 function createFrame(tabId, frameId) | 113 function createFrame(tabId, frameId) |
Sebastian Noack
2016/09/09 14:39:51
The changes here are due to rebasing.
kzar
2016/09/13 12:30:01
Acknowledged.
| |
114 { | 114 { |
115 var frames = framesOfTabs[tabId]; | 115 var frames = framesOfTabs[tabId]; |
116 if (!frames) | 116 if (!frames) |
117 frames = framesOfTabs[tabId] = Object.create(null); | 117 frames = framesOfTabs[tabId] = Object.create(null); |
118 | 118 |
119 var frame = frames[frameId]; | 119 var frame = frames[frameId]; |
120 if (!frame) | 120 if (!frame) |
121 frame = frames[frameId] = {}; | 121 frame = frames[frameId] = {}; |
122 | 122 |
123 return frame; | 123 return frame; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
476 if (parentFrameId != -1) | 476 if (parentFrameId != -1) |
477 frames[details[i].frameId].parent = frames[parentFrameId]; | 477 frames[details[i].frameId].parent = frames[parentFrameId]; |
478 } | 478 } |
479 } | 479 } |
480 }); | 480 }); |
481 }); | 481 }); |
482 }); | 482 }); |
483 | 483 |
484 chrome.webRequest.onBeforeRequest.addListener(function(details) | 484 chrome.webRequest.onBeforeRequest.addListener(function(details) |
485 { | 485 { |
486 // the high-level code isn't interested in requests that aren't | 486 // The high-level code isn't interested in requests that aren't |
487 // related to a tab or requests loading a top-level document, | 487 // related to a tab or requests loading a top-level document, |
488 // those should never be blocked | 488 // those should never be blocked. |
489 if (details.tabId == -1 || details.type == "main_frame") | 489 if (details.tabId == -1 || details.type == "main_frame") |
490 return; | 490 return; |
491 | 491 |
492 // we are looking for the frame that contains the element that | 492 // We are looking for the frame that contains the element which |
493 // is about to load, however if a frame is loading the surrounding | 493 // has triggered this request. For most requests (e.g. images) we |
494 // frame is indicated by parentFrameId instead of frameId | 494 // can just use the request's frame ID, but for subdocument requests |
495 // (e.g. iframes) we must instead use the request's parent frame ID. | |
495 var frameId; | 496 var frameId; |
496 var requestType; | 497 var requestType; |
497 if (details.type == "sub_frame") | 498 if (details.type == "sub_frame") |
498 { | 499 { |
499 frameId = details.parentFrameId; | 500 frameId = details.parentFrameId; |
500 requestType = "SUBDOCUMENT"; | 501 requestType = "SUBDOCUMENT"; |
501 } | 502 } |
502 else | 503 else |
503 { | 504 { |
504 frameId = details.frameId; | 505 frameId = details.frameId; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 ext.windows = { | 627 ext.windows = { |
627 create: function(createData, callback) | 628 create: function(createData, callback) |
628 { | 629 { |
629 chrome.windows.create(createData, function(createdWindow) | 630 chrome.windows.create(createData, function(createdWindow) |
630 { | 631 { |
631 afterTabLoaded(callback)(createdWindow.tabs[0]); | 632 afterTabLoaded(callback)(createdWindow.tabs[0]); |
632 }); | 633 }); |
633 } | 634 } |
634 }; | 635 }; |
635 })(); | 636 })(); |
LEFT | RIGHT |