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

Fix html macro exception missing parameter value #7122

Conversation

pmario
Copy link
Member

@pmario pmario commented Dec 15, 2022

This PR fixes the problem where a macrocall with an empty parameter causes the RSOD
Also see the discussion at Talk

To preproduce

  • open tiddlywiki.com
  • create a tiddler with this content: <<list-links '[tag[HelloThere]]' field:>>
  • Activate the preview
  • The RSOD comes up.

image

The problem is this line

var domNode = this.document.createElementNS(this.namespace,this.tag);

.createElementNS() allows the second parameter createElementNS(namespaceURI, qualifiedName) to be a HTML tag name.

In this case this.tag -> qualifiedName contains the value field: ... where the : colon throws an exception. ...

This PR

  • creates an error message and
  • writes the JS-error string to the console.

image

@vercel
Copy link

vercel bot commented Dec 15, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
tiddlywiki5 ✅ Ready (Inspect) Visit Preview Dec 15, 2022 at 3:51AM (UTC)

@pmario
Copy link
Member Author

pmario commented Dec 15, 2022

@Jermolene ... Do not merge yet, since we will probably need a new translatable error text

@pmario
Copy link
Member Author

pmario commented Dec 15, 2022

If add console-error to the Logger class #7125 is merged I'd like to use the logger.error() function to create a red error message on the dev console, instead of an almost invisible log() message

@pmario
Copy link
Member Author

pmario commented Dec 20, 2022

@Jermolene Your latest fix for the genesis widget didn't fix this problem

@Jermolene
Copy link
Member

@Jermolene Your latest fix for the genesis widget didn't fix this problem

I had not seen this ticket.

@Jermolene
Copy link
Member

Thanks @pmario I'm going with a slightly different fix which is to silently correct the tag name; it's consistent with what we already do with unsafe elements.

@Jermolene Jermolene closed this in a5afed9 Dec 20, 2022
@pmario pmario deleted the fix-html-macro-exception-missing-parameter-value branch November 15, 2023 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants