From 4fd4a0372cd6c72cbb042e6f180d0c64976326ae Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 11 Apr 2016 09:55:53 +0100 Subject: [PATCH] In Safari, limit iterations of the command-parsing loop. --- .../auto-complete/SuggestionManager.coffee | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SuggestionManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SuggestionManager.coffee index e0c3710358..914f43ee6b 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SuggestionManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/SuggestionManager.coffee @@ -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