Avoid all 'arguments' mutation for Safari's sake.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Sun, 19 Apr 2015 14:10:17 +0000 (16:10 +0200)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Sun, 19 Apr 2015 14:10:17 +0000 (16:10 +0200)
BUGS.org
src/yuu/core.js
src/yuu/gfx.js
src/yuu/yf.js

index ccdfe9d..93b9066 100644 (file)
--- a/BUGS.org
+++ b/BUGS.org
@@ -1,16 +1,24 @@
 * Next Version
-** Remove CSS pixel ratio > 1 support in Safari
-   Mac OS X Safari has scaling bugs, and iOS Safari has lower
-   performance.
 ** Use standard Unicode codepoints for icon fonts
    This is done via the [[https://korewanetadesu.com/pages/fontstandard.html][Font Standard]] icon font.
-** Work around incorrect Safari JIT generation
-   Some details of the symptoms / likely-but-unproven cause at
-   https://korewanetadesu.com/safari-jit-bug.html.
 ** Sped up background and book noise animations
 ** Cat paws
 ** DONE Migrate to nw.js (from node-webkit)
 
+** DONE Safari 8 / iOS 8 support
+   This is the first version to support Safari on Mac OS X and iOS.
+
+   The primary problem in earlier versions appears to be a bug in
+   Safari's JIT when optimizing functions that modify JavaScript's
+   ~arguments~ object. Code triggering this bug was rewritten to avoid
+   modifying ~arguments~. This bug is further described in
+   https://korewanetadesu.com/safari-jit-bug.html and seems to still
+   exist in current versions of WebKit's new "FTL" JIT.
+
+   Prior to OS X 10.10, Safari on OS X will show [[https://bugs.webkit.org/show_bug.cgi?id=134854][artifacts on HiDPI
+   ("Retina") screens due to a bug in its compositing]].
+   
+
 
 * v1.2
 ** DONE Override the GPU blacklist on GNU/Linux
 
 
 * Open Issues
-** TODO Safari handles WebGL device pixel scaling incorrectly
-   Given a device pixel ratio of 2, Safari will scale the backbuffer
-   incorrectly when rendering it (seems like it scales it down using
-   bilinear interpolation, then back up with the same) resulting in
-   something that looks worse than leaving the DPR set to 1.
-
-   Currently DPR is fixed to 1 for Safari.
-
-   https://bugs.webkit.org/show_bug.cgi?id=134854
-** TODO Still some "random stalls" in Safari.
-   Likely due to the same JIT bug manifesting in some other ways.
 ** TODO Choppy / staticy audio on iOS
    Especially when backgrounding, e.g. switching tabs. There's
    probably no easy way to avoid this.
 ** TODO Scrolling is broken in licensing window
 This began when upgrading to nw.js 0.12 (from node-webkit 0.10.4). If
 it's broken one place it's probably broken other places also.
+
+Not reproducible in Chrome 42, so it's possible this was some
+transient Chromium bug that will be gone in newer NW.js.
index e770f86..f4b40a2 100644 (file)
@@ -7,11 +7,6 @@
 (function (yuu) {
     "use strict";
 
-    yuu.isSafari = function (ua) {
-        return /^((?!chrome).)*safari/i.test(ua || navigator.userAgent)
-            || navigator.standalone;
-    };
-
     yuu.require = function (m) {
         try { return require(m); }
         catch (exc) { return null; }
index 3765aaa..2c3088e 100644 (file)
     var gl;
     var canvas;
 
-    // Safari on OS X has issues with DPR != 1 where the backbuffer
-    // scales down, then back up. I'm pretty sure this is not a
-    // problem with this code, because I see similar artifacting on
-    // most demos, e.g.
-    // https://www.khronos.org/registry/webgl/sdk/demos/google/shiny-teapot/index.html
-    //
-    // With DPR = 1 this presumably still happens but the negative
-    // effect is lessened.
-    //
-    // Safari on iOS does _not_ have this problem (another reason why
-    // I suspect it's a bug in Safari and not this code), but reducing
-    // fragment count by 75% is generally a good idea on these devices
-    // anyway.
-    var dpr = yuu.DPR = !yuu.isSafari()
-        ? (this.devicePixelRatio || 1)
-        : 1;
+    var dpr = yuu.DPR = this.devicePixelRatio || 1;
 
     yT.defineProperty(Int8Array.prototype, "GL_TYPE", 0x1400);
     yT.defineProperty(Uint8Array.prototype, "GL_TYPE", 0x1401);
index 0779e7e..81ccb2e 100644 (file)
         case 1: return function () { return f.call(this, arguments); };
         default:
             return function () {
-                var args = slice(arguments, 0, length - 1);
-                args.push(slice(arguments, length - 1));
+                var args = slice(arguments, 0, length);
+                args[length - 1] = slice(arguments, length - 1);
                 return f.apply(this, args);
             };
         }
             map.call(thisArg, callback, ...).
         */
         var a = [];
-        arguments[0] = compose(pusher(a), arguments[0]);
-        each.apply(this, arguments);
+        var args = slice(arguments);
+        args[0] = compose(pusher(a), args[0]);
+        each.apply(this, args);
         return a;
     }
 
             As eachr is to each, so mapr is to map.
         */
         var a = [];
-        arguments[0] = compose(pusher(a), arguments[0]);
-        eachr.apply(this, arguments);
+        var args = slice(arguments);
+        args[0] = compose(pusher(a), args[0]);
+        eachr.apply(this, args);
         return a;
     }
 
     }
 
     function every () {
-        arguments[0] = not(arguments[0] || I);
-        return !some.apply(this, arguments);
+        var args = slice(arguments);
+        args[0] = not(args[0] || I);
+        return !some.apply(this, args);
     }
 
     function none () {