Skip to content

WeakMap - TypeError: Expected argument of type object, but instead had type object  #373

Description

@SebastianPaulo

I use HTMLUnit to test a webpage with a 3rd party library (TinyMCE).
The library is using a WeakMap to has additional stuff for documents it stores (Documents being the keys of the WeakMap).
In all browsers this works fine.
However HTMLUnit is throwing a TypeError Expected argument of type object, but instead had type object (Which by description alone is kind of odd).

Investigation

I traced the problem to: documents are represented as DocumentProxy in HTMLUnit, which are not implementing Scriptable; and therefore not considered an object by Rhino (ScriptRuntime.isObject returns false).
Based on browser engines typeof domNode is object.

I think this is a bug, which needs a fix. However I am not sure if it's needed to be fix in htmlunit or in Rhino.

Steps to repeat

I attached a minimal reproduction project to illustrate the issue.
bug-demo.zip
(run ./gradlew test)

No activity

Activity on this issue will appear here.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions