mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-29 11:21:31 +00:00
In Safari, limit iterations of the command-parsing loop.
This commit is contained in:
parent
862057b32c
commit
4fd4a0372c
1 changed files with 19 additions and 0 deletions
|
@ -1,11 +1,30 @@
|
|||
define [], () ->
|
||||
|
||||
browserIsSafari = () ->
|
||||
userAgent = navigator.userAgent
|
||||
(
|
||||
userAgent.match(/.*Safari\/.*/) &&
|
||||
!userAgent.match(/.*Chrome\/.*/) &&
|
||||
!userAgent.match(/.*Chromium\/.*/)
|
||||
)
|
||||
|
||||
|
||||
class Parser
|
||||
constructor: (@doc) ->
|
||||
|
||||
parse: () ->
|
||||
limit = null
|
||||
if browserIsSafari()
|
||||
limit = 100
|
||||
|
||||
commands = []
|
||||
seen = {}
|
||||
iterations = 0
|
||||
while command = @nextCommand()
|
||||
iterations += 1
|
||||
if limit && iterations > limit
|
||||
return commands
|
||||
|
||||
docState = @doc
|
||||
|
||||
optionalArgs = 0
|
||||
|
|
Loading…
Reference in a new issue