Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Chrome error
Mon, Jan 21 2013 10:46 AMPermanent Link

Matthew Jones

I get an error "Uncaught TypeError: Cannot call method 'toLocaleUpperCase' of null"
when I am using a comboBox in Chrome. The combo has three theme names listed, and
the code is simple:
   Application.Theme := cboTheme.Text;

This only happens in Chrome, and not the integrated browser (IE?) or the IE
standalone. In fact, Chrome is now not showing the content of my form at all. Hmm.
Okay, that killing the page is repeatable. It appears that Chrome is upset - on
trying again I can see these errors:

Resource interpreted as Script but transferred with MIME type
application/octet-stream: "http://localhost/interactweb.js". interactweb.html:11

Uncaught TypeError: Cannot call method 'toLocaleUpperCase' of null
interactweb.js:214

Closing EWB, hitting refresh to clear the cache in Chrome, and then starting again,
makes it work until I select the combo again. I have another combo with URLs in,
and that works fine for selecting a TPage contents, so it must be theme related.

/Matthew Jones/
Tue, Jan 22 2013 10:23 AMPermanent Link

Matthew Jones

The javascript is this line:

function sametext($0, $1)
{
  return ($0.toLocaleUpperCase().localeCompare($1.toLocaleUpperCase()) == 0);
};


/Matthew Jones/
Tue, Jan 22 2013 10:42 AMPermanent Link

Matthew Jones

This is the Chrome stack when it loads and doesn't even show anything:
Uncaught TypeError: Cannot call method 'toLocaleUpperCase' of null
interactweb.js:214
sametext interactweb.js:214
webdom_setactivestylesheet interactweb.js:473
webdom_init interactweb.js:747
interactweb_load interactweb.js:16288
onload

The problem is "obvious" in that the webdom_setactivestylesheet is calling sametext
with a "null" variable, but the calling function is:
function webdom_init()
{
  webdom_setactivestylesheet("Default");
};

I tried setting the other themes as default, and they are all the same. I don't
understand this. Looking at the code, I can only imagine that the stylesheet title
is null.
// FAIL: if (sametext(window.document.styleSheets[i].title, name))

These themes are ones downloaded from the "newsgroup" via the web interface.

/Matthew Jones/
Tue, Jan 22 2013 10:47 AMPermanent Link

Matthew Jones

Okay, more experiments. I removed all the themes, and set it to default, and it all
works fine. I then set it to a custom theme, and that fails.  Opening the theme
shows there is a title.

Could it be that the custom theme is not loaded at the time it is selected? Or
something? I'll stop now, and do something more useful on my project. Interesting
learning how it all works though!

/Matthew Jones/
Tue, Jan 22 2013 11:28 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I get an error "Uncaught TypeError: Cannot call method
'toLocaleUpperCase' of null" when I am using a comboBox in Chrome. The combo
has three theme names listed, and the code is simple:
   Application.Theme := cboTheme.Text; >>

What version of Chrome, and are you running via localhost or directly via
the file system ?  If you're running against the file system, please see
this FAQ:

http://www.elevatesoft.com/supportfaq?action=view&category=ewb&question=google_chrome_filesystem_display

Chrome's handling of stylesheet rules is fairly bad, and causes all sorts of
issues with theme switching.  I just tried switching a theme at runtime
using Chrome Version 24.0.1312.52 m and it fails with a "theme not found"
error.

<< Resource interpreted as Script but transferred with MIME type
application/octet-stream: "http://localhost/interactweb.js".
interactweb.html:11 >>

That's just a minor issue with the web server content type being reported
and won't affect the operation (I fixed that one a week or so ago and a fix
will be in the next build).

If you want to send me your project, I'll test out the combo box issue here,
but combo boxes seem to work fine with the default or a custom theme here
with the Chrome version reported above.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jan 22 2013 11:39 AMPermanent Link

Matthew Jones

I'm running whatever the latest "normal" Chrome is, and to localhost not file.

To pick up on your other response (since it is the same issue):
> Please see my other reply - WebKit/Chrome has issues with switching
> stylesheets at runtime, so if you're planning on targeting these
> browsers you're probably going to have to throw out the "theme
> switching" aspect of your application.

I put it in only so I could experiment, but it would be nice to be able to theme
the app on loading to suit the target device. So look a bit more Mac like on a Mac,
PC like on Windows, or whatever. But not really important, I just wanted to see
what the themes looked like.

/Matthew Jones/
Tue, Jan 22 2013 12:02 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I put it in only so I could experiment, but it would be nice to be able
to theme the app on loading to suit the target device. So look a bit more
Mac like on a Mac, PC like on Windows, or whatever. But not really
important, I just wanted to see what the themes looked like. >>

Yeah, it sure would be nice, but the WebKit devs are apparently being
stubborn on this one.  I don't know if you noticed, but any stylesheets
labeled as "alternate" in the HTML don't even show up in the stylesheets
collection for the document.

Tim Young
Elevate Software
www.elevatesoft.com
Image