From 0169a0ca3f2f4c2d64402669d763da6b4fe8e23e Mon Sep 17 00:00:00 2001 From: walkevin Date: Wed, 18 Jun 2014 10:18:39 +0200 Subject: [PATCH 1/2] Fix for Mozilla Firefox infinite recursion bug If the script is loaded twice in Firefox, then axisLabels will be registered twice in the plugins array, which eventually causes an infinite recursion, since the trick with the secondPass flag fails in these circumstances. --- jquery.flot.axislabels.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/jquery.flot.axislabels.js b/jquery.flot.axislabels.js index 4d955d6..b2cfce0 100644 --- a/jquery.flot.axislabels.js +++ b/jquery.flot.axislabels.js @@ -454,10 +454,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. } - $.plot.plugins.push({ - init: init, - options: options, - name: 'axisLabels', - version: '2.0' - }); + if(jqueryFlotAxisLabelsIsRegistered !== undefined){ + var jqueryFlotAxisLabelsIsRegistered = true; + $.plot.plugins.push({ + init: init, + options: options, + name: 'axisLabels', + version: '2.0' + }); + } })(jQuery); From 689d83f54be2b05c7f00fdf0894f449233da0f0b Mon Sep 17 00:00:00 2001 From: walkevin Date: Mon, 1 Dec 2014 21:15:00 +0100 Subject: [PATCH 2/2] Move check variable to beginning of file. --- jquery.flot.axislabels.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jquery.flot.axislabels.js b/jquery.flot.axislabels.js index b2cfce0..8ac1cc3 100644 --- a/jquery.flot.axislabels.js +++ b/jquery.flot.axislabels.js @@ -27,12 +27,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ (function ($) { - var options = { + var jqueryFlotAxisLabelsIsRegistered = false; + var options = { axisLabels: { show: true } }; - + function canvasSupported() { return !!document.createElement('canvas').getContext; } @@ -454,8 +455,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. } - if(jqueryFlotAxisLabelsIsRegistered !== undefined){ - var jqueryFlotAxisLabelsIsRegistered = true; + if(jqueryFlotAxisLabelsIsRegistered !== false){ + jqueryFlotAxisLabelsIsRegistered = true; $.plot.plugins.push({ init: init, options: options,