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

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

Issue 5943816674607104: Issue 1983 - Dispatch onLoading event for prerendered pages (Closed)
Patch Set: Don't remove entry from framesOfTab Created Feb. 10, 2015, 12:42 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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 { 95 {
96 callback(tabs.map(function(tab) 96 callback(tabs.map(function(tab)
97 { 97 {
98 return new Page(tab); 98 return new Page(tab);
99 })); 99 }));
100 }); 100 });
101 }, 101 },
102 onLoading: new ext._EventTarget() 102 onLoading: new ext._EventTarget()
103 }; 103 };
104 104
105 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) 105 chrome.webNavigation.onBeforeNavigate.addListener(function(details)
106 { 106 {
107 if (changeInfo.status == "loading") 107 if (details.frameId == 0)
108 ext.pages.onLoading._dispatch(new Page(tab)); 108 {
109 ext._removeFromAllPageMaps(details.tabId);
110 ext.pages.onLoading._dispatch(new Page({id: details.tabId, url: details.ur l}));
111 }
109 }); 112 });
110 113
111 function forgetTab(tabId) 114 function forgetTab(tabId)
112 { 115 {
113 ext._removeFromAllPageMaps(tabId); 116 ext._removeFromAllPageMaps(tabId);
114 delete framesOfTabs[tabId]; 117 delete framesOfTabs[tabId];
115 } 118 }
116 119
117 chrome.webNavigation.onBeforeNavigate.addListener(function(details)
118 {
119 if (details.frameId == 0)
120 forgetTab(details.tabId);
121 });
122
123 chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId) 120 chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId)
124 { 121 {
125 forgetTab(removedTabId); 122 forgetTab(removedTabId);
126 }); 123 });
127 124
128 chrome.tabs.onRemoved.addListener(forgetTab); 125 chrome.tabs.onRemoved.addListener(forgetTab);
129 126
130 127
131 /* Browser actions */ 128 /* Browser actions */
132 129
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 callback(new Page(tab)); 489 callback(new Page(tab));
493 } 490 }
494 else 491 else
495 { 492 {
496 ext.pages.open(optionsUrl, callback); 493 ext.pages.open(optionsUrl, callback);
497 } 494 }
498 }); 495 });
499 }); 496 });
500 }; 497 };
501 })(); 498 })();
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