Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Vue.js #188

Open
rbri opened this issue Jul 5, 2020 · 9 comments
Open

Support Vue.js #188

rbri opened this issue Jul 5, 2020 · 9 comments
Labels
js-engine Issues related to the js engine

Comments

@rbri
Copy link
Member

rbri commented Jul 5, 2020

Seems like this framework gets more and more popular.
This issue is about making sites using Vue.js working with HtmlUnit.

@rbri
Copy link
Member Author

rbri commented Jul 5, 2020

There is a first (failing) test case here: com.gargoylesoftware.htmlunit.libraries.VueTest

@rbri
Copy link
Member Author

rbri commented Jul 5, 2020

Finding 1:
The first problem seems to be related to a problem with Rhino's strict support. At least my minimal sample is working if i remove the 'use strict' from the vue.js code.

If you like you can try something like this as a workaround

    try (WebClient webClient = new WebClient(BrowserVersion.FIREFOX)) {

        new WebConnectionWrapper(webClient) {

            public WebResponse getResponse(final WebRequest request) throws IOException {
                WebResponse response = super.getResponse(request);
                if (MimeType.APPLICATION_JAVASCRIPT.equals(response.getContentType())) {
                    String content = response.getContentAsString();
                    content = content.replace("'use strict';", "");
                    content = content.replace("\"use strict\";", "");

                    final WebResponseData data = new WebResponseData(content.getBytes(),
                            response.getStatusCode(), response.getStatusMessage(), response.getResponseHeaders());
                    response = new WebResponse(data, request, response.getLoadTime());
                }
                return response;
            }
        };

        HtmlPage page = webClient.getPage(url);
        System.out.println(page.asXml());
    }

The reason is the same as #60. The Rhino issue is mozilla/rhino#403.
Will try to fix this in Rhino.

@rbri
Copy link
Member Author

rbri commented Jul 5, 2020

Made a first update of core-js. At least my super simple first test passes.
Please use the latest snapshot build and report your results.

@rbri
Copy link
Member Author

rbri commented Jul 7, 2020

Yesterday i have added another test case - this time a simple button with an action. Works also fine with the lastest core-js.

@danielkp1234
Copy link

@rbri Have you gotten time to figure out what is causing the vue.js error in the issue above
SeleniumHQ/htmlunit-driver#87

@rbri
Copy link
Member Author

rbri commented Aug 2, 2020

Sorry not really. Have done many things (see twitter for some of them). The most important are the fixes for NodeList - this hopefully brings some real progress for our js support. Will focus on finishing the FF79 and EDGE stuff during this week and can hopefully make a new version next weekend. Then i can come back to this.

@danielkp1234
Copy link

@rbri That sounds great :)

jogu added a commit to openid-certification/conformance-suite that referenced this issue Jun 12, 2021
use strict comes from:

HtmlUnit/htmlunit#188

but appears to go wrong in gzipped results.
jogu added a commit to openid-certification/conformance-suite that referenced this issue Jun 13, 2021
use strict comes from:

HtmlUnit/htmlunit#188

but appears to go wrong in gzipped results.
jogu added a commit to openid-certification/conformance-suite that referenced this issue Jun 13, 2021
use strict comes from:

HtmlUnit/htmlunit#188

but appears to go wrong in gzipped results.
jogu added a commit to openid-certification/conformance-suite that referenced this issue Jun 13, 2021
use strict comes from:

HtmlUnit/htmlunit#188

but appears to go wrong in gzipped results.
@trajano
Copy link

trajano commented Jun 23, 2022

This bug in mozilla/rhino#913 will prevent this construct which is used in Vue from working

  const PatchFlagNames = {
      [1 /* TEXT */]: `TEXT`,
      [2 /* CLASS */]: `CLASS`,
      [4 /* STYLE */]: `STYLE`,
      [8 /* PROPS */]: `PROPS`,
      [16 /* FULL_PROPS */]: `FULL_PROPS`,
      [32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
      [64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
      [128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
      [256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
      [512 /* NEED_PATCH */]: `NEED_PATCH`,
      [1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
      [2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
      [-1 /* HOISTED */]: `HOISTED`,
      [-2 /* BAIL */]: `BAIL`
  };

This can be quickly verified by https://www.jdoodle.com/execute-rhino-online/

image

@rbri
Copy link
Member Author

rbri commented Mar 27, 2024

see #755

@rbri rbri added the js-engine Issues related to the js engine label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
js-engine Issues related to the js engine
Projects
None yet
Development

No branches or pull requests

3 participants