From d98f7bdc31ec515fbd2e27f402e5b7d37a15aee4 Mon Sep 17 00:00:00 2001 From: Nic Jansma Date: Fri, 20 Mar 2015 20:26:44 -0400 Subject: [PATCH 1/2] Page Params order fixed for JS vars --- plugins/page-params.js | 4 +- .../04-page-params/01-page-group-order.html | 38 +++++++++++++++++++ .../04-page-params/01-page-group-order.js | 16 ++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 tests/page-templates/04-page-params/01-page-group-order.html create mode 100644 tests/page-templates/04-page-params/01-page-group-order.js diff --git a/plugins/page-params.js b/plugins/page-params.js index b2696a0d3..4bafa0c15 100644 --- a/plugins/page-params.js +++ b/plugins/page-params.js @@ -239,11 +239,11 @@ Handler.prototype = { return false; } - this.extractJavaScriptVariable(o.varName); + return this.extractJavaScriptVariable(o.varName); }, Custom: function(o) { - this.extractJavaScriptVariable(o.parameter1); + return this.extractJavaScriptVariable(o.parameter1); }, extractJavaScriptVariable: function(varname) { diff --git a/tests/page-templates/04-page-params/01-page-group-order.html b/tests/page-templates/04-page-params/01-page-group-order.html new file mode 100644 index 000000000..809ed93bc --- /dev/null +++ b/tests/page-templates/04-page-params/01-page-group-order.html @@ -0,0 +1,38 @@ +<%= header %> +<%= boomerangSnippet %> + + + +<%= footer %> diff --git a/tests/page-templates/04-page-params/01-page-group-order.js b/tests/page-templates/04-page-params/01-page-group-order.js new file mode 100644 index 000000000..acf22473a --- /dev/null +++ b/tests/page-templates/04-page-params/01-page-group-order.js @@ -0,0 +1,16 @@ +/*eslint-env mocha*/ +/*global BOOMR_test,assert*/ + +describe("e2e/04-page-params/00-page-groups", function() { + var tf = BOOMR.plugins.TestFramework; + var t = BOOMR_test; + + it("Should pass basic beacon validation", function(done) { + t.validateBeaconWasSent(done); + }); + + it("Should set the Page Group to 111", function() { + var b = tf.lastBeacon(); + assert.equal(b["h.pg"], 111); + }); +}); From 45a435c235ef3ef557214645316051b4bc89040d Mon Sep 17 00:00:00 2001 From: Nic Jansma Date: Thu, 2 Apr 2015 15:45:24 -0400 Subject: [PATCH 2/2] Fixes due to breaking no-empty change https://github.com/eslint/eslint/issues/2187 --- .eslintrc | 9 +++++---- boomerang.js | 8 +++++++- package.json | 2 +- plugins/navtiming.js | 6 +++--- plugins/page-params.js | 3 +-- plugins/restiming.js | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.eslintrc b/.eslintrc index 299b9d5b4..adaeef375 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,6 @@ { "env": { - "browser": true + "browser":true }, "globals": { "BOOMR":true, @@ -22,9 +22,10 @@ "no-console":0, "no-delete-var":0, "no-underscore-dangle":0, - "no-multi-spaces": 0, + "no-multi-spaces":0, "dot-notation":[2, {"allowKeywords": false}], - "space-unary-ops": 0, - "key-spacing": 0 + "space-unary-ops":0, + "key-spacing":0, + "no-empty":2 } } diff --git a/boomerang.js b/boomerang.js index f7f8d042d..33ee9ddb5 100644 --- a/boomerang.js +++ b/boomerang.js @@ -124,6 +124,7 @@ if (!BOOMR.plugins) { BOOMR.plugins = {}; } } } catch(ignore) { + // empty } try { @@ -138,6 +139,7 @@ if (!BOOMR.plugins) { BOOMR.plugins = {}; } } } catch(ignore) { + // empty } if (!createCustomEvent && d.createEventObject) { @@ -687,6 +689,7 @@ boomr = { try { form.submit(); } catch (ignore) { + // empty } if (urls.length) { @@ -866,7 +869,10 @@ boomr = { }; } } - catch(ignore) { } + catch(ignore) { + // empty + } + return Date.now || function() { return new Date().getTime(); }; }()), diff --git a/package.json b/package.json index 9bbbde2c5..ef6c3416b 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "grunt-contrib-connect": "^0.9.0", "grunt-contrib-copy": "^0.7.0", "grunt-contrib-uglify": "^0.6.0", - "grunt-eslint": "*", + "grunt-eslint": "^10.0.0", "grunt-filesize": "0.0.7", "grunt-karma": "^0.9.0", "grunt-protractor-runner": "^1.2.1", diff --git a/plugins/navtiming.js b/plugins/navtiming.js index 7804ffa18..9c0bf47be 100644 --- a/plugins/navtiming.js +++ b/plugins/navtiming.js @@ -88,7 +88,7 @@ var impl = { BOOMR.addVar(data); - try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) {} + try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) { /* empty */ } this.complete = true; BOOMR.sendBeacon(); @@ -142,7 +142,7 @@ var impl = { BOOMR.addVar(data); - try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) {} + try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) { /* empty */ } } // XXX Inconsistency warning. msFirstPaint above is in milliseconds while @@ -159,7 +159,7 @@ var impl = { BOOMR.addVar(data); - try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) {} + try { impl.addedVars.push.apply(impl.addedVars, Object.keys(data)); } catch(ignore) { /* empty */ } } } diff --git a/plugins/page-params.js b/plugins/page-params.js index 4bafa0c15..d963a0f96 100644 --- a/plugins/page-params.js +++ b/plugins/page-params.js @@ -579,8 +579,7 @@ Handler.prototype = { return null; } } - catch(ignore) { - } + catch(ignore) { /* empty */ } BOOMR.addError(e, "PageVars.findResource"); return null; diff --git a/plugins/restiming.js b/plugins/restiming.js index 54ab89d40..d2246ba46 100644 --- a/plugins/restiming.js +++ b/plugins/restiming.js @@ -160,7 +160,7 @@ function getNavStartTime(frame) { } catch(e) { - // swallow all access exceptions + // empty } return navStart;