Unknown Protocol error for AdBlock Plus?

User Help for Seamonkey and Mozilla Suite
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Unknown Protocol error for AdBlock Plus?

Post by patrickjdempsey »

I've never had this problem before, but today SeaMonkey isn't allowing me to install ABP subscriptions from the ABP website:

https://adblockplus.org/en/features#socialmedia

The "open this dialogue" links bring up an error page:

Unknown Protocol

One of the following (abp) is not a registered protocol or is not allowed in this context.

The address specifies a protocol (e.g. "wxyz://") the browser does not recognize, so the browser cannot properly connect to the site.

  • Are you trying to access multimedia or other non-text services? Check the site for extra requirements.
  • Some protocols may require third-party software or plugins before the browser can recognize them.


There's an old thread on the AdBlock Plus forums about this but it didn't go very far:
https://adblockplus.org/forum/viewtopic.php?t=10613

Anyone else seen this?
Last edited by patrickjdempsey on May 3rd, 2015, 5:19 pm, edited 1 time in total.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: Unknown Protocol error for AdBlock Plus?

Post by barbaz »

What ABP version?
Are you posting from the same SeaMonkey install that has the problem?

(That link works for me in my personal fork of ABP 2.1.2 so I'd suspect some change in Adblock Plus or perhaps an extension conflict on your end introduced by an update of something else.)
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Unknown Protocol error for AdBlock Plus?

Post by patrickjdempsey »

I keep everything 100% up-to-date. SeaMonkey 2.33.1. AdBlock Plus 2.6.9. And yes, I'm sure it doesn't happen on *most* machines... I'm mostly interested in people who do have the problem. I'm going to play around with my settings and see if there's something I can suss out.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: Unknown Protocol error for AdBlock Plus?

Post by barbaz »

OK so I can confirm that it's not a problem with ABP itself.EDIT see below

In case it's relevant or helps you figure this out, the abp: links are not "loaded", clicks on them are intercepted by a click listener that grabs info out of the URI to determine what subscription to ask you to add...
Last edited by barbaz on May 3rd, 2015, 4:23 pm, edited 1 time in total.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Unknown Protocol error for AdBlock Plus?

Post by patrickjdempsey »

I tried in a new absolutely clean profile:
- Installed ABP 2.6.9 from AMO.
- Try the link...... everything worked fine.

Closed SeaMonkey and reopened.
- Tried the link... Error page.

Open Addons Manager. Disable ABP... then Enable ABP.
- Tried the link... works.

So somehow the listener is getting dropped.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: Unknown Protocol error for AdBlock Plus?

Post by barbaz »

patrickjdempsey wrote:somehow the listener is getting dropped.

Or never added in the first place... did some more investigation, and I think the reason it worked for me is due to something else in my profile, and the reason it works in my ABP-fork is I already fixed this possibility.

It's the old window.gBrowser / window.getBrowser() deal. ABP uses window.gBrowser on SeaMonkey, but if they do that before something calls window.getBrowser(), they'll end up trying to use null. In Firefox window.gBrowser is a getter and window.getBrowser() is deprecated; in SeaMonkey window.gBrowser is a normal variable that gets set by calling window.getBrowser() (which also returns the value it sets for window.gBrowser).

So basically ABP just doesn't properly support SeaMonkey. :(


EDIT I think all they need to do is change https://hg.adblockplus.org/adblockplus/file/9259df089273/lib/appSupport.js#l328 to

Code: Select all

return window.gBrowser || window.getBrowser();


EDIT2 I think I'll file a bug on their issue tracker either later today or sometime tomorrow.
User avatar
patrickjdempsey
Posts: 23686
Joined: October 23rd, 2008, 11:43 am
Location: Asheville NC
Contact:

Re: Unknown Protocol error for AdBlock Plus?

Post by patrickjdempsey »

Thanks for looking into it. It's a relatively uncommon situation since most users will likely install subscriptions from chrome://adblockplus/content/ui/firstRun.html on first run.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: Unknown Protocol error for AdBlock Plus?

Post by barbaz »

Lemon Juice
Posts: 788
Joined: June 1st, 2006, 9:41 am

Re: Unknown Protocol error for AdBlock Plus?

Post by Lemon Juice »

barbaz wrote:It's the old window.gBrowser / window.getBrowser() deal. ABP uses window.gBrowser on SeaMonkey, but if they do that before something calls window.getBrowser(), they'll end up trying to use null. In Firefox window.gBrowser is a getter and window.getBrowser() is deprecated; in SeaMonkey window.gBrowser is a normal variable that gets set by calling window.getBrowser() (which also returns the value it sets for window.gBrowser).

I think ultimately SeaMonkey core should follow Firefox in this regard and switch to the gBrowser getter because it is only a source of incompatibilities. I'm not sure if there is any reason, apart from historical residue, for keeping window.gBrowser initialized by window.getBrowser() and from what I can see the switch to Fx way should not break any existing extensions.
*** SeaMonkey — weird name, sane interface, modern bowels ***
Mouse Gestures for SeaMonkey/Firefox
Convert Fx and TB extensions to SeaMonkey
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: Unknown Protocol error for AdBlock Plus?

Post by barbaz »

OTOH deprecating getBrowser() will be another kind of extension compatibility nightmare (not all my extensions use gBrowser || getBrowser()). Plus it's slightly more efficient if window.gBrowser is a regular variable - the logic of the getter doesn't have to be followed every time. I suppose they could use some trick something like

Code: Select all

Object.defineProperty(window, 'gBrowser', {configurable:true, enumerable:true, get:function(){
  let b = /* result of current logic of window.getBrowser(); */
  Object.defineProperty(window, "gBrowser", {configurable:true, enumerable:true, value:b});
  return b;
},
set:function(v){
  Object.defineProperty(window, 'gBrowser', {configurable:true, enuerable:true, value:v});
}});

and then just map getBrowser() to gBrowser. Would be the same as before except gBrowser would initialize itself as well.
Lemon Juice
Posts: 788
Joined: June 1st, 2006, 9:41 am

Re: Unknown Protocol error for AdBlock Plus?

Post by Lemon Juice »

barbaz wrote:OTOH deprecating getBrowser() will be another kind of extension compatibility nightmare

Why? In SM it may remain deprecated forever - or even not deprecated.
barbaz wrote:Plus it's slightly more efficient if window.gBrowser is a regular variable - the logic of the getter doesn't have to be followed every time.

I don't think such microoptimization will influence anything.
I suppose they could use some trick something like

Code: Select all

Object.defineProperty(window, 'gBrowser', {configurable:true, enumerable:true, get:function(){
  let b = /* result of current logic of window.getBrowser(); */
  Object.defineProperty(window, "gBrowser", {configurable:true, enumerable:true, value:b});
  return b;
},
set:function(v){
  Object.defineProperty(window, 'gBrowser', {configurable:true, enuerable:true, value:v});
}});

and then just map getBrowser() to gBrowser. Would be the same as before except gBrowser would initialize itself as well.

This might work, too. Personally, I would be in favour of following Fx's implementation because it's always safer for compatibility and certain edge cases. But other solutions wouldn't be bad either. Maybe I'll file a bug when I find some time, we'll see what the developers think about it.
*** SeaMonkey — weird name, sane interface, modern bowels ***
Mouse Gestures for SeaMonkey/Firefox
Convert Fx and TB extensions to SeaMonkey
barbaz
Posts: 1504
Joined: October 1st, 2014, 3:25 pm

Re: Unknown Protocol error for AdBlock Plus?

Post by barbaz »

Lemon Juice wrote:
barbaz wrote:OTOH deprecating getBrowser() will be another kind of extension compatibility nightmare

Why? In SM it may remain deprecated forever - or even not deprecated.

Switching to the Fx way means deprecating getBrowser(), which eventually means removing it. If getBrowser() stays not deprecated in SM then it's fine, no problem with addon compatibility.

Lemon Juice wrote:I don't think such microoptimization will influence anything.

Depends how many times you access the browser. That's why if this will be changed I'd prefer a solution like above. It's the least amount of change (from an addon's perspective) required to emulate Firefox's behavior.

(I actually don't know how much of an optimization this is, but even micro-optimizations can eventually add up.)

Lemon Juice wrote:Personally, I would be in favour of following Fx's implementation because it's always safer for compatibility and certain edge cases. But other solutions wouldn't be bad either. Maybe I'll file a bug when I find some time, we'll see what the developers think about it.

SeaMonkey has its own implementation of that stuff, so as far as compatibility goes all we need is that the APIs are compatible, internal differences shouldn't matter.


If you file a bug please let me know the bug number.
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Re: Unknown Protocol error for AdBlock Plus?

Post by Philip Chee »

Code: Select all

window.__defineGetter__(gBrowser, function () {
  var element = document.getElementById("content");
  if (!element)
    return null;
  delete window[gBrowser];
  return window[gBrowser] = element;
});
window.__defineSetter__(gBrowser, function (val) {
  delete window[gBrowser];
  return window[gBrowser] = val;
});

The existing getBrowser() doesn't need to change:

Code: Select all

function getBrowser()
{
  if (!gBrowser)
    gBrowser = document.getElementById("content");
  return gBrowser;
}

But could be optimized as:

Code: Select all

function getBrowser()
{
  return gBrowser;
}

Phil
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Re: Unknown Protocol error for AdBlock Plus?

Post by Philip Chee »

I've filed Bug 1161538 - Make gBrowser a lazy getter [Addon-compat]

I hope someone picks this up because my TODO list is about 10 pages long at the moment.

Phil
Lemon Juice
Posts: 788
Joined: June 1st, 2006, 9:41 am

Re: Unknown Protocol error for AdBlock Plus?

Post by Lemon Juice »

Philip Chee wrote:I've filed Bug 1161538 - Make gBrowser a lazy getter [Addon-compat]

Ouch, I was just in the process of creating a bug for this :!:
*** SeaMonkey — weird name, sane interface, modern bowels ***
Mouse Gestures for SeaMonkey/Firefox
Convert Fx and TB extensions to SeaMonkey
Post Reply