From 274c9457b9a9029fffb9801ce072143248b0553c Mon Sep 17 00:00:00 2001 From: benweet Date: Thu, 24 Apr 2014 00:12:21 +0100 Subject: [PATCH] Fixed memory leaks --- Gruntfile.js | 22 +- bower.json | 2 +- package.json | 5 +- public/cache.manifest | 3 +- public/res-min/main.js | 23509 +++++++++++++++- public/res-min/themes/base.css | 7 +- public/res-min/themes/default.css | 19 +- public/res-min/themes/gray.css | 19 +- public/res-min/themes/night.css | 19 +- public/res-min/themes/original.css | 17 +- public/res-min/themes/school.css | 19 +- public/res/constants.js | 2 +- .../res/extensions/dialogManagePublication.js | 17 +- .../extensions/dialogManageSynchronization.js | 17 +- public/res/extensions/documentManager.js | 182 +- public/res/extensions/documentPanel.js | 18 +- public/res/extensions/documentSelector.js | 21 +- public/res/html/bodyIndex.html | 2 +- public/res/html/bodyViewer.html | 10 +- public/res/layout.js | 108 +- public/res/styles/base.less | 4 + public/res/styles/main.less | 19 +- public/res/worker.js | 15 - public/res/workers/spellCheckWorker.js | 39 - 24 files changed, 23603 insertions(+), 492 deletions(-) delete mode 100644 public/res/worker.js delete mode 100644 public/res/workers/spellCheckWorker.js diff --git a/Gruntfile.js b/Gruntfile.js index 2c6e99f7..11f692ee 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,6 +3,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-contrib-less'); + grunt.loadNpmTasks('grunt-jsbeautifier'); grunt.loadNpmTasks('grunt-string-replace'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-bower-requirejs'); @@ -35,14 +36,6 @@ module.exports = function(grunt) { mainConfigFile: 'public/res/main.js', optimize: "uglify2", inlineText: true, - /* - uglify2: { - output: { - beautify: true, - indent_level: 1, - }, - }, - */ excludeShallow: [ 'css/css-builder', 'less/lessc-server', @@ -51,6 +44,16 @@ module.exports = function(grunt) { } } }, + jsbeautifier: { + files: ['public/res-min/main.js'], + options: { + js: { + space_before_conditional: false, + keep_array_indentation: true, + indentWithTabs: true, + } + } + }, less: { compile: { options: { @@ -182,6 +185,9 @@ module.exports = function(grunt) { // Run r.js optimization grunt.task.run('requirejs'); + // Beautify uglified JS for site error analysis + grunt.task.run('jsbeautifier'); + }); /*************************************************************************** diff --git a/bower.json b/bower.json index 83571b9c..c30d9aa7 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "stackedit", - "version": "3.99.1", + "version": "3.99.2", "description": "StackEdit is a free, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.", "dependencies": { "bootstrap": "3.0.3", diff --git a/package.json b/package.json index 52f9d7e1..1b6e9d96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stackedit", - "version": "3.99.1", + "version": "3.99.2", "private": true, "description": "StackEdit is a free, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.", "main": "res/main.js", @@ -22,7 +22,8 @@ "grunt-bower-requirejs": "~0.7.1", "grunt-bower-task": "~0.3.1", "grunt-bump": "0.0.11", - "grunt-contrib-jshint": "~0.7.1" + "grunt-contrib-jshint": "~0.7.1", + "grunt-jsbeautifier": "^0.2.7" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/public/cache.manifest b/public/cache.manifest index 35d299b0..adc82520 100644 --- a/public/cache.manifest +++ b/public/cache.manifest @@ -1,8 +1,7 @@ CACHE MANIFEST -#Date Tue Apr 22 2014 00:21:08 +#Date Thu Apr 24 2014 00:11:08 CACHE: -res/worker.js libs/MathJax/MathJax.js?config=TeX-AMS_HTML libs/MathJax/config/Safe.js libs/MathJax/config/TeX-AMS_HTML.js diff --git a/public/res-min/main.js b/public/res-min/main.js index 03edbdc1..68dbf6d4 100644 --- a/public/res-min/main.js +++ b/public/res-min/main.js @@ -10,8 +10,8 @@ * http://jquery.org/license * * Date: 2013-07-03T13:30Z - */ - + */ + /*! * Sizzle CSS Selector Engine v1.9.4-pre * http://sizzlejs.com/ @@ -21,8 +21,8 @@ * http://jquery.org/license * * Date: 2013-06-03 - */ - + */ + /** * @license Rangy, a cross-browser JavaScript range and selection library * http://code.google.com/p/rangy/ @@ -31,84 +31,84 @@ * Licensed under the MIT license. * Version: 1.2.3 * Build date: 26 February 2012 - */ - -// Underscore.js 1.5.1 -// http://underscorejs.org -// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -// Underscore may be freely distributed under the MIT license. - -//Copyright (C) 2012 Kory Nunn - -//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -//The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + */ + +// Underscore.js 1.5.1 +// http://underscorejs.org +// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors +// Underscore may be freely distributed under the MIT license. + +//Copyright (C) 2012 Kory Nunn + +//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +//The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + /*! * XRegExp-All 3.0.0-pre * * Steven Levithan � 2012 MIT License - */ - + */ + /*! * XRegExp 3.0.0-pre * * Steven Levithan � 2007-2012 MIT License - */ - + */ + /*! * XRegExp.build 3.0.0-pre * * Steven Levithan � 2012 MIT License * Inspired by Lea Verou's RegExp.create - */ - + */ + /*! * XRegExp.matchRecursive 3.0.0-pre * * Steven Levithan � 2009-2012 MIT License - */ - + */ + /*! * XRegExp Unicode Base 3.0.0-pre * * Steven Levithan � 2008-2012 MIT License * Uses Unicode 6.2.0 * Unicode data generated by Mathias Bynens - */ - + */ + /*! * XRegExp Unicode Blocks 3.0.0-pre * * Steven Levithan � 2010-2012 MIT License * Uses Unicode 6.2.0 * Unicode data generated by Mathias Bynens - */ - + */ + /*! * XRegExp Unicode Categories 3.0.0-pre * * Steven Levithan � 2010-2012 MIT License * Uses Unicode 6.2.0 * Unicode data generated by Mathias Bynens - */ - + */ + /*! * XRegExp Unicode Properties 3.0.0-pre * * Steven Levithan � 2012 MIT License * Uses Unicode 6.2.0 * Unicode data generated by Mathias Bynens - */ - + */ + /*! * XRegExp Unicode Scripts 3.0.0-pre * * Steven Levithan � 2010-2012 MIT License * Uses Unicode 6.2.0 * Unicode data generated by Mathias Bynens - */ - + */ + /*! FileSaver.js * A saveAs() FileSaver implementation. * 2014-01-24 @@ -116,16 +116,16 @@ * By Eli Grey, http://eligrey.com * License: X11/MIT * See LICENSE.md - */ - -/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ - + */ + +/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ + /** * @license RequireJS text 2.0.12 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/requirejs/text for details - */ - + */ + /* Copyright (c) 2010 Jeremy Faivre @@ -146,30 +146,30 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -// Copyright (C) 2006 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - +*/ + +// Copyright (C) 2006 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + /* * to-markdown - an HTML to Markdown converter * * Copyright 2011-2012, Dom Christie * Licenced under the MIT licence * - */ - + */ + /** * Copyright 2013 Craig Campbell * @@ -190,8 +190,8 @@ THE SOFTWARE. * * @version 1.4.6 * @url craig.is/killing/mice - */ - + */ + /** * jGrowl 1.2.10 * @@ -201,7 +201,7 @@ THE SOFTWARE. * Written by Stan Lemon * Last updated: 2013.02.14 * - * jGrowl is a jQuery plugin implementing unobtrusive userland notifications. These + * jGrowl is a jQuery plugin implementing unobtrusive userland notifications. These * notifications function similarly to the Growl Framework available for * Mac OS X (http://growl.info). * @@ -220,14 +220,14 @@ THE SOFTWARE. * * Changes in 1.2.6 * - Fixed js error when a notification is opening and closing at the same time - * + * * Changes in 1.2.5 * - Changed wrapper jGrowl's options usage to "o" instead of $.jGrowl.defaults * - Added themeState option to control 'highlight' or 'error' for jQuery UI * - Ammended some CSS to provide default positioning for nested usage. * - Changed some CSS to be prefixed with jGrowl- to prevent namespacing issues - * - Added two new options - openDuration and closeDuration to allow - * better control of notification open and close speeds, respectively + * - Added two new options - openDuration and closeDuration to allow + * better control of notification open and close speeds, respectively * Patch contributed by Jesse Vincet. * - Added afterOpen callback. Patch contributed by Russel Branca. * @@ -308,14 +308,14 @@ THE SOFTWARE. * Changes in 1.0.1: * - Removed dependency on metadata plugin in favor of .data() * - Namespaced all events - */ - + */ + /*! * Bootstrap v3.0.3 (http://getbootstrap.com) * Copyright 2013 Twitter, Inc. * Licensed under http://www.apache.org/licenses/LICENSE-2.0 - */ - + */ + /* ======================================================================== * Bootstrap: transition.js v3.0.3 * http://getbootstrap.com/javascript/#transitions @@ -333,8 +333,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: alert.js v3.0.3 * http://getbootstrap.com/javascript/#alerts @@ -352,8 +352,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: button.js v3.0.3 * http://getbootstrap.com/javascript/#buttons @@ -371,8 +371,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: carousel.js v3.0.3 * http://getbootstrap.com/javascript/#carousel @@ -390,8 +390,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: collapse.js v3.0.3 * http://getbootstrap.com/javascript/#collapse @@ -409,8 +409,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: dropdown.js v3.0.3 * http://getbootstrap.com/javascript/#dropdowns @@ -428,8 +428,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: modal.js v3.0.3 * http://getbootstrap.com/javascript/#modals @@ -447,8 +447,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: tooltip.js v3.0.3 * http://getbootstrap.com/javascript/#tooltip @@ -467,8 +467,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: popover.js v3.0.3 * http://getbootstrap.com/javascript/#popovers @@ -486,8 +486,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: scrollspy.js v3.0.3 * http://getbootstrap.com/javascript/#scrollspy @@ -505,8 +505,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: tab.js v3.0.3 * http://getbootstrap.com/javascript/#tabs @@ -524,8 +524,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: affix.js v3.0.3 * http://getbootstrap.com/javascript/#affix @@ -543,8 +543,8 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ======================================================================== */ - + * ======================================================================== */ + /* =========================================================== # bootstrap-tour - v0.7.3 # http://bootstraptour.com @@ -562,8 +562,8 @@ THE SOFTWARE. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -*/ - +*/ + /* * waitForImages 1.4.2 * ------------------- @@ -572,14 +572,14 @@ THE SOFTWARE. * * Copyright (c) 2013 Alex Dickson * Licensed under the MIT license. - */ - + */ + /** * Prism: Lightweight, robust, elegant syntax highlighting * MIT license http://www.opensource.org/licenses/mit-license.php/ * @author Lea Verou http://lea.verou.me - */ - + */ + /** * Diff Match and Patch * @@ -597,26 +597,26 @@ THE SOFTWARE. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ - + */ + /* * Copyright 2012 The Polymer Authors. All rights reserved. * Use of this source code is governed by a BSD-style * license that can be found in the LICENSE file. - */ - + */ + /* * Copyright 2012 The Polymer Authors. All rights reserved. * Use of this source code is goverened by a BSD-style * license that can be found in the LICENSE file. - */ - + */ + /*! Hammer.JS - v1.0.10 - 2014-03-28 * http://eightmedia.github.io/hammer.js * * Copyright (c) 2014 Jorik Tangelder ; - * Licensed under the MIT license */ - + * Licensed under the MIT license */ + /** * @license CSS Class Applier module for Rangy. * Adds, removes and toggles CSS classes on Ranges and Selections @@ -630,60 +630,23241 @@ THE SOFTWARE. * Licensed under the MIT license. * Version: 1.2.3 * Build date: 26 February 2012 - */ - -<<<<<<< HEAD -function printStackTrace(e){e=e||{guess:!0};var t=e.e||null,n=!!e.guess,i=new printStackTrace.implementation,r=i.run(t);return n?i.guessAnonymousFunctions(r):r}function diff_match_patch(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32}!function(e,t){function n(e){var t=e.length,n=ot.type(e);return ot.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}function i(e){var t=ht[e]={};return ot.each(e.match(st)||[],function(e,n){t[n]=!0}),t}function r(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=ot.expando+Math.random()}function o(e,n,i){var r;if(i===t&&1===e.nodeType)if(r="data-"+n.replace(bt,"-$1").toLowerCase(),i=e.getAttribute(r),"string"==typeof i){try{i="true"===i?!0:"false"===i?!1:"null"===i?null:+i+""===i?+i:vt.test(i)?JSON.parse(i):i}catch(o){}mt.set(e,n,i)}else i=t;return i}function a(){return!0}function s(){return!1}function l(){try{return z.activeElement}catch(e){}}function c(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function u(e,t,n){if(ot.isFunction(t))return ot.grep(e,function(e,i){return!!t.call(e,i,e)!==n});if(t.nodeType)return ot.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(It.test(t))return ot.filter(t,e,n);t=ot.filter(t,e)}return ot.grep(e,function(e){return tt.call(t,e)>=0!==n})}function d(e,t){return ot.nodeName(e,"table")&&ot.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function p(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function f(e){var t=jt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function h(e,t){for(var n=e.length,i=0;n>i;i++)gt.set(e[i],"globalEval",!t||gt.get(t[i],"globalEval"))}function m(e,t){var n,i,r,o,a,s,l,c;if(1===t.nodeType){if(gt.hasData(e)&&(o=gt.access(e),a=gt.set(t,o),c=o.events)){delete a.handle,a.events={};for(r in c)for(n=0,i=c[r].length;i>n;n++)ot.event.add(t,r,c[r][n])}mt.hasData(e)&&(s=mt.access(e),l=ot.extend({},s),mt.set(t,l))}}function g(e,n){var i=e.getElementsByTagName?e.getElementsByTagName(n||"*"):e.querySelectorAll?e.querySelectorAll(n||"*"):[];return n===t||n&&ot.nodeName(e,n)?ot.merge([e],i):i}function v(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Ft.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function b(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),i=t,r=Zt.length;r--;)if(t=Zt[r]+n,t in e)return t;return i}function y(e,t){return e=t||e,"none"===ot.css(e,"display")||!ot.contains(e.ownerDocument,e)}function x(t){return e.getComputedStyle(t,null)}function w(e,t){for(var n,i,r,o=[],a=0,s=e.length;s>a;a++)i=e[a],i.style&&(o[a]=gt.get(i,"olddisplay"),n=i.style.display,t?(o[a]||"none"!==n||(i.style.display=""),""===i.style.display&&y(i)&&(o[a]=gt.access(i,"olddisplay",E(i.nodeName)))):o[a]||(r=y(i),(n&&"none"!==n||!r)&>.set(i,"olddisplay",r?n:ot.css(i,"display"))));for(a=0;s>a;a++)i=e[a],i.style&&(t&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=t?o[a]||"":"none"));return e}function S(e,t,n){var i=Vt.exec(t);return i?Math.max(0,i[1]-(n||0))+(i[2]||"px"):t}function C(e,t,n,i,r){for(var o=n===(i?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=ot.css(e,n+Yt[o],!0,r)),i?("content"===n&&(a-=ot.css(e,"padding"+Yt[o],!0,r)),"margin"!==n&&(a-=ot.css(e,"border"+Yt[o]+"Width",!0,r))):(a+=ot.css(e,"padding"+Yt[o],!0,r),"padding"!==n&&(a+=ot.css(e,"border"+Yt[o]+"Width",!0,r)));return a}function T(e,t,n){var i=!0,r="width"===t?e.offsetWidth:e.offsetHeight,o=x(e),a=ot.support.boxSizing&&"border-box"===ot.css(e,"boxSizing",!1,o);if(0>=r||null==r){if(r=qt(e,t,o),(0>r||null==r)&&(r=e.style[t]),Wt.test(r))return r;i=a&&(ot.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+C(e,t,n||(a?"border":"content"),i,o)+"px"}function E(e){var t=z,n=Xt[e];return n||(n=k(e,t),"none"!==n&&n||(Ht=(Ht||ot("