Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-72358

Requested non-existent AUI modules make every AUI().use fail

    Details

    • Story Points:
      0.25

      Description

      There's a little known feature of YUI, which is the ability to know if a sandbox has "errored" while loading modules.

      The API is very simple and embedded in the YUI().use(...) method (see reference).

      AUI().use(function (A, status) {
        console.log(status.success); // Boolean
        console.log(status.msg) // Some string explaining the error if success: false
      });
      

      Note that once a sandbox is in error state it will remain as such:

      var Y = YUI();
      
      Y.use('goodmodule', function (Y, status) {
        // status = { success: true }
      
        Y.use('badmodule', function (Y, status) {
          // status = {
          //   success: false,
          //   msg: "Missing modules: badmodule"
          // }
      
          Y.use('anothergoodmodule', function (Y, status) {
            // status = {
            //   success: false,
            //   msg: "Missing modules: badmodule" // this is not cleared!!
            // }
          });
        });
      });
      

      This is wouldn't be an issue by itself, but

      1. AUI actually uses a single sandbox, so one error will ruin the whole page
      2. with Senna.js once you break the sandbox it stays as such forever
      3. Liferay core apps are loading not-existent modules!!!

      The offending AUI modules are io-request and parse-content loaded here:

      The sum of all these things make using the status parameter of the callback passed to Y.use completely useless and therefore there's no programmatic way to know the health of the sandbox.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 10 weeks, 6 days ago

                Packages

                Version Package