adblock-plus breaks ubufox and toolkit plugin installer wizard (and possibly other wizards as well)

Bug #215672 reported by Alexander Sack on 2008-04-11
12
Affects Status Importance Assigned to Milestone
XULRunner
Fix Released
High
adblock-plus (Ubuntu)
High
Unassigned
mozilla-noscript (Ubuntu)
High
Unassigned
xulrunner-1.9 (Ubuntu)
High
Unassigned

Bug Description

Binary package hint: adblock-plus

plugin wizard will show up, but when pushing next it will just appear and enter stage "finished" directly. This obviously prevents anything from getting installed.

works for me, we had today the same report for a localized version in the #testday channel. Can you try with a new profile (http://support.mozilla.com/en-US/kb/Managing+profiles) if you still see the problem ?

I noticed after seeing this bug that I see the problem as well. I've found that if I have either Adblock Plus or No Script enabled that I see the problem.

The regression range that I found is right at the 3-21 nightly build. The previous hourly build is ok. But nothing that regression range is even used.

http://bonsai.mozilla.org/cvsquery.cgi?module=PhoenixTinderbox&date=explicit&mindate=1206103020&maxdate=1206112319

So this could have been uncovered by the nightly clobber. So the range would be from the 3-20 nightly to the 3-21 nightly.

http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=PhoenixTinderbox&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2008-03-20+05%3A00%3A00&maxdate=2008-03-21+04%3A00%3A00&cvsroot=%2Fcvsroot

Bug 424444 had the same regression range as this bug and was caused by something before the regression range.

I missed the error message:
Error: document.getElementById("dontShowPrivacyStatement") is null
Source File: chrome://reporter/content/reportWizard.js
Line: 118

Yes, I see that as well. Checked with Adblock Plus Watcher - Adblock Plus isn't blocking anything here (actually returning early for all the calls here because they are initiated by chrome). More likely, the presence of a JavaScript content policy changes the initialization of the dialog somehow.

requesting relnote keyword, since this also affects beta 5

assigning to JST to determine how serious this is

*** Bug 426589 has been marked as a duplicate of this bug. ***

*** Bug 426808 has been marked as a duplicate of this bug. ***

*** Bug 427097 has been marked as a duplicate of this bug. ***

In , Jst (jst) wrote :
Download full text (5.8 KiB)

Here's the JS stack when we get the error about getElementById("dontShowPrivacyStatement") returning null:

1 setPrivacyPref() ["chrome://reporter/content/reportWizard.js":118]
2 anonymous(event = [object Event @ 0xa086c80 (native @ 0xa428b50)]) ["chrome://global/content/bindings/wizard.xml":410]
3 _fireEvent(aType = "pageadvanced", aTarget = [object XULElement @ 0x9fcac80 (native @ 0xa25c910)]) ["chrome://global/content/bindings/wizard.xml":411]
4 advance(aPageId = undefined) ["chrome://global/content/bindings/wizard.xml":257]
5 initPrivacyNotice() ["chrome://reporter/content/reportWizard.js":98]
6 anonymous(event = [object Event @ 0xa02c440 (native @ 0xa422940)]) ["chrome://global/content/bindings/wizard.xml":410]
7 _fireEvent(aType = "pageshow", aTarget = [object XULElement @ 0x9fcac80 (native @ 0xa25c910)]) ["chrome://global/content/bindings/wizard.xml":411]
8 set_currentPage(val = [object XULElement @ 0x9fcac80 (native @ 0xa25c910)]) ["chrome://global/content/bindings/wizard.xml":94]
9 advance(aPageId = undefined) ["chrome://global/content/bindings/wizard.xml":284]
10 () ["chrome://global/content/bindings/wizard.xml":199]

And the C++ stack is rougly this:

#0 nsXULDocument::GetElementById (this=0xa24c000, aId=@0xbffcdac4,
    aReturn=0xbffcd830)
#1 0x00366a65 in NS_InvokeByIndex_P ()
#2 0x0726f457 in XPCWrappedNative::CallMethod (ccx=@0xbffcda50,
    mode=XPCWrappedNative::CALL_METHOD)
[...]
#19 0x001aaa7f in JS_CallFunctionValue (cx=0xa010c80, obj=0x9ecd140,
    fval=166517248, argc=0, argv=0x0, rval=0xbffcfbb8)
#20 0x08635746 in nsXBLProtoImplAnonymousMethod::Execute (this=0xa5bd1a0,
    aBoundElement=0xa27a6d0)
#21 0x0862a291 in nsXBLPrototypeBinding::BindingAttached (this=0x9f98800,
    aBoundElement=0xa27a6d0)
#22 0x08623637 in nsXBLBinding::ExecuteAttachedHandler (this=0xa451480)
#23 0x086e6676 in nsElementSH::PostCreate (this=0x9ace680, wrapper=0x9f80180,
    cx=0x9676360, obj=0x9ecd140)
#24 0x07274565 in XPCWrappedNative::GetNewOrUsed (ccx=@0xbffd0058,
    Object=0xa27a6d0, Scope=0x9b50200, Interface=0x96d3f00, isGlobal=0,
    resultWrapper=0xbffcffbc)
[...]
#27 0x07221f40 in nsXPConnect::WrapNative (this=0x96edbc0,
    aJSContext=0x9676360, aScope=0x996a1a0, aCOMObj=0xa27a6d0,
    aIID=@0x897f890, _retval=0xbffd0120)
#28 0x086df602 in nsDOMClassInfo::WrapNative (cx=0x9676360, scope=0x996a1a0,
    native=0xa27a6d0, aIID=@0x897f890, vp=0xbffd0190, aHolder=0xbffd018c)
#29 0x086e05de in nsNodeSH::PreCreate (this=0x9ace680, nativeObj=0xa25c910,
    cx=0x9676360, globalObj=0x996a1a0, parentObj=0xbffd0294)
#30 0x07273d20 in XPCWrappedNative::GetNewOrUsed (ccx=@0xbffd03d8,
    Object=0xa25c910, Scope=0x999e380, Interface=0x96d3f00, isGlobal=0,
    resultWrapper=0xbffd033c)
[...]
#38 0x086df602 in nsDOMClassInfo::WrapNative (cx=0x9676360, scope=0x996a1a0,
    native=0xa25c9a0, aIID=@0x897f890, vp=0xbffd0890, aHolder=0xbffd088c)
#39 0x086e05de in nsNodeSH::PreCreate (this=0x9ace680, nativeObj=0xa25c9d0,
    cx=0x9676360, globalObj=0x996a1a0, parentObj=0xbffd0994)
#40 0x07273d20 in XPCWrappedNative::GetNewOrUsed (ccx=@0xbffd0bf0,
    Object=0xa25c9ec, Scope=0x999e380, Interface=0x96d3f00, isGlobal=0,
    resultWrapper...

Read more...

In , Jst (jst) wrote :

This was caused by bug 395609. Smaug, any thoughts here? Your change made us load XUL frames earlier (in BindToTree() rather than once we're in layout. I'm not sure we really can do anything about that, othar than document that change and fix this code up.

Thoughts?

In , Jst (jst) wrote :

Smaug, see my previous comment.

Fixing priority. P2.

I really think this needs to be fixed in the frontend code. The code is relying on a very bogus assumption, that the xbl ctor won't run until long after the node has been inserted in the tree and the xbl binding has been attached.

This work should be done in onload or some such, or move the node around so that the xbl-bound node is after the requested node.

In , Jst (jst) wrote :

Robert, you wrote this code didn't you? Any early thoughts on how this coulde be fixed in the report broken website wizard?

jst and robert and I discussed this on IRC earlier. An easy workaround would be to have the reporter code use an onload listener to call initPrivacyNotice() for the first panel, rather than relying on the "onpageshow" pseudo-event that's fired from the wizard constructor.

That wouldn't fix other wizards that might also have this bug, though. I don't see a clean way to fix this in a generic way, since the dialog code can't tell whether or not the document is loaded yet (so it can't reliably defer calling event handlers until onload).

(In reply to comment #15)
> I really think this needs to be fixed in the frontend code.
I agree. Will look at the chrome code ASAP.

(In reply to comment #17)
> That wouldn't fix other wizards that might also have this bug, though. I don't
> see a clean way to fix this in a generic way, since the dialog code can't tell
> whether or not the document is loaded yet (so it can't reliably defer calling
> event handlers until onload).

You would need a fix for bug 347174 for that, I would think.

By the way: Since I can't report a broken website the normal way, I think that you should know that Pandora Radio (pandora.com) doesn't work properly. The tuner loads and the songs appear, but the songs don't play.

In , Jst (jst) wrote :

(In reply to comment #20)
> By the way: Since I can't report a broken website the normal way, I think that
> you should know that Pandora Radio (pandora.com) doesn't work properly.

Please file a separate bug on that, let's keep this bug about the problem described here and use new bugs for unrelated issues.

Created attachment 314133
delay iframe loading

This is not nice, but fixes this bug.

There is something strange happening here. If I have ABP installed, I end up
with different DOM in the reporter dialog. It has only the first wizardpage
element. Does content policy (implemented in JavaScript) disturb XUL loading
somehow? Sounds like a bug which fixing bug 395609 somehow revealed.

If I don't any better way, I'll try delaying XUL frame loading until the
main document is fully loaded or something.

Actually, the DOM is right, but DOMi doesn't report it correctly or something.
My guess is that XBL gets bound "too early" to documentElement if
JS content policy does something.

In , Jst (jst) wrote :

Created attachment 314225
Delay initPrivacyNotice()

This is an alternative to Smaug's fix. This makes initPrivacyNotice() a no-op if called before the window is done loading, and makes the onload handler call initPrivacyNotice(). Seems to work here...

Robert/Gavin/Smaug, what do you think of either of these approaches?

Created attachment 314230
update XBL even when not notifying

Jst, Jonas, as far as I see this bug has actually always been there.
Bug 395609 just made it visible in this case.
If XBL is bound to some element while content sink (without notifying) still
creates the DOM, XBL may not be up-to-date.
So, the idea in this patch is to update XBL if the parent of inserted/append
/removed node is somehow in XBL, even if aNotify is PR_FALSE.

The change to wizard.xml is needed to delay some initialization.
DOMContentLoaded is fired after initial reflow.

Passes mochitest, chrome and browser tests.
Initial testing shows that the special handling for XBL is called very rarely,
basically in FF UI only when opening 'ReportBroken' dialog.

If this is too scary (though shouldn't be that scary, and IMO is the right
thing to do), Jst's "delay" patch might be good enough.
And now it is really time to sleep :)

Comment on attachment 314230
update XBL even when not notifying

This one scares me a little. Even if it is the RightThing we know that our XBL usage is very shaky and even fixing true bugs often end up breaking things relying on those bugs.

Also, won't these notifications reach the bindingmanager eventually? The sink should notify on this content at some point, even though it might be SomeTimeLater? So if we notify manually now we'd cause the notification to happen twice.

Finally, is there any risk that notifying on the bindingmanager when aNotify is false could end up causing script to run?

(In reply to comment #26)
> Also, won't these notifications reach the bindingmanager eventually?
Ah, äh. Not in XUL, which I was debugging, but in HTML.

> Finally, is there any risk that notifying on the bindingmanager when aNotify is
> false could end up causing script to run?
I tried to go through those methods and they just update the data structures of
XBL bindings..

I'm inclined to say that we should hold that patch for post 1.9 and instead do a pure frontend workaround for now.

Created attachment 314332
update XBL even when not notifying, v2

Well, here is anyway a patch which doesn't have the problem with
multiple notifications. NODE_MAY_BE_IN_BINDING_MNGR is used to optimize out
the common cases when notifying bindingmanager wouldn't do anything.

In , Jst (jst) wrote :

Comment on attachment 314225
Delay initPrivacyNotice()

Robert/Gavin, I think we should do this for now, and take Smaug's patch later. What's your thoughts?

Comment on attachment 314225
Delay initPrivacyNotice()

You can't go back to the privacy notice pane, so you can just move the call to initPrivacyNotice from the pane's onpageshow to the wizard's onload.

This will fix this specific instance of the bug, but it won't address other users of this widget that might rely on the document being "ready" when the constructor is called. It's hard to know how many potential users like that exist, but it would be nice to not break them... seems like smaug's patch would be better in this regard (although the dialog.xml change looks like it would break dialogs added after the document has loaded - perhaps not an important enough use case that we need to worry about it). I can't really evaluate the riskiness of it, though, so I'll defer to your judgement there.

(In reply to comment #31)
> seems like smaug's patch would
> be better in this regard (although the dialog.xml change looks like it would
> break dialogs added after the document has loaded - perhaps not an important
> enough use case that we need to worry about it).
What dialog.xml change?
<wizard> is expected (at least the code expects si) to be the root element, so
no new <wizard> elements after load.

Er, sorry, I meant wizard.xml. You're right, that part of your patch is very unlikely to be a problem.

In , Jst (jst) wrote :

Created attachment 314470
Updated fix.

In , Jst (jst) wrote :

Sigh. Turns out my patch didn't fix this problem at all :( It did in my tree, but what I didn't realize when I was testing was that I had locally backed out Smaugs patch that introduced this problem in the first place :(

With the patch the reporter wizard page closes right away when you open it and you have adblock installed :(

In , Jst (jst) wrote :

Gavin says he's got a plan for making the wizard code not advance a wizard before the page is done loading, which would fix this in better and more general way. Reassigning.

*** Bug 428220 has been marked as a duplicate of this bug. ***

(In reply to comment #36)
> Gavin says he's got a plan for making the wizard code not advance a wizard
> before the page is done loading,
But the problem is that the XBL code isn't updated properly if the binding
is attached to the <wizard> element too early. Use DOMi to see what the
non-anonymous code looks inside the binding.
Maybe re-binding XBL to <wizard> when DOMContentLoaded fires could help here.
That would be an ugly hack though.

Created attachment 314910
defer firing wizard events until DOMContentLoaded

smaug's right - this patch fixes the exception and makes the initial privacy pane work (by deferring the wizard events until DOMContentLoaded), but it's not sufficient. The wizard is still broken, because the document is missing wizardpage elements even after it has fully loaded.

Reassigning back to smaug, since it looks like we'll need to take his patch (or something like it).

Comment on attachment 314332
update XBL even when not notifying, v2

So, is this too scary?

I'd be pretty afraid of touching that XBL stuff, myself... It's very fragile, and not well tested. It's buggy in various ways, but we don't want to change those ways if we can avoid it, this late in the game.

It does seem like this would be a problem for anything in XUL that loads from content, though. Or for any XUL that uses an inline script. And I'm sure the lack of notifications in XUL also causes bugs in content lists, and so forth.

So really, we just need to fix XUL to notify properly... That's clearly not 1.9-scope, though.

To fix this bug, I could live with special-casing xul:frame to not start loading immediately if StartLayout() hasn't been called yet, and starting that load when StartLayout() does happen.

(In reply to comment #42)
> So really, we just need to fix XUL to notify properly... That's clearly not
> 1.9-scope, though.
The bug isn't about XUL not notifying properly but XBL not getting updated when
there have been some updates to DOM.

(In reply to comment #43)
> To fix this bug, I could live with special-casing xul:frame to not start
> loading immediately if StartLayout() hasn't been called yet, and starting that
> load when StartLayout() does happen.
That is possible, yes. Ugly, but possible.

That seems less scary. Isn't that what happened before smaugs change?

Past 1.9 I think we should do what comment 42 says.

Yes, I realize what this bug is about. I'm just saying that changing the notification setup all over to deal with the XUL brokenness is pretty worrisome at this point...

I don't understand what does this have to do with XUL? The same bug might,
I think, happen on HTML too.

But special casing XUL documents to wait until StartLayout() might be good
enough here.

Comment on attachment 314332
update XBL even when not notifying, v2

Maybe this is too scary at this point.

Created attachment 315081
delay frame loading

Passes mochitest, browser and chrome without those new assertions or warnings.

Apparently, there is another place where the same bug manifests - plugin installer. Alexander Sack sent me a report about this issue that he found on Linux, but it is reproducible on Windows as well. You need to have some JavaScript content policy installed - Adblock Plus or NoScript will do (minimal content policy has the same effect). Steps to reproduce:

1. Make sure Quicktime plugin isn't installed and go to http://www.gottamovefaster.com/quicktime/
2. Click "Click here to download plugin" message
3. Wait for the wizard to offer you Quicktime and click Next.

The wizard simply disappears. Next wizard page would contain an iframe where the license terms of the plugin should load into.

Smaug, can you check whether your patch fixes this issue as well?

Alexander Sack (asac) wrote :

Binary package hint: adblock-plus

plugin wizard will show up, but when pushing next it will just appear and enter stage "finished" directly. This obviously prevents anything from getting installed.

Alexander Sack (asac) wrote :

important. adblock-plus is a very popular extension and breaking wizards for adblock-plus users is not acceptable at least.

Changed in adblock-plus:
importance: Undecided → High
status: New → Confirmed
Alexander Sack (asac) wrote :

appears to be a manifestation of mozilla bug https://bugzilla.mozilla.org/show_bug.cgi?id=425814

there are multiple workarounds available in that bug and we should verify and take one of those.

Changed in xulrunner-1.9:
importance: Undecided → High
status: New → Confirmed
Alexander Sack (asac) wrote :

according to upstream bug this also gets triggered by noscript extension. associating bug accordingly.

Changed in mozilla-noscript:
importance: Undecided → High
status: New → Confirmed

attachment 315081 doesn't fix the bug in comment 50 it for me.

Alexander Sack (asac) wrote :

that didn't help. now trying

"(From update of attachment 314332 [details])
Maybe this is too scary at this point."

attachment 314332 fixes the plugin installer wizard for me. I'd like to use that for ubuntu as it breaks an imporant use-case for users of popular extensions (adblock plug, noscript).

smaug, any concrete risks in mind (comment 48)?

Alexander Sack (asac) wrote :

https://bugzilla.mozilla.org/attachment.cgi?id=314332 fixes this issue.

Now: waiting for upstream input on impact.

nominating as blocker as it breaks an important feature of ubuntu firefox when popular firefox extensions that instantiate javascript policies (e.g. adblock-plus + noscript) are installed.

Changed in xulrunner-1.9:
milestone: none → ubuntu-8.04
status: Confirmed → Triaged
Alexander Sack (asac) wrote :

still waiting for upstream input.

Changed in xulrunner-1.9:
status: Triaged → Fix Committed

How about we don't start forking stuff for now, eh?

I wonder why the "defer loading" patch doesn't fix the issue...

Changed in xulrunner:
status: Unknown → Confirmed

Is PFS not working correctly (bug 424421) just another manifestation of this bug?

Reed: I bet, since I have ABP 0.7.5.4 due to ads everywhere. No NoScript.

Definitely needs to go to the ABP team and the devs so that they can work together on a fix.

(In reply to comment #53)
> How about we don't start forking stuff for now, eh?
>

I have a release milestone hanging over me ;) ... definitly don't want to fork.

> I wonder why the "defer loading" patch doesn't fix the issue...
>

i did a clean respin and have to admit that i stand corrected: my claim in comment 51 is wrong; attachment 315081 fixes the pfs for me too! Sorry for the noise ;).

(In reply to comment #56)
> i did a clean respin and have to admit that i stand corrected: my claim in
> comment 51 is wrong; attachment 315081 [details] fixes the pfs for me too! Sorry for the
> noise ;).

So let's try attachment 315081 then. Jonas, (or bz) reviews?

This implementation makes me a little nervous. Do all displayed XUL documents always go through DoneWalking? Including content ones? It's also not super future proof since we might some day allow things like let XSLT create XUL documents, or let you create documents through the DOM and then insert them into a docshell.

> Do all displayed XUL documents always go through DoneWalking?

Yes.

> It's also not super future proof

It's a temporary "safe for 1.9 at this point" measure until we fix the XUL notification breakage...

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xulrunner-1.9 - 1.9~b5+nobinonly-0ubuntu2

---------------
xulrunner-1.9 (1.9~b5+nobinonly-0ubuntu2) hardy; urgency=low

  * fix "firefox-3.0 gets removed on dist-upgrade when firefox-3.0 build is
    not available on mirror". We deal with this situation by dropping the
    Break: field from xulrunner-1.9 and adding upper bounds on xulrunner-1.9
    to firefox-3.0 binary.
    - update debian/control

  * improve translation support by shipping a crafted install.rdf. We ship a
    template install.rdf.in in debian/translation-support and replace the
    em:{version,maxVersion,minVersion} during build. For now those versions
    are maintained manually because we need maintainer attention on upgrades
    considering the upstream string freeze. To increase failsafeness, we fail
    the build if the version appears to be out of sync with the upstream
    version in the post-install target. The install.rdf is finally added to
    the zip file in the binary-post-install rule used to produce the
    en-US.xpi.
    - add debian/translation-support/install.rdf.in
    - update debian/rules

  * fix "USE_SYSTEM_NSS checks nspr version, not nss"
    - update debian/rules

  * fix "firefox resets user prefs if the user sets a preference that is equal
    to the default shipped by firefox/xulrunner that was overloaded with an
    extension default (aka ubufox). (LP: #203306). Patch ported from ffox 2
    package.
    - add debian/patches/bzXXX-dont-reset-user-prefs-on-upgrade.patch
    - update debian/patches/series

  * fix "broken wizard binding with javascript policies in place" -
    For particular, this fixes "plugin installer wizard broken with adblock or
    noscript installed" (LP: #215672). Patch taken from bugzilla 425814
    - add debian/patches/bz425814_att315081.patch
    - update debian/patches/series

  * conflict with removed from archive package j2re1.4-mozilla-plugin as it
    causes crashes in latest gecko code (LP: #214468)
    - update debian/control

 -- Alexander Sack <email address hidden> Tue, 15 Apr 2008 11:59:05 +0200

Changed in xulrunner-1.9:
status: Fix Committed → Fix Released

*** Bug 424421 has been marked as a duplicate of this bug. ***

Comment on attachment 315081
delay frame loading

>Index: content/base/src/nsDocument.h
>+ PRBool mDelayFrameLoaderInitialization;

Put this up with our earlier PRBool bitfield (right after mHasWarnedAboutBoxObjects)?

With that looks ok.

Created attachment 316283
delay frame loading + PRPackedBool

Is there a way to put tests around this? The "not super future proof" scares me a little to a lot.

I don't know any reasonable way to test this automatically :(
I'd say the "not super future proof" is about post 1.9.

Yes, that things that might break this are adding new features. Something that won't happen in 1.9.0.x.

Comment on attachment 316283
delay frame loading + PRPackedBool

a1.9=beltzner

Changed in xulrunner:
status: Confirmed → Fix Released

It's looking like this may have broken Firebug's loading of a chrome HTML page in a xul:browser (the load is triggered from the load event of another xul:browser)? Bug 411814 has more details, would very much like anyone's help with it.

*** Bug 430958 has been marked as a duplicate of this bug. ***

Siegfried Gevatter (rainct) wrote :

Can this bug be closed for adblock-plus and mozilla-noscript?

On Fri, Aug 08, 2008 at 12:45:48PM -0000, Siegfried Gevatter (RainCT) wrote:
> Can this bug be closed for adblock-plus and mozilla-noscript?
>

if you verified that this bug doesnt happen anymore with the packages
above installed from ubuntu archive, then yes. otherwise, maybe
upgrading those to latest upstream helps.

 - Alexander

Jordan Erickson (lns) wrote :

This is just a shot in the dark, but would this issue still effect FF after Adblock is uninstalled?

Alexander Sack (asac) on 2009-03-23
Changed in adblock-plus (Ubuntu):
status: Confirmed → Invalid
Changed in mozilla-noscript (Ubuntu):
status: Confirmed → Invalid
Changed in xulrunner:
importance: Unknown → High
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.