Tapestry 5
  1. Tapestry 5
  2. TAP5-555

Tapestry.ScriptManager.contains throws error if <script> tag in <head> has no href

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.18
    • Fix Version/s: 5.1.0.1
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      Tapestry.ScriptManager.contains firsts lines are:

      return $A(collection).any(function (element)
      {
      var existing = element[prop];
      if (existing.blank()) return false;

      If element doesn't have the prop, then the existing var is null and existing.blank() throws an exception because the call of a method to a null variable. This problem happens for example (because of this i detected it) when i want to update a zone with a block that also loads stylesheets and scripts and, in the original page, there are script and or style tags embedded (<style> without href or <script> without src). In the loop looking for an existing script or style tag that had already loaded the new script or tag in the ajax response, the existing variable in the code is null and the error triggers.

      The solution is very simple, i think:
      if (existing == null || existing.blank()) return false;

      Regards.

        Activity

        Raul Montes created issue -
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Howard M. Lewis Ship made changes -
        Summary Tapestry.ScriptManager.contains throws error when element doesn't have the prop param Tapestry.ScriptManager.contains throws error if <script> tag in <head> has no href
        Howard M. Lewis Ship committed 750516 (1 file)
        Reviews: none

        TAP5-555: Tapestry.ScriptManager.contains throws error if <script> tag in <head> has no href

        Howard M. Lewis Ship made changes -
        Fix Version/s 5.1.0.1 [ 12313660 ]
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Closed [ 6 ]

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Raul Montes
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development