diff options
author | maf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-29 01:46:51 +0000 |
---|---|---|
committer | maf@google.com <maf@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-29 01:46:51 +0000 |
commit | ab5196786a9458716b09844a4d6eec624c3e54a6 (patch) | |
tree | a7424d2cffe442ae2b954da55728f3e89a519862 /o3d/samples/o3djs | |
parent | 8f3065eb8272020b90013eadfeb1b689068076bb (diff) | |
download | chromium_src-ab5196786a9458716b09844a4d6eec624c3e54a6.zip chromium_src-ab5196786a9458716b09844a4d6eec624c3e54a6.tar.gz chromium_src-ab5196786a9458716b09844a4d6eec624c3e54a6.tar.bz2 |
Until we work out why V8 refuses to work on the Safari/10.6 combination, ignore attempts to select the V8 engine on that config.
This makes everything work. w00t!
Review URL: http://codereview.chromium.org/2361003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3djs')
-rw-r--r-- | o3d/samples/o3djs/util.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/o3d/samples/o3djs/util.js b/o3d/samples/o3djs/util.js index d67f02a..da54ec8 100644 --- a/o3d/samples/o3djs/util.js +++ b/o3d/samples/o3djs/util.js @@ -583,13 +583,37 @@ o3djs.util.Engine = { o3djs.util.mainEngine_ = o3djs.util.Engine.BROWSER; /** + * Checks the user agent string for substring s, returning true if it appears. + * @return {boolean} Whether the browser's user-agent string contains string s. + */ +function o3djs_navHas(s) { + return navigator.userAgent.indexOf(s) != -1; +} + +/** + * Checks for V8 support. This is to cope with environments where our V8 is + * known to be problematic, eg Safari on 10.6. + * @return {boolean} Whether the environment supports V8. + */ +function o3djs_isV8Supported() { + if (o3djs_navHas('Chrome')) + return true; + if (!o3djs_navHas('Safari')) + return true; + return !o3djs_navHas('Intel Mac OS X 10_6'); +} + +/** * Select an engine to use as the main engine (the one the makeClients * callback will be invoked on). If an embedded engine is requested, one * element must be identified with the id 'o3d'. The callback will be invoked * in this element. + * Ignores attempts to choose V8 if it is not supported in this host. * @param {o3djs.util.Engine} engine The engine. */ o3djs.util.setMainEngine = function(engine) { + if ((engine == o3djs.util.Engine.V8) && !o3djs_isV8Supported()) + return; o3djs.util.mainEngine_ = engine; }; |