Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: ext/background.js

Issue 29838555: Issue 6808 - Default to top frame of page if parent can't be found (Closed)
Left Patch Set: Created July 25, 2018, 7:12 p.m.
Right Patch Set: Consistent > 0 Created July 25, 2018, 8:27 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 528
529 for (let detail of details) 529 for (let detail of details)
530 { 530 {
531 let frame = {url: new URL(detail.url)}; 531 let frame = {url: new URL(detail.url)};
532 frames.set(detail.frameId, frame); 532 frames.set(detail.frameId, frame);
533 533
534 if (detail.parentFrameId != -1) 534 if (detail.parentFrameId != -1)
535 { 535 {
536 frame.parent = frames.get(detail.parentFrameId); 536 frame.parent = frames.get(detail.parentFrameId);
537 537
538 if (!frame.parent && detail.parentFrameId != 0) 538 if (!frame.parent && detail.parentFrameId > 0)
Sebastian Noack 2018/07/25 19:31:24 Why not falling back to the top-level frame here i
Sebastian Noack 2018/07/25 19:31:24 Nit: Above you check for parentFrameId > 0, here y
kzar 2018/07/25 20:28:25 Well, if the parentFrameId is -1 I figure it's the
kzar 2018/07/25 20:28:25 Done.
539 frame.parent = frames.get(0); 539 frame.parent = frames.get(0);
540 } 540 }
541 } 541 }
542 } 542 }
543 }); 543 });
544 }); 544 });
545 }); 545 });
546 546
547 547
548 /* Message passing */ 548 /* Message passing */
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 return frames.get(0) || null; 599 return frames.get(0) || null;
600 } 600 }
601 }; 601 };
602 } 602 }
603 603
604 return ext.onMessage._dispatch( 604 return ext.onMessage._dispatch(
605 message, sender, sendResponse 605 message, sender, sendResponse
606 ).includes(true); 606 ).includes(true);
607 }); 607 });
608 } 608 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld