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

Side by Side Diff: lib/ui.js

Issue 6231262318559232: Issue 238 - Opening new windows slows down progressively (Closed)
Patch Set: Created April 4, 2014, 8:54 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 FilterNotifier.addListener(function(action) 452 FilterNotifier.addListener(function(action)
453 { 453 {
454 if (/^(filter|subscription)\.(added|removed|disabled|updated)$/.test(actio n) || action == "load") 454 if (/^(filter|subscription)\.(added|removed|disabled|updated)$/.test(actio n) || action == "load")
455 this.updateState(); 455 this.updateState();
456 }.bind(this)); 456 }.bind(this));
457 457
458 notificationTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); 458 notificationTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
459 notificationTimer.initWithCallback(this.showNextNotification.bind(this), 459 notificationTimer.initWithCallback(this.showNextNotification.bind(this),
460 3 * 60 * 1000, Ci.nsITimer.TYPE_ONE_SHOT) ; 460 3 * 60 * 1000, Ci.nsITimer.TYPE_ONE_SHOT) ;
461 onShutdown.add(function() notificationTimer.cancel()); 461 onShutdown.add(function() notificationTimer.cancel());
462
463 // Add "anti-adblock messages" notification
464 initAntiAdblockNotification();
465
466 let documentCreationObserver = {
467 observe: function(subject, topic, data)
468 {
469 if (!(subject instanceof Ci.nsIDOMWindow))
470 return;
471
472 this.showNextNotification(subject.location.href);
473 }.bind(UI)
474 };
475 Services.obs.addObserver(documentCreationObserver, "content-document-global- created", false);
476 onShutdown.add(function()
477 {
478 Services.obs.removeObserver(documentCreationObserver, "content-document-gl obal-created", false);
479 });
462 }, 480 },
463 481
464 /** 482 /**
465 * Will be set to true after the check whether first-run actions should run 483 * Will be set to true after the check whether first-run actions should run
466 * has been performed. 484 * has been performed.
467 * @type Boolean 485 * @type Boolean
468 */ 486 */
469 firstRunDone: false, 487 firstRunDone: false,
470 488
471 /** 489 /**
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 this.updateIconState(window, window.document.getElementById("abp-status")) ; 542 this.updateIconState(window, window.document.getElementById("abp-status")) ;
525 this.updateIconState(window, window.document.getElementById("abp-toolbarbu tton")); 543 this.updateIconState(window, window.document.getElementById("abp-toolbarbu tton"));
526 }.bind(this)); 544 }.bind(this));
527 addBrowserClickListener(window, this.onBrowserClick.bind(this, window)); 545 addBrowserClickListener(window, this.onBrowserClick.bind(this, window));
528 546
529 window.document.getElementById("abp-notification-close").addEventListener("c ommand", function(event) 547 window.document.getElementById("abp-notification-close").addEventListener("c ommand", function(event)
530 { 548 {
531 window.document.getElementById("abp-notification").hidePopup(); 549 window.document.getElementById("abp-notification").hidePopup();
532 }, false); 550 }, false);
533 551
534 // Add "anti-adblock messages" notification
535 initAntiAdblockNotification();
536
537 let documentCreationObserver = {
538 observe: function(subject, topic, data)
539 {
540 if (!(subject instanceof Ci.nsIDOMWindow))
541 return;
542
543 this.showNextNotification(subject.location.href);
544 }.bind(UI)
545 };
546 Services.obs.addObserver(documentCreationObserver, "content-document-global- created", false);
547 onShutdown.add(function()
548 {
549 Services.obs.removeObserver(documentCreationObserver, "content-document-gl obal-created", false);
550 });
551
552 // First-run actions? 552 // First-run actions?
553 if (!this.firstRunDone) 553 if (!this.firstRunDone)
554 { 554 {
555 this.firstRunDone = true; 555 this.firstRunDone = true;
556 556
557 let {addonVersion} = require("info"); 557 let {addonVersion} = require("info");
558 let prevVersion = Prefs.currentVersion; 558 let prevVersion = Prefs.currentVersion;
559 if (prevVersion != addonVersion) 559 if (prevVersion != addonVersion)
560 { 560 {
561 Prefs.currentVersion = addonVersion; 561 Prefs.currentVersion = addonVersion;
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], 1912 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)],
1913 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] 1913 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)]
1914 ]; 1914 ];
1915 1915
1916 onShutdown.add(function() 1916 onShutdown.add(function()
1917 { 1917 {
1918 for (let window in UI.applicationWindows) 1918 for (let window in UI.applicationWindows)
1919 if (UI.isBottombarOpen(window)) 1919 if (UI.isBottombarOpen(window))
1920 UI.toggleBottombar(window); 1920 UI.toggleBottombar(window);
1921 }); 1921 });
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