[Flashblock] Re: Flashblock revised XBL
gary liquid
liquid at gmail.com
Wed Jan 4 00:46:02 EST 2006
One more after thought.
This error is appearing to occur because we now try re-running the
Constructor code.
What happens if we modify the flash element so that it DOESN'T get the
second callback.
For instance, the CSS could be directed to treat object/embeds with already
initialised properties to somewhere else.
This is just a thinking out loud thing, but would mean the recalling of the
Constructor would only occur for brand new object/embed objects.
I'm not sure if this will work and its not been tested, but it would remove
the reentrant problems at source.
We should really do the overrideCTV check RIGHT at the start of the
constructor really, and we should operate from the this.* variables. this
means we test for bailout before we have disturbed ANY of the variables with
possibly messy 2nd generation data.
Theoretical CSS modification:
object[overrideCTV =true],
embed[overrideCTV =true],
{
-moz-binding: none !important;
}
I just tried this on my system and it doesn't work (maybe my skills)
Error: Selector expected. Ruleset ignored due to bad selector.
Source File: chrome://flashblock/content/flashblock.css
Line: 13
What is a bad selector? Is it the overrideCTV part, or is it the binding
option?
does anyone think this is a legitimate line of thinking, and if so how could
we solve it?
Gary
On 1/4/06, gary liquid <liquid at gmail.com> wrote:
>
> Lorenzo
> I am pleased to say this works for me in all test cases, but please read
> all this mail.
>
> (All cases except for "FBlock Test
> Cases\FlashBlockNewScientistCutdown\c.htm", but thats because I renamed 2 of
> the flash files after creating the htm)
>
> The updated XML file you sent over was included in a test version and
> repackaged and installed.
> The newly compiled version passed every test, and blocked all flash, and
> allowed it to be clicked to view, HOWEVER the bad NP error DOES still
> occur.
> It occurs at a later date at a point which doesn't actually matter though.
> The Bad NP occurs when the initialization code is RERUN for the flash
> element after you click the ShowFlashClicker (After you add the Embed/Object
> back into the DOM model, the Constructor code runs again).
> This has the effect of stopping the constructor thread from rerunning
> which the overrideCTV flag would have done a few statements down anyway.
> The code flow inside the Click event still continues however and the flash
> blocker is removed as expected.
>
> This is how the code is appearing to behave.
> I don't know if they are actual threads, but its a single code task
> Thread#:CodeFlow: Description
> T1:CONSTRUCT: // Firefox Identified an Embed element
> T1:CONSTRUCT: Store temp variables
> T1:CONSTRUCT: Confirm overrideCTV flag is not yet set (exit if it is)
> T1:CONSTRUCT: Create Clicker DIV element
> T1:CONSTRUCT: Prepare a 0ms Callback to actually create the element
> T1:CONSTRUCT: Finished this task
>
> T1:0msCallback: // Callback to Show the Clicker
> T1:0msCallback: Show Clicker
> T1:0msCallback: Stop/Remove Flash
> T1:0msCallback: Finished this task
>
> ........ sometime later on now .....
>
> T1:Clicker_Clicked: //User Clicked on the Button to show flash
> T1:Clicker_Clicked: ReInsert Flash object into DOM tree ***THIS CALLS THE
> CONSTRUCTOR AGAIN***
>
> T2:CONSTRUCT: // Firefox Identified an Embed element
> T2:CONSTRUCT: Store temp variables
> T2:CONSTRUCT: BOOM Bad NP ERROR (actually its the "var parent =
> current.parentNode;" line that throws it)
> T2:CONSTRUCT: Thread stopped *see below for more info*
>
> T1:Clicker_Click: // Thread1 Code continues without a care in the world
> T1:Clicker_Click: Remove Clicker
> T1:Clicker_Click: Finished this task
>
>
>
>
>
> --------------------------------------------------------------------------------------
> * Bad NP Object error mini discussion.
> This seems to occur when you try accessing any property or method of any
> object within the second thread.
> You are ok to use the stored variable to reinsert the flash into the DOM,
> but if you try to do anything with it it fails.
>
> even more strangely, this can occur EVEN if you do a dump() call without
> referencing any variables.
> I placed a dump("Identified Element, doing stuff\n"); statement as the
> first line of code in the constructor and this too fell down to the bad NP
> error on the second initialization.
> I think its more a firefox bug than a specific flash problem.
>
> However, since the scope of variables created inside a constructor isn't
> known to me and references could be flying up its own butt I will leave it
> for now.
> I don't know enough about how XBL works (yet) to understand the problem
> fully but to me
> holding and using references created as part of the constructor process
> callback of one embed/object element from within a callback/event placed on
> a seperate HTML div node seems a bit far.
> --------------------------------------------------------------------------------------
>
>
>
> hopefully thats clear enough to see that the problem occuring now is moved
> enough to say WORKS FOR ME!
> I would say that for an interim release, the XML you sent me is Good.
> This removes the VISIBLE manifestation of the problem whilst leaving a big
> fat questionmark about the true meaning of NP object errors.
>
> I don't have any diff tools over here, I suppose I should get something
> setup - heck, I need a better dev arrangement than wordpad, can anyone
> confirm if I can edit/manipulate the xml file from within my firefox profile
> folder and test by simply rerunning firefox without messing with the whole
> repackage/reinstall - if not, just how can it be streamlined?
>
> Gary
>
> On 1/3/06, Lorenzo Colitti <lorenzo at colitti.com> wrote:
> >
> > gary liquid wrote:
> > > Ok all,
> >
> > [CC'ing the FB list again to keep the others in the loop. Remember, no
> > man is an island!]
> >
> > > > So simply doing:
> > > > if("src" in current) { ... }
> > > > in flashblockShowPlaceholder() causes an error, right?
> > >
> > > Yes thats right - I broke the code up so each portion of the
> > expression
> > > was on a seperate line and the bad NP object error occurs when you try
> >
> > > the expression above.
> >
> > Right... if that's the cause of the problem, then the attached patch
> > should be enough to fix it with a minimum of code changes.
> > Unfortunately, I don't have a Windows box to test on. Can you check if
> > it fixes the problem?
> >
> > I attach flashblock.xml too in case you can't use the diff somehow.
> >
> > Thanks for your help so far!
> >
> > Cheers,
> > Lorenzo
> >
> > --
> > Lorenzo Colitti http://www.colitti.com/lorenzo/
> >
> >
> > ? flashblock-1.5.xpi
> > ? flashblock.xpi
> > ? xpi.sh
> > Index: content/flashblock/flashblock.xml
> > ===================================================================
> > RCS file: /cvs/flashblock/source/content/flashblock/flashblock.xml,v
> > retrieving revision 1.8.2.6
> > diff -u -r1.8.2.6 flashblock.xml
> > --- content/flashblock/flashblock.xml 1 Jan 2006 13:16:06 -0000
> > 1.8.2.6
> > +++ content/flashblock/flashblock.xml 3 Jan 2006 22:33:45 -0000
> > @@ -22,17 +22,18 @@
> > }
> > }
> >
> > -function flashblockCreatePlaceholder() {
> > +function flashblockCreatePlaceholder(isStandalone) {
> > // Create placeholder
> > var flashblockCreateElement = nativeMethod(document,
> > "createElement");
> > var placeholder = flashblockCreateElement("div");
> > + placeholder.isStandalone = isStandalone;
> > return placeholder;
> > }
> >
> > // Substitute the animation with a placeholder
> > function flashblockShowPlaceholder() {
> > parent.insertBefore(placeholder, current);
> > - if("src" in current && current.src ==
> > current.ownerDocument.location) {
> > + if(placeholder.isStandalone) {
> > placeholder.flashblock = "frame";
> > current.StopPlay();
> > current.LoadMovie(0, "");
> > @@ -134,7 +135,8 @@
> > current.overrideCTV = true;
> >
> > // Create placeholder div
> > -var placeholder = flashblockCreatePlaceholder();
> > +var isStandalone = ("src" in current && current.src ==
> > current.ownerDocument.location);
> > +var placeholder = flashblockCreatePlaceholder(isStandalone);
> >
> > // Set placeholder image
> > var type = this.flashblockType ? this.flashblockType : "flash"
> >
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/flashblock/attachments/20060104/dafa257f/attachment.htm
More information about the Flashblock
mailing list