Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36800

JS error from simpleyui: Y.Lang is undefined

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4.2
    • Component/s: Libraries, SCORM
    • Labels:
    • Testing Instructions:
      Hide

      Use a browser that allows you to view JS errors (firebug etc)
      Enter a SCORM package
      Click on the breadcrumb link to the course homepage
      keep an eye on the JS errors - make sure Y.Lang error doesn't show. (Without this patch the error would show very quickly and then disappear when the next page was loaded).
      Ignore any other JS warnings as they are likely to be some other issue.

      Show
      Use a browser that allows you to view JS errors (firebug etc) Enter a SCORM package Click on the breadcrumb link to the course homepage keep an eye on the JS errors - make sure Y.Lang error doesn't show. (Without this patch the error would show very quickly and then disappear when the next page was loaded). Ignore any other JS warnings as they are likely to be some other issue.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull Master Branch:
      master_MDL-36800

      Description

      When exiting a SCORM and returning to the course homepage or SCORM entry page this JS error is thrown:

      Error: TypeError: Y.Lang is undefined
      Source File: http://moodle/theme/yui_combo.php?3.7.3/build/simpleyui/simpleyui.js&3.7.3/build/loader/loader.js
      Line: 867

      you only see it if jscache is off or if fix for MDL-36772 is in place.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              danmarsden Dan Marsden added a comment -

              I think this is a regression caused by MDL-34915 but I'm not 100% sure.

              Show
              danmarsden Dan Marsden added a comment - I think this is a regression caused by MDL-34915 but I'm not 100% sure.
              Hide
              skodak Petr Skoda added a comment -

              hi, could you please upload some SCORM test package here?

              Show
              skodak Petr Skoda added a comment - hi, could you please upload some SCORM test package here?
              Hide
              danmarsden Dan Marsden added a comment -

              here's one - (it doesn't work in current master without the fix in MDL-36772) - if you enter the SCORM, answer the 2 questions until you get the end score - then click on a breadcrumb link to return to course/scorm entry page the error is thrown as it exits the scorm. Thanks!

              Show
              danmarsden Dan Marsden added a comment - here's one - (it doesn't work in current master without the fix in MDL-36772 ) - if you enter the SCORM, answer the 2 questions until you get the end score - then click on a breadcrumb link to return to course/scorm entry page the error is thrown as it exits the scorm. Thanks!
              Hide
              skodak Petr Skoda added a comment - - edited

              Strange, I applied the MDL-36772 and then trie to replace "YUI.use(" with "Y.use(" in mod/scorm/. and it started showing different error messages in JS console.

              Show
              skodak Petr Skoda added a comment - - edited Strange, I applied the MDL-36772 and then trie to replace "YUI.use(" with "Y.use(" in mod/scorm/ . and it started showing different error messages in JS console.
              Hide
              skodak Petr Skoda added a comment - - edited

              Hmm, the way you load the datamodel seems to be unique in moodle JS:

              var api_url = M.cfg.wwwroot + '/mod/scorm/loaddatamodel.php?' + node.title;
              document.getElementById('external-scormapi').src = api_url;

              Maybe that could affect the state of Y and YUI that is available there...

              Show
              skodak Petr Skoda added a comment - - edited Hmm, the way you load the datamodel seems to be unique in moodle JS: var api_url = M.cfg.wwwroot + '/mod/scorm/loaddatamodel.php?' + node.title; document.getElementById('external-scormapi').src = api_url; Maybe that could affect the state of Y and YUI that is available there...
              Hide
              danmarsden Dan Marsden added a comment -

              heh - not my code! - I've wanted to rewrite that for a while and turn the .js.php into pure .js to improve caching... but that's not something for a stable branch and finding the time to do it....

              Show
              danmarsden Dan Marsden added a comment - heh - not my code! - I've wanted to rewrite that for a while and turn the .js.php into pure .js to improve caching... but that's not something for a stable branch and finding the time to do it....
              Hide
              skodak Petr Skoda added a comment -

              Thanks for the report, I was unable to diagnose and fix this properly, sorry.

              Show
              skodak Petr Skoda added a comment - Thanks for the report, I was unable to diagnose and fix this properly, sorry.
              Hide
              ncheng Nancy added a comment -

              good news! I found the fix for this bug. It was acutally quite simple. Take a look at this link:

              http://stackoverflow.com/questions/9318719/yui-3-error-b-lang-is-undefined-yui-min-js-line-7

              To totally fix this bug, you need to update these files in moodle/mod/scorm/datamodels:
              aicc.js.php, callback.js.php, scorm_12.js.php, scorm_13.js.php

              For example, in scorm_12.js.php, line 239
              YUI.use('yui2-connection', function(Y) {
              =>
              YUI().use('yui2-connection', function(Y) {

              That's it.

              Show
              ncheng Nancy added a comment - good news! I found the fix for this bug. It was acutally quite simple. Take a look at this link: http://stackoverflow.com/questions/9318719/yui-3-error-b-lang-is-undefined-yui-min-js-line-7 To totally fix this bug, you need to update these files in moodle/mod/scorm/datamodels: aicc.js.php, callback.js.php, scorm_12.js.php, scorm_13.js.php For example, in scorm_12.js.php, line 239 YUI.use('yui2-connection', function(Y) { => YUI().use('yui2-connection', function(Y) { That's it.
              Hide
              skodak Petr Skoda added a comment -

              arrrghh, why did I NOT notice it?? Thanks a lot!!

              Show
              skodak Petr Skoda added a comment - arrrghh, why did I NOT notice it?? Thanks a lot!!
              Hide
              ncheng Nancy added a comment - - edited

              Not a problem! It took me more than 11 hours just to track down to this bug, but only 1.5 hours to find and apply the fix.

              Show
              ncheng Nancy added a comment - - edited Not a problem! It took me more than 11 hours just to track down to this bug, but only 1.5 hours to find and apply the fix.
              Hide
              danmarsden Dan Marsden added a comment -

              legend! - great work for tracking that down - I'll submit a patch for integration and get it into next weeks build.

              Was the error causing a problem while using your SCORM package? - if yes it would be good to know what problems you were having so we can keep an eye on other people reporting similar issues.

              Show
              danmarsden Dan Marsden added a comment - legend! - great work for tracking that down - I'll submit a patch for integration and get it into next weeks build. Was the error causing a problem while using your SCORM package? - if yes it would be good to know what problems you were having so we can keep an eye on other people reporting similar issues.
              Hide
              danmarsden Dan Marsden added a comment -

              Note to integrator - this only affects 2.4 and master.

              Show
              danmarsden Dan Marsden added a comment - Note to integrator - this only affects 2.4 and master.
              Hide
              ncheng Nancy added a comment -

              Yes, this JavaScript error prevented any further actions to be executed after calling LMSFinish.

              We have a course built using Articulate Storyline. At the end of the course when the user clicked 'Next' button to exit (which would trigger a call to LMSFinish), a goodbye page should be displayed to instruct the user what to do next. This bug prevented its display, and the user would have to click again to see this goodbye page.

              Hope this helps. And let me know if you need further info.

              Show
              ncheng Nancy added a comment - Yes, this JavaScript error prevented any further actions to be executed after calling LMSFinish. We have a course built using Articulate Storyline. At the end of the course when the user clicked 'Next' button to exit (which would trigger a call to LMSFinish), a goodbye page should be displayed to instruct the user what to do next. This bug prevented its display, and the user would have to click again to see this goodbye page. Hope this helps. And let me know if you need further info.
              Hide
              danmarsden Dan Marsden added a comment -

              cool - thanks, I've pushed a fix up for review which will hopefully be included in next weeks stable build.

              Show
              danmarsden Dan Marsden added a comment - cool - thanks, I've pushed a fix up for review which will hopefully be included in next weeks stable build.
              Show
              danmarsden Dan Marsden added a comment - btw - there are several other issues in the SCORM stable backlog that you should feel welcome to tackle! https://tracker.moodle.org/issues/?jql=project%20%3D%20MDL%20AND%20resolution%20%3D%20Unresolved%20AND%20fixVersion%20%3D%20%22STABLE%20backlog%22%20AND%20component%20%3D%20SCORM%20AND%20assignee%20in%20%28danmarsden%29%20ORDER%20BY%20assignee%20ASC%2C%20priority%20DESC
              Hide
              damyon Damyon Wiese added a comment -

              Thanks Dan and Nancy,

              This fix looks correct and has been integrated for master and 24.

              Show
              damyon Damyon Wiese added a comment - Thanks Dan and Nancy, This fix looks correct and has been integrated for master and 24.
              Hide
              poltawski Dan Poltawski added a comment -

              Grr. sorry, assigned myself as tester accidentally

              Show
              poltawski Dan Poltawski added a comment - Grr. sorry, assigned myself as tester accidentally
              Hide
              fred Frédéric Massart added a comment -

              Failing to make sure this is expected. I have tested on Firefox and Chrome, and Firefox does not log any error any more, but Chrome does. This is the backtrace of the error logged by Chrome:

              Uncaught TypeError: Cannot read property 'util' of undefined loaddatamodel.php:176
              (anonymous function) loaddatamodel.php:176
              proto._notify simpleyui.js:973
              (anonymous function) simpleyui.js:948
              proto._notify simpleyui.js:973
              handleLoader simpleyui.js:1118
              Y.Loader._finish loader.js:2090
              Y.Loader._onFailure loader.js:2184
              complete loader.js:2382
              Y.Get.js.onFailure loader.js:2449
              Transaction._finish simpleyui.js:4564
              Transaction._next simpleyui.js:4763
              Transaction._progress simpleyui.js:4871
              onError simpleyui.js:4656
              Transaction._insert simpleyui.js:4748
              Transaction.execute simpleyui.js:4490
              Y.Get.Get._next simpleyui.js:4269
              Y.Get.Get._load simpleyui.js:4248
              Y.Get.Get.js simpleyui.js:4033
              Y.Loader._insert loader.js:2426
              (anonymous function) loader.js:2479
              Y.Loader._continue loader.js:2462
              Y.Loader.insert loader.js:2481
              proto._use simpleyui.js:1181
              proto.use simpleyui.js:947
              LMSFinish loaddatamodel.php:175
              unloader quizmaker.html:76
              onunload quizmaker.html:98
              

              If this is irrelevant, then the test can pass.

              Cheers,
              Fred

              Show
              fred Frédéric Massart added a comment - Failing to make sure this is expected. I have tested on Firefox and Chrome, and Firefox does not log any error any more, but Chrome does. This is the backtrace of the error logged by Chrome: Uncaught TypeError: Cannot read property 'util' of undefined loaddatamodel.php:176 (anonymous function) loaddatamodel.php:176 proto._notify simpleyui.js:973 (anonymous function) simpleyui.js:948 proto._notify simpleyui.js:973 handleLoader simpleyui.js:1118 Y.Loader._finish loader.js:2090 Y.Loader._onFailure loader.js:2184 complete loader.js:2382 Y.Get.js.onFailure loader.js:2449 Transaction._finish simpleyui.js:4564 Transaction._next simpleyui.js:4763 Transaction._progress simpleyui.js:4871 onError simpleyui.js:4656 Transaction._insert simpleyui.js:4748 Transaction.execute simpleyui.js:4490 Y.Get.Get._next simpleyui.js:4269 Y.Get.Get._load simpleyui.js:4248 Y.Get.Get.js simpleyui.js:4033 Y.Loader._insert loader.js:2426 (anonymous function) loader.js:2479 Y.Loader._continue loader.js:2462 Y.Loader.insert loader.js:2481 proto._use simpleyui.js:1181 proto.use simpleyui.js:947 LMSFinish loaddatamodel.php:175 unloader quizmaker.html:76 onunload quizmaker.html:98 If this is irrelevant, then the test can pass. Cheers, Fred
              Hide
              damyon Damyon Wiese added a comment -

              I didn't see that issue when I tested with Chrome - but it doesn't look related and Dan put a note about ignoring other JS warnings in the test instructions so I vote for a pass.

              Show
              damyon Damyon Wiese added a comment - I didn't see that issue when I tested with Chrome - but it doesn't look related and Dan put a note about ignoring other JS warnings in the test instructions so I vote for a pass.
              Hide
              danmarsden Dan Marsden added a comment -

              yeah - ignore any other JS errors - there are a few that need looking at in SCORM - that particular issue could be MDL-37844 but manifested in a different way and pointing at the "real" line causing the error.

              Show
              danmarsden Dan Marsden added a comment - yeah - ignore any other JS errors - there are a few that need looking at in SCORM - that particular issue could be MDL-37844 but manifested in a different way and pointing at the "real" line causing the error.
              Hide
              damyon Damyon Wiese added a comment -

              Can this be retested: Re comment from Dan?

              Show
              damyon Damyon Wiese added a comment - Can this be retested: Re comment from Dan?
              Hide
              fred Frédéric Massart added a comment -

              Passing test as the related JS error does not occur any more.

              Show
              fred Frédéric Massart added a comment - Passing test as the related JS error does not occur any more.
              Hide
              damyon Damyon Wiese added a comment -

              Congratulations! This issue has been resolved. Thanks for helping to make Moodle better for everyone!

              Regards, Damyon

              Show
              damyon Damyon Wiese added a comment - Congratulations! This issue has been resolved. Thanks for helping to make Moodle better for everyone! Regards, Damyon

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Mar/13