Loading ...
Sorry, an error occurred while loading the content.

Workaround for firefox bug involving pre/post incrementing and eval

Expand Messages
  • theburkeyuk
    Hello! Thanks for all your work on Overlib. I came across a bug involving firefox incrementing a variable by 2 on a ++i command nested inside an eval argument
    Message 1 of 1 , Oct 1, 2009
    • 0 Attachment
      Hello!

      Thanks for all your work on Overlib. I came across a bug involving firefox incrementing a variable by 2 on a ++i command nested inside an eval argument list:

      https://bugzilla.mozilla.org/show_bug.cgi?id=519737

      If you find the order of your commands effects how it works or that certain commands aren't working, then these are symptoms of the above bug.

      I've implemented a workaround which you can apply to your local overlib.js if you want:

      Index: overlib.js
      ===================================================================
      --- overlib.js (revision 341020)
      +++ overlib.js (working copy)
      @@ -14,7 +14,11 @@
      //\ license agreement at the link above. Please give credit on sites that

      //\ use overLIB and submit changes of the script so other people can use

      //\ them as well.

      -// $Revision: 1.119 $ $Date: 2005/07/02 23:41:44 $

      +//\

      +//\ This file has been modified from the main distribution so

      +//\ that ++var becomes (++var) to work around https://bugzilla.mozilla.org/show_bug.cgi?id=519737

      +//\

      +//\ $Revision: 1.119 $ $Date: 2005/07/02 23:41:44 $

      //\/////

      //\mini



      @@ -683,64 +687,64 @@
      } else {

      // Note: NS4 doesn't like switch cases with vars.

      if (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; }

      - if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; }

      - if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; }

      + if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[(++i)]+'].toString()'); continue; }

      + if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[(++i)]+'].toString()'); continue; }

      if (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; }

      - if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[++i]+'"'); continue; }

      + if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[(++i)]+'"'); continue; }

      if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; }

      - if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; }

      + if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[(++i)])+"'"); continue; }

      if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); if(pf!='ol_') olHautoFlag=1; continue; }

      - if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; }

      - if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; }

      - if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); continue; }

      - if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[++i]+'"'); continue; }

      - if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[++i]+'"'); continue; }

      - if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[++i]+'"'); continue; }

      - if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[++i]+'"'); continue; }

      - if (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; }

      - if (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; }

      + if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[(++i)]); continue; }

      + if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[(++i)]); continue; }

      + if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==WIDTH) { eval(pf+'width='+ar[(++i)]); continue; }

      + if (ar[i]==BORDER) { eval(pf+'border='+ar[(++i)]); continue; }

      if (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; }

      - if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[++i])+"'"); continue; }

      + if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[(++i)])+"'"); continue; }

      if (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; }

      if (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; }

      - if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again.

      - if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[++i])+"'"); continue; }

      - if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; }

      - if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; }

      - if (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; }

      - if (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; }

      - if (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; }

      - if (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; }

      - if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[++i]+'"'); continue; }

      - if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[++i]+'"'); continue; }

      - if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; }

      - if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; }

      + if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[(++i)]); continue; } // Same param again.

      + if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[(++i)])+"'"); continue; }

      + if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[(++i)]); continue; }

      + if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[(++i)]); continue; }

      + if (ar[i]==FIXX) { eval(pf+'fixx='+ar[(++i)]); continue; }

      + if (ar[i]==FIXY) { eval(pf+'fixy='+ar[(++i)]); continue; }

      + if (ar[i]==RELX) { eval(pf+'relx='+ar[(++i)]); continue; }

      + if (ar[i]==RELY) { eval(pf+'rely='+ar[(++i)]); continue; }

      + if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==PADX) { eval(pf+'padxl='+ar[(++i)]); eval(pf+'padxr='+ar[(++i)]); continue; }

      + if (ar[i]==PADY) { eval(pf+'padyt='+ar[(++i)]); eval(pf+'padyb='+ar[(++i)]); continue; }

      if (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; }

      if (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); if (pf!='ol_') olVautoFlag=1; continue; }

      - if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); continue; }

      - if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; }

      - if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; }

      - if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[++i])+"'"); continue; }

      - if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[++i]+'"'); continue; }

      - if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[++i]+'"'); continue; }

      - if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[++i]+'"'); continue; }

      - if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; }

      - if (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[++i]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[++i]; opt_FUNCTION(v); } continue; }

      - if (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; }

      + if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[(++i)])+"'"); continue; }

      + if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[(++i)])+"'"); continue; }

      + if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[(++i)])+"'"); continue; }

      + if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[(++i)]); continue; }

      + if (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[(++i)]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[(++i)]; opt_FUNCTION(v); } continue; }

      + if (ar[i]==DELAY) { eval(pf+'delay='+ar[(++i)]); continue; }

      if (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; }

      if (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; }

      if (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; }

      if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; }

      if (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; }

      - if (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff==0) ? 1 : 0'); v=ar[i+1]; if (pf != 'ol_' && eval(pf+'mouseoff') && typeof v == 'number' && (v < pmStart || v > pmUpper)) olHideDelay=ar[++i]; continue; }

      - if (ar[i]==CLOSETITLE) { eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'"); continue; }

      + if (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff==0) ? 1 : 0'); v=ar[i+1]; if (pf != 'ol_' && eval(pf+'mouseoff') && typeof v == 'number' && (v < pmStart || v > pmUpper)) olHideDelay=ar[(++i)]; continue; }

      + if (ar[i]==CLOSETITLE) { eval(pf+"closetitle='"+escSglQuote(ar[(++i)])+"'"); continue; }

      if (ar[i]==CSSOFF||ar[i]==CSSCLASS) { eval(pf+'css='+ar[i]); continue; }

      if (ar[i]==COMPATMODE) { eval(pf+'compatmode=('+pf+'compatmode==0) ? 1 : 0'); continue; }

      - if (ar[i]==FGCLASS) { eval(pf+'fgclass="'+ar[++i]+'"'); continue; }

      - if (ar[i]==BGCLASS) { eval(pf+'bgclass="'+ar[++i]+'"'); continue; }

      - if (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass="'+ar[++i]+'"'); continue; }

      - if (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass="'+ar[++i]+'"'); continue; }

      - if (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass="'+ar[++i]+'"'); continue; }

      + if (ar[i]==FGCLASS) { eval(pf+'fgclass="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==BGCLASS) { eval(pf+'bgclass="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass="'+ar[(++i)]+'"'); continue; }

      + if (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass="'+ar[(++i)]+'"'); continue; }

      i = parseCmdLine(pf, i, ar);

      }

      }

      @@ -1307,7 +1311,7 @@
      pms = pms.concat(pM);



      for (var i = 0; i< pM.length; i++) {

      - eval(pM[i].toUpperCase()+'='+pmCount++);

      + eval(pM[i].toUpperCase()+'='+(pmCount++));

      }

      }
    Your message has been successfully submitted and would be delivered to recipients shortly.