| 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 23 matching lines...) Expand all Loading... |
| 34 { | 34 { |
| 35 return Object.keys(panels).length > 0; | 35 return Object.keys(panels).length > 0; |
| 36 } | 36 } |
| 37 | 37 |
| 38 function getActivePanel(page) | 38 function getActivePanel(page) |
| 39 { | 39 { |
| 40 let panel = panels[page._id]; | 40 let panel = panels[page._id]; |
| 41 if(panel && !panel.reload && !panel.reloading) | 41 if(panel && !panel.reload && !panel.reloading) |
| 42 return panel; | 42 return panel; |
| 43 return null; | 43 return null; |
| 44 } | |
| 45 | |
| 46 function getRequestInfo(request) | |
| 47 { | |
| 48 return { | |
| 49 url: request.url, | |
| 50 type: request.type, | |
| 51 docDomain: request.docDomain | |
| 52 }; | |
| 53 } | 44 } |
| 54 | 45 |
| 55 function getFilterInfo(filter) | 46 function getFilterInfo(filter) |
| 56 { | 47 { |
| 57 if (!filter) | 48 if (!filter) |
| 58 return null; | 49 return null; |
| 59 | 50 |
| 60 let userDefined = false; | 51 let userDefined = false; |
| 61 let subscriptionTitle = null; | 52 let subscriptionTitle = null; |
| 62 | 53 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 (record.filter && record.filter.selector) == (filter && filter.selector) | 86 (record.filter && record.filter.selector) == (filter && filter.selector) |
| 96 ); | 87 ); |
| 97 } | 88 } |
| 98 | 89 |
| 99 function addRecord(panel, request, filter) | 90 function addRecord(panel, request, filter) |
| 100 { | 91 { |
| 101 if (!hasRecord(panel, request, filter)) | 92 if (!hasRecord(panel, request, filter)) |
| 102 { | 93 { |
| 103 panel.port.postMessage({ | 94 panel.port.postMessage({ |
| 104 type: "add-record", | 95 type: "add-record", |
| 105 request: getRequestInfo(request), | 96 request: request, |
| 106 filter: getFilterInfo(filter) | 97 filter: getFilterInfo(filter) |
| 107 }); | 98 }); |
| 108 | 99 |
| 109 panel.records.push({ | 100 panel.records.push({ |
| 110 request: request, | 101 request: request, |
| 111 filter: filter | 102 filter: filter |
| 112 }); | 103 }); |
| 113 } | 104 } |
| 114 } | 105 } |
| 115 | 106 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 panel.records.splice(i--, 1); | 328 panel.records.splice(i--, 1); |
| 338 continue; | 329 continue; |
| 339 } | 330 } |
| 340 | 331 |
| 341 record.filter = matchRequest(record.request); | 332 record.filter = matchRequest(record.request); |
| 342 } | 333 } |
| 343 | 334 |
| 344 panel.port.postMessage({ | 335 panel.port.postMessage({ |
| 345 type: "update-record", | 336 type: "update-record", |
| 346 index: i, | 337 index: i, |
| 347 request: getRequestInfo(record.request), | 338 request: record.request, |
| 348 filter: getFilterInfo(record.filter) | 339 filter: getFilterInfo(record.filter) |
| 349 }); | 340 }); |
| 350 } | 341 } |
| 351 } | 342 } |
| 352 } | 343 } |
| 353 | 344 |
| 354 chrome.runtime.onConnect.addListener(port => | 345 chrome.runtime.onConnect.addListener(port => |
| 355 { | 346 { |
| 356 let match = port.name.match(/^devtools-(\d+)$/); | 347 let match = port.name.match(/^devtools-(\d+)$/); |
| 357 if (!match) | 348 if (!match) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 382 | 373 |
| 383 if (!hasPanels()) | 374 if (!hasPanels()) |
| 384 { | 375 { |
| 385 FilterNotifier.removeListener(onFilterChange); | 376 FilterNotifier.removeListener(onFilterChange); |
| 386 ext.pages.onLoading.removeListener(onLoading); | 377 ext.pages.onLoading.removeListener(onLoading); |
| 387 } | 378 } |
| 388 }); | 379 }); |
| 389 | 380 |
| 390 panels[inspectedTabId] = {port: port, records: []}; | 381 panels[inspectedTabId] = {port: port, records: []}; |
| 391 }); | 382 }); |
| LEFT | RIGHT |