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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 frame = frames[frameId] = {}; | 121 frame = frames[frameId] = {}; |
122 | 122 |
123 return frame; | 123 return frame; |
124 } | 124 } |
125 | 125 |
126 chrome.webNavigation.onBeforeNavigate.addListener(function(details) | 126 chrome.webNavigation.onBeforeNavigate.addListener(function(details) |
127 { | 127 { |
128 // Capture parent frame here because onCommitted doesn't get this info. | 128 // Capture parent frame here because onCommitted doesn't get this info. |
129 var frame = createFrame(details.tabId, details.frameId); | 129 var frame = createFrame(details.tabId, details.frameId); |
130 frame.parent = framesOfTabs[details.tabId][details.parentFrameId] || null; | 130 frame.parent = framesOfTabs[details.tabId][details.parentFrameId] || null; |
| 131 |
| 132 // Frames are assumed to always have a URL, so for new frames it's better to |
| 133 // record the URL now. Otherwise requests new frames make before their |
| 134 // onCommitted event fires won't be subject to blocking and will cause |
| 135 // exceptions. |
| 136 if (!("url" in frame)) |
| 137 frame.url = new URL(details.url); |
131 }); | 138 }); |
132 | 139 |
133 var eagerlyUpdatedPages = new ext.PageMap(); | 140 var eagerlyUpdatedPages = new ext.PageMap(); |
134 | 141 |
135 ext._updatePageFrameStructure = function(frameId, tabId, url, eager) | 142 ext._updatePageFrameStructure = function(frameId, tabId, url, eager) |
136 { | 143 { |
137 if (frameId == 0) | 144 if (frameId == 0) |
138 { | 145 { |
139 let page = new Page({id: tabId, url: url}); | 146 let page = new Page({id: tabId, url: url}); |
140 | 147 |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 ext.windows = { | 646 ext.windows = { |
640 create: function(createData, callback) | 647 create: function(createData, callback) |
641 { | 648 { |
642 chrome.windows.create(createData, function(createdWindow) | 649 chrome.windows.create(createData, function(createdWindow) |
643 { | 650 { |
644 afterTabLoaded(callback)(createdWindow.tabs[0]); | 651 afterTabLoaded(callback)(createdWindow.tabs[0]); |
645 }); | 652 }); |
646 } | 653 } |
647 }; | 654 }; |
648 })(); | 655 })(); |
OLD | NEW |