Sitepatching updates

tweaking the broken code until it works, one site at a time

Facebook, Orkut++

Added patches

PATCH-237, Delay script execution on JAL map to avoid deadlock in plug-in scripting. Bug in Opera.

PATCH-303, Reporting different clientHeight and scrollHeight for TEXTAREA breaks commenting on fantasy.nfl.com. Opera doesn't take textarea padding into account when calculating scrollHeight, causing while(clientHeight>scrollHeight) to loop forever. Turns out no browser does this the same way, but WebKit appears to be most sane and consistent, so we'll do the same.

PATCH-269, Reposition invisible file input on rediff.com. Like last week's Freemail.hu fix, Rediff is a site that is important in a specific region. The problem we're patching is that attaching a file while writing an E-mail does nothing. As most webmail sites these days, they put an invisible
<input type="file" onchange="this.form.submit()">
above some stylish "Attach file" text and graphic. The idea is that when you think you click their "Attach file" text, you should actually click the invisible "choose" button, get the file dialog, and once you've made a selection the file uploads automatically.

The problem is sort of both Opera's and Rediff's fault - Rediff fails to position the invisible file input so that users click the invisible "choose" button due to their browser-specific CSS, and Opera fails to make the "text" part of the file input clickable. Opera requires click on choose button, not text box part of the input. The result is that when you click the "Attach file" text you're clicking the invisible "text" part of the file input, and nothing happens.

For Rediffmail we also ship a patch to make sure window.focus() focuses the BODY element inside the IFRAME. When you call window.focus() on an IFRAME with designMode, Opera focuses the document and the cursor appears. However, if the page inside the IFRAME uses
<body contentEditable="true">

instead of designMode, Opera fails to put the cursor inside the BODY element when the page calls focus(). Worse: it actually removes the cursor from BODY if it's already there. This makes it hard or impossible to type a letter when the site keeps trying to focus the window! The fix is to overwrite window.focus() with a method that calls document.body.focus(). It's fixed in core now, and several patches for this bug across many sites will be obsolete when that fix ships. smile

PATCH-304, avoid extra linebreaks in Orkut chat box. Opera requires cancelling keypress, not keydown - the key event issues strike again. Issue was mentioned in the shout box to the right of this blog by Rafael Luik - thanks wink

Changed patches
PATCH-264, Enable Facebook @mentions. The original patch broke the FB music player (unable to change track). Normally, if you through the DOM add an inline script to the page it will run immediately. However, if there is an active BeforeScript event listener this changes - the current thread will finish, then BeforeScript runs, and then the new script.

The solution is to make sure we remove the BeforeScript listener when it's fixed the sniffing that prevents @mentions from working.

PATCH-272, Remove non-functional addEventListener from XHR objects was changed to use the delete keyword. Thanks to Andrea Giammarchi for blogging about the problem with the old patch.

Removed patches
PATCH-30, MSNBC sniffing hides Flash content. Site fixed their sniffing to include Opera, so the patch we fixed last week wasn't required for much longer. bigsmile

Hungary, here we comeTiny update

Comments

Daniel HendrycksDanielHendrycks Thursday, September 30, 2010 11:31:34 AM

up

ouzowtfouzoWTF Thursday, September 30, 2010 12:09:32 PM

cool

Kai OckendorfOckendorf Thursday, September 30, 2010 1:27:46 PM

up

d4rkn1ght Thursday, September 30, 2010 6:00:40 PM

up

Hallvord R. M. Steenhallvors Friday, October 1, 2010 12:57:19 AM

/me loves the sound obsolete patches make when they hit the virtual dustbin, especially if said patches are for important American sites bigsmile

Abhinavdecodedthought Friday, October 1, 2010 2:20:57 AM

up

Charles SchlossChas4 Wednesday, October 6, 2010 1:15:51 PM

up

Abhinavdecodedthought Tuesday, October 26, 2010 2:32:04 PM

in the homepage of facebook when I comment on someone's message I am unable to select the text using the mouse pointer sad
reported the problem here--> CLICKME