hasdhasudhasd fuck i hate the small differences in browsers

Discussion in 'OT Technology' started by hsmith, Sep 16, 2006.

  1. hsmith

    hsmith OT Supporter

    Joined:
    Feb 24, 2002
    Messages:
    124,562
    Likes Received:
    649
    Location:
    Your mother.
    something works perfect on IE & Firefox, but bombs on safari, crashing the browsers...

    So I bought a macbook ($1100 out the door) to track it down and I figured out the problem. problem is, i have no idea how to fucking fix it. fuck.

    problem occurs when someone blurs from a textbox when they click on another textbox. it causes a race condition in the form because on the blur it redraws the form using javascript. so it is trying to access a form element that disappears


    fucndkfdjjfdsjkfij
     
  2. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Sounds like you need a boolean flag that the Javascript can set to "True" when it starts the redraw, and set back to "False" when it finishes the redraw. Then the bit of code that wants to access the textbox can loop forever until that boolean flag is equal to "False", at which point it can proceed with whatever it's supposed to be doing.
     
  3. hsmith

    hsmith OT Supporter

    Joined:
    Feb 24, 2002
    Messages:
    124,562
    Likes Received:
    649
    Location:
    Your mother.
    i figured it out. once it dawned on me the solution it took 15 minutes to implement :o
     
  4. Aimless

    Aimless Resident drunkey

    Joined:
    Nov 5, 2001
    Messages:
    2,534
    Likes Received:
    0
    Location:
    Wisconsin
    Can I have your Macbook then?
     
  5. hsmith

    hsmith OT Supporter

    Joined:
    Feb 24, 2002
    Messages:
    124,562
    Likes Received:
    649
    Location:
    Your mother.
    lol no :o
     
  6. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    How'd you fix the problem?
     
  7. hsmith

    hsmith OT Supporter

    Joined:
    Feb 24, 2002
    Messages:
    124,562
    Likes Received:
    649
    Location:
    Your mother.
    well i had the javascript redrawing the tables as soon as the input was blurred. the issue was safari was triggering the focus event if the user clicked on another form element. that was then causing a race condition causing the browser to crash.

    so now, i don't redraw the entire table, i instead just updated the column values i need to. it is more efficent and what i should have been doing, but the other way was a bit easier (and "worked" until i foudn the safari issue). buit i still use the entire redrawing of the form frequently, just not when they edit values.
     
  8. piratepenguin

    piratepenguin New Member

    Joined:
    Jun 18, 2006
    Messages:
    1,067
    Likes Received:
    0
    Location:
    Ireland
    It crashes Safari? How about Konqueror? Report a bug?
     
  9. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Read what he said he did to fix the problem; the bug wasn't in Safari, it was in his cheap & easy solution. Once he did it properly, the problem was fixed.
     
  10. hsmith

    hsmith OT Supporter

    Joined:
    Feb 24, 2002
    Messages:
    124,562
    Likes Received:
    649
    Location:
    Your mother.
    well it could be an issue with safari. it shouldn't crash the browser. it is poor programming on their part.
     
  11. piratepenguin

    piratepenguin New Member

    Joined:
    Jun 18, 2006
    Messages:
    1,067
    Likes Received:
    0
    Location:
    Ireland
    um, report a bug?

    If you could post any mess of a testcase (I dont understand it the problem..) I can test it in Konq, then if it crashes konq we can report it to http://bugs.kde.org (apple uses a modified version of KHTML, konquerors layout engine)

    Apple would probably be interested in it too for sure.
     
  12. hsmith

    hsmith OT Supporter

    Joined:
    Feb 24, 2002
    Messages:
    124,562
    Likes Received:
    649
    Location:
    Your mother.
    Code:
    
    <html>
    <head>
    
        <script type="text/javascript">
            function Redraw()
            {
                var val = '<input type="text" onblur="Redraw();" /><input type="text" onblur="Redraw();" />';
                document.getElementById('content').innerHTML = val;
            }
        </script>
    
    </head>
    <body onload="Redraw();">
        <div id="content"></div>
    </body>
    </html>
    
    

    that will crash the browser, just click between the two, click the form, click around, enter values, ect
     
  13. piratepenguin

    piratepenguin New Member

    Joined:
    Jun 18, 2006
    Messages:
    1,067
    Likes Received:
    0
    Location:
    Ireland
    Good stuff.

    Indeed it crashes Konq. http://bugs.kde.org/show_bug.cgi?id=134345
     
  14. hsmith

    hsmith OT Supporter

    Joined:
    Feb 24, 2002
    Messages:
    124,562
    Likes Received:
    649
    Location:
    Your mother.
    :cool: i figured that isn't the desired functionaliuty :o
     
  15. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Many things are created by accident. Did you know that gunpowder was supposed to be the basis for the elixir of life, and Post-It glue was supposed to be the strongest superglue ever? You may have just invented the next big internet exploit. Quick -- blackmail someone, before they develop a patch!
     

Share This Page