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

Delta Between Two Patch Sets: ext/background.js

Issue 29417597: Issue 5161 - Use maps and sets where appropriate (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Rebased Created May 21, 2017, 10:03 p.m.
Right Patch Set: Minor unrelated changes Created May 21, 2017, 10:15 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 | lib/devtools.js » ('j') | 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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 tabs.forEach(tab => 544 tabs.forEach(tab =>
545 { 545 {
546 chrome.webNavigation.getAllFrames({tabId: tab.id}, details => 546 chrome.webNavigation.getAllFrames({tabId: tab.id}, details =>
547 { 547 {
548 if (details && details.length > 0) 548 if (details && details.length > 0)
549 { 549 {
550 let frames = new Map(); 550 let frames = new Map();
551 framesOfTabs.set(tab.id, frames); 551 framesOfTabs.set(tab.id, frames);
552 552
553 for (let detail of details) 553 for (let detail of details)
554 frames.set(detail.frameId, {url: new URL(detail.url)});
555
556 for (let detail of details)
557 { 554 {
558 let {parentFrameId} = detail; 555 let frame = {url: new URL(detail.url)};
559 556 frames.set(detail.frameId, frame);
560 if (parentFrameId != -1) 557
561 frames.get(detail.frameId).parent = frames.get(parentFrameId); 558 if (detail.parentFrameId != -1)
559 frame.parent = frames.get(detail.parentFrameId);
562 } 560 }
563 } 561 }
564 }); 562 });
565 }); 563 });
566 }); 564 });
567 565
568 chrome.webRequest.onBeforeRequest.addListener(details => 566 chrome.webRequest.onBeforeRequest.addListener(details =>
569 { 567 {
570 // The high-level code isn't interested in requests that aren't 568 // The high-level code isn't interested in requests that aren't
571 // related to a tab or requests loading a top-level document, 569 // related to a tab or requests loading a top-level document,
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 ext.windows = { 730 ext.windows = {
733 create(createData, callback) 731 create(createData, callback)
734 { 732 {
735 chrome.windows.create(createData, createdWindow => 733 chrome.windows.create(createData, createdWindow =>
736 { 734 {
737 afterTabLoaded(callback)(createdWindow.tabs[0]); 735 afterTabLoaded(callback)(createdWindow.tabs[0]);
738 }); 736 });
739 } 737 }
740 }; 738 };
741 }()); 739 }());
LEFTRIGHT
« no previous file | lib/devtools.js » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld