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

Side by Side Diff: lib/ui.js

Issue 11239001: Use XMLHttpRequest constructor in JS modules (Closed)
Patch Set: Created July 25, 2013, 12:36 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 | « lib/synchronizer.js ('k') | 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-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 this.value = UI.isToolbarIconVisible(window); 153 this.value = UI.isToolbarIconVisible(window);
154 }; 154 };
155 addCommandHandler("adblockplus-showinaddonbar", handler); 155 addCommandHandler("adblockplus-showinaddonbar", handler);
156 addCommandHandler("adblockplus-showintoolbar", handler); 156 addCommandHandler("adblockplus-showintoolbar", handler);
157 } 157 }
158 158
159 let list = doc.getElementById("adblockplus-subscription-list"); 159 let list = doc.getElementById("adblockplus-subscription-list");
160 if (list) 160 if (list)
161 { 161 {
162 // Load subscriptions data 162 // Load subscriptions data
163 let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstan ce(Ci.nsIXMLHttpRequest); 163 let request = new XMLHttpRequest();
164 request.mozBackgroundRequest = true; 164 request.mozBackgroundRequest = true;
165 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml") ; 165 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml") ;
166 request.addEventListener("load", function() 166 request.addEventListener("load", function()
167 { 167 {
168 if (onShutdown.done) 168 if (onShutdown.done)
169 return; 169 return;
170 170
171 let currentSubscription = FilterStorage.subscriptions.filter( 171 let currentSubscription = FilterStorage.subscriptions.filter(
172 function(subscription) subscription instanceof DownloadableSubscript ion && subscription.url != Prefs.subscriptions_exceptionsurl 172 function(subscription) subscription instanceof DownloadableSubscript ion && subscription.url != Prefs.subscriptions_exceptionsurl
173 ); 173 );
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 * Gets called on startup, initializes UI integration. 277 * Gets called on startup, initializes UI integration.
278 */ 278 */
279 init: function() 279 init: function()
280 { 280 {
281 // We should call initDone once both overlay and filters are loaded 281 // We should call initDone once both overlay and filters are loaded
282 let overlayLoaded = false; 282 let overlayLoaded = false;
283 let filtersLoaded = false; 283 let filtersLoaded = false;
284 let sessionRestored = false; 284 let sessionRestored = false;
285 285
286 // Start loading overlay 286 // Start loading overlay
287 let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(C i.nsIJSXMLHttpRequest); 287 let request = new XMLHttpRequest();
288 request.mozBackgroundRequest = true; 288 request.mozBackgroundRequest = true;
289 request.open("GET", "chrome://adblockplus/content/ui/overlay.xul"); 289 request.open("GET", "chrome://adblockplus/content/ui/overlay.xul");
290 request.addEventListener("load", function(event) 290 request.addEventListener("load", function(event)
291 { 291 {
292 if (onShutdown.done) 292 if (onShutdown.done)
293 return; 293 return;
294 294
295 this.processOverlay(request.responseXML.documentElement); 295 this.processOverlay(request.responseXML.documentElement);
296 296
297 overlayLoaded = true; 297 overlayLoaded = true;
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 </dialog>'; 787 </dialog>';
788 Services.ww.openWindow(window, 788 Services.ww.openWindow(window,
789 "data:application/vnd.mozilla.xul+xml," + encodeU RIComponent(dialogSource), 789 "data:application/vnd.mozilla.xul+xml," + encodeU RIComponent(dialogSource),
790 "_blank", "chrome,centerscreen,resizable,dialog=n o", null); 790 "_blank", "chrome,centerscreen,resizable,dialog=n o", null);
791 } 791 }
792 } 792 }
793 793
794 if (addSubscription) 794 if (addSubscription)
795 { 795 {
796 // Load subscriptions data 796 // Load subscriptions data
797 let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance (Ci.nsIXMLHttpRequest); 797 let request = new XMLHttpRequest();
798 request.mozBackgroundRequest = true; 798 request.mozBackgroundRequest = true;
799 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml"); 799 request.open("GET", "chrome://adblockplus/content/ui/subscriptions.xml");
800 request.addEventListener("load", function() 800 request.addEventListener("load", function()
801 { 801 {
802 if (onShutdown.done) 802 if (onShutdown.done)
803 return; 803 return;
804 804
805 let node = Utils.chooseFilterSubscription(request.responseXML.getElement sByTagName("subscription")); 805 let node = Utils.chooseFilterSubscription(request.responseXML.getElement sByTagName("subscription"));
806 let subscription = (node ? Subscription.fromURL(node.getAttribute("url") ) : null); 806 let subscription = (node ? Subscription.fromURL(node.getAttribute("url") ) : null);
807 if (subscription) 807 if (subscription)
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], 2025 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)],
2026 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] 2026 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)]
2027 ]; 2027 ];
2028 2028
2029 onShutdown.add(function() 2029 onShutdown.add(function()
2030 { 2030 {
2031 for (let window in UI.applicationWindows) 2031 for (let window in UI.applicationWindows)
2032 if (UI.isBottombarOpen(window)) 2032 if (UI.isBottombarOpen(window))
2033 UI.toggleBottombar(window); 2033 UI.toggleBottombar(window);
2034 }); 2034 });
OLDNEW
« no previous file with comments | « lib/synchronizer.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld