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-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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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; | 562 let frame; |
563 // In Edge we don't have frameId | 563 // In Microsoft Edge (version 42.17134.1.0) we don't have frameId |
kzar
2018/07/17 14:46:07
Would be nice to add an Edge version number, so in
Sebastian Noack
2018/07/17 14:50:34
Also please spell out "Microsoft Edge".
geo
2018/07/17 16:36:21
Done.
geo
2018/07/17 16:36:22
Done.
| |
564 // so we fall back to iterating over the tab's frames | 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 | 565 // see https://developer.microsoft.com/en-us/microsoft-edge/platform/i ssues/11716733 |
566 if (rawSender.frameId != undefined) | 566 if (rawSender.frameId != undefined) |
567 frame = frames.get(rawSender.frameId); | 567 frame = frames.get(rawSender.frameId); |
568 else | 568 else if (rawSender.url) |
569 { | 569 { |
570 for (let [key, value] of frames) | 570 let rawSenderHref = rawSender.url.replace(/#.*/, ""); |
571 | |
572 for (let [frameId, frameInfo] of frames) | |
571 { | 573 { |
572 let valueHref = value.url.href.replace("#", ""); | 574 let frameInfoHref = frameInfo.url.href.replace(/#.*/, ""); |
Sebastian Noack
2018/07/17 14:20:42
This will only strip the # character itself but no
geo
2018/07/17 16:36:21
I'm sorry. I've fixed it.
Yes, both value.url and
| |
573 | 575 |
574 let rawSenderHref = rawSender.url ? | 576 // If we have two frames with the same URL |
Sebastian Noack
2018/07/17 14:20:42
Under which circumstances is url undefined or null
geo
2018/07/17 16:36:21
I've based that off the comment at https://coderev
| |
575 rawSender.url.replace("#", "") : | 577 // we are going to pick the first one we find |
Sebastian Noack
2018/07/17 14:20:41
This will only strip the # character itself but no
geo
2018/07/17 16:36:21
Done.
| |
576 ""; | 578 // as we have no other way of distinguishing between them. |
577 | 579 if (frameInfoHref == rawSenderHref) |
578 if (valueHref == rawSenderHref) | |
kzar
2018/07/17 14:46:07
I wonder what will happen if two frames have the s
Sebastian Noack
2018/07/17 14:50:34
Then we assume that it's the first of the two fram
kzar
2018/07/17 15:41:53
Fair enough, but maybe we should leave a comment h
geo
2018/07/17 16:36:22
Done.
| |
579 { | 580 { |
580 frame = value; | 581 frame = frameInfo; |
581 this.id = key; | 582 this.id = frameId; |
582 break; | 583 break; |
583 } | 584 } |
584 } | 585 } |
585 } | 586 } |
586 | 587 |
587 if (frame) | 588 if (frame) |
588 return frame.parent || null; | 589 return frame.parent || null; |
589 return frames.get(0) || null; | 590 return frames.get(0) || null; |
590 } | 591 } |
591 }; | 592 }; |
592 } | 593 } |
593 | 594 |
594 return ext.onMessage._dispatch( | 595 return ext.onMessage._dispatch( |
595 message, sender, sendResponse | 596 message, sender, sendResponse |
596 ).includes(true); | 597 ).includes(true); |
597 }); | 598 }); |
598 } | 599 } |
LEFT | RIGHT |