Skip to content

Error executing JavaScript command #7

Closed

Description

@sco1

I'm receiving a JS error every time I attempt to modify a UI element.

For example, the demos from the readme:

myGUI = DOMdemoGUI;
mlapptools.fontColor(myGUI.TextArea, 'aqua');

Throws the following:

Error using matlab.internal.webwindow/executeJS (line 701)
Error executing JavaScript command:

	JavaScript error: Uncaught TypeError: dojo.query is not a function at line 1 column 18 in undefined

Error in mlapptools/getWidgetID (line 345)
                    widgetID = win.executeJS(widgetquerystr);

Error in mlapptools.getWebElements (line 104)
            widgetID = mlapptools.getWidgetID(win, mlapptools.getDataTag(uiElement));

Error in mlapptools.fontColor (line 54)
            [win, widgetID] = mlapptools.getWebElements(uiElement);

Error in trialcode (line 2)
mlapptools.fontColor(myGUI.TextArea, 'aqua');

On both Windows & Mac

Activity

  1. sco1 commented on Jan 2, 2018

    @sco1
    MemberAuthor

    Mac ver:

    -----------------------------------------------------------------------------------------------------
    MATLAB Version: 9.3.0.713579 (R2017b)
    MATLAB License Number:
    Operating System: Mac OS X  Version: 10.13.2 Build: 17C88 
    Java Version: Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
    -----------------------------------------------------------------------------------------------------
    MATLAB                                                Version 9.3         (R2017b)
    

    Windows ver:

    -----------------------------------------------------------------------------------------------------
    MATLAB Version: 9.3.0.713579 (R2017b)
    MATLAB License Number:
    Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 14393)
    Java Version: Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
    -----------------------------------------------------------------------------------------------------
    MATLAB                                                Version 9.3         (R2017b)
    
  2. Dev-iL commented on Jan 2, 2018

    @Dev-iL
    Member

    I tried running the code now - it resulted in an error on my 1st attempt, then it was ok. This sort of Heisenbug makes me think it is related to the logic that determines whether the figure finished loading (asynchronously...).

    Please try to run the 1st line separately, make sure that the figure is loaded, then run the 2nd line.

  3. sco1 commented on Jan 2, 2018

    @sco1
    MemberAuthor

    Confirming that executing the figure generating code first does resolve the issue on both OSes

  4. sco1 commented on Jan 2, 2018

    @sco1
    MemberAuthor

    Is this related to the issues we've run into previously with #1?

  5. Dev-iL commented on Jan 3, 2018

    @Dev-iL
    Member

    @sco1 Yes, I believe these issues are related.

    I think I came up with a better testing method based on the ideas in the other issue. Please test the solution I uploaded to my fork: Dev-iL@697f6c9

    If it works for you, I'll merge it and we can close the issues (at least until a new MATLAB version comes out).

  6. sco1 commented on Jan 3, 2018

    @sco1
    MemberAuthor

    I still need a bit of time to check some things out but it looks good for the most part.

    It does regress the issue identified & fixed in #5. 2bd87fc asserts that getWebWindow will get the ancestor automatically but it does not in the uipanel case:

    Reference to non-existent field 'PlatformHost'.
    
    Error in mlapptools.getWebWindow (line 121)
                    win = struct(hController.PlatformHost).CEF;
    
    Error in mlapptools.getWebElements (line 103)
                win = mlapptools.getWebWindow(uiElement);
    
    Error in mlapptools.fontWeight (line 67)
                [win, widgetID] = mlapptools.getWebElements(uiElement);
    
    Error in trialcode (line 6)
    mlapptools.fontWeight(txa, 'bold');
    

    Adding the ancestor check to getWebWindow quickly fixes this issue.

    This could also affect waitTillFigureLoaded since it assumes it's being passed a figure input, which might not necessarily be the case because the type enforcement happens elsewhere. That being said, it doesn't look like it will cause an overt error since it's checking for existence of struct(hFig).Controller, which is still present with a uipanel input.

    It would probably be best to go through and check on all of the input assumptions and make sure they're correct and type enforced as early as appropriate.

  7. Dev-iL commented on Jan 3, 2018

    @Dev-iL
    Member

    It doesn't regress, I just didn't add this change on my branch so as to avoid merge issues later on :)

  8. added a commit that references this issue on Jan 7, 2018
  9. sco1 commented on Jan 7, 2018

    @sco1
    MemberAuthor

    Should be fixed with #8 (947c54e)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions