فهرست منبع

remove the render timeout

pdfjs uses requestAnimationFrame to schedule the rendering, and this
does not fire if the tab is inactive. That causes an unwanted error if
switching tabs for more than the one minute timeout.
Brian Gough 10 سال پیش
والد
کامیت
7555382e33
1فایلهای تغییر یافته به همراه1 افزوده شده و 15 حذف شده
  1. 1 15
      services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee

+ 1 - 15
services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee

@@ -8,7 +8,6 @@ define [
 		class PDFRenderer
 		class PDFRenderer
 			JOB_QUEUE_INTERVAL: 25
 			JOB_QUEUE_INTERVAL: 25
 			PAGE_LOAD_TIMEOUT: 60*1000
 			PAGE_LOAD_TIMEOUT: 60*1000
-			PAGE_RENDER_TIMEOUT: 60*1000
 			INDICATOR_DELAY1: 100  # time to delay before showing the indicator
 			INDICATOR_DELAY1: 100  # time to delay before showing the indicator
 			INDICATOR_DELAY2: 250  # time until the indicator starts animating
 			INDICATOR_DELAY2: 250  # time until the indicator starts animating
 
 
@@ -295,19 +294,9 @@ define [
 					transform: [pixelRatio, 0, 0, pixelRatio, 0, 0]
 					transform: [pixelRatio, 0, 0, pixelRatio, 0, 0]
 				}
 				}
 
 
-				timedOut = false
-
-				timer = $timeout () =>
-					# page render timed out
-					Raven?.captureMessage?('pdfng page render timed out after ' + @PAGE_RENDER_TIMEOUT + 'ms (1% sample)') if Math.random() < 0.01
-					timedOut = true
-					result.cancel()
-				, @PAGE_RENDER_TIMEOUT
-
 				result.then () ->
 				result.then () ->
 					# page render success
 					# page render success
 					element.canvas.replaceWith(canvas)
 					element.canvas.replaceWith(canvas)
-					$timeout.cancel(timer)
 					canvas.removeClass('pdfng-rendering')
 					canvas.removeClass('pdfng-rendering')
 					page.getTextContent().then (textContent) ->
 					page.getTextContent().then (textContent) ->
 						textLayer.setTextContent textContent
 						textLayer.setTextContent textContent
@@ -319,10 +308,7 @@ define [
 						self.errorCallback?(error)
 						self.errorCallback?(error)
 				.catch (error) ->
 				.catch (error) ->
 					# page render failed
 					# page render failed
-					$timeout.cancel(timer)
-					if timedOut
-						self.errorCallback?('timeout')
-					else if error is 'cancelled'
+					if error is 'cancelled'
 						return # do nothing when cancelled
 						return # do nothing when cancelled
 					else
 					else
 						self.errorCallback?(error)
 						self.errorCallback?(error)