adblock not working

Everything about using Adblock Plus on Mozilla Firefox, Thunderbird and SeaMonkey
User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: adblock not working

Post by V@no »

Before I start my rant, I want thank creator(s) for this extension. This is a must-have and it's the first extension I install on new computers. Absolutely amazing...when it's working...
Please stop this. It's not problem with our browsers, it's problem with the extension. Only ABP has this 50/50 chance that it will work on startup, well at least what I've seen so far.
It might work perfectly with fresh profile, but you can't expect users reset their profiles all the time, or don't install any other extensions.
Last edited by V@no on Wed Apr 24, 2013 4:29 pm, edited 1 time in total.
MonztA
ABP Developer
Posts: 3957
Joined: Mon Aug 14, 2006 12:18 am
Location: Germany

Re: adblock not working

Post by MonztA »

You could help us fixing the bug or at least implementing a workaround if possible. If that issue happens to you, please copy the following files/folders from your Firefox profile folder (neither of these files stores particularly sensitive data):

prefs.js
extensions.ini
extensions.sqlite
addons.sqlite
"adblockplus" folder

And send these files to me via personal message or e-mail at easylist dot subscription at gmail dot com. I will then forward it to the developers.
User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: adblock not working

Post by V@no »

After you mentioned these files, I've copied them into fresh profile including extensions folder and could reproduce this issue right the way, then I replaced adblockplus folder with the original and the problem was gone.
Then started over with fresh profile and just copied mentioned files, minus prefs.js and extensions folder - no problem.
Then copied prefs.js and extensions folder, and started disabling extensions, after disabling TabMixPlus, the problem was gone.
After that I disabled all extensions and enabled TabMixPlus - still no problem.

At this point, I think it's not actually an incompatibility issue, but rather poor implementation of startup routine of ABP.
Let's start with what's the deal with the delay at which the icon shows up in the addon bar?
User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: adblock not working

Post by V@no »

Found what's causing it.

\lib\ui.js

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);
}
SessionRestoreObserver.prototype =
{
  callback: null,
  timer: null,
  observe: function(subject, topic, data)
  {
    Services.obs.removeObserver(this, "sessionstore-windows-restored");
    sessionRestoreObserver = null;

    this.timer.cancel();
    this.timer = null;

    if (!onShutdown.done)
      this.callback();
  },
  QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference])
}
If you halt restoring the session for 5 or more seconds (with a master password prompt or by any other means), ABP will fail initialize.
On "slow" computers where Firefox takes more then 5 seconds to fully initialize, most probably will result in no ABP icon.

Since master password prompt can be triggered before browser initialized I found it the easiest way reproduce it by forcing master password prompt on startup with "master password+" extension, or "session manager" with enabled encryption for sessions. Then when MP prompt showed, wait 5 seconds before submitting the password.

There should NEVER be such thing as "wait NN seconds before...", there are plenty of events and observers for that.
catweazel67

Re: adblock not working

Post by catweazel67 »

hi i was having the same problem but just now i turned off the option in adblock that is "disable everywhere" becuase i thought it was disabling ads but it was disabling ad block itself and now it works dunno about anyone else but that might help but i do alos feel really stupid now
Anonymous37

Re: adblock not working

Post by Anonymous37 »

What about those cursed underlined word surveys?
MonztA
ABP Developer
Posts: 3957
Joined: Mon Aug 14, 2006 12:18 am
Location: Germany

Re: adblock not working

Post by MonztA »

Where?
Blub Blobbery

Re: adblock not working

Post by Blub Blobbery »

Hi, I'm having problems with Adblock Plus. Up until now everything worked just fine, but something has changed and I don't know what. I'm suddenly seeing all the ads again, on every website they used to be blocked. I've tried installing and reinstalling it completely, deleting the folder in my profile, unchecking the box which allowed minor ads to be seen, reinitializing every bold extensions.adblockplus thing in about:config and reinitializing Firefox completely. I've even tried downloading ABP development build, but nothing works. Is there anything I can do? Because I'm starting to feel desperate. There isn't even an alternative ad blocker that works around (I've tried but all failed), so I'm really reliant on you guys. Help please?
ArJ

Re: adblock not working

Post by ArJ »

I'm having the same issues as the above poster. Ads have started showing up for me as well.
MonztA
ABP Developer
Posts: 3957
Joined: Mon Aug 14, 2006 12:18 am
Location: Germany

Re: adblock not working

Post by MonztA »

Update EasyList now, it should be fixed after that again: en/faq_basics#update-filterlists
Blub Blobbery

Re: adblock not working

Post by Blub Blobbery »

It worked! It worked! Thank you so much!
Swingguy0

Re: adblock not working

Post by Swingguy0 »

Thank You! Manually updating worked like a charm
User avatar
V@no
Posts: 30
Joined: Sat Apr 06, 2013 5:44 pm

Re: adblock not working

Post by V@no »

Until devs fix this issue, here is a simple addon that fixes it by disabling and then enabling ABP on startup:
http://dev.vano.org/abp/downloads/adblo ... latest.xpi
Source:

Code: Select all

const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");

function startup(data, reason)
{
	AddonManager.getAddonByID("{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}", function(addon)
	{
		if (addon.isActive)
			watchWindows(function()
			{
				let listener = {
					onDisabled: function(Addon)
					{
						if(addon.id != Addon.id)
							return

						let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
						unload(timer.cancel);
						timer.init(function()
						{
							AddonManager.removeAddonListener(listener);
							Addon.userDisabled = false;
							unload();
						}, 100, timer.TYPE_ONE_SHOT);
					}
				};
				AddonManager.addAddonListener(listener);
				unload(function(){AddonManager.removeAddonListener(listener)});
				addon.userDisabled = true;
			});
	});
}


function shutdown(data, reason)
{
	unload();
}

function install(data, reason)
{
}

function uninstall(data, reason)
{
}






/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Home Dash Utility.
 *
 * The Initial Developer of the Original Code is The Mozilla Foundation.
 * Portions created by the Initial Developer are Copyright (C) 2011
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Edward Lee <edilee@mozilla.com>
 *   Erik Vold <erikvvold@gmail.com>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

"use strict";


/**
 * Save callbacks to run when unloading. Optionally scope the callback to a
 * container, e.g., window. Provide a way to run all the callbacks.
 *
 * @usage unload(): Run all callbacks and release them.
 *
 * @usage unload(callback): Add a callback to run on unload.
 * @param [function] callback: 0-parameter function to call on unload.
 * @return [function]: A 0-parameter function that undoes adding the callback.
 *
 * @usage unload(callback, container) Add a scoped callback to run on unload.
 * @param [function] callback: 0-parameter function to call on unload.
 * @param [node] container: Remove the callback when this container unloads.
 * @return [function]: A 0-parameter function that undoes adding the callback.
 */
function unload(callback, container) {
	// Initialize the array of unloaders on the first usage
	let unloaders = unload.unloaders;
	if (unloaders == null)
		unloaders = unload.unloaders = [];

	// Calling with no arguments runs all the unloader callbacks
	if (callback == null) {
		unloaders.slice().forEach(function(unloader) unloader());
		unloaders.length = 0;
		return true;
	}

	// The callback is bound to the lifetime of the container if we have one
	if (container != null) {
		// Remove the unloader when the container unloads
		container.addEventListener("unload", removeUnloader, false);

		// Wrap the callback to additionally remove the unload listener
		let origCallback = callback;
		callback = function() {
			container.removeEventListener("unload", removeUnloader, false);
			origCallback();
		}
	}

	// Wrap the callback in a function that ignores failures
	function unloader() {
		try {
			callback();
		}
		catch(ex) {}
	}
	unloaders.push(unloader);

	// Provide a way to remove the unloader
	function removeUnloader() {
		let index = unloaders.indexOf(unloader);
		if (index != -1)
			unloaders.splice(index, 1);
	}
	return removeUnloader;
}

/**
 * Apply a callback to each open and new browser windows.
 *
 * @usage watchWindows(callback): Apply a callback to each browser window.
 * @param [function] callback: 1-parameter function that gets a browser window.
 */
function watchWindows(callback) {
	var unloaded = false;
	unload(function() unloaded = true);

	// Wrap the callback in a function that ignores failures
	function watcher(window, type) {
		try {
			// Now that the window has loaded, only handle browser windows
			let {documentElement} = window.document;
			if (documentElement.getAttribute("windowtype") == "navigator:browser")
				callback(window, type);
		}
		catch(ex) {}
	}

	// Wait for the window to finish loading before running the callback
	function runOnLoad(window) {
		// Listen for one load event before checking the window type
		window.addEventListener("load", function runOnce() {
			window.removeEventListener("load", runOnce, false);
			if (unloaded) return; // the extension has shutdown
			watcher(window, "load");
		}, false);
	}

	// Add functionality to existing windows
	let windows = Services.wm.getEnumerator(null);
	while (windows.hasMoreElements()) {
		// Only run the watcher immediately if the window is completely loaded
		let window = windows.getNext();
		if (window.document.readyState == "complete")
			watcher(window);
		// Wait for the window to load before continuing
		else
			runOnLoad(window);
	}

	// Watch for new browser windows opening then wait for it to load
	function windowWatcher(subject, topic) {
		if (topic == "domwindowopened")
			runOnLoad(subject);
	}
	Services.ww.registerNotification(windowWatcher);

	// Make sure to stop watching for windows if we're unloading
	unload(function() Services.ww.unregisterNotification(windowWatcher));
}
Last edited by V@no on Sat Aug 31, 2013 3:43 am, edited 2 times in total.
Sabby

Re: adblock not working

Post by Sabby »

to V@no:
Hi, I just installed your Adblock plus icon fixer but it doesn't change anything here. The Adblock Plus still won't show until I manually disable and enable Adblock Plus.
Cheers Sabby :(
User avatar
Patrickrock
Posts: 3
Joined: Fri Jun 21, 2013 2:40 pm
Location: Dallas

Re: adblock not working

Post by Patrickrock »

Same issue happened with me ..most ads are no longer blocked...
Post Reply