[wp-trac] [WordPress Trac] #27650: Possible interference between media upload progress bar and window.requestAnimFrame calls

WordPress Trac noreply at wordpress.org
Thu Apr 3 03:24:40 UTC 2014


#27650: Possible interference between media upload progress bar and
window.requestAnimFrame calls
--------------------------+-----------------------------
 Reporter:  zipzit        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  3.8.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I wrote a simple little plugin to help troubleshoot CSS @media calls.  The
 plugin added a small box to the corner of the screen, and updated 4 /
 second via window.requestAnimFrame calls. When that plugin is activated,
 the media upload stalls out or comes back with "An error occurred in the
 upload. Please try again later” error message.  When the system stalls,
 the screen is locked, my plugin no longer functions. It doesn't happen
 until the upload media progress bar is nearly 100% complete. The images
 have uploaded fine (I can check the uploads directory via FTP)  The whole
 thing is odd.  The critical parts of my plugin code:

 {{{
 <?php
 function dev_tool_window_size(){
 ?>
     <div id="dev_tool_window_size" style="position: fixed; top:33;
 right:0; min-width:50px; background-color: blue; color: white; z-index:
 100000;">
     window size
     </div>

     <script type="text/javascript">

     function checkScreenSize(){
         document.getElementById('dev_tool_window_size').innerHTML= 'window
 size:  (code removed for WP error test) ';
     }

         // shim layer with setTimeout fallback
         window.requestAnimFrame = (function(){
           return  window.requestAnimationFrame       ||
                   window.webkitRequestAnimationFrame ||
                   window.mozRequestAnimationFrame    ||
                   window.oRequestAnimationFrame      ||
                   window.msRequestAnimationFrame     ||
                   function( callback ){
                     window.setTimeout(callback, 1000 / 4);  /* update 60
 per second?  4 times per second is just fine.  */
                   };
         })();

         (function loop(){
           requestAnimFrame(loop);
           checkScreenSize();
         })();
     </script>
 <?php
 }
 add_action('wp_loaded', 'dev_tool_window_size' );
 ?>
 }}}

 I think this means that anybody running html5 animations using
 window.requestAnimFrame will receive error messages when they attempt to
 upload media.  Is this intended behavior?

 Complete plugin will be attached to the ticket.
 Feel free to call or text or email anytime..
 LB
 313-727-6850
 zipzit at yahoo.com

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27650>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list