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

Side by Side Diff: chrome/ext/background.js

Issue 29373683: Issue 4775 - Perform callback after options page loaded (Closed)
Patch Set: Created Jan. 28, 2017, 12:30 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 { 542 {
543 chrome.runtime.openOptionsPage(() => 543 chrome.runtime.openOptionsPage(() =>
544 { 544 {
545 if (chrome.runtime.lastError) 545 if (chrome.runtime.lastError)
546 return; 546 return;
547 547
548 chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs => 548 chrome.tabs.query({active: true, lastFocusedWindow: true}, tabs =>
549 { 549 {
550 if (tabs.length > 0) 550 if (tabs.length > 0)
551 { 551 {
552 window.setTimeout(() => 552 if (tabs[0].status == "complete")
553 {
554 callback(new Page(tabs[0])); 553 callback(new Page(tabs[0]));
555 }); 554 else
555 afterTabLoaded(callback)(tabs[0]);
556 } 556 }
557 }); 557 });
558 }); 558 });
559 } 559 }
560 }; 560 };
561 } 561 }
562 else 562 else
563 { 563 {
564 // Edge does not yet support runtime.openOptionsPage (tested version 38) 564 // Edge does not yet support runtime.openOptionsPage (tested version 38)
565 // and so this workaround needs to stay for now. 565 // and so this workaround needs to stay for now.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 ext.windows = { 601 ext.windows = {
602 create(createData, callback) 602 create(createData, callback)
603 { 603 {
604 chrome.windows.create(createData, createdWindow => 604 chrome.windows.create(createData, createdWindow =>
605 { 605 {
606 afterTabLoaded(callback)(createdWindow.tabs[0]); 606 afterTabLoaded(callback)(createdWindow.tabs[0]);
607 }); 607 });
608 } 608 }
609 }; 609 };
610 } 610 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld