WEBCORE_NAVIGATOR_PLATFORM is not defined for Symbian and for Linux platforms. the following javascript would fail <html> <body > The name of the operating system of the current browser should be displayed below:<br> <script type="text/javascript"> document.write(navigator.platform+"<br/>"); </script> </body> </html>
Created attachment 32887 [details] Patch
Comment on attachment 32887 [details] Patch No reason to believe that PLATFORM(LINUX) is "Linux i686"
I think navigator.platform is very similar to what is in PluginViewQt.cpp line 275: static const char* MozillaUserAgent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0";
Created attachment 32911 [details] Patch Add #define for Symbian platform. Use uname to determine the OS name and CPU , but limit it to Linux platform only. (I am not able to test other platforms).
Comment on attachment 32911 [details] Patch r=me. Seems consistent with firefox and chromium on linux, too.
From my reading uname is POSIX.1 so we should guard it with something like PLATFORM(UNIX).
(In reply to comment #6) > From my reading uname is POSIX.1 so we should guard it with something like > PLATFORM(UNIX). I wanted to be on the safe side, so I limited this to Linux based platforms. Some types of Unix might not be 100% POSIX.1 compatible, and I did not want to take the risk.
Comment on attachment 32911 [details] Patch > String NavigatorBase::platform() const > { > +#if PLATFORM(LINUX) > + struct utsname osname; > + int result = uname(&osname); > + String platformName; > + if (result >= 0) { > + platformName = osname.sysname; > + platformName += " "; > + platformName += osname.machine; > + } > + return platformName; Can we please make use of DEFINE_STATIC_LOCAL here for platformName?
Comment on attachment 32911 [details] Patch > > String NavigatorBase::platform() const > { > +#if PLATFORM(LINUX) > + struct utsname osname; > + int result = uname(&osname); > + String platformName; > + if (result >= 0) { > + platformName = osname.sysname; > + platformName += " "; > + platformName += osname.machine; > + } > + return platformName; > +#else > return WEBCORE_NAVIGATOR_PLATFORM; > +#endif Jan is right, we should call uname(&osname) exactly once. Yael could you post an updated version of the patch?
Created attachment 32996 [details] Patch Use DEFINE_STATIC_LOCAL as requested in comment #8.
landed in 46078