Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-25611

Fix usage of JavaScript in WebUI bundle

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 9.10, 10.2
    • Fix Version/s: None
    • Component/s: Web UI
    • Tags:
    • Backlog priority:
      500
    • Browser:
    • Sprint:
      nxGang Sprint 10.10.4, nxGang Sprint 10.10.5
    • Story Points:
      2

      Description

      Steps to reproduce:

      1. enable the dev mode in nuxeo.conf
        org.nuxeo.dev=true
        
      2. install nuxeo-web-ui
        ./nuxeoctl mp-install nuxeo-web-ui
      3. start Nuxeo
      4. edit the file nxserver/nuxeo.war/ui/nuxeo-web-ui-bundle.html
      5. add at the beginning, before the first nuxeo-slot-content, the following code
        <script type="text/javascript">
        function test(foo) {
            return foo;
        }
        </script>
        
      6. log in
      7. navigate to a File document
      8. put the cursor over the Clipboard icon and observe the tooltip is not displayed
      9. click on the Clipboard icon and observe the icon is not refreshed to indicate the new state
      10. in the browser console, you will the following error
        Uncaught TypeError: Cannot read property 'contains' of undefined
            at HTMLElement.toggle (elements.html:49306)
            at HTMLElement.handler (nuxeo-app.html:2283)
            at Object._fire (nuxeo-app.html:7171)
            at Object.forward (nuxeo-app.html:7566)
            at Object.click (nuxeo-app.html:7529)
            at HTMLElement._handleNative (nuxeo-app.html:6949)
        

      The problem seems to be that the JS code modifies how the code is loaded and the document is still undefined when some functions are called (like the first call to update for nuxeo-clipboard-toggle-button

      If the JS code is put at the end of nxserver/nuxeo.war/ui/nuxeo-web-ui-bundle.html, everything works fine.

      Reproduced 9.10 and 10.2 with Chrome, but it probably affects all browsers.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 6 hours, 40 minutes
                  6h 40m