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

Delta Between Two Patch Sets: lib/appSupport.js

Issue 6305806509146112: Issue 427 - Remove non-standard function and getter syntax (Closed)
Left Patch Set: Convert shorthand function expressions to arrow functions, this of course isn't possible for getter… Created May 10, 2014, 12:43 p.m.
Right Patch Set: Wow sorry for those wrong braces, I am so used to a different style that I didn't even realize what… Created May 18, 2014, 10:51 a.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 | « .hgsubstate ('k') | lib/customizableUI.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 <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 10 matching lines...) Expand all
21 21
22 Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 22 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
23 Cu.import("resource://gre/modules/Services.jsm"); 23 Cu.import("resource://gre/modules/Services.jsm");
24 Cu.import("resource://gre/modules/AddonManager.jsm"); 24 Cu.import("resource://gre/modules/AddonManager.jsm");
25 25
26 /** 26 /**
27 * Checks whether an application window is known and should get Adblock Plus 27 * Checks whether an application window is known and should get Adblock Plus
28 * user interface elements. 28 * user interface elements.
29 * @result Boolean 29 * @result Boolean
30 */ 30 */
31 exports.isKnownWindow = function isKnownWindow(/**Window*/ window) { 31 exports.isKnownWindow = (/**Window*/ window) => false;
Wladimir Palant 2014/05/15 07:12:38 (/**Window*/ window) => false?
32 return false;
33 }
34 32
35 /** 33 /**
36 * HACK: In some applications the window finishes initialization during load 34 * HACK: In some applications the window finishes initialization during load
37 * event processing which makes an additional delay necessary. This flag 35 * event processing which makes an additional delay necessary. This flag
38 * indicates that. 36 * indicates that.
39 * @type Boolean 37 * @type Boolean
40 */ 38 */
41 exports.delayInitialization = false; 39 exports.delayInitialization = false;
42 40
43 /** 41 /**
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 let {application} = require("info"); 257 let {application} = require("info");
260 switch (application) 258 switch (application)
261 { 259 {
262 case "firefox": 260 case "firefox":
263 { 261 {
264 exports.isKnownWindow = function ff_isKnownWindow(window) 262 exports.isKnownWindow = function ff_isKnownWindow(window)
265 { 263 {
266 return (window.document.documentElement.getAttribute("windowtype") == "nav igator:browser"); 264 return (window.document.documentElement.getAttribute("windowtype") == "nav igator:browser");
267 }; 265 };
268 266
269 exports.getBrowser = function ff_getBrowser(window) { 267 exports.getBrowser = (window) => window.gBrowser;
270 return window.gBrowser
271 };
Wladimir Palant 2014/05/15 07:12:38 (window) => window.gBrowser?
272 268
273 exports.addTab = function ff_addTab(window, url, event) 269 exports.addTab = function ff_addTab(window, url, event)
274 { 270 {
275 if (event) 271 if (event)
276 window.openNewTabWith(url, exports.getBrowser(window).contentDocument, n ull, event, false); 272 window.openNewTabWith(url, exports.getBrowser(window).contentDocument, n ull, event, false);
277 else 273 else
278 window.gBrowser.loadOneTab(url, {inBackground: false}); 274 window.gBrowser.loadOneTab(url, {inBackground: false});
279 }; 275 };
280 276
281 exports.contentContextMenu = "contentAreaContextMenu"; 277 exports.contentContextMenu = "contentAreaContextMenu";
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 case "thunderbird": 389 case "thunderbird":
394 { 390 {
395 exports.isKnownWindow = function tb_isKnownWindow(window) 391 exports.isKnownWindow = function tb_isKnownWindow(window)
396 { 392 {
397 let type = window.document.documentElement.getAttribute("windowtype"); 393 let type = window.document.documentElement.getAttribute("windowtype");
398 return (type == "mail:3pane" || type == "mail:messageWindow"); 394 return (type == "mail:3pane" || type == "mail:messageWindow");
399 }; 395 };
400 396
401 exports.delayInitialization = true; 397 exports.delayInitialization = true;
402 398
403 exports.getBrowser = function tb_getBrowser(window) { 399 exports.getBrowser = (window) => window.getBrowser();
404 return window.getBrowser();
405 }
Wladimir Palant 2014/05/15 07:12:38 (window) => window.getBrowser()?
406 400
407 exports.addTab = function tb_addTab(window, url, event) 401 exports.addTab = function tb_addTab(window, url, event)
408 { 402 {
409 let tabmail = window.document.getElementById("tabmail"); 403 let tabmail = window.document.getElementById("tabmail");
410 if (!tabmail) 404 if (!tabmail)
411 { 405 {
412 let wnd = Services.wm.getMostRecentWindow("mail:3pane"); 406 let wnd = Services.wm.getMostRecentWindow("mail:3pane");
413 if (window) 407 if (window)
414 tabmail = wnd.document.getElementById("tabmail"); 408 tabmail = wnd.document.getElementById("tabmail");
415 } 409 }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 listener.detach(); 676 listener.detach();
683 this.listeners.delete(window); 677 this.listeners.delete(window);
684 } 678 }
685 }); 679 });
686 680
687 break; 681 break;
688 } 682 }
689 683
690 case "fennec2": 684 case "fennec2":
691 { 685 {
692 exports.isKnownWindow = function fmn_isKnownWindow(/**Window*/ window) { 686 exports.isKnownWindow = (window) => window.document.documentElement.id == "m ain-window";
693 return window.document.documentElement.id == "main-window"; 687
694 }; 688 exports.getBrowser = (window) => window.BrowserApp.selectedBrowser;
695 689
696 exports.getBrowser = function fmn_getBrowser(window) { 690 exports.addTab = (window, url, event) => window.BrowserApp.addTab(url, {sele cted: true});
697 return window.BrowserApp.selectedBrowser;
698 };
699
700 exports.addTab = function fmn_addTab(window, url, event) {
701 return window.BrowserApp.addTab(url, {selected: true});
702 };
Wladimir Palant 2014/05/15 07:12:38 Use fat arrow expressions here?
703 691
704 let BrowserChangeListener = function(window, callback) 692 let BrowserChangeListener = function(window, callback)
705 { 693 {
706 this.window = window; 694 this.window = window;
707 this.callback = callback; 695 this.callback = callback;
708 this.onSelect = this.onSelect.bind(this); 696 this.onSelect = this.onSelect.bind(this);
709 this.attach(); 697 this.attach();
710 }; 698 };
711 BrowserChangeListener.prototype = { 699 BrowserChangeListener.prototype = {
712 window: null, 700 window: null,
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 event.state = {id: require("info").addonID}; 939 event.state = {id: require("info").addonID};
952 browser._contentWindow.dispatchEvent(event); 940 browser._contentWindow.dispatchEvent(event);
953 }); 941 });
954 }); 942 });
955 }, true); 943 }, true);
956 }; 944 };
957 945
958 break; 946 break;
959 } 947 }
960 } 948 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld