MAY
18
2007

Yet another GMail fix

As some might have noticed GMail was updated this morning. As usual this broke the standard view Konqueror, but only if you use the recommended method of spoofing as Firefox.

Fortunately I traced it down and fixed it in no time at all :D

Here is the patch for your convenience (apply in kdelibs/khtml):

--- /home/carewolf/html_elementimpl.cpp 2007-05-18 10:48:33.000000000 +0200
+++ html/html_elementimpl.cpp 2007-05-18 10:50:36.000000000 +0200
@@ -562,6 +562,13 @@

void HTMLElementImpl::setInnerHTML( const DOMString &html, int &exceptioncode )
{
+ // Works line innerText in Gecko
+ // ### test if needed for ID_SCRIPT as well.
+ if ( id() == ID_STYLE ) {
+ setInnerText(html, exceptioncode);
+ return;
+ }
+
DocumentFragment fragment = createContextualFragment( html );
if ( fragment.isNull() ) {
exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;

Comments

is this going to make it in KDE 3.5.7? I know it's tagged, but this sounds like it's worth it...


By superstoned at Fri, 05/18/2007 - 10:41

Cool to see such patch.

Have two questions though:
- what JavaScript line causes this problem?
- And are these kind of necessary hacks documented somewhere? For example, the fact window.frames[ id ] returns any DOM element in MSIE, or location = location.href also works. :p


By vdboor at Fri, 05/18/2007 - 12:10

These lines are responsible:

if(BU)
{c.cssText=b}
else if(B9)
{c.innerText=b}
else
{c.innerHTML=b}

Where BU is set on MSIE UserAgent, and B9 set on Safari UserAgent.

So the short answers is that stuff like this happens because GMail is horrible piece of crappy enginering.

The correct way to do this would have been to test for the properties cssText or innerText on StyleElements, and only use the innerHTML gecko-hack if anything sane fails. Unfortunately the JS-idiots at Google are incapable of using anything other than UserAgent switches.


By Allan Sandfeld at Fri, 05/18/2007 - 14:36

Hi Allen, care to explain why you're posting the fix, but not committing it? Any problems with it!?


By carlo at Thu, 05/24/2007 - 17:00

I can only access to gmail in html view. Standard view doesn't work at all, neither with IE browser identification nor with firefox browser identification. I wanna try this patch but how to apply this patch? Please provide a detailed instruction. I'm using fc8 with KDE 3.5.8-7.fc8


By kamruddin.nur at Wed, 05/21/2008 - 12:16