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

Side by Side Diff: lib/appSupport.js

Issue 6325312296058880: issue #290 - [seamonkey] blockable items list persists on tab changes (Closed)
Patch Set: Created July 8, 2014, 9:09 a.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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 /** 138 /**
139 * Maps windows to a list of progress listeners. 139 * Maps windows to a list of progress listeners.
140 */ 140 */
141 let progressListeners = new WeakMap(); 141 let progressListeners = new WeakMap();
142 142
143 /** 143 /**
144 * Makes sure that a function is called whenever the displayed browser location changes. 144 * Makes sure that a function is called whenever the displayed browser location changes.
145 */ 145 */
146 exports.addBrowserLocationListener = function addBrowserLocationListener(/**Wind ow*/ window, /**Function*/ callback, /**Boolean*/ ignoreSameDoc) 146 exports.addBrowserLocationListener = function addBrowserLocationListener(/**Wind ow*/ window, /**Function*/ callback, /**Boolean*/ ignoreSameDoc)
147 { 147 {
148 _addBrowserLocationListener(window, callback, ignoreSameDoc);
149 };
150
151 function _addBrowserLocationListener(/**Window*/ window, /**Function*/ callback, /**Boolean*/ ignoreSameDoc)
152 {
148 let browser = (exports.getBrowser ? exports.getBrowser(window) : null); 153 let browser = (exports.getBrowser ? exports.getBrowser(window) : null);
149 if (browser) 154 if (browser)
150 { 155 {
151 let dummy = function() {}; 156 let dummy = function() {};
152 let progressListener = 157 let progressListener =
153 { 158 {
154 callback: callback, 159 callback: callback,
155 onLocationChange: function(progress, request, uri, flags) 160 onLocationChange: function(progress, request, uri, flags)
156 { 161 {
157 if (!ignoreSameDoc || !flags || !(flags & Ci.nsIWebProgressListener.LOCA TION_CHANGE_SAME_DOCUMENT)) 162 if (!ignoreSameDoc || !flags || !(flags & Ci.nsIWebProgressListener.LOCA TION_CHANGE_SAME_DOCUMENT))
158 this.callback(); 163 this.callback();
159 }, 164 },
160 onProgressChange: dummy, 165 onProgressChange: dummy,
161 onSecurityChange: dummy, 166 onSecurityChange: dummy,
162 onStateChange: dummy, 167 onStateChange: dummy,
163 onStatusChange: dummy, 168 onStatusChange: dummy,
164 QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, Ci.nsISu pportsWeakReference]) 169 QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, Ci.nsISu pportsWeakReference])
165 }; 170 };
166 browser.addProgressListener(progressListener); 171 browser.addProgressListener(progressListener);
167 172
168 if (progressListeners.has(window)) 173 if (progressListeners.has(window))
169 progressListeners.get(window).push(progressListener); 174 progressListeners.get(window).push(progressListener);
170 else 175 else
171 progressListeners.set(window, [progressListener]); 176 progressListeners.set(window, [progressListener]);
172 } 177 }
173 }; 178 }
174 179
175 /** 180 /**
176 * Removes a location listener registered for a window. 181 * Removes a location listener registered for a window.
177 */ 182 */
178 exports.removeBrowserLocationListener = function removeBrowserLocationListener(/ **Window*/ window, /**Function*/ callback) 183 exports.removeBrowserLocationListener = function removeBrowserLocationListener(/ **Window*/ window, /**Function*/ callback)
179 { 184 {
180 if (!progressListeners.has(window)) 185 if (!progressListeners.has(window))
181 return; 186 return;
182 187
183 let browser = (exports.getBrowser ? exports.getBrowser(window) : null); 188 let browser = (exports.getBrowser ? exports.getBrowser(window) : null);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 { 357 {
353 return null; 358 return null;
354 } 359 }
355 } 360 }
356 else 361 else
357 { 362 {
358 let browser = exports.getBrowser(window); 363 let browser = exports.getBrowser(window);
359 return (browser ? browser.currentURI : null); 364 return (browser ? browser.currentURI : null);
360 } 365 }
361 }; 366 };
367
368 exports.addBrowserLocationListener = function addBrowserLocationListener(/** Window*/ window, /**Function*/ callback, /**Boolean*/ ignoreSameDoc)
369 {
370 // for Seamonkey we have to ignore same document flag because of bug #1035 171
Wladimir Palant 2014/07/08 11:29:02 Please use a link, otherwise it won't be obvious w
saroyanm 2014/07/08 11:58:42 Done.
371 _addBrowserLocationListener(window, callback, false);
372 };
Wladimir Palant 2014/07/08 11:29:02 Forcing the ignoreSameDoc parameter to be always f
saroyanm 2014/07/08 11:58:42 I like this :)
362 373
363 exports.contentContextMenu = ["contentAreaContextMenu", "mailContext"]; 374 exports.contentContextMenu = ["contentAreaContextMenu", "mailContext"];
364 375
365 exports.defaultToolbarPosition = { 376 exports.defaultToolbarPosition = {
366 parent: ["PersonalToolbar", "msgToolbar"], 377 parent: ["PersonalToolbar", "msgToolbar"],
367 before: ["bookmarks-button", "button-junk"] 378 before: ["bookmarks-button", "button-junk"]
368 }; 379 };
369 380
370 exports.statusbarPosition = { 381 exports.statusbarPosition = {
371 parent: "status-bar" 382 parent: "status-bar"
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 event.state = {id: require("info").addonID}; 950 event.state = {id: require("info").addonID};
940 browser._contentWindow.dispatchEvent(event); 951 browser._contentWindow.dispatchEvent(event);
941 }); 952 });
942 }); 953 });
943 }, true); 954 }, true);
944 }; 955 };
945 956
946 break; 957 break;
947 } 958 }
948 } 959 }
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