Fix for Chrome in iOS
See https://github.com/devote/HTML5-History-API/issues/29
168175
function(method, args) {
    var isNeedFix = global.history !== windowHistory;
    if (isNeedFix) {
      global.history = windowHistory;
    }
    method.apply(windowHistory, args);
    if (isNeedFix) {
      global.history = historyObject;
    }
  }
930446
function handleError(message, url, line) {
        // Ignore this error if it does not look like the rather vague cross origin error in Chrome
        // Chrome will print it to the console anyway
        if (!testCrossOriginError(message, url, line)) {
            if (previousErrorHandler) {
                return previousErrorHandler(message, url, line);
            }
            return;
        }

        // Show an error message
        window.alert("Oops! This application doesn't run in browsers yet.\n\nIt is built in HTML, but right now it runs as a desktop app so you can use it to edit local files. Please use the application shell in the following repo to run this application:\n\ngithub.com/adobe/brackets-shell");

        // Restore the original handler for later errors
        window.onerror = previousErrorHandler;
    }
1277898
public void pushHistory(String strHistory, boolean bPushToBrowser)
    {
        if (m_vHistory == null)
            m_vHistory = new Vector<String>();
        m_vHistory.addElement(strHistory);
        String strHelp = Utility.fixDisplayURL(strHistory, true, true, true, this);
        if (this.getAppletScreen() != null)
        	if (this.getAppletScreen().getScreenFieldView() != null)
        		this.getAppletScreen().getScreenFieldView().showDocument(strHelp, MenuConstants.HELP_WINDOW_CHANGE);
        if (bPushToBrowser)
        	if (this.getAppletScreen() != null)
            	if (this.getAppletScreen().getTask() instanceof BaseAppletReference)
    				((BaseAppletReference)this.getAppletScreen().getTask()).pushBrowserHistory(strHistory, this.getTitle(), bPushToBrowser);    	// Let browser know about the new screen
    }
407595
function (now) {

      if (this.lastFrameTime){
        // chrome bug, see: https://code.google.com/p/chromium/issues/detail?id=268213
        // http://jsfiddle.net/pehrlich/35pTx/
        // console.assert(this.lastFrameTime < now);
        if (now < this.lastFrameTime){
          // this fix will cause an extra animation frame before the lerp frame advances. no big.
          this.lastFrameTime = now;
        }else{
          this.timeSinceLastFrame += (now - this.lastFrameTime);
        }
      }

      this.lastFrameTime = now;

      console.assert(!isNaN(this.timeSinceLastFrame));


      var timeToNextFrame;

      // handle frame dropping, etc
      while ( this.timeSinceLastFrame > ( timeToNextFrame = this.recording.timeToNextFrame() ) ){
        this.timeSinceLastFrame -= timeToNextFrame;
        if (!this.recording.advanceFrame()){
          this.pause();
          this.controller.emit('playback.playbackFinished', this);
          return
        }
      }

      this.sendFrame(
        this.recording.createLerpFrameData(this.timeSinceLastFrame / timeToNextFrame)
      );

    }
371062
public void popBrowserHistory(int quanityToPop, boolean bCommandHandledByJava, String browserTitle)
    {
        if (this.getBrowserManager() != null)
            this.getBrowserManager().popBrowserHistory(quanityToPop, bCommandHandledByJava, this.getStatusText(Constants.INFORMATION));        // Let browser know about the new screen
    }
480354
function restore_options() {
  // Use default value showChangeLog = true.
  chrome.storage.sync.get({
    showChangeLog: true
  }, function (items) {
    document.getElementById('show_changelog').checked = items.showChangeLog;
  });
}
1014756
function updateSidebar () {
      var top = (doc && doc.scrollTop) || body.scrollTop
      var headerHeight = header.offsetHeight
      if (top > (headerHeight - 25)) {
        // main.classList.add('fix-sidebar')
        header.classList.add('fix-header')
      } else {
        // main.classList.remove('fix-sidebar')
        header.classList.remove('fix-header')
      }
      if (animating || !allLinks) return
      var last
      for (var i = 0; i < allLinks.length; i++) {
        var link = allLinks[i]
        if (link.offsetTop > top) {
          if (!last) last = link
          break
        } else {
          last = link
        }
      }
      if (last) {
        setActive(last.id)
      }
    }
1069522
function() {
            var applyTouchMove = function(difference_x, difference_y) {
                $this.scrollTop($this.scrollTop() - difference_y);
                $this.scrollLeft($this.scrollLeft() - difference_x);

                // update bar position
                updateBarSizeAndPosition();
            };

            var start_coords = {},
                start_time = 0,
                speed = {},
                breaking_process = null;

            $this.bind("touchstart.perfect-scroll", function(e) {
                var touch = e.originalEvent.targetTouches[0];

                start_coords.pageX = touch.pageX;
                start_coords.pageY = touch.pageY;

                start_time = (new Date()).getTime();

                if (breaking_process !== null) {
                    clearInterval(breaking_process);
                }
            });
            $this.bind("touchmove.perfect-scroll", function(e) {
                var touch = e.originalEvent.targetTouches[0];

                var current_coords = {};
                current_coords.pageX = touch.pageX;
                current_coords.pageY = touch.pageY;

                var difference_x = current_coords.pageX - start_coords.pageX,
                    difference_y = current_coords.pageY - start_coords.pageY;

                applyTouchMove(difference_x, difference_y);
                start_coords = current_coords;

                var current_time = (new Date()).getTime();
                speed.x = difference_x / (current_time - start_time);
                speed.y = difference_y / (current_time - start_time);
                start_time = current_time;

                e.preventDefault();
            });
            $this.bind("touchend.perfect-scroll", function(e) {
                breaking_process = setInterval(function() {
                    if(Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {
                        clearInterval(breaking_process);
                        return;
                    }

                    applyTouchMove(speed.x * 30, speed.y * 30);

                    speed.x *= 0.8;
                    speed.y *= 0.8;
                }, 10);
            });
        }
175264
function defaultError(view, location) {
	const code = (/^[45]\d\d$/).test(location.name) ? +location.name : 0;
	view.document.body['inner'+'HTML'] = `<h1 id="code"></h1><span id="message"></span>`
	+`<style> :root { background: #424F5A; filter: invert(1) hue-rotate(180deg); font-family: Segoe UI, Tahoma, sans-serif; } </style>`;
	view.document.querySelector('#message').textContent = code ? view.history.state && view.history.state.message || '' : `Unknown view "${ location.name }"`;
	view.document.querySelector('#code').textContent = code || 404;
	view.document.title = !code || code === 404 ? 'Not Found' : view.history.state && view.history.state.title || 'Error';
	!code && console.error(`Got unknown view "${ view.location.hash.slice(1) }"`);
	location.onChange(() => view.location.reload());
}
515388
function Notifications(chrome) {
  this.chrome = chrome;
  
  
  /**
   * Creates and displays a notification.
   * 
   * @param {string} notificationId 
   * @param {[object Object]} options 
   * @param {function} callback 
   */
  this.create = sinon.stub();
  
  /**
   * Updates an existing notification.
   * 
   * @param {string} notificationId 
   * @param {[object Object]} options 
   * @param {function} callback 
   */
  this.update = sinon.stub();
  
  /**
   * Clears the specified notification.
   * 
   * @param {string} notificationId 
   * @param {function} callback 
   */
  this.clear = sinon.stub();
  
  /**
   * Retrieves all the notifications.
   * 
   * @param {function} callback 
   */
  this.getAll = sinon.stub();
  
  /**
   * Retrieves whether the user has enabled notifications from this app or extension.
   * 
   * @param {function} callback 
   */
  this.getPermissionLevel = sinon.stub();
  
  
  /**
   */
  this.onClosed = new Event();
  
  /**
   */
  this.onClicked = new Event();
  
  /**
   */
  this.onButonClicked = new Event();
  
  /**
   */
  this.onPermissionLevelChanged = new Event();
  
  /**
   */
  this.onShowSettings = new Event();
  
}
475931
function() {
            var ua = navigator.userAgent, parsed;

            if (/*@cc_on@if(@_jscript_version>=5)!@end@*/0)
                return true;
                
            if (parsed = ua.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/))
                return parsed[1] >= '4.0.249.4' || 1 * parsed[1].split(".")[0] > 5;
            if ((parsed = ua.match(/Safari\/(\d+\.\d+)/)) && !/iPhone/.test(ua))
                return parsed[1] >= '525.13';
            if (/Opera/.test({}.toString.call(window.opera)))
                return opera.version() >= '10.00';
            if (parsed = ua.match(/rv:(\d+\.\d+\.\d+)[^b].*Gecko\//))
                return parsed[1] >= '1.9.1';

            return false;
        }
1343574
public String popHistory(int quanityToPop, boolean bPopFromBrowser)
    {
        String strHistory = null;
        for (int i = 0; i < quanityToPop; i++)
        {
        	strHistory = null;
	        if (m_vHistory != null) if (m_vHistory.size() > 0)
	            strHistory = (String)m_vHistory.remove(m_vHistory.size() - 1);
        }
        if (bPopFromBrowser)
        	if (this.getAppletScreen() != null) 
            	if (this.getAppletScreen().getTask() instanceof BaseAppletReference)
    				((BaseAppletReference)this.getAppletScreen().getTask()).popBrowserHistory(quanityToPop, strHistory != null, this.getTitle());    	// Let browser know about the new screen
        return strHistory;
    }
1368177
function changeState(state, url, replace, lastURLValue) {
    if (!isSupportHistoryAPI) {
      // if not used implementation history.location
      if (isUsedHistoryLocationFlag === 0) isUsedHistoryLocationFlag = 2;
      // normalization url
      var urlObject = parseURL(url, isUsedHistoryLocationFlag === 2 && ('' + url).indexOf("#") !== -1);
      // if current url not equal new url
      if (urlObject._relative !== parseURL()._relative) {
        // if empty lastURLValue to skip hash change event
        lastURL = lastURLValue;
        if (replace) {
          // only replace hash, not store to history
          windowLocation.replace("#" + urlObject._special);
        } else {
          // change hash and add new record to history
          windowLocation.hash = urlObject._special;
        }
      }
    } else {
      lastURL = windowLocation.href;
    }
    if (!isSupportStateObjectInHistory && state) {
      stateStorage[windowLocation.href] = state;
    }
    isFireInitialState = false;
  }
350362
function eliminateDuplicates(browsers) {
    var set = {};

    browsers.forEach(function (browser) {
        var osgroup = browser.os;
        var subgroup = browser.long_name;
        var version = browser.short_version;
        var device;
        var browserName;
        if (browser.api_name === "iphone")  {
            osgroup = device = "iPhone Simulator";
        } else if (browser.api_name === "ipad") {
            osgroup = device =  "iPad Simulator";
        } else if (browser.long_name === "Google Chrome") {
            browserName = 'Chrome';
        } else if (browser.long_name === "Microsoft Edge") {
            browserName = 'MicrosoftEdge';
            version = browser.long_version.substr(0, 8);
        } else if (browser.api_name === "android") {
            browserName = 'Android';
            osgroup = "Android " + browser.short_version;
            device = browser.long_name;
            if (subgroup === "Android") {
                subgroup += " " + version + " Emulator";
                device = "Android Emulator";
            }
        } else if (osgroup in OS_ID_TO_GROUPNAME) {
            osgroup = OS_ID_TO_GROUPNAME[osgroup];
        }
        set[JSON.stringify([osgroup, subgroup, version])] = {
            browserName: browserName || browser.long_name,
            platform: OS_ID_TO_GROUPNAME[browser.os] || browser.os,
            version: version,
            deviceName: device || browser.device
        };
    });

    var uniques = Object.keys(set).sort().map(function (id) {
        return set[id];
    });
    return uniques;
}
261096
function fixEvent ( e, pageOffset ) {

            // Prevent scrolling and panning on touch events, while
            // attempting to slide. The tap event also depends on this.
            e.preventDefault();

            // Filter the event to register the type, which can be
            // touch, mouse or pointer. Offset changes need to be
            // made on an event specific basis.
            var touch = e.type.indexOf('touch') === 0;
            var mouse = e.type.indexOf('mouse') === 0;
            var pointer = e.type.indexOf('pointer') === 0;
            var x;
            var y;

            // IE10 implemented pointer events with a prefix;
            if ( e.type.indexOf('MSPointer') === 0 ) {
                pointer = true;
            }

            if ( touch ) {

                // Fix bug when user touches with two or more fingers on mobile devices.
                // It's useful when you have two or more sliders on one page,
                // that can be touched simultaneously.
                // #649, #663, #668
                if ( e.touches.length > 1 ) {
                    return false;
                }

                // noUiSlider supports one movement at a time,
                // so we can select the first 'changedTouch'.
                x = e.changedTouches[0].pageX;
                y = e.changedTouches[0].pageY;
            }

            pageOffset = pageOffset || getPageOffset();

            if ( mouse || pointer ) {
                x = e.clientX + pageOffset.x;
                y = e.clientY + pageOffset.y;
            }

            e.pageOffset = pageOffset;
            e.points = [x, y];
            e.cursor = mouse || pointer; // Fix #435

            return e;
        }
1134462
function(element, enterCallback, exitCallback, errorCallback) {
			element = element || document.body;

			elements.push({
				element: element,
				enter: enterCallback || emptyFunction,
				exit: exitCallback || emptyFunction,
				error: errorCallback || emptyFunction
			});

			// iOS only supports webkitEnterFullscreen on videos, so try that.
			// Browsers that don't support full screen at all will also go through this,
			// but they will fire an error.
			if (fn.request === undefined) {
				videoEnterFullscreen(element);
				return;
			}

			// `document.fullscreenEnabled` defined, but is `false`, so try a video if there is one.
			if (iframe && document[fn.enabled] === false) {
				videoEnterFullscreen(element);
				return;
			}

			// Chrome on Android reports that fullscreen is enabled, but it isn't really on < 32.
			if (chromeAndroid !== false && chromeAndroid < 32) {
				videoEnterFullscreen(element);
				return;
			}

			// If we're in an iframe, it needs to have the `allowfullscreen` attribute in order for element full screen
			// to work. Safari 5.1 supports element full screen, but doesn't have `document.webkitFullScreenEnabled`,
			// so the only way to tell if it will work is to just try it.
			if (iframe && fn.enabled === undefined) {
				fn.enabled = 'webkitFullscreenEnabled';

				element[fn.request]();

				setTimeout(function() {
					// It didn't work, so set `webkitFullscreenEnabled` to false so we don't
					// have to try again next time. Then try to fall back to video full screen.
					if (!document[fn.element]) {
						document[fn.enabled] = false;
						videoEnterFullscreen(element);
					}
					// It worked! set `webkitFullscreenEnabled` so we know next time.
					else {
						document[fn.enabled] = true;
					}
				}, 250);

				return;
			}

			try {
				element[fn.request]();

				// If there's no element after 100ms, it didn't work. This check is for Safari 5.1
				// which fails to fire a `webkitfullscreenerror` if the request wasn't from a user
				// action.
				setTimeout(function() {
					if (!document[fn.element]) {
						callOnError(iframe ? 'not_enabled' : 'not_allowed', element);
					}
				}, 100);
			}
			catch (err) {
				callOnError('not_enabled', element);
			}
		}
827983
public void pushHistory(String strHistory, boolean bPushToBrowser)
    {
        if (m_vHistory == null)
            m_vHistory = new Vector<String>();
        String strHelpURL = ThinUtil.fixDisplayURL(strHistory, true, true, true, this);
        if (bPushToBrowser)
            if ((strHistory != null) && (strHistory.length() > 0))
                if (strHistory.indexOf(Params.APPLET + '=') == -1)
            strHistory = UrlUtil.addURLParam(strHistory, Params.APPLET, this.getClass().getName()); // Adding &applet says this is a screen on not back/etc
        m_vHistory.addElement(strHistory);
    	this.getApplication().showTheDocument(strHelpURL, this, ThinMenuConstants.HELP_WINDOW_CHANGE);
        this.pushBrowserHistory(strHistory, this.getStatusText(Constants.INFORMATION), bPushToBrowser);    	// Let browser know about the new screen
    }