| Left: | ||
| Right: |
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 // In Edge requests from internal extension pages | 552 // In Edge requests from internal extension pages |
| 553 // (protocol ms-browser-extension://) do no have a sender URL. | 553 // (protocol ms-browser-extension://) do no have a sender URL. |
| 554 url: rawSender.url ? new URL(rawSender.url) : null, | 554 url: rawSender.url ? new URL(rawSender.url) : null, |
| 555 get parent() | 555 get parent() |
| 556 { | 556 { |
| 557 let frames = framesOfTabs.get(rawSender.tab.id); | 557 let frames = framesOfTabs.get(rawSender.tab.id); |
| 558 | 558 |
| 559 if (!frames) | 559 if (!frames) |
| 560 return null; | 560 return null; |
| 561 | 561 |
| 562 let frame = frames.get(rawSender.frameId); | 562 let frame; |
| 563 // In Microsoft Edge (version 42.17134.1.0) we don't have frameId | |
| 564 // so we fall back to iterating over the tab's frames | |
| 565 // see https://developer.microsoft.com/en-us/microsoft-edge/platform/i ssues/11716733 | |
| 566 if (rawSender.frameId != undefined) | |
| 567 frame = frames.get(rawSender.frameId); | |
| 568 else | |
| 569 { | |
| 570 let rawSenderHref = rawSender.url ? | |
|
Sebastian Noack
2018/07/19 16:18:05
Do we even want to enter this code path if we don'
geo
2018/07/19 18:48:16
No, you are right, there is no point to it. `frame
| |
| 571 rawSender.url.replace(/#.*/, "") : | |
| 572 ""; | |
| 573 | |
| 574 for (let [frameId, frameInfo] of frames) | |
| 575 { | |
| 576 let frameInfoHref = frameInfo.url.href.replace(/#.*/, ""); | |
| 577 | |
| 578 // If we have two frames with the same URL | |
| 579 // we are going to pick the first one we find | |
| 580 // as we have no other way of distinguishing between them. | |
| 581 if (frameInfoHref == rawSenderHref) | |
| 582 { | |
| 583 frame = frameInfo; | |
| 584 this.id = frameId; | |
| 585 break; | |
| 586 } | |
| 587 } | |
| 588 } | |
| 589 | |
| 563 if (frame) | 590 if (frame) |
| 564 return frame.parent || null; | 591 return frame.parent || null; |
| 565 | |
| 566 return frames.get(0) || null; | 592 return frames.get(0) || null; |
| 567 } | 593 } |
| 568 }; | 594 }; |
| 569 } | 595 } |
| 570 | 596 |
| 571 return ext.onMessage._dispatch( | 597 return ext.onMessage._dispatch( |
| 572 message, sender, sendResponse | 598 message, sender, sendResponse |
| 573 ).includes(true); | 599 ).includes(true); |
| 574 }); | 600 }); |
| 575 } | 601 } |
| OLD | NEW |