FF20Beta/Win7: Icon disappears

Posting here is no longer possible, please use the corresponding product forum.
User avatar
greiner
ABP Developer
Posts: 900
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: FF20Beta/Win7: Icon disappears

Post by greiner »

1) I can't reproduce this issue… do you have any other extensions installed because those might interfere with the startup of Adblock Plus (e.g. someone mentioned having to enter a master-password on startup).

Code: Select all

/**
* Observer waiting for the browsing session to be restored on startup.
*/
function SessionRestoreObserver(/**function*/ callback)
{
  sessionRestoreObserver = this;

  this.callback = callback;
  Services.obs.addObserver(this, "sessionstore-windows-restored", true);

  // Just in case, don't wait longer than 5 seconds
  this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
  this.timer.init(this, 5000, Ci.nsITimer.TYPE_ONE_SHOT);
}
2) The five second delay that was mentioned in previous posts is only a fallback. Under normal circumstances we initialize the UI after receiving the "sessionstore-windows-restored" event from the browser. If we don't get this event within five seconds we also start initializing the UI.

3) There are other issues mentioned here (people don't see the Adblock Plus icon because their Addon bar is hidden) that are not linked to this one.
User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: FF20Beta/Win7: Icon disappears

Post by V@no »

greiner wrote:1) I can't reproduce this issue… do you have any other extensions installed because those might interfere with the startup of Adblock Plus (e.g. someone mentioned having to enter a master-password on startup).
It seems this only reproducible with delay from non-bootstrap extensions.
Try this simple extension:
http://dev.vano.org/adblockplusstartupcheck
It will open a modal window, putting everything else on halt and close it after 5 seconds.
User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: FF20Beta/Win7: Icon disappears

Post by V@no »

greiner wrote:2) The five second delay that was mentioned in previous posts is only a fallback. Under normal circumstances we initialize the UI after receiving the "sessionstore-windows-restored" event from the browser. If we don't get this event within five seconds we also start initializing the UI.
The problem is that timer is not affected by window process, it fires regardless if window on halt due to child modal window or not, so it continue executing the initialization and because main window is on halt at this time the initialization fails to properly recognize windowtype attribute (because it still blank at that time), at which point ABP aborts initialization for this window.

lib/ui.js/UI.applyToWindow()
:

Code: Select all

    if (!isKnownWindow(window))
      return;

The fix is simple: remove the timer and relay solely on observer.
Done.

In my extensive tests I couldn't make sessionstore-windows-restored event not get fired and ABP works just fine. Even though some people say it only fires on firefox startup, in my tests it fires on new windows too.

Fixed function:

Code: Select all

/**
 * Observer waiting for the browsing session to be restored on startup.
 */
function SessionRestoreObserver(/**function*/ callback)
{
  sessionRestoreObserver = this;

  this.callback = callback;
  Services.obs.addObserver(this, "sessionstore-windows-restored", true);
}
SessionRestoreObserver.prototype =
{
  callback: null,
  observe: function(subject, topic, data)
  {
    Services.obs.removeObserver(this, "sessionstore-windows-restored");
    sessionRestoreObserver = null;

    if (!onShutdown.done)
      this.callback();
  },
  QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference])
}
User avatar
greiner
ABP Developer
Posts: 900
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: FF20Beta/Win7: Icon disappears

Post by greiner »

Thanks for the demo extension… I was able to reproduce the issue and am almost done with the bugfix.

However, removing the timer is not an option due to cases where the event does not fire. The actual problem is that a method that we use which gives us all Firefox windows only returns the ones that are visible. This means that if the main window is not visible after five seconds it does not initialize the icon in that window as soon as it becomes visible again.
User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: FF20Beta/Win7: Icon disappears

Post by V@no »

greiner wrote:However, removing the timer is not an option due to cases where the event does not fire.
Just out of curiosity, any particular case when it doesn't fire?
User avatar
greiner
ABP Developer
Posts: 900
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: FF20Beta/Win7: Icon disappears

Post by greiner »

V@no wrote:Just out of curiosity, any particular case when it doesn't fire?
I'm not aware of any specific cases because the fix happened before I joined Adblock Plus. However, it seems like in older Firefox versions (and keep in mind that we're still supporting Firefox 16+) the event is fired before extensions are loaded.
User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: FF20Beta/Win7: Icon disappears

Post by V@no »

Well, the first ever revision introduced usage of sessionstore-windows-restored event was back in March 2010. The timer was also introduced at that revision, which means it wasn't added as a bug fix.
That revision was 2 years before the oldest supported by ABP Firefox version. And bugzilla doesn't show any unresolved issues with the event not firing.

Anyway, thank you for finally taking care of this issue ;)
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: FF20Beta/Win7: Icon disappears

Post by mapx »

User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: FF20Beta/Win7: Icon disappears

Post by V@no »

Thank you guys, I think it fixed now.
User avatar
fanboy
Posts: 3446
Joined: Sun Jun 17, 2007 4:45 am
Contact:

Re: FF20Beta/Win7: Icon disappears

Post by fanboy »

I wonder if this same issue I saw here (in Nightly); (Crashing Adblock plus)

Code: Select all

WARN addons.xpi: Exception running bootstrap method startup on {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}: [Exception... "Component returned failure code: 0xc1f30100 (NS_ERROR_FACTORY_EXISTS) [nsIComponentRegistrar.registerFactory]"  nsresult: "0xc1f30100 (NS_ERROR_FACTORY_EXISTS)"  location: "JS frame :: resource://gre/modules/XPIProvider.jsm -> jar:file:///C:/Users/fanboy/AppData/Roaming/Mozilla/Firefox/Profiles/ppealjph.default-1369527610533/extensions/%7Bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7D.xpi!/bootstrap.js -> jar:file:///C:/Users/fanboy/AppData/Roaming/Mozilla/Firefox/Profiles/ppealjph.default-1369527610533/extensions/%7Bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7D.xpi!/lib/contentPolicy.js :: PolicyImplementation.init :: line 368"  data: no]
AD Block User

Re: FF20Beta/Win7: Icon disappears

Post by AD Block User »

fanboy wrote:I wonder if this same issue I saw here (in Nightly); (Crashing Adblock plus)
I dislike the new version. For over a month the options list has randomly changed from Fan Boys (my preferred) to Easy List. It blocks too much or nothing. Now the new version doesn't even have Fan Boys list available at all and all my personal lists have vanished. Grrrr :x
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: FF20Beta/Win7: Icon disappears

Post by mapx »

fanboy list merged with easylist, it's the same team now

https://easylist.adblockplus.org/blog/2 ... boy-s-list
"Fanboy, who has many years of experience in ad blocking, is a gain for the Easy project and will from now on be the main author."
User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: FF20Beta/Win7: Icon disappears

Post by V@no »

Bringing the topic back up, because the problem wasn't fixed.
The icon still disappears and requires restart the extension.
C'mon, guys, 9.5 month already!

Although, this time it's different - not on browser start.
Last edited by V@no on Wed Dec 18, 2013 3:06 pm, edited 1 time in total.
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: FF20Beta/Win7: Icon disappears

Post by mapx »

give some more details to devs: firefox version, ABP version (stable or dev build: did you try the last dev build ? ), op.system
p_hill
Posts: 438
Joined: Mon Feb 03, 2014 5:26 pm
Location: Cologne

Re: FF20Beta/Win7: Icon disappears

Post by p_hill »

lease continue in our new issue tracker, see this for non-reproducable: https://issues.adblockplus.org/ticket/198
And this for a known reproducable issue: https://issues.adblockplus.org/ticket/190
Locked