[www-doc] [Git][VideoLAN.org/websites][master] macARM detection: Additional robustness improvements

David gitlab at videolan.org
Mon Jan 18 13:46:49 UTC 2021



David pushed to branch master at VideoLAN organization / websites


Commits:
6d793360 by David Fuhrmann at 2021-01-18T14:46:40+01:00
macARM detection: Additional robustness improvements

- guard against glcontext being null (can happen on old browsers
  running 10.7)
- Add opengl code into try / catch block
- Move texture check into the else block (otherwise an already
  detected arm machine might be degraded to intel once support
  for that texture is added)

- - - - -


1 changed file:

- www.videolan.org/include/os-specific.php


Changes:

=====================================
www.videolan.org/include/os-specific.php
=====================================
@@ -82,19 +82,19 @@ function replaceDLinfos( $downloadButton = "#downloadButton" )
                      navigator.userAgent.indexOf("OS X 10.6")!=-1) {
               OS="osx32";
           } else {
-              var glcontext = document.createElement("canvas").getContext("webgl");
-              var debugrenderer = glcontext.getExtension('WEBGL_debug_renderer_info');
-              var renderername = debugrenderer && glcontext.getParameter(debugrenderer.UNMASKED_RENDERER_WEBGL) || "";
-              if (renderername.match(/Apple/) && !renderername.match(/Apple GPU/)) {
-                  OS="osxarm64";
-              } else {
-                  OS="osx";
-              }
-              if (glcontext.getSupportedExtensions().indexOf("WEBGL_compressed_texture_s3tc_srgb") == -1) {
-                  OS="osxarm64";
-              } else {
-                  OS="osx";
-              }
+              OS="osx";
+              try {
+                  var glcontext = document.createElement("canvas").getContext("webgl");
+                  var debugrenderer = glcontext ? glcontext.getExtension('WEBGL_debug_renderer_info') : null;
+                  var renderername = debugrenderer && glcontext.getParameter(debugrenderer.UNMASKED_RENDERER_WEBGL) || "";
+                  if (renderername.match(/Apple/) && !renderername.match(/Apple GPU/)) {
+                      OS="osxarm64";
+                  } else {
+                      if (glcontext.getSupportedExtensions().indexOf("WEBGL_compressed_texture_s3tc_srgb") == -1) {
+                          OS="osxarm64";
+                      }
+                  }
+              } catch (e) { }
           }
        }
        if (navigator.platform.indexOf("Linux")!=-1) {



View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/commit/6d79336034711055763f83180787538b8594fb60

-- 
View it on GitLab: https://code.videolan.org/VideoLAN.org/websites/-/commit/6d79336034711055763f83180787538b8594fb60
You're receiving this email because of your account on code.videolan.org.




More information about the www-doc mailing list