From 75eaf399dfb8c291e5b3a1c31489fd36debfcde6 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 1 Apr 2015 12:05:49 -0500 Subject: [PATCH 1/2] Fixes #600: remove wyciwyg from URLs (+test). --- tests/functional/reporting.js | 11 +++++++++++ webcompat/static/js/lib/bugform.js | 12 ++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/functional/reporting.js b/tests/functional/reporting.js index 347f1be19..0ab3f3cd6 100644 --- a/tests/functional/reporting.js +++ b/tests/functional/reporting.js @@ -30,6 +30,17 @@ define([ }); }, + 'wyciwyg bug workaround': function() { + return this.remote + .setFindTimeout(intern.config.wc.pageLoadTimeout) + .get(require.toUrl(url + '?open=1&url=wyciwyg://0/http://bbs.csdn.net/topics/20282413')) + .findByCssSelector('#url').getProperty('value') + .then(function (value) { + assert.notInclude(value, 'wyciwyg://0/'); + }) + .end() + }, + 'validation works': function() { return this.remote .setFindTimeout(intern.config.wc.pageLoadTimeout) diff --git a/webcompat/static/js/lib/bugform.js b/webcompat/static/js/lib/bugform.js index 14a5616da..47f5cd8d2 100644 --- a/webcompat/static/js/lib/bugform.js +++ b/webcompat/static/js/lib/bugform.js @@ -38,19 +38,19 @@ function BugForm() { var urlParam = location.search.match(/url=(.+)/); if (urlParam != null) { // weird Gecko bug. See https://bugzilla.mozilla.org/show_bug.cgi?id=1098037 - urlParam = self.trimWysiwyg(urlParam[1]); + urlParam = self.trimWyciwyg(urlParam[1]); urlField.val(decodeURIComponent(urlParam)); self.copyURL(); self.makeValid('url'); } }, - trimWysiwyg: function(url) { - //trim wysiwyg://N/ from URL. - var wysiwygRe = /(wysiwyg:\/\/\d+\/)/i; - if (url.search(wysiwygRe) !== 0) { + trimWyciwyg: function(url) { + //trim wyciwyg://N/ from URL. + var wyciwygRe = /(wyciwyg:\/\/\d+\/)/i; + if (url.search(wyciwygRe) !== 0) { return url; } else { - return url.replace(wysiwygRe, ''); + return url.replace(wyciwygRe, ''); } }, disableSubmits: function() { From 540545d9d51f0b525f64e02165b764b0e44fa467 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 1 Apr 2015 12:13:07 -0500 Subject: [PATCH 2/2] Semicolon fail. /o\ --- tests/functional/reporting.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/reporting.js b/tests/functional/reporting.js index 0ab3f3cd6..67b0187c4 100644 --- a/tests/functional/reporting.js +++ b/tests/functional/reporting.js @@ -38,7 +38,7 @@ define([ .then(function (value) { assert.notInclude(value, 'wyciwyg://0/'); }) - .end() + .end(); }, 'validation works': function() {