From 15cf52314484cf2cf30eb08a398eee0a9f8f0795 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 22 Nov 2021 16:35:35 +0530 Subject: [PATCH] don't load the janky test framework that we aren't even using --- customize.dist/login.js | 2 +- www/assert/main.js | 7 ++++--- www/common/common-interface.js | 6 +++--- www/common/sframe-app-framework.js | 8 +++++--- www/common/sframe-boot2.js | 6 +++--- www/common/sframe-common-outer.js | 14 +++++++------- www/login/main.js | 14 +++++++++----- www/pad/inner.js | 20 ++++++++++++-------- www/poll/inner.js | 12 ++++++++---- www/register/main.js | 9 +++++---- 10 files changed, 57 insertions(+), 41 deletions(-) diff --git a/customize.dist/login.js b/customize.dist/login.js index 1ba0eb470..8a27ee4ff 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -554,7 +554,7 @@ define([ return; } - if (testing) { return void proceed(result); } + //if (testing) { return void proceed(result); } if (!(proxy.curvePrivate && proxy.curvePublic && proxy.edPrivate && proxy.edPublic)) { diff --git a/www/assert/main.js b/www/assert/main.js index de10261ba..18d1dbd26 100644 --- a/www/assert/main.js +++ b/www/assert/main.js @@ -3,7 +3,7 @@ define([ '/bower_components/hyperjson/hyperjson.js', 'json.sortify', '/drive/tests.js', - '/common/test.js', + //'/common/test.js', '/common/common-hash.js', '/common/common-util.js', '/common/common-thumbnail.js', @@ -18,7 +18,7 @@ define([ '/bower_components/tweetnacl/nacl-fast.min.js', 'less!/customize/src/less2/pages/page-assert.less', -], function ($, Hyperjson, Sortify, Drive, Test, Hash, Util, Thumb, Wire, Flat, MediaTag, Block, ApiConfig, Assertions, h, Messages) { +], function ($, Hyperjson, Sortify, Drive, /*Test,*/ Hash, Util, Thumb, Wire, Flat, MediaTag, Block, ApiConfig, Assertions, h, Messages) { window.Hyperjson = Hyperjson; window.Sortify = Sortify; var Nacl = window.nacl; @@ -526,11 +526,12 @@ define([ })), ])); +/* if (failed) { Test.failed(); } else { Test.passed(); - } + }*/ }); }); diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 5c2431efd..d853f6c13 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -18,14 +18,14 @@ define([ '/lib/tippy/tippy.min.js', '/common/hyperscript.js', '/customize/loading.js', - '/common/test.js', + //'/common/test.js', '/lib/jquery-ui/jquery-ui.min.js', // autocomplete widget '/bower_components/bootstrap-tokenfield/dist/bootstrap-tokenfield.js', 'css!/lib/tippy/tippy.css', 'css!/lib/jquery-ui/jquery-ui.min.css' ], function ($, Messages, Util, Hash, Notifier, AppConfig, - Alertify, Tippy, h, Loading, Test) { + Alertify, Tippy, h, Loading/*, Test */) { var UI = {}; /* @@ -994,7 +994,7 @@ define([ // Release the test blocker, hopefully every test has been registered. // This test is created in sframe-boot2.js cb = cb || function () {}; - if (Test.__ASYNC_BLOCKER__) { Test.__ASYNC_BLOCKER__.pass(); } + //if (Test.__ASYNC_BLOCKER__) { Test.__ASYNC_BLOCKER__.pass(); } var $loading = $('#' + LOADING); $loading.addClass("cp-loading-hidden"); // Hide the loading screen diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 96997cd06..1ba7ba2ef 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -38,8 +38,8 @@ define([ Feedback, Snapshots, AppConfig, - ChainPad, - Test) + ChainPad /*, + /* Test */) { var SaveAs = window.saveAs; @@ -87,6 +87,7 @@ define([ var contentContainer = options.contentContainer || (function () { throw new Error("contentContainer must be specified"); }()); +/* Test(function (t) { console.log("Here is the test"); evOnReady.reg(function () { @@ -96,6 +97,7 @@ define([ }); }); }); +*/ var onLocal; var textContentGetter; @@ -779,7 +781,7 @@ define([ }).nThen(function (waitFor) { common.getSframeChannel().onReady(waitFor()); }).nThen(function (waitFor) { - Test.registerInner(common.getSframeChannel()); + //Test.registerInner(common.getSframeChannel()); common.handleNewFile(waitFor); }).nThen(function (waitFor) { cpNfInner = common.startRealtime({ diff --git a/www/common/sframe-boot2.js b/www/common/sframe-boot2.js index 647a520af..2870be392 100644 --- a/www/common/sframe-boot2.js +++ b/www/common/sframe-boot2.js @@ -2,8 +2,8 @@ // Note: This must only be loaded from inside of a sandbox-iframe. define([ '/common/requireconfig.js', - '/common/test.js' -], function (RequireConfig, Test) { + //'/common/test.js' +], function (RequireConfig /*, Test */) { require.config(RequireConfig()); // most of CryptPad breaks if you don't support isArray @@ -29,7 +29,7 @@ define([ // This test is for keeping the testing infrastructure operating // until all tests have been registered. // This test is completed in common-interface.js - Test(function (t) { Test.__ASYNC_BLOCKER__ = t; }); + //Test(function (t) { Test.__ASYNC_BLOCKER__ = t; }); window.onerror = function (e) { if (/requirejs\.org/.test(e)) { diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index c72fcbc1c..a86eac425 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -80,7 +80,7 @@ define([ nThen: nThen }; var AppConfig; - var Test; + //var Test; var password, newPadPassword, newPadPasswordForce; var initialPathInDrive; var burnAfterReading; @@ -113,11 +113,11 @@ define([ '/common/outer/local-store.js', '/common/outer/cache-store.js', '/customize/application_config.js', - '/common/test.js', + //'/common/test.js', '/common/userObject.js', ], waitFor(function (_CpNfOuter, _Cryptpad, _Crypto, _Cryptget, _SFrameChannel, _SecureIframe, _UnsafeIframe, _OOIframe, _Messaging, _Notifier, _Hash, _Util, _Realtime, _Notify, - _Constants, _Feedback, _LocalStore, _Cache, _AppConfig, _Test, _UserObject) { + _Constants, _Feedback, _LocalStore, _Cache, _AppConfig, /* _Test,*/ _UserObject) { CpNfOuter = _CpNfOuter; Cryptpad = _Cryptpad; Crypto = Utils.Crypto = _Crypto; @@ -139,7 +139,7 @@ define([ Utils.Notify = _Notify; Utils.currentPad = currentPad; AppConfig = _AppConfig; - Test = _Test; + //Test = _Test; if (localStorage.CRYPTPAD_URLARGS !== ApiConfig.requireConf.urlArgs) { console.log("New version, flushing cache"); @@ -715,7 +715,7 @@ define([ sframeChan.event('EV_LOGOUT'); }); - Test.registerOuter(sframeChan); + //Test.registerOuter(sframeChan); Cryptpad.onNewVersionReconnect.reg(function () { sframeChan.event("EV_NEW_VERSION"); @@ -2138,8 +2138,8 @@ define([ Utils.Feedback.reportAppUsage(); - if (!realtime && !Test.testing) { return; } - if (isNewFile && cfg.useCreationScreen && !Test.testing) { return; } + if (!realtime /*&& !Test.testing*/) { return; } + if (isNewFile && cfg.useCreationScreen /* && !Test.testing */) { return; } if (burnAfterReading) { return; } //if (isNewFile && Utils.LocalStore.isLoggedIn() // && AppConfig.displayCreationScreen && cfg.useCreationScreen) { return; } diff --git a/www/login/main.js b/www/login/main.js index cb03e17f3..df0be1733 100644 --- a/www/login/main.js +++ b/www/login/main.js @@ -6,10 +6,10 @@ define([ '/common/common-realtime.js', '/common/common-feedback.js', '/common/outer/local-store.js', - '/common/test.js', + //'/common/test.js', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', -], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore, Test) { +], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore /*, Test */) { $(function () { var $checkImport = $('#import-recent'); if (LocalStore.isLoggedIn()) { @@ -43,17 +43,19 @@ define([ $('button.login').click(); }); - var test; + //var test; $('button.login').click(function () { var shouldImport = $checkImport[0].checked; var uname = $uname.val(); var passwd = $passwd.val(); - Login.loginOrRegisterUI(uname, passwd, false, shouldImport, Test.testing, function () { + Login.loginOrRegisterUI(uname, passwd, false, shouldImport, /*Test.testing */ false, function () { + /* if (test) { localStorage.clear(); - test.pass(); + //test.pass(); return true; } + */ }); }); $('#register').on('click', function () { @@ -64,11 +66,13 @@ define([ window.location.href = '/register/' + hash; }); +/* Test(function (t) { $uname.val('testuser'); $passwd.val('testtest'); test = t; $('button.login').click(); }); + */ }); }); diff --git a/www/pad/inner.js b/www/pad/inner.js index 95e7c1bff..620b862bc 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -27,7 +27,7 @@ define([ '/bower_components/hyperjson/hyperjson.js', '/common/sframe-app-framework.js', '/common/cursor.js', - '/common/TypingTests.js', + //'/common/TypingTests.js', '/customize/messages.js', '/pad/links.js', '/pad/comments.js', @@ -42,8 +42,8 @@ define([ '/common/common-ui-elements.js', '/common/hyperscript.js', '/bower_components/chainpad/chainpad.dist.js', - '/customize/application_config.js', - '/common/test.js', + //'/customize/application_config.js', + //'/common/test.js', '/lib/diff-dom/diffDOM.js', '/bower_components/file-saver/FileSaver.min.js', @@ -57,7 +57,7 @@ define([ Hyperjson, Framework, Cursor, - TypingTest, + //TypingTest, Messages, Links, Comments, @@ -71,9 +71,9 @@ define([ UI, UIElements, h, - ChainPad, + ChainPad/*, AppConfig, - Test + Test */ ) { var DiffDom = window.diffDOM; @@ -1249,6 +1249,7 @@ define([ // export the typing tests to the window. // call like `test = easyTest()` // terminate the test like `test.cancel()` + /* window.easyTest = function() { cursor.update(); //var start = cursor.Range.start; @@ -1257,6 +1258,7 @@ define([ framework.localChange(); return test; }; + */ // Fix the scrollbar if it's reset when clicking on a button (firefox only?) @@ -1509,6 +1511,7 @@ define([ Links.init(Ckeditor, editor, openLinkSetting); require(['/pad/csp.js'], waitFor()); }).nThen(function( /*waitFor*/ ) { + /* function launchAnchorTest(test) { // -------- anchor test: make sure the exported anchor contains ------- @@ -1572,16 +1575,17 @@ define([ if (editor.status === "ready") { window.clearInterval(intervalHandle); console.log("Editor is ready."); - tryAndTestExport(); + tryAndTestExport(); // XXX } else { console.log("Waiting for editor to be ready."); } }, 100); } + /* Test(function(test) { launchAnchorTest(test); - }); + });*/ andThen2(editor, Ckeditor, framework); }); }; diff --git a/www/poll/inner.js b/www/poll/inner.js index a70ddf648..dd01b0789 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -50,8 +50,8 @@ define([ h, Messages, SFCodeMirror, - CMeditor, - Test) + CMeditor/*, + Test*/) { var saveAs = window.saveAs; @@ -1010,6 +1010,7 @@ define([ publish(true); } +/* var passIfOk = function (t) { t.assert($('#cp-app-poll-description-published').text().indexOf( "Content for the description") === 0); @@ -1023,7 +1024,9 @@ define([ t.assert($('input[value="Meeee"]').length === 1); t.pass(); }; +*/ + /* if (!APP.readOnly) { console.log("Here is the test"); Test(function (t) { @@ -1075,13 +1078,14 @@ define([ setTimeout(waitFor()); }).nThen(function (waitFor) { APP.rt.realtime.onSettle(waitFor()); - }).nThen(function (/*waitFor*/) { + }).nThen(function (/*waitFor*/ /*) { passIfOk(t); }); }); } else { Test(passIfOk); } + */ // No need for onLocal in openPadChat because in poll, we listen for metadata changes // and save them everytime. @@ -1315,7 +1319,7 @@ define([ }).nThen(function (waitFor) { common.handleNewFile(waitFor); }).nThen(function (/* waitFor */) { - Test.registerInner(common.getSframeChannel()); + //Test.registerInner(common.getSframeChannel()); var metadataMgr = common.getMetadataMgr(); metadataMgr.setDegraded(false); // FIXME degarded mode unsupported (no cursor channel) diff --git a/www/register/main.js b/www/register/main.js index 87d9c0513..301306f70 100644 --- a/www/register/main.js +++ b/www/register/main.js @@ -2,7 +2,7 @@ define([ 'jquery', '/customize/login.js', '/common/cryptpad-common.js', - '/common/test.js', + //'/common/test.js', '/common/common-credential.js', '/common/common-interface.js', '/common/common-util.js', @@ -13,7 +13,7 @@ define([ '/common/hyperscript.js', 'css!/bower_components/components-font-awesome/css/font-awesome.min.css', -], function ($, Login, Cryptpad, Test, Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h) { +], function ($, Login, Cryptpad, /*Test,*/ Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h) { var Messages = Cryptpad.Messages; $(function () { if (LocalStore.isLoggedIn()) { @@ -111,7 +111,7 @@ define([ function (yes) { if (!yes) { return; } - Login.loginOrRegisterUI(uname, passwd, true, shouldImport, Test.testing, function () { + Login.loginOrRegisterUI(uname, passwd, true, shouldImport, false /*Test.testing*/, function () { if (test) { localStorage.clear(); test.pass(); @@ -149,6 +149,7 @@ define([ } }); +/* Test(function (t) { test = t; $uname.val('testuser'); @@ -161,6 +162,6 @@ define([ window.setTimeout(function () { UI.findOKButton().click(); }, 1000); - }); + }); */ }); });